mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
This commit was generated by cvs2svn to compensate for changes in r60484,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
32dca8efe6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=60485
6712
contrib/binutils/ChangeLog
Normal file
6712
contrib/binutils/ChangeLog
Normal file
File diff suppressed because it is too large
Load Diff
@ -35,6 +35,7 @@ includedir=${prefix}/include
|
||||
oldincludedir=/usr/include
|
||||
infodir=${prefix}/info
|
||||
mandir=${prefix}/man
|
||||
gxx_include_dir=${includedir}/g++
|
||||
|
||||
tooldir = $(exec_prefix)/$(target)
|
||||
|
||||
@ -49,12 +50,16 @@ man6dir = $(mandir)/man6
|
||||
man7dir = $(mandir)/man7
|
||||
man8dir = $(mandir)/man8
|
||||
man9dir = $(mandir)/man9
|
||||
infodir = $(prefix)/info
|
||||
includedir = $(prefix)/include
|
||||
# Directory in which the compiler finds executables, libraries, etc.
|
||||
libsubdir = $(libdir)/gcc-lib/$(target_alias)/$(gcc_version)
|
||||
GDB_NLM_DEPS =
|
||||
|
||||
SHELL = /bin/sh
|
||||
|
||||
# INSTALL_PROGRAM_ARGS is changed by configure.in to use -x for a
|
||||
# cygwin32 host.
|
||||
# cygwin host.
|
||||
INSTALL_PROGRAM_ARGS =
|
||||
|
||||
INSTALL = $(SHELL) $$s/install-sh -c
|
||||
@ -79,6 +84,7 @@ HOST_PREFIX_1 = loser-
|
||||
CFLAGS = -g
|
||||
CXXFLAGS = -g -O2
|
||||
|
||||
LDFLAGS =
|
||||
LIBCFLAGS = $(CFLAGS)
|
||||
CFLAGS_FOR_TARGET = $(CFLAGS)
|
||||
LDFLAGS_FOR_TARGET =
|
||||
@ -86,12 +92,14 @@ LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
|
||||
PICFLAG =
|
||||
PICFLAG_FOR_TARGET =
|
||||
|
||||
CHILLFLAGS = $(CFLAGS)
|
||||
CHILL_LIB = -lchill
|
||||
CXX = c++
|
||||
|
||||
# Use -O2 to stress test the compiler.
|
||||
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
|
||||
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates -fexceptions
|
||||
CXXFLAGS_FOR_TARGET = $(CXXFLAGS)
|
||||
LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
|
||||
LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates -fexceptions
|
||||
|
||||
RANLIB = ranlib
|
||||
|
||||
@ -102,12 +110,12 @@ NM = nm
|
||||
|
||||
LD = ld
|
||||
|
||||
# Not plain GZIP, since gzip looks there for extra command-line options.
|
||||
GZIPPROG = gzip
|
||||
BZIPPROG = bzip2
|
||||
|
||||
# These values are substituted by configure.
|
||||
DEFAULT_YACC = yacc
|
||||
DEFAULT_LEX = lex
|
||||
DEFAULT_M4 = m4
|
||||
|
||||
BISON = `if [ -f $$r/bison/bison ] ; then \
|
||||
echo $$r/bison/bison -L $$s/bison/ ; \
|
||||
@ -129,7 +137,7 @@ LEX = `if [ -f $$r/flex/flex ] ; \
|
||||
|
||||
M4 = `if [ -f $$r/m4/m4 ] ; \
|
||||
then echo $$r/m4/m4 ; \
|
||||
else echo m4 ; fi`
|
||||
else echo ${DEFAULT_M4} ; fi`
|
||||
|
||||
MAKEINFO = `if [ -f $$r/texinfo/makeinfo/Makefile ] ; \
|
||||
then echo $$r/texinfo/makeinfo/makeinfo ; \
|
||||
@ -159,7 +167,9 @@ 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 newlib libio librx libstdc++ libg++ winsup opcodes cygmon
|
||||
|
||||
|
||||
TARGET_CONFIGDIRS = libiberty libgloss $(SPECIAL_LIBS) newlib libio librx libstdc++ libg++ winsup opcodes bsp libstub cygmon
|
||||
|
||||
# Target libraries are put under this directory:
|
||||
# Changed by configure to $(target_alias) if cross.
|
||||
@ -178,7 +188,11 @@ RPATH_ENVVAR = LD_LIBRARY_PATH
|
||||
|
||||
# configure.in sets SET_LIB_PATH to this if --enable-shared was used.
|
||||
REALLY_SET_LIB_PATH = \
|
||||
$(RPATH_ENVVAR)=$$r/bfd:$$r/opcodes:$$$(RPATH_ENVVAR); \
|
||||
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);
|
||||
|
||||
ALL = all.normal
|
||||
@ -189,15 +203,24 @@ INSTALL_TARGET = installdirs \
|
||||
$(INSTALL_X11_MODULES) \
|
||||
$(INSTALL_DOSREL)
|
||||
|
||||
INSTALL_TARGET_CROSS = installdirs \
|
||||
install-gcc-cross \
|
||||
$(INSTALL_MODULES) \
|
||||
$(INSTALL_TARGET_MODULES) \
|
||||
$(INSTALL_X11_MODULES) \
|
||||
$(INSTALL_DOSREL)
|
||||
|
||||
CC_FOR_TARGET = ` \
|
||||
if [ -f $$r/gcc/xgcc ] ; then \
|
||||
if [ -f $$r/$(TARGET_SUBDIR)/newlib/Makefile ] ; then \
|
||||
if [ -f $$r/$(TARGET_SUBDIR)/winsup/Makefile ] ; then \
|
||||
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/newlib/libc/include -nostdinc; \
|
||||
else \
|
||||
echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \
|
||||
fi; \
|
||||
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; \
|
||||
@ -215,15 +238,28 @@ CC_FOR_TARGET = ` \
|
||||
# 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 \
|
||||
if [ -f $$r/$(TARGET_SUBDIR)/winsup/Makefile ] ; then \
|
||||
echo $$r/gcc/xgcc -B$$r/gcc/ -B$$r/$(TARGET_SUBDIR)/newlib/ -L$$r/winsup -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \
|
||||
else \
|
||||
echo $$r/gcc/xgcc -B$$r/gcc/ -idirafter $$r/$(TARGET_SUBDIR)/newlib/targ-include -idirafter $$s/newlib/libc/include -nostdinc; \
|
||||
fi; \
|
||||
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; \
|
||||
@ -312,6 +348,18 @@ NM_FOR_TARGET = ` \
|
||||
fi; \
|
||||
fi`
|
||||
|
||||
# The first rule in the file had better be this one. Don't put any above it.
|
||||
# This lives here to allow makefile fragments to contain dependencies.
|
||||
all: all.normal
|
||||
.PHONY: all
|
||||
|
||||
# These can be overridden by config/mt-*.
|
||||
# The _TARGET_ is because they're specified in mt-foo.
|
||||
# The _HOST_ is because they're programs that run on the host.
|
||||
EXTRA_TARGET_HOST_ALL_MODULES =
|
||||
EXTRA_TARGET_HOST_INSTALL_MODULES =
|
||||
EXTRA_TARGET_HOST_CHECK_MODULES =
|
||||
|
||||
#### host and target specific makefile fragments come in here.
|
||||
###
|
||||
|
||||
@ -326,6 +374,9 @@ BASE_FLAGS_TO_PASS = \
|
||||
"CC_FOR_TARGET=$(CC_FOR_TARGET)" \
|
||||
"CFLAGS=$(CFLAGS)" \
|
||||
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
|
||||
"CHILLFLAGS=$(CHILLFLAGS)" \
|
||||
"CHILL_FOR_TARGET=$(CHILL_FOR_TARGET)" \
|
||||
"CHILL_LIB=$(CHILL_LIB)" \
|
||||
"CXX_FOR_BUILD=$(CXX_FOR_BUILD)" \
|
||||
"CXXFLAGS=$(CXXFLAGS)" \
|
||||
"CXXFLAGS_FOR_TARGET=$(CXXFLAGS_FOR_TARGET)" \
|
||||
@ -346,14 +397,13 @@ BASE_FLAGS_TO_PASS = \
|
||||
"MAKE=$(MAKE)" \
|
||||
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
|
||||
"NM_FOR_TARGET=$(NM_FOR_TARGET)" \
|
||||
"PICFLAG=$(PICFLAG)" \
|
||||
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
|
||||
"RANLIB_FOR_TARGET=$(RANLIB_FOR_TARGET)" \
|
||||
"RPATH_ENVVAR=$(RPATH_ENVVAR)" \
|
||||
"SHELL=$(SHELL)" \
|
||||
"EXPECT=$(EXPECT)" \
|
||||
"RUNTEST=$(RUNTEST)" \
|
||||
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
|
||||
"TARGET_SUBDIR=$(TARGET_SUBDIR)" \
|
||||
"WINDRES_FOR_TARGET=$(WINDRES_FOR_TARGET)" \
|
||||
"YACC=$(YACC)" \
|
||||
"bindir=$(bindir)" \
|
||||
@ -371,7 +421,12 @@ BASE_FLAGS_TO_PASS = \
|
||||
"sbindir=$(sbindir)" \
|
||||
"sharedstatedir=$(sharedstatedir)" \
|
||||
"sysconfdir=$(sysconfdir)" \
|
||||
"tooldir=$(tooldir)"
|
||||
"tooldir=$(tooldir)" \
|
||||
"gxx_include_dir=$(gxx_include_dir)" \
|
||||
"gcc_version=$(gcc_version)" \
|
||||
"gcc_version_trigger=$(gcc_version_trigger)" \
|
||||
"target_alias=$(target_alias)" \
|
||||
"libsubdir=$(libsubdir)"
|
||||
|
||||
# Flags to pass down to most sub-makes, in which we're building with
|
||||
# the host environment.
|
||||
@ -417,7 +472,6 @@ EXTRA_TARGET_FLAGS = \
|
||||
'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
|
||||
'LIBCXXFLAGS=$$(LIBCXXFLAGS_FOR_TARGET)' \
|
||||
'NM=$$(NM_FOR_TARGET)' \
|
||||
'PICFLAG=$$(PICFLAG_FOR_TARGET)' \
|
||||
'RANLIB=$$(RANLIB_FOR_TARGET)' \
|
||||
'WINDRES=$$(WINDRES_FOR_TARGET)'
|
||||
|
||||
@ -430,7 +484,7 @@ TARGET_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_TARGET_FLAGS)
|
||||
# The HOST_* variables are a special case, which are used for the gcc
|
||||
# cross-building scheme.
|
||||
EXTRA_GCC_FLAGS = \
|
||||
'AR=$$(AR_FOR_TARGET)' \
|
||||
'AR=$(AR)' \
|
||||
'AS=$(AS)' \
|
||||
'CC=$(CC)' \
|
||||
'CXX=$(CXX)' \
|
||||
@ -439,18 +493,18 @@ EXTRA_GCC_FLAGS = \
|
||||
'HOST_PREFIX=$(HOST_PREFIX)' \
|
||||
'HOST_PREFIX_1=$(HOST_PREFIX_1)' \
|
||||
'NM=$(NM)' \
|
||||
'RANLIB=$$(RANLIB_FOR_TARGET)' \
|
||||
'RANLIB=$(RANLIB)' \
|
||||
'WINDRES=$$(WINDRES_FOR_TARGET)' \
|
||||
"GCC_FOR_TARGET=$(GCC_FOR_TARGET)" \
|
||||
"`if test x'$(LANGUAGES)' != x; then echo 'LANGUAGES=$(LANGUAGES)'; else echo 'XFOO=bar'; fi`" \
|
||||
"`if test x'$(STMP_FIXPROTO)' != x; then echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)'; else echo 'XFOO=bar'; fi`" \
|
||||
"`if test x'$(LIMITS_H_TEST)' != x; then echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)'; else echo 'XFOO=bar'; fi`" \
|
||||
"`if test x'$(LIBGCC1_TEST)' != x; then echo 'LIBGCC1_TEST=$(LIBGCC1_TEST)'; else echo 'XFOO=bar'; fi`" \
|
||||
"`if test x'$(LIBGCC2_CFLAGS)' != x; then echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)'; else echo 'XFOO=bar'; fi`" \
|
||||
"`if test x'$(LIBGCC2_DEBUG_CFLAGS)' != x; then echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)'; else echo 'XFOO=bar'; fi`" \
|
||||
"`if test x'$(LIBGCC2_INCLUDES)' != x; then echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)'; else echo 'XFOO=bar'; fi`" \
|
||||
"`if test x'$(ENQUIRE)' != x; then echo 'ENQUIRE=$(ENQUIRE)'; else echo 'XFOO=bar'; fi`" \
|
||||
"`if test x'$(BOOT_CFLAGS)' != x; then echo 'BOOT_CFLAGS=$(BOOT_CFLAGS)'; else echo 'XFOO=bar'; fi`"
|
||||
"`echo 'LANGUAGES=$(LANGUAGES)' | sed -e s/.*=$$/XFOO=/`" \
|
||||
"`echo 'STMP_FIXPROTO=$(STMP_FIXPROTO)' | sed -e s/.*=$$/XFOO=/`" \
|
||||
"`echo 'LIMITS_H_TEST=$(LIMITS_H_TEST)' | sed -e s/.*=$$/XFOO=/`" \
|
||||
"`echo 'LIBGCC1_TEST=$(LIBGCC1_TEST)' | sed -e s/.*=$$/XFOO=/`" \
|
||||
"`echo 'LIBGCC2_CFLAGS=$(LIBGCC2_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \
|
||||
"`echo 'LIBGCC2_DEBUG_CFLAGS=$(LIBGCC2_DEBUG_CFLAGS)' | sed -e s/.*=$$/XFOO=/`" \
|
||||
"`echo 'LIBGCC2_INCLUDES=$(LIBGCC2_INCLUDES)' | sed -e s/.*=$$/XFOO=/`" \
|
||||
"`echo 'ENQUIRE=$(ENQUIRE)' | sed -e s/.*=$$/XFOO=/`" \
|
||||
"`echo 'BOOT_CFLAGS=$(BOOT_CFLAGS)' | sed -e s/.*=$$/XFOO=/`"
|
||||
|
||||
GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS)
|
||||
|
||||
@ -458,6 +512,7 @@ GCC_FLAGS_TO_PASS = $(BASE_FLAGS_TO_PASS) $(EXTRA_GCC_FLAGS)
|
||||
# using $(FLAGS_TO_PASS).
|
||||
ALL_MODULES = \
|
||||
all-apache \
|
||||
all-ash \
|
||||
all-autoconf \
|
||||
all-automake \
|
||||
all-bash \
|
||||
@ -465,6 +520,7 @@ ALL_MODULES = \
|
||||
all-binutils \
|
||||
all-bison \
|
||||
all-byacc \
|
||||
all-bzip2 \
|
||||
all-cvssrc \
|
||||
all-db \
|
||||
all-dejagnu \
|
||||
@ -492,6 +548,7 @@ ALL_MODULES = \
|
||||
all-ld \
|
||||
all-libgui \
|
||||
all-libiberty \
|
||||
all-libtool \
|
||||
all-m4 \
|
||||
all-make \
|
||||
all-mmalloc \
|
||||
@ -507,15 +564,17 @@ ALL_MODULES = \
|
||||
all-send-pr \
|
||||
all-shellutils \
|
||||
all-sim \
|
||||
all-snavigator \
|
||||
all-tar \
|
||||
all-tcl \
|
||||
all-tcl8.1 \
|
||||
all-texinfo \
|
||||
all-textutils \
|
||||
all-tgas \
|
||||
all-time \
|
||||
all-uudecode \
|
||||
all-wdiff
|
||||
all-wdiff \
|
||||
all-zip \
|
||||
$(EXTRA_TARGET_HOST_ALL_MODULES)
|
||||
|
||||
# This is a list of the check targets for all of the modules which are
|
||||
# compiled using $(FLAGS_TO_PASS).
|
||||
@ -526,15 +585,18 @@ ALL_MODULES = \
|
||||
NATIVE_CHECK_MODULES = \
|
||||
check-bison \
|
||||
check-byacc \
|
||||
check-flex
|
||||
check-flex \
|
||||
check-zip
|
||||
|
||||
CROSS_CHECK_MODULES = \
|
||||
check-apache \
|
||||
check-ash \
|
||||
check-autoconf \
|
||||
check-automake \
|
||||
check-bash \
|
||||
check-bfd \
|
||||
check-binutils \
|
||||
check-bzip2 \
|
||||
check-cvssrc \
|
||||
check-db \
|
||||
check-dejagnu \
|
||||
@ -559,6 +621,7 @@ CROSS_CHECK_MODULES = \
|
||||
check-ld \
|
||||
check-libgui \
|
||||
check-libiberty \
|
||||
check-libtool \
|
||||
check-m4 \
|
||||
check-make \
|
||||
check-mmcheckoc \
|
||||
@ -572,7 +635,6 @@ CROSS_CHECK_MODULES = \
|
||||
check-sed \
|
||||
check-send-pr \
|
||||
check-shellutils \
|
||||
check-snavigator \
|
||||
check-sim \
|
||||
check-tar \
|
||||
check-tcl \
|
||||
@ -581,7 +643,8 @@ CROSS_CHECK_MODULES = \
|
||||
check-tgas \
|
||||
check-time \
|
||||
check-uudecode \
|
||||
check-wdiff
|
||||
check-wdiff \
|
||||
$(EXTRA_TARGET_HOST_CHECK_MODULES)
|
||||
|
||||
CHECK_MODULES=$(NATIVE_CHECK_MODULES) $(CROSS_CHECK_MODULES)
|
||||
|
||||
@ -594,10 +657,12 @@ CHECK_MODULES=$(NATIVE_CHECK_MODULES) $(CROSS_CHECK_MODULES)
|
||||
# program on installation which uses the Tcl libraries.
|
||||
INSTALL_MODULES = \
|
||||
install-apache \
|
||||
install-ash \
|
||||
install-autoconf \
|
||||
install-automake \
|
||||
install-bash \
|
||||
install-bfd \
|
||||
install-bzip2 \
|
||||
install-opcodes \
|
||||
install-binutils \
|
||||
install-bison \
|
||||
@ -626,10 +691,12 @@ INSTALL_MODULES = \
|
||||
install-intl \
|
||||
install-ispell \
|
||||
install-tcl \
|
||||
install-tcl8.1 \
|
||||
install-itcl \
|
||||
install-ld \
|
||||
install-libgui \
|
||||
install-libiberty \
|
||||
install-libtool \
|
||||
install-m4 \
|
||||
install-make \
|
||||
install-mmalloc \
|
||||
@ -643,13 +710,15 @@ INSTALL_MODULES = \
|
||||
install-send-pr \
|
||||
install-shellutils \
|
||||
install-sim \
|
||||
install-snavigator \
|
||||
install-tar \
|
||||
install-texinfo \
|
||||
install-textutils \
|
||||
install-tgas \
|
||||
install-time \
|
||||
install-uudecode \
|
||||
install-wdiff
|
||||
install-wdiff \
|
||||
install-zip \
|
||||
$(EXTRA_TARGET_HOST_INSTALL_MODULES)
|
||||
|
||||
# This is a list of the targets for all of the modules which are compiled
|
||||
# using $(X11_FLAGS_TO_PASS).
|
||||
@ -662,6 +731,7 @@ ALL_X11_MODULES = \
|
||||
all-guile \
|
||||
all-tclX \
|
||||
all-tk \
|
||||
all-tk8.1 \
|
||||
all-tix
|
||||
|
||||
# This is a list of the check targets for all of the modules which are
|
||||
@ -687,6 +757,7 @@ INSTALL_X11_MODULES = \
|
||||
install-gash \
|
||||
install-tclX \
|
||||
install-tk \
|
||||
install-tk8.1 \
|
||||
install-tix
|
||||
|
||||
# This is a list of the targets for all of the modules which are compiled
|
||||
@ -697,11 +768,14 @@ ALL_TARGET_MODULES = \
|
||||
all-target-librx \
|
||||
all-target-libg++ \
|
||||
all-target-newlib \
|
||||
all-target-libtermcap \
|
||||
all-target-winsup \
|
||||
all-target-libgloss \
|
||||
all-target-libiberty \
|
||||
all-target-gperf \
|
||||
all-target-examples \
|
||||
all-target-libstub \
|
||||
all-target-bsp \
|
||||
all-target-cygmon
|
||||
|
||||
# This is a list of the configure targets for all of the modules which
|
||||
@ -712,11 +786,14 @@ CONFIGURE_TARGET_MODULES = \
|
||||
configure-target-librx \
|
||||
configure-target-libg++ \
|
||||
configure-target-newlib \
|
||||
configure-target-libtermcap \
|
||||
configure-target-winsup \
|
||||
configure-target-libgloss \
|
||||
configure-target-libiberty \
|
||||
configure-target-gperf \
|
||||
configure-target-examples \
|
||||
configure-target-libstub \
|
||||
configure-target-bsp \
|
||||
configure-target-cygmon
|
||||
|
||||
# This is a list of the check targets for all of the modules which are
|
||||
@ -737,14 +814,17 @@ INSTALL_TARGET_MODULES = \
|
||||
install-target-libstdc++ \
|
||||
install-target-libg++ \
|
||||
install-target-newlib \
|
||||
install-target-libtermcap \
|
||||
install-target-winsup \
|
||||
install-target-libgloss \
|
||||
install-target-libiberty \
|
||||
install-target-bsp \
|
||||
install-target-gperf
|
||||
|
||||
# This is a list of the targets for which we can do a clean-{target}.
|
||||
CLEAN_MODULES = \
|
||||
clean-apache \
|
||||
clean-ash \
|
||||
clean-autoconf \
|
||||
clean-automake \
|
||||
clean-bash \
|
||||
@ -752,6 +832,7 @@ CLEAN_MODULES = \
|
||||
clean-binutils \
|
||||
clean-bison \
|
||||
clean-byacc \
|
||||
clean-bzip2 \
|
||||
clean-cvssrc \
|
||||
clean-db \
|
||||
clean-dejagnu \
|
||||
@ -779,6 +860,7 @@ CLEAN_MODULES = \
|
||||
clean-ld \
|
||||
clean-libgui \
|
||||
clean-libiberty \
|
||||
clean-libtool \
|
||||
clean-m4 \
|
||||
clean-make \
|
||||
clean-mmalloc \
|
||||
@ -794,7 +876,6 @@ CLEAN_MODULES = \
|
||||
clean-send-pr \
|
||||
clean-shellutils \
|
||||
clean-sim \
|
||||
clean-snavigator \
|
||||
clean-tar \
|
||||
clean-tcl \
|
||||
clean-texinfo \
|
||||
@ -802,7 +883,8 @@ CLEAN_MODULES = \
|
||||
clean-tgas \
|
||||
clean-time \
|
||||
clean-uudecode \
|
||||
clean-wdiff
|
||||
clean-wdiff \
|
||||
clean-zip
|
||||
|
||||
# All of the target modules that can be cleaned
|
||||
CLEAN_TARGET_MODULES = \
|
||||
@ -816,6 +898,8 @@ CLEAN_TARGET_MODULES = \
|
||||
clean-target-libiberty \
|
||||
clean-target-gperf \
|
||||
clean-target-examples \
|
||||
clean-target-libstub \
|
||||
clean-target-bsp \
|
||||
clean-target-cygmon
|
||||
|
||||
# All of the x11 modules that can be cleaned
|
||||
@ -830,10 +914,6 @@ CLEAN_X11_MODULES = \
|
||||
clean-tk \
|
||||
clean-tix
|
||||
|
||||
# The first rule in the file had better be this one. Don't put any above it.
|
||||
all: all.normal
|
||||
.PHONY: all
|
||||
|
||||
# The target built for a native build.
|
||||
.PHONY: all.normal
|
||||
all.normal: \
|
||||
@ -928,10 +1008,10 @@ install-info: do-install-info dir.info
|
||||
else true ; fi
|
||||
|
||||
local-clean:
|
||||
-rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E
|
||||
-rm -f *.a TEMP errs core *.o *~ \#* TAGS *.E *.log
|
||||
|
||||
local-distclean:
|
||||
-rm -f Makefile config.status config.cache
|
||||
-rm -f Makefile config.status config.cache mh-frag mt-frag
|
||||
-if [ "$(TARGET_SUBDIR)" != "." ]; then \
|
||||
rm -rf $(TARGET_SUBDIR); \
|
||||
else true; fi
|
||||
@ -983,10 +1063,32 @@ check: $(CHECK_MODULES) \
|
||||
$(CHECK_X11_MODULES) \
|
||||
check-gcc
|
||||
|
||||
# Automated reporting of test results.
|
||||
|
||||
warning.log: build.log
|
||||
$(srcdir)/contrib/warn_summary build.log > $@
|
||||
|
||||
mail-report.log:
|
||||
if test x'$(BOOT_CFLAGS)' != x''; then \
|
||||
BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
|
||||
fi; \
|
||||
$(srcdir)/contrib/test_summary -t >$@
|
||||
chmod +x $@
|
||||
echo If you really want to send e-mail, run ./$@ now
|
||||
|
||||
mail-report-with-warnings.log: warning.log
|
||||
if test x'$(BOOT_CFLAGS)' != x''; then \
|
||||
BOOT_CFLAGS='$(BOOT_CFLAGS)'; export BOOT_CFLAGS; \
|
||||
fi; \
|
||||
$(srcdir)/contrib/test_summary -t -i warning.log >$@
|
||||
chmod +x $@
|
||||
echo If you really want to send e-mail, run ./$@ now
|
||||
|
||||
# Installation targets.
|
||||
|
||||
.PHONY: install uninstall source-vault binary-vault vault-install
|
||||
.PHONY: install install-cross uninstall source-vault binary-vault vault-install
|
||||
install: $(INSTALL_TARGET)
|
||||
install-cross: $(INSTALL_TARGET_CROSS)
|
||||
|
||||
uninstall:
|
||||
@echo "the uninstall target is not supported in this tree"
|
||||
@ -1196,14 +1298,23 @@ $(CONFIGURE_TARGET_MODULES):
|
||||
libsrcdir="$$s/$${dir}"; \
|
||||
fi; \
|
||||
if [ -f $${libsrcdir}/configure ] ; then \
|
||||
$(SHELL) $${libsrcdir}/configure \
|
||||
rm -f no-such-file skip-this-dir; \
|
||||
CONFIG_SITE=no-such-file $(SHELL) $${libsrcdir}/configure \
|
||||
$(CONFIG_ARGUMENTS) $${srcdiroption} \
|
||||
--with-target-subdir="$(TARGET_SUBDIR)"; \
|
||||
else \
|
||||
$(SHELL) $$s/configure \
|
||||
rm -f no-such-file skip-this-dir; \
|
||||
CONFIG_SITE=no-such-file $(SHELL) $$s/configure \
|
||||
$(CONFIG_ARGUMENTS) $${srcdiroption} \
|
||||
--with-target-subdir="$(TARGET_SUBDIR)"; \
|
||||
fi; \
|
||||
if [ -f skip-this-dir ] ; then \
|
||||
sh skip-this-dir; \
|
||||
rm -f skip-this-dir; \
|
||||
cd ..; rmdir $${dir} || true; \
|
||||
else \
|
||||
true; \
|
||||
fi; \
|
||||
else \
|
||||
true; \
|
||||
fi; \
|
||||
@ -1312,16 +1423,57 @@ all-gcc:
|
||||
true; \
|
||||
fi
|
||||
|
||||
.PHONY: all-bootstrap
|
||||
all-bootstrap:
|
||||
@if [ -f ./gcc/Makefile ] ; then \
|
||||
r=`pwd`; export r; \
|
||||
s=`cd $(srcdir); pwd`; export s; \
|
||||
$(SET_LIB_PATH) \
|
||||
(cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) bootstrap); \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
# Building GCC uses some tools for rebuilding "source" files
|
||||
# like texinfo, bison/byacc, etc. So we must depend on those.
|
||||
#
|
||||
# While building GCC, it may be necessary to run various target
|
||||
# programs like the assembler, linker, etc. So we depend on
|
||||
# those too.
|
||||
#
|
||||
# In theory, on an SMP all those dependencies can be resolved
|
||||
# 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
|
||||
@r=`pwd`; export r; \
|
||||
s=`cd $(srcdir); pwd`; export s; \
|
||||
$(SET_LIB_PATH) \
|
||||
echo "Bootstrapping the compiler"; \
|
||||
cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) $@
|
||||
@r=`pwd`; export r; \
|
||||
s=`cd $(srcdir); pwd`; export s; \
|
||||
case "$@" in \
|
||||
*bootstrap4-lean ) \
|
||||
msg="Comparing stage3 and stage4 of the compiler"; \
|
||||
compare=compare3-lean ;; \
|
||||
*bootstrap4 ) msg="Comparing stage3 and stage4 of the compiler"; \
|
||||
compare=compare3 ;; \
|
||||
*-lean ) msg="Comparing stage2 and stage3 of the compiler"; \
|
||||
compare=compare-lean ;; \
|
||||
* ) msg="Comparing stage2 and stage3 of the compiler"; \
|
||||
compare=compare ;; \
|
||||
esac; \
|
||||
$(SET_LIB_PATH) \
|
||||
echo "$$msg"; \
|
||||
cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) $$compare
|
||||
@r=`pwd`; export r; \
|
||||
s=`cd $(srcdir); pwd` ; export s; \
|
||||
$(SET_LIB_PATH) \
|
||||
echo "Building runtime libraries"; \
|
||||
$(MAKE) $(BASE_FLAGS_TO_PASS) all
|
||||
|
||||
.PHONY: cross
|
||||
cross: all-texinfo all-bison all-byacc all-binutils all-gas all-ld
|
||||
@r=`pwd`; export r; \
|
||||
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++"
|
||||
@r=`pwd`; export r; \
|
||||
s=`cd $(srcdir); pwd` ; export s; \
|
||||
$(SET_LIB_PATH) \
|
||||
echo "Building runtime libraries"; \
|
||||
$(MAKE) $(BASE_FLAGS_TO_PASS) all LANGUAGES="c c++"
|
||||
|
||||
.PHONY: check-gcc
|
||||
check-gcc:
|
||||
@ -1345,7 +1497,16 @@ install-gcc:
|
||||
true; \
|
||||
fi
|
||||
|
||||
|
||||
.PHONY: install-gcc-cross
|
||||
install-gcc-cross:
|
||||
@if [ -f ./gcc/Makefile ] ; then \
|
||||
r=`pwd`; export r; \
|
||||
s=`cd $(srcdir); pwd`; export s; \
|
||||
$(SET_LIB_PATH) \
|
||||
(cd gcc; $(MAKE) $(GCC_FLAGS_TO_PASS) LANGUAGES="c c++" install); \
|
||||
else \
|
||||
true; \
|
||||
fi
|
||||
# EXPERIMENTAL STUFF
|
||||
# This rule is used to install the modules which use FLAGS_TO_PASS.
|
||||
# To build a target install-X means to cd to X and make install.
|
||||
@ -1366,16 +1527,20 @@ install-dosrel-fake:
|
||||
|
||||
# This is a list of inter-dependencies among modules.
|
||||
all-apache:
|
||||
all-ash:
|
||||
all-autoconf: all-m4 all-texinfo
|
||||
all-automake:
|
||||
all-automake: all-m4 all-texinfo
|
||||
all-bash:
|
||||
all-bfd:
|
||||
all-binutils: all-libiberty all-opcodes all-bfd all-flex all-bison all-byacc
|
||||
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
|
||||
all-byacc:
|
||||
all-bzip2:
|
||||
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-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
|
||||
all-db:
|
||||
all-dejagnu: all-tcl all-expect all-tk
|
||||
all-diff: all-libiberty
|
||||
@ -1389,7 +1554,7 @@ all-fileutils: all-libiberty
|
||||
all-findutils:
|
||||
all-find:
|
||||
all-flex: all-libiberty all-bison all-byacc
|
||||
all-gas: all-libiberty all-opcodes all-bfd
|
||||
all-gas: all-libiberty all-opcodes all-bfd all-intl
|
||||
all-gash: all-tcl
|
||||
all-gawk:
|
||||
ALL_GCC = all-gcc
|
||||
@ -1401,8 +1566,7 @@ all-gettext:
|
||||
all-gnuserv:
|
||||
configure-target-gperf: $(ALL_GCC)
|
||||
all-target-gperf: configure-target-gperf all-target-libiberty all-target-libstdc++
|
||||
all-gprof: all-libiberty all-bfd all-opcodes
|
||||
all-grep: all-libiberty
|
||||
all-gprof: all-libiberty all-bfd all-opcodes all-intl
|
||||
all-grez: all-libiberty all-bfd all-opcodes
|
||||
all-gui: all-gdb all-libproc all-target-librx
|
||||
all-guile:
|
||||
@ -1412,26 +1576,31 @@ all-indent:
|
||||
all-inet: all-tcl all-send-pr all-perl
|
||||
all-intl:
|
||||
all-ispell: all-emacs19
|
||||
all-itcl: all-tcl all-tk
|
||||
all-ld: all-libiberty all-bfd all-opcodes all-bison all-byacc all-flex
|
||||
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-libgloss: $(ALL_GCC)
|
||||
all-target-libgloss: configure-target-libgloss configure-target-newlib
|
||||
configure-target-libio: $(ALL_GCC)
|
||||
all-target-libio: configure-target-libio all-gas all-ld all-gcc all-target-libiberty all-target-newlib
|
||||
check-target-libio: all-target-libstdc++
|
||||
all-libgui: all-tcl all-tk all-itcl
|
||||
check-target-libio:
|
||||
all-libgui: all-tcl all-tk all-tcl8.1 all-tk8.1 all-itcl
|
||||
all-libiberty:
|
||||
configure-target-librx: $(ALL_GCC) configure-target-newlib
|
||||
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)
|
||||
all-target-libstub: configure-target-libstub
|
||||
all-libtool:
|
||||
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-patch: all-libiberty
|
||||
all-perl:
|
||||
@ -1443,25 +1612,27 @@ all-sed: all-libiberty
|
||||
all-send-pr: all-prms
|
||||
all-shellutils:
|
||||
all-sim: all-libiberty all-bfd all-opcodes all-readline
|
||||
all-snavigator: all-tcl all-tk all-tix all-itcl all-db all-grep
|
||||
all-tar: all-libiberty
|
||||
all-tcl:
|
||||
all-tcl8.1:
|
||||
all-tclX: all-tcl all-tk
|
||||
all-tk: all-tcl
|
||||
all-tk8.1: all-tcl8.1
|
||||
all-texinfo: all-libiberty
|
||||
all-textutils:
|
||||
all-tgas: all-libiberty all-bfd all-opcodes
|
||||
all-time:
|
||||
all-tix: all-tcl all-tk
|
||||
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-libio configure-target-winsup
|
||||
all-target-winsup: all-target-newlib all-target-libiberty all-target-libtermcap configure-target-winsup
|
||||
configure-target-winsup: configure-target-newlib
|
||||
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-target: $(ALL_TARGET_MODULES)
|
||||
install-target: $(INSTALL_TARGET_MODULES)
|
||||
install-gdbtk: install-tcl install-tk install-itcl install-tix install-libgui install-gdb
|
||||
install-gdb: install-tcl install-tk install-itcl install-tix install-libgui
|
||||
### other supporting targets
|
||||
|
||||
MAKEDIRS= \
|
||||
@ -1494,7 +1665,7 @@ TAGS: do-TAGS
|
||||
|
||||
# with the gnu make, this is done automatically.
|
||||
|
||||
Makefile: Makefile.in configure.in $(host_makefile_frag) $(target_makefile_frag)
|
||||
Makefile: Makefile.in configure.in $(host_makefile_frag) $(target_makefile_frag) $(gcc_version_trigger)
|
||||
$(SHELL) ./config.status
|
||||
|
||||
#
|
||||
@ -1504,7 +1675,7 @@ Makefile: Makefile.in configure.in $(host_makefile_frag) $(target_makefile_frag)
|
||||
# ChangeLog omitted because it may refer to files which are not in this
|
||||
# distribution (perhaps it would be better to include it anyway).
|
||||
DEVO_SUPPORT= README Makefile.in configure configure.in \
|
||||
config.guess config.sub config move-if-change \
|
||||
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
|
||||
@ -1521,9 +1692,8 @@ SUPPORT_FILES = list-of-support-files-for-tool-in-question
|
||||
|
||||
.PHONY: taz
|
||||
|
||||
taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) \
|
||||
texinfo/texinfo.tex texinfo/gpl.texinfo texinfo/lgpl.texinfo
|
||||
# Take out texinfo from a few places; make simple BISON=bison line.
|
||||
taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) texinfo/texinfo.tex
|
||||
# Take out texinfo from a few places.
|
||||
sed -e '/^all\.normal: /s/\all-texinfo //' \
|
||||
-e '/^ install-texinfo /d' \
|
||||
<Makefile.in >tmp
|
||||
@ -1567,68 +1737,94 @@ taz: $(DEVO_SUPPORT) $(SUPPORT_FILES) \
|
||||
#
|
||||
mkdir proto-toplev/texinfo
|
||||
ln -s ../../texinfo/texinfo.tex proto-toplev/texinfo/
|
||||
ln -s ../../texinfo/gpl.texinfo proto-toplev/texinfo/
|
||||
ln -s ../../texinfo/lgpl.texinfo proto-toplev/texinfo/
|
||||
if test -r texinfo/util/tex3patch ; then \
|
||||
mkdir proto-toplev/texinfo/util && \
|
||||
ln -s ../../../texinfo/util/tex3patch proto-toplev/texinfo/util ; \
|
||||
else true; fi
|
||||
chmod og=u `find . -print`
|
||||
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; \
|
||||
$(MAKE) -f Makefile.in do-tar-gz TOOL=$(TOOL) VER=$$ver
|
||||
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-gz:
|
||||
echo "==> Making $(TOOL)-$(VER).tar.gz"
|
||||
-rm -f $(TOOL)-$(VER)
|
||||
ln -s proto-toplev $(TOOL)-$(VER)
|
||||
tar cfh $(TOOL)-$(VER).tar $(TOOL)-$(VER)
|
||||
$(GZIPPROG) -v -9 $(TOOL)-$(VER).tar
|
||||
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)
|
||||
$(BZIPPROG) -v -9 $(PACKAGE)-$(VER).tar
|
||||
|
||||
TEXINFO_SUPPORT= texinfo/texinfo.tex texinfo/gpl.texinfo texinfo/lgpl.texinfo
|
||||
TEXINFO_SUPPORT= texinfo/texinfo.tex
|
||||
DIST_SUPPORT= $(DEVO_SUPPORT) $(TEXINFO_SUPPORT)
|
||||
|
||||
.PHONY: gas.tar.gz
|
||||
GAS_SUPPORT_DIRS= bfd include libiberty opcodes setup.com makefile.vms
|
||||
gas.tar.gz: $(DIST_SUPPORT) $(GAS_SUPPORT_DIRS) gas
|
||||
.PHONY: gas.tar.bz2
|
||||
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 \
|
||||
SUPPORT_FILES="$(GAS_SUPPORT_DIRS)"
|
||||
|
||||
# The FSF "binutils" release includes gprof and ld.
|
||||
.PHONY: binutils.tar.gz
|
||||
BINUTILS_SUPPORT_DIRS= bfd gas include libiberty opcodes ld gprof setup.com makefile.vms
|
||||
binutils.tar.gz: $(DIST_SUPPORT) $(BINUTILS_SUPPORT_DIRS) binutils
|
||||
.PHONY: binutils.tar.bz2
|
||||
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 \
|
||||
SUPPORT_FILES="$(BINUTILS_SUPPORT_DIRS) makeall.bat configure.bat"
|
||||
SUPPORT_FILES="$(BINUTILS_SUPPORT_DIRS)"
|
||||
|
||||
.PHONY: gas+binutils.tar.gz
|
||||
.PHONY: gas+binutils.tar.bz2
|
||||
GASB_SUPPORT_DIRS= $(GAS_SUPPORT_DIRS) binutils ld gprof
|
||||
gas+binutils.tar.gz: $(DIST_SUPPORT) $(GASB_SUPPORT_DIRS) gas
|
||||
gas+binutils.tar.bz2: $(DIST_SUPPORT) $(GASB_SUPPORT_DIRS) gas
|
||||
$(MAKE) -f Makefile.in taz TOOL=gas \
|
||||
SUPPORT_FILES="$(GASB_SUPPORT_DIRS) makeall.bat configure.bat"
|
||||
SUPPORT_FILES="$(GASB_SUPPORT_DIRS)"
|
||||
|
||||
.PHONY: libg++.tar.gz
|
||||
.PHONY: libg++.tar.bz2
|
||||
LIBGXX_SUPPORT_DIRS=include libstdc++ libio librx libiberty
|
||||
libg++.tar.gz: $(DIST_SUPPORT) libg++
|
||||
libg++.tar.bz2: $(DIST_SUPPORT) libg++
|
||||
$(MAKE) -f Makefile.in taz TOOL=libg++ \
|
||||
SUPPORT_FILES="$(LIBGXX_SUPPORT_DIRS)"
|
||||
|
||||
GNATS_SUPPORT_DIRS=include libiberty send-pr
|
||||
gnats.tar.gz: $(DIST_SUPPORT) $(GNATS_SUPPORT_DIRS) gnats
|
||||
gnats.tar.bz2: $(DIST_SUPPORT) $(GNATS_SUPPORT_DIRS) gnats
|
||||
$(MAKE) -f Makefile.in taz TOOL=gnats \
|
||||
SUPPORT_FILES="$(GNATS_SUPPORT_DIRS)"
|
||||
|
||||
.PHONY: gdb.tar.gz
|
||||
GDB_SUPPORT_DIRS= bfd include libiberty mmalloc opcodes readline sim utils
|
||||
GDBTK_SUPPORT_DIRS= `if [ -d tcl -a -d tk ] ; then echo tcl tk ; fi`
|
||||
gdb.tar.gz: $(DIST_SUPPORT) $(GDB_SUPPORT_DIRS) gdb
|
||||
.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 \
|
||||
SUPPORT_FILES="$(GDB_SUPPORT_DIRS) $(GDBTK_SUPPORT_DIRS)"
|
||||
SUPPORT_FILES="$(GDB_SUPPORT_DIRS)"
|
||||
|
||||
.PHONY: newlib.tar.gz
|
||||
.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 \
|
||||
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 \
|
||||
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 \
|
||||
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" \
|
||||
SUPPORT_FILES="$(INSIGHTD_SUPPORT_DIRS)"
|
||||
|
||||
.PHONY: newlib.tar.bz2
|
||||
NEWLIB_SUPPORT_DIRS=libgloss
|
||||
# taz configures for the sun4 target which won't configure newlib.
|
||||
# We need newlib configured so that the .info files are made.
|
||||
@ -1641,7 +1837,7 @@ NEWLIB_SUPPORT_DIRS=libgloss
|
||||
# the make distclean. For now punt on the issue of shipping newlib info files
|
||||
# with newlib net releases and wait for a day when some native target (sun4?)
|
||||
# supports newlib (if only minimally).
|
||||
newlib.tar.gz: $(DIST_SUPPORT) $(NEWLIB_SUPPORT_DIRS) newlib
|
||||
newlib.tar.bz2: $(DIST_SUPPORT) $(NEWLIB_SUPPORT_DIRS) newlib
|
||||
$(MAKE) -f Makefile.in taz TOOL=newlib \
|
||||
SUPPORT_FILES="$(NEWLIB_SUPPORT_DIRS)" \
|
||||
DEVO_SUPPORT="$(DEVO_SUPPORT) COPYING.NEWLIB" newlib
|
||||
@ -1649,5 +1845,4 @@ newlib.tar.gz: $(DIST_SUPPORT) $(NEWLIB_SUPPORT_DIRS) newlib
|
||||
.NOEXPORT:
|
||||
MAKEOVERRIDES=
|
||||
|
||||
|
||||
# end of Makefile.in
|
||||
|
File diff suppressed because it is too large
Load Diff
7851
contrib/binutils/bfd/ChangeLog-9193
Normal file
7851
contrib/binutils/bfd/ChangeLog-9193
Normal file
File diff suppressed because it is too large
Load Diff
10043
contrib/binutils/bfd/ChangeLog-9495
Normal file
10043
contrib/binutils/bfd/ChangeLog-9495
Normal file
File diff suppressed because it is too large
Load Diff
6711
contrib/binutils/bfd/ChangeLog-9697
Normal file
6711
contrib/binutils/bfd/ChangeLog-9697
Normal file
File diff suppressed because it is too large
Load Diff
@ -4,9 +4,9 @@ AUTOMAKE_OPTIONS = cygnus
|
||||
|
||||
INCDIR = $(srcdir)/../include
|
||||
CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
|
||||
DEP = mkdep
|
||||
MKDEP = gcc -MM
|
||||
|
||||
SUBDIRS = doc
|
||||
SUBDIRS = doc po
|
||||
|
||||
docdir = doc
|
||||
|
||||
@ -41,25 +41,32 @@ ALL_MACHINES = \
|
||||
cpu-alpha.lo \
|
||||
cpu-arc.lo \
|
||||
cpu-arm.lo \
|
||||
cpu-avr.lo \
|
||||
cpu-d10v.lo \
|
||||
cpu-d30v.lo \
|
||||
cpu-fr30.lo \
|
||||
cpu-h8300.lo \
|
||||
cpu-h8500.lo \
|
||||
cpu-hppa.lo \
|
||||
cpu-i370.lo \
|
||||
cpu-i386.lo \
|
||||
cpu-i860.lo \
|
||||
cpu-i960.lo \
|
||||
cpu-m32r.lo \
|
||||
cpu-m68k.lo \
|
||||
cpu-m88k.lo \
|
||||
cpu-mips.lo \
|
||||
cpu-m10200.lo \
|
||||
cpu-m10300.lo \
|
||||
cpu-mcore.lo \
|
||||
cpu-mips.lo \
|
||||
cpu-ns32k.lo \
|
||||
cpu-pj.lo \
|
||||
cpu-powerpc.lo \
|
||||
cpu-rs6000.lo \
|
||||
cpu-sh.lo \
|
||||
cpu-sparc.lo \
|
||||
cpu-tic30.lo \
|
||||
cpu-tic80.lo \
|
||||
cpu-v850.lo \
|
||||
cpu-vax.lo \
|
||||
cpu-we32k.lo \
|
||||
@ -71,24 +78,32 @@ ALL_MACHINES_CFILES = \
|
||||
cpu-alpha.c \
|
||||
cpu-arc.c \
|
||||
cpu-arm.c \
|
||||
cpu-avr.c \
|
||||
cpu-d10v.c \
|
||||
cpu-d30v.c \
|
||||
cpu-fr30.c \
|
||||
cpu-h8300.c \
|
||||
cpu-h8500.c \
|
||||
cpu-hppa.c \
|
||||
cpu-i370.c \
|
||||
cpu-i386.c \
|
||||
cpu-i860.c \
|
||||
cpu-i960.c \
|
||||
cpu-m32r.c \
|
||||
cpu-m68k.c \
|
||||
cpu-m88k.c \
|
||||
cpu-mips.c \
|
||||
cpu-m10200.c \
|
||||
cpu-m10300.c \
|
||||
cpu-mcore.c \
|
||||
cpu-mips.c \
|
||||
cpu-ns32k.c \
|
||||
cpu-pj.c \
|
||||
cpu-powerpc.c \
|
||||
cpu-rs6000.c \
|
||||
cpu-sh.c \
|
||||
cpu-sparc.c \
|
||||
cpu-tic30.c \
|
||||
cpu-tic80.c \
|
||||
cpu-v850.c \
|
||||
cpu-vax.c \
|
||||
cpu-we32k.c \
|
||||
@ -105,6 +120,7 @@ BFD32_BACKENDS = \
|
||||
aout-tic30.lo \
|
||||
aout0.lo \
|
||||
aout32.lo \
|
||||
armnetbsd.lo \
|
||||
bout.lo \
|
||||
cf-i386lynx.lo \
|
||||
cf-m68klynx.lo \
|
||||
@ -129,33 +145,45 @@ BFD32_BACKENDS = \
|
||||
coff-stgo32.lo \
|
||||
coff-svm68k.lo \
|
||||
coff-tic30.lo \
|
||||
coff-tic80.lo \
|
||||
coff-u68k.lo \
|
||||
coff-we32k.lo \
|
||||
coff-w65.lo \
|
||||
coff-z8k.lo \
|
||||
cofflink.lo \
|
||||
dwarf1.lo \
|
||||
dwarf2.lo \
|
||||
ecoff.lo \
|
||||
ecofflink.lo \
|
||||
elf.lo \
|
||||
elf32-arc.lo \
|
||||
elfarm-oabi.lo \
|
||||
elfarm-nabi.lo \
|
||||
elf32-avr.lo \
|
||||
elf32-d10v.lo \
|
||||
elf32-d30v.lo \
|
||||
elf32-fr30.lo \
|
||||
elf32-gen.lo \
|
||||
elf32-hppa.lo \
|
||||
elf32-i370.lo \
|
||||
elf32-i386.lo \
|
||||
elf32-i860.lo \
|
||||
elf32-i960.lo \
|
||||
elf32-m32r.lo \
|
||||
elf32-m68k.lo \
|
||||
elf32-m88k.lo \
|
||||
elf32-mips.lo \
|
||||
elf-m10200.lo \
|
||||
elf-m10300.lo \
|
||||
elf32-mcore.lo \
|
||||
elf32-mips.lo \
|
||||
elf32-pj.lo \
|
||||
elf32-ppc.lo \
|
||||
elf32-sh.lo \
|
||||
elf32-sparc.lo \
|
||||
elf32-v850.lo \
|
||||
elf32.lo \
|
||||
elflink.lo \
|
||||
epoc-pe-arm.lo \
|
||||
epoc-pei-arm.lo \
|
||||
hp300bsd.lo \
|
||||
hp300hpux.lo \
|
||||
som.lo \
|
||||
@ -189,8 +217,15 @@ BFD32_BACKENDS = \
|
||||
pei-arm.lo \
|
||||
pe-i386.lo \
|
||||
pei-i386.lo \
|
||||
pe-mcore.lo \
|
||||
pei-mcore.lo \
|
||||
pe-ppc.lo \
|
||||
pei-ppc.lo \
|
||||
pe-sh.lo \
|
||||
pei-sh.lo \
|
||||
pe-mips.lo \
|
||||
pei-mips.lo \
|
||||
peigen.lo \
|
||||
ppcboot.lo \
|
||||
reloc16.lo \
|
||||
riscix.lo \
|
||||
@ -200,6 +235,11 @@ BFD32_BACKENDS = \
|
||||
sunos.lo \
|
||||
vaxnetbsd.lo \
|
||||
versados.lo \
|
||||
vms.lo \
|
||||
vms-gsd.lo \
|
||||
vms-hdr.lo \
|
||||
vms-misc.lo \
|
||||
vms-tir.lo \
|
||||
xcofflink.lo
|
||||
|
||||
BFD32_BACKENDS_CFILES = \
|
||||
@ -210,6 +250,7 @@ BFD32_BACKENDS_CFILES = \
|
||||
aout-tic30.c \
|
||||
aout0.c \
|
||||
aout32.c \
|
||||
armnetbsd.c \
|
||||
bout.c \
|
||||
cf-i386lynx.c \
|
||||
cf-m68klynx.c \
|
||||
@ -234,33 +275,45 @@ BFD32_BACKENDS_CFILES = \
|
||||
coff-stgo32.c \
|
||||
coff-svm68k.c \
|
||||
coff-tic30.c \
|
||||
coff-tic80.c \
|
||||
coff-u68k.c \
|
||||
coff-we32k.c \
|
||||
coff-w65.c \
|
||||
coff-z8k.c \
|
||||
cofflink.c \
|
||||
dwarf1.c \
|
||||
dwarf2.c \
|
||||
ecoff.c \
|
||||
ecofflink.c \
|
||||
elf.c \
|
||||
elf32-arc.c \
|
||||
elfarm-oabi.c \
|
||||
elfarm-nabi.c \
|
||||
elf32-avr.c \
|
||||
elf32-d10v.c \
|
||||
elf32-d30v.c \
|
||||
elf32-fr30.c \
|
||||
elf32-gen.c \
|
||||
elf32-hppa.c \
|
||||
elf32-i370.c \
|
||||
elf32-i386.c \
|
||||
elf32-i860.c \
|
||||
elf32-i960.c \
|
||||
elf32-m32r.c \
|
||||
elf32-m68k.c \
|
||||
elf32-m88k.c \
|
||||
elf32-mips.c \
|
||||
elf-m10200.c \
|
||||
elf-m10300.c \
|
||||
elf32-mcore.c \
|
||||
elf32-mips.c \
|
||||
elf32-pj.c \
|
||||
elf32-ppc.c \
|
||||
elf32-sh.c \
|
||||
elf32-sparc.c \
|
||||
elf32-v850.c \
|
||||
elf32.c \
|
||||
elflink.c \
|
||||
epoc-pe-arm.c \
|
||||
epoc-pei-arm.c \
|
||||
hp300bsd.c \
|
||||
hp300hpux.c \
|
||||
som.c \
|
||||
@ -294,8 +347,15 @@ BFD32_BACKENDS_CFILES = \
|
||||
pei-arm.c \
|
||||
pe-i386.c \
|
||||
pei-i386.c \
|
||||
pe-mcore.c \
|
||||
pei-mcore.c \
|
||||
pe-ppc.c \
|
||||
pei-ppc.c \
|
||||
pe-sh.c \
|
||||
pei-sh.c \
|
||||
pe-mips.c \
|
||||
pei-mips.c \
|
||||
peigen.c \
|
||||
ppcboot.c \
|
||||
reloc16.c \
|
||||
riscix.c \
|
||||
@ -305,6 +365,11 @@ BFD32_BACKENDS_CFILES = \
|
||||
sunos.c \
|
||||
vaxnetbsd.c \
|
||||
versados.c \
|
||||
vms.c \
|
||||
vms-gsd.c \
|
||||
vms-hdr.c \
|
||||
vms-misc.c \
|
||||
vms-tir.c \
|
||||
xcofflink.c
|
||||
|
||||
# The .o files needed by all of the 64 bit vectors that are configured into
|
||||
@ -319,11 +384,6 @@ BFD64_BACKENDS = \
|
||||
elf64-mips.lo \
|
||||
elf64-sparc.lo \
|
||||
elf64.lo \
|
||||
evax-alpha.lo \
|
||||
evax-egsd.lo \
|
||||
evax-etir.lo \
|
||||
evax-emh.lo \
|
||||
evax-misc.lo \
|
||||
nlm32-alpha.lo \
|
||||
nlm64.lo
|
||||
|
||||
@ -336,11 +396,6 @@ BFD64_BACKENDS_CFILES = \
|
||||
elf64-mips.c \
|
||||
elf64-sparc.c \
|
||||
elf64.c \
|
||||
evax-alpha.c \
|
||||
evax-egsd.c \
|
||||
evax-etir.c \
|
||||
evax-emh.c \
|
||||
evax-misc.c \
|
||||
nlm32-alpha.c \
|
||||
nlm64.c
|
||||
|
||||
@ -350,6 +405,7 @@ OPTIONAL_BACKENDS = \
|
||||
irix-core.lo \
|
||||
lynx-core.lo \
|
||||
osf-core.lo \
|
||||
sco5-core.lo \
|
||||
trad-core.lo \
|
||||
cisco-core.lo
|
||||
|
||||
@ -359,6 +415,7 @@ OPTIONAL_BACKENDS_CFILES = \
|
||||
irix-core.c \
|
||||
lynx-core.c \
|
||||
osf-core.c \
|
||||
sco5-core.c \
|
||||
trad-core.c \
|
||||
cisco-core.c
|
||||
|
||||
@ -369,7 +426,7 @@ BFD_BACKENDS = @bfd_backends@
|
||||
BFD_MACHINES = @bfd_machines@
|
||||
TDEFAULTS = @tdefaults@
|
||||
|
||||
INCLUDES = -D_GNU_SOURCE @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES)
|
||||
INCLUDES = -D_GNU_SOURCE @HDEFINES@ @COREFLAG@ @TDEFINES@ $(CSEARCH) $(CSWITCHES) -I$(srcdir)/../intl -I../intl
|
||||
|
||||
# C source files that correspond to .o's.
|
||||
CFILES = \
|
||||
@ -379,13 +436,24 @@ CFILES = \
|
||||
$(BFD64_BACKENDS_CFILES) \
|
||||
$(OPTIONAL_BACKENDS_CFILES)
|
||||
|
||||
HFILES = \
|
||||
## This is a list of all .h files which are in the source tree.
|
||||
SOURCE_HFILES = \
|
||||
aout-target.h aoutf1.h aoutx.h coffcode.h coffswap.h \
|
||||
ecoffswap.h elf32-hppa.h elf32-target.h elf64-target.h \
|
||||
elfcode.h evax.h genlink.h go32stub.h hppa_stubs.h libaout.h \
|
||||
ecoffswap.h elf32-arm.h elfcode.h elfcore.h \
|
||||
elflink.h freebsd.h genlink.h go32stub.h libaout.h \
|
||||
libbfd.h libcoff.h libecoff.h elf-bfd.h libhppa.h libieee.h \
|
||||
libnlm.h liboasys.h netbsd.h nlm-target.h nlmcode.h ns32k.h som.h \
|
||||
targmatch.h
|
||||
libnlm.h liboasys.h libpei.h netbsd.h nlm-target.h nlmcode.h \
|
||||
nlmswap.h ns32k.h peicode.h som.h vms.h
|
||||
|
||||
HFILES = \
|
||||
elf32-target.h elf64-target.h targmatch.h \
|
||||
$(SOURCE_HFILES)
|
||||
|
||||
POTFILES = $(CFILES) $(SOURCE_HFILES)
|
||||
|
||||
po/POTFILES.in: @MAINT@ Makefile
|
||||
for file in $(POTFILES); do echo $$file; done | sort > tmp \
|
||||
&& mv tmp $(srcdir)/po/POTFILES.in
|
||||
|
||||
diststuff: info
|
||||
|
||||
@ -412,8 +480,8 @@ ofiles: stamp-ofiles ; @true
|
||||
|
||||
libbfd_la_SOURCES = $(BFD_LIBS_CFILES)
|
||||
libbfd_la_DEPENDENCIES = $(OFILES) ofiles
|
||||
libbfd_la_LIBADD = `cat ofiles`
|
||||
libbfd_la_LDFLAGS = -release $(VERSION)
|
||||
libbfd_la_LIBADD = `cat ofiles` @WIN32LIBADD@
|
||||
libbfd_la_LDFLAGS = -release $(VERSION) @WIN32LDFLAGS@
|
||||
|
||||
# libtool will build .libs/libbfd.a. We create libbfd.a in the build
|
||||
# directory so that we don't have to convert all the programs that use
|
||||
@ -424,8 +492,9 @@ noinst_LIBRARIES = libbfd.a
|
||||
libbfd_a_SOURCES =
|
||||
|
||||
stamp-lib: libbfd.la
|
||||
if [ -f .libs/libbfd.a ]; then \
|
||||
cp .libs/libbfd.a libbfd.tmp; \
|
||||
libtooldir=`$(LIBTOOL) --config | sed -n -e 's/^objdir=//p'`; \
|
||||
if [ -f $$libtooldir/libbfd.a ]; then \
|
||||
cp $$libtooldir/libbfd.a libbfd.tmp; \
|
||||
$(SHELL) $(srcdir)/../move-if-change libbfd.tmp libbfd.a; \
|
||||
else true; fi
|
||||
touch stamp-lib
|
||||
@ -468,29 +537,24 @@ $(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
|
||||
|
||||
# Install BFD include file, and others that it needs.
|
||||
install-data-local: $(BFD_H)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(includedir)
|
||||
$(INSTALL_DATA) $(BFD_H) $(includedir)/bfd.h
|
||||
$(INSTALL_DATA) $(INCDIR)/ansidecl.h $(includedir)/ansidecl.h
|
||||
$(INSTALL_DATA) $(INCDIR)/bfdlink.h $(includedir)/bfdlink.h
|
||||
|
||||
# Have to get rid of .dep1 here so that "$?" later includes all of $(CFILES).
|
||||
.dep: dep.sed $(CFILES) $(HFILES) bfd.h
|
||||
rm -f .dep1
|
||||
$(MAKE) DEP=$(DEP) .dep1
|
||||
sed -f dep.sed <.dep1 >.dep
|
||||
# Have to get rid of DEP1 here so that "$?" later includes all of $(CFILES).
|
||||
DEP: dep.sed $(CFILES) $(HFILES) bfd.h
|
||||
rm -f DEP1
|
||||
$(MAKE) MKDEP="$(MKDEP)" DEP1
|
||||
sed -f dep.sed < DEP1 > $@
|
||||
echo '# IF YOU PUT ANYTHING HERE IT WILL GO AWAY' >> $@
|
||||
|
||||
# This rule really wants a mkdep that runs "gcc -MM".
|
||||
# The NetBSD mkdep overwrites any existing file contents, and doesn't insert
|
||||
# the "DO NOT DELETE" line.
|
||||
# Other mkdep versions require a file that already exists, and do insert it.
|
||||
# Hence the weirdness....
|
||||
.dep1: $(CFILES)
|
||||
rm -f .dep2 .dep2a
|
||||
echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > .dep2
|
||||
echo > .dep2a
|
||||
$(DEP) -f .dep2a $(INCLUDES) $(CFLAGS) $?
|
||||
sed -e '/DO NOT DELETE/d' -e '/^$$/d' < .dep2a >> .dep2
|
||||
rm -f .dep2a
|
||||
$(SHELL) $(srcdir)/../move-if-change .dep2 .dep1
|
||||
DEP1: $(CFILES)
|
||||
echo '# DO NOT DELETE THIS LINE -- mkdep uses it.' > DEP2
|
||||
echo '# DO NOT PUT ANYTHING AFTER THIS LINE, IT WILL GO AWAY.' >> DEP2
|
||||
$(MKDEP) $(INCLUDES) $(CFLAGS) $? >> DEP2
|
||||
mv -f DEP2 $@
|
||||
|
||||
dep.sed: dep-in.sed config.status
|
||||
sed <$(srcdir)/dep-in.sed >dep.sed \
|
||||
@ -498,19 +562,19 @@ dep.sed: dep-in.sed config.status
|
||||
-e 's!@INCDIR@!$(INCDIR)!' \
|
||||
-e 's!@SRCDIR@!$(srcdir)!'
|
||||
|
||||
dep: .dep
|
||||
dep: DEP
|
||||
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < Makefile > tmp-Makefile
|
||||
cat .dep >> tmp-Makefile
|
||||
cat DEP >> tmp-Makefile
|
||||
$(SHELL) $(srcdir)/../move-if-change tmp-Makefile Makefile
|
||||
|
||||
dep-in: .dep
|
||||
dep-in: DEP
|
||||
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.in > tmp-Makefile.in
|
||||
cat .dep >> tmp-Makefile.in
|
||||
cat DEP >> tmp-Makefile.in
|
||||
$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.in $(srcdir)/Makefile.in
|
||||
|
||||
dep-am: .dep
|
||||
dep-am: DEP
|
||||
sed -e '/^..DO NOT DELETE THIS LINE/,$$d' < $(srcdir)/Makefile.am > tmp-Makefile.am
|
||||
cat .dep >> tmp-Makefile.am
|
||||
cat DEP >> tmp-Makefile.am
|
||||
$(SHELL) $(srcdir)/../move-if-change tmp-Makefile.am $(srcdir)/Makefile.am
|
||||
|
||||
host-aout.lo: Makefile
|
||||
@ -573,11 +637,22 @@ stmp-lcoff-h: $(LIBCOFF_H_FILES)
|
||||
MOSTLYCLEANFILES = elf32-target.h elf64-target.h ofiles stamp-ofiles \
|
||||
targmatch.h
|
||||
|
||||
CLEANFILES = bfd.h dep.sed stmp-bfd-h .dep .dep1 libbfd.a stamp-lib \
|
||||
CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEP1 DEP2 libbfd.a stamp-lib \
|
||||
stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
|
||||
|
||||
# We want to rerun configure if config.bfd or configure.host change.
|
||||
config.status: $(srcdir)/configure $(srcdir)/config.bfd $(srcdir)/configure.host
|
||||
$(SHELL) ./config.status --recheck
|
||||
|
||||
|
||||
elfarm-oabi.lo: elfarm-oabi.c elf32-arm.h elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
$(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
|
||||
elfarm-nabi.lo: elfarm-nabi.c elf32-arm.h elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
$(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
|
||||
# What appears below is generated by a hacked mkdep using gcc -MM.
|
||||
|
||||
# DO NOT DELETE THIS LINE -- mkdep uses it.
|
||||
@ -597,7 +672,7 @@ init.lo: init.c
|
||||
libbfd.lo: libbfd.c
|
||||
opncls.lo: opncls.c $(INCDIR)/objalloc.h
|
||||
reloc.lo: reloc.c $(INCDIR)/bfdlink.h
|
||||
section.lo: section.c
|
||||
section.lo: section.c $(INCDIR)/bfdlink.h
|
||||
syms.lo: syms.c $(INCDIR)/bfdlink.h $(INCDIR)/aout/stab_gnu.h \
|
||||
$(INCDIR)/aout/stab.def
|
||||
targets.lo: targets.c $(INCDIR)/fnmatch.h targmatch.h
|
||||
@ -614,24 +689,32 @@ cpu-a29k.lo: cpu-a29k.c
|
||||
cpu-alpha.lo: cpu-alpha.c
|
||||
cpu-arc.lo: cpu-arc.c
|
||||
cpu-arm.lo: cpu-arm.c
|
||||
cpu-avr.lo: cpu-avr.c
|
||||
cpu-d10v.lo: cpu-d10v.c
|
||||
cpu-d30v.lo: cpu-d30v.c
|
||||
cpu-fr30.lo: cpu-fr30.c
|
||||
cpu-h8300.lo: cpu-h8300.c
|
||||
cpu-h8500.lo: cpu-h8500.c
|
||||
cpu-hppa.lo: cpu-hppa.c
|
||||
cpu-i370.lo: cpu-i370.c
|
||||
cpu-i386.lo: cpu-i386.c
|
||||
cpu-i860.lo: cpu-i860.c
|
||||
cpu-i960.lo: cpu-i960.c
|
||||
cpu-m32r.lo: cpu-m32r.c
|
||||
cpu-m68k.lo: cpu-m68k.c
|
||||
cpu-m88k.lo: cpu-m88k.c
|
||||
cpu-mips.lo: cpu-mips.c
|
||||
cpu-m10200.lo: cpu-m10200.c
|
||||
cpu-m10300.lo: cpu-m10300.c
|
||||
cpu-mcore.lo: cpu-mcore.c
|
||||
cpu-mips.lo: cpu-mips.c
|
||||
cpu-ns32k.lo: cpu-ns32k.c ns32k.h
|
||||
cpu-pj.lo: cpu-pj.c
|
||||
cpu-powerpc.lo: cpu-powerpc.c
|
||||
cpu-rs6000.lo: cpu-rs6000.c
|
||||
cpu-sh.lo: cpu-sh.c
|
||||
cpu-sparc.lo: cpu-sparc.c
|
||||
cpu-tic30.lo: cpu-tic30.c
|
||||
cpu-tic80.lo: cpu-tic80.c
|
||||
cpu-v850.lo: cpu-v850.c
|
||||
cpu-vax.lo: cpu-vax.c
|
||||
cpu-we32k.lo: cpu-we32k.c
|
||||
@ -658,6 +741,9 @@ aout0.lo: aout0.c aoutf1.h $(INCDIR)/aout/sun4.h libaout.h \
|
||||
aout32.lo: aout32.c aoutx.h $(INCDIR)/bfdlink.h libaout.h \
|
||||
$(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def \
|
||||
$(INCDIR)/aout/ar.h
|
||||
armnetbsd.lo: armnetbsd.c netbsd.h libaout.h $(INCDIR)/bfdlink.h \
|
||||
aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
|
||||
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
|
||||
bout.lo: bout.c $(INCDIR)/bfdlink.h genlink.h $(INCDIR)/bout.h \
|
||||
$(INCDIR)/aout/stab_gnu.h $(INCDIR)/aout/stab.def libaout.h
|
||||
cf-i386lynx.lo: cf-i386lynx.c coff-i386.c $(INCDIR)/coff/i386.h \
|
||||
@ -721,6 +807,8 @@ coff-svm68k.lo: coff-svm68k.c coff-m68k.c $(INCDIR)/coff/m68k.h \
|
||||
coffcode.h coffswap.h
|
||||
coff-tic30.lo: coff-tic30.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic30.h \
|
||||
$(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
|
||||
coff-tic80.lo: coff-tic80.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/tic80.h \
|
||||
$(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
|
||||
coff-u68k.lo: coff-u68k.c coff-m68k.c $(INCDIR)/coff/m68k.h \
|
||||
$(INCDIR)/coff/internal.h libcoff.h $(INCDIR)/bfdlink.h \
|
||||
coffcode.h coffswap.h
|
||||
@ -733,6 +821,9 @@ coff-z8k.lo: coff-z8k.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/z8k.h \
|
||||
$(INCDIR)/coff/internal.h libcoff.h coffcode.h coffswap.h
|
||||
cofflink.lo: cofflink.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \
|
||||
libcoff.h
|
||||
dwarf1.lo: dwarf1.c $(INCDIR)/libiberty.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf.h
|
||||
dwarf2.lo: dwarf2.c $(INCDIR)/libiberty.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/bfdlink.h $(INCDIR)/elf/dwarf2.h
|
||||
@ -749,61 +840,96 @@ elf.lo: elf.c $(INCDIR)/bfdlink.h elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h
|
||||
elf32-arc.lo: elf32-arc.c elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
$(INCDIR)/elf/arc.h elf32-target.h
|
||||
$(INCDIR)/elf/arc.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elfarm-oabi.lo: elfarm-oabi.c $(INCDIR)/elf/arm-oabi.h \
|
||||
$(INCDIR)/elf/reloc-macros.h elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
elf32-arm.h elf32-target.h
|
||||
elfarm-nabi.lo: elfarm-nabi.c $(INCDIR)/elf/arm.h $(INCDIR)/elf/reloc-macros.h \
|
||||
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
|
||||
$(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h elf32-arm.h \
|
||||
elf32-target.h
|
||||
elf32-avr.lo: elf32-avr.c elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
$(INCDIR)/elf/avr.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32-d10v.lo: elf32-d10v.c elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
elf32-target.h
|
||||
elf32-d30v.lo: elf32-d30v.c elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
elf32-target.h
|
||||
elf32-fr30.lo: elf32-fr30.c elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
$(INCDIR)/elf/fr30.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32-gen.lo: elf32-gen.c elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
elf32-target.h
|
||||
elf32-hppa.lo: elf32-hppa.c $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
elf32-i370.lo: elf32-i370.c $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
elf32-hppa.h libhppa.h $(INCDIR)/elf/hppa.h hppa_stubs.h \
|
||||
elf32-target.h
|
||||
$(INCDIR)/elf/i370.h elf32-target.h
|
||||
elf32-i386.lo: elf32-i386.c $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
elf32-target.h
|
||||
$(INCDIR)/elf/i386.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32-i860.lo: elf32-i860.c elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
elf32-target.h
|
||||
elf32-i960.lo: elf32-i960.c elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
$(INCDIR)/elf/i960.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32-m32r.lo: elf32-m32r.c elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
$(INCDIR)/elf/m32r.h elf32-target.h
|
||||
$(INCDIR)/elf/m32r.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32-m68k.lo: elf32-m68k.c $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
elf32-target.h
|
||||
$(INCDIR)/elf/m68k.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32-m88k.lo: elf32-m88k.c elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
elf32-target.h
|
||||
elf32-mips.lo: elf32-mips.c $(INCDIR)/bfdlink.h genlink.h \
|
||||
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
|
||||
$(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/coff/sym.h \
|
||||
$(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
|
||||
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h ecoffswap.h \
|
||||
elf32-target.h
|
||||
elf-m10200.lo: elf-m10200.c elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
elf32-target.h
|
||||
elf-m10300.lo: elf-m10300.c elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
$(INCDIR)/elf/mn10300.h $(INCDIR)/elf/reloc-macros.h \
|
||||
elf32-target.h
|
||||
elf32-mcore.lo: elf32-mcore.c $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/elf/mcore.h $(INCDIR)/elf/reloc-macros.h \
|
||||
elf32-target.h
|
||||
elf32-mips.lo: elf32-mips.c $(INCDIR)/bfdlink.h genlink.h \
|
||||
elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
|
||||
$(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \
|
||||
$(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
|
||||
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/mips.h ecoffswap.h \
|
||||
elf32-target.h
|
||||
elf32-pj.lo: elf32-pj.c $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/elf/pj.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32-ppc.lo: elf32-ppc.c $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/elf/ppc.h elf32-target.h
|
||||
$(INCDIR)/elf/ppc.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32-sh.lo: elf32-sh.c $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
elf32-target.h
|
||||
$(INCDIR)/elf/sh.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32-sparc.lo: elf32-sparc.c $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/elf/sparc.h elf32-target.h
|
||||
$(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \
|
||||
elf32-target.h
|
||||
elf32-v850.lo: elf32-v850.c $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/elf/v850.h elf32-target.h
|
||||
$(INCDIR)/elf/v850.h $(INCDIR)/elf/reloc-macros.h elf32-target.h
|
||||
elf32.lo: elf32.c elfcode.h $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/fnmatch.h elfcore.h elflink.h
|
||||
elfcore.h elflink.h
|
||||
elflink.lo: elflink.c $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h
|
||||
epoc-pe-arm.lo: epoc-pe-arm.c pe-arm.c coff-arm.c $(INCDIR)/coff/arm.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
|
||||
epoc-pei-arm.lo: epoc-pei-arm.c pei-arm.c coff-arm.c \
|
||||
$(INCDIR)/coff/arm.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h \
|
||||
libcoff.h $(INCDIR)/bfdlink.h coffcode.h peicode.h \
|
||||
libpei.h
|
||||
hp300bsd.lo: hp300bsd.c libaout.h $(INCDIR)/bfdlink.h \
|
||||
aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
|
||||
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
|
||||
@ -884,22 +1010,42 @@ pc532-mach.lo: pc532-mach.c libaout.h $(INCDIR)/bfdlink.h \
|
||||
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
|
||||
pe-arm.lo: pe-arm.c coff-arm.c $(INCDIR)/coff/arm.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
|
||||
pei-arm.lo: pei-arm.c coff-arm.c $(INCDIR)/coff/arm.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
|
||||
pe-i386.lo: pe-i386.c coff-i386.c $(INCDIR)/coff/i386.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
|
||||
pei-i386.lo: pei-i386.c coff-i386.c $(INCDIR)/coff/i386.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
|
||||
pe-mcore.lo: pe-mcore.c coff-mcore.c $(INCDIR)/coff/mcore.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
|
||||
pei-mcore.lo: pei-mcore.c coff-mcore.c $(INCDIR)/coff/mcore.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
|
||||
pe-ppc.lo: pe-ppc.c coff-ppc.c $(INCDIR)/coff/powerpc.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
|
||||
pei-ppc.lo: pei-ppc.c coff-ppc.c $(INCDIR)/coff/powerpc.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
|
||||
pe-sh.lo: pe-sh.c coff-sh.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
|
||||
coffcode.h peicode.h libpei.h
|
||||
pei-sh.lo: pei-sh.c coff-sh.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/sh.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
|
||||
coffcode.h peicode.h libpei.h
|
||||
pe-mips.lo: pe-mips.c $(INCDIR)/coff/mipspe.h $(INCDIR)/coff/internal.h \
|
||||
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h coffcode.h \
|
||||
peicode.h libpei.h
|
||||
pei-mips.lo: pei-mips.c pe-mips.c $(INCDIR)/coff/mipspe.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/pe.h libcoff.h \
|
||||
$(INCDIR)/bfdlink.h coffcode.h peicode.h libpei.h
|
||||
peigen.lo: peigen.c $(INCDIR)/coff/internal.h $(INCDIR)/coff/i386.h \
|
||||
$(INCDIR)/coff/pe.h libcoff.h $(INCDIR)/bfdlink.h libpei.h
|
||||
ppcboot.lo: ppcboot.c
|
||||
reloc16.lo: reloc16.c $(INCDIR)/bfdlink.h genlink.h \
|
||||
$(INCDIR)/coff/internal.h libcoff.h
|
||||
@ -922,6 +1068,11 @@ vaxnetbsd.lo: vaxnetbsd.c netbsd.h libaout.h $(INCDIR)/bfdlink.h \
|
||||
aout-target.h $(INCDIR)/aout/aout64.h $(INCDIR)/aout/stab_gnu.h \
|
||||
$(INCDIR)/aout/stab.def $(INCDIR)/aout/ar.h
|
||||
versados.lo: versados.c $(INCDIR)/libiberty.h
|
||||
vms.lo: vms.c $(INCDIR)/bfdlink.h vms.h
|
||||
vms-gsd.lo: vms-gsd.c $(INCDIR)/bfdlink.h vms.h
|
||||
vms-hdr.lo: vms-hdr.c $(INCDIR)/bfdlink.h vms.h
|
||||
vms-misc.lo: vms-misc.c $(INCDIR)/bfdlink.h vms.h
|
||||
vms-tir.lo: vms-tir.c $(INCDIR)/bfdlink.h vms.h
|
||||
xcofflink.lo: xcofflink.c $(INCDIR)/bfdlink.h $(INCDIR)/coff/internal.h \
|
||||
libcoff.h
|
||||
aout64.lo: aout64.c aoutx.h $(INCDIR)/bfdlink.h libaout.h \
|
||||
@ -937,30 +1088,26 @@ demo64.lo: demo64.c aoutf1.h $(INCDIR)/aout/sun4.h \
|
||||
aout-target.h
|
||||
elf64-alpha.lo: elf64-alpha.c elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
$(INCDIR)/elf/alpha.h $(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h \
|
||||
$(INCDIR)/coff/symconst.h $(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h \
|
||||
$(INCDIR)/aout/ar.h libcoff.h libecoff.h ecoffswap.h \
|
||||
elf64-target.h
|
||||
$(INCDIR)/elf/alpha.h $(INCDIR)/elf/reloc-macros.h \
|
||||
$(INCDIR)/coff/internal.h $(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h \
|
||||
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h $(INCDIR)/aout/ar.h \
|
||||
libcoff.h libecoff.h ecoffswap.h elf64-target.h
|
||||
elf64-gen.lo: elf64-gen.c elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
elf64-target.h
|
||||
elf64-mips.lo: elf64-mips.c $(INCDIR)/aout/ar.h $(INCDIR)/bfdlink.h \
|
||||
genlink.h elf-bfd.h $(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h \
|
||||
$(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/coff/sym.h \
|
||||
$(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
|
||||
$(INCDIR)/elf/external.h $(INCDIR)/elf/mips.h $(INCDIR)/elf/reloc-macros.h \
|
||||
$(INCDIR)/coff/sym.h $(INCDIR)/coff/symconst.h $(INCDIR)/coff/internal.h \
|
||||
$(INCDIR)/coff/ecoff.h $(INCDIR)/coff/alpha.h ecoffswap.h \
|
||||
elf64-target.h
|
||||
elf64-sparc.lo: elf64-sparc.c elf-bfd.h $(INCDIR)/elf/common.h \
|
||||
$(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h $(INCDIR)/bfdlink.h \
|
||||
$(INCDIR)/elf/sparc.h elf64-target.h
|
||||
$(INCDIR)/elf/sparc.h $(INCDIR)/elf/reloc-macros.h \
|
||||
elf64-target.h
|
||||
elf64.lo: elf64.c elfcode.h $(INCDIR)/bfdlink.h elf-bfd.h \
|
||||
$(INCDIR)/elf/common.h $(INCDIR)/elf/internal.h $(INCDIR)/elf/external.h \
|
||||
$(INCDIR)/fnmatch.h elfcore.h elflink.h
|
||||
evax-alpha.lo: evax-alpha.c $(INCDIR)/bfdlink.h evax.h
|
||||
evax-egsd.lo: evax-egsd.c $(INCDIR)/bfdlink.h evax.h
|
||||
evax-etir.lo: evax-etir.c $(INCDIR)/bfdlink.h evax.h
|
||||
evax-emh.lo: evax-emh.c $(INCDIR)/bfdlink.h evax.h
|
||||
evax-misc.lo: evax-misc.c $(INCDIR)/bfdlink.h evax.h
|
||||
elfcore.h elflink.h
|
||||
nlm32-alpha.lo: nlm32-alpha.c $(INCDIR)/nlm/alpha-ext.h \
|
||||
libnlm.h $(INCDIR)/nlm/common.h $(INCDIR)/nlm/internal.h \
|
||||
$(INCDIR)/nlm/external.h nlmswap.h nlm-target.h
|
||||
@ -972,6 +1119,7 @@ hpux-core.lo: hpux-core.c
|
||||
irix-core.lo: irix-core.c
|
||||
lynx-core.lo: lynx-core.c
|
||||
osf-core.lo: osf-core.c
|
||||
sco5-core.lo: sco5-core.c libaout.h $(INCDIR)/bfdlink.h
|
||||
trad-core.lo: trad-core.c libaout.h $(INCDIR)/bfdlink.h
|
||||
cisco-core.lo: cisco-core.c
|
||||
# IF YOU PUT ANYTHING HERE IT WILL GO AWAY
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -8,6 +8,9 @@ The documentation on using BFD is scanty and may be occasionally
|
||||
incorrect. Pointers to documentation problems, or an entirely
|
||||
rewritten manual, would be appreciated.
|
||||
|
||||
There is some BFD internals documentation in doc/bfdint.texi which may
|
||||
help programmers who want to modify BFD.
|
||||
|
||||
BFD is normally built as part of another package. See the build
|
||||
instructions for that package, probably in a README file in the
|
||||
appropriate directory.
|
||||
|
@ -3,9 +3,9 @@ AC_DEFUN(BFD_BINARY_FOPEN,
|
||||
[AC_REQUIRE([AC_CANONICAL_SYSTEM])
|
||||
case "${host}" in
|
||||
changequote(,)dnl
|
||||
i[345]86-*-msdos* | i[345]86-*-go32* | i[345]86-*-mingw32* | *-*-cygwin32* | *-*-windows)
|
||||
*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
|
||||
changequote([,])dnl
|
||||
AC_DEFINE(USE_BINARY_FOPEN) ;;
|
||||
AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
|
||||
esac])dnl
|
||||
|
||||
dnl Get a default for CC_FOR_BUILD to put into Makefile.
|
||||
@ -24,15 +24,18 @@ if test "x$cross_compiling" = "xno"; then
|
||||
EXEEXT_FOR_BUILD='$(EXEEXT)'
|
||||
else
|
||||
AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
|
||||
[cat > ac_c_test.c << 'EOF'
|
||||
int main() {
|
||||
/* Nothing needed here */
|
||||
}
|
||||
EOF
|
||||
${CC_FOR_BUILD} -o ac_c_test am_c_test.c 1>&5 2>&5
|
||||
bfd_cv_build_exeext=`echo ac_c_test.* | grep -v ac_c_test.c | sed -e s/ac_c_test//`
|
||||
rm -f ac_c_test*
|
||||
test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
|
||||
[rm -f conftest*
|
||||
echo 'int main () { return 0; }' > conftest.c
|
||||
bfd_cv_build_exeext=
|
||||
${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
|
||||
for file in conftest.*; do
|
||||
case $file in
|
||||
*.c | *.o | *.obj | *.ilk | *.pdb) ;;
|
||||
*) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
|
||||
esac
|
||||
done
|
||||
rm -f conftest*
|
||||
test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
|
||||
EXEEXT_FOR_BUILD=""
|
||||
test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
|
||||
fi
|
||||
@ -61,7 +64,44 @@ AC_CACHE_VAL(bfd_cv_decl_needed_$1,
|
||||
bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
|
||||
AC_MSG_RESULT($bfd_cv_decl_needed_$1)
|
||||
if test $bfd_cv_decl_needed_$1 = yes; then
|
||||
bfd_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
|
||||
AC_DEFINE_UNQUOTED($bfd_tr_decl)
|
||||
AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
|
||||
[Define if $1 is not declared in system header files.])
|
||||
fi
|
||||
])dnl
|
||||
|
||||
dnl Check for existence of a type $1 in sys/procfs.h
|
||||
|
||||
AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
|
||||
[AC_MSG_CHECKING([for $1 in sys/procfs.h])
|
||||
AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
|
||||
[AC_TRY_COMPILE([#include <sys/procfs.h>],
|
||||
[$1 avar],
|
||||
bfd_cv_have_sys_procfs_type_$1=yes,
|
||||
bfd_cv_have_sys_procfs_type_$1=no
|
||||
)])
|
||||
if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
|
||||
AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
|
||||
[Define if <sys/procfs.h> has $1.])
|
||||
fi
|
||||
AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
|
||||
])
|
||||
|
||||
|
||||
dnl Check for existence of member $2 in type $1 in sys/procfs.h
|
||||
|
||||
AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
|
||||
[AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
|
||||
AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
|
||||
[AC_TRY_COMPILE([#include <sys/procfs.h>],
|
||||
[$1 avar; void* aref = (void*) &avar.$2],
|
||||
bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
|
||||
bfd_cv_have_sys_procfs_type_member_$1_$2=no
|
||||
)])
|
||||
if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
|
||||
AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
|
||||
[Define if <sys/procfs.h> has $1.$2.])
|
||||
fi
|
||||
AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
|
||||
])
|
||||
|
||||
|
||||
|
816
contrib/binutils/bfd/aclocal.m4
vendored
816
contrib/binutils/bfd/aclocal.m4
vendored
@ -1,7 +1,7 @@
|
||||
dnl aclocal.m4 generated automatically by aclocal 1.2e
|
||||
dnl aclocal.m4 generated automatically by aclocal 1.4
|
||||
|
||||
dnl Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
dnl This Makefile.in is free software; the Free Software Foundation
|
||||
dnl Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
dnl This file is free software; the Free Software Foundation
|
||||
dnl gives unlimited permission to copy and/or distribute it,
|
||||
dnl with or without modifications, as long as this notice is preserved.
|
||||
|
||||
@ -15,9 +15,9 @@ AC_DEFUN(BFD_BINARY_FOPEN,
|
||||
[AC_REQUIRE([AC_CANONICAL_SYSTEM])
|
||||
case "${host}" in
|
||||
changequote(,)dnl
|
||||
i[345]86-*-msdos* | i[345]86-*-go32* | i[345]86-*-mingw32* | *-*-cygwin32* | *-*-windows)
|
||||
*-*-msdos* | *-*-go32* | *-*-mingw32* | *-*-cygwin* | *-*-windows*)
|
||||
changequote([,])dnl
|
||||
AC_DEFINE(USE_BINARY_FOPEN) ;;
|
||||
AC_DEFINE(USE_BINARY_FOPEN, 1, [Use b modifier when opening binary files?]) ;;
|
||||
esac])dnl
|
||||
|
||||
dnl Get a default for CC_FOR_BUILD to put into Makefile.
|
||||
@ -36,15 +36,18 @@ if test "x$cross_compiling" = "xno"; then
|
||||
EXEEXT_FOR_BUILD='$(EXEEXT)'
|
||||
else
|
||||
AC_CACHE_CHECK([for build system executable suffix], bfd_cv_build_exeext,
|
||||
[cat > ac_c_test.c << 'EOF'
|
||||
int main() {
|
||||
/* Nothing needed here */
|
||||
}
|
||||
EOF
|
||||
${CC_FOR_BUILD} -o ac_c_test am_c_test.c 1>&5 2>&5
|
||||
bfd_cv_build_exeext=`echo ac_c_test.* | grep -v ac_c_test.c | sed -e s/ac_c_test//`
|
||||
rm -f ac_c_test*
|
||||
test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
|
||||
[rm -f conftest*
|
||||
echo 'int main () { return 0; }' > conftest.c
|
||||
bfd_cv_build_exeext=
|
||||
${CC_FOR_BUILD} -o conftest conftest.c 1>&5 2>&5
|
||||
for file in conftest.*; do
|
||||
case $file in
|
||||
*.c | *.o | *.obj | *.ilk | *.pdb) ;;
|
||||
*) bfd_cv_build_exeext=`echo $file | sed -e s/conftest//` ;;
|
||||
esac
|
||||
done
|
||||
rm -f conftest*
|
||||
test x"${bfd_cv_build_exeext}" = x && bfd_cv_build_exeext=no])
|
||||
EXEEXT_FOR_BUILD=""
|
||||
test x"${bfd_cv_build_exeext}" != xno && EXEEXT_FOR_BUILD=${bfd_cv_build_exeext}
|
||||
fi
|
||||
@ -73,11 +76,48 @@ AC_CACHE_VAL(bfd_cv_decl_needed_$1,
|
||||
bfd_cv_decl_needed_$1=no, bfd_cv_decl_needed_$1=yes)])
|
||||
AC_MSG_RESULT($bfd_cv_decl_needed_$1)
|
||||
if test $bfd_cv_decl_needed_$1 = yes; then
|
||||
bfd_tr_decl=NEED_DECLARATION_`echo $1 | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
|
||||
AC_DEFINE_UNQUOTED($bfd_tr_decl)
|
||||
AC_DEFINE([NEED_DECLARATION_]translit($1, [a-z], [A-Z]), 1,
|
||||
[Define if $1 is not declared in system header files.])
|
||||
fi
|
||||
])dnl
|
||||
|
||||
dnl Check for existence of a type $1 in sys/procfs.h
|
||||
|
||||
AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE,
|
||||
[AC_MSG_CHECKING([for $1 in sys/procfs.h])
|
||||
AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
|
||||
[AC_TRY_COMPILE([#include <sys/procfs.h>],
|
||||
[$1 avar],
|
||||
bfd_cv_have_sys_procfs_type_$1=yes,
|
||||
bfd_cv_have_sys_procfs_type_$1=no
|
||||
)])
|
||||
if test $bfd_cv_have_sys_procfs_type_$1 = yes; then
|
||||
AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z]), 1,
|
||||
[Define if <sys/procfs.h> has $1.])
|
||||
fi
|
||||
AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_$1)
|
||||
])
|
||||
|
||||
|
||||
dnl Check for existence of member $2 in type $1 in sys/procfs.h
|
||||
|
||||
AC_DEFUN(BFD_HAVE_SYS_PROCFS_TYPE_MEMBER,
|
||||
[AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
|
||||
AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
|
||||
[AC_TRY_COMPILE([#include <sys/procfs.h>],
|
||||
[$1 avar; void* aref = (void*) &avar.$2],
|
||||
bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
|
||||
bfd_cv_have_sys_procfs_type_member_$1_$2=no
|
||||
)])
|
||||
if test $bfd_cv_have_sys_procfs_type_member_$1_$2 = yes; then
|
||||
AC_DEFINE([HAVE_]translit($1, [a-z], [A-Z])[_]translit($2, [a-z], [A-Z]), 1,
|
||||
[Define if <sys/procfs.h> has $1.$2.])
|
||||
fi
|
||||
AC_MSG_RESULT($bfd_cv_have_sys_procfs_type_member_$1_$2)
|
||||
])
|
||||
|
||||
|
||||
|
||||
# Do all the work for Automake. This macro actually does too much --
|
||||
# some checks are only needed if your package does certain things.
|
||||
# But this isn't really a big deal.
|
||||
@ -88,7 +128,7 @@ dnl Usage:
|
||||
dnl AM_INIT_AUTOMAKE(package,version, [no-define])
|
||||
|
||||
AC_DEFUN(AM_INIT_AUTOMAKE,
|
||||
[AC_REQUIRE([AM_PROG_INSTALL])
|
||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||
PACKAGE=[$1]
|
||||
AC_SUBST(PACKAGE)
|
||||
VERSION=[$2]
|
||||
@ -98,8 +138,8 @@ if test "`cd $srcdir && pwd`" != "`pwd`" && test -f $srcdir/config.status; then
|
||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
|
||||
fi
|
||||
ifelse([$3],,
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE")
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION"))
|
||||
AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
|
||||
AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package]))
|
||||
AC_REQUIRE([AM_SANITY_CHECK])
|
||||
AC_REQUIRE([AC_ARG_PROGRAM])
|
||||
dnl FIXME This is truly gross.
|
||||
@ -111,15 +151,6 @@ AM_MISSING_PROG(AUTOHEADER, autoheader, $missing_dir)
|
||||
AM_MISSING_PROG(MAKEINFO, makeinfo, $missing_dir)
|
||||
AC_REQUIRE([AC_PROG_MAKE_SET])])
|
||||
|
||||
|
||||
# serial 1
|
||||
|
||||
AC_DEFUN(AM_PROG_INSTALL,
|
||||
[AC_REQUIRE([AC_PROG_INSTALL])
|
||||
test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL_PROGRAM}'
|
||||
AC_SUBST(INSTALL_SCRIPT)dnl
|
||||
])
|
||||
|
||||
#
|
||||
# Check to make sure that the build environment is sane.
|
||||
#
|
||||
@ -180,32 +211,75 @@ fi
|
||||
AC_SUBST($1)])
|
||||
|
||||
|
||||
# serial 24 AM_PROG_LIBTOOL
|
||||
AC_DEFUN(AM_PROG_LIBTOOL,
|
||||
[AC_REQUIRE([AM_ENABLE_SHARED])dnl
|
||||
AC_REQUIRE([AM_ENABLE_STATIC])dnl
|
||||
AC_REQUIRE([AC_CANONICAL_HOST])dnl
|
||||
AC_REQUIRE([AC_PROG_RANLIB])dnl
|
||||
AC_REQUIRE([AC_PROG_CC])dnl
|
||||
AC_REQUIRE([AM_PROG_LD])dnl
|
||||
AC_REQUIRE([AM_PROG_NM])dnl
|
||||
AC_REQUIRE([AC_PROG_LN_S])dnl
|
||||
dnl
|
||||
# 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=
|
||||
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 "$silent" = yes && libtool_flags="$libtool_flags --silent"
|
||||
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 "$host" in
|
||||
case "$lt_target" in
|
||||
*-*-irix6*)
|
||||
# Find out which ABI we are using.
|
||||
echo '[#]line __oline__ "configure"' > conftest.$ac_ext
|
||||
@ -227,30 +301,42 @@ case "$host" in
|
||||
|
||||
*-*-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
|
||||
;;
|
||||
esac
|
||||
|
||||
# Actually configure libtool. ac_aux_dir is where install-sh is found.
|
||||
CC="$CC" CFLAGS="$CFLAGS" CPPFLAGS="$CPPFLAGS" \
|
||||
LD="$LD" NM="$NM" RANLIB="$RANLIB" LN_S="$LN_S" \
|
||||
${CONFIG_SHELL-/bin/sh} $ac_aux_dir/ltconfig \
|
||||
$libtool_flags --no-verify $ac_aux_dir/ltmain.sh $host \
|
||||
|| AC_MSG_ERROR([libtool configure failed])
|
||||
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
|
||||
])
|
||||
|
||||
# AM_ENABLE_SHARED - implement the --enable-shared flag
|
||||
# Usage: AM_ENABLE_SHARED[(DEFAULT)]
|
||||
# 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(AM_ENABLE_SHARED,
|
||||
[define([AM_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
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 build shared libraries [default=>>AM_ENABLE_SHARED_DEFAULT]
|
||||
<< --enable-shared[=PKGS] build shared libraries [default=>>AC_ENABLE_SHARED_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[ --enable-shared=PKGS only build shared libraries if the current package
|
||||
appears as an element in the PKGS list],
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_shared=yes ;;
|
||||
@ -267,29 +353,23 @@ no) enable_shared=no ;;
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_shared=AM_ENABLE_SHARED_DEFAULT)dnl
|
||||
enable_shared=AC_ENABLE_SHARED_DEFAULT)dnl
|
||||
])
|
||||
|
||||
# AM_DISABLE_SHARED - set the default shared flag to --disable-shared
|
||||
AC_DEFUN(AM_DISABLE_SHARED,
|
||||
[AM_ENABLE_SHARED(no)])
|
||||
# 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)])
|
||||
|
||||
# AM_DISABLE_STATIC - set the default static flag to --disable-static
|
||||
AC_DEFUN(AM_DISABLE_STATIC,
|
||||
[AM_ENABLE_STATIC(no)])
|
||||
|
||||
# AM_ENABLE_STATIC - implement the --enable-static flag
|
||||
# Usage: AM_ENABLE_STATIC[(DEFAULT)]
|
||||
# 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(AM_ENABLE_STATIC,
|
||||
[define([AM_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
|
||||
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 build static libraries [default=>>AM_ENABLE_STATIC_DEFAULT]
|
||||
<< --enable-static[=PKGS] build static libraries [default=>>AC_ENABLE_STATIC_DEFAULT],
|
||||
changequote([, ])dnl
|
||||
[ --enable-static=PKGS only build shared libraries if the current package
|
||||
appears as an element in the PKGS list],
|
||||
[p=${PACKAGE-default}
|
||||
case "$enableval" in
|
||||
yes) enable_static=yes ;;
|
||||
@ -306,28 +386,73 @@ no) enable_static=no ;;
|
||||
IFS="$ac_save_ifs"
|
||||
;;
|
||||
esac],
|
||||
enable_static=AM_ENABLE_STATIC_DEFAULT)dnl
|
||||
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)])
|
||||
|
||||
# AM_PROG_LD - find the path to the GNU or non-GNU linker
|
||||
AC_DEFUN(AM_PROG_LD,
|
||||
|
||||
# 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])
|
||||
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.
|
||||
# Accept absolute paths.
|
||||
changequote(,)dnl
|
||||
/* | [A-Za-z]:\\*)
|
||||
[\\/]* | [A-Za-z]:[\\/]*)
|
||||
re_direlt='/[^/][^/]*/\.\./'
|
||||
changequote([,])dnl
|
||||
test -z "$LD" && LD="$ac_prog"
|
||||
;;
|
||||
# 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
|
||||
@ -344,10 +469,10 @@ else
|
||||
fi
|
||||
AC_CACHE_VAL(ac_cv_path_LD,
|
||||
[if test -z "$LD"; then
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
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"; then
|
||||
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.
|
||||
@ -355,7 +480,7 @@ AC_CACHE_VAL(ac_cv_path_LD,
|
||||
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
|
||||
test "$with_gnu_ld" != yes && break
|
||||
fi
|
||||
fi
|
||||
done
|
||||
@ -370,11 +495,10 @@ else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
|
||||
AC_SUBST(LD)
|
||||
AM_PROG_LD_GNU
|
||||
AC_PROG_LD_GNU
|
||||
])
|
||||
|
||||
AC_DEFUN(AM_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
|
||||
@ -384,43 +508,117 @@ else
|
||||
fi])
|
||||
])
|
||||
|
||||
# AM_PROG_NM - find the path to a BSD-compatible name lister
|
||||
AC_DEFUN(AM_PROG_NM,
|
||||
# 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,
|
||||
[case "$NM" in
|
||||
changequote(,)dnl
|
||||
/* | [A-Za-z]:\\*)
|
||||
changequote([,])dnl
|
||||
ac_cv_path_NM="$NM" # Let the user override the test with a path.
|
||||
;;
|
||||
*)
|
||||
IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}:"
|
||||
for ac_dir in /usr/ucb /usr/ccs/bin $PATH /bin; do
|
||||
[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; then
|
||||
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"
|
||||
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"
|
||||
ac_cv_path_NM="$ac_dir/nm -p"
|
||||
break
|
||||
else
|
||||
ac_cv_path_NM="$ac_dir/nm"
|
||||
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
|
||||
break
|
||||
fi
|
||||
done
|
||||
IFS="$ac_save_ifs"
|
||||
test -z "$ac_cv_path_NM" && ac_cv_path_NM=nm
|
||||
;;
|
||||
esac])
|
||||
fi])
|
||||
NM="$ac_cv_path_NM"
|
||||
AC_MSG_RESULT([$NM])
|
||||
AC_SUBST(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,
|
||||
@ -458,69 +656,367 @@ AC_DEFUN(AM_MAINTAINER_MODE,
|
||||
USE_MAINTAINER_MODE=$enableval,
|
||||
USE_MAINTAINER_MODE=no)
|
||||
AC_MSG_RESULT($USE_MAINTAINER_MODE)
|
||||
if test $USE_MAINTAINER_MODE = yes; then
|
||||
MAINT=
|
||||
else
|
||||
MAINT='#M#'
|
||||
fi
|
||||
AM_CONDITIONAL(MAINTAINER_MODE, test $USE_MAINTAINER_MODE = yes)
|
||||
MAINT=$MAINTAINER_MODE_TRUE
|
||||
AC_SUBST(MAINT)dnl
|
||||
]
|
||||
)
|
||||
|
||||
# Check to see if we're running under Cygwin32, without using
|
||||
# AC_CANONICAL_*. If so, set output variable CYGWIN32 to "yes".
|
||||
# Otherwise set it to "no".
|
||||
# Define a conditional.
|
||||
|
||||
dnl AM_CYGWIN32()
|
||||
AC_DEFUN(AM_CYGWIN32,
|
||||
[AC_CACHE_CHECK(for Cygwin32 environment, am_cv_cygwin32,
|
||||
[AC_TRY_COMPILE(,[return __CYGWIN32__;],
|
||||
am_cv_cygwin32=yes, am_cv_cygwin32=no)
|
||||
rm -f conftest*])
|
||||
CYGWIN32=
|
||||
test "$am_cv_cygwin32" = yes && CYGWIN32=yes])
|
||||
|
||||
# Check to see if we're running under Win32, without using
|
||||
# AC_CANONICAL_*. If so, set output variable EXEEXT to ".exe".
|
||||
# Otherwise set it to "".
|
||||
|
||||
dnl AM_EXEEXT()
|
||||
dnl This knows we add .exe if we're building in the Cygwin32
|
||||
dnl environment. But if we're not, then it compiles a test program
|
||||
dnl to see if there is a suffix for executables.
|
||||
AC_DEFUN(AM_EXEEXT,
|
||||
[AC_REQUIRE([AM_CYGWIN32])
|
||||
AC_REQUIRE([AM_MINGW32])
|
||||
AC_MSG_CHECKING([for executable suffix])
|
||||
AC_CACHE_VAL(am_cv_exeext,
|
||||
[if test "$CYGWIN32" = yes || test "$MINGW32" = yes; then
|
||||
am_cv_exeext=.exe
|
||||
AC_DEFUN(AM_CONDITIONAL,
|
||||
[AC_SUBST($1_TRUE)
|
||||
AC_SUBST($1_FALSE)
|
||||
if $2; then
|
||||
$1_TRUE=
|
||||
$1_FALSE='#'
|
||||
else
|
||||
cat > am_c_test.c << 'EOF'
|
||||
int main() {
|
||||
/* Nothing needed here */
|
||||
}
|
||||
EOF
|
||||
${CC-cc} -o am_c_test $CFLAGS $CPPFLAGS $LDFLAGS am_c_test.c $LIBS 1>&5
|
||||
am_cv_exeext=`echo am_c_test.* | grep -v am_c_test.c | sed -e s/am_c_test//`
|
||||
rm -f am_c_test*])
|
||||
test x"${am_cv_exeext}" = x && am_cv_exeext=no
|
||||
$1_TRUE='#'
|
||||
$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
|
||||
EXEEXT=""
|
||||
test x"${am_cv_exeext}" != xno && EXEEXT=${am_cv_exeext}
|
||||
AC_MSG_RESULT(${am_cv_exeext})
|
||||
AC_SUBST(EXEEXT)])
|
||||
AC_SUBST($1)dnl
|
||||
])
|
||||
|
||||
# Check to see if we're running under Mingw, without using
|
||||
# AC_CANONICAL_*. If so, set output variable MINGW32 to "yes".
|
||||
# Otherwise set it to "no".
|
||||
# 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.
|
||||
|
||||
dnl AM_MINGW32()
|
||||
AC_DEFUN(AM_MINGW32,
|
||||
[AC_CACHE_CHECK(for Mingw32 environment, am_cv_mingw32,
|
||||
[AC_TRY_COMPILE(,[return __MINGW32__;],
|
||||
am_cv_mingw32=yes, am_cv_mingw32=no)
|
||||
rm -f conftest*])
|
||||
MINGW32=
|
||||
test "$am_cv_mingw32" = yes && MINGW32=yes])
|
||||
# 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])
|
||||
|
||||
|
552
contrib/binutils/bfd/aout-arm.c
Normal file
552
contrib/binutils/bfd/aout-arm.c
Normal file
@ -0,0 +1,552 @@
|
||||
/* 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
|
||||
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. */
|
||||
|
||||
|
||||
#define N_TXTADDR(x) \
|
||||
((N_MAGIC(x) == NMAGIC) ? 0x8000 : \
|
||||
(N_MAGIC(x) != ZMAGIC) ? 0 : \
|
||||
(N_SHARED_LIB(x)) ? ((x).a_entry & ~(TARGET_PAGE_SIZE - 1)) : \
|
||||
TEXT_START_ADDR)
|
||||
|
||||
#define TEXT_START_ADDR 0x8000
|
||||
#define TARGET_PAGE_SIZE 0x8000
|
||||
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
||||
#define DEFAULT_ARCH bfd_arch_arm
|
||||
|
||||
#define MY(OP) CAT(aoutarm_,OP)
|
||||
#define N_BADMAG(x) ((((x).a_info & ~007200) != ZMAGIC) && \
|
||||
(((x).a_info & ~006000) != OMAGIC) && \
|
||||
((x).a_info != NMAGIC))
|
||||
#define N_MAGIC(x) ((x).a_info & ~07200)
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
|
||||
#define MYARM(OP) CAT(aoutarm_,OP)
|
||||
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
|
||||
as well as our own. */
|
||||
#define NAME(x,y) CAT3(aoutarm,_32_,y)
|
||||
|
||||
#define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup
|
||||
|
||||
#include "libaout.h"
|
||||
#include "aout/aout64.h"
|
||||
|
||||
static bfd_reloc_status_type
|
||||
MY(fix_pcrel_26_done) PARAMS ((bfd *, arelent *, asymbol *, PTR,
|
||||
asection *, bfd *, char **));
|
||||
|
||||
static bfd_reloc_status_type
|
||||
MY(fix_pcrel_26) PARAMS ((bfd *, arelent *, asymbol *, PTR,
|
||||
asection *, bfd *, char **));
|
||||
static void MY(swap_std_reloc_in) PARAMS ((bfd *, struct reloc_std_external *,
|
||||
arelent *, asymbol **,
|
||||
bfd_size_type));
|
||||
void MY(swap_std_reloc_out) PARAMS ((bfd *, arelent *,
|
||||
struct reloc_std_external *));
|
||||
|
||||
reloc_howto_type MY(howto_table)[] =
|
||||
{
|
||||
/* type rs size bsz pcrel bitpos ovrf sf name part_inpl readmask setmask
|
||||
pcdone */
|
||||
HOWTO (0, 0, 0, 8, false, 0, complain_overflow_bitfield, 0, "8", true,
|
||||
0x000000ff, 0x000000ff, false),
|
||||
HOWTO (1, 0, 1, 16, false, 0, complain_overflow_bitfield, 0, "16", true,
|
||||
0x0000ffff, 0x0000ffff, false),
|
||||
HOWTO (2, 0, 2, 32, false, 0, complain_overflow_bitfield, 0, "32", true,
|
||||
0xffffffff, 0xffffffff, false),
|
||||
HOWTO (3, 2, 2, 26, true, 0, complain_overflow_signed, MY(fix_pcrel_26),
|
||||
"ARM26", true, 0x00ffffff, 0x00ffffff, true),
|
||||
HOWTO (4, 0, 0, 8, true, 0, complain_overflow_signed, 0, "DISP8", true,
|
||||
0x000000ff, 0x000000ff, true),
|
||||
HOWTO (5, 0, 1, 16, true, 0, complain_overflow_signed, 0, "DISP16", true,
|
||||
0x0000ffff, 0x0000ffff, true),
|
||||
HOWTO (6, 0, 2, 32, true, 0, complain_overflow_signed, 0, "DISP32", true,
|
||||
0xffffffff, 0xffffffff, true),
|
||||
HOWTO (7, 2, 2, 26, false, 0, complain_overflow_signed,
|
||||
MY(fix_pcrel_26_done), "ARM26D", true, 0x0, 0x0,
|
||||
false),
|
||||
EMPTY_HOWTO (-1),
|
||||
HOWTO (9, 0, -1, 16, false, 0, complain_overflow_bitfield, 0, "NEG16", true,
|
||||
0x0000ffff, 0x0000ffff, false),
|
||||
HOWTO (10, 0, -2, 32, false, 0, complain_overflow_bitfield, 0, "NEG32", true,
|
||||
0xffffffff, 0xffffffff, false)
|
||||
};
|
||||
|
||||
#define RELOC_ARM_BITS_NEG_BIG ((unsigned int) 0x08)
|
||||
#define RELOC_ARM_BITS_NEG_LITTLE ((unsigned int) 0x10)
|
||||
|
||||
reloc_howto_type *
|
||||
MY(reloc_howto)(abfd, rel, r_index, r_extern, r_pcrel)
|
||||
bfd *abfd;
|
||||
struct reloc_std_external *rel;
|
||||
int *r_index;
|
||||
int *r_extern;
|
||||
int *r_pcrel;
|
||||
{
|
||||
unsigned int r_length;
|
||||
unsigned int r_pcrel_done;
|
||||
unsigned int r_neg;
|
||||
int index;
|
||||
|
||||
*r_pcrel = 0;
|
||||
if (bfd_header_big_endian (abfd))
|
||||
{
|
||||
*r_index = ((rel->r_index[0] << 16)
|
||||
| (rel->r_index[1] << 8)
|
||||
| rel->r_index[2]);
|
||||
*r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_BIG));
|
||||
r_pcrel_done = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_BIG));
|
||||
r_neg = (0 != (rel->r_type[0] & RELOC_ARM_BITS_NEG_BIG));
|
||||
r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_BIG)
|
||||
>> RELOC_STD_BITS_LENGTH_SH_BIG);
|
||||
}
|
||||
else
|
||||
{
|
||||
*r_index = ((rel->r_index[2] << 16)
|
||||
| (rel->r_index[1] << 8)
|
||||
| rel->r_index[0]);
|
||||
*r_extern = (0 != (rel->r_type[0] & RELOC_STD_BITS_EXTERN_LITTLE));
|
||||
r_pcrel_done = (0 != (rel->r_type[0] & RELOC_STD_BITS_PCREL_LITTLE));
|
||||
r_neg = (0 != (rel->r_type[0] & RELOC_ARM_BITS_NEG_LITTLE));
|
||||
r_length = ((rel->r_type[0] & RELOC_STD_BITS_LENGTH_LITTLE)
|
||||
>> RELOC_STD_BITS_LENGTH_SH_LITTLE);
|
||||
}
|
||||
index = r_length + 4 * r_pcrel_done + 8 * r_neg;
|
||||
if (index == 3)
|
||||
*r_pcrel = 1;
|
||||
|
||||
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)
|
||||
bfd *abfd;
|
||||
int r_extern;
|
||||
int r_index;
|
||||
long value;
|
||||
reloc_howto_type *howto;
|
||||
struct reloc_std_external *reloc;
|
||||
{
|
||||
unsigned int r_length;
|
||||
int r_pcrel;
|
||||
int r_neg;
|
||||
|
||||
PUT_WORD (abfd, value, reloc->r_address);
|
||||
r_length = howto->size ; /* Size as a power of two */
|
||||
|
||||
/* Special case for branch relocations. */
|
||||
if (howto->type == 3 || howto->type == 7)
|
||||
r_length = 3;
|
||||
|
||||
r_pcrel = howto->type & 4; /* PC Relative done? */
|
||||
r_neg = howto->type & 8; /* Negative relocation */
|
||||
if (bfd_header_big_endian (abfd))
|
||||
{
|
||||
reloc->r_index[0] = r_index >> 16;
|
||||
reloc->r_index[1] = r_index >> 8;
|
||||
reloc->r_index[2] = r_index;
|
||||
reloc->r_type[0] =
|
||||
((r_extern ? RELOC_STD_BITS_EXTERN_BIG : 0)
|
||||
| (r_pcrel ? RELOC_STD_BITS_PCREL_BIG : 0)
|
||||
| (r_neg ? RELOC_ARM_BITS_NEG_BIG : 0)
|
||||
| (r_length << RELOC_STD_BITS_LENGTH_SH_BIG));
|
||||
}
|
||||
else
|
||||
{
|
||||
reloc->r_index[2] = r_index >> 16;
|
||||
reloc->r_index[1] = r_index >> 8;
|
||||
reloc->r_index[0] = r_index;
|
||||
reloc->r_type[0] =
|
||||
((r_extern ? RELOC_STD_BITS_EXTERN_LITTLE : 0)
|
||||
| (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE : 0)
|
||||
| (r_neg ? RELOC_ARM_BITS_NEG_LITTLE : 0)
|
||||
| (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)
|
||||
|
||||
void
|
||||
MY(relocatable_reloc)(howto, abfd, reloc, amount, r_addr)
|
||||
reloc_howto_type *howto;
|
||||
bfd *abfd;
|
||||
struct reloc_std_external *reloc;
|
||||
bfd_vma *amount;
|
||||
bfd_vma r_addr;
|
||||
{
|
||||
if (howto->type == 3)
|
||||
{
|
||||
if (reloc->r_type[0]
|
||||
& (bfd_header_big_endian (abfd)
|
||||
? RELOC_STD_BITS_EXTERN_BIG : RELOC_STD_BITS_EXTERN_LITTLE))
|
||||
{
|
||||
/* The reloc is still external, so don't modify anything. */
|
||||
*amount = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
*amount -= r_addr;
|
||||
/* Change the r_pcrel value -- on the ARM, this bit is set once the
|
||||
relocation is done. */
|
||||
if (bfd_header_big_endian (abfd))
|
||||
reloc->r_type[0] |= RELOC_STD_BITS_PCREL_BIG;
|
||||
else
|
||||
reloc->r_type[0] |= RELOC_STD_BITS_PCREL_LITTLE;
|
||||
}
|
||||
}
|
||||
else if (howto->type == 7)
|
||||
*amount = 0;
|
||||
}
|
||||
|
||||
#define MY_relocatable_reloc(HOW, BFD, REL, AMOUNT, ADDR) \
|
||||
MY(relocatable_reloc)(HOW, BFD, REL, &(AMOUNT), ADDR)
|
||||
|
||||
static bfd_reloc_status_type
|
||||
MY(fix_pcrel_26_done) (abfd, reloc_entry, symbol, data, input_section,
|
||||
output_bfd, error_message)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *reloc_entry ATTRIBUTE_UNUSED;
|
||||
asymbol *symbol ATTRIBUTE_UNUSED;
|
||||
PTR data ATTRIBUTE_UNUSED;
|
||||
asection *input_section ATTRIBUTE_UNUSED;
|
||||
bfd *output_bfd ATTRIBUTE_UNUSED;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
/* This is dead simple at present. */
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
static bfd_reloc_status_type
|
||||
MY(fix_pcrel_26) (abfd, reloc_entry, symbol, data, input_section,
|
||||
output_bfd, error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_vma relocation;
|
||||
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)
|
||||
return output_bfd ? bfd_reloc_ok : bfd_reloc_undefined;
|
||||
|
||||
/* If the sections are different, and we are doing a partial relocation,
|
||||
just ignore it for now. */
|
||||
if (symbol->section->name != input_section->name
|
||||
&& output_bfd != (bfd *)NULL)
|
||||
return bfd_reloc_ok;
|
||||
|
||||
relocation = (target & 0x00ffffff) << 2;
|
||||
relocation = (relocation ^ 0x02000000) - 0x02000000; /* Sign extend */
|
||||
relocation += symbol->value;
|
||||
relocation += symbol->section->output_section->vma;
|
||||
relocation += symbol->section->output_offset;
|
||||
relocation += reloc_entry->addend;
|
||||
relocation -= input_section->output_section->vma;
|
||||
relocation -= input_section->output_offset;
|
||||
relocation -= addr;
|
||||
if (relocation & 3)
|
||||
return bfd_reloc_overflow;
|
||||
|
||||
/* Check for overflow */
|
||||
if (relocation & 0x02000000)
|
||||
{
|
||||
if ((relocation & ~ (bfd_vma) 0x03ffffff) != ~ (bfd_vma) 0x03ffffff)
|
||||
flag = bfd_reloc_overflow;
|
||||
}
|
||||
else if (relocation & ~0x03ffffff)
|
||||
flag = bfd_reloc_overflow;
|
||||
|
||||
target &= ~0x00ffffff;
|
||||
target |= (relocation >> 2) & 0x00ffffff;
|
||||
bfd_put_32 (abfd, target, (bfd_byte *) data + addr);
|
||||
|
||||
/* 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)
|
||||
bfd *abfd;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
#define ASTD(i,j) case i: return &MY(howto_table)[j]
|
||||
if (code == BFD_RELOC_CTOR)
|
||||
switch (bfd_get_arch_info (abfd)->bits_per_address)
|
||||
{
|
||||
case 32:
|
||||
code = BFD_RELOC_32;
|
||||
break;
|
||||
default: return (CONST struct reloc_howto_struct *) 0;
|
||||
}
|
||||
|
||||
switch (code)
|
||||
{
|
||||
ASTD (BFD_RELOC_16, 1);
|
||||
ASTD (BFD_RELOC_32, 2);
|
||||
ASTD (BFD_RELOC_ARM_PCREL_BRANCH, 3);
|
||||
ASTD (BFD_RELOC_8_PCREL, 4);
|
||||
ASTD (BFD_RELOC_16_PCREL, 5);
|
||||
ASTD (BFD_RELOC_32_PCREL, 6);
|
||||
default: return (CONST struct reloc_howto_struct *) 0;
|
||||
}
|
||||
}
|
||||
|
||||
#define MY_swap_std_reloc_in MY(swap_std_reloc_in)
|
||||
#define MY_swap_std_reloc_out MY(swap_std_reloc_out)
|
||||
#define MY_get_section_contents _bfd_generic_get_section_contents
|
||||
/* #define MY_bfd_link_hash_table_create _bfd_generic_link_hash_table_create */
|
||||
/* #define MY_bfd_link_add_symbols _bfd_generic_link_add_symbols */
|
||||
/* #define MY_bfd_final_link _bfd_generic_final_link */
|
||||
|
||||
#include "aoutx.h"
|
||||
|
||||
static void
|
||||
MY_swap_std_reloc_in (abfd, bytes, cache_ptr, symbols, symcount)
|
||||
bfd *abfd;
|
||||
struct reloc_std_external *bytes;
|
||||
arelent *cache_ptr;
|
||||
asymbol **symbols;
|
||||
bfd_size_type symcount ATTRIBUTE_UNUSED;
|
||||
{
|
||||
int r_index;
|
||||
int r_extern;
|
||||
int r_pcrel;
|
||||
struct aoutdata *su = &(abfd->tdata.aout_data->a);
|
||||
|
||||
cache_ptr->address = bfd_h_get_32 (abfd, bytes->r_address);
|
||||
|
||||
cache_ptr->howto = MY_reloc_howto (abfd, bytes, r_index, r_extern, r_pcrel);
|
||||
|
||||
MOVE_ADDRESS (0);
|
||||
}
|
||||
|
||||
void
|
||||
MY_swap_std_reloc_out (abfd, g, natptr)
|
||||
bfd *abfd;
|
||||
arelent *g;
|
||||
struct reloc_std_external *natptr;
|
||||
{
|
||||
int r_index;
|
||||
asymbol *sym = *(g->sym_ptr_ptr);
|
||||
int r_extern;
|
||||
int r_length;
|
||||
int r_pcrel;
|
||||
int r_neg = 0; /* Negative relocs use the BASEREL bit. */
|
||||
asection *output_section = sym->section->output_section;
|
||||
|
||||
PUT_WORD(abfd, g->address, natptr->r_address);
|
||||
|
||||
r_length = g->howto->size ; /* Size as a power of two */
|
||||
if (r_length < 0)
|
||||
{
|
||||
r_length = -r_length;
|
||||
r_neg = 1;
|
||||
}
|
||||
|
||||
r_pcrel = (int) g->howto->pc_relative; /* Relative to PC? */
|
||||
|
||||
/* For RISC iX, in pc-relative relocs the r_pcrel bit means that the
|
||||
relocation has been done already (Only for the 26-bit one I think)???!!!
|
||||
*/
|
||||
|
||||
if (g->howto->type == 3)
|
||||
{
|
||||
r_length = 3;
|
||||
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. */
|
||||
r_addend = g->addend + (*(g->sym_ptr_ptr))->section->output_section->vma;
|
||||
#endif
|
||||
|
||||
/* name was clobbered by aout_write_syms to be symbol index */
|
||||
|
||||
/* If this relocation is relative to a symbol then set the
|
||||
r_index to the symbols index, and the r_extern bit.
|
||||
|
||||
Absolute symbols can come in in two ways, either as an offset
|
||||
from the abs section, or as a symbol which has an abs value.
|
||||
check for that here
|
||||
*/
|
||||
|
||||
if (bfd_is_com_section (output_section)
|
||||
|| output_section == &bfd_abs_section
|
||||
|| output_section == &bfd_und_section)
|
||||
{
|
||||
if (bfd_abs_section.symbol == sym)
|
||||
{
|
||||
/* Whoops, looked like an abs symbol, but is really an offset
|
||||
from the abs section */
|
||||
r_index = 0;
|
||||
r_extern = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Fill in symbol */
|
||||
r_extern = 1;
|
||||
r_index = (*(g->sym_ptr_ptr))->KEEPIT;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Just an ordinary section */
|
||||
r_extern = 0;
|
||||
r_index = output_section->target_index;
|
||||
}
|
||||
|
||||
/* now the fun stuff */
|
||||
if (bfd_header_big_endian (abfd))
|
||||
{
|
||||
natptr->r_index[0] = r_index >> 16;
|
||||
natptr->r_index[1] = r_index >> 8;
|
||||
natptr->r_index[2] = r_index;
|
||||
natptr->r_type[0] =
|
||||
( (r_extern ? RELOC_STD_BITS_EXTERN_BIG: 0)
|
||||
| (r_pcrel ? RELOC_STD_BITS_PCREL_BIG: 0)
|
||||
| (r_neg ? RELOC_ARM_BITS_NEG_BIG: 0)
|
||||
| (r_length << RELOC_STD_BITS_LENGTH_SH_BIG));
|
||||
}
|
||||
else
|
||||
{
|
||||
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_STD_BITS_EXTERN_LITTLE: 0)
|
||||
| (r_pcrel ? RELOC_STD_BITS_PCREL_LITTLE: 0)
|
||||
| (r_neg ? RELOC_ARM_BITS_NEG_LITTLE: 0)
|
||||
| (r_length << RELOC_STD_BITS_LENGTH_SH_LITTLE));
|
||||
}
|
||||
}
|
||||
|
||||
#define MY_BFD_TARGET
|
||||
|
||||
#include "aout-target.h"
|
||||
|
||||
extern const bfd_target aout_arm_big_vec;
|
||||
|
||||
const bfd_target aout_arm_little_vec =
|
||||
{
|
||||
"a.out-arm-little", /* name */
|
||||
bfd_target_aout_flavour,
|
||||
BFD_ENDIAN_LITTLE, /* target byte order (little) */
|
||||
BFD_ENDIAN_LITTLE, /* target headers byte order (little) */
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
|
||||
MY_symbol_leading_char,
|
||||
AR_PAD_CHAR, /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
|
||||
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
|
||||
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
|
||||
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
|
||||
{_bfd_dummy_target, MY_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, MY_core_file_p},
|
||||
{bfd_false, MY_mkobject, /* bfd_set_format */
|
||||
_bfd_generic_mkarchive, bfd_false},
|
||||
{bfd_false, MY_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (MY),
|
||||
BFD_JUMP_TABLE_COPY (MY),
|
||||
BFD_JUMP_TABLE_CORE (MY),
|
||||
BFD_JUMP_TABLE_ARCHIVE (MY),
|
||||
BFD_JUMP_TABLE_SYMBOLS (MY),
|
||||
BFD_JUMP_TABLE_RELOCS (MY),
|
||||
BFD_JUMP_TABLE_WRITE (MY),
|
||||
BFD_JUMP_TABLE_LINK (MY),
|
||||
BFD_JUMP_TABLE_DYNAMIC (MY),
|
||||
|
||||
& aout_arm_big_vec,
|
||||
|
||||
(PTR) MY_backend_data,
|
||||
};
|
||||
|
||||
const bfd_target aout_arm_big_vec =
|
||||
{
|
||||
"a.out-arm-big", /* name */
|
||||
bfd_target_aout_flavour,
|
||||
BFD_ENDIAN_BIG, /* target byte order (big) */
|
||||
BFD_ENDIAN_BIG, /* target headers byte order (big) */
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
|
||||
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
|
||||
MY_symbol_leading_char,
|
||||
AR_PAD_CHAR, /* ar_pad_char */
|
||||
15, /* ar_max_namelen */
|
||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
|
||||
{_bfd_dummy_target, MY_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, MY_core_file_p},
|
||||
{bfd_false, MY_mkobject, /* bfd_set_format */
|
||||
_bfd_generic_mkarchive, bfd_false},
|
||||
{bfd_false, MY_write_object_contents, /* bfd_write_contents */
|
||||
_bfd_write_archive_contents, bfd_false},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (MY),
|
||||
BFD_JUMP_TABLE_COPY (MY),
|
||||
BFD_JUMP_TABLE_CORE (MY),
|
||||
BFD_JUMP_TABLE_ARCHIVE (MY),
|
||||
BFD_JUMP_TABLE_SYMBOLS (MY),
|
||||
BFD_JUMP_TABLE_RELOCS (MY),
|
||||
BFD_JUMP_TABLE_WRITE (MY),
|
||||
BFD_JUMP_TABLE_LINK (MY),
|
||||
BFD_JUMP_TABLE_DYNAMIC (MY),
|
||||
|
||||
& aout_arm_little_vec,
|
||||
|
||||
(PTR) MY_backend_data,
|
||||
};
|
32
contrib/binutils/bfd/aout-sparcle.c
Normal file
32
contrib/binutils/bfd/aout-sparcle.c
Normal file
@ -0,0 +1,32 @@
|
||||
/* BFD backend for sparc little-endian aout binaries.
|
||||
Copyright (C) 1996 Free Software Foundation, Inc.
|
||||
Written 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. */
|
||||
|
||||
#define TARGETNAME "a.out-sparc-little"
|
||||
#define MY(OP) CAT(sparcle_aout_,OP)
|
||||
|
||||
#include "bfd.h"
|
||||
#include "bfdlink.h"
|
||||
#include "libaout.h"
|
||||
|
||||
#define MACHTYPE_OK(mtype) ((mtype) == M_SPARC || (mtype) == M_SPARCLET)
|
||||
|
||||
/* Include the usual a.out support. */
|
||||
#define TARGET_IS_LITTLE_ENDIAN_P
|
||||
#include "aoutf1.h"
|
@ -1,5 +1,5 @@
|
||||
/* Define a target vector and some small routines for a variant of a.out.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 1997
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -234,9 +234,9 @@ static boolean MY_bfd_copy_private_section_data
|
||||
static boolean
|
||||
MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
|
||||
bfd *ibfd;
|
||||
asection *isec;
|
||||
asection *isec ATTRIBUTE_UNUSED;
|
||||
bfd *obfd;
|
||||
asection *osec;
|
||||
asection *osec ATTRIBUTE_UNUSED;
|
||||
{
|
||||
if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour
|
||||
&& bfd_get_flavour (obfd) == bfd_target_aout_flavour)
|
||||
@ -258,11 +258,7 @@ MY(write_object_contents) (abfd)
|
||||
struct external_exec exec_bytes;
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
#if CHOOSE_RELOC_SIZE
|
||||
CHOOSE_RELOC_SIZE(abfd);
|
||||
#else
|
||||
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
|
||||
#endif
|
||||
|
||||
WRITE_HEADERS(abfd, execp);
|
||||
|
||||
@ -509,6 +505,9 @@ MY_bfd_final_link (abfd, info)
|
||||
#ifndef MY_bfd_relax_section
|
||||
#define MY_bfd_relax_section bfd_generic_relax_section
|
||||
#endif
|
||||
#ifndef MY_bfd_gc_sections
|
||||
#define MY_bfd_gc_sections bfd_generic_gc_sections
|
||||
#endif
|
||||
#ifndef MY_bfd_reloc_type_lookup
|
||||
#define MY_bfd_reloc_type_lookup NAME(aout,reloc_type_lookup)
|
||||
#endif
|
||||
@ -642,6 +641,9 @@ const bfd_target MY(vec) =
|
||||
BFD_JUMP_TABLE_LINK (MY),
|
||||
BFD_JUMP_TABLE_DYNAMIC (MY),
|
||||
|
||||
(PTR) MY_backend_data,
|
||||
/* Alternative_target */
|
||||
NULL,
|
||||
|
||||
(PTR) MY_backend_data
|
||||
};
|
||||
#endif /* MY_BFD_TARGET */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD back-end for TMS320C30 a.out binaries.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
||||
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -131,7 +131,7 @@ static CONST struct aout_backend_data tic30_aout_backend_data =
|
||||
it. */
|
||||
reloc_howto_type tic30_aout_howto_table[] =
|
||||
{
|
||||
{-1},
|
||||
EMPTY_HOWTO (-1),
|
||||
HOWTO (1, 2, 1, 16, false, 0, 0, tic30_aout_fix_16,
|
||||
"16", false, 0x0000FFFF, 0x0000FFFF, false),
|
||||
HOWTO (2, 2, 2, 24, false, 0, complain_overflow_bitfield, NULL,
|
||||
@ -142,18 +142,18 @@ reloc_howto_type tic30_aout_howto_table[] =
|
||||
"32", false, 0xFFFFFFFF, 0xFFFFFFFF, false),
|
||||
HOWTO (5, 2, 1, 16, true, 0, complain_overflow_signed,
|
||||
tic30_aout_fix_pcrel_16, "PCREL", true, 0x0000FFFF, 0x0000FFFF, true),
|
||||
{-1},
|
||||
{-1},
|
||||
{-1},
|
||||
{-1},
|
||||
{-1}
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1)
|
||||
};
|
||||
|
||||
extern reloc_howto_type *NAME (aout, reloc_type_lookup) ();
|
||||
|
||||
reloc_howto_type *
|
||||
tic30_aout_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
switch (code)
|
||||
@ -218,9 +218,9 @@ tic30_aout_fix_16 (abfd, reloc_entry, symbol, data, input_section, output_bfd, e
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
asection *input_section ATTRIBUTE_UNUSED;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_vma relocation;
|
||||
|
||||
@ -245,9 +245,9 @@ tic30_aout_fix_32 (abfd, reloc_entry, symbol, data, input_section,
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
asection *input_section ATTRIBUTE_UNUSED;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_vma relocation;
|
||||
|
||||
@ -274,11 +274,11 @@ tic30_aout_fix_pcrel_16 (abfd, reloc_entry, symbol, data, input_section,
|
||||
output_bfd, error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
asymbol *symbol ATTRIBUTE_UNUSED;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
asection *input_section ATTRIBUTE_UNUSED;
|
||||
bfd *output_bfd ATTRIBUTE_UNUSED;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_vma relocation = 1;
|
||||
bfd_byte offset_data = bfd_get_8 (abfd, (bfd_byte *) data + reloc_entry->address - 1);
|
||||
@ -590,9 +590,9 @@ tic30_aout_object_p (abfd)
|
||||
static boolean
|
||||
MY_bfd_copy_private_section_data (ibfd, isec, obfd, osec)
|
||||
bfd *ibfd;
|
||||
asection *isec;
|
||||
asection *isec ATTRIBUTE_UNUSED;
|
||||
bfd *obfd;
|
||||
asection *osec;
|
||||
asection *osec ATTRIBUTE_UNUSED;
|
||||
{
|
||||
if (bfd_get_flavour (obfd) == bfd_target_aout_flavour)
|
||||
obj_aout_subformat (obfd) = obj_aout_subformat (ibfd);
|
||||
@ -610,11 +610,8 @@ tic30_aout_write_object_contents (abfd)
|
||||
struct external_exec exec_bytes;
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
#if CHOOSE_RELOC_SIZE
|
||||
CHOOSE_RELOC_SIZE (abfd);
|
||||
#else
|
||||
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
|
||||
#endif
|
||||
|
||||
{
|
||||
bfd_size_type text_size; /* dummy vars */
|
||||
file_ptr text_end;
|
||||
@ -779,7 +776,7 @@ MY_bfd_final_link (abfd, info)
|
||||
enum machine_type
|
||||
tic30_aout_machine_type (arch, machine, unknown)
|
||||
enum bfd_architecture arch;
|
||||
unsigned long machine;
|
||||
unsigned long machine ATTRIBUTE_UNUSED;
|
||||
boolean *unknown;
|
||||
{
|
||||
enum machine_type arch_flags;
|
||||
@ -939,6 +936,9 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
|
||||
#ifndef MY_bfd_relax_section
|
||||
#define MY_bfd_relax_section bfd_generic_relax_section
|
||||
#endif
|
||||
#ifndef MY_bfd_gc_sections
|
||||
#define MY_bfd_gc_sections bfd_generic_gc_sections
|
||||
#endif
|
||||
#ifndef MY_bfd_reloc_type_lookup
|
||||
#define MY_bfd_reloc_type_lookup tic30_aout_reloc_type_lookup
|
||||
#endif
|
||||
@ -1057,6 +1057,8 @@ const bfd_target tic30_aout_vec =
|
||||
BFD_JUMP_TABLE_LINK (MY),
|
||||
BFD_JUMP_TABLE_DYNAMIC (MY),
|
||||
|
||||
(PTR) MY_backend_data,
|
||||
NULL,
|
||||
|
||||
(PTR) MY_backend_data
|
||||
};
|
||||
#endif /* MY_BFD_TARGET */
|
||||
|
@ -150,6 +150,11 @@ sunos_set_arch_mach (abfd, machtype)
|
||||
machine = bfd_mach_sparc_sparclet;
|
||||
break;
|
||||
|
||||
case M_SPARCLITE_LE:
|
||||
arch = bfd_arch_sparc;
|
||||
machine = bfd_mach_sparc_sparclite_le;
|
||||
break;
|
||||
|
||||
case M_386:
|
||||
case M_386_DYNIX:
|
||||
arch = bfd_arch_i386;
|
||||
@ -232,6 +237,9 @@ sunos_write_object_contents (abfd)
|
||||
case bfd_mach_sparc_sparclet:
|
||||
N_SET_MACHTYPE (*execp, M_SPARCLET);
|
||||
break;
|
||||
case bfd_mach_sparc_sparclite_le:
|
||||
N_SET_MACHTYPE (*execp, M_SPARCLITE_LE);
|
||||
break;
|
||||
default:
|
||||
N_SET_MACHTYPE (*execp, M_SPARC);
|
||||
break;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD semi-generic back-end for a.out binaries.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
|
||||
Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
@ -120,10 +120,9 @@ DESCRIPTION
|
||||
|
||||
#define KEEPIT udata.i
|
||||
|
||||
#include <string.h> /* For strchr and friends */
|
||||
#include <ctype.h>
|
||||
#include "bfd.h"
|
||||
#include <sysdep.h>
|
||||
#include "sysdep.h"
|
||||
#include "bfdlink.h"
|
||||
|
||||
#include "libaout.h"
|
||||
@ -199,7 +198,7 @@ reloc_howto_type howto_table_ext[] =
|
||||
HOWTO(RELOC_SFA_BASE,0, 2, 32, false, 0, complain_overflow_bitfield,0,"SFA_BASE", false, 0,0xffffffff, false),
|
||||
HOWTO(RELOC_SFA_OFF13,0,2, 32, false, 0, complain_overflow_bitfield,0,"SFA_OFF13",false, 0,0xffffffff, false),
|
||||
HOWTO(RELOC_BASE10, 0, 2, 10, false, 0, complain_overflow_dont,0,"BASE10", false, 0,0x000003ff, false),
|
||||
HOWTO(RELOC_BASE13, 0, 2, 13, false, 0, complain_overflow_bitfield,0,"BASE13", false, 0,0x00001fff, false),
|
||||
HOWTO(RELOC_BASE13, 0, 2, 13, false, 0, complain_overflow_signed,0,"BASE13", false, 0,0x00001fff, false),
|
||||
HOWTO(RELOC_BASE22, 10, 2, 22, false, 0, complain_overflow_bitfield,0,"BASE22", false, 0,0x003fffff, false),
|
||||
HOWTO(RELOC_PC10, 0, 2, 10, true, 0, complain_overflow_dont,0,"PC10", false, 0,0x000003ff, true),
|
||||
HOWTO(RELOC_PC22, 10, 2, 22, true, 0, complain_overflow_signed,0,"PC22", false, 0,0x003fffff, true),
|
||||
@ -208,6 +207,10 @@ reloc_howto_type howto_table_ext[] =
|
||||
HOWTO(RELOC_GLOB_DAT,0, 2, 0, false, 0, complain_overflow_bitfield,0,"GLOB_DAT", false, 0,0x00000000, false),
|
||||
HOWTO(RELOC_JMP_SLOT,0, 2, 0, false, 0, complain_overflow_bitfield,0,"JMP_SLOT", false, 0,0x00000000, false),
|
||||
HOWTO(RELOC_RELATIVE,0, 2, 0, false, 0, complain_overflow_bitfield,0,"RELATIVE", false, 0,0x00000000, false),
|
||||
HOWTO(0, 0, 0, 0, false, 0, complain_overflow_dont, 0, "R_SPARC_NONE", false,0,0x00000000,true),
|
||||
HOWTO(0, 0, 0, 0, false, 0, complain_overflow_dont, 0, "R_SPARC_NONE", false,0,0x00000000,true),
|
||||
#define RELOC_SPARC_REV32 RELOC_WDISP19
|
||||
HOWTO(RELOC_SPARC_REV32, 0, 2, 32, false, 0, complain_overflow_dont,0,"R_SPARC_REV32", false, 0,0xffffffff, false),
|
||||
};
|
||||
|
||||
/* Convert standard reloc records to "arelent" format (incl byte swap). */
|
||||
@ -225,28 +228,35 @@ HOWTO( 7, 0, 4, 64, true, 0, complain_overflow_signed, 0,"DISP64", tr
|
||||
HOWTO( 8, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"GOT_REL", false, 0,0x00000000, false),
|
||||
HOWTO( 9, 0, 1, 16, false, 0, complain_overflow_bitfield,0,"BASE16", false,0xffffffff,0xffffffff, false),
|
||||
HOWTO(10, 0, 2, 32, false, 0, complain_overflow_bitfield,0,"BASE32", false,0xffffffff,0xffffffff, false),
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
HOWTO(16, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"JMP_TABLE", false, 0,0x00000000, false),
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
{ -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 }, { -1 },
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
HOWTO(32, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"RELATIVE", false, 0,0x00000000, false),
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
{ -1 },
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
EMPTY_HOWTO (-1),
|
||||
HOWTO(40, 0, 2, 0, false, 0, complain_overflow_bitfield,0,"BASEREL", false, 0,0x00000000, false),
|
||||
};
|
||||
|
||||
@ -286,6 +296,7 @@ NAME(aout,reloc_type_lookup) (abfd,code)
|
||||
EXT (BFD_RELOC_SPARC_PC10, 17);
|
||||
EXT (BFD_RELOC_SPARC_PC22, 18);
|
||||
EXT (BFD_RELOC_SPARC_WPLT30, 19);
|
||||
EXT (BFD_RELOC_SPARC_REV32, 26);
|
||||
default: return (reloc_howto_type *) NULL;
|
||||
}
|
||||
else
|
||||
@ -708,6 +719,7 @@ NAME(aout,machine_type) (arch, machine, unknown)
|
||||
if (machine == 0
|
||||
|| machine == bfd_mach_sparc
|
||||
|| machine == bfd_mach_sparc_sparclite
|
||||
|| machine == bfd_mach_sparc_sparclite_le
|
||||
|| machine == bfd_mach_sparc_v9)
|
||||
arch_flags = M_SPARC;
|
||||
else if (machine == bfd_mach_sparc_sparclet)
|
||||
@ -739,14 +751,29 @@ NAME(aout,machine_type) (arch, machine, unknown)
|
||||
case bfd_arch_mips:
|
||||
switch (machine) {
|
||||
case 0:
|
||||
case 2000:
|
||||
case 3000: arch_flags = M_MIPS1; break;
|
||||
case 4000: /* mips3 */
|
||||
case 4400:
|
||||
case 8000: /* mips4 */
|
||||
/* real mips2: */
|
||||
case 6000: arch_flags = M_MIPS2; break;
|
||||
default: arch_flags = M_UNKNOWN; break;
|
||||
case bfd_mach_mips3000:
|
||||
case bfd_mach_mips3900:
|
||||
arch_flags = M_MIPS1;
|
||||
break;
|
||||
case bfd_mach_mips6000:
|
||||
arch_flags = M_MIPS2;
|
||||
break;
|
||||
case bfd_mach_mips4000:
|
||||
case bfd_mach_mips4010:
|
||||
case bfd_mach_mips4100:
|
||||
case bfd_mach_mips4300:
|
||||
case bfd_mach_mips4400:
|
||||
case bfd_mach_mips4600:
|
||||
case bfd_mach_mips4650:
|
||||
case bfd_mach_mips8000:
|
||||
case bfd_mach_mips10000:
|
||||
case bfd_mach_mips16:
|
||||
/* FIXME: These should be MIPS3 or MIPS4. */
|
||||
arch_flags = M_MIPS2;
|
||||
break;
|
||||
default:
|
||||
arch_flags = M_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -1052,7 +1079,7 @@ boolean
|
||||
NAME(aout,adjust_sizes_and_vmas) (abfd, text_size, text_end)
|
||||
bfd *abfd;
|
||||
bfd_size_type *text_size;
|
||||
file_ptr *text_end;
|
||||
file_ptr *text_end ATTRIBUTE_UNUSED;
|
||||
{
|
||||
struct internal_exec *execp = exec_hdr (abfd);
|
||||
|
||||
@ -1214,7 +1241,7 @@ NAME(aout,set_section_contents) (abfd, section, location, offset, count)
|
||||
&& section != obj_datasec (abfd))
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s: can not represent section `%s' in a.out object file format",
|
||||
(_("%s: can not represent section `%s' in a.out object file format"),
|
||||
bfd_get_filename (abfd), bfd_get_section_name (abfd, section));
|
||||
bfd_set_error (bfd_error_nonrepresentable_section);
|
||||
return false;
|
||||
@ -1598,9 +1625,9 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
|
||||
/* This case occurs, e.g., for the *DEBUG* section of a COFF
|
||||
file. */
|
||||
(*_bfd_error_handler)
|
||||
("%s: can not represent section for symbol `%s' in a.out object file format",
|
||||
(_("%s: can not represent section for symbol `%s' in a.out object file format"),
|
||||
bfd_get_filename (abfd),
|
||||
cache_ptr->name != NULL ? cache_ptr->name : "*unknown*");
|
||||
cache_ptr->name != NULL ? cache_ptr->name : _("*unknown*"));
|
||||
bfd_set_error (bfd_error_nonrepresentable_section);
|
||||
return false;
|
||||
}
|
||||
@ -1628,7 +1655,7 @@ translate_to_native_sym_flags (abfd, cache_ptr, sym_pointer)
|
||||
else
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s: can not represent section `%s' in a.out object file format",
|
||||
(_("%s: can not represent section `%s' in a.out object file format"),
|
||||
bfd_get_filename (abfd), bfd_get_section_name (abfd, sec));
|
||||
bfd_set_error (bfd_error_nonrepresentable_section);
|
||||
return false;
|
||||
@ -2511,16 +2538,16 @@ NAME(aout,get_symtab_upper_bound) (abfd)
|
||||
/*ARGSUSED*/
|
||||
alent *
|
||||
NAME(aout,get_lineno) (ignore_abfd, ignore_symbol)
|
||||
bfd *ignore_abfd;
|
||||
asymbol *ignore_symbol;
|
||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
||||
asymbol *ignore_symbol ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return (alent *)NULL;
|
||||
return (alent *)NULL;
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret)
|
||||
bfd *ignore_abfd;
|
||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
||||
asymbol *symbol;
|
||||
symbol_info *ret;
|
||||
{
|
||||
@ -2548,7 +2575,7 @@ NAME(aout,get_symbol_info) (ignore_abfd, symbol, ret)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
NAME(aout,print_symbol) (ignore_abfd, afile, symbol, how)
|
||||
bfd *ignore_abfd;
|
||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
||||
PTR afile;
|
||||
asymbol *symbol;
|
||||
bfd_print_symbol_type how;
|
||||
@ -2679,6 +2706,7 @@ NAME(aout,find_nearest_line)
|
||||
CONST char *main_file_name = NULL;
|
||||
CONST char *current_file_name = NULL;
|
||||
CONST char *line_file_name = NULL; /* Value of current_file_name at line number. */
|
||||
CONST char *line_directory_name = NULL; /* Value of directory_name at line number. */
|
||||
bfd_vma low_line_vma = 0;
|
||||
bfd_vma low_func_vma = 0;
|
||||
asymbol *func = 0;
|
||||
@ -2767,6 +2795,7 @@ NAME(aout,find_nearest_line)
|
||||
*line_ptr = q->desc;
|
||||
low_line_vma = q->symbol.value;
|
||||
line_file_name = current_file_name;
|
||||
line_directory_name = directory_name;
|
||||
}
|
||||
break;
|
||||
case N_FUN:
|
||||
@ -2787,7 +2816,10 @@ NAME(aout,find_nearest_line)
|
||||
|
||||
done:
|
||||
if (*line_ptr != 0)
|
||||
main_file_name = line_file_name;
|
||||
{
|
||||
main_file_name = line_file_name;
|
||||
directory_name = line_directory_name;
|
||||
}
|
||||
|
||||
if (main_file_name == NULL
|
||||
|| main_file_name[0] == '/'
|
||||
@ -2853,7 +2885,7 @@ NAME(aout,find_nearest_line)
|
||||
int
|
||||
NAME(aout,sizeof_headers) (abfd, execable)
|
||||
bfd *abfd;
|
||||
boolean execable;
|
||||
boolean execable ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return adata(abfd).exec_bytes_size;
|
||||
}
|
||||
@ -3639,7 +3671,7 @@ NAME(aout,final_link) (abfd, info, callback)
|
||||
work out the number of relocs needed, and then multiply
|
||||
by the reloc size. */
|
||||
(*_bfd_error_handler)
|
||||
("%s: relocateable link from %s to %s not supported",
|
||||
(_("%s: relocateable link from %s to %s not supported"),
|
||||
bfd_get_filename (abfd),
|
||||
sub->xvec->name, abfd->xvec->name);
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
@ -4694,6 +4726,8 @@ aout_reloc_index_to_section (abfd, indx)
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
/*NOTREACHED*/
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Relocate an a.out section using standard a.out relocs. */
|
||||
@ -4937,6 +4971,7 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
|
||||
/* We are generating an executable, and must do a full
|
||||
relocation. */
|
||||
hundef = false;
|
||||
|
||||
if (r_extern)
|
||||
{
|
||||
h = sym_hashes[r_index];
|
||||
@ -4994,7 +5029,8 @@ aout_link_input_section_std (finfo, input_bfd, input_section, relocs,
|
||||
else
|
||||
name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
|
||||
if (! ((*finfo->info->callbacks->undefined_symbol)
|
||||
(finfo->info, name, input_bfd, input_section, r_addr)))
|
||||
(finfo->info, name, input_bfd, input_section,
|
||||
r_addr, true)))
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -5279,6 +5315,7 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
|
||||
/* We are generating an executable, and must do a full
|
||||
relocation. */
|
||||
hundef = false;
|
||||
|
||||
if (r_extern)
|
||||
{
|
||||
h = sym_hashes[r_index];
|
||||
@ -5395,14 +5432,26 @@ aout_link_input_section_ext (finfo, input_bfd, input_section, relocs,
|
||||
else
|
||||
name = strings + GET_WORD (input_bfd, syms[r_index].e_strx);
|
||||
if (! ((*finfo->info->callbacks->undefined_symbol)
|
||||
(finfo->info, name, input_bfd, input_section, r_addr)))
|
||||
(finfo->info, name, input_bfd, input_section,
|
||||
r_addr, true)))
|
||||
return false;
|
||||
}
|
||||
|
||||
r = MY_final_link_relocate (howto_table_ext + r_type,
|
||||
input_bfd, input_section,
|
||||
contents, r_addr, relocation,
|
||||
r_addend);
|
||||
if (r_type != RELOC_SPARC_REV32)
|
||||
r = MY_final_link_relocate (howto_table_ext + r_type,
|
||||
input_bfd, input_section,
|
||||
contents, r_addr, relocation,
|
||||
r_addend);
|
||||
else
|
||||
{
|
||||
bfd_vma x;
|
||||
|
||||
x = bfd_get_32 (input_bfd, contents + r_addr);
|
||||
x = x + relocation + r_addend;
|
||||
bfd_putl32 (/*input_bfd,*/ x, contents + r_addr);
|
||||
r = bfd_reloc_ok;
|
||||
}
|
||||
|
||||
if (r != bfd_reloc_ok)
|
||||
{
|
||||
switch (r)
|
||||
@ -5455,7 +5504,7 @@ aout_link_reloc_link_order (finfo, o, p)
|
||||
int r_index;
|
||||
int r_extern;
|
||||
reloc_howto_type *howto;
|
||||
file_ptr *reloff_ptr;
|
||||
file_ptr *reloff_ptr = NULL;
|
||||
struct reloc_std_external srel;
|
||||
struct reloc_ext_external erel;
|
||||
PTR rel_ptr;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD back-end for archive files (libraries).
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
|
||||
Free Software Foundation, Inc.
|
||||
Written by Cygnus Support. Mostly Gumby Henkel-Wallace's fault.
|
||||
|
||||
@ -131,8 +131,6 @@ DESCRIPTION
|
||||
#include "libbfd.h"
|
||||
#include "aout/ar.h"
|
||||
#include "aout/ranlib.h"
|
||||
#include <errno.h>
|
||||
#include <string.h> /* For memchr, strrchr and friends */
|
||||
#include <ctype.h>
|
||||
|
||||
#ifndef errno
|
||||
@ -175,7 +173,8 @@ static boolean do_slurp_bsd_armap PARAMS ((bfd *abfd));
|
||||
static boolean do_slurp_coff_armap PARAMS ((bfd *abfd));
|
||||
static const char *normalize PARAMS ((bfd *, const char *file));
|
||||
static struct areltdata *bfd_ar_hdr_from_filesystem PARAMS ((bfd *abfd,
|
||||
const char *));
|
||||
const char *,
|
||||
bfd *member));
|
||||
|
||||
boolean
|
||||
_bfd_generic_mkarchive (abfd)
|
||||
@ -397,7 +396,7 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag)
|
||||
}
|
||||
|
||||
/* Extract the filename from the archive - there are two ways to
|
||||
specify an extendend name table, either the first char of the
|
||||
specify an extended name table, either the first char of the
|
||||
name is a space, or it's a slash. */
|
||||
if ((hdr.ar_name[0] == '/'
|
||||
|| (hdr.ar_name[0] == ' '
|
||||
@ -443,19 +442,22 @@ _bfd_generic_read_ar_hdr_mag (abfd, mag)
|
||||
Note: The SYSV format (terminated by '/') allows embedded
|
||||
spaces, so only look for ' ' if we don't find '/'. */
|
||||
|
||||
namelen = 0;
|
||||
while (hdr.ar_name[namelen] != '\0' &&
|
||||
hdr.ar_name[namelen] != '/')
|
||||
char *e;
|
||||
e = memchr (hdr.ar_name, '\0', ar_maxnamelen (abfd));
|
||||
if (e == NULL)
|
||||
{
|
||||
namelen++;
|
||||
if (namelen == (unsigned) ar_maxnamelen (abfd))
|
||||
{
|
||||
namelen = 0;
|
||||
while (hdr.ar_name[namelen] != ' '
|
||||
&& namelen < (unsigned) ar_maxnamelen (abfd))
|
||||
namelen++;
|
||||
break;
|
||||
}
|
||||
e = memchr (hdr.ar_name, '/', ar_maxnamelen (abfd));
|
||||
if (e == NULL)
|
||||
e = memchr (hdr.ar_name, ' ', ar_maxnamelen (abfd));
|
||||
}
|
||||
|
||||
if (e != NULL)
|
||||
namelen = e - hdr.ar_name;
|
||||
else
|
||||
{
|
||||
/* If we didn't find a termination character, then the name
|
||||
must be the entire field. */
|
||||
namelen = ar_maxnamelen (abfd);
|
||||
}
|
||||
|
||||
allocsize += namelen + 1;
|
||||
@ -1176,7 +1178,7 @@ normalize (abfd, file)
|
||||
#else
|
||||
static const char *
|
||||
normalize (abfd, file)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
const char *file;
|
||||
{
|
||||
const char *filename = strrchr (file, '/');
|
||||
@ -1338,21 +1340,41 @@ _bfd_construct_extended_name_table (abfd, trailing_slash, tabloc, tablen)
|
||||
|
||||
/** A couple of functions for creating ar_hdrs */
|
||||
|
||||
#ifndef HAVE_GETUID
|
||||
#define getuid() 0
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_GETGID
|
||||
#define getgid() 0
|
||||
#endif
|
||||
|
||||
/* Takes a filename, returns an arelt_data for it, or NULL if it can't
|
||||
make one. The filename must refer to a filename in the filesystem.
|
||||
The filename field of the ar_hdr will NOT be initialized */
|
||||
The filename field of the ar_hdr will NOT be initialized. If member
|
||||
is set, and it's an in-memory bfd, we fake it. */
|
||||
|
||||
static struct areltdata *
|
||||
bfd_ar_hdr_from_filesystem (abfd, filename)
|
||||
bfd_ar_hdr_from_filesystem (abfd, filename, member)
|
||||
bfd *abfd;
|
||||
const char *filename;
|
||||
bfd *member;
|
||||
{
|
||||
struct stat status;
|
||||
struct areltdata *ared;
|
||||
struct ar_hdr *hdr;
|
||||
char *temp, *temp1;
|
||||
|
||||
if (stat (filename, &status) != 0)
|
||||
if (member && (member->flags & BFD_IN_MEMORY) != 0)
|
||||
{
|
||||
/* Assume we just "made" the member, and fake it */
|
||||
struct bfd_in_memory *bim = (struct bfd_in_memory *) member->iostream;
|
||||
time(&status.st_mtime);
|
||||
status.st_uid = getuid();
|
||||
status.st_gid = getgid();
|
||||
status.st_mode = 0644;
|
||||
status.st_size = bim->size;
|
||||
}
|
||||
else if (stat (filename, &status) != 0)
|
||||
{
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
return NULL;
|
||||
@ -1404,7 +1426,7 @@ bfd_special_undocumented_glue (abfd, filename)
|
||||
bfd *abfd;
|
||||
const char *filename;
|
||||
{
|
||||
struct areltdata *ar_elt = bfd_ar_hdr_from_filesystem (abfd, filename);
|
||||
struct areltdata *ar_elt = bfd_ar_hdr_from_filesystem (abfd, filename, 0);
|
||||
if (ar_elt == NULL)
|
||||
return NULL;
|
||||
return (struct ar_hdr *) ar_elt->arch_header;
|
||||
@ -1586,7 +1608,7 @@ _bfd_write_archive_contents (arch)
|
||||
if (!current->arelt_data)
|
||||
{
|
||||
current->arelt_data =
|
||||
(PTR) bfd_ar_hdr_from_filesystem (arch, current->filename);
|
||||
(PTR) bfd_ar_hdr_from_filesystem (arch, current->filename, current);
|
||||
if (!current->arelt_data)
|
||||
return false;
|
||||
|
||||
@ -1699,7 +1721,7 @@ _bfd_write_archive_contents (arch)
|
||||
if (bfd_update_armap_timestamp (arch))
|
||||
break;
|
||||
(*_bfd_error_handler)
|
||||
("Warning: writing archive was slow: rewriting timestamp\n");
|
||||
(_("Warning: writing archive was slow: rewriting timestamp\n"));
|
||||
}
|
||||
while (++tries < 6);
|
||||
}
|
||||
@ -1887,13 +1909,8 @@ bsd_write_armap (arch, elength, map, orl_count, stridx)
|
||||
bfd_ardata (arch)->armap_datepos = (SARMAG
|
||||
+ offsetof (struct ar_hdr, ar_date[0]));
|
||||
sprintf (hdr.ar_date, "%ld", bfd_ardata (arch)->armap_timestamp);
|
||||
#ifndef _WIN32
|
||||
sprintf (hdr.ar_uid, "%ld", (long) getuid ());
|
||||
sprintf (hdr.ar_gid, "%ld", (long) getgid ());
|
||||
#else
|
||||
sprintf (hdr.ar_uid, "%ld", (long) 666);
|
||||
sprintf (hdr.ar_gid, "%ld", (long) 42);
|
||||
#endif
|
||||
sprintf (hdr.ar_size, "%-10d", (int) mapsize);
|
||||
strncpy (hdr.ar_fmag, ARFMAG, 2);
|
||||
for (i = 0; i < sizeof (struct ar_hdr); i++)
|
||||
@ -1970,7 +1987,7 @@ _bfd_archive_bsd_update_armap_timestamp (arch)
|
||||
bfd_flush (arch);
|
||||
if (bfd_stat (arch, &archstat) == -1)
|
||||
{
|
||||
perror ("Reading archive file mod timestamp");
|
||||
perror (_("Reading archive file mod timestamp"));
|
||||
return true; /* Can't read mod time for some reason */
|
||||
}
|
||||
if (archstat.st_mtime <= bfd_ardata (arch)->armap_timestamp)
|
||||
@ -1994,7 +2011,7 @@ _bfd_archive_bsd_update_armap_timestamp (arch)
|
||||
!= sizeof (hdr.ar_date)))
|
||||
{
|
||||
/* FIXME: bfd can't call perror. */
|
||||
perror ("Writing updated armap timestamp");
|
||||
perror (_("Writing updated armap timestamp"));
|
||||
return true; /* Some error while writing */
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* BFD library support routines for architectures.
|
||||
Copyright (C) 1990, 91-97, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999, 2000
|
||||
Free Software Foundation, Inc.
|
||||
Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -77,6 +78,7 @@ DESCRIPTION
|
||||
.#define bfd_mach_m68030 5
|
||||
.#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.
|
||||
@ -104,8 +106,9 @@ DESCRIPTION
|
||||
.#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_v9 6
|
||||
.#define bfd_mach_sparc_v9a 7 {* 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_v9_p(mach) \
|
||||
. ((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a)
|
||||
@ -115,6 +118,7 @@ DESCRIPTION
|
||||
.#define bfd_mach_mips4000 4000
|
||||
.#define bfd_mach_mips4010 4010
|
||||
.#define bfd_mach_mips4100 4100
|
||||
.#define bfd_mach_mips4111 4111
|
||||
.#define bfd_mach_mips4300 4300
|
||||
.#define bfd_mach_mips4400 4400
|
||||
.#define bfd_mach_mips4600 4600
|
||||
@ -127,9 +131,11 @@ DESCRIPTION
|
||||
. 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 *}
|
||||
@ -143,34 +149,61 @@ DESCRIPTION
|
||||
. bfd_arch_rs6000, {* IBM RS/6000 *}
|
||||
. 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 *}
|
||||
.#define bfd_mach_z8001 1
|
||||
.#define bfd_mach_z8002 2
|
||||
. 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
|
||||
.#define bfd_mach_sh3 0x30
|
||||
.#define bfd_mach_sh3_dsp 0x3d
|
||||
.#define bfd_mach_sh3e 0x3e
|
||||
.#define bfd_mach_sh4 0x40
|
||||
. 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 *}
|
||||
.#define bfd_mach_arm_2 1
|
||||
.#define bfd_mach_arm_2a 2
|
||||
.#define bfd_mach_arm_2a 2
|
||||
.#define bfd_mach_arm_3 3
|
||||
.#define bfd_mach_arm_3M 4
|
||||
.#define bfd_mach_arm_4 5
|
||||
.#define bfd_mach_arm_4 5
|
||||
.#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_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 *}
|
||||
.#define bfd_mach_m32rx 'x'
|
||||
. 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_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
|
||||
. bfd_arch_last
|
||||
. };
|
||||
|
||||
@ -214,9 +247,11 @@ 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_d10v_arch;
|
||||
extern const bfd_arch_info_type bfd_d30v_arch;
|
||||
extern const bfd_arch_info_type bfd_h8300_arch;
|
||||
extern const bfd_arch_info_type bfd_h8500_arch;
|
||||
extern const bfd_arch_info_type bfd_hppa_arch;
|
||||
extern const bfd_arch_info_type bfd_i370_arch;
|
||||
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;
|
||||
@ -228,15 +263,20 @@ extern const bfd_arch_info_type bfd_mn10200_arch;
|
||||
extern const bfd_arch_info_type bfd_mn10300_arch;
|
||||
extern const bfd_arch_info_type bfd_powerpc_arch;
|
||||
extern const bfd_arch_info_type bfd_rs6000_arch;
|
||||
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_tic80_arch;
|
||||
extern const bfd_arch_info_type bfd_vax_arch;
|
||||
extern const bfd_arch_info_type bfd_we32k_arch;
|
||||
extern const bfd_arch_info_type bfd_z8k_arch;
|
||||
extern const bfd_arch_info_type bfd_ns32k_arch;
|
||||
extern const bfd_arch_info_type bfd_w65_arch;
|
||||
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;
|
||||
|
||||
static const bfd_arch_info_type * const bfd_archures_list[] =
|
||||
{
|
||||
@ -248,9 +288,11 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
|
||||
&bfd_arc_arch,
|
||||
&bfd_arm_arch,
|
||||
&bfd_d10v_arch,
|
||||
&bfd_d30v_arch,
|
||||
&bfd_h8300_arch,
|
||||
&bfd_h8500_arch,
|
||||
&bfd_hppa_arch,
|
||||
&bfd_i370_arch,
|
||||
&bfd_i386_arch,
|
||||
&bfd_i860_arch,
|
||||
&bfd_i960_arch,
|
||||
@ -265,12 +307,16 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
|
||||
&bfd_sh_arch,
|
||||
&bfd_sparc_arch,
|
||||
&bfd_tic30_arch,
|
||||
&bfd_tic80_arch,
|
||||
&bfd_vax_arch,
|
||||
&bfd_we32k_arch,
|
||||
&bfd_z8k_arch,
|
||||
&bfd_ns32k_arch,
|
||||
&bfd_w65_arch,
|
||||
&bfd_v850_arch,
|
||||
&bfd_fr30_arch,
|
||||
&bfd_mcore_arch,
|
||||
&bfd_avr_arch,
|
||||
#endif
|
||||
0
|
||||
};
|
||||
@ -747,10 +793,13 @@ bfd_default_scan (info, string)
|
||||
arch = bfd_arch_m68k;
|
||||
number = bfd_mach_m68040;
|
||||
break;
|
||||
case 68060:
|
||||
arch = bfd_arch_m68k;
|
||||
number = bfd_mach_m68060;
|
||||
break;
|
||||
case 68332:
|
||||
arch = bfd_arch_m68k;
|
||||
/* FIXME: This should be cpu32. */
|
||||
number = bfd_mach_m68020;
|
||||
number = bfd_mach_cpu32;
|
||||
break;
|
||||
|
||||
case 32000:
|
||||
@ -771,6 +820,26 @@ bfd_default_scan (info, string)
|
||||
arch = bfd_arch_rs6000;
|
||||
break;
|
||||
|
||||
case 7410:
|
||||
arch = bfd_arch_sh;
|
||||
number = bfd_mach_sh_dsp;
|
||||
break;
|
||||
|
||||
case 7708:
|
||||
arch = bfd_arch_sh;
|
||||
number = bfd_mach_sh3;
|
||||
break;
|
||||
|
||||
case 7729:
|
||||
arch = bfd_arch_sh;
|
||||
number = bfd_mach_sh3_dsp;
|
||||
break;
|
||||
|
||||
case 7750:
|
||||
arch = bfd_arch_sh;
|
||||
number = bfd_mach_sh4;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -863,9 +932,58 @@ 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!";
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_octets_per_byte
|
||||
|
||||
SYNOPSIS
|
||||
unsigned int bfd_octets_per_byte(bfd *abfd);
|
||||
|
||||
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;
|
||||
{
|
||||
return bfd_arch_mach_octets_per_byte (bfd_get_arch (abfd),
|
||||
bfd_get_mach (abfd));
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_arch_mach_octets_per_byte
|
||||
|
||||
SYNOPSIS
|
||||
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
|
||||
*/
|
||||
|
||||
unsigned int
|
||||
bfd_arch_mach_octets_per_byte (arch, mach)
|
||||
enum bfd_architecture arch;
|
||||
unsigned long mach;
|
||||
{
|
||||
const bfd_arch_info_type * ap = bfd_lookup_arch (arch, mach);
|
||||
|
||||
if (ap)
|
||||
return ap->bits_per_byte / 8;
|
||||
return 1;
|
||||
}
|
||||
|
49
contrib/binutils/bfd/armnetbsd.c
Normal file
49
contrib/binutils/bfd/armnetbsd.c
Normal file
@ -0,0 +1,49 @@
|
||||
/* BFD back-end for NetBSD/ARM a.out-ish binaries.
|
||||
Copyright (C) 1999 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. */
|
||||
|
||||
#define BYTES_IN_WORD 4
|
||||
#undef TARGET_IS_BIG_ENDIAN_P
|
||||
|
||||
#define TARGET_PAGE_SIZE 4096
|
||||
#define SEGMENT_SIZE TARGET_PAGE_SIZE
|
||||
|
||||
#define DEFAULT_ARCH bfd_arch_arm
|
||||
#define DEFAULT_MID M_ARM6_NETBSD
|
||||
/*#define MACHTYPE_OK(mtype) ((mtype) == M_ARM6_NETBSD)*/
|
||||
|
||||
#define MY(OP) CAT (armnetbsd_, OP)
|
||||
/* This needs to start with a.out so GDB knows it is an a.out variant. */
|
||||
#define TARGETNAME "a.out-arm-netbsd"
|
||||
|
||||
#if 0
|
||||
#define NAME(x,y) CAT3(aoutarm,_32_,y)
|
||||
|
||||
#define aoutarm_32_get_section_contents aout_32_get_section_contents
|
||||
|
||||
#define MY_bfd_reloc_type_lookup aoutarm_bfd_reloc_type_lookup
|
||||
|
||||
#include "bfd.h" /* To ensure following declaration is OK */
|
||||
|
||||
CONST struct reloc_howto_struct *
|
||||
MY_bfd_reloc_type_lookup
|
||||
PARAMS ((bfd * abfd AND
|
||||
bfd_reloc_code_real_type code));
|
||||
#endif
|
||||
|
||||
#include "netbsd.h"
|
@ -1,5 +1,5 @@
|
||||
/* Main header file for the bfd library -- portable access to object files.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support.
|
||||
|
||||
@ -89,7 +89,7 @@ typedef struct _bfd bfd;
|
||||
/* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h> -fnf */
|
||||
/* It gets worse if the host also defines a true/false enum... -sts */
|
||||
/* And even worse if your compiler has built-in boolean types... -law */
|
||||
#if defined (__GNUG__) && (__GNUC_MINOR__ > 5)
|
||||
#if defined (__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
|
||||
#define TRUE_FALSE_ALREADY_DEFINED
|
||||
#endif
|
||||
#ifdef MPW
|
||||
@ -121,20 +121,24 @@ typedef long int file_ptr;
|
||||
use gcc's "long long" type. Otherwise, BFD_HOST_64_BIT must be
|
||||
defined above. */
|
||||
|
||||
#ifndef BFD_HOST_64_BIT
|
||||
# if BFD_HOST_64BIT_LONG
|
||||
# define BFD_HOST_64_BIT long
|
||||
# define BFD_HOST_U_64_BIT unsigned long
|
||||
# else
|
||||
# ifdef __GNUC__
|
||||
# if __GNUC__ >= 2
|
||||
# define BFD_HOST_64_BIT long long
|
||||
# define BFD_HOST_U_64_BIT unsigned long long
|
||||
# endif /* __GNUC__ >= 2 */
|
||||
# endif /* ! defined (__GNUC__) */
|
||||
# endif /* ! BFD_HOST_64BIT_LONG */
|
||||
#endif /* ! defined (BFD_HOST_64_BIT) */
|
||||
|
||||
#ifdef BFD64
|
||||
|
||||
#ifndef BFD_HOST_64_BIT
|
||||
#if BFD_HOST_64BIT_LONG
|
||||
#define BFD_HOST_64_BIT long
|
||||
#define BFD_HOST_U_64_BIT unsigned long
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define BFD_HOST_64_BIT long long
|
||||
#define BFD_HOST_U_64_BIT unsigned long long
|
||||
#else /* ! defined (__GNUC__) */
|
||||
#error No 64 bit integer type available
|
||||
#endif /* ! defined (__GNUC__) */
|
||||
#endif /* ! BFD_HOST_64BIT_LONG */
|
||||
#endif /* ! defined (BFD_HOST_64_BIT) */
|
||||
|
||||
typedef BFD_HOST_U_64_BIT bfd_vma;
|
||||
@ -175,7 +179,9 @@ typedef unsigned long bfd_size_type;
|
||||
/* Print a bfd_vma x on stream s. */
|
||||
#define fprintf_vma(s,x) fprintf(s, "%08lx", x)
|
||||
#define sprintf_vma(s,x) sprintf(s, "%08lx", x)
|
||||
|
||||
#endif /* not BFD64 */
|
||||
|
||||
#define printf_vma(x) fprintf_vma(stdout,x)
|
||||
|
||||
typedef unsigned int flagword; /* 32 bits of flags */
|
||||
@ -620,6 +626,20 @@ extern boolean bfd_elf64_size_dynamic_sections
|
||||
extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
|
||||
extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
|
||||
|
||||
/* Return an upper bound on the number of bytes required to store a
|
||||
copy of ABFD's program header table entries. Return -1 if an error
|
||||
occurs; bfd_get_error will return an appropriate code. */
|
||||
extern long bfd_get_elf_phdr_upper_bound PARAMS ((bfd *abfd));
|
||||
|
||||
/* Copy ABFD's program header table entries to *PHDRS. The entries
|
||||
will be stored as an array of Elf_Internal_Phdr structures, as
|
||||
defined in include/elf/internal.h. To find out how large the
|
||||
buffer needs to be, call bfd_get_elf_phdr_upper_bound.
|
||||
|
||||
Return the number of program header table entries read, or -1 if an
|
||||
error occurs; bfd_get_error will return an appropriate code. */
|
||||
extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
|
||||
|
||||
/* SunOS shared library support routines for the linker. */
|
||||
|
||||
extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
|
||||
@ -691,7 +711,41 @@ union internal_auxent;
|
||||
|
||||
extern boolean bfd_coff_get_syment
|
||||
PARAMS ((bfd *, struct symbol_cache_entry *, struct internal_syment *));
|
||||
|
||||
extern boolean bfd_coff_get_auxent
|
||||
PARAMS ((bfd *, struct symbol_cache_entry *, int, union internal_auxent *));
|
||||
|
||||
extern boolean bfd_coff_set_symbol_class
|
||||
PARAMS ((bfd *, struct symbol_cache_entry *, unsigned int));
|
||||
|
||||
/* ARM Interworking support. Called from linker. */
|
||||
extern boolean bfd_arm_allocate_interworking_sections
|
||||
PARAMS ((struct bfd_link_info *));
|
||||
|
||||
extern boolean bfd_arm_process_before_allocation
|
||||
PARAMS ((bfd *, struct bfd_link_info *, int));
|
||||
|
||||
extern boolean bfd_arm_get_bfd_for_interworking
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* PE ARM Interworking support. Called from linker. */
|
||||
extern boolean bfd_arm_pe_allocate_interworking_sections
|
||||
PARAMS ((struct bfd_link_info *));
|
||||
|
||||
extern boolean bfd_arm_pe_process_before_allocation
|
||||
PARAMS ((bfd *, struct bfd_link_info *, int));
|
||||
|
||||
extern boolean bfd_arm_pe_get_bfd_for_interworking
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* ELF ARM Interworking support. Called from linker. */
|
||||
extern boolean bfd_elf32_arm_allocate_interworking_sections
|
||||
PARAMS ((struct bfd_link_info *));
|
||||
|
||||
extern boolean bfd_elf32_arm_process_before_allocation
|
||||
PARAMS ((bfd *, struct bfd_link_info *, int));
|
||||
|
||||
extern boolean bfd_elf32_arm_get_bfd_for_interworking
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* And more from the source. */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Main header file for the bfd library -- portable access to object files.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||
Free Software Foundation, Inc.
|
||||
Contributed by Cygnus Support.
|
||||
|
||||
@ -89,7 +89,7 @@ typedef struct _bfd bfd;
|
||||
/* Yup, SVR4 has a "typedef enum boolean" in <sys/types.h> -fnf */
|
||||
/* It gets worse if the host also defines a true/false enum... -sts */
|
||||
/* And even worse if your compiler has built-in boolean types... -law */
|
||||
#if defined (__GNUG__) && (__GNUC_MINOR__ > 5)
|
||||
#if defined (__GNUG__) && (__GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 6))
|
||||
#define TRUE_FALSE_ALREADY_DEFINED
|
||||
#endif
|
||||
#ifdef MPW
|
||||
@ -121,20 +121,24 @@ typedef long int file_ptr;
|
||||
use gcc's "long long" type. Otherwise, BFD_HOST_64_BIT must be
|
||||
defined above. */
|
||||
|
||||
#ifndef BFD_HOST_64_BIT
|
||||
# if BFD_HOST_64BIT_LONG
|
||||
# define BFD_HOST_64_BIT long
|
||||
# define BFD_HOST_U_64_BIT unsigned long
|
||||
# else
|
||||
# ifdef __GNUC__
|
||||
# if __GNUC__ >= 2
|
||||
# define BFD_HOST_64_BIT long long
|
||||
# define BFD_HOST_U_64_BIT unsigned long long
|
||||
# endif /* __GNUC__ >= 2 */
|
||||
# endif /* ! defined (__GNUC__) */
|
||||
# endif /* ! BFD_HOST_64BIT_LONG */
|
||||
#endif /* ! defined (BFD_HOST_64_BIT) */
|
||||
|
||||
#ifdef BFD64
|
||||
|
||||
#ifndef BFD_HOST_64_BIT
|
||||
#if BFD_HOST_64BIT_LONG
|
||||
#define BFD_HOST_64_BIT long
|
||||
#define BFD_HOST_U_64_BIT unsigned long
|
||||
#else
|
||||
#ifdef __GNUC__
|
||||
#define BFD_HOST_64_BIT long long
|
||||
#define BFD_HOST_U_64_BIT unsigned long long
|
||||
#else /* ! defined (__GNUC__) */
|
||||
#error No 64 bit integer type available
|
||||
#endif /* ! defined (__GNUC__) */
|
||||
#endif /* ! BFD_HOST_64BIT_LONG */
|
||||
#endif /* ! defined (BFD_HOST_64_BIT) */
|
||||
|
||||
typedef BFD_HOST_U_64_BIT bfd_vma;
|
||||
@ -175,7 +179,9 @@ typedef unsigned long bfd_size_type;
|
||||
/* Print a bfd_vma x on stream s. */
|
||||
#define fprintf_vma(s,x) fprintf(s, "%08lx", x)
|
||||
#define sprintf_vma(s,x) sprintf(s, "%08lx", x)
|
||||
|
||||
#endif /* not BFD64 */
|
||||
|
||||
#define printf_vma(x) fprintf_vma(stdout,x)
|
||||
|
||||
typedef unsigned int flagword; /* 32 bits of flags */
|
||||
@ -620,6 +626,20 @@ extern boolean bfd_elf64_size_dynamic_sections
|
||||
extern void bfd_elf_set_dt_needed_name PARAMS ((bfd *, const char *));
|
||||
extern const char *bfd_elf_get_dt_soname PARAMS ((bfd *));
|
||||
|
||||
/* Return an upper bound on the number of bytes required to store a
|
||||
copy of ABFD's program header table entries. Return -1 if an error
|
||||
occurs; bfd_get_error will return an appropriate code. */
|
||||
extern long bfd_get_elf_phdr_upper_bound PARAMS ((bfd *abfd));
|
||||
|
||||
/* Copy ABFD's program header table entries to *PHDRS. The entries
|
||||
will be stored as an array of Elf_Internal_Phdr structures, as
|
||||
defined in include/elf/internal.h. To find out how large the
|
||||
buffer needs to be, call bfd_get_elf_phdr_upper_bound.
|
||||
|
||||
Return the number of program header table entries read, or -1 if an
|
||||
error occurs; bfd_get_error will return an appropriate code. */
|
||||
extern int bfd_get_elf_phdrs PARAMS ((bfd *abfd, void *phdrs));
|
||||
|
||||
/* SunOS shared library support routines for the linker. */
|
||||
|
||||
extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
|
||||
@ -691,9 +711,43 @@ union internal_auxent;
|
||||
|
||||
extern boolean bfd_coff_get_syment
|
||||
PARAMS ((bfd *, struct symbol_cache_entry *, struct internal_syment *));
|
||||
|
||||
extern boolean bfd_coff_get_auxent
|
||||
PARAMS ((bfd *, struct symbol_cache_entry *, int, union internal_auxent *));
|
||||
|
||||
extern boolean bfd_coff_set_symbol_class
|
||||
PARAMS ((bfd *, struct symbol_cache_entry *, unsigned int));
|
||||
|
||||
/* ARM Interworking support. Called from linker. */
|
||||
extern boolean bfd_arm_allocate_interworking_sections
|
||||
PARAMS ((struct bfd_link_info *));
|
||||
|
||||
extern boolean bfd_arm_process_before_allocation
|
||||
PARAMS ((bfd *, struct bfd_link_info *, int));
|
||||
|
||||
extern boolean bfd_arm_get_bfd_for_interworking
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* PE ARM Interworking support. Called from linker. */
|
||||
extern boolean bfd_arm_pe_allocate_interworking_sections
|
||||
PARAMS ((struct bfd_link_info *));
|
||||
|
||||
extern boolean bfd_arm_pe_process_before_allocation
|
||||
PARAMS ((bfd *, struct bfd_link_info *, int));
|
||||
|
||||
extern boolean bfd_arm_pe_get_bfd_for_interworking
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* ELF ARM Interworking support. Called from linker. */
|
||||
extern boolean bfd_elf32_arm_allocate_interworking_sections
|
||||
PARAMS ((struct bfd_link_info *));
|
||||
|
||||
extern boolean bfd_elf32_arm_process_before_allocation
|
||||
PARAMS ((bfd *, struct bfd_link_info *, int));
|
||||
|
||||
extern boolean bfd_elf32_arm_get_bfd_for_interworking
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* And more from the source. */
|
||||
void
|
||||
bfd_init PARAMS ((void));
|
||||
@ -719,11 +773,17 @@ bfd_close_all_done PARAMS ((bfd *));
|
||||
bfd *
|
||||
bfd_create PARAMS ((CONST char *filename, bfd *templ));
|
||||
|
||||
boolean
|
||||
bfd_make_writable PARAMS ((bfd *abfd));
|
||||
|
||||
boolean
|
||||
bfd_make_readable PARAMS ((bfd *abfd));
|
||||
|
||||
|
||||
/* Byte swapping macros for user section data. */
|
||||
|
||||
#define bfd_put_8(abfd, val, ptr) \
|
||||
(*((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) \
|
||||
@ -758,6 +818,20 @@ bfd_create PARAMS ((CONST char *filename, bfd *templ));
|
||||
#define bfd_get_signed_64(abfd, ptr) \
|
||||
BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
|
||||
|
||||
#define bfd_get(bits, abfd, ptr) \
|
||||
((bits) == 8 ? bfd_get_8 (abfd, ptr) \
|
||||
: (bits) == 16 ? bfd_get_16 (abfd, ptr) \
|
||||
: (bits) == 32 ? bfd_get_32 (abfd, ptr) \
|
||||
: (bits) == 64 ? bfd_get_64 (abfd, ptr) \
|
||||
: (abort (), (bfd_vma) - 1))
|
||||
|
||||
#define bfd_put(bits, abfd, val, ptr) \
|
||||
((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
|
||||
: (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
|
||||
: (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
|
||||
: (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
|
||||
: (abort (), (void) 0))
|
||||
|
||||
|
||||
/* Byte swapping macros for file header data. */
|
||||
|
||||
@ -797,6 +871,27 @@ bfd_create PARAMS ((CONST char *filename, bfd *templ));
|
||||
#define bfd_h_get_signed_64(abfd, ptr) \
|
||||
BFD_SEND(abfd, bfd_h_getx_signed_64, (ptr))
|
||||
|
||||
/* This structure is used for a comdat section, as in PE. A comdat
|
||||
section is associated with a particular symbol. When the linker
|
||||
sees a comdat section, it keeps only one of the sections with a
|
||||
given name and associated with a given symbol. */
|
||||
|
||||
struct bfd_comdat_info
|
||||
{
|
||||
/* The name of the symbol associated with a comdat section. */
|
||||
const char *name;
|
||||
|
||||
/* The local symbol table index of the symbol associated with a
|
||||
comdat section. This is only meaningful to the object file format
|
||||
specific code; it is not an index into the list returned by
|
||||
bfd_canonicalize_symtab. */
|
||||
long symbol;
|
||||
|
||||
/* 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
|
||||
@ -862,7 +957,7 @@ typedef struct sec
|
||||
standard data. */
|
||||
#define SEC_CONSTRUCTOR 0x100
|
||||
|
||||
/* The section is a constuctor, and should be placed at the
|
||||
/* 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
|
||||
@ -951,6 +1046,17 @@ typedef struct sec
|
||||
else up the line will take care of it later. */
|
||||
#define SEC_LINKER_CREATED 0x800000
|
||||
|
||||
/* This section should not be subject to garbage collection. */
|
||||
#define SEC_KEEP 0x1000000
|
||||
|
||||
/* This section contains "short" data, and should be placed
|
||||
"near" the GP. */
|
||||
#define SEC_SMALL_DATA 0x2000000
|
||||
|
||||
/* This section contains data which may be shared with other
|
||||
executables or shared objects. */
|
||||
#define SEC_SHARED 0x4000000
|
||||
|
||||
/* End of section flags. */
|
||||
|
||||
/* Some internal packed boolean fields. */
|
||||
@ -964,6 +1070,9 @@ typedef struct sec
|
||||
/* A mark flag used by some of the linker backends. */
|
||||
unsigned int linker_mark : 1;
|
||||
|
||||
/* A mark flag used by some linker backends for garbage collection. */
|
||||
unsigned int gc_mark : 1;
|
||||
|
||||
/* End of internal packed boolean fields. */
|
||||
|
||||
/* The virtual memory address of the section - where it will be
|
||||
@ -981,22 +1090,25 @@ typedef struct sec
|
||||
|
||||
bfd_vma lma;
|
||||
|
||||
/* The size of the section in bytes, 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 */
|
||||
/* 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_size_type _cooked_size;
|
||||
|
||||
/* The original size on disk of the section, in bytes. Normally this
|
||||
/* The original size on disk of the section, in octets. Normally this
|
||||
value is the same as the size, but if some relaxing has
|
||||
been done, then this value will be bigger. */
|
||||
|
||||
bfd_size_type _raw_size;
|
||||
|
||||
/* If this section is going to be output, then this value is the
|
||||
offset into the output section of the first byte in the input
|
||||
section. E.g., if this was going to start at the 100th byte in
|
||||
the output section, this value would be 100. */
|
||||
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_vma output_offset;
|
||||
|
||||
@ -1054,6 +1166,10 @@ typedef struct sec
|
||||
|
||||
unsigned int lineno_count;
|
||||
|
||||
/* Optional information about a COMDAT entry; NULL if not COMDAT */
|
||||
|
||||
struct bfd_comdat_info *comdat;
|
||||
|
||||
/* When a section is being output, this value changes as more
|
||||
linenumbers are written out */
|
||||
|
||||
@ -1113,9 +1229,11 @@ extern const struct symbol_cache_entry * const bfd_com_symbol;
|
||||
extern const struct symbol_cache_entry * const bfd_und_symbol;
|
||||
extern const struct symbol_cache_entry * const bfd_ind_symbol;
|
||||
#define bfd_get_section_size_before_reloc(section) \
|
||||
(section->reloc_done ? (abort(),1): (section)->_raw_size)
|
||||
((section)->reloc_done ? (abort (), (bfd_size_type) 1) \
|
||||
: (section)->_raw_size)
|
||||
#define bfd_get_section_size_after_reloc(section) \
|
||||
((section->reloc_done) ? (section)->_cooked_size: (abort(),1))
|
||||
((section)->reloc_done ? (section)->_cooked_size \
|
||||
: (abort (), (bfd_size_type) 1))
|
||||
asection *
|
||||
bfd_get_section_by_name PARAMS ((bfd *abfd, CONST char *name));
|
||||
|
||||
@ -1160,6 +1278,10 @@ bfd_copy_private_section_data PARAMS ((bfd *ibfd, asection *isec, bfd *obfd, ase
|
||||
#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
|
||||
BFD_SEND (obfd, _bfd_copy_private_section_data, \
|
||||
(ibfd, isection, obfd, osection))
|
||||
void
|
||||
_bfd_strip_section_from_output
|
||||
PARAMS ((struct bfd_link_info *info, asection *section));
|
||||
|
||||
enum bfd_architecture
|
||||
{
|
||||
bfd_arch_unknown, /* File arch not known */
|
||||
@ -1172,6 +1294,7 @@ enum bfd_architecture
|
||||
#define bfd_mach_m68030 5
|
||||
#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.
|
||||
@ -1199,8 +1322,9 @@ enum bfd_architecture
|
||||
#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_v9 6
|
||||
#define bfd_mach_sparc_v9a 7 /* 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_v9_p(mach) \
|
||||
((mach) >= bfd_mach_sparc_v8plus && (mach) <= bfd_mach_sparc_v9a)
|
||||
@ -1210,6 +1334,7 @@ enum bfd_architecture
|
||||
#define bfd_mach_mips4000 4000
|
||||
#define bfd_mach_mips4010 4010
|
||||
#define bfd_mach_mips4100 4100
|
||||
#define bfd_mach_mips4111 4111
|
||||
#define bfd_mach_mips4300 4300
|
||||
#define bfd_mach_mips4400 4400
|
||||
#define bfd_mach_mips4600 4600
|
||||
@ -1222,9 +1347,11 @@ enum bfd_architecture
|
||||
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 */
|
||||
@ -1238,34 +1365,61 @@ enum bfd_architecture
|
||||
bfd_arch_rs6000, /* IBM RS/6000 */
|
||||
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 */
|
||||
#define bfd_mach_z8001 1
|
||||
#define bfd_mach_z8002 2
|
||||
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
|
||||
#define bfd_mach_sh3 0x30
|
||||
#define bfd_mach_sh3_dsp 0x3d
|
||||
#define bfd_mach_sh3e 0x3e
|
||||
#define bfd_mach_sh4 0x40
|
||||
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 */
|
||||
#define bfd_mach_arm_2 1
|
||||
#define bfd_mach_arm_2a 2
|
||||
#define bfd_mach_arm_2a 2
|
||||
#define bfd_mach_arm_3 3
|
||||
#define bfd_mach_arm_3M 4
|
||||
#define bfd_mach_arm_4 5
|
||||
#define bfd_mach_arm_4 5
|
||||
#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_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 */
|
||||
#define bfd_mach_m32rx 'x'
|
||||
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_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
|
||||
bfd_arch_last
|
||||
};
|
||||
|
||||
@ -1331,6 +1485,13 @@ const char *
|
||||
bfd_printable_arch_mach
|
||||
PARAMS ((enum bfd_architecture arch, unsigned long machine));
|
||||
|
||||
unsigned int
|
||||
bfd_octets_per_byte PARAMS ((bfd *abfd));
|
||||
|
||||
unsigned int
|
||||
bfd_arch_mach_octets_per_byte PARAMS ((enum bfd_architecture arch,
|
||||
unsigned long machine));
|
||||
|
||||
typedef enum bfd_reloc_status
|
||||
{
|
||||
/* No errors detected */
|
||||
@ -1449,13 +1610,26 @@ struct reloc_howto_struct
|
||||
/* The textual name of the relocation type. */
|
||||
char *name;
|
||||
|
||||
/* When performing a partial link, some formats must modify the
|
||||
relocations rather than the data - this flag signals this.*/
|
||||
/* Some formats record a relocation addend in the section contents
|
||||
rather than with the relocation. For ELF formats this is the
|
||||
distinction between USE_REL and USE_RELA (though the code checks
|
||||
for USE_REL == 1/0). The value of this field is TRUE if the
|
||||
addend is recorded with the section contents; when performing a
|
||||
partial link (ld -r) the section contents (the data) will be
|
||||
modified. The value of this field is FALSE if addends are
|
||||
recorded with the relocation (in arelent.addend); when performing
|
||||
a partial link the relocation will be modified.
|
||||
All relocations for all ELF USE_RELA targets should set this field
|
||||
to FALSE (values of TRUE should be looked on with suspicion).
|
||||
However, the converse is not true: not all relocations of all ELF
|
||||
USE_REL targets set this field to TRUE. Why this is so is peculiar
|
||||
to each particular target. For relocs that aren't used in partial
|
||||
links (e.g. GOT stuff) it doesn't matter what this is set to. */
|
||||
boolean partial_inplace;
|
||||
|
||||
/* The src_mask selects which parts of the read in data
|
||||
are to be used in the relocation sum. E.g., if this was an 8 bit
|
||||
bit of data which we read and relocated, this would be
|
||||
byte of data which we read and relocated, this would be
|
||||
0x000000ff. When we have relocs which have an addend, such as
|
||||
sun4 extended relocs, the value in the offset part of a
|
||||
relocating field is garbage so we never use it. In this case
|
||||
@ -1481,6 +1655,9 @@ struct reloc_howto_struct
|
||||
{(unsigned)C,R,S,B, P, BI, O,SF,NAME,INPLACE,MASKSRC,MASKDST,PC}
|
||||
#define NEWHOWTO( FUNCTION, NAME,SIZE,REL,IN) HOWTO(0,0,SIZE,0,REL,0,complain_overflow_dont,FUNCTION, NAME,false,0,0,IN)
|
||||
|
||||
#define EMPTY_HOWTO(C) \
|
||||
HOWTO((C),0,0,0,false,0,complain_overflow_dont,NULL,NULL,false,0,0,false)
|
||||
|
||||
#define HOWTO_PREPARE(relocation, symbol) \
|
||||
{ \
|
||||
if (symbol != (asymbol *)NULL) { \
|
||||
@ -1505,6 +1682,7 @@ bfd_check_overflow
|
||||
PARAMS ((enum complain_overflow how,
|
||||
unsigned int bitsize,
|
||||
unsigned int rightshift,
|
||||
unsigned int addrsize,
|
||||
bfd_vma relocation));
|
||||
|
||||
bfd_reloc_status_type
|
||||
@ -1661,6 +1839,9 @@ relocation types already defined. */
|
||||
BFD_RELOC_SPARC_L44,
|
||||
BFD_RELOC_SPARC_REGISTER,
|
||||
|
||||
/* SPARC little endian relocation */
|
||||
BFD_RELOC_SPARC_REV32,
|
||||
|
||||
/* Alpha ECOFF and ELF relocations. Some of these treat the symbol or
|
||||
"addend" in some special way.
|
||||
For GPDISP_HI16 ("gpdisp") relocations, the symbol is ignored when
|
||||
@ -1709,6 +1890,17 @@ The GNU linker currently doesn't do any of this optimizing. */
|
||||
BFD_RELOC_ALPHA_ELF_LITERAL,
|
||||
BFD_RELOC_ALPHA_LITUSE,
|
||||
|
||||
/* The BFD_RELOC_ALPHA_USER_* relocations are used by the assembler to
|
||||
process the explicit !<reloc>!sequence relocations, and are mapped
|
||||
into the normal relocations at the end of processing. */
|
||||
BFD_RELOC_ALPHA_USER_LITERAL,
|
||||
BFD_RELOC_ALPHA_USER_LITUSE_BASE,
|
||||
BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF,
|
||||
BFD_RELOC_ALPHA_USER_LITUSE_JSR,
|
||||
BFD_RELOC_ALPHA_USER_GPDISP,
|
||||
BFD_RELOC_ALPHA_USER_GPRELHIGH,
|
||||
BFD_RELOC_ALPHA_USER_GPRELLOW,
|
||||
|
||||
/* The HINT relocation indicates a value that should be filled into the
|
||||
"hint" field of a jmp/jsr/ret instruction, for possible branch-
|
||||
prediction logic which may be provided on some processors. */
|
||||
@ -1764,6 +1956,10 @@ to compensate for the borrow when the low bits are added. */
|
||||
BFD_RELOC_MIPS_GOT_LO16,
|
||||
BFD_RELOC_MIPS_CALL_HI16,
|
||||
BFD_RELOC_MIPS_CALL_LO16,
|
||||
BFD_RELOC_MIPS_SUB,
|
||||
BFD_RELOC_MIPS_GOT_PAGE,
|
||||
BFD_RELOC_MIPS_GOT_OFST,
|
||||
BFD_RELOC_MIPS_GOT_DISP,
|
||||
|
||||
|
||||
/* i386/elf relocations */
|
||||
@ -1790,6 +1986,14 @@ to compensate for the borrow when the low bits are added. */
|
||||
BFD_RELOC_NS32K_DISP_16_PCREL,
|
||||
BFD_RELOC_NS32K_DISP_32_PCREL,
|
||||
|
||||
/* Picojava relocs. Not all of these appear in object files. */
|
||||
BFD_RELOC_PJ_CODE_HI16,
|
||||
BFD_RELOC_PJ_CODE_LO16,
|
||||
BFD_RELOC_PJ_CODE_DIR16,
|
||||
BFD_RELOC_PJ_CODE_DIR32,
|
||||
BFD_RELOC_PJ_CODE_REL16,
|
||||
BFD_RELOC_PJ_CODE_REL32,
|
||||
|
||||
/* Power(rs6000) and PowerPC relocations. */
|
||||
BFD_RELOC_PPC_B26,
|
||||
BFD_RELOC_PPC_BA26,
|
||||
@ -1822,6 +2026,9 @@ to compensate for the borrow when the low bits are added. */
|
||||
BFD_RELOC_PPC_EMB_BIT_FLD,
|
||||
BFD_RELOC_PPC_EMB_RELSDA,
|
||||
|
||||
/* IBM 370/390 relocations */
|
||||
BFD_RELOC_I370_D12,
|
||||
|
||||
/* The type of reloc used to build a contructor table - at the moment
|
||||
probably a 32 bit wide absolute relocation, but the target can choose.
|
||||
It generally does map to one of the other relocation types. */
|
||||
@ -1834,6 +2041,7 @@ not stored in the instruction. */
|
||||
/* These relocs are only used within the ARM assembler. They are not
|
||||
(at present) written to any object files. */
|
||||
BFD_RELOC_ARM_IMMEDIATE,
|
||||
BFD_RELOC_ARM_ADRL_IMMEDIATE,
|
||||
BFD_RELOC_ARM_OFFSET_IMM,
|
||||
BFD_RELOC_ARM_SHIFT_IMM,
|
||||
BFD_RELOC_ARM_SWI,
|
||||
@ -1849,6 +2057,15 @@ not stored in the instruction. */
|
||||
BFD_RELOC_ARM_THUMB_IMM,
|
||||
BFD_RELOC_ARM_THUMB_SHIFT,
|
||||
BFD_RELOC_ARM_THUMB_OFFSET,
|
||||
BFD_RELOC_ARM_GOT12,
|
||||
BFD_RELOC_ARM_GOT32,
|
||||
BFD_RELOC_ARM_JUMP_SLOT,
|
||||
BFD_RELOC_ARM_COPY,
|
||||
BFD_RELOC_ARM_GLOB_DAT,
|
||||
BFD_RELOC_ARM_PLT32,
|
||||
BFD_RELOC_ARM_RELATIVE,
|
||||
BFD_RELOC_ARM_GOTOFF,
|
||||
BFD_RELOC_ARM_GOTPC,
|
||||
|
||||
/* Hitachi SH relocs. Not all of these appear in object files. */
|
||||
BFD_RELOC_SH_PCDISP8BY2,
|
||||
@ -1907,7 +2124,53 @@ assumed to be 0. */
|
||||
assumed to be 0. */
|
||||
BFD_RELOC_D10V_18_PCREL,
|
||||
|
||||
/* Mitsubishi D30V relocs.
|
||||
This is a 6-bit absolute reloc. */
|
||||
BFD_RELOC_D30V_6,
|
||||
|
||||
/* This is a 6-bit pc-relative reloc with
|
||||
the right 3 bits assumed to be 0. */
|
||||
BFD_RELOC_D30V_9_PCREL,
|
||||
|
||||
/* This is a 6-bit pc-relative reloc with
|
||||
the right 3 bits assumed to be 0. Same
|
||||
as the previous reloc but on the right side
|
||||
of the container. */
|
||||
BFD_RELOC_D30V_9_PCREL_R,
|
||||
|
||||
/* This is a 12-bit absolute reloc with the
|
||||
right 3 bitsassumed to be 0. */
|
||||
BFD_RELOC_D30V_15,
|
||||
|
||||
/* This is a 12-bit pc-relative reloc with
|
||||
the right 3 bits assumed to be 0. */
|
||||
BFD_RELOC_D30V_15_PCREL,
|
||||
|
||||
/* This is a 12-bit pc-relative reloc with
|
||||
the right 3 bits assumed to be 0. Same
|
||||
as the previous reloc but on the right side
|
||||
of the container. */
|
||||
BFD_RELOC_D30V_15_PCREL_R,
|
||||
|
||||
/* This is an 18-bit absolute reloc with
|
||||
the right 3 bits assumed to be 0. */
|
||||
BFD_RELOC_D30V_21,
|
||||
|
||||
/* This is an 18-bit pc-relative reloc with
|
||||
the right 3 bits assumed to be 0. */
|
||||
BFD_RELOC_D30V_21_PCREL,
|
||||
|
||||
/* This is an 18-bit pc-relative reloc with
|
||||
the right 3 bits assumed to be 0. Same
|
||||
as the previous reloc but on the right side
|
||||
of the container. */
|
||||
BFD_RELOC_D30V_21_PCREL_R,
|
||||
|
||||
/* This is a 32-bit absolute reloc. */
|
||||
BFD_RELOC_D30V_32,
|
||||
|
||||
/* This is a 32-bit pc-relative reloc. */
|
||||
BFD_RELOC_D30V_32_PCREL,
|
||||
|
||||
/* Mitsubishi M32R relocs.
|
||||
This is a 24 bit absolute address. */
|
||||
@ -1971,6 +2234,27 @@ data area pointer. */
|
||||
/* This is a 16 bit offset from the tiny data area pointer. */
|
||||
BFD_RELOC_V850_TDA_16_16_OFFSET,
|
||||
|
||||
/* This is a 5 bit offset (of which only 4 bits are used) from the tiny
|
||||
data area pointer. */
|
||||
BFD_RELOC_V850_TDA_4_5_OFFSET,
|
||||
|
||||
/* This is a 4 bit offset from the tiny data area pointer. */
|
||||
BFD_RELOC_V850_TDA_4_4_OFFSET,
|
||||
|
||||
/* This is a 16 bit offset from the short data area pointer, with the
|
||||
bits placed non-contigously in the instruction. */
|
||||
BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET,
|
||||
|
||||
/* This is a 16 bit offset from the zero data area pointer, with the
|
||||
bits placed non-contigously in the instruction. */
|
||||
BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET,
|
||||
|
||||
/* This is a 6 bit offset from the call table base pointer. */
|
||||
BFD_RELOC_V850_CALLT_6_7_OFFSET,
|
||||
|
||||
/* This is a 16 bit offset from the call table base pointer. */
|
||||
BFD_RELOC_V850_CALLT_16_16_OFFSET,
|
||||
|
||||
|
||||
/* This is a 32bit pcrel reloc for the mn10300, offset by two bytes in the
|
||||
instruction. */
|
||||
@ -1984,6 +2268,133 @@ instruction. */
|
||||
significant 8 bits of a 24 bit word are placed into the least
|
||||
significant 8 bits of the opcode. */
|
||||
BFD_RELOC_TIC30_LDP,
|
||||
|
||||
/* This is a 48 bit reloc for the FR30 that stores 32 bits. */
|
||||
BFD_RELOC_FR30_48,
|
||||
|
||||
/* This is a 32 bit reloc for the FR30 that stores 20 bits split up into
|
||||
two sections. */
|
||||
BFD_RELOC_FR30_20,
|
||||
|
||||
/* This is a 16 bit reloc for the FR30 that stores a 6 bit word offset in
|
||||
4 bits. */
|
||||
BFD_RELOC_FR30_6_IN_4,
|
||||
|
||||
/* This is a 16 bit reloc for the FR30 that stores an 8 bit byte offset
|
||||
into 8 bits. */
|
||||
BFD_RELOC_FR30_8_IN_8,
|
||||
|
||||
/* This is a 16 bit reloc for the FR30 that stores a 9 bit short offset
|
||||
into 8 bits. */
|
||||
BFD_RELOC_FR30_9_IN_8,
|
||||
|
||||
/* This is a 16 bit reloc for the FR30 that stores a 10 bit word offset
|
||||
into 8 bits. */
|
||||
BFD_RELOC_FR30_10_IN_8,
|
||||
|
||||
/* This is a 16 bit reloc for the FR30 that stores a 9 bit pc relative
|
||||
short offset into 8 bits. */
|
||||
BFD_RELOC_FR30_9_PCREL,
|
||||
|
||||
/* This is a 16 bit reloc for the FR30 that stores a 12 bit pc relative
|
||||
short offset into 11 bits. */
|
||||
BFD_RELOC_FR30_12_PCREL,
|
||||
|
||||
/* Motorola Mcore relocations. */
|
||||
BFD_RELOC_MCORE_PCREL_IMM8BY4,
|
||||
BFD_RELOC_MCORE_PCREL_IMM11BY2,
|
||||
BFD_RELOC_MCORE_PCREL_IMM4BY2,
|
||||
BFD_RELOC_MCORE_PCREL_32,
|
||||
BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2,
|
||||
BFD_RELOC_MCORE_RVA,
|
||||
|
||||
/* This is a 16 bit reloc for the AVR that stores 8 bit pc relative
|
||||
short offset into 7 bits. */
|
||||
BFD_RELOC_AVR_7_PCREL,
|
||||
|
||||
/* This is a 16 bit reloc for the AVR that stores 13 bit pc relative
|
||||
short offset into 12 bits. */
|
||||
BFD_RELOC_AVR_13_PCREL,
|
||||
|
||||
/* This is a 16 bit reloc for the AVR that stores 17 bit value (usually
|
||||
program memory address) into 16 bits. */
|
||||
BFD_RELOC_AVR_16_PM,
|
||||
|
||||
/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
|
||||
data memory address) into 8 bit immediate value of LDI insn. */
|
||||
BFD_RELOC_AVR_LO8_LDI,
|
||||
|
||||
/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
|
||||
of data memory address) into 8 bit immediate value of LDI insn. */
|
||||
BFD_RELOC_AVR_HI8_LDI,
|
||||
|
||||
/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
|
||||
of program memory address) into 8 bit immediate value of LDI insn. */
|
||||
BFD_RELOC_AVR_HH8_LDI,
|
||||
|
||||
/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
|
||||
(usually data memory address) into 8 bit immediate value of SUBI insn. */
|
||||
BFD_RELOC_AVR_LO8_LDI_NEG,
|
||||
|
||||
/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
|
||||
(high 8 bit of data memory address) into 8 bit immediate value of
|
||||
SUBI insn. */
|
||||
BFD_RELOC_AVR_HI8_LDI_NEG,
|
||||
|
||||
/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
|
||||
(most high 8 bit of program memory address) into 8 bit immediate value
|
||||
of LDI or SUBI insn. */
|
||||
BFD_RELOC_AVR_HH8_LDI_NEG,
|
||||
|
||||
/* This is a 16 bit reloc for the AVR that stores 8 bit value (usually
|
||||
command address) into 8 bit immediate value of LDI insn. */
|
||||
BFD_RELOC_AVR_LO8_LDI_PM,
|
||||
|
||||
/* This is a 16 bit reloc for the AVR that stores 8 bit value (high 8 bit
|
||||
of command address) into 8 bit immediate value of LDI insn. */
|
||||
BFD_RELOC_AVR_HI8_LDI_PM,
|
||||
|
||||
/* This is a 16 bit reloc for the AVR that stores 8 bit value (most high 8 bit
|
||||
of command address) into 8 bit immediate value of LDI insn. */
|
||||
BFD_RELOC_AVR_HH8_LDI_PM,
|
||||
|
||||
/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
|
||||
(usually command address) into 8 bit immediate value of SUBI insn. */
|
||||
BFD_RELOC_AVR_LO8_LDI_PM_NEG,
|
||||
|
||||
/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
|
||||
(high 8 bit of 16 bit command address) into 8 bit immediate value
|
||||
of SUBI insn. */
|
||||
BFD_RELOC_AVR_HI8_LDI_PM_NEG,
|
||||
|
||||
/* This is a 16 bit reloc for the AVR that stores negated 8 bit value
|
||||
(high 6 bit of 22 bit command address) into 8 bit immediate
|
||||
value of SUBI insn. */
|
||||
BFD_RELOC_AVR_HH8_LDI_PM_NEG,
|
||||
|
||||
/* This is a 32 bit reloc for the AVR that stores 23 bit value
|
||||
into 22 bits. */
|
||||
BFD_RELOC_AVR_CALL,
|
||||
|
||||
/* These two relocations are used by the linker to determine which of
|
||||
the entries in a C++ virtual function table are actually used. When
|
||||
the --gc-sections option is given, the linker will zero out the entries
|
||||
that are not used, so that the code for those functions need not be
|
||||
included in the output.
|
||||
|
||||
VTABLE_INHERIT is a zero-space relocation used to describe to the
|
||||
linker the inheritence tree of a C++ virtual function table. The
|
||||
relocation's symbol should be the parent class' vtable, and the
|
||||
relocation should be located at the child vtable.
|
||||
|
||||
VTABLE_ENTRY is a zero-space relocation that describes the use of a
|
||||
virtual function table entry. The reloc's symbol should refer to the
|
||||
table of the class mentioned in the code. Off of that base, an offset
|
||||
describes the entry that is being used. For Rela hosts, this offset
|
||||
is stored in the reloc's addend. For Rel hosts, we are forced to put
|
||||
this offset in the reloc's section offset. */
|
||||
BFD_RELOC_VTABLE_INHERIT,
|
||||
BFD_RELOC_VTABLE_ENTRY,
|
||||
BFD_RELOC_UNUSED };
|
||||
typedef enum bfd_reloc_code_real bfd_reloc_code_real_type;
|
||||
reloc_howto_type *
|
||||
@ -2038,7 +2449,7 @@ typedef struct symbol_cache_entry
|
||||
<<BSF_GLOBAL>> */
|
||||
|
||||
/* The symbol is a debugging record. The value has an arbitary
|
||||
meaning. */
|
||||
meaning, unless BSF_DEBUGGING_RELOC is also set. */
|
||||
#define BSF_DEBUGGING 0x08
|
||||
|
||||
/* The symbol denotes a function entry point. Used in ELF,
|
||||
@ -2096,6 +2507,11 @@ typedef struct symbol_cache_entry
|
||||
others someday. */
|
||||
#define BSF_OBJECT 0x10000
|
||||
|
||||
/* This symbol is a debugging symbol. The value is the offset
|
||||
into the section of the data. BSF_DEBUGGING should be set
|
||||
as well. */
|
||||
#define BSF_DEBUGGING_RELOC 0x20000
|
||||
|
||||
flagword flags;
|
||||
|
||||
/* A pointer to the section to which this symbol is
|
||||
@ -2137,6 +2553,9 @@ bfd_print_symbol_vandf PARAMS ((PTR file, asymbol *symbol));
|
||||
int
|
||||
bfd_decode_symclass PARAMS ((asymbol *symbol));
|
||||
|
||||
boolean
|
||||
bfd_is_undefined_symclass PARAMS ((int symclass));
|
||||
|
||||
void
|
||||
bfd_symbol_info PARAMS ((asymbol *symbol, symbol_info *ret));
|
||||
|
||||
@ -2280,6 +2699,7 @@ struct _bfd
|
||||
struct nlm_obj_tdata *nlm_obj_data;
|
||||
struct bout_data_struct *bout_data;
|
||||
struct sun_core_struct *sun_core_data;
|
||||
struct sco5_core_struct *sco5_core_data;
|
||||
struct trad_core_struct *trad_core_data;
|
||||
struct som_data_struct *som_data;
|
||||
struct hpux_core_struct *hpux_core_data;
|
||||
@ -2432,6 +2852,9 @@ bfd_set_private_flags PARAMS ((bfd *abfd, flagword flags));
|
||||
#define bfd_relax_section(abfd, section, link_info, again) \
|
||||
BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
|
||||
|
||||
#define bfd_gc_sections(abfd, link_info) \
|
||||
BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
|
||||
|
||||
#define bfd_link_hash_table_create(abfd) \
|
||||
BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
|
||||
|
||||
@ -2519,6 +2942,7 @@ enum bfd_flavour {
|
||||
bfd_target_os9k_flavour,
|
||||
bfd_target_versados_flavour,
|
||||
bfd_target_msdos_flavour,
|
||||
bfd_target_ovax_flavour,
|
||||
bfd_target_evax_flavour
|
||||
};
|
||||
|
||||
@ -2726,7 +3150,8 @@ CAT(NAME,_bfd_relax_section),\
|
||||
CAT(NAME,_bfd_link_hash_table_create),\
|
||||
CAT(NAME,_bfd_link_add_symbols),\
|
||||
CAT(NAME,_bfd_final_link),\
|
||||
CAT(NAME,_bfd_link_split_section)
|
||||
CAT(NAME,_bfd_link_split_section),\
|
||||
CAT(NAME,_bfd_gc_sections)
|
||||
int (*_bfd_sizeof_headers) PARAMS ((bfd *, boolean));
|
||||
bfd_byte * (*_bfd_get_relocated_section_contents) PARAMS ((bfd *,
|
||||
struct bfd_link_info *, struct bfd_link_order *,
|
||||
@ -2750,7 +3175,10 @@ CAT(NAME,_bfd_link_split_section)
|
||||
/* Should this section be split up into smaller pieces during linking. */
|
||||
boolean (*_bfd_link_split_section) PARAMS ((bfd *, struct sec *));
|
||||
|
||||
/* Routines to handle dynamic symbols and relocs. */
|
||||
/* 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. */
|
||||
#define BFD_JUMP_TABLE_DYNAMIC(NAME)\
|
||||
CAT(NAME,_get_dynamic_symtab_upper_bound),\
|
||||
CAT(NAME,_canonicalize_dynamic_symtab),\
|
||||
@ -2767,7 +3195,11 @@ CAT(NAME,_canonicalize_dynamic_reloc)
|
||||
long (*_bfd_canonicalize_dynamic_reloc)
|
||||
PARAMS ((bfd *, arelent **, struct symbol_cache_entry **));
|
||||
|
||||
/* Opposite endian version of this target. */
|
||||
const struct bfd_target * alternative_target;
|
||||
|
||||
PTR backend_data;
|
||||
|
||||
} bfd_target;
|
||||
boolean
|
||||
bfd_set_default_target PARAMS ((const char *name));
|
||||
@ -2778,6 +3210,9 @@ bfd_find_target PARAMS ((CONST char *target_name, bfd *abfd));
|
||||
const char **
|
||||
bfd_target_list PARAMS ((void));
|
||||
|
||||
const bfd_target *
|
||||
bfd_search_for_target PARAMS ((int (* search_func)(const bfd_target *, void *), void *));
|
||||
|
||||
boolean
|
||||
bfd_check_format PARAMS ((bfd *abfd, bfd_format format));
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Generic BFD library interface and support routines.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
|
||||
Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
@ -167,6 +167,7 @@ CODE_FRAGMENT
|
||||
. struct nlm_obj_tdata *nlm_obj_data;
|
||||
. struct bout_data_struct *bout_data;
|
||||
. struct sun_core_struct *sun_core_data;
|
||||
. struct sco5_core_struct *sco5_core_data;
|
||||
. struct trad_core_struct *trad_core_data;
|
||||
. struct som_data_struct *som_data;
|
||||
. struct hpux_core_struct *hpux_core_data;
|
||||
@ -270,25 +271,25 @@ CODE_FRAGMENT
|
||||
static bfd_error_type bfd_error = bfd_error_no_error;
|
||||
|
||||
CONST char *CONST bfd_errmsgs[] = {
|
||||
"No error",
|
||||
"System call error",
|
||||
"Invalid bfd target",
|
||||
"File in wrong format",
|
||||
"Invalid operation",
|
||||
"Memory exhausted",
|
||||
"No symbols",
|
||||
"Archive has no index; run ranlib to add one",
|
||||
"No more archived files",
|
||||
"Malformed archive",
|
||||
"File format not recognized",
|
||||
"File format is ambiguous",
|
||||
"Section has no contents",
|
||||
"Nonrepresentable section on output",
|
||||
"Symbol needs debug section which does not exist",
|
||||
"Bad value",
|
||||
"File truncated",
|
||||
"File too big",
|
||||
"#<Invalid error code>"
|
||||
N_("No error"),
|
||||
N_("System call error"),
|
||||
N_("Invalid bfd target"),
|
||||
N_("File in wrong format"),
|
||||
N_("Invalid operation"),
|
||||
N_("Memory exhausted"),
|
||||
N_("No symbols"),
|
||||
N_("Archive has no index; run ranlib to add one"),
|
||||
N_("No more archived files"),
|
||||
N_("Malformed archive"),
|
||||
N_("File format not recognized"),
|
||||
N_("File format is ambiguous"),
|
||||
N_("Section has no contents"),
|
||||
N_("Nonrepresentable section on output"),
|
||||
N_("Symbol needs debug section which does not exist"),
|
||||
N_("Bad value"),
|
||||
N_("File truncated"),
|
||||
N_("File too big"),
|
||||
N_("#<Invalid error code>")
|
||||
};
|
||||
|
||||
/*
|
||||
@ -352,7 +353,7 @@ bfd_errmsg (error_tag)
|
||||
((int)error_tag > (int)bfd_error_invalid_error_code)))
|
||||
error_tag = bfd_error_invalid_error_code;/* sanity check */
|
||||
|
||||
return bfd_errmsgs [(int)error_tag];
|
||||
return _(bfd_errmsgs [(int)error_tag]);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -617,7 +618,7 @@ DESCRIPTION
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
bfd_set_reloc (ignore_abfd, asect, location, count)
|
||||
bfd *ignore_abfd;
|
||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
||||
sec_ptr asect;
|
||||
arelent **location;
|
||||
unsigned int count;
|
||||
@ -675,9 +676,33 @@ bfd_assert (file, line)
|
||||
const char *file;
|
||||
int line;
|
||||
{
|
||||
(*_bfd_error_handler) ("bfd assertion fail %s:%d", file, line);
|
||||
(*_bfd_error_handler) (_("bfd assertion fail %s:%d"), file, line);
|
||||
}
|
||||
|
||||
/* A more or less friendly abort message. In libbfd.h abort is
|
||||
defined to call this function. */
|
||||
|
||||
#ifndef EXIT_FAILURE
|
||||
#define EXIT_FAILURE 1
|
||||
#endif
|
||||
|
||||
void
|
||||
_bfd_abort (file, line, fn)
|
||||
const char *file;
|
||||
int line;
|
||||
const char *fn;
|
||||
{
|
||||
if (fn != NULL)
|
||||
(*_bfd_error_handler)
|
||||
(_("BFD internal error, aborting at %s line %d in %s\n"),
|
||||
file, line, fn);
|
||||
else
|
||||
(*_bfd_error_handler)
|
||||
(_("BFD internal error, aborting at %s line %d\n"),
|
||||
file, line);
|
||||
(*_bfd_error_handler) (_("Please report this bug.\n"));
|
||||
xexit (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
@ -1044,6 +1069,9 @@ DESCRIPTION
|
||||
.#define bfd_relax_section(abfd, section, link_info, again) \
|
||||
. BFD_SEND (abfd, _bfd_relax_section, (abfd, section, link_info, again))
|
||||
.
|
||||
.#define bfd_gc_sections(abfd, link_info) \
|
||||
. BFD_SEND (abfd, _bfd_gc_sections, (abfd, link_info))
|
||||
.
|
||||
.#define bfd_link_hash_table_create(abfd) \
|
||||
. BFD_SEND (abfd, _bfd_link_hash_table_create, (abfd))
|
||||
.
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD back-end for binary objects.
|
||||
Copyright 1994, 95, 96, 97, 1998 Free Software Foundation, Inc.
|
||||
Copyright 1994, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -58,7 +58,7 @@ static int binary_sizeof_headers PARAMS ((bfd *, boolean));
|
||||
|
||||
static boolean
|
||||
binary_mkobject (abfd)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -112,7 +112,7 @@ binary_object_p (abfd)
|
||||
static boolean
|
||||
binary_get_section_contents (abfd, section, location, offset, count)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
asection *section ATTRIBUTE_UNUSED;
|
||||
PTR location;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
@ -127,7 +127,7 @@ binary_get_section_contents (abfd, section, location, offset, count)
|
||||
|
||||
static long
|
||||
binary_get_symtab_upper_bound (abfd)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return (BIN_SYMS + 1) * sizeof (asymbol *);
|
||||
}
|
||||
@ -222,7 +222,7 @@ binary_make_empty_symbol (abfd)
|
||||
|
||||
static void
|
||||
binary_get_symbol_info (ignore_abfd, symbol, ret)
|
||||
bfd *ignore_abfd;
|
||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
||||
asymbol *symbol;
|
||||
symbol_info *ret;
|
||||
{
|
||||
@ -255,14 +255,6 @@ binary_set_section_contents (abfd, sec, data, offset, size)
|
||||
file_ptr offset;
|
||||
bfd_size_type size;
|
||||
{
|
||||
/* We don't want to output anything for a section that is neither
|
||||
loaded nor allocated. The contents of such a section are not
|
||||
meaningful in the binary format. */
|
||||
if ((sec->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
|
||||
return true;
|
||||
if ((sec->flags & SEC_NEVER_LOAD) != 0)
|
||||
return true;
|
||||
|
||||
if (! abfd->output_has_begun)
|
||||
{
|
||||
boolean found_low;
|
||||
@ -275,7 +267,8 @@ binary_set_section_contents (abfd, sec, data, offset, size)
|
||||
found_low = false;
|
||||
low = 0;
|
||||
for (s = abfd->sections; s != NULL; s = s->next)
|
||||
if (((s->flags & (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC))
|
||||
if (((s->flags
|
||||
& (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC | SEC_NEVER_LOAD))
|
||||
== (SEC_HAS_CONTENTS | SEC_LOAD | SEC_ALLOC))
|
||||
&& (! found_low || s->lma < low))
|
||||
{
|
||||
@ -284,11 +277,40 @@ binary_set_section_contents (abfd, sec, data, offset, size)
|
||||
}
|
||||
|
||||
for (s = abfd->sections; s != NULL; s = s->next)
|
||||
s->filepos = s->lma - low;
|
||||
{
|
||||
s->filepos = s->lma - low;
|
||||
|
||||
/* Skip following warning check for sections that will not
|
||||
occupy file space. */
|
||||
if ((s->flags
|
||||
& (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_NEVER_LOAD))
|
||||
!= (SEC_HAS_CONTENTS | SEC_ALLOC))
|
||||
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. */
|
||||
|
||||
if (s->filepos < 0)
|
||||
(*_bfd_error_handler)
|
||||
(_("Warning: Writing section `%s' to huge (ie negative) file offset 0x%lx."),
|
||||
bfd_get_section_name (abfd, s),
|
||||
(unsigned long) s->filepos);
|
||||
}
|
||||
|
||||
abfd->output_has_begun = true;
|
||||
}
|
||||
|
||||
/* We don't want to output anything for a section that is neither
|
||||
loaded nor allocated. The contents of such a section are not
|
||||
meaningful in the binary format. */
|
||||
if ((sec->flags & (SEC_LOAD | SEC_ALLOC)) == 0)
|
||||
return true;
|
||||
if ((sec->flags & SEC_NEVER_LOAD) != 0)
|
||||
return true;
|
||||
|
||||
return _bfd_generic_set_section_contents (abfd, sec, data, offset, size);
|
||||
}
|
||||
|
||||
@ -296,8 +318,8 @@ binary_set_section_contents (abfd, sec, data, offset, size)
|
||||
|
||||
static int
|
||||
binary_sizeof_headers (abfd, exec)
|
||||
bfd *abfd;
|
||||
boolean exec;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
boolean exec ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -305,6 +327,7 @@ binary_sizeof_headers (abfd, exec)
|
||||
#define binary_bfd_get_relocated_section_contents \
|
||||
bfd_generic_get_relocated_section_contents
|
||||
#define binary_bfd_relax_section bfd_generic_relax_section
|
||||
#define binary_bfd_gc_sections bfd_generic_gc_sections
|
||||
#define binary_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define binary_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define binary_bfd_final_link _bfd_generic_final_link
|
||||
@ -359,5 +382,7 @@ const bfd_target binary_vec =
|
||||
BFD_JUMP_TABLE_LINK (binary),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
NULL,
|
||||
|
||||
NULL
|
||||
};
|
||||
|
@ -285,10 +285,25 @@ bfd_open_file (abfd)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Create the file. Unlink it first, for the convenience of
|
||||
operating systems which worry about overwriting running
|
||||
binaries. */
|
||||
unlink (abfd->filename);
|
||||
/* Create the file.
|
||||
|
||||
Some operating systems won't let us overwrite a running
|
||||
binary. For them, we want to unlink the file first.
|
||||
|
||||
However, gcc 2.95 will create temporary files using
|
||||
O_EXCL and tight permissions to prevent other users from
|
||||
substituting other .o files during the compilation. gcc
|
||||
will then tell the assembler to use the newly created
|
||||
file as an output file. If we unlink the file here, we
|
||||
open a brief window when another user could still
|
||||
substitute a file.
|
||||
|
||||
So we unlink the output file if and only if it has
|
||||
non-zero size. */
|
||||
struct stat s;
|
||||
|
||||
if (stat (abfd->filename, &s) == 0 && s.st_size != 0)
|
||||
unlink (abfd->filename);
|
||||
abfd->iostream = (PTR) fopen (abfd->filename, FOPEN_WB);
|
||||
abfd->opened_once = true;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD back-end for ALPHA Extended-Coff files.
|
||||
Copyright 1993, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
Copyright 1993, 94, 95, 96, 97, 98, 1999 Free Software Foundation, Inc.
|
||||
Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
|
||||
Ian Lance Taylor <ian@cygnus.com>.
|
||||
|
||||
@ -877,7 +877,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
|
||||
if (r == bfd_reloc_ok && gp_undefined)
|
||||
{
|
||||
r = bfd_reloc_dangerous;
|
||||
err = (char *) "GP relative relocation used when GP not defined";
|
||||
err = (char *) _("GP relative relocation used when GP not defined");
|
||||
}
|
||||
break;
|
||||
|
||||
@ -914,7 +914,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
|
||||
{
|
||||
r = bfd_reloc_dangerous;
|
||||
err =
|
||||
(char *) "GP relative relocation used when GP not defined";
|
||||
(char *) _("GP relative relocation used when GP not defined");
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -1133,7 +1133,7 @@ alpha_ecoff_get_relocated_section_contents (abfd, link_info, link_order,
|
||||
case bfd_reloc_undefined:
|
||||
if (! ((*link_info->callbacks->undefined_symbol)
|
||||
(link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
|
||||
input_bfd, input_section, rel->address)))
|
||||
input_bfd, input_section, rel->address, true)))
|
||||
goto error_return;
|
||||
break;
|
||||
case bfd_reloc_dangerous:
|
||||
@ -1483,7 +1483,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
if (gp && !ecoff_data (output_bfd)->issued_multiple_gp_warning)
|
||||
{
|
||||
(*info->callbacks->warning) (info,
|
||||
"using multiple gp values",
|
||||
_("using multiple gp values"),
|
||||
(char *) NULL, output_bfd,
|
||||
(asection *) NULL, (bfd_vma) 0);
|
||||
ecoff_data (output_bfd)->issued_multiple_gp_warning = true;
|
||||
@ -1719,7 +1719,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
relocated. */
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.string, input_bfd,
|
||||
input_section, (bfd_vma) 0)))
|
||||
input_section, (bfd_vma) 0, true)))
|
||||
return false;
|
||||
addend = 0;
|
||||
}
|
||||
@ -1921,7 +1921,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.string, input_bfd,
|
||||
input_section,
|
||||
r_vaddr - input_section->vma)))
|
||||
r_vaddr - input_section->vma, true)))
|
||||
return false;
|
||||
relocation = 0;
|
||||
}
|
||||
@ -1989,7 +1989,7 @@ alpha_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
if (gp_usedp && gp_undefined)
|
||||
{
|
||||
if (! ((*info->callbacks->reloc_dangerous)
|
||||
(info, "GP relative relocation when GP not defined",
|
||||
(info, _("GP relative relocation when GP not defined"),
|
||||
input_bfd, input_section, r_vaddr - input_section->vma)))
|
||||
return false;
|
||||
/* Only give the error once per link. */
|
||||
@ -2266,13 +2266,14 @@ 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, true, false, 4,
|
||||
FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true, false, 4,
|
||||
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,
|
||||
alpha_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
|
||||
_bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL, NULL
|
||||
},
|
||||
/* Supported architecture. */
|
||||
bfd_arch_alpha,
|
||||
@ -2357,6 +2358,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
|
||||
|
||||
/* Relaxing sections is generic. */
|
||||
#define _bfd_ecoff_bfd_relax_section bfd_generic_relax_section
|
||||
#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
|
||||
|
||||
const bfd_target ecoffalpha_little_vec =
|
||||
{
|
||||
@ -2397,5 +2399,7 @@ const bfd_target ecoffalpha_little_vec =
|
||||
BFD_JUMP_TABLE_LINK (_bfd_ecoff),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
NULL,
|
||||
|
||||
(PTR) &alpha_ecoff_backend_data
|
||||
};
|
||||
|
2552
contrib/binutils/bfd/coff-arm.c
Normal file
2552
contrib/binutils/bfd/coff-arm.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/* BFD back-end for Intel 386 COFF files.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||
Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
@ -37,13 +37,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "libcoff.h"
|
||||
|
||||
static bfd_reloc_status_type coff_i386_reloc
|
||||
static bfd_reloc_status_type coff_i386_reloc
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static reloc_howto_type *coff_i386_rtype_to_howto
|
||||
PARAMS ((bfd *, asection *, struct internal_reloc *,
|
||||
struct coff_link_hash_entry *, struct internal_syment *,
|
||||
|
||||
bfd_vma *));
|
||||
static reloc_howto_type *coff_i386_reloc_type_lookup
|
||||
PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
|
||||
/* The page size is a guess based on ELF. */
|
||||
@ -66,9 +67,9 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
asection *input_section ATTRIBUTE_UNUSED;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
symvalue diff;
|
||||
|
||||
@ -106,8 +107,8 @@ coff_i386_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
|
||||
|
||||
#ifdef COFF_WITH_PE
|
||||
/* FIXME: How should this case be handled? */
|
||||
if (reloc_entry->howto->type == R_IMAGEBASE && diff != 0)
|
||||
abort ();
|
||||
if (reloc_entry->howto->type == R_IMAGEBASE)
|
||||
diff -= pe_data (output_bfd)->pe_opthdr.ImageBase;
|
||||
#endif
|
||||
|
||||
#define DOIT(x) \
|
||||
@ -154,140 +155,150 @@ 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(abfd, howto)
|
||||
bfd * abfd;
|
||||
/* 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;
|
||||
reloc_howto_type *howto;
|
||||
{
|
||||
return ! howto->pc_relative && howto->type != R_IMAGEBASE;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /* COFF_WITH_PE */
|
||||
|
||||
#ifndef PCRELOFFSET
|
||||
#define PCRELOFFSET false
|
||||
#endif
|
||||
|
||||
static reloc_howto_type howto_table[] =
|
||||
static reloc_howto_type howto_table[] =
|
||||
{
|
||||
{0},
|
||||
{1},
|
||||
{2},
|
||||
{3},
|
||||
{4},
|
||||
{5},
|
||||
HOWTO (R_DIR32, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
EMPTY_HOWTO (0),
|
||||
EMPTY_HOWTO (1),
|
||||
EMPTY_HOWTO (2),
|
||||
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 */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
coff_i386_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 */
|
||||
coff_i386_reloc, /* special_function */
|
||||
"dir32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
/* PE IMAGE_REL_I386_DIR32NB relocation (7). */
|
||||
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_i386_reloc, /* special_function */
|
||||
"rva32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
{010},
|
||||
{011},
|
||||
{012},
|
||||
{013},
|
||||
{014},
|
||||
{015},
|
||||
{016},
|
||||
HOWTO (R_RELBYTE, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
coff_i386_reloc, /* special_function */
|
||||
"rva32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
EMPTY_HOWTO (010),
|
||||
EMPTY_HOWTO (011),
|
||||
EMPTY_HOWTO (012),
|
||||
EMPTY_HOWTO (013),
|
||||
EMPTY_HOWTO (014),
|
||||
EMPTY_HOWTO (015),
|
||||
EMPTY_HOWTO (016),
|
||||
/* Byte relocation (017). */
|
||||
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_i386_reloc, /* special_function */
|
||||
"8", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x000000ff, /* src_mask */
|
||||
0x000000ff, /* dst_mask */
|
||||
coff_i386_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 */
|
||||
/* 16-bit word relocation (020). */
|
||||
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_i386_reloc, /* special_function */
|
||||
"16", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x0000ffff, /* src_mask */
|
||||
0x0000ffff, /* dst_mask */
|
||||
coff_i386_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 */
|
||||
/* 32-bit longword relocation (021). */
|
||||
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_i386_reloc, /* special_function */
|
||||
"32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
coff_i386_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 */
|
||||
/* Byte PC relative relocation (022). */
|
||||
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_i386_reloc, /* special_function */
|
||||
"DISP8", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x000000ff, /* src_mask */
|
||||
0x000000ff, /* dst_mask */
|
||||
coff_i386_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 */
|
||||
/* 16-bit word PC relative relocation (023). */
|
||||
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_i386_reloc, /* special_function */
|
||||
"DISP16", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x0000ffff, /* src_mask */
|
||||
0x0000ffff, /* dst_mask */
|
||||
coff_i386_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 */
|
||||
/* 32-bit longword PC relative relocation (024). */
|
||||
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_i386_reloc, /* special_function */
|
||||
"DISP32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
coff_i386_reloc, /* special_function */
|
||||
"DISP32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
PCRELOFFSET) /* pcrel_offset */
|
||||
};
|
||||
|
||||
@ -297,8 +308,11 @@ static reloc_howto_type howto_table[] =
|
||||
#define BADMAG(x) I386BADMAG(x)
|
||||
#define I386 1 /* Customize coffcode.h */
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) \
|
||||
(cache_ptr)->howto = howto_table + (dst)->r_type;
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) \
|
||||
((cache_ptr)->howto = \
|
||||
((dst)->r_type < sizeof (howto_table) / sizeof (howto_table[0]) \
|
||||
? howto_table + (dst)->r_type \
|
||||
: NULL))
|
||||
|
||||
/* For 386 COFF a STYP_NOLOAD | STYP_BSS section is part of a shared
|
||||
library. On some other COFF targets STYP_BSS is normally
|
||||
@ -385,19 +399,25 @@ coff_pe_i386_relocate_section (output_bfd, info, input_bfd,
|
||||
|
||||
static reloc_howto_type *
|
||||
coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
asection *sec;
|
||||
struct internal_reloc *rel;
|
||||
struct coff_link_hash_entry *h;
|
||||
struct internal_syment *sym;
|
||||
bfd_vma *addendp;
|
||||
{
|
||||
|
||||
reloc_howto_type *howto;
|
||||
|
||||
if (rel->r_type > sizeof (howto_table) / sizeof (howto_table[0]))
|
||||
{
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
howto = howto_table + rel->r_type;
|
||||
|
||||
#ifdef COFF_WITH_PE
|
||||
/* Cancel out code in _bfd_coff_generic_relocate_section. */
|
||||
*addendp = 0;
|
||||
#endif
|
||||
|
||||
@ -411,7 +431,7 @@ coff_i386_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);
|
||||
|
||||
#ifndef COFF_WITH_PE
|
||||
@ -430,7 +450,7 @@ coff_i386_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;
|
||||
#endif
|
||||
|
||||
@ -458,23 +478,29 @@ coff_i386_rtype_to_howto (abfd, sec, rel, h, sym, addendp)
|
||||
return howto;
|
||||
}
|
||||
|
||||
|
||||
#define coff_bfd_reloc_type_lookup coff_i386_reloc_type_lookup
|
||||
|
||||
|
||||
static reloc_howto_type *
|
||||
coff_i386_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
switch (code)
|
||||
{
|
||||
case BFD_RELOC_RVA:
|
||||
return howto_table +R_IMAGEBASE;
|
||||
return howto_table + R_IMAGEBASE;
|
||||
case BFD_RELOC_32:
|
||||
return howto_table + R_DIR32;
|
||||
case BFD_RELOC_32_PCREL:
|
||||
return howto_table + R_PCRLONG;
|
||||
case BFD_RELOC_16:
|
||||
return howto_table + R_RELWORD;
|
||||
case BFD_RELOC_16_PCREL:
|
||||
return howto_table + R_PCRWORD;
|
||||
case BFD_RELOC_8:
|
||||
return howto_table + R_RELBYTE;
|
||||
case BFD_RELOC_8_PCREL:
|
||||
return howto_table + R_PCRBYTE;
|
||||
default:
|
||||
BFD_FAIL ();
|
||||
return 0;
|
||||
@ -508,69 +534,6 @@ coff_i386_is_local_label_name (abfd, name)
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
static const bfd_target *
|
||||
i3coff_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 i386 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 =
|
||||
@ -591,14 +554,11 @@ const bfd_target
|
||||
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),
|
||||
#ifdef COFF_WITH_PE
|
||||
| SEC_LINK_ONCE | SEC_LINK_DUPLICATES
|
||||
#endif
|
||||
| SEC_CODE | SEC_DATA),
|
||||
|
||||
#ifdef TARGET_UNDERSCORE
|
||||
TARGET_UNDERSCORE, /* leading underscore */
|
||||
@ -616,8 +576,8 @@ const bfd_target
|
||||
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, i3coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, i3coff_object_p},
|
||||
{_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 */
|
||||
bfd_false},
|
||||
{bfd_false, coff_write_object_contents, /* bfd_write_contents */
|
||||
@ -633,5 +593,7 @@ const bfd_target
|
||||
BFD_JUMP_TABLE_LINK (coff),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
COFF_SWAP_TABLE,
|
||||
NULL,
|
||||
|
||||
COFF_SWAP_TABLE
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD back-end for MIPS Extended-Coff files.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
|
||||
Free Software Foundation, Inc.
|
||||
Original version by Per Bothner.
|
||||
Full support added by Ian Lance Taylor, ian@cygnus.com.
|
||||
@ -273,10 +273,10 @@ static reloc_howto_type mips_howto_table[] =
|
||||
0xffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
{ 8 },
|
||||
{ 9 },
|
||||
{ 10 },
|
||||
{ 11 },
|
||||
EMPTY_HOWTO (8),
|
||||
EMPTY_HOWTO (9),
|
||||
EMPTY_HOWTO (10),
|
||||
EMPTY_HOWTO (11),
|
||||
|
||||
/* This reloc is a Cygnus extension used when generating position
|
||||
independent code for embedded systems. It represents a 16 bit PC
|
||||
@ -334,13 +334,13 @@ static reloc_howto_type mips_howto_table[] =
|
||||
0xffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
{ 15 },
|
||||
{ 16 },
|
||||
{ 17 },
|
||||
{ 18 },
|
||||
{ 19 },
|
||||
{ 20 },
|
||||
{ 21 },
|
||||
EMPTY_HOWTO (15),
|
||||
EMPTY_HOWTO (16),
|
||||
EMPTY_HOWTO (17),
|
||||
EMPTY_HOWTO (18),
|
||||
EMPTY_HOWTO (19),
|
||||
EMPTY_HOWTO (20),
|
||||
EMPTY_HOWTO (21),
|
||||
|
||||
/* This reloc is a Cygnus extension used when generating position
|
||||
independent code for embedded systems. It represents an entry in
|
||||
@ -569,7 +569,7 @@ mips_adjust_reloc_in (abfd, intern, rptr)
|
||||
|
||||
static void
|
||||
mips_adjust_reloc_out (abfd, rel, intern)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
const arelent *rel;
|
||||
struct internal_reloc *intern;
|
||||
{
|
||||
@ -604,13 +604,13 @@ mips_generic_reloc (abfd,
|
||||
input_section,
|
||||
output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
PTR data ATTRIBUTE_UNUSED;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
if (output_bfd != (bfd *) NULL
|
||||
&& (symbol->flags & BSF_SECTION_SYM) == 0
|
||||
@ -651,13 +651,13 @@ mips_refhi_reloc (abfd,
|
||||
input_section,
|
||||
output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_reloc_status_type ret;
|
||||
bfd_vma relocation;
|
||||
@ -872,7 +872,7 @@ mips_gprel_reloc (abfd,
|
||||
gp = 4;
|
||||
_bfd_set_gp_value (output_bfd, gp);
|
||||
*error_message =
|
||||
(char *) "GP relative relocation when _gp not defined";
|
||||
(char *) _("GP relative relocation when _gp not defined");
|
||||
return bfd_reloc_dangerous;
|
||||
}
|
||||
}
|
||||
@ -933,13 +933,13 @@ mips_relhi_reloc (abfd,
|
||||
input_section,
|
||||
output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_reloc_status_type ret;
|
||||
bfd_vma relocation;
|
||||
@ -1109,13 +1109,13 @@ mips_switch_reloc (abfd,
|
||||
input_section,
|
||||
output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *reloc_entry ATTRIBUTE_UNUSED;
|
||||
asymbol *symbol ATTRIBUTE_UNUSED;
|
||||
PTR data ATTRIBUTE_UNUSED;
|
||||
asection *input_section ATTRIBUTE_UNUSED;
|
||||
bfd *output_bfd ATTRIBUTE_UNUSED;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
@ -1124,7 +1124,7 @@ mips_switch_reloc (abfd,
|
||||
|
||||
static reloc_howto_type *
|
||||
mips_bfd_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
int mips_type;
|
||||
@ -1193,11 +1193,18 @@ mips_relocate_hi (refhi, reflo, input_bfd, input_section, contents, adjust,
|
||||
unsigned long val;
|
||||
unsigned long vallo;
|
||||
|
||||
if (refhi == NULL)
|
||||
return;
|
||||
|
||||
insn = bfd_get_32 (input_bfd,
|
||||
contents + adjust + refhi->r_vaddr - input_section->vma);
|
||||
vallo = (bfd_get_32 (input_bfd,
|
||||
contents + adjust + reflo->r_vaddr - input_section->vma)
|
||||
& 0xffff);
|
||||
if (reflo == NULL)
|
||||
vallo = 0;
|
||||
else
|
||||
vallo = (bfd_get_32 (input_bfd,
|
||||
contents + adjust + reflo->r_vaddr - input_section->vma)
|
||||
& 0xffff);
|
||||
|
||||
val = ((insn & 0xffff) << 16) + vallo;
|
||||
val += relocation;
|
||||
|
||||
@ -1425,7 +1432,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
if (gp_undefined)
|
||||
{
|
||||
if (! ((*info->callbacks->reloc_dangerous)
|
||||
(info, "GP relative relocation when GP not defined",
|
||||
(info, _("GP relative relocation when GP not defined"),
|
||||
input_bfd, input_section,
|
||||
int_rel.r_vaddr - input_section->vma)))
|
||||
return false;
|
||||
@ -1774,7 +1781,7 @@ mips_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.string, input_bfd,
|
||||
input_section,
|
||||
int_rel.r_vaddr - input_section->vma)))
|
||||
int_rel.r_vaddr - input_section->vma, true)))
|
||||
return false;
|
||||
relocation = 0;
|
||||
}
|
||||
@ -2322,9 +2329,9 @@ mips_relax_section (abfd, sec, info, again)
|
||||
|
||||
static boolean
|
||||
mips_relax_pcrel16 (info, input_bfd, input_section, h, location, address)
|
||||
struct bfd_link_info *info;
|
||||
struct bfd_link_info *info ATTRIBUTE_UNUSED;
|
||||
bfd *input_bfd;
|
||||
asection *input_section;
|
||||
asection *input_section ATTRIBUTE_UNUSED;
|
||||
struct ecoff_link_hash_entry *h;
|
||||
bfd_byte *location;
|
||||
bfd_vma address;
|
||||
@ -2423,7 +2430,7 @@ bfd_mips_ecoff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
|
||||
/* We can only relocate REFWORD relocs at run time. */
|
||||
if (int_rel.r_type != MIPS_R_REFWORD)
|
||||
{
|
||||
*errmsg = "unsupported reloc type";
|
||||
*errmsg = _("unsupported reloc type");
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
}
|
||||
@ -2460,7 +2467,7 @@ bfd_mips_ecoff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
|
||||
default:
|
||||
/* No other sections should appear in -membedded-pic
|
||||
code. */
|
||||
*errmsg = "reloc against unsupported section";
|
||||
*errmsg = _("reloc against unsupported section");
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
}
|
||||
@ -2468,7 +2475,7 @@ bfd_mips_ecoff_create_embedded_relocs (abfd, info, datasec, relsec, errmsg)
|
||||
|
||||
if ((int_rel.r_offset & 3) != 0)
|
||||
{
|
||||
*errmsg = "reloc not properly aligned";
|
||||
*errmsg = _("reloc not properly aligned");
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
}
|
||||
@ -2498,13 +2505,14 @@ 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, true, false, 4,
|
||||
FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true, false, 4,
|
||||
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,
|
||||
_bfd_ecoff_mkobject_hook, _bfd_ecoff_styp_to_sec_flags,
|
||||
_bfd_ecoff_set_alignment_hook, _bfd_ecoff_slurp_symbol_table,
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL
|
||||
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||
NULL, NULL
|
||||
},
|
||||
/* Supported architecture. */
|
||||
bfd_arch_mips,
|
||||
@ -2590,6 +2598,11 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
|
||||
/* Relaxing sections is MIPS specific. */
|
||||
#define _bfd_ecoff_bfd_relax_section mips_relax_section
|
||||
|
||||
/* GC of sections is not done. */
|
||||
#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
|
||||
|
||||
extern const bfd_target ecoff_big_vec;
|
||||
|
||||
const bfd_target ecoff_little_vec =
|
||||
{
|
||||
"ecoff-littlemips", /* name */
|
||||
@ -2629,6 +2642,8 @@ const bfd_target ecoff_little_vec =
|
||||
BFD_JUMP_TABLE_LINK (_bfd_ecoff),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
& ecoff_big_vec,
|
||||
|
||||
(PTR) &mips_ecoff_backend_data
|
||||
};
|
||||
|
||||
@ -2670,6 +2685,8 @@ const bfd_target ecoff_big_vec =
|
||||
BFD_JUMP_TABLE_LINK (_bfd_ecoff),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
& ecoff_little_vec,
|
||||
|
||||
(PTR) &mips_ecoff_backend_data
|
||||
};
|
||||
|
||||
@ -2712,5 +2729,7 @@ const bfd_target ecoff_biglittle_vec =
|
||||
BFD_JUMP_TABLE_LINK (_bfd_ecoff),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
NULL,
|
||||
|
||||
(PTR) &mips_ecoff_backend_data
|
||||
};
|
||||
|
2969
contrib/binutils/bfd/coff-ppc.c
Normal file
2969
contrib/binutils/bfd/coff-ppc.c
Normal file
File diff suppressed because it is too large
Load Diff
214
contrib/binutils/bfd/coff-sparc.c
Normal file
214
contrib/binutils/bfd/coff-sparc.c
Normal file
@ -0,0 +1,214 @@
|
||||
/* BFD back-end for Sparc COFF files.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
|
||||
Free Software Foundation, Inc.
|
||||
Written 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. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "coff/sparc.h"
|
||||
#include "coff/internal.h"
|
||||
#include "libcoff.h"
|
||||
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (3)
|
||||
|
||||
#define BADMAG(x) ((x).f_magic != SPARCMAGIC && (x).f_magic != LYNXCOFFMAGIC)
|
||||
|
||||
/* The page size is a guess based on ELF. */
|
||||
#define COFF_PAGE_SIZE 0x10000
|
||||
|
||||
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_WDISP30, R_SPARC_WDISP22,
|
||||
R_SPARC_HI22, R_SPARC_22,
|
||||
R_SPARC_13, R_SPARC_LO10,
|
||||
R_SPARC_GOT10, R_SPARC_GOT13, R_SPARC_GOT22,
|
||||
R_SPARC_PC10, R_SPARC_PC22,
|
||||
R_SPARC_WPLT30,
|
||||
R_SPARC_COPY,
|
||||
R_SPARC_GLOB_DAT, R_SPARC_JMP_SLOT,
|
||||
R_SPARC_RELATIVE,
|
||||
R_SPARC_UA32,
|
||||
R_SPARC_max
|
||||
};
|
||||
|
||||
#if 0
|
||||
static CONST char *CONST reloc_type_names[] =
|
||||
{
|
||||
"R_SPARC_NONE",
|
||||
"R_SPARC_8", "R_SPARC_16", "R_SPARC_32",
|
||||
"R_SPARC_DISP8", "R_SPARC_DISP16", "R_SPARC_DISP32",
|
||||
"R_SPARC_WDISP30", "R_SPARC_WDISP22",
|
||||
"R_SPARC_HI22", "R_SPARC_22",
|
||||
"R_SPARC_13", "R_SPARC_LO10",
|
||||
"R_SPARC_GOT10", "R_SPARC_GOT13", "R_SPARC_GOT22",
|
||||
"R_SPARC_PC10", "R_SPARC_PC22",
|
||||
"R_SPARC_WPLT30",
|
||||
"R_SPARC_COPY",
|
||||
"R_SPARC_GLOB_DAT", "R_SPARC_JMP_SLOT",
|
||||
"R_SPARC_RELATIVE",
|
||||
"R_SPARC_UA32",
|
||||
};
|
||||
#endif
|
||||
|
||||
/* This is stolen pretty directly from elf.c. */
|
||||
static bfd_reloc_status_type
|
||||
bfd_coff_generic_reloc PARAMS ((bfd *, arelent *, asymbol *, PTR,
|
||||
asection *, bfd *, char **));
|
||||
|
||||
static bfd_reloc_status_type
|
||||
bfd_coff_generic_reloc (abfd, reloc_entry, symbol, data, input_section,
|
||||
output_bfd, error_message)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data ATTRIBUTE_UNUSED;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
if (output_bfd != (bfd *) NULL
|
||||
&& (symbol->flags & BSF_SECTION_SYM) == 0)
|
||||
{
|
||||
reloc_entry->address += input_section->output_offset;
|
||||
return bfd_reloc_ok;
|
||||
}
|
||||
|
||||
return bfd_reloc_continue;
|
||||
}
|
||||
|
||||
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),
|
||||
HOWTO(R_SPARC_16, 0,1,16,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_16", false,0,0x0000ffff,true),
|
||||
HOWTO(R_SPARC_32, 0,2,32,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_32", false,0,0xffffffff,true),
|
||||
HOWTO(R_SPARC_DISP8, 0,0, 8,true, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP8", false,0,0x000000ff,true),
|
||||
HOWTO(R_SPARC_DISP16, 0,1,16,true, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP16", false,0,0x0000ffff,true),
|
||||
HOWTO(R_SPARC_DISP32, 0,2,32,true, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_DISP32", false,0,0x00ffffff,true),
|
||||
HOWTO(R_SPARC_WDISP30, 2,2,30,true, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_WDISP30", false,0,0x3fffffff,true),
|
||||
HOWTO(R_SPARC_WDISP22, 2,2,22,true, 0,complain_overflow_signed, bfd_coff_generic_reloc,"R_SPARC_WDISP22", false,0,0x003fffff,true),
|
||||
HOWTO(R_SPARC_HI22, 10,2,22,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_HI22", false,0,0x003fffff,true),
|
||||
HOWTO(R_SPARC_22, 0,2,22,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_22", false,0,0x003fffff,true),
|
||||
HOWTO(R_SPARC_13, 0,2,13,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_13", false,0,0x00001fff,true),
|
||||
HOWTO(R_SPARC_LO10, 0,2,10,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_LO10", false,0,0x000003ff,true),
|
||||
HOWTO(R_SPARC_GOT10, 0,2,10,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT10", false,0,0x000003ff,true),
|
||||
HOWTO(R_SPARC_GOT13, 0,2,13,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT13", false,0,0x00001fff,true),
|
||||
HOWTO(R_SPARC_GOT22, 10,2,22,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_GOT22", false,0,0x003fffff,true),
|
||||
HOWTO(R_SPARC_PC10, 0,2,10,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_PC10", false,0,0x000003ff,true),
|
||||
HOWTO(R_SPARC_PC22, 0,2,22,false,0,complain_overflow_bitfield,bfd_coff_generic_reloc,"R_SPARC_PC22", false,0,0x003fffff,true),
|
||||
HOWTO(R_SPARC_WPLT30, 0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_WPLT30", false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_COPY, 0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_COPY", false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_GLOB_DAT,0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_GLOB_DAT",false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_JMP_SLOT,0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_JMP_SLOT",false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_RELATIVE,0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_RELATIVE",false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_UA32, 0,0,00,false,0,complain_overflow_dont, bfd_coff_generic_reloc,"R_SPARC_UA32", false,0,0x00000000,true),
|
||||
};
|
||||
|
||||
struct coff_reloc_map {
|
||||
bfd_reloc_code_real_type bfd_reloc_val;
|
||||
unsigned char coff_reloc_val;
|
||||
};
|
||||
|
||||
static CONST struct coff_reloc_map sparc_reloc_map[] =
|
||||
{
|
||||
{ BFD_RELOC_NONE, R_SPARC_NONE, },
|
||||
{ BFD_RELOC_16, R_SPARC_16, },
|
||||
{ BFD_RELOC_8, R_SPARC_8 },
|
||||
{ BFD_RELOC_8_PCREL, R_SPARC_DISP8 },
|
||||
{ BFD_RELOC_CTOR, R_SPARC_32 }, /* @@ Assumes 32 bits. */
|
||||
{ BFD_RELOC_32, R_SPARC_32 },
|
||||
{ BFD_RELOC_32_PCREL, R_SPARC_DISP32 },
|
||||
{ BFD_RELOC_HI22, R_SPARC_HI22 },
|
||||
{ BFD_RELOC_LO10, R_SPARC_LO10, },
|
||||
{ BFD_RELOC_32_PCREL_S2, R_SPARC_WDISP30 },
|
||||
{ BFD_RELOC_SPARC22, R_SPARC_22 },
|
||||
{ BFD_RELOC_SPARC13, R_SPARC_13 },
|
||||
{ BFD_RELOC_SPARC_GOT10, R_SPARC_GOT10 },
|
||||
{ BFD_RELOC_SPARC_GOT13, R_SPARC_GOT13 },
|
||||
{ BFD_RELOC_SPARC_GOT22, R_SPARC_GOT22 },
|
||||
{ BFD_RELOC_SPARC_PC10, R_SPARC_PC10 },
|
||||
{ BFD_RELOC_SPARC_PC22, R_SPARC_PC22 },
|
||||
{ BFD_RELOC_SPARC_WPLT30, R_SPARC_WPLT30 },
|
||||
{ BFD_RELOC_SPARC_COPY, R_SPARC_COPY },
|
||||
{ BFD_RELOC_SPARC_GLOB_DAT, R_SPARC_GLOB_DAT },
|
||||
{ BFD_RELOC_SPARC_JMP_SLOT, R_SPARC_JMP_SLOT },
|
||||
{ BFD_RELOC_SPARC_RELATIVE, R_SPARC_RELATIVE },
|
||||
{ BFD_RELOC_SPARC_WDISP22, R_SPARC_WDISP22 },
|
||||
/* { BFD_RELOC_SPARC_UA32, R_SPARC_UA32 }, not used?? */
|
||||
};
|
||||
|
||||
static reloc_howto_type *
|
||||
coff_sparc_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < sizeof (sparc_reloc_map) / sizeof (struct coff_reloc_map); i++)
|
||||
{
|
||||
if (sparc_reloc_map[i].bfd_reloc_val == code)
|
||||
return &coff_sparc_howto_table[(int) sparc_reloc_map[i].coff_reloc_val];
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#define coff_bfd_reloc_type_lookup coff_sparc_reloc_type_lookup
|
||||
|
||||
static void
|
||||
rtype2howto (cache_ptr, dst)
|
||||
arelent *cache_ptr;
|
||||
struct internal_reloc *dst;
|
||||
{
|
||||
BFD_ASSERT (dst->r_type < (unsigned int) R_SPARC_max);
|
||||
cache_ptr->howto = &coff_sparc_howto_table[dst->r_type];
|
||||
}
|
||||
|
||||
#define RTYPE2HOWTO(internal, relocentry) rtype2howto(internal,relocentry)
|
||||
|
||||
#define SWAP_IN_RELOC_OFFSET bfd_h_get_32
|
||||
#define SWAP_OUT_RELOC_OFFSET bfd_h_put_32
|
||||
#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
|
||||
cache_ptr->addend = reloc.r_offset;
|
||||
|
||||
/* Clear the r_spare field in relocs. */
|
||||
#define SWAP_OUT_RELOC_EXTRA(abfd,src,dst) \
|
||||
do { \
|
||||
dst->r_spare[0] = 0; \
|
||||
dst->r_spare[1] = 0; \
|
||||
} while (0)
|
||||
|
||||
#define __A_MAGIC_SET__
|
||||
|
||||
/* Enable Sparc-specific hacks in coffcode.h. */
|
||||
|
||||
#define COFF_SPARC
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
#ifndef TARGET_SYM
|
||||
#define TARGET_SYM sparccoff_vec
|
||||
#endif
|
||||
|
||||
#ifndef TARGET_NAME
|
||||
#define TARGET_NAME "coff-sparc"
|
||||
#endif
|
||||
|
||||
CREATE_BIG_COFF_TARGET_VEC (TARGET_SYM, TARGET_NAME, D_PAGED, 0, '_', NULL)
|
@ -1,5 +1,5 @@
|
||||
/* BFD back-end for TMS320C30 coff binaries.
|
||||
Copyright (C) 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1998, 1999 Free Software Foundation, Inc.
|
||||
Contributed by Steven Haworth (steve@pm.cse.rmit.edu.au)
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -41,7 +41,7 @@ reloc_howto_type tic30_coff_howto_table[] =
|
||||
"32", false, 0xFFFFFFFF, 0xFFFFFFFF, false),
|
||||
HOWTO (R_TIC30_PC16, 2, 1, 16, true, 0, complain_overflow_signed, NULL,
|
||||
"PCREL", false, 0x0000FFFF, 0x0000FFFF, false),
|
||||
{-1}
|
||||
EMPTY_HOWTO (-1)
|
||||
};
|
||||
|
||||
#ifndef coff_bfd_reloc_type_lookup
|
||||
@ -52,7 +52,7 @@ reloc_howto_type tic30_coff_howto_table[] =
|
||||
and coff implementations. */
|
||||
reloc_howto_type *
|
||||
tic30_coff_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
switch (code)
|
||||
@ -202,5 +202,7 @@ const bfd_target tic30_coff_vec =
|
||||
BFD_JUMP_TABLE_LINK (coff),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
NULL,
|
||||
|
||||
COFF_SWAP_TABLE
|
||||
};
|
||||
|
@ -237,44 +237,4 @@ extra_case (in_abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)
|
||||
bfd_coff_reloc16_get_relocated_section_contents
|
||||
#define coff_bfd_relax_section bfd_coff_reloc16_relax_section
|
||||
|
||||
const bfd_target z8kcoff_vec =
|
||||
{
|
||||
"coff-z8k", /* name */
|
||||
bfd_target_coff_flavour,
|
||||
BFD_ENDIAN_BIG, /* data byte order is big */
|
||||
BFD_ENDIAN_BIG, /* header byte order is big */
|
||||
|
||||
(HAS_RELOC | EXEC_P | /* object flags */
|
||||
HAS_LINENO | HAS_DEBUG |
|
||||
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_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* data */
|
||||
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
|
||||
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
|
||||
bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* hdrs */
|
||||
|
||||
{_bfd_dummy_target, coff_object_p, /* bfd_check_format */
|
||||
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 (coff),
|
||||
BFD_JUMP_TABLE_LINK (coff),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
COFF_SWAP_TABLE,
|
||||
};
|
||||
CREATE_BIG_COFF_TARGET_VEC (z8kcoff_vec, "coff-z8k", 0, 0, '_', NULL)
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/* Support for the generic parts of COFF, for BFD.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999, 2000
|
||||
Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
@ -140,9 +140,9 @@ make_a_section_from_file (abfd, hdr, target_index)
|
||||
return_section->lineno_count = hdr->s_nlnno;
|
||||
return_section->userdata = NULL;
|
||||
return_section->next = (asection *) NULL;
|
||||
return_section->flags = bfd_coff_styp_to_sec_flags_hook (abfd, hdr, name);
|
||||
|
||||
return_section->target_index = target_index;
|
||||
return_section->flags = bfd_coff_styp_to_sec_flags_hook (abfd, hdr, name,
|
||||
return_section);
|
||||
|
||||
/* At least on i386-coff, the line number count for a shared library
|
||||
section must be ignored. */
|
||||
@ -211,6 +211,11 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
|
||||
if (bfd_read ((PTR) external_sections, 1, readsize, abfd) != readsize)
|
||||
goto fail;
|
||||
|
||||
/* Set the arch/mach *before* swapping in sections; section header swapping
|
||||
may depend on arch/mach info. */
|
||||
if (bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f) == false)
|
||||
goto fail;
|
||||
|
||||
/* Now copy data as required; construct all asections etc */
|
||||
if (nscns != 0)
|
||||
{
|
||||
@ -228,9 +233,6 @@ coff_real_object_p (abfd, nscns, internal_f, internal_a)
|
||||
|
||||
/* make_abs_section (abfd); */
|
||||
|
||||
if (bfd_coff_set_arch_mach_hook (abfd, (PTR) internal_f) == false)
|
||||
goto fail;
|
||||
|
||||
return abfd->xvec;
|
||||
|
||||
fail:
|
||||
@ -559,7 +561,7 @@ coff_count_linenumbers (abfd)
|
||||
/*ARGSUSED*/
|
||||
coff_symbol_type *
|
||||
coff_symbol_from (ignore_abfd, symbol)
|
||||
bfd *ignore_abfd;
|
||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
||||
asymbol *symbol;
|
||||
{
|
||||
if (bfd_asymbol_flavour (symbol) != bfd_target_coff_flavour)
|
||||
@ -585,7 +587,8 @@ fixup_symbol_value (abfd, coff_symbol_ptr, syment)
|
||||
syment->n_scnum = N_UNDEF;
|
||||
syment->n_value = coff_symbol_ptr->symbol.value;
|
||||
}
|
||||
else if (coff_symbol_ptr->symbol.flags & BSF_DEBUGGING)
|
||||
else if ((coff_symbol_ptr->symbol.flags & BSF_DEBUGGING) != 0
|
||||
&& (coff_symbol_ptr->symbol.flags & BSF_DEBUGGING_RELOC) == 0)
|
||||
{
|
||||
syment->n_value = coff_symbol_ptr->symbol.value;
|
||||
}
|
||||
@ -594,6 +597,7 @@ fixup_symbol_value (abfd, coff_symbol_ptr, syment)
|
||||
syment->n_scnum = N_UNDEF;
|
||||
syment->n_value = 0;
|
||||
}
|
||||
/* FIXME: Do we need to handle the absolute section here? */
|
||||
else
|
||||
{
|
||||
if (coff_symbol_ptr->symbol.section)
|
||||
@ -658,16 +662,18 @@ coff_renumber_symbols (bfd_ptr, first_undef)
|
||||
if ((symbol_ptr_ptr[i]->flags & BSF_NOT_AT_END) != 0
|
||||
|| (!bfd_is_und_section (symbol_ptr_ptr[i]->section)
|
||||
&& !bfd_is_com_section (symbol_ptr_ptr[i]->section)
|
||||
&& ((symbol_ptr_ptr[i]->flags & (BSF_GLOBAL | BSF_FUNCTION))
|
||||
!= BSF_GLOBAL)))
|
||||
&& ((symbol_ptr_ptr[i]->flags & BSF_FUNCTION) != 0
|
||||
|| ((symbol_ptr_ptr[i]->flags & (BSF_GLOBAL | BSF_WEAK))
|
||||
== 0))))
|
||||
*newsyms++ = symbol_ptr_ptr[i];
|
||||
|
||||
for (i = 0; i < symbol_count; i++)
|
||||
if ((symbol_ptr_ptr[i]->flags & BSF_NOT_AT_END) == 0
|
||||
&& !bfd_is_und_section (symbol_ptr_ptr[i]->section)
|
||||
&& (bfd_is_com_section (symbol_ptr_ptr[i]->section)
|
||||
|| ((symbol_ptr_ptr[i]->flags & (BSF_GLOBAL | BSF_FUNCTION))
|
||||
== BSF_GLOBAL)))
|
||||
|| ((symbol_ptr_ptr[i]->flags & BSF_FUNCTION) == 0
|
||||
&& ((symbol_ptr_ptr[i]->flags & (BSF_GLOBAL | BSF_WEAK))
|
||||
!= 0))))
|
||||
*newsyms++ = symbol_ptr_ptr[i];
|
||||
|
||||
*first_undef = newsyms - bfd_ptr->outsymbols;
|
||||
@ -808,14 +814,18 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
|
||||
if (native->u.syment.n_sclass == C_FILE
|
||||
&& native->u.syment.n_numaux > 0)
|
||||
{
|
||||
unsigned int filnmlen;
|
||||
|
||||
strncpy (native->u.syment._n._n_name, ".file", SYMNMLEN);
|
||||
auxent = &(native + 1)->u.auxent;
|
||||
|
||||
filnmlen = bfd_coff_filnmlen (abfd);
|
||||
|
||||
if (bfd_coff_long_filenames (abfd))
|
||||
{
|
||||
if (name_length <= FILNMLEN)
|
||||
if (name_length <= filnmlen)
|
||||
{
|
||||
strncpy (auxent->x_file.x_fname, name, FILNMLEN);
|
||||
strncpy (auxent->x_file.x_fname, name, filnmlen);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -826,11 +836,9 @@ coff_fix_symbol_name (abfd, symbol, native, string_size_p,
|
||||
}
|
||||
else
|
||||
{
|
||||
strncpy (auxent->x_file.x_fname, name, FILNMLEN);
|
||||
if (name_length > FILNMLEN)
|
||||
{
|
||||
name[FILNMLEN] = '\0';
|
||||
}
|
||||
strncpy (auxent->x_file.x_fname, name, filnmlen);
|
||||
if (name_length > filnmlen)
|
||||
name[filnmlen] = '\0';
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1032,6 +1040,8 @@ coff_write_alien_symbol (abfd, symbol, written, string_size_p,
|
||||
native->u.syment.n_type = 0;
|
||||
if (symbol->flags & BSF_LOCAL)
|
||||
native->u.syment.n_sclass = C_STAT;
|
||||
else if (symbol->flags & BSF_WEAK)
|
||||
native->u.syment.n_sclass = obj_pe (abfd) ? C_NT_WEAK : C_WEAKEXT;
|
||||
else
|
||||
native->u.syment.n_sclass = C_EXT;
|
||||
native->u.syment.n_numaux = 0;
|
||||
@ -1242,7 +1252,7 @@ coff_write_symbols (abfd)
|
||||
}
|
||||
else if (c_symbol->native->u.syment.n_sclass == C_FILE
|
||||
&& c_symbol->native->u.syment.n_numaux > 0)
|
||||
maxlen = FILNMLEN;
|
||||
maxlen = bfd_coff_filnmlen (abfd);
|
||||
else
|
||||
maxlen = SYMNMLEN;
|
||||
|
||||
@ -1347,7 +1357,7 @@ coff_write_linenumbers (abfd)
|
||||
/*ARGSUSED */
|
||||
alent *
|
||||
coff_get_lineno (ignore_abfd, symbol)
|
||||
bfd *ignore_abfd;
|
||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
||||
asymbol *symbol;
|
||||
{
|
||||
return coffsymbol (symbol)->lineno;
|
||||
@ -1600,7 +1610,7 @@ _bfd_coff_read_string_table (abfd)
|
||||
if (strsize < STRING_SIZE_SIZE)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s: bad string table size %lu", bfd_get_filename (abfd),
|
||||
(_("%s: bad string table size %lu"), bfd_get_filename (abfd),
|
||||
(unsigned long) strsize);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return NULL;
|
||||
@ -1742,10 +1752,26 @@ coff_get_normalized_symtab (abfd)
|
||||
}
|
||||
else
|
||||
{
|
||||
/* ordinary short filename, put into memory anyway */
|
||||
internal_ptr->u.syment._n._n_n._n_offset = (long)
|
||||
copy_name (abfd, (internal_ptr + 1)->u.auxent.x_file.x_fname,
|
||||
FILNMLEN);
|
||||
/* Ordinary short filename, put into memory anyway. The
|
||||
Microsoft PE tools sometimes store a filename in
|
||||
multiple AUX entries. */
|
||||
if (internal_ptr->u.syment.n_numaux > 1
|
||||
&& coff_data (abfd)->pe)
|
||||
{
|
||||
internal_ptr->u.syment._n._n_n._n_offset =
|
||||
((long)
|
||||
copy_name (abfd,
|
||||
(internal_ptr + 1)->u.auxent.x_file.x_fname,
|
||||
internal_ptr->u.syment.n_numaux * symesz));
|
||||
}
|
||||
else
|
||||
{
|
||||
internal_ptr->u.syment._n._n_n._n_offset =
|
||||
((long)
|
||||
copy_name (abfd,
|
||||
(internal_ptr + 1)->u.auxent.x_file.x_fname,
|
||||
bfd_coff_filnmlen (abfd)));
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1843,8 +1869,8 @@ coff_make_empty_symbol (abfd)
|
||||
asymbol *
|
||||
coff_bfd_make_debug_symbol (abfd, ptr, sz)
|
||||
bfd *abfd;
|
||||
PTR ptr;
|
||||
unsigned long sz;
|
||||
PTR ptr ATTRIBUTE_UNUSED;
|
||||
unsigned long sz ATTRIBUTE_UNUSED;
|
||||
{
|
||||
coff_symbol_type *new = (coff_symbol_type *) bfd_alloc (abfd, sizeof (coff_symbol_type));
|
||||
if (new == NULL)
|
||||
@ -2042,8 +2068,23 @@ coff_print_symbol (abfd, filep, symbol, how)
|
||||
auxp->u.auxent.x_scn.x_comdat);
|
||||
break;
|
||||
}
|
||||
/* else fall through */
|
||||
case C_EXT:
|
||||
if (ISFCN (combined->u.syment.n_type))
|
||||
{
|
||||
fprintf (file,
|
||||
_("AUX tagndx %ld ttlsiz 0x%lx lnnos %ld next %ld"),
|
||||
tagndx,
|
||||
auxp->u.auxent.x_sym.x_misc.x_fsize,
|
||||
auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_lnnoptr,
|
||||
(auxp->fix_end
|
||||
? ((long)
|
||||
(auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.p
|
||||
- root))
|
||||
: auxp->u.auxent.x_sym.x_fcnary.x_fcn.x_endndx.l));
|
||||
break;
|
||||
}
|
||||
/* else fall through */
|
||||
|
||||
default:
|
||||
fprintf (file, "AUX lnno %d size 0x%x tagndx %ld",
|
||||
auxp->u.auxent.x_sym.x_misc.x_lnsz.x_lnno,
|
||||
@ -2091,16 +2132,15 @@ coff_print_symbol (abfd, filep, symbol, how)
|
||||
|
||||
boolean
|
||||
_bfd_coff_is_local_label_name (abfd, name)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
const char *name;
|
||||
{
|
||||
return name[0] == '.' && name[1] == 'L';
|
||||
}
|
||||
|
||||
/* Provided a BFD, a section and an offset into the section, calculate
|
||||
and return the name of the source file and the line nearest to the
|
||||
wanted location. */
|
||||
|
||||
/* 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,
|
||||
@ -2186,9 +2226,11 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
|
||||
}
|
||||
}
|
||||
|
||||
/* We use <= MAXDIFF here so that if we get a zero length
|
||||
file, we actually use the next file entry. */
|
||||
if (p2 < pend
|
||||
&& offset + sec_vma >= (bfd_vma) p2->u.syment.n_value
|
||||
&& offset + sec_vma - (bfd_vma) p2->u.syment.n_value < maxdiff)
|
||||
&& offset + sec_vma - (bfd_vma) p2->u.syment.n_value <= maxdiff)
|
||||
{
|
||||
*filename_ptr = (char *) p->u.syment._n._n_n._n_offset;
|
||||
maxdiff = offset + sec_vma - p2->u.syment.n_value;
|
||||
@ -2225,6 +2267,8 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
|
||||
|
||||
if (section->lineno != NULL)
|
||||
{
|
||||
bfd_vma last_value = 0;
|
||||
|
||||
l = §ion->lineno[i];
|
||||
|
||||
for (; i < section->lineno_count; i++)
|
||||
@ -2236,6 +2280,7 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
|
||||
if (coff->symbol.value > offset)
|
||||
break;
|
||||
*functionname_ptr = coff->symbol.name;
|
||||
last_value = coff->symbol.value;
|
||||
if (coff->native)
|
||||
{
|
||||
combined_entry_type *s = coff->native;
|
||||
@ -2264,6 +2309,20 @@ coff_find_nearest_line (abfd, section, symbols, offset, filename_ptr,
|
||||
}
|
||||
l++;
|
||||
}
|
||||
|
||||
/* If we fell off the end of the loop, then assume that this
|
||||
symbol has no line number info. Otherwise, symbols with no
|
||||
line number info get reported with the line number of the
|
||||
last line of the last symbol which does have line number
|
||||
info. We use 0x100 as a slop to account for cases where the
|
||||
last line has executable code. */
|
||||
if (i >= section->lineno_count
|
||||
&& last_value != 0
|
||||
&& offset - last_value > 0x100)
|
||||
{
|
||||
*functionname_ptr = NULL;
|
||||
*line_ptr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Cache the results for the next call. */
|
||||
@ -2304,3 +2363,71 @@ coff_sizeof_headers (abfd, reloc)
|
||||
size += abfd->section_count * bfd_coff_scnhsz (abfd);
|
||||
return size;
|
||||
}
|
||||
|
||||
/* Change the class of a coff symbol held by BFD. */
|
||||
boolean
|
||||
bfd_coff_set_symbol_class (abfd, symbol, class)
|
||||
bfd * abfd;
|
||||
asymbol * symbol;
|
||||
unsigned int class;
|
||||
{
|
||||
coff_symbol_type * csym;
|
||||
|
||||
csym = coff_symbol_from (abfd, symbol);
|
||||
if (csym == NULL)
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
}
|
||||
else if (csym->native == NULL)
|
||||
{
|
||||
/* This is an alien symbol which no native coff backend data.
|
||||
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));
|
||||
if (native == NULL)
|
||||
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;
|
||||
native->u.syment.n_value = symbol->value;
|
||||
}
|
||||
else if (bfd_is_com_section (symbol->section))
|
||||
{
|
||||
native->u.syment.n_scnum = N_UNDEF;
|
||||
native->u.syment.n_value = symbol->value;
|
||||
}
|
||||
else
|
||||
{
|
||||
native->u.syment.n_scnum =
|
||||
symbol->section->output_section->target_index;
|
||||
native->u.syment.n_value = (symbol->value
|
||||
+ 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;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* COFF specific linker code.
|
||||
Copyright 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright 1994, 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -40,6 +40,16 @@ static int process_embedded_commands
|
||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *));
|
||||
static void mark_relocs PARAMS ((struct coff_final_link_info *, bfd *));
|
||||
|
||||
/* 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
|
||||
variables with the appropriate names, and with values from the
|
||||
coff_data (abfd) structure. */
|
||||
|
||||
#define N_TMASK n_tmask
|
||||
#define N_BTSHFT n_btshft
|
||||
#define N_BTMASK n_btmask
|
||||
|
||||
/* Create an entry in a COFF linker hash table. */
|
||||
|
||||
struct bfd_hash_entry *
|
||||
@ -225,30 +235,25 @@ coff_link_check_ar_symbols (abfd, info, pneeded)
|
||||
struct bfd_link_info *info;
|
||||
boolean *pneeded;
|
||||
{
|
||||
boolean (*sym_is_global) PARAMS ((bfd *, struct internal_syment *));
|
||||
bfd_size_type symesz;
|
||||
bfd_byte *esym;
|
||||
bfd_byte *esym_end;
|
||||
|
||||
*pneeded = false;
|
||||
|
||||
sym_is_global = coff_backend_info (abfd)->_bfd_coff_sym_is_global;
|
||||
|
||||
symesz = bfd_coff_symesz (abfd);
|
||||
esym = (bfd_byte *) obj_coff_external_syms (abfd);
|
||||
esym_end = esym + obj_raw_syment_count (abfd) * symesz;
|
||||
while (esym < esym_end)
|
||||
{
|
||||
struct internal_syment sym;
|
||||
enum coff_symbol_classification classification;
|
||||
|
||||
bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym);
|
||||
|
||||
if ((sym.n_sclass == C_EXT
|
||||
#ifdef C_SYSTEM
|
||||
|| sym.n_sclass == C_SYSTEM
|
||||
#endif
|
||||
|| (sym_is_global && (*sym_is_global) (abfd, &sym)))
|
||||
&& (sym.n_scnum != 0 || sym.n_value != 0))
|
||||
classification = bfd_coff_classify_symbol (abfd, &sym);
|
||||
if (classification == COFF_SYMBOL_GLOBAL
|
||||
|| classification == COFF_SYMBOL_COMMON)
|
||||
{
|
||||
const char *name;
|
||||
char buf[SYMNMLEN + 1];
|
||||
@ -290,7 +295,9 @@ coff_link_add_symbols (abfd, info)
|
||||
bfd *abfd;
|
||||
struct bfd_link_info *info;
|
||||
{
|
||||
boolean (*sym_is_global) PARAMS ((bfd *, struct internal_syment *));
|
||||
unsigned int n_tmask = coff_data (abfd)->local_n_tmask;
|
||||
unsigned int n_btshft = coff_data (abfd)->local_n_btshft;
|
||||
unsigned int n_btmask = coff_data (abfd)->local_n_btmask;
|
||||
boolean keep_syms;
|
||||
boolean default_copy;
|
||||
bfd_size_type symcount;
|
||||
@ -304,8 +311,6 @@ coff_link_add_symbols (abfd, info)
|
||||
keep_syms = obj_coff_keep_syms (abfd);
|
||||
obj_coff_keep_syms (abfd) = true;
|
||||
|
||||
sym_is_global = coff_backend_info (abfd)->_bfd_coff_sym_is_global;
|
||||
|
||||
if (info->keep_memory)
|
||||
default_copy = false;
|
||||
else
|
||||
@ -332,21 +337,20 @@ coff_link_add_symbols (abfd, info)
|
||||
while (esym < esym_end)
|
||||
{
|
||||
struct internal_syment sym;
|
||||
enum coff_symbol_classification classification;
|
||||
boolean copy;
|
||||
|
||||
bfd_coff_swap_sym_in (abfd, (PTR) esym, (PTR) &sym);
|
||||
|
||||
if (sym.n_sclass == C_EXT
|
||||
#ifdef C_SYSTEM
|
||||
|| sym.n_sclass == C_SYSTEM
|
||||
#endif
|
||||
|| (sym_is_global && (*sym_is_global) (abfd, &sym)))
|
||||
classification = bfd_coff_classify_symbol (abfd, &sym);
|
||||
if (classification != COFF_SYMBOL_LOCAL)
|
||||
{
|
||||
const char *name;
|
||||
char buf[SYMNMLEN + 1];
|
||||
flagword flags;
|
||||
asection *section;
|
||||
bfd_vma value;
|
||||
boolean addit;
|
||||
|
||||
/* This symbol is externally visible. */
|
||||
|
||||
@ -363,33 +367,119 @@ coff_link_add_symbols (abfd, info)
|
||||
|
||||
value = sym.n_value;
|
||||
|
||||
if (sym.n_scnum == 0)
|
||||
{
|
||||
if (value == 0)
|
||||
{
|
||||
flags = 0;
|
||||
section = bfd_und_section_ptr;
|
||||
}
|
||||
else
|
||||
{
|
||||
flags = BSF_GLOBAL;
|
||||
section = bfd_com_section_ptr;
|
||||
}
|
||||
}
|
||||
else
|
||||
switch (classification)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
|
||||
case COFF_SYMBOL_GLOBAL:
|
||||
flags = BSF_EXPORT | BSF_GLOBAL;
|
||||
section = coff_section_from_bfd_index (abfd, sym.n_scnum);
|
||||
if (! obj_pe (abfd))
|
||||
value -= section->vma;
|
||||
break;
|
||||
|
||||
case COFF_SYMBOL_UNDEFINED:
|
||||
flags = 0;
|
||||
section = bfd_und_section_ptr;
|
||||
break;
|
||||
|
||||
case COFF_SYMBOL_COMMON:
|
||||
flags = BSF_GLOBAL;
|
||||
section = bfd_com_section_ptr;
|
||||
break;
|
||||
|
||||
case COFF_SYMBOL_PE_SECTION:
|
||||
flags = BSF_SECTION_SYM | BSF_GLOBAL;
|
||||
section = coff_section_from_bfd_index (abfd, sym.n_scnum);
|
||||
break;
|
||||
}
|
||||
|
||||
if (! (bfd_coff_link_add_one_symbol
|
||||
(info, abfd, name, flags, section, value,
|
||||
(const char *) NULL, copy, false,
|
||||
(struct bfd_link_hash_entry **) sym_hash)))
|
||||
goto error_return;
|
||||
if (sym.n_sclass == C_WEAKEXT
|
||||
|| (obj_pe (abfd) && sym.n_sclass == C_NT_WEAK))
|
||||
flags = BSF_WEAK;
|
||||
|
||||
addit = true;
|
||||
|
||||
/* In the PE format, section symbols actually refer to the
|
||||
start of the output section. We handle them specially
|
||||
here. */
|
||||
if (obj_pe (abfd) && (flags & BSF_SECTION_SYM) != 0)
|
||||
{
|
||||
*sym_hash = coff_link_hash_lookup (coff_hash_table (info),
|
||||
name, false, copy, false);
|
||||
if (*sym_hash != NULL)
|
||||
{
|
||||
if (((*sym_hash)->coff_link_hash_flags
|
||||
& COFF_LINK_HASH_PE_SECTION_SYMBOL) == 0
|
||||
&& (*sym_hash)->root.type != bfd_link_hash_undefined
|
||||
&& (*sym_hash)->root.type != bfd_link_hash_undefweak)
|
||||
(*_bfd_error_handler)
|
||||
("Warning: symbol `%s' is both section and non-section",
|
||||
name);
|
||||
|
||||
addit = false;
|
||||
}
|
||||
}
|
||||
|
||||
/* The Microsoft Visual C compiler does string pooling by
|
||||
hashing the constants to an internal symbol name, and
|
||||
relying on the the linker comdat support to discard
|
||||
duplicate names. However, if one string is a literal and
|
||||
one is a data initializer, one will end up in the .data
|
||||
section and one will end up in the .rdata section. The
|
||||
Microsoft linker will combine them into the .data
|
||||
section, which seems to be wrong since it might cause the
|
||||
literal to change.
|
||||
|
||||
As long as there are no external references to the
|
||||
symbols, which there shouldn't be, we can treat the .data
|
||||
and .rdata instances as separate symbols. The comdat
|
||||
code in the linker will do the appropriate merging. Here
|
||||
we avoid getting a multiple definition error for one of
|
||||
these special symbols.
|
||||
|
||||
FIXME: I don't think this will work in the case where
|
||||
there are two object files which use the constants as a
|
||||
literal and two object files which use it as a data
|
||||
initializer. One or the other of the second object files
|
||||
is going to wind up with an inappropriate reference. */
|
||||
if (obj_pe (abfd)
|
||||
&& (classification == COFF_SYMBOL_GLOBAL
|
||||
|| classification == COFF_SYMBOL_PE_SECTION)
|
||||
&& section->comdat != NULL
|
||||
&& strncmp (name, "??_", 3) == 0
|
||||
&& strcmp (name, section->comdat->name) == 0)
|
||||
{
|
||||
if (*sym_hash == NULL)
|
||||
*sym_hash = coff_link_hash_lookup (coff_hash_table (info),
|
||||
name, false, copy, false);
|
||||
if (*sym_hash != NULL
|
||||
&& (*sym_hash)->root.type == bfd_link_hash_defined
|
||||
&& (*sym_hash)->root.u.def.section->comdat != NULL
|
||||
&& strcmp ((*sym_hash)->root.u.def.section->comdat->name,
|
||||
section->comdat->name) == 0)
|
||||
addit = false;
|
||||
}
|
||||
|
||||
if (addit)
|
||||
{
|
||||
if (! (bfd_coff_link_add_one_symbol
|
||||
(info, abfd, name, flags, section, value,
|
||||
(const char *) NULL, copy, false,
|
||||
(struct bfd_link_hash_entry **) sym_hash)))
|
||||
goto error_return;
|
||||
}
|
||||
|
||||
if (obj_pe (abfd) && (flags & BSF_SECTION_SYM) != 0)
|
||||
(*sym_hash)->coff_link_hash_flags |=
|
||||
COFF_LINK_HASH_PE_SECTION_SYMBOL;
|
||||
|
||||
/* Limit the alignment of a common symbol to the possible
|
||||
alignment of a section. There is no point to permitting
|
||||
a higher alignment for a common symbol: we can not
|
||||
guarantee it, and it may cause us to allocate extra space
|
||||
in the common section. */
|
||||
if (section == bfd_com_section_ptr
|
||||
&& (*sym_hash)->root.type == bfd_link_hash_common
|
||||
&& ((*sym_hash)->root.u.c.p->alignment_power
|
||||
@ -399,24 +489,44 @@ coff_link_add_symbols (abfd, info)
|
||||
|
||||
if (info->hash->creator->flavour == bfd_get_flavour (abfd))
|
||||
{
|
||||
if (((*sym_hash)->class == C_NULL
|
||||
&& (*sym_hash)->type == T_NULL)
|
||||
|| sym.n_scnum != 0
|
||||
|| (sym.n_value != 0
|
||||
&& (*sym_hash)->root.type != bfd_link_hash_defined))
|
||||
{
|
||||
(*sym_hash)->class = sym.n_sclass;
|
||||
if (sym.n_type != T_NULL)
|
||||
{
|
||||
if ((*sym_hash)->type != T_NULL
|
||||
&& (*sym_hash)->type != sym.n_type)
|
||||
(*_bfd_error_handler)
|
||||
("Warning: type of symbol `%s' changed from %d to %d in %s",
|
||||
name, (*sym_hash)->type, sym.n_type,
|
||||
bfd_get_filename (abfd));
|
||||
(*sym_hash)->type = sym.n_type;
|
||||
}
|
||||
(*sym_hash)->auxbfd = abfd;
|
||||
/* If we don't have any symbol information currently in
|
||||
the hash table, or if we are looking at a symbol
|
||||
definition, then update the symbol class and type in
|
||||
the hash table. */
|
||||
if (((*sym_hash)->class == C_NULL
|
||||
&& (*sym_hash)->type == T_NULL)
|
||||
|| sym.n_scnum != 0
|
||||
|| (sym.n_value != 0
|
||||
&& (*sym_hash)->root.type != bfd_link_hash_defined
|
||||
&& (*sym_hash)->root.type != bfd_link_hash_defweak))
|
||||
{
|
||||
(*sym_hash)->class = sym.n_sclass;
|
||||
if (sym.n_type != T_NULL)
|
||||
{
|
||||
/* We want to warn if the type changed, but not
|
||||
if it changed from an unspecified type.
|
||||
Testing the whole type byte may work, but the
|
||||
change from (e.g.) a function of unspecified
|
||||
type to function of known type also wants to
|
||||
skip the warning. */
|
||||
if ((*sym_hash)->type != T_NULL
|
||||
&& (*sym_hash)->type != sym.n_type
|
||||
&& !(DTYPE ((*sym_hash)->type) == DTYPE (sym.n_type)
|
||||
&& (BTYPE ((*sym_hash)->type) == T_NULL
|
||||
|| BTYPE (sym.n_type) == T_NULL)))
|
||||
(*_bfd_error_handler)
|
||||
(_("Warning: type of symbol `%s' changed from %d to %d in %s"),
|
||||
name, (*sym_hash)->type, sym.n_type,
|
||||
bfd_get_filename (abfd));
|
||||
|
||||
/* We don't want to change from a meaningful
|
||||
base type to a null one, but if we know
|
||||
nothing, take what little we might now know. */
|
||||
if (BTYPE (sym.n_type) != T_NULL
|
||||
|| (*sym_hash)->type == T_NULL)
|
||||
(*sym_hash)->type = sym.n_type;
|
||||
}
|
||||
(*sym_hash)->auxbfd = abfd;
|
||||
if (sym.n_numaux != 0)
|
||||
{
|
||||
union internal_auxent *alloc;
|
||||
@ -441,6 +551,26 @@ coff_link_add_symbols (abfd, info)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (classification == COFF_SYMBOL_PE_SECTION
|
||||
&& (*sym_hash)->numaux != 0)
|
||||
{
|
||||
/* Some PE sections (such as .bss) have a zero size in
|
||||
the section header, but a non-zero size in the AUX
|
||||
record. Correct that here.
|
||||
|
||||
FIXME: This is not at all the right place to do this.
|
||||
For example, it won't help objdump. This needs to be
|
||||
done when we swap in the section header. */
|
||||
|
||||
BFD_ASSERT ((*sym_hash)->numaux == 1);
|
||||
if (section->_raw_size == 0)
|
||||
section->_raw_size = (*sym_hash)->aux[0].x_scn.x_scnlen;
|
||||
|
||||
/* FIXME: We could test whether the section sizes
|
||||
matches the size in the aux entry, but apparently
|
||||
that sometimes fails unexpectedly. */
|
||||
}
|
||||
}
|
||||
|
||||
esym += (sym.n_numaux + 1) * symesz;
|
||||
@ -768,7 +898,7 @@ _bfd_coff_final_link (abfd, info)
|
||||
== bfd_target_coff_flavour))
|
||||
{
|
||||
sub = p->u.indirect.section->owner;
|
||||
if (! bfd_coff_link_output_has_begun (sub))
|
||||
if (! bfd_coff_link_output_has_begun (sub, & finfo))
|
||||
{
|
||||
if (! _bfd_coff_link_input_bfd (&finfo, sub))
|
||||
goto error_return;
|
||||
@ -1060,7 +1190,7 @@ char **dst;
|
||||
static int
|
||||
process_embedded_commands (output_bfd, info, abfd)
|
||||
bfd *output_bfd;
|
||||
struct bfd_link_info *info;
|
||||
struct bfd_link_info *info ATTRIBUTE_UNUSED;
|
||||
bfd *abfd;
|
||||
{
|
||||
asection *sec = bfd_get_section_by_name (abfd, ".drectve");
|
||||
@ -1203,15 +1333,17 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|
||||
struct coff_final_link_info *finfo;
|
||||
bfd *input_bfd;
|
||||
{
|
||||
boolean (*sym_is_global) PARAMS ((bfd *, struct internal_syment *));
|
||||
unsigned int n_tmask = coff_data (input_bfd)->local_n_tmask;
|
||||
unsigned int n_btshft = coff_data (input_bfd)->local_n_btshft;
|
||||
#if 0
|
||||
unsigned int n_btmask = coff_data (input_bfd)->local_n_btmask;
|
||||
#endif
|
||||
boolean (*adjust_symndx) PARAMS ((bfd *, struct bfd_link_info *, bfd *,
|
||||
asection *, struct internal_reloc *,
|
||||
boolean *));
|
||||
bfd *output_bfd;
|
||||
const char *strings;
|
||||
bfd_size_type syment_base;
|
||||
unsigned int n_tmask;
|
||||
unsigned int n_btshft;
|
||||
boolean copy, hash;
|
||||
bfd_size_type isymesz;
|
||||
bfd_size_type osymesz;
|
||||
@ -1229,7 +1361,6 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|
||||
/* Move all the symbols to the output file. */
|
||||
|
||||
output_bfd = finfo->output_bfd;
|
||||
sym_is_global = coff_backend_info (input_bfd)->_bfd_coff_sym_is_global;
|
||||
strings = NULL;
|
||||
syment_base = obj_raw_syment_count (output_bfd);
|
||||
isymesz = bfd_coff_symesz (input_bfd);
|
||||
@ -1237,13 +1368,6 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|
||||
linesz = bfd_coff_linesz (input_bfd);
|
||||
BFD_ASSERT (linesz == bfd_coff_linesz (output_bfd));
|
||||
|
||||
n_tmask = coff_data (input_bfd)->local_n_tmask;
|
||||
n_btshft = coff_data (input_bfd)->local_n_btshft;
|
||||
|
||||
/* Define macros so that ISFCN, et. al., macros work correctly. */
|
||||
#define N_TMASK n_tmask
|
||||
#define N_BTSHFT n_btshft
|
||||
|
||||
copy = false;
|
||||
if (! finfo->info->keep_memory)
|
||||
copy = true;
|
||||
@ -1284,6 +1408,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|
||||
while (esym < esym_end)
|
||||
{
|
||||
struct internal_syment isym;
|
||||
enum coff_symbol_classification classification;
|
||||
boolean skip;
|
||||
boolean global;
|
||||
boolean dont_skip_symbol;
|
||||
@ -1297,14 +1422,22 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|
||||
the symbol. */
|
||||
isym = *isymp;
|
||||
|
||||
if (isym.n_scnum != 0)
|
||||
*secpp = coff_section_from_bfd_index (input_bfd, isym.n_scnum);
|
||||
else
|
||||
classification = bfd_coff_classify_symbol (input_bfd, &isym);
|
||||
switch (classification)
|
||||
{
|
||||
if (isym.n_value == 0)
|
||||
*secpp = bfd_und_section_ptr;
|
||||
else
|
||||
*secpp = bfd_com_section_ptr;
|
||||
default:
|
||||
abort ();
|
||||
case COFF_SYMBOL_GLOBAL:
|
||||
case COFF_SYMBOL_PE_SECTION:
|
||||
case COFF_SYMBOL_LOCAL:
|
||||
*secpp = coff_section_from_bfd_index (input_bfd, isym.n_scnum);
|
||||
break;
|
||||
case COFF_SYMBOL_COMMON:
|
||||
*secpp = bfd_com_section_ptr;
|
||||
break;
|
||||
case COFF_SYMBOL_UNDEFINED:
|
||||
*secpp = bfd_und_section_ptr;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Extract the flag indicating if this symbol is used by a
|
||||
@ -1328,26 +1461,34 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|
||||
|
||||
if (! skip)
|
||||
{
|
||||
if (isym.n_sclass == C_EXT
|
||||
#ifdef C_SYSTEM
|
||||
|| isym.n_sclass == C_SYSTEM
|
||||
#endif
|
||||
|| (sym_is_global && (*sym_is_global) (input_bfd, &isym)))
|
||||
switch (classification)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
case COFF_SYMBOL_GLOBAL:
|
||||
case COFF_SYMBOL_COMMON:
|
||||
case COFF_SYMBOL_PE_SECTION:
|
||||
/* This is a global symbol. Global symbols come at the
|
||||
end of the symbol table, so skip them for now.
|
||||
Function symbols, however, are an exception, and are
|
||||
not moved to the end. */
|
||||
Locally defined function symbols, however, are an
|
||||
exception, and are not moved to the end. */
|
||||
global = true;
|
||||
if (! ISFCN (isym.n_type))
|
||||
skip = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
|
||||
case COFF_SYMBOL_UNDEFINED:
|
||||
/* Undefined symbols are left for the end. */
|
||||
global = true;
|
||||
skip = true;
|
||||
break;
|
||||
|
||||
case COFF_SYMBOL_LOCAL:
|
||||
/* This is a local symbol. Skip it if we are discarding
|
||||
local symbols. */
|
||||
if (finfo->info->discard == discard_all && ! dont_skip_symbol)
|
||||
skip = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1455,7 +1596,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|
||||
{
|
||||
const char *elename;
|
||||
char elebuf[SYMNMLEN + 1];
|
||||
char *copy;
|
||||
char *name_copy;
|
||||
|
||||
bfd_coff_swap_sym_in (input_bfd, (PTR) esl, (PTR) islp);
|
||||
|
||||
@ -1470,12 +1611,13 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|
||||
if (elename == NULL)
|
||||
return false;
|
||||
|
||||
copy = (char *) bfd_alloc (input_bfd, strlen (elename) + 1);
|
||||
if (copy == NULL)
|
||||
name_copy = (char *) bfd_alloc (input_bfd,
|
||||
strlen (elename) + 1);
|
||||
if (name_copy == NULL)
|
||||
return false;
|
||||
strcpy (copy, elename);
|
||||
strcpy (name_copy, elename);
|
||||
|
||||
(*epp)->name = copy;
|
||||
(*epp)->name = name_copy;
|
||||
(*epp)->type = islp->n_type;
|
||||
(*epp)->tagndx = 0;
|
||||
if (islp->n_numaux >= 1
|
||||
@ -1587,31 +1729,76 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|
||||
isym._n._n_n._n_offset = STRING_SIZE_SIZE + indx;
|
||||
}
|
||||
|
||||
if (isym.n_scnum > 0)
|
||||
switch (isym.n_sclass)
|
||||
{
|
||||
isym.n_scnum = (*secpp)->output_section->target_index;
|
||||
isym.n_value += (*secpp)->output_offset;
|
||||
if (! obj_pe (input_bfd))
|
||||
isym.n_value -= (*secpp)->vma;
|
||||
if (! obj_pe (finfo->output_bfd))
|
||||
isym.n_value += (*secpp)->output_section->vma;
|
||||
}
|
||||
case C_AUTO:
|
||||
case C_MOS:
|
||||
case C_EOS:
|
||||
case C_MOE:
|
||||
case C_MOU:
|
||||
case C_UNTAG:
|
||||
case C_STRTAG:
|
||||
case C_ENTAG:
|
||||
case C_TPDEF:
|
||||
case C_ARG:
|
||||
case C_USTATIC:
|
||||
case C_REG:
|
||||
case C_REGPARM:
|
||||
case C_FIELD:
|
||||
/* The symbol value should not be modified. */
|
||||
break;
|
||||
|
||||
case C_FCN:
|
||||
if (obj_pe (input_bfd)
|
||||
&& strcmp (isym.n_name, ".bf") != 0
|
||||
&& isym.n_scnum > 0)
|
||||
{
|
||||
/* For PE, .lf and .ef get their value left alone,
|
||||
while .bf gets relocated. However, they all have
|
||||
"real" section numbers, and need to be moved into
|
||||
the new section. */
|
||||
isym.n_scnum = (*secpp)->output_section->target_index;
|
||||
break;
|
||||
}
|
||||
/* Fall through. */
|
||||
default:
|
||||
case C_LABEL: /* Not completely sure about these 2 */
|
||||
case C_EXTDEF:
|
||||
case C_BLOCK:
|
||||
case C_EFCN:
|
||||
case C_NULL:
|
||||
case C_EXT:
|
||||
case C_STAT:
|
||||
case C_SECTION:
|
||||
case C_NT_WEAK:
|
||||
/* Compute new symbol location. */
|
||||
if (isym.n_scnum > 0)
|
||||
{
|
||||
isym.n_scnum = (*secpp)->output_section->target_index;
|
||||
isym.n_value += (*secpp)->output_offset;
|
||||
if (! obj_pe (input_bfd))
|
||||
isym.n_value -= (*secpp)->vma;
|
||||
if (! obj_pe (finfo->output_bfd))
|
||||
isym.n_value += (*secpp)->output_section->vma;
|
||||
}
|
||||
break;
|
||||
|
||||
case C_FILE:
|
||||
/* The value of a C_FILE symbol is the symbol index of
|
||||
the next C_FILE symbol. The value of the last C_FILE
|
||||
symbol is the symbol index to the first external
|
||||
symbol (actually, coff_renumber_symbols does not get
|
||||
this right--it just sets the value of the last C_FILE
|
||||
symbol to zero--and nobody has ever complained about
|
||||
it). We try to get this right, below, just before we
|
||||
write the symbols out, but in the general case we may
|
||||
have to write the symbol out twice. */
|
||||
|
||||
/* The value of a C_FILE symbol is the symbol index of the
|
||||
next C_FILE symbol. The value of the last C_FILE symbol
|
||||
is the symbol index to the first external symbol
|
||||
(actually, coff_renumber_symbols does not get this
|
||||
right--it just sets the value of the last C_FILE symbol
|
||||
to zero--and nobody has ever complained about it). We
|
||||
try to get this right, below, just before we write the
|
||||
symbols out, but in the general case we may have to write
|
||||
the symbol out twice. */
|
||||
if (isym.n_sclass == C_FILE)
|
||||
{
|
||||
if (finfo->last_file_index != -1
|
||||
&& finfo->last_file.n_value != (long) output_index)
|
||||
{
|
||||
/* We must correct the value of the last C_FILE entry. */
|
||||
/* We must correct the value of the last C_FILE
|
||||
entry. */
|
||||
finfo->last_file.n_value = output_index;
|
||||
if ((bfd_size_type) finfo->last_file_index >= syment_base)
|
||||
{
|
||||
@ -1643,12 +1830,16 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|
||||
|
||||
finfo->last_file_index = output_index;
|
||||
finfo->last_file = isym;
|
||||
break;
|
||||
}
|
||||
|
||||
/* If doing task linking, convert normal global function symbols to
|
||||
static functions. */
|
||||
|
||||
if (finfo->info->task_link && isym.n_sclass == C_EXT)
|
||||
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)))
|
||||
isym.n_sclass = C_STAT;
|
||||
|
||||
/* Output the symbol. */
|
||||
@ -1920,6 +2111,8 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|
||||
bfd_vma offset;
|
||||
bfd_byte *eline;
|
||||
bfd_byte *elineend;
|
||||
bfd_byte *oeline;
|
||||
boolean skipping;
|
||||
|
||||
/* FIXME: If SEC_HAS_CONTENTS is not for the section, then
|
||||
build_link_order in ldwrite.c will not have created a
|
||||
@ -1941,7 +2134,9 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|
||||
|
||||
offset = o->output_section->vma + o->output_offset - o->vma;
|
||||
eline = finfo->linenos;
|
||||
oeline = finfo->linenos;
|
||||
elineend = eline + linesz * o->lineno_count;
|
||||
skipping = false;
|
||||
for (; eline < elineend; eline += linesz)
|
||||
{
|
||||
struct internal_lineno iline;
|
||||
@ -1961,11 +2156,13 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|
||||
if (indx < 0)
|
||||
{
|
||||
/* These line numbers are attached to a symbol
|
||||
which we are stripping. We should really
|
||||
just discard the line numbers, but that would
|
||||
be a pain because we have already counted
|
||||
them. */
|
||||
indx = 0;
|
||||
which we are stripping. We must discard the
|
||||
line numbers because reading them back with
|
||||
no associated symbol (or associating them all
|
||||
with symbol #0) will fail. We can't regain
|
||||
the space in the output file, but at least
|
||||
they're dense. */
|
||||
skipping = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -2004,23 +2201,32 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|
||||
is.n_type, is.n_sclass, 0,
|
||||
is.n_numaux, auxptr);
|
||||
}
|
||||
|
||||
skipping = false;
|
||||
}
|
||||
|
||||
iline.l_addr.l_symndx = indx;
|
||||
}
|
||||
|
||||
bfd_coff_swap_lineno_out (output_bfd, (PTR) &iline, (PTR) eline);
|
||||
if (!skipping)
|
||||
{
|
||||
bfd_coff_swap_lineno_out (output_bfd, (PTR) &iline,
|
||||
(PTR) oeline);
|
||||
oeline += linesz;
|
||||
}
|
||||
}
|
||||
|
||||
if (bfd_seek (output_bfd,
|
||||
(o->output_section->line_filepos
|
||||
+ o->output_section->lineno_count * linesz),
|
||||
SEEK_SET) != 0
|
||||
|| bfd_write (finfo->linenos, linesz, o->lineno_count,
|
||||
output_bfd) != linesz * o->lineno_count)
|
||||
|| (bfd_write (finfo->linenos, 1, oeline - finfo->linenos,
|
||||
output_bfd)
|
||||
!= (bfd_size_type) (oeline - finfo->linenos)))
|
||||
return false;
|
||||
|
||||
o->output_section->lineno_count += o->lineno_count;
|
||||
o->output_section->lineno_count +=
|
||||
(oeline - finfo->linenos) / linesz;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2076,7 +2282,7 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
|
||||
&& o->reloc_count != 0)
|
||||
{
|
||||
((*_bfd_error_handler)
|
||||
("%s: relocs in section `%s', but it has no contents",
|
||||
(_("%s: relocs in section `%s', but it has no contents"),
|
||||
bfd_get_filename (input_bfd),
|
||||
bfd_get_section_name (input_bfd, o)));
|
||||
bfd_set_error (bfd_error_no_contents);
|
||||
@ -2219,7 +2425,10 @@ _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, o->output_offset,
|
||||
contents,
|
||||
(file_ptr)
|
||||
(o->output_offset *
|
||||
bfd_octets_per_byte (output_bfd)),
|
||||
(o->_cooked_size != 0
|
||||
? o->_cooked_size
|
||||
: o->_raw_size)))
|
||||
@ -2337,12 +2546,15 @@ _bfd_coff_write_global_sym (h, data)
|
||||
if (isym.n_sclass == C_NULL)
|
||||
isym.n_sclass = C_EXT;
|
||||
|
||||
/* 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. */
|
||||
/* 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. */
|
||||
if (finfo->global_to_static)
|
||||
{
|
||||
if (isym.n_sclass != C_EXT)
|
||||
if (isym.n_sclass != C_EXT
|
||||
&& isym.n_sclass != C_WEAKEXT
|
||||
&& (! obj_pe (output_bfd) || isym.n_sclass != C_NT_WEAK))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -2369,11 +2581,64 @@ _bfd_coff_write_global_sym (h, data)
|
||||
|
||||
++obj_raw_syment_count (output_bfd);
|
||||
|
||||
/* Write out any associated aux entries. There normally will be
|
||||
none. If there are any, I have no idea how to modify them. */
|
||||
/* Write out any associated aux entries. Most of the aux entries
|
||||
will have been modified in _bfd_coff_link_input_bfd. We have to
|
||||
handle section aux entries here, now that we have the final
|
||||
relocation and line number counts. */
|
||||
for (i = 0; i < isym.n_numaux; i++)
|
||||
{
|
||||
bfd_coff_swap_aux_out (output_bfd, (PTR) (h->aux + i), isym.n_type,
|
||||
union internal_auxent *auxp;
|
||||
|
||||
auxp = h->aux + i;
|
||||
|
||||
/* Look for a section aux entry here using the same tests that
|
||||
coff_swap_aux_out uses. */
|
||||
if (i == 0
|
||||
&& (isym.n_sclass == C_STAT
|
||||
|| isym.n_sclass == C_HIDDEN)
|
||||
&& isym.n_type == T_NULL
|
||||
&& (h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak))
|
||||
{
|
||||
asection *sec;
|
||||
|
||||
sec = h->root.u.def.section->output_section;
|
||||
if (sec != NULL)
|
||||
{
|
||||
auxp->x_scn.x_scnlen = (sec->_cooked_size != 0
|
||||
? sec->_cooked_size
|
||||
: sec->_raw_size);
|
||||
|
||||
/* For PE, an overflow on the final link reportedly does
|
||||
not matter. FIXME: Why not? */
|
||||
|
||||
if (sec->reloc_count > 0xffff
|
||||
&& (! obj_pe (output_bfd)
|
||||
|| finfo->info->relocateable))
|
||||
(*_bfd_error_handler)
|
||||
(_("%s: %s: reloc overflow: 0x%lx > 0xffff"),
|
||||
bfd_get_filename (output_bfd),
|
||||
bfd_get_section_name (output_bfd, sec),
|
||||
sec->reloc_count);
|
||||
|
||||
if (sec->lineno_count > 0xffff
|
||||
&& (! obj_pe (output_bfd)
|
||||
|| finfo->info->relocateable))
|
||||
(*_bfd_error_handler)
|
||||
(_("%s: warning: %s: line number overflow: 0x%lx > 0xffff"),
|
||||
bfd_get_filename (output_bfd),
|
||||
bfd_get_section_name (output_bfd, sec),
|
||||
sec->lineno_count);
|
||||
|
||||
auxp->x_scn.x_nreloc = sec->reloc_count;
|
||||
auxp->x_scn.x_nlinno = sec->lineno_count;
|
||||
auxp->x_scn.x_checksum = 0;
|
||||
auxp->x_scn.x_associated = 0;
|
||||
auxp->x_scn.x_comdat = 0;
|
||||
}
|
||||
}
|
||||
|
||||
bfd_coff_swap_aux_out (output_bfd, (PTR) auxp, isym.n_type,
|
||||
isym.n_sclass, i, isym.n_numaux,
|
||||
(PTR) finfo->outsyms);
|
||||
if (bfd_write (finfo->outsyms, symesz, 1, output_bfd) != symesz)
|
||||
@ -2475,7 +2740,9 @@ _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) link_order->offset, size);
|
||||
(file_ptr)
|
||||
(link_order->offset *
|
||||
bfd_octets_per_byte (output_bfd)), size);
|
||||
free (buf);
|
||||
if (! ok)
|
||||
return false;
|
||||
@ -2586,6 +2853,14 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
|
||||
h = NULL;
|
||||
sym = NULL;
|
||||
}
|
||||
else if (symndx < 0
|
||||
|| (unsigned long) symndx >= obj_raw_syment_count (input_bfd))
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s: illegal symbol index %ld in relocs",
|
||||
bfd_get_filename (input_bfd), symndx);
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
h = obj_coff_sym_hashes (input_bfd)[symndx];
|
||||
@ -2658,7 +2933,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
|
||||
{
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.string, input_bfd, input_section,
|
||||
rel->r_vaddr - input_section->vma)))
|
||||
rel->r_vaddr - input_section->vma, true)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -2702,7 +2977,7 @@ _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
|
||||
break;
|
||||
case bfd_reloc_outofrange:
|
||||
(*_bfd_error_handler)
|
||||
("%s: bad reloc address 0x%lx in section `%s'",
|
||||
(_("%s: bad reloc address 0x%lx in section `%s'"),
|
||||
bfd_get_filename (input_bfd),
|
||||
(unsigned long) rel->r_vaddr,
|
||||
bfd_get_section_name (input_bfd, input_section));
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* Generic COFF swapping routines, for BFD.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
|
||||
Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -26,10 +27,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
Any file which uses this must first include "coff/internal.h" and
|
||||
"coff/CPU.h". The functions will then be correct for that CPU. */
|
||||
|
||||
#ifndef IMAGE_BASE
|
||||
#define IMAGE_BASE 0
|
||||
#endif
|
||||
|
||||
#define PUTWORD bfd_h_put_32
|
||||
#define PUTHALF bfd_h_put_16
|
||||
#define PUTBYTE bfd_h_put_8
|
||||
@ -264,7 +261,7 @@ coff_swap_reloc_out (abfd, src, dst)
|
||||
SWAP_OUT_RELOC_EXTRA(abfd,reloc_src, reloc_dst);
|
||||
#endif
|
||||
|
||||
return RELSZ;
|
||||
return bfd_coff_relsz (abfd);
|
||||
}
|
||||
|
||||
#endif /* NO_COFF_RELOCS */
|
||||
@ -288,6 +285,9 @@ coff_swap_filehdr_in (abfd, src, dst)
|
||||
filehdr_dst->f_nsyms = bfd_h_get_32(abfd, (bfd_byte *)filehdr_src-> f_nsyms);
|
||||
filehdr_dst->f_opthdr = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_opthdr);
|
||||
filehdr_dst->f_flags = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_flags);
|
||||
#ifdef TIC80_TARGET_ID
|
||||
filehdr_dst->f_target_id = bfd_h_get_16(abfd, (bfd_byte *)filehdr_src-> f_target_id);
|
||||
#endif
|
||||
|
||||
#ifdef COFF_ADJUST_FILEHDR_IN_POST
|
||||
COFF_ADJUST_FILEHDR_IN_POST (abfd, src, dst);
|
||||
@ -314,11 +314,14 @@ coff_swap_filehdr_out (abfd, in, out)
|
||||
bfd_h_put_32(abfd, filehdr_in->f_nsyms, (bfd_byte *) filehdr_out->f_nsyms);
|
||||
bfd_h_put_16(abfd, filehdr_in->f_opthdr, (bfd_byte *) filehdr_out->f_opthdr);
|
||||
bfd_h_put_16(abfd, filehdr_in->f_flags, (bfd_byte *) filehdr_out->f_flags);
|
||||
#ifdef TIC80_TARGET_ID
|
||||
bfd_h_put_16(abfd, filehdr_in->f_target_id, (bfd_byte *) filehdr_out->f_target_id);
|
||||
#endif
|
||||
|
||||
#ifdef COFF_ADJUST_FILEHDR_OUT_POST
|
||||
COFF_ADJUST_FILEHDR_OUT_POST (abfd, in, out);
|
||||
#endif
|
||||
return FILHSZ;
|
||||
return bfd_coff_filhsz (abfd);
|
||||
}
|
||||
|
||||
|
||||
@ -354,6 +357,9 @@ coff_swap_sym_in (abfd, ext1, in1)
|
||||
}
|
||||
in->n_sclass = bfd_h_get_8(abfd, ext->e_sclass);
|
||||
in->n_numaux = bfd_h_get_8(abfd, ext->e_numaux);
|
||||
#ifdef COFF_ADJUST_SYM_IN_POST
|
||||
COFF_ADJUST_SYM_IN_POST (abfd, ext1, in1);
|
||||
#endif
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
@ -387,6 +393,9 @@ coff_swap_sym_out (abfd, inp, extp)
|
||||
}
|
||||
bfd_h_put_8(abfd, in->n_sclass , ext->e_sclass);
|
||||
bfd_h_put_8(abfd, in->n_numaux , ext->e_numaux);
|
||||
#ifdef COFF_ADJUST_SYM_OUT_POST
|
||||
COFF_ADJUST_SYM_OUT_POST (abfd, inp, extp);
|
||||
#endif
|
||||
return SYMESZ;
|
||||
}
|
||||
|
||||
@ -416,7 +425,16 @@ coff_swap_aux_in (abfd, ext1, type, class, indx, numaux, in1)
|
||||
#if FILNMLEN != E_FILNMLEN
|
||||
-> Error, we need to cope with truncating or extending FILNMLEN!;
|
||||
#else
|
||||
memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
|
||||
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);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
goto end;
|
||||
@ -512,8 +530,8 @@ coff_swap_aux_out (abfd, inp, type, class, indx, numaux, extp)
|
||||
PTR inp;
|
||||
int type;
|
||||
int class;
|
||||
int indx;
|
||||
int numaux;
|
||||
int indx ATTRIBUTE_UNUSED;
|
||||
int numaux ATTRIBUTE_UNUSED;
|
||||
PTR extp;
|
||||
{
|
||||
union internal_auxent *in = (union internal_auxent *)inp;
|
||||
@ -833,7 +851,7 @@ coff_swap_scnhdr_out (abfd, in, out)
|
||||
{
|
||||
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *)in;
|
||||
SCNHDR *scnhdr_ext = (SCNHDR *)out;
|
||||
unsigned int ret = SCNHSZ;
|
||||
unsigned int ret = bfd_coff_scnhsz (abfd);
|
||||
|
||||
#ifdef COFF_ADJUST_SCNHDR_OUT_PRE
|
||||
COFF_ADJUST_SCNHDR_OUT_PRE (abfd, in, out);
|
||||
@ -870,7 +888,7 @@ coff_swap_scnhdr_out (abfd, in, out)
|
||||
memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
|
||||
buf[sizeof (scnhdr_int->s_name)] = '\0';
|
||||
(*_bfd_error_handler)
|
||||
("%s: warning: %s: line number overflow: 0x%lx > 0xffff",
|
||||
(_("%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);
|
||||
@ -883,7 +901,7 @@ coff_swap_scnhdr_out (abfd, in, out)
|
||||
|
||||
memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
|
||||
buf[sizeof (scnhdr_int->s_name)] = '\0';
|
||||
(*_bfd_error_handler) ("%s: %s: reloc overflow: 0x%lx > 0xffff",
|
||||
(*_bfd_error_handler) (_("%s: %s: reloc overflow: 0x%lx > 0xffff"),
|
||||
bfd_get_filename (abfd),
|
||||
buf, scnhdr_int->s_nreloc);
|
||||
bfd_set_error (bfd_error_file_truncated);
|
||||
|
@ -30,16 +30,19 @@ targ_cpu=`echo $targ | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
case "${targ_cpu}" in
|
||||
alpha*) targ_archs=bfd_alpha_arch ;;
|
||||
arm*) targ_archs=bfd_arm_arch ;;
|
||||
c30*) targ_archs=bfd_tic30_arch ;;
|
||||
strongarm*) targ_archs=bfd_arm_arch ;;
|
||||
thumb*) targ_archs=bfd_arm_arch ;;
|
||||
c30*) targ_archs=bfd_tic30_arch ;;
|
||||
hppa*) targ_archs=bfd_hppa_arch ;;
|
||||
i[3456]86) targ_archs=bfd_i386_arch ;;
|
||||
i370) targ_archs=bfd_i370_arch ;;
|
||||
m68*) targ_archs=bfd_m68k_arch ;;
|
||||
m88*) targ_archs=bfd_m88k_arch ;;
|
||||
mips*) targ_archs=bfd_mips_arch ;;
|
||||
pj*) targ_archs="bfd_pj_arch bfd_i386_arch";;
|
||||
powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
|
||||
rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
|
||||
sparc*) targ_archs=bfd_sparc_arch ;;
|
||||
sparc*) targ_archs=bfd_sparc_arch ;;
|
||||
v850*) targ_archs=bfd_v850_arch ;;
|
||||
z8k*) targ_archs=bfd_z8k_arch ;;
|
||||
*) targ_archs=bfd_${targ_cpu}_arch ;;
|
||||
@ -54,7 +57,7 @@ esac
|
||||
case "${targ}" in
|
||||
# START OF targmatch.h
|
||||
#ifdef BFD64
|
||||
alpha*-*-netbsd*)
|
||||
alpha*-*-netbsd* | alpha*-*-freebsd*)
|
||||
targ_defvec=bfd_elf64_alpha_vec
|
||||
targ_selvecs=ecoffalpha_little_vec
|
||||
;;
|
||||
@ -71,7 +74,7 @@ case "${targ}" in
|
||||
targ_selvecs=ecoffalpha_little_vec
|
||||
;;
|
||||
alpha*-*-*vms*)
|
||||
targ_defvec=evax_alpha_vec
|
||||
targ_defvec=vms_alpha_vec
|
||||
;;
|
||||
alpha*-*-*)
|
||||
targ_defvec=ecoffalpha_little_vec
|
||||
@ -83,9 +86,24 @@ case "${targ}" in
|
||||
targ_selvecs=bfd_elf32_bigarc_vec
|
||||
;;
|
||||
|
||||
arm-*-netbsd*)
|
||||
targ_defvec=armnetbsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
arm-*-riscix*)
|
||||
targ_defvec=riscix_vec
|
||||
;;
|
||||
arm-epoc-pe*)
|
||||
targ_defvec=arm_epoc_pe_little_vec
|
||||
targ_selvecs="arm_epoc_pe_little_vec arm_epoc_pe_big_vec arm_epoc_pei_little_vec arm_epoc_pei_big_vec"
|
||||
targ_underscore=no
|
||||
;;
|
||||
arm-wince-pe | arm-*-wince)
|
||||
targ_defvec=armpe_little_vec
|
||||
targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec"
|
||||
targ_underscore=no
|
||||
targ_cflags=-DARM_WINCE
|
||||
;;
|
||||
arm-*-pe*)
|
||||
targ_defvec=armpe_little_vec
|
||||
targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec"
|
||||
@ -104,16 +122,48 @@ case "${targ}" in
|
||||
targ_selvecs=armcoff_big_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
arm-*-elf | arm*-*-linux-gnu* | arm*-*-conix*)
|
||||
targ_defvec=bfd_elf32_littlearm_vec
|
||||
targ_selvecs=bfd_elf32_bigarm_vec
|
||||
;;
|
||||
arm-*-oabi)
|
||||
targ_defvec=bfd_elf32_littlearm_oabi_vec
|
||||
targ_selvecs=bfd_elf32_bigarm_oabi_vec
|
||||
;;
|
||||
|
||||
thumb-*-coff)
|
||||
targ_defvec=armcoff_little_vec
|
||||
targ_selvecs=armcoff_big_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
thumb-*-oabi)
|
||||
targ_defvec=bfd_elf32_littlearm_oabi_vec
|
||||
targ_selvecs=bfd_elf32_bigarm_oabi_vec
|
||||
;;
|
||||
thumb-*-elf)
|
||||
targ_defvec=bfd_elf32_littlearm_vec
|
||||
targ_selvecs=bfd_elf32_bigarm_vec
|
||||
;;
|
||||
thumb-epoc-pe*)
|
||||
targ_defvec=arm_epoc_pe_little_vec
|
||||
targ_selvecs="arm_epoc_pe_little_vec arm_epoc_pe_big_vec arm_epoc_pei_little_vec arm_epoc_pei_big_vec"
|
||||
targ_underscore=no
|
||||
;;
|
||||
thumb-*-pe*)
|
||||
targ_defvec=armpe_little_vec
|
||||
targ_selvecs="armpe_little_vec armpe_big_vec armpei_little_vec armpei_big_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
strongarm-*-elf)
|
||||
targ_defvec=bfd_elf32_littlearm_vec
|
||||
targ_selvecs=bfd_elf32_bigarm_vec
|
||||
;;
|
||||
strongarm-*-coff)
|
||||
targ_defvec=armcoff_little_vec
|
||||
targ_selvecs=armcoff_big_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
a29k-*-ebmon* | a29k-*-udi* | a29k-*-coff* | a29k-*-sym1* | \
|
||||
a29k-*-vxworks* | a29k-*-sysv*)
|
||||
targ_defvec=a29kcoff_big_vec
|
||||
@ -125,6 +175,10 @@ case "${targ}" in
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
avr-*-*)
|
||||
targ_defvec=bfd_elf32_avr_vec
|
||||
;;
|
||||
|
||||
c30-*-*aout* | tic30-*-*aout*)
|
||||
targ_defvec=tic30_aout_vec
|
||||
;;
|
||||
@ -136,6 +190,13 @@ case "${targ}" in
|
||||
targ_defvec=bfd_elf32_d10v_vec
|
||||
;;
|
||||
|
||||
d30v-*-*)
|
||||
targ_defvec=bfd_elf32_d30v_vec
|
||||
;;
|
||||
|
||||
fr30-*-elf)
|
||||
targ_defvec=bfd_elf32_fr30_vec
|
||||
;;
|
||||
|
||||
|
||||
h8300*-*-*)
|
||||
@ -148,41 +209,60 @@ case "${targ}" in
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
hppa*-*-*elf* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems*)
|
||||
#if 0 /* HPPA ELF does not work currently. */
|
||||
hppa*-*-*elf* | hppa*-*-linux-gnu* | hppa*-*-lites* | hppa*-*-sysv4* | hppa*-*-rtems*)
|
||||
targ_defvec=bfd_elf32_hppa_vec
|
||||
;;
|
||||
#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF)
|
||||
#endif
|
||||
#if defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) || defined (HOST_HPPAMPEIX)
|
||||
#if 0 /* HPPA ELF does not work currently. */
|
||||
hppa*-*-bsd*)
|
||||
targ_defvec=som_vec
|
||||
targ_selvecs=bfd_elf32_hppa_vec
|
||||
;;
|
||||
hppa*-*-hpux* | hppa*-*-hiux*)
|
||||
#endif
|
||||
hppa*-*-hpux* | hppa*-*-hiux* | hppa*-*-mpeix*)
|
||||
targ_defvec=som_vec
|
||||
;;
|
||||
#if 0 /* HPPA ELF does not work currently. */
|
||||
hppa*-*-osf*)
|
||||
targ_defvec=som_vec
|
||||
targ_selvecs=bfd_elf32_hppa_vec
|
||||
;;
|
||||
#endif
|
||||
#endif /* defined (HOST_HPPAHPUX) || defined (HOST_HPPABSD) || defined (HOST_HPPAOSF) */
|
||||
|
||||
i370-*-*)
|
||||
targ_defvec=bfd_elf32_i370_vec
|
||||
targ_selvecs="bfd_elf32_i370_vec"
|
||||
;;
|
||||
i[3456]86-*-sco3.2v5*coff)
|
||||
targ_defvec=i386coff_vec
|
||||
targ_selvecs=bfd_elf32_i386_vec
|
||||
;;
|
||||
i[3456]86-*-sysv4* | i[3456]86-*-unixware | i[3456]86-*-solaris2* | \
|
||||
i[3456]86-*-elf | i[3456]86-*-sco3.2v5* | i[3456]86-*-freebsdelf* | \
|
||||
i[3456]86-*-dgux*)
|
||||
i[3456]86-*-sysv4* | i[3456]86-*-unixware* | i[3456]86-*-solaris2* | \
|
||||
i[3456]86-*-elf | i[3456]86-*-sco3.2v5* | \
|
||||
i[3456]86-*-dgux* | i[3456]86-*-sysv5*)
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
targ_selvecs=i386coff_vec
|
||||
;;
|
||||
i[3456]86-*-rtemself*)
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
targ_selvecs="i386coff_vec i386aout_vec"
|
||||
;;
|
||||
i[3456]86-*-msdosdjgpp* | i[3456]*-*-go32* | i[3456]86-go32-rtems* )
|
||||
targ_defvec=go32coff_vec
|
||||
targ_selvecs="go32stubbedcoff_vec i386aout_vec"
|
||||
;;
|
||||
i[3456]86-*-sysv* | i[3456]86-*-isc* | i[3456]86-*-sco* | i[3456]86-*-coff | \
|
||||
i[3456]86-*-aix* | i[3456]86*-*-rtems*)
|
||||
i[3456]86-*-aix*)
|
||||
targ_defvec=i386coff_vec
|
||||
;;
|
||||
i[3456]86-sequent-bsd*)
|
||||
i[3456]86*-*-rtems*)
|
||||
targ_defvec=i386coff_vec
|
||||
targ_selvecs="bfd_elf32_i386_vec i386aout_vec"
|
||||
;;
|
||||
i[3456]86-sequent-bsd*)
|
||||
targ_defvec=i386dynix_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
@ -190,11 +270,16 @@ case "${targ}" in
|
||||
targ_defvec=i386bsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[3456]86-*-freebsd*)
|
||||
i[3456]86-*-freebsdaout* | i[3456]86-*-freebsd[12].* | \
|
||||
i[3456]86-*-freebsd[12])
|
||||
targ_defvec=i386freebsd_vec
|
||||
targ_selvecs=i386bsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i[3456]86-*-freebsd*)
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
targ_selvecs=i386coff_vec
|
||||
;;
|
||||
i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
|
||||
targ_defvec=i386netbsd_vec
|
||||
targ_selvecs=i386bsd_vec
|
||||
@ -236,16 +321,34 @@ case "${targ}" in
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
targ_selvecs="i386msdos_vec i386aout_vec"
|
||||
;;
|
||||
i[3456]86-*-mingw32* | i[3456]86-*-cygwin32* | i[3456]86-*-winnt | i[3456]86-*-pe)
|
||||
i[3456]86-*-beospe*)
|
||||
targ_defvec=i386pe_vec
|
||||
targ_selvecs="i386pe_vec i386pei_vec"
|
||||
;;
|
||||
i[3456]86-*-beoself* | i[3456]86-*-beos*)
|
||||
targ_defvec=bfd_elf32_i386_vec
|
||||
targ_selvecs="i386pe_vec i386pei_vec"
|
||||
;;
|
||||
i[3456]86-*-interix*)
|
||||
targ_defvec=i386pei_vec
|
||||
targ_selvecs="i386pe_vec"
|
||||
# FIXME: This should eventually be checked at runtime.
|
||||
targ_cflags=-DSTRICT_PE_FORMAT
|
||||
;;
|
||||
i[3456]86-*-mingw32* | i[3456]86-*-cygwin* | i[3456]86-*-winnt | i[3456]86-*-pe)
|
||||
targ_defvec=i386pe_vec
|
||||
targ_selvecs="i386pe_vec i386pei_vec bfd_elf32_i386_vec"
|
||||
;;
|
||||
i[3456]86-none-*)
|
||||
targ_defvec=i386coff_vec
|
||||
;;
|
||||
i[3456]86-*-aout* | i[3456]86*-*-vsta*)
|
||||
targ_defvec=i386aout_vec
|
||||
;;
|
||||
i[3456]86-*-vxworks*)
|
||||
targ_defvec=i386aout_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
i860-*-mach3* | i860-*-osf1* | i860-*-coff*)
|
||||
targ_defvec=i860coff_vec
|
||||
@ -269,6 +372,10 @@ case "${targ}" in
|
||||
targ_selvecs="b_out_vec_big_host icoff_little_vec icoff_big_vec ieee_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
i960-*-elf*)
|
||||
targ_defvec=bfd_elf32_i960_vec
|
||||
targ_selvecs="icoff_little_vec icoff_big_vec"
|
||||
;;
|
||||
|
||||
m32r-*-*)
|
||||
targ_defvec=bfd_elf32_m32r_vec
|
||||
@ -290,17 +397,21 @@ case "${targ}" in
|
||||
;;
|
||||
m68*-*-aout*)
|
||||
targ_defvec=aout0_big_vec
|
||||
# We include cisco_core_vec here, rather than making a separate cisco
|
||||
# We include cisco_core_big_vec here, rather than making a separate cisco
|
||||
# configuration, so that cisco-core.c gets routinely tested at
|
||||
# least for compilation.
|
||||
targ_selvecs="cisco_core_vec ieee_vec"
|
||||
targ_selvecs="cisco_core_big_vec ieee_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
m68*-*-elf* | m68*-*-sysv4*)
|
||||
targ_defvec=bfd_elf32_m68k_vec
|
||||
targ_selvecs="m68kcoff_vec ieee_vec"
|
||||
;;
|
||||
m68*-*-coff* | m68*-*-sysv* | m68*-*-rtems*)
|
||||
m68*-*-rtems*)
|
||||
targ_defvec=m68kcoff_vec
|
||||
targ_selvecs="m68kcoff_vec versados_vec ieee_vec aout0_big_vec"
|
||||
;;
|
||||
m68*-*-coff* | m68*-*-sysv*)
|
||||
targ_defvec=m68kcoff_vec
|
||||
targ_selvecs="m68kcoff_vec versados_vec ieee_vec"
|
||||
;;
|
||||
@ -317,6 +428,11 @@ case "${targ}" in
|
||||
targ_defvec=bfd_elf32_m68k_vec
|
||||
targ_selvecs=m68klinux_vec
|
||||
;;
|
||||
m68*-*-gnu*)
|
||||
targ_defvec=bfd_elf32_m68k_vec
|
||||
# targ_selvecs=m68kmach3_vec
|
||||
# targ_cflags=-DSTAT_FOR_EXEC
|
||||
;;
|
||||
m68*-*-lynxos*)
|
||||
targ_defvec=m68klynx_coff_vec
|
||||
targ_selvecs=m68klynx_aout_vec
|
||||
@ -367,6 +483,15 @@ case "${targ}" in
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
mcore-*-elf)
|
||||
targ_defvec=bfd_elf32_mcore_big_vec
|
||||
targ_selvecs="bfd_elf32_mcore_big_vec bfd_elf32_mcore_little_vec"
|
||||
;;
|
||||
mcore-*-pe)
|
||||
targ_defvec=mcore_pe_big_vec
|
||||
targ_selvecs="mcore_pe_big_vec mcore_pe_little_vec mcore_pei_big_vec mcore_pei_little_vec"
|
||||
;;
|
||||
|
||||
mips*-big-*)
|
||||
targ_defvec=ecoff_big_vec
|
||||
targ_selvecs=ecoff_little_vec
|
||||
@ -415,6 +540,11 @@ case "${targ}" in
|
||||
targ_defvec=aout_mips_little_vec
|
||||
targ_cflags=-DSTAT_FOR_EXEC
|
||||
;;
|
||||
mips*-*-pe*)
|
||||
targ_defvec=mipslpe_vec
|
||||
targ_selvecs="mipslpei_vec mipslpei_vec ecoff_little_vec ecoff_big_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
mips*-*-sysv4*)
|
||||
targ_defvec=bfd_elf32_bigmips_vec
|
||||
targ_selvecs="bfd_elf32_littlemips_vec ecoff_big_vec ecoff_little_vec"
|
||||
@ -423,11 +553,11 @@ case "${targ}" in
|
||||
targ_defvec=ecoff_big_vec
|
||||
targ_selvecs=ecoff_little_vec
|
||||
;;
|
||||
mips*el-*-elf*)
|
||||
mips*el-*-elf* | mips*el-*-rtems* | mips*el-*-vxworks*)
|
||||
targ_defvec=bfd_elf32_littlemips_vec
|
||||
targ_selvecs="bfd_elf32_bigmips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
|
||||
;;
|
||||
mips*-*-elf* | mips*-*-rtems*)
|
||||
mips*-*-elf* | mips*-*-rtems* | mips*-*-vxworks*)
|
||||
targ_defvec=bfd_elf32_bigmips_vec
|
||||
targ_selvecs="bfd_elf32_littlemips_vec bfd_elf64_bigmips_vec bfd_elf64_littlemips_vec"
|
||||
;;
|
||||
@ -461,13 +591,24 @@ case "${targ}" in
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
pj-*-*)
|
||||
targ_defvec=bfd_elf32_pj_vec
|
||||
targ_selvecs="bfd_elf32_pj_vec bfd_elf32_pjl_vec"
|
||||
;;
|
||||
|
||||
pjl-*-*)
|
||||
targ_defvec=bfd_elf32_pjl_vec
|
||||
targ_selvecs="bfd_elf32_pjl_vec bfd_elf32_pj_vec bfd_elf32_i386_vec"
|
||||
;;
|
||||
|
||||
powerpc-*-aix* | powerpc-*-beos*)
|
||||
targ_defvec=rs6000coff_vec
|
||||
;;
|
||||
powerpc-*-*bsd* | powerpc-*-elf* | powerpc-*-sysv4* | powerpc-*-eabi* | \
|
||||
powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems*)
|
||||
powerpc-*-solaris2* | powerpc-*-linux-gnu* | powerpc-*-rtems* | \
|
||||
powerpc-*-vxworks*)
|
||||
targ_defvec=bfd_elf32_powerpc_vec
|
||||
targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec ppcboot_vec"
|
||||
targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec"
|
||||
;;
|
||||
powerpc-*-macos* | powerpc-*-mpw*)
|
||||
targ_defvec=pmac_xcoff_vec
|
||||
@ -477,12 +618,13 @@ case "${targ}" in
|
||||
targ_selvecs="nlm32_powerpc_vec rs6000coff_vec"
|
||||
;;
|
||||
powerpcle-*-elf* | powerpcle-*-sysv4* | powerpcle-*-eabi* | \
|
||||
powerpcle-*-solaris2* | powerpcle-*-linux-gnu*)
|
||||
powerpcle-*-solaris2* | powerpcle-*-linux-gnu* | powerpcle-*-vxworks* |\
|
||||
powerpcle-*-rtems*)
|
||||
targ_defvec=bfd_elf32_powerpcle_vec
|
||||
targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec ppcboot_vec"
|
||||
targ_selvecs="rs6000coff_vec bfd_elf32_powerpc_vec ppcboot_vec"
|
||||
;;
|
||||
|
||||
powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin32*)
|
||||
powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin*)
|
||||
targ_defvec=bfd_powerpcle_pe_vec
|
||||
targ_selvecs="bfd_powerpcle_pei_vec bfd_powerpc_pei_vec bfd_powerpcle_pe_vec bfd_powerpc_pe_vec"
|
||||
;;
|
||||
@ -491,11 +633,16 @@ case "${targ}" in
|
||||
targ_defvec=rs6000coff_vec
|
||||
;;
|
||||
|
||||
sh-*-elf*)
|
||||
sh-*-elf* | sh-*-rtemself*)
|
||||
targ_defvec=bfd_elf32_sh_vec
|
||||
targ_selvecs="bfd_elf32_shl_vec shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
sh-*-pe)
|
||||
targ_defvec=shlpe_vec
|
||||
targ_selvecs="shlpe_vec shlpei_vec"
|
||||
targ_underscore=yes
|
||||
;;
|
||||
sh-*-* | sh-*-rtems*)
|
||||
targ_defvec=shcoff_vec
|
||||
targ_selvecs="shcoff_vec shlcoff_vec shcoff_small_vec shlcoff_small_vec"
|
||||
@ -507,7 +654,11 @@ case "${targ}" in
|
||||
targ_selvecs=sparcle_aout_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
sparclite-*-elf*)
|
||||
sparc86x-*-aout*)
|
||||
targ_defvec=sunos_big_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
sparclite-*-elf* | sparc86x-*-elf*)
|
||||
targ_defvec=bfd_elf32_sparc_vec
|
||||
;;
|
||||
sparc-*-linux*aout*)
|
||||
@ -517,20 +668,35 @@ case "${targ}" in
|
||||
;;
|
||||
sparc-*-linux-gnu*)
|
||||
targ_defvec=bfd_elf32_sparc_vec
|
||||
targ_selvecs="sparclinux_vec sunos_big_vec"
|
||||
targ_selvecs="sparclinux_vec bfd_elf64_sparc_vec sunos_big_vec"
|
||||
;;
|
||||
sparc-*-lynxos*)
|
||||
targ_defvec=sparclynx_coff_vec
|
||||
targ_selvecs=sparclynx_aout_vec
|
||||
;;
|
||||
sparc-*-netbsd* | sparc-*-openbsd*)
|
||||
sparc-*-netbsdelf*)
|
||||
targ_defvec=bfd_elf32_sparc_vec
|
||||
targ_selvecs=sparcnetbsd_vec
|
||||
;;
|
||||
sparc-*-netbsdaout* | sparc-*-netbsd*)
|
||||
targ_defvec=sparcnetbsd_vec
|
||||
targ_selvecs=bfd_elf32_sparc_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
sparc-*-openbsd*)
|
||||
targ_defvec=sparcnetbsd_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
sparc-*-elf* | sparc-*-solaris2*)
|
||||
sparc-*-elf* | sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
|
||||
targ_defvec=bfd_elf32_sparc_vec
|
||||
targ_selvecs=sunos_big_vec
|
||||
;;
|
||||
#ifdef BFD64
|
||||
sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*)
|
||||
targ_defvec=bfd_elf32_sparc_vec
|
||||
targ_selvecs="bfd_elf64_sparc_vec sunos_big_vec"
|
||||
;;
|
||||
#endif
|
||||
sparc-*-sysv4*)
|
||||
targ_defvec=bfd_elf32_sparc_vec
|
||||
;;
|
||||
@ -567,9 +733,21 @@ case "${targ}" in
|
||||
;;
|
||||
#endif
|
||||
|
||||
tic80*-*-*)
|
||||
targ_defvec=tic80coff_vec
|
||||
targ_underscore=yes
|
||||
;;
|
||||
|
||||
|
||||
v850-*-*)
|
||||
targ_defvec=bfd_elf32_v850_vec
|
||||
;;
|
||||
v850e-*-*)
|
||||
targ_defvec=bfd_elf32_v850_vec
|
||||
;;
|
||||
v850ea-*-*)
|
||||
targ_defvec=bfd_elf32_v850_vec
|
||||
;;
|
||||
#if HAVE_host_aout_vec
|
||||
vax-*-bsd* | vax-*-ultrix*)
|
||||
targ_defvec=host_aout_vec
|
||||
@ -577,6 +755,10 @@ case "${targ}" in
|
||||
;;
|
||||
#endif
|
||||
|
||||
vax*-*-*vms*)
|
||||
targ_defvec=vms_vax_vec
|
||||
;;
|
||||
|
||||
we32k-*-*)
|
||||
targ_defvec=we32kcoff_vec
|
||||
;;
|
||||
@ -615,3 +797,16 @@ case "${targ}" in
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
# If we support any ELF target, then automatically add support for the
|
||||
# generic ELF targets. This permits an objdump with some ELF support
|
||||
# to be used on an arbitrary ELF file for anything other than
|
||||
# relocation information.
|
||||
case "${targ_defvec} ${targ_selvecs}" in
|
||||
*bfd_elf64*)
|
||||
targ_selvecs="${targ_selvecs} bfd_elf64_little_generic_vec bfd_elf64_big_generic_vec bfd_elf32_little_generic_vec bfd_elf32_big_generic_vec"
|
||||
;;
|
||||
*bfd_elf32*)
|
||||
targ_selvecs="${targ_selvecs} bfd_elf32_little_generic_vec bfd_elf32_big_generic_vec"
|
||||
;;
|
||||
esac
|
||||
|
@ -1,46 +1,62 @@
|
||||
/* config.in. Generated automatically from configure.in by autoheader. */
|
||||
|
||||
/* Name of package. */
|
||||
#undef PACKAGE
|
||||
/* Define if using alloca.c. */
|
||||
#undef C_ALLOCA
|
||||
|
||||
/* Version of package. */
|
||||
#undef VERSION
|
||||
/* Define to empty if the keyword does not work. */
|
||||
#undef const
|
||||
|
||||
/* Whether strstr must be declared even if <string.h> is included. */
|
||||
#undef NEED_DECLARATION_STRSTR
|
||||
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
|
||||
This function is required for alloca.c support on those systems. */
|
||||
#undef CRAY_STACKSEG_END
|
||||
|
||||
/* Whether malloc must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_MALLOC
|
||||
/* Define if you have alloca, as a function or macro. */
|
||||
#undef HAVE_ALLOCA
|
||||
|
||||
/* Whether realloc must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_REALLOC
|
||||
|
||||
/* Whether free must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_FREE
|
||||
|
||||
/* Whether getenv must be declared even if <stdlib.h> is included. */
|
||||
#undef NEED_DECLARATION_GETENV
|
||||
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
|
||||
#undef HAVE_ALLOCA_H
|
||||
|
||||
/* Define if you have a working `mmap' system call. */
|
||||
#undef HAVE_MMAP
|
||||
|
||||
/* Define as __inline if that's what the C compiler calls it. */
|
||||
#undef inline
|
||||
|
||||
/* Define to `long' if <sys/types.h> doesn't define. */
|
||||
#undef off_t
|
||||
|
||||
/* Define 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
|
||||
|
||||
/* If using the C implementation of alloca, define if you know the
|
||||
direction of stack growth for your system; otherwise it will be
|
||||
automatically deduced at run-time.
|
||||
STACK_DIRECTION > 0 => grows toward higher addresses
|
||||
STACK_DIRECTION < 0 => grows toward lower addresses
|
||||
STACK_DIRECTION = 0 => direction of growth unknown
|
||||
*/
|
||||
#undef STACK_DIRECTION
|
||||
|
||||
/* Define if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define if you can safely include both <sys/time.h> and <time.h>. */
|
||||
#undef TIME_WITH_SYS_TIME
|
||||
|
||||
/* Do we need to use the b modifier when opening binary files? */
|
||||
#undef USE_BINARY_FOPEN
|
||||
/* Define if you have the __argz_count function. */
|
||||
#undef HAVE___ARGZ_COUNT
|
||||
|
||||
/* Name of host specific header file to include in trad-core.c. */
|
||||
#undef TRAD_HEADER
|
||||
/* Define if you have the __argz_next function. */
|
||||
#undef HAVE___ARGZ_NEXT
|
||||
|
||||
/* Define only if <sys/procfs.h> is available *and* it defines prstatus_t. */
|
||||
#undef HAVE_SYS_PROCFS_H
|
||||
/* Define if you have the __argz_stringify function. */
|
||||
#undef HAVE___ARGZ_STRINGIFY
|
||||
|
||||
/* Do we really want to use mmap if it's available? */
|
||||
#undef USE_MMAP
|
||||
/* Define if you have the dcgettext function. */
|
||||
#undef HAVE_DCGETTEXT
|
||||
|
||||
/* Define if you have the fcntl function. */
|
||||
#undef HAVE_FCNTL
|
||||
@ -48,24 +64,75 @@
|
||||
/* Define if you have the fdopen function. */
|
||||
#undef HAVE_FDOPEN
|
||||
|
||||
/* Define if you have the getcwd function. */
|
||||
#undef HAVE_GETCWD
|
||||
|
||||
/* Define if you have the getgid function. */
|
||||
#undef HAVE_GETGID
|
||||
|
||||
/* Define if you have the getpagesize function. */
|
||||
#undef HAVE_GETPAGESIZE
|
||||
|
||||
/* Define if you have the getuid function. */
|
||||
#undef HAVE_GETUID
|
||||
|
||||
/* Define if you have the madvise function. */
|
||||
#undef HAVE_MADVISE
|
||||
|
||||
/* Define if you have the mprotect function. */
|
||||
#undef HAVE_MPROTECT
|
||||
|
||||
/* Define if you have the munmap function. */
|
||||
#undef HAVE_MUNMAP
|
||||
|
||||
/* Define if you have the putenv function. */
|
||||
#undef HAVE_PUTENV
|
||||
|
||||
/* Define if you have the setenv function. */
|
||||
#undef HAVE_SETENV
|
||||
|
||||
/* Define if you have the setitimer function. */
|
||||
#undef HAVE_SETITIMER
|
||||
|
||||
/* Define if you have the setlocale function. */
|
||||
#undef HAVE_SETLOCALE
|
||||
|
||||
/* Define if you have the stpcpy function. */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define if you have the strcasecmp function. */
|
||||
#undef HAVE_STRCASECMP
|
||||
|
||||
/* Define if you have the strchr function. */
|
||||
#undef HAVE_STRCHR
|
||||
|
||||
/* Define if you have the sysconf function. */
|
||||
#undef HAVE_SYSCONF
|
||||
|
||||
/* Define if you have the <argz.h> header file. */
|
||||
#undef HAVE_ARGZ_H
|
||||
|
||||
/* Define if you have the <dirent.h> header file. */
|
||||
#undef HAVE_DIRENT_H
|
||||
|
||||
/* Define if you have the <fcntl.h> header file. */
|
||||
#undef HAVE_FCNTL_H
|
||||
|
||||
/* Define if you have the <limits.h> header file. */
|
||||
#undef HAVE_LIMITS_H
|
||||
|
||||
/* Define if you have the <locale.h> header file. */
|
||||
#undef HAVE_LOCALE_H
|
||||
|
||||
/* Define if you have the <malloc.h> header file. */
|
||||
#undef HAVE_MALLOC_H
|
||||
|
||||
/* Define if you have the <ndir.h> header file. */
|
||||
#undef HAVE_NDIR_H
|
||||
|
||||
/* Define if you have the <nl_types.h> header file. */
|
||||
#undef HAVE_NL_TYPES_H
|
||||
|
||||
/* Define if you have the <stddef.h> header file. */
|
||||
#undef HAVE_STDDEF_H
|
||||
|
||||
@ -78,9 +145,21 @@
|
||||
/* Define if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define if you have the <sys/dir.h> header file. */
|
||||
#undef HAVE_SYS_DIR_H
|
||||
|
||||
/* Define if you have the <sys/file.h> header file. */
|
||||
#undef HAVE_SYS_FILE_H
|
||||
|
||||
/* Define if you have the <sys/ndir.h> header file. */
|
||||
#undef HAVE_SYS_NDIR_H
|
||||
|
||||
/* Define if you have the <sys/param.h> header file. */
|
||||
#undef HAVE_SYS_PARAM_H
|
||||
|
||||
/* Define if you have the <sys/procfs.h> header file. */
|
||||
#undef HAVE_SYS_PROCFS_H
|
||||
|
||||
/* Define if you have the <sys/time.h> header file. */
|
||||
#undef HAVE_SYS_TIME_H
|
||||
|
||||
@ -89,3 +168,76 @@
|
||||
|
||||
/* Define if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define if you have the <values.h> header file. */
|
||||
#undef HAVE_VALUES_H
|
||||
|
||||
/* Name of package */
|
||||
#undef PACKAGE
|
||||
|
||||
/* Version number of package */
|
||||
#undef VERSION
|
||||
|
||||
/* Define if you have the stpcpy function */
|
||||
#undef HAVE_STPCPY
|
||||
|
||||
/* Define if your locale.h file contains LC_MESSAGES. */
|
||||
#undef HAVE_LC_MESSAGES
|
||||
|
||||
/* Define to 1 if NLS is requested */
|
||||
#undef ENABLE_NLS
|
||||
|
||||
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
|
||||
#undef HAVE_GETTEXT
|
||||
|
||||
/* Use b modifier when opening binary files? */
|
||||
#undef USE_BINARY_FOPEN
|
||||
|
||||
/* Define if strstr is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_STRSTR
|
||||
|
||||
/* Define if malloc is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_MALLOC
|
||||
|
||||
/* Define if realloc is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_REALLOC
|
||||
|
||||
/* Define if free is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_FREE
|
||||
|
||||
/* Define if getenv is not declared in system header files. */
|
||||
#undef NEED_DECLARATION_GETENV
|
||||
|
||||
/* Define if <sys/procfs.h> has prstatus_t. */
|
||||
#undef HAVE_PRSTATUS_T
|
||||
|
||||
/* Define if <sys/procfs.h> has prstatus_t.pr_who. */
|
||||
#undef HAVE_PRSTATUS_T_PR_WHO
|
||||
|
||||
/* Define if <sys/procfs.h> has pstatus_t. */
|
||||
#undef HAVE_PSTATUS_T
|
||||
|
||||
/* Define if <sys/procfs.h> has prpsinfo_t. */
|
||||
#undef HAVE_PRPSINFO_T
|
||||
|
||||
/* Define if <sys/procfs.h> has psinfo_t. */
|
||||
#undef HAVE_PSINFO_T
|
||||
|
||||
/* Define if <sys/procfs.h> has lwpstatus_t. */
|
||||
#undef HAVE_LWPSTATUS_T
|
||||
|
||||
/* Define if <sys/procfs.h> has lwpstatus_t.pr_context. */
|
||||
#undef HAVE_LWPSTATUS_T_PR_CONTEXT
|
||||
|
||||
/* Define if <sys/procfs.h> has lwpstatus_t.pr_reg. */
|
||||
#undef HAVE_LWPSTATUS_T_PR_REG
|
||||
|
||||
/* Define if <sys/procfs.h> has win32_pstatus_t. */
|
||||
#undef HAVE_WIN32_PSTATUS_T
|
||||
|
||||
/* Name of host specific header file to include in trad-core.c. */
|
||||
#undef TRAD_HEADER
|
||||
|
||||
/* Use mmap if it's available? */
|
||||
#undef USE_MMAP
|
||||
|
||||
|
4702
contrib/binutils/bfd/configure
vendored
4702
contrib/binutils/bfd/configure
vendored
File diff suppressed because it is too large
Load Diff
@ -23,6 +23,7 @@ alpha*-*-*) host64=true; HOST_64BIT_TYPE=long ;;
|
||||
|
||||
hppa*-*-hpux*) HDEFINES=-DHOST_HPPAHPUX ;;
|
||||
hppa*-*-hiux*) HDEFINES=-DHOST_HPPAHPUX ;;
|
||||
hppa*-*-mpeix*) HDEFINES=-DHOST_HPPAMPEIX ;;
|
||||
hppa*-*-bsd*) HDEFINES=-DHOST_HPPABSD ;;
|
||||
hppa*-*-osf*) HDEFINES=-DHOST_HPPAOSF ;;
|
||||
|
||||
@ -62,6 +63,8 @@ m68*-hp-hpux*) HDEFINES=-DHOST_HP300HPUX ;;
|
||||
ac_cv_func_getpagesize=no
|
||||
ac_cv_func_madvise=no
|
||||
ac_cv_func_mprotect=no
|
||||
ac_cv_func_getuid=no
|
||||
ac_cv_func_getgid=no
|
||||
ac_cv_header_sys_file_h=no
|
||||
ac_cv_header_sys_time_h=no
|
||||
ac_cv_header_unistd_h=no
|
||||
|
@ -1,13 +1,13 @@
|
||||
dnl Process this file with autoconf to produce a configure script.
|
||||
dnl
|
||||
|
||||
AC_PREREQ(2.5)
|
||||
AC_PREREQ(2.13)
|
||||
AC_INIT(libbfd.c)
|
||||
|
||||
AC_CANONICAL_SYSTEM
|
||||
AC_ISC_POSIX
|
||||
|
||||
AM_INIT_AUTOMAKE(bfd, 2.9.1)
|
||||
AM_INIT_AUTOMAKE(bfd, 2.9.5)
|
||||
|
||||
dnl These must be called before AM_PROG_LIBTOOL, because it may want
|
||||
dnl to call AC_CHECK_PROG.
|
||||
@ -58,8 +58,7 @@ fi
|
||||
AC_ARG_PROGRAM
|
||||
|
||||
AM_MAINTAINER_MODE
|
||||
AM_CYGWIN32
|
||||
AM_EXEEXT
|
||||
AC_EXEEXT
|
||||
|
||||
host64=false
|
||||
target64=false
|
||||
@ -68,11 +67,14 @@ target64=false
|
||||
|
||||
AC_PROG_CC
|
||||
|
||||
ALL_LINGUAS=
|
||||
CY_GNU_GETTEXT
|
||||
|
||||
# Permit host specific settings.
|
||||
. ${srcdir}/configure.host
|
||||
|
||||
AC_SUBST(HDEFINES)
|
||||
AM_PROG_INSTALL
|
||||
AC_PROG_INSTALL
|
||||
|
||||
BFD_HOST_64BIT_LONG=0
|
||||
BFD_HOST_64_BIT_DEFINED=0
|
||||
@ -95,7 +97,8 @@ BFD_CC_FOR_BUILD
|
||||
AC_CHECK_HEADERS(stddef.h string.h strings.h stdlib.h time.h unistd.h)
|
||||
AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h)
|
||||
AC_HEADER_TIME
|
||||
AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen)
|
||||
AC_HEADER_DIRENT
|
||||
AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid)
|
||||
|
||||
BFD_BINARY_FOPEN
|
||||
|
||||
@ -108,37 +111,44 @@ BFD_NEED_DECLARATION(getenv)
|
||||
# If we are configured native, pick a core file support file.
|
||||
COREFILE=
|
||||
COREFLAG=
|
||||
TRAD_HEADER=
|
||||
if test "${target}" = "${host}"; then
|
||||
case "${host}" in
|
||||
alpha*-*-linux-gnu*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/alphalinux.h")
|
||||
TRAD_HEADER='"hosts/alphalinux.h"'
|
||||
;;
|
||||
alpha*-*-netbsd*) COREFILE=netbsd-core.lo ;;
|
||||
alpha*-*-*) COREFILE=osf-core.lo ;;
|
||||
arm-*-riscix) COREFILE=trad-core.lo ;;
|
||||
hppa*-*-hpux*) COREFILE=hpux-core.lo ;;
|
||||
hppa*-*-hiux*) COREFILE=hpux-core.lo ;;
|
||||
hppa*-*-mpeix*) COREFILE=hpux-core.lo ;;
|
||||
hppa*-*-bsd*) COREFILE="hpux-core.lo hppabsd-core.lo"
|
||||
COREFLAG="-DHPUX_CORE -DHPPABSD_CORE" ;;
|
||||
i370-*-*)
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/i370linux.h"'
|
||||
;;
|
||||
|
||||
changequote(,)dnl
|
||||
i[3456]86-sequent-bsd*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.lo;
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/symmetry.h")
|
||||
COREFILE=trad-core.lo
|
||||
TRAD_HEADER='"hosts/symmetry.h"'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-sequent-sysv4*) ;;
|
||||
i[3456]86-sequent-sysv*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/symmetry.h")
|
||||
TRAD_HEADER='"hosts/symmetry.h"'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-*-bsd* | i[3456]86-*-freebsd*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/i386bsd.h")
|
||||
TRAD_HEADER='"hosts/i386bsd.h"'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-*-netbsd* | i[3456]86-*-openbsd*)
|
||||
@ -149,25 +159,30 @@ changequote(,)dnl
|
||||
i[3456]86-esix-sysv3*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/esix.h")
|
||||
TRAD_HEADER='"hosts/esix.h"'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-*-sco3.2v5*)
|
||||
changequote([,])dnl
|
||||
COREFILE=sco5-core.lo
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-*-sco* | i[3456]86-*-isc*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/i386sco.h")
|
||||
TRAD_HEADER='"hosts/i386sco.h"'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-*-mach3*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/i386mach3.h")
|
||||
TRAD_HEADER='"hosts/i386mach3.h"'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-*-linux-gnu*)
|
||||
changequote([,])dnl
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/i386linux.h")
|
||||
TRAD_HEADER='"hosts/i386linux.h"'
|
||||
;;
|
||||
changequote(,)dnl
|
||||
i[3456]86-*-isc*) COREFILE=trad-core.lo ;;
|
||||
@ -175,76 +190,76 @@ changequote(,)dnl
|
||||
changequote([,])dnl
|
||||
i860-*-mach3* | i860-*-osf1*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/i860mach3.h")
|
||||
TRAD_HEADER='"hosts/i860mach3.h"'
|
||||
;;
|
||||
mips-dec-bsd*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/mipsbsd.h")
|
||||
TRAD_HEADER='"hosts/mipsbsd.h"'
|
||||
;;
|
||||
mips-dec-mach3*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/mipsmach3.h")
|
||||
TRAD_HEADER='"hosts/mipsmach3.h"'
|
||||
;;
|
||||
mips-*-netbsd* | mips*-*-openbsd*)
|
||||
COREFILE=netbsd-core.lo
|
||||
;;
|
||||
mips-dec-*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/decstation.h")
|
||||
TRAD_HEADER='"hosts/decstation.h"'
|
||||
;;
|
||||
mips-sgi-irix4*) COREFILE=irix-core.lo ;;
|
||||
mips-sgi-irix5*) COREFILE=irix-core.lo ;;
|
||||
mips-sgi-irix6*) COREFILE=irix-core.lo ;;
|
||||
mips-*-mach3*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/mipsmach3.h")
|
||||
TRAD_HEADER='"hosts/mipsmach3.h"'
|
||||
;;
|
||||
mips-*-sysv4*) ;;
|
||||
mips-*-sysv* | mips-*-riscos*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/riscos.h")
|
||||
TRAD_HEADER='"hosts/riscos.h"'
|
||||
;;
|
||||
mips-sony-bsd*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/news-mips.h")
|
||||
TRAD_HEADER='"hosts/news-mips.h"'
|
||||
;;
|
||||
m68*-bull*-sysv*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/dpx2.h")
|
||||
TRAD_HEADER='"hosts/dpx2.h"'
|
||||
;;
|
||||
m68*-hp-hpux*) COREFILE=hpux-core.lo ;;
|
||||
m68*-hp-bsd*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/hp300bsd.h")
|
||||
TRAD_HEADER='"hosts/hp300bsd.h"'
|
||||
;;
|
||||
m68*-*-linux-gnu*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/m68klinux.h")
|
||||
TRAD_HEADER='"hosts/m68klinux.h"'
|
||||
;;
|
||||
m68*-motorola-sysv*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER, "hosts/delta68.h")
|
||||
TRAD_HEADER='"hosts/delta68.h"'
|
||||
;;
|
||||
m68*-sony-*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/news.h")
|
||||
TRAD_HEADER='"hosts/news.h"'
|
||||
;;
|
||||
m68*-*-netbsd* | m68*-*-openbsd*)
|
||||
COREFILE=netbsd-core.lo
|
||||
;;
|
||||
m68*-apple-aux*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/m68kaux.h")
|
||||
TRAD_HEADER='"hosts/m68kaux.h"'
|
||||
;;
|
||||
m88*-*-sysv4*) ;;
|
||||
m88*-motorola-sysv*) COREFILE=ptrace-core.lo ;;
|
||||
m88*-*-mach3*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/m88kmach3.h")
|
||||
TRAD_HEADER='"hosts/m88kmach3.h"'
|
||||
;;
|
||||
ns32k-pc532-mach)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/pc532mach.h")
|
||||
TRAD_HEADER='"hosts/pc532mach.h"'
|
||||
;;
|
||||
ns32k-*-netbsd* | ns32k-*-openbsd*)
|
||||
COREFILE=netbsd-core.lo
|
||||
@ -262,19 +277,19 @@ changequote([,])dnl
|
||||
;;
|
||||
tahoe-*-*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/tahoe.h")
|
||||
TRAD_HEADER='"hosts/tahoe.h"'
|
||||
;;
|
||||
vax-*-ultrix2*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/vaxult2.h")
|
||||
TRAD_HEADER='"hosts/vaxult2.h"'
|
||||
;;
|
||||
vax-*-ultrix*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/vaxult2.h")
|
||||
TRAD_HEADER='"hosts/vaxult2.h"'
|
||||
;;
|
||||
vax-*-*)
|
||||
COREFILE=trad-core.lo
|
||||
AC_DEFINE(TRAD_HEADER,"hosts/vaxbsd.h")
|
||||
TRAD_HEADER='"hosts/vaxbsd.h"'
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -288,25 +303,43 @@ changequote([,])dnl
|
||||
osf-core.lo) COREFLAG=-DOSF_CORE ;;
|
||||
ptrace-core.lo) COREFLAG=-DPTRACE_CORE ;;
|
||||
rs6000-core.lo) COREFLAG="$COREFLAG -DAIX_CORE" ;;
|
||||
sco5-core.lo) COREFLAG="$COREFLAG -DSCO5_CORE" ;;
|
||||
trad-core.lo) COREFLAG="$COREFLAG -DTRAD_CORE" ;;
|
||||
esac
|
||||
|
||||
# The ELF code uses the native <sys/procfs.h> to handle core files.
|
||||
# Define HAVE_SYS_PROCFS_H if the file exists and defines
|
||||
# prstatus_t.
|
||||
AC_MSG_CHECKING([for sys/procfs.h])
|
||||
AC_CACHE_VAL(bfd_cv_header_sys_procfs_h,
|
||||
[AC_TRY_COMPILE([#include <sys/procfs.h>],
|
||||
[prstatus_t t;],
|
||||
bfd_cv_header_sys_procfs_h=yes, bfd_cv_header_sys_procfs_h=no)])
|
||||
AC_MSG_RESULT($bfd_cv_header_sys_procfs_h)
|
||||
if test $bfd_cv_header_sys_procfs_h = yes; then
|
||||
AC_DEFINE(HAVE_SYS_PROCFS_H)
|
||||
# ELF corefile support has several flavors, but all of
|
||||
# them use something called <sys/procfs.h>
|
||||
AC_CHECK_HEADERS(sys/procfs.h)
|
||||
if test "$ac_cv_header_sys_procfs_h" = yes; then
|
||||
BFD_HAVE_SYS_PROCFS_TYPE(prstatus_t)
|
||||
BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(prstatus_t, pr_who)
|
||||
BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t)
|
||||
BFD_HAVE_SYS_PROCFS_TYPE(prpsinfo_t)
|
||||
BFD_HAVE_SYS_PROCFS_TYPE(psinfo_t)
|
||||
BFD_HAVE_SYS_PROCFS_TYPE(lwpstatus_t)
|
||||
BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_context)
|
||||
BFD_HAVE_SYS_PROCFS_TYPE_MEMBER(lwpstatus_t, pr_reg)
|
||||
BFD_HAVE_SYS_PROCFS_TYPE(win32_pstatus_t)
|
||||
fi
|
||||
|
||||
fi
|
||||
AC_SUBST(COREFILE)
|
||||
AC_SUBST(COREFLAG)
|
||||
AC_DEFINE_UNQUOTED(TRAD_HEADER, $TRAD_HEADER,
|
||||
[Name of host specific header file to include in trad-core.c.])
|
||||
|
||||
# Horrible hacks to build DLLs on Windows.
|
||||
WIN32LDFLAGS=
|
||||
WIN32LIBADD=
|
||||
case "${host}" in
|
||||
*-*-cygwin*)
|
||||
if test "$enable_shared" = "yes"; then
|
||||
WIN32LDFLAGS="-no-undefined"
|
||||
WIN32LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
AC_SUBST(WIN32LDFLAGS)
|
||||
AC_SUBST(WIN32LIBADD)
|
||||
|
||||
# target stuff:
|
||||
|
||||
@ -314,7 +347,7 @@ AC_SUBST(COREFLAG)
|
||||
if test -n "$enable_targets" ; then
|
||||
for targ in `echo $enable_targets | sed 's/,/ /g'`
|
||||
do
|
||||
result=`${CONFIG_SHELL-/bin/sh} $ac_config_sub $targ 2>/dev/null`
|
||||
result=`$ac_config_sub $targ 2>/dev/null`
|
||||
if test -n "$result" ; then
|
||||
canon_targets="$canon_targets $result"
|
||||
else
|
||||
@ -349,7 +382,7 @@ AC_SUBST(TDEFINES)
|
||||
# 64-bit support needs to be compiled in. Currently, it will be included if
|
||||
# the default or any other explicitly requested target requires it; it
|
||||
# will not be included on a 32-bit host if no 64-bit target is requested, and
|
||||
# no "--with-64-bit-bfd" option is given, even if "--with-targets=all" is
|
||||
# no "--with-64-bit-bfd" option is given, even if "--enable-targets=all" is
|
||||
# used.
|
||||
|
||||
# uniq the default and selected vectors in all the configured targets.
|
||||
@ -376,7 +409,7 @@ selarchs="$f"
|
||||
# Target backend .o files.
|
||||
tb=
|
||||
|
||||
elf="elf.lo elflink.lo dwarf2.lo"
|
||||
elf="elf.lo elflink.lo dwarf2.lo dwarf1.lo"
|
||||
|
||||
for vec in $selvecs
|
||||
do
|
||||
@ -387,10 +420,15 @@ do
|
||||
a_out_adobe_vec) tb="$tb aout-adobe.lo aout32.lo" ;;
|
||||
armcoff_little_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
|
||||
armcoff_big_vec) tb="$tb coff-arm.lo cofflink.lo " ;;
|
||||
armpe_little_vec) tb="$tb pe-arm.lo coff-arm.lo cofflink.lo " ;;
|
||||
armpe_big_vec) tb="$tb pe-arm.lo coff-arm.lo cofflink.lo " ;;
|
||||
armpei_little_vec) tb="$tb pei-arm.lo cofflink.lo " ;;
|
||||
armpei_big_vec) tb="$tb pei-arm.lo cofflink.lo " ;;
|
||||
armnetbsd_vec) tb="$tb armnetbsd.lo aout32.lo" ;;
|
||||
armpe_little_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;;
|
||||
armpe_big_vec) tb="$tb pe-arm.lo peigen.lo cofflink.lo " ;;
|
||||
armpei_little_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
|
||||
armpei_big_vec) tb="$tb pei-arm.lo peigen.lo cofflink.lo " ;;
|
||||
arm_epoc_pe_little_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
|
||||
arm_epoc_pe_big_vec) tb="$tb epoc-pe-arm.lo peigen.lo cofflink.lo " ;;
|
||||
arm_epoc_pei_little_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
|
||||
arm_epoc_pei_big_vec) tb="$tb epoc-pei-arm.lo peigen.lo cofflink.lo " ;;
|
||||
aout0_big_vec) tb="$tb aout0.lo aout32.lo" ;;
|
||||
aout_arm_big_vec) tb="$tb aout-arm.lo aout32.lo" ;;
|
||||
aout_arm_little_vec) tb="$tb aout-arm.lo aout32.lo" ;;
|
||||
@ -401,16 +439,25 @@ do
|
||||
b_out_vec_little_host) tb="$tb bout.lo aout32.lo" ;;
|
||||
bfd_elf64_alpha_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"
|
||||
target64=true ;;
|
||||
bfd_elf32_avr_vec) tb="$tb elf32-avr.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_littlearc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_littlearm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_littlearm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_bigarc_vec) tb="$tb elf32-arc.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_bigarm_vec) tb="$tb elfarm-nabi.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_bigarm_oabi_vec) tb="$tb elfarm-oabi.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_big_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_bigmips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
|
||||
bfd_elf64_bigmips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"
|
||||
target64=true ;;
|
||||
bfd_elf32_d10v_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_d30v_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_fr30_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_hppa_vec) tb="$tb elf32-hppa.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i370_vec) tb="$tb elf32-i370.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i386_vec) tb="$tb elf32-i386.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i860_vec) tb="$tb elf32-i860.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_i960_vec) tb="$tb elf32-i960.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_little_generic_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_littlemips_vec) tb="$tb elf32-mips.lo elf32.lo $elf ecofflink.lo" ;;
|
||||
bfd_elf64_littlemips_vec) tb="$tb elf64-mips.lo elf64.lo elf32-mips.lo elf32.lo $elf ecofflink.lo"
|
||||
@ -418,8 +465,12 @@ do
|
||||
bfd_elf32_m32r_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_m68k_vec) tb="$tb elf32-m68k.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_m88k_vec) tb="$tb elf32-m88k.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_mcore_big_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_mcore_little_vec) tb="$tb elf32-mcore.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_mn10200_vec) tb="$tb elf-m10200.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_mn10300_vec) tb="$tb elf-m10300.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
|
||||
bfd_elf32_pjl_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
|
||||
bfd_elf32_powerpc_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_powerpcle_vec) tb="$tb elf32-ppc.lo elf32.lo $elf" ;;
|
||||
bfd_elf32_sh_vec) tb="$tb elf32-sh.lo elf32.lo $elf coff-sh.lo" ;;
|
||||
@ -432,7 +483,8 @@ do
|
||||
target64=true ;;
|
||||
bfd_elf64_sparc_vec) tb="$tb elf64-sparc.lo elf64.lo $elf"
|
||||
target64=true ;;
|
||||
cisco_core_vec) tb="$tb cisco-core.lo" ;;
|
||||
cisco_core_big_vec) tb="$tb cisco-core.lo" ;;
|
||||
cisco_core_little_vec) tb="$tb cisco-core.lo" ;;
|
||||
demo_64_vec) tb="$tb demo64.lo aout64.lo"
|
||||
target64=true ;;
|
||||
ecoff_big_vec) tb="$tb coff-mips.lo ecoff.lo ecofflink.lo" ;;
|
||||
@ -442,8 +494,6 @@ do
|
||||
target64=true ;;
|
||||
go32coff_vec) tb="$tb coff-go32.lo cofflink.lo" ;;
|
||||
go32stubbedcoff_vec) tb="$tb coff-stgo32.lo cofflink.lo" ;;
|
||||
evax_alpha_vec) tb="$tb evax-alpha.lo evax-emh.lo evax-egsd.lo evax-etir.lo evax-misc.lo"
|
||||
target64=true ;;
|
||||
h8300coff_vec) tb="$tb coff-h8300.lo reloc16.lo" ;;
|
||||
h8500coff_vec) tb="$tb coff-h8500.lo reloc16.lo" ;;
|
||||
host_aout_vec) tb="$tb host-aout.lo aout32.lo" ;;
|
||||
@ -455,8 +505,8 @@ do
|
||||
i386dynix_vec) tb="$tb i386dynix.lo aout32.lo" ;;
|
||||
i386freebsd_vec) tb="$tb i386freebsd.lo aout32.lo" ;;
|
||||
i386msdos_vec) tb="$tb i386msdos.lo" ;;
|
||||
i386pe_vec) tb="$tb pe-i386.lo cofflink.lo " ;;
|
||||
i386pei_vec) tb="$tb pei-i386.lo cofflink.lo" ;;
|
||||
i386pe_vec) tb="$tb pe-i386.lo peigen.lo cofflink.lo" ;;
|
||||
i386pei_vec) tb="$tb pei-i386.lo peigen.lo cofflink.lo" ;;
|
||||
i386linux_vec) tb="$tb i386linux.lo aout32.lo" ;;
|
||||
i386lynx_aout_vec) tb="$tb i386lynx.lo lynx-core.lo aout32.lo" ;;
|
||||
i386lynx_coff_vec) tb="$tb cf-i386lynx.lo cofflink.lo lynx-core.lo" ;;
|
||||
@ -477,6 +527,12 @@ do
|
||||
m68kaux_coff_vec) tb="$tb coff-aux.lo coff-m68k.lo cofflink.lo" ;;
|
||||
m68ksysvcoff_vec) tb="$tb coff-svm68k.lo cofflink.lo" ;;
|
||||
m88kbcs_vec) tb="$tb coff-m88k.lo" ;;
|
||||
mipslpe_vec) tb="$tb pe-mips.lo cofflink.lo" ;;
|
||||
mipslpei_vec) tb="$tb pei-mips.lo cofflink.lo" ;;
|
||||
mcore_pe_big_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
|
||||
mcore_pe_little_vec) tb="$tb pe-mcore.lo peigen.lo cofflink.lo" ;;
|
||||
mcore_pei_big_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
|
||||
mcore_pei_little_vec) tb="$tb pei-mcore.lo peigen.lo cofflink.lo" ;;
|
||||
newsos3_vec) tb="$tb newsos3.lo aout32.lo" ;;
|
||||
nlm32_i386_vec) tb="$tb nlm32-i386.lo nlm32.lo nlm.lo" ;;
|
||||
nlm32_sparc_vec) tb="$tb nlm32-sparc.lo nlm32.lo nlm.lo" ;;
|
||||
@ -488,15 +544,17 @@ do
|
||||
pc532machaout_vec) tb="$tb pc532-mach.lo aout-ns32k.lo" ;;
|
||||
pmac_xcoff_vec) tb="$tb coff-pmac.lo xcofflink.lo" ;;
|
||||
rs6000coff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
|
||||
bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo cofflink.lo" ;;
|
||||
bfd_powerpcle_pe_vec) tb="$tb pe-ppc.lo cofflink.lo" ;;
|
||||
bfd_powerpc_pei_vec) tb="$tb pei-ppc.lo cofflink.lo" ;;
|
||||
bfd_powerpcle_pei_vec) tb="$tb pei-ppc.lo cofflink.lo" ;;
|
||||
bfd_powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;
|
||||
bfd_powerpcle_pe_vec) tb="$tb pe-ppc.lo peigen.lo cofflink.lo" ;;
|
||||
bfd_powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
|
||||
bfd_powerpcle_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
|
||||
ppcboot_vec) tb="$tb ppcboot.lo" ;;
|
||||
shcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
|
||||
shlcoff_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
|
||||
shcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
|
||||
shlcoff_small_vec) tb="$tb coff-sh.lo cofflink.lo" ;;
|
||||
shlpe_vec) tb="$tb pe-sh.lo coff-sh.lo cofflink.lo" ;;
|
||||
shlpei_vec) tb="$tb pei-sh.lo coff-sh.lo cofflink.lo" ;;
|
||||
som_vec) tb="$tb som.lo" ;;
|
||||
sparcle_aout_vec) tb="$tb aout-sparcle.lo aout32.lo" ;;
|
||||
sparclinux_vec) tb="$tb sparclinux.lo aout32.lo" ;;
|
||||
@ -510,10 +568,14 @@ do
|
||||
tekhex_vec) tb="$tb tekhex.lo" ;;
|
||||
tic30_aout_vec) tb="$tb aout-tic30.lo" ;;
|
||||
tic30_coff_vec) tb="$tb coff-tic30.lo" ;;
|
||||
tic80coff_vec) tb="$tb coff-tic80.lo cofflink.lo" ;;
|
||||
versados_vec) tb="$tb versados.lo" ;;
|
||||
vms_alpha_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo"
|
||||
target64=true ;;
|
||||
vms_vax_vec) tb="$tb vms.lo vms-hdr.lo vms-gsd.lo vms-tir.lo vms-misc.lo" ;;
|
||||
w65_vec) tb="$tb coff-w65.lo reloc16.lo" ;;
|
||||
we32kcoff_vec) tb="$tb coff-we32k.lo" ;;
|
||||
z8kcoff_vec) tb="$tb coff-z8k.lo reloc16.lo" ;;
|
||||
w65_vec) tb="$tb coff-w65.lo reloc16.lo" ;;
|
||||
versados_vec) tb="$tb versados.lo" ;;
|
||||
|
||||
"") ;;
|
||||
*) AC_MSG_ERROR(*** unknown target vector $vec) ;;
|
||||
@ -595,8 +657,9 @@ dnl AC_CHECK_HEADERS(sys/mman.h)
|
||||
AC_FUNC_MMAP
|
||||
AC_CHECK_FUNCS(madvise mprotect)
|
||||
case ${want_mmap}+${ac_cv_func_mmap_fixed_mapped} in
|
||||
true+yes ) AC_DEFINE(USE_MMAP) ;;
|
||||
true+yes ) AC_DEFINE(USE_MMAP, 1, [Use mmap if it's available?]) ;;
|
||||
esac
|
||||
|
||||
rm -f doc/config.status
|
||||
AC_OUTPUT(Makefile doc/Makefile bfd-in3.h:bfd-in2.h)
|
||||
AC_OUTPUT(Makefile doc/Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in,
|
||||
[sed -e '/POTFILES =/r po/POTFILES' po/Makefile.in > po/Makefile])
|
||||
|
@ -21,18 +21,31 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
#define N(BITS_WORD, BITS_ADDR, NUMBER, PRINT, DEFAULT, NEXT) \
|
||||
{ \
|
||||
BITS_WORD, /* bits in a word */ \
|
||||
BITS_ADDR, /* bits in an address */ \
|
||||
8, /* 8 bits in a byte */ \
|
||||
bfd_arch_alpha, \
|
||||
NUMBER, \
|
||||
"alpha", \
|
||||
PRINT, \
|
||||
3, \
|
||||
DEFAULT, \
|
||||
bfd_default_compatible, \
|
||||
bfd_default_scan, \
|
||||
NEXT, \
|
||||
}
|
||||
|
||||
#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[] =
|
||||
{
|
||||
N (64, 64, bfd_mach_alpha_ev4, "alpha:ev4", false, NN(1)),
|
||||
N (64, 64, bfd_mach_alpha_ev5, "alpha:ev5", false, NN(2)),
|
||||
N (64, 64, bfd_mach_alpha_ev6, "alpha:ev6", false, 0),
|
||||
};
|
||||
|
||||
const bfd_arch_info_type bfd_alpha_arch =
|
||||
{
|
||||
64, /* 32 bits in a word */
|
||||
64, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_alpha,
|
||||
0, /* only 1 machine */
|
||||
"alpha",
|
||||
"alpha",
|
||||
3,
|
||||
true, /* the one and only */
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan ,
|
||||
0,
|
||||
};
|
||||
N (64, 64, 0, "alpha", true, NN(0));
|
||||
|
143
contrib/binutils/bfd/cpu-arm.c
Normal file
143
contrib/binutils/bfd/cpu-arm.c
Normal file
@ -0,0 +1,143 @@
|
||||
/* BFD support for the ARM processor
|
||||
Copyright 1994, 95, 97, 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
|
||||
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"
|
||||
|
||||
static const bfd_arch_info_type *compatible
|
||||
PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
|
||||
static boolean scan PARAMS ((const struct bfd_arch_info *, const char *));
|
||||
|
||||
/* This routine is provided two arch_infos and works out which ARM
|
||||
machine which would be compatible with both and returns a pointer
|
||||
to its info structure */
|
||||
|
||||
static const bfd_arch_info_type *
|
||||
compatible (a,b)
|
||||
const bfd_arch_info_type * a;
|
||||
const bfd_arch_info_type * b;
|
||||
{
|
||||
/* If a & b are for different architecture we can do nothing */
|
||||
if (a->arch != b->arch)
|
||||
return NULL;
|
||||
|
||||
/* If a & b are for the same machine then all is well */
|
||||
if (a->mach == b->mach)
|
||||
return a;
|
||||
|
||||
/* Otherwise if either a or b is the 'default' machine then
|
||||
it can be polymorphed into the other */
|
||||
if (a->the_default)
|
||||
return b;
|
||||
|
||||
if (b->the_default)
|
||||
return a;
|
||||
|
||||
/* So far all newer ARM architecture cores are supersets of previous cores */
|
||||
if (a->mach < b->mach)
|
||||
return b;
|
||||
else if (a->mach > b->mach)
|
||||
return a;
|
||||
|
||||
/* Never reached! */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct
|
||||
{
|
||||
enum bfd_architecture arch;
|
||||
char * name;
|
||||
}
|
||||
processors[] =
|
||||
{
|
||||
{ bfd_mach_arm_2, "arm2" },
|
||||
{ bfd_mach_arm_2a, "arm250" },
|
||||
{ bfd_mach_arm_2a, "arm3" },
|
||||
{ bfd_mach_arm_3, "arm6" },
|
||||
{ bfd_mach_arm_3, "arm60" },
|
||||
{ bfd_mach_arm_3, "arm600" },
|
||||
{ bfd_mach_arm_3, "arm610" },
|
||||
{ bfd_mach_arm_3, "arm7" },
|
||||
{ bfd_mach_arm_3, "arm710" },
|
||||
{ bfd_mach_arm_3, "arm7500" },
|
||||
{ bfd_mach_arm_3, "arm7d" },
|
||||
{ bfd_mach_arm_3, "arm7di" },
|
||||
{ bfd_mach_arm_3M, "arm7dm" },
|
||||
{ bfd_mach_arm_3M, "arm7dmi" },
|
||||
{ bfd_mach_arm_4T, "arm7tdmi" },
|
||||
{ bfd_mach_arm_4, "arm8" },
|
||||
{ bfd_mach_arm_4, "arm810" },
|
||||
{ bfd_mach_arm_4, "arm9" },
|
||||
{ bfd_mach_arm_4, "arm920" },
|
||||
{ bfd_mach_arm_4T, "arm920t" },
|
||||
{ bfd_mach_arm_4T, "arm9tdmi" },
|
||||
{ bfd_mach_arm_4, "sa1" },
|
||||
{ bfd_mach_arm_4, "strongarm"},
|
||||
{ bfd_mach_arm_4, "strongarm110" },
|
||||
{ bfd_mach_arm_4, "strongarm1100" },
|
||||
};
|
||||
|
||||
static boolean
|
||||
scan (info, string)
|
||||
const struct bfd_arch_info * info;
|
||||
const char * string;
|
||||
{
|
||||
int i;
|
||||
|
||||
/* First test for an exact match */
|
||||
if (strcasecmp (string, info->printable_name) == 0)
|
||||
return true;
|
||||
|
||||
/* Next check for a processor name instead of an Architecture name */
|
||||
for (i = sizeof (processors) / sizeof (processors[0]); i--;)
|
||||
{
|
||||
if (strcasecmp (string, processors[ i ].name) == 0)
|
||||
break;
|
||||
}
|
||||
|
||||
if (i != -1 && info->arch == processors[ i ].arch)
|
||||
return true;
|
||||
|
||||
/* 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] ),
|
||||
N( bfd_mach_arm_3M, "armv3m", false, & arch_info_struct[4] ),
|
||||
N( bfd_mach_arm_4, "armv4", false, & arch_info_struct[5] ),
|
||||
N( bfd_mach_arm_4T, "armv4t", false, & arch_info_struct[6] ),
|
||||
N( bfd_mach_arm_5, "armv5", false, & arch_info_struct[7] ),
|
||||
N( bfd_mach_arm_5T, "armv5t", false, NULL )
|
||||
};
|
||||
|
||||
const bfd_arch_info_type bfd_arm_arch =
|
||||
N( 0, "arm", true, & arch_info_struct[0] );
|
@ -21,6 +21,21 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
const bfd_arch_info_type bfd_i386_arch_intel_syntax =
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_i386,
|
||||
bfd_mach_i386_i386_intel_syntax,
|
||||
"i386:intel",
|
||||
"i386:intel",
|
||||
3,
|
||||
true,
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan ,
|
||||
0,
|
||||
};
|
||||
static const bfd_arch_info_type i8086_arch =
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
@ -34,7 +49,7 @@ static const bfd_arch_info_type i8086_arch =
|
||||
false,
|
||||
bfd_default_compatible,
|
||||
bfd_default_scan ,
|
||||
0,
|
||||
&bfd_i386_arch_intel_syntax,
|
||||
};
|
||||
|
||||
const bfd_arch_info_type bfd_i386_arch =
|
||||
@ -52,3 +67,4 @@ const bfd_arch_info_type bfd_i386_arch =
|
||||
bfd_default_scan ,
|
||||
&i8086_arch,
|
||||
};
|
||||
|
||||
|
@ -44,6 +44,7 @@ I_mips3900,
|
||||
I_mips4000,
|
||||
I_mips4010,
|
||||
I_mips4100,
|
||||
I_mips4111,
|
||||
I_mips4300,
|
||||
I_mips4400,
|
||||
I_mips4600,
|
||||
@ -65,6 +66,7 @@ static const bfd_arch_info_type arch_info_struct[] =
|
||||
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)),
|
||||
|
124
contrib/binutils/bfd/cpu-powerpc.c
Normal file
124
contrib/binutils/bfd/cpu-powerpc.c
Normal file
@ -0,0 +1,124 @@
|
||||
/* BFD PowerPC CPU definition
|
||||
Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
|
||||
Contributed by Ian Lance Taylor, 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. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
/* The common PowerPC architecture is compatible with the RS/6000. */
|
||||
|
||||
static const bfd_arch_info_type *powerpc_compatible
|
||||
PARAMS ((const bfd_arch_info_type *, const bfd_arch_info_type *));
|
||||
|
||||
static const bfd_arch_info_type *
|
||||
powerpc_compatible (a,b)
|
||||
const bfd_arch_info_type *a;
|
||||
const bfd_arch_info_type *b;
|
||||
{
|
||||
BFD_ASSERT (a->arch == bfd_arch_powerpc);
|
||||
switch (b->arch)
|
||||
{
|
||||
default:
|
||||
return NULL;
|
||||
case bfd_arch_powerpc:
|
||||
return bfd_default_compatible (a, b);
|
||||
case bfd_arch_rs6000:
|
||||
if (a->mach == 0)
|
||||
return a;
|
||||
return NULL;
|
||||
}
|
||||
/*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_powerpc,
|
||||
603, /* for the mpc603 */
|
||||
"powerpc",
|
||||
"powerpc:603",
|
||||
3,
|
||||
false, /* not the default */
|
||||
powerpc_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_powerpc,
|
||||
604, /* for the mpc604 */
|
||||
"powerpc",
|
||||
"powerpc:604",
|
||||
3,
|
||||
false, /* not the default */
|
||||
powerpc_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_powerpc,
|
||||
403, /* for the 403 */
|
||||
"powerpc",
|
||||
"powerpc:403",
|
||||
3,
|
||||
false, /* not the default */
|
||||
powerpc_compatible,
|
||||
bfd_default_scan,
|
||||
&arch_info_struct[3]
|
||||
},
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_powerpc,
|
||||
601, /* for the mpc601 */
|
||||
"powerpc",
|
||||
"powerpc:601",
|
||||
3,
|
||||
false, /* not the default */
|
||||
powerpc_compatible,
|
||||
bfd_default_scan,
|
||||
0
|
||||
}
|
||||
};
|
||||
|
||||
const bfd_arch_info_type bfd_powerpc_arch =
|
||||
{
|
||||
32, /* 32 bits in a word */
|
||||
32, /* 32 bits in an address */
|
||||
8, /* 8 bits in a byte */
|
||||
bfd_arch_powerpc,
|
||||
0, /* for the POWER/PowerPC common architecture */
|
||||
"powerpc",
|
||||
"powerpc:common",
|
||||
3,
|
||||
true, /* the default */
|
||||
powerpc_compatible,
|
||||
bfd_default_scan,
|
||||
&arch_info_struct[0]
|
||||
};
|
@ -95,6 +95,20 @@ static const bfd_arch_info_type arch_info_struct[] =
|
||||
bfd_default_scan,
|
||||
&arch_info_struct[4],
|
||||
},
|
||||
{
|
||||
32, /* bits in a word */
|
||||
32, /* bits in an address */
|
||||
8, /* bits in a byte */
|
||||
bfd_arch_sparc,
|
||||
bfd_mach_sparc_sparclite_le,
|
||||
"sparc",
|
||||
"sparc:sparclite_le",
|
||||
3,
|
||||
false,
|
||||
sparc_compatible,
|
||||
bfd_default_scan,
|
||||
&arch_info_struct[5],
|
||||
},
|
||||
{
|
||||
64, /* bits in a word */
|
||||
64, /* bits in an address */
|
||||
@ -107,7 +121,7 @@ static const bfd_arch_info_type arch_info_struct[] =
|
||||
false,
|
||||
sparc_compatible,
|
||||
bfd_default_scan,
|
||||
&arch_info_struct[5],
|
||||
&arch_info_struct[6],
|
||||
},
|
||||
{
|
||||
64, /* bits in a word */
|
||||
|
@ -69,7 +69,8 @@ scan (info, string)
|
||||
|
||||
switch (number)
|
||||
{
|
||||
|
||||
case bfd_mach_v850e: arch = bfd_arch_v850; break;
|
||||
case bfd_mach_v850ea: arch = bfd_arch_v850; break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@ -89,6 +90,14 @@ scan (info, string)
|
||||
|
||||
#define NEXT NULL
|
||||
|
||||
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)
|
||||
};
|
||||
|
||||
#undef NEXT
|
||||
#define NEXT &arch_info_struct[0]
|
||||
|
||||
const bfd_arch_info_type bfd_v850_arch =
|
||||
N (bfd_mach_v850, "v850", true, NEXT);
|
||||
|
@ -7,7 +7,7 @@ s!\.o:!.lo:!
|
||||
s! @BFD_H@!!g
|
||||
s!@INCDIR@!$(INCDIR)!g
|
||||
s!@SRCDIR@/!!g
|
||||
s!hosts/[^ ]*\.h ! !g
|
||||
s! hosts/[^ ]*\.h! !g
|
||||
s/ sysdep.h//g
|
||||
s! \.\./bfd/sysdep.h!!g
|
||||
s/ libbfd.h//g
|
||||
|
@ -1,3 +1,36 @@
|
||||
2000-04-30 Ben Elliston <bje@redhat.com>
|
||||
|
||||
* bfdint.texi (BFD generated files): Fix another typo.
|
||||
|
||||
2000-04-17 Ben Elliston <bje@redhat.com>
|
||||
|
||||
* bfdint.texi (BFD_JUMP_TABLE macros): Fix typo.
|
||||
|
||||
Thu Feb 4 23:21:36 1999 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* Makefile.in: Rebuild with current autoconf/automake.
|
||||
|
||||
Thu Jul 23 09:36:44 1998 Nick Clifton <nickc@cygnus.com>
|
||||
|
||||
* bfdint.texi (BFD ELF processor required): Add paragraph
|
||||
describing the necessity to create "include/elf/CPU.h".
|
||||
|
||||
Thu May 7 14:45:43 1998 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* Makefile.am (chew.o): Add -I options for intl srcdir and
|
||||
objdir.
|
||||
* Makefile.in: Rebuild.
|
||||
|
||||
Mon Apr 27 20:19:24 1998 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* bfdint.texi: New file.
|
||||
* Makefile.am (noinst_TEXINFOS): New variable.
|
||||
* Makefile.in: Rebuild.
|
||||
|
||||
Mon Apr 13 16:48:56 1998 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* Makefile.in: Rebuild.
|
||||
|
||||
Mon Apr 6 14:06:55 1998 Ian Lance Taylor <ian@cygnus.com>
|
||||
|
||||
* Makefile.am (STAGESTUFF): Remove variable.
|
||||
|
@ -51,7 +51,7 @@ $(MKDOC): chew.o
|
||||
$(CC_FOR_BUILD) -o $(MKDOC) chew.o $(LOADLIBES) $(LDFLAGS)
|
||||
|
||||
chew.o: chew.c
|
||||
$(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
|
||||
$(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
|
||||
|
||||
protos: libbfd.h libcoff.h bfd.h
|
||||
|
||||
@ -239,6 +239,8 @@ bfd.h: $(srcdir)/../bfd-in.h \
|
||||
echo "#endif" >>bfd.h
|
||||
echo "#endif" >>bfd.h
|
||||
|
||||
noinst_TEXINFOS = bfdint.texi
|
||||
|
||||
MOSTLYCLEANFILES = $(MKDOC) *.o
|
||||
|
||||
CLEANFILES = s-* *.p *.ip
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Makefile.in generated automatically by automake 1.2e from Makefile.am
|
||||
# Makefile.in generated automatically by automake 1.4 from Makefile.am
|
||||
|
||||
# Copyright (C) 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
|
||||
# This Makefile.in is free software; the Free Software Foundation
|
||||
# gives unlimited permission to copy and/or distribute it,
|
||||
# with or without modifications, as long as this notice is preserved.
|
||||
@ -32,6 +32,8 @@ mandir = @mandir@
|
||||
includedir = @includedir@
|
||||
oldincludedir = /usr/include
|
||||
|
||||
DESTDIR =
|
||||
|
||||
pkgdatadir = $(datadir)/@PACKAGE@
|
||||
pkglibdir = $(libdir)/@PACKAGE@
|
||||
pkgincludedir = $(includedir)/@PACKAGE@
|
||||
@ -44,7 +46,7 @@ AUTOMAKE = @AUTOMAKE@
|
||||
AUTOHEADER = @AUTOHEADER@
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS)
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
||||
transform = @program_transform_name@
|
||||
@ -62,30 +64,52 @@ host_triplet = @host@
|
||||
target_alias = @target_alias@
|
||||
target_triplet = @target@
|
||||
AR = @AR@
|
||||
AS = @AS@
|
||||
BFD_HOST_64BIT_LONG = @BFD_HOST_64BIT_LONG@
|
||||
BFD_HOST_64_BIT = @BFD_HOST_64_BIT@
|
||||
BFD_HOST_64_BIT_DEFINED = @BFD_HOST_64_BIT_DEFINED@
|
||||
BFD_HOST_U_64_BIT = @BFD_HOST_U_64_BIT@
|
||||
CATALOGS = @CATALOGS@
|
||||
CATOBJEXT = @CATOBJEXT@
|
||||
CC = @CC@
|
||||
CC_FOR_BUILD = @CC_FOR_BUILD@
|
||||
COREFILE = @COREFILE@
|
||||
COREFLAG = @COREFLAG@
|
||||
DATADIRNAME = @DATADIRNAME@
|
||||
DLLTOOL = @DLLTOOL@
|
||||
EXEEXT = @EXEEXT@
|
||||
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
|
||||
GMOFILES = @GMOFILES@
|
||||
GMSGFMT = @GMSGFMT@
|
||||
GT_NO = @GT_NO@
|
||||
GT_YES = @GT_YES@
|
||||
HDEFINES = @HDEFINES@
|
||||
LD = @LD@
|
||||
INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@
|
||||
INSTOBJEXT = @INSTOBJEXT@
|
||||
INTLDEPS = @INTLDEPS@
|
||||
INTLLIBS = @INTLLIBS@
|
||||
INTLOBJS = @INTLOBJS@
|
||||
LIBTOOL = @LIBTOOL@
|
||||
LN_S = @LN_S@
|
||||
MAINT = @MAINT@
|
||||
MAKEINFO = @MAKEINFO@
|
||||
NM = @NM@
|
||||
MKINSTALLDIRS = @MKINSTALLDIRS@
|
||||
MSGFMT = @MSGFMT@
|
||||
OBJDUMP = @OBJDUMP@
|
||||
PACKAGE = @PACKAGE@
|
||||
POFILES = @POFILES@
|
||||
POSUB = @POSUB@
|
||||
RANLIB = @RANLIB@
|
||||
TDEFINES = @TDEFINES@
|
||||
USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@
|
||||
USE_NLS = @USE_NLS@
|
||||
VERSION = @VERSION@
|
||||
WIN32LDFLAGS = @WIN32LDFLAGS@
|
||||
WIN32LIBADD = @WIN32LIBADD@
|
||||
all_backends = @all_backends@
|
||||
bfd_backends = @bfd_backends@
|
||||
bfd_machines = @bfd_machines@
|
||||
l = @l@
|
||||
tdefaults = @tdefaults@
|
||||
wordsize = @wordsize@
|
||||
|
||||
@ -97,12 +121,14 @@ DOCFILES = aoutx.texi archive.texi archures.texi \
|
||||
opncls.texi reloc.texi section.texi \
|
||||
syms.texi targets.texi init.texi hash.texi linker.texi
|
||||
|
||||
|
||||
PROTOS = archive.p archures.p bfd.p \
|
||||
core.p format.p \
|
||||
libbfd.p opncls.p reloc.p \
|
||||
section.p syms.p targets.p \
|
||||
format.p core.p init.p
|
||||
|
||||
|
||||
IPROTOS = cache.ip libbfd.ip reloc.ip init.ip archures.ip coffcode.ip
|
||||
|
||||
# SRCDOC, SRCPROT, SRCIPROT only used to sidestep Sun Make bug in interaction
|
||||
@ -118,6 +144,7 @@ SRCDOC = $(srcdir)/../aoutx.h $(srcdir)/../archive.c \
|
||||
$(srcdir)/../syms.c $(srcdir)/../targets.c \
|
||||
$(srcdir)/../hash.c $(srcdir)/../linker.c
|
||||
|
||||
|
||||
SRCPROT = $(srcdir)/../archive.c $(srcdir)/../archures.c \
|
||||
$(srcdir)/../bfd.c $(srcdir)/../coffcode.h $(srcdir)/../corefile.c \
|
||||
$(srcdir)/../format.c $(srcdir)/../libbfd.c \
|
||||
@ -125,17 +152,21 @@ SRCPROT = $(srcdir)/../archive.c $(srcdir)/../archures.c \
|
||||
$(srcdir)/../section.c $(srcdir)/../syms.c \
|
||||
$(srcdir)/../targets.c $(srcdir)/../init.c
|
||||
|
||||
|
||||
SRCIPROT = $(srcdir)/../cache.c $(srcdir)/../libbfd.c \
|
||||
$(srcdir)/../reloc.c $(srcdir)/../cpu-h8300.c \
|
||||
$(srcdir)/../cpu-i960.c $(srcdir)/../archures.c \
|
||||
$(srcdir)/../init.c
|
||||
|
||||
|
||||
TEXIDIR = $(srcdir)/../../texinfo/fsf
|
||||
|
||||
info_TEXINFOS = bfd.texinfo
|
||||
|
||||
MKDOC = chew$(EXEEXT_FOR_BUILD)
|
||||
|
||||
noinst_TEXINFOS = bfdint.texi
|
||||
|
||||
MOSTLYCLEANFILES = $(MKDOC) *.o
|
||||
|
||||
CLEANFILES = s-* *.p *.ip
|
||||
@ -157,15 +188,14 @@ DIST_COMMON = ChangeLog Makefile.am Makefile.in
|
||||
DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
|
||||
|
||||
TAR = tar
|
||||
GZIP = --best
|
||||
default: all
|
||||
|
||||
GZIP_ENV = --best
|
||||
all: all-redirect
|
||||
.SUFFIXES:
|
||||
.SUFFIXES: .dvi .info .ps .texi .texinfo
|
||||
$(srcdir)/Makefile.in: @MAINT@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
.SUFFIXES: .dvi .info .ps .texi .texinfo .txi
|
||||
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4)
|
||||
cd $(top_srcdir) && $(AUTOMAKE) --cygnus doc/Makefile
|
||||
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
|
||||
cd $(top_builddir) \
|
||||
&& CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status
|
||||
|
||||
@ -181,7 +211,7 @@ DVIPS = dvips
|
||||
$(MAKEINFO) -I $(srcdir) $<
|
||||
|
||||
.texi.dvi:
|
||||
TEXINPUTS=$(top_srcdir)/../texinfo:$$TEXINPUTS \
|
||||
TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.texi:
|
||||
@ -197,28 +227,42 @@ DVIPS = dvips
|
||||
$(MAKEINFO) -I $(srcdir) $<
|
||||
|
||||
.texinfo.dvi:
|
||||
TEXINPUTS=$(top_srcdir)/../texinfo:$$TEXINPUTS \
|
||||
TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.txi.info:
|
||||
@rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
$(MAKEINFO) -I $(srcdir) $<
|
||||
|
||||
.txi.dvi:
|
||||
TEXINPUTS=$(top_srcdir)/../texinfo/texinfo.tex:$$TEXINPUTS \
|
||||
MAKEINFO='$(MAKEINFO) -I $(srcdir)' $(TEXI2DVI) $<
|
||||
|
||||
.txi:
|
||||
@rm -f $@ $@-[0-9] $@-[0-9][0-9]
|
||||
$(MAKEINFO) -I $(srcdir) $<
|
||||
.dvi.ps:
|
||||
$(DVIPS) $< -o $@
|
||||
|
||||
install-info-am: $(INFO_DEPS)
|
||||
@$(NORMAL_INSTALL)
|
||||
$(mkinstalldirs) $(infodir)
|
||||
@for file in $(INFO_DEPS); do \
|
||||
$(mkinstalldirs) $(DESTDIR)$(infodir)
|
||||
@list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
for ifile in `cd $$d && echo $$file $$file-[0-9] $$file-[0-9][0-9]`; do \
|
||||
if test -f $$d/$$ifile; then \
|
||||
echo " $(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile"; \
|
||||
$(INSTALL_DATA) $$d/$$ifile $(infodir)/$$ifile; \
|
||||
echo " $(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile"; \
|
||||
$(INSTALL_DATA) $$d/$$ifile $(DESTDIR)$(infodir)/$$ifile; \
|
||||
else : ; fi; \
|
||||
done; \
|
||||
done
|
||||
@$(POST_INSTALL)
|
||||
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
|
||||
for file in $(INFO_DEPS); do \
|
||||
echo " install-info --info-dir=$(infodir) $(infodir)/$$file";\
|
||||
install-info --info-dir=$(infodir) $(infodir)/$$file || :;\
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
echo " install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file";\
|
||||
install-info --info-dir=$(DESTDIR)$(infodir) $(DESTDIR)$(infodir)/$$file || :;\
|
||||
done; \
|
||||
else : ; fi
|
||||
|
||||
@ -227,17 +271,20 @@ uninstall-info:
|
||||
@if $(SHELL) -c 'install-info --version | sed 1q | fgrep -s -v -i debian' >/dev/null 2>&1; then \
|
||||
ii=yes; \
|
||||
else ii=; fi; \
|
||||
for file in $(INFO_DEPS); do \
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
test -z "$ii" \
|
||||
|| install-info --info-dir=$(infodir) --remove $$file; \
|
||||
|| install-info --info-dir=$(DESTDIR)$(infodir) --remove $$file; \
|
||||
done
|
||||
$(NORMAL_UNINSTALL)
|
||||
for file in $(INFO_DEPS); do \
|
||||
(cd $(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
|
||||
@$(NORMAL_UNINSTALL)
|
||||
list='$(INFO_DEPS)'; \
|
||||
for file in $$list; do \
|
||||
(cd $(DESTDIR)$(infodir) && rm -f $$file $$file-[0-9] $$file-[0-9][0-9]); \
|
||||
done
|
||||
|
||||
dist-info: $(INFO_DEPS)
|
||||
for base in $(INFO_DEPS); do \
|
||||
list='$(INFO_DEPS)'; \
|
||||
for base in $$list; do \
|
||||
if test -f $$base; then d=.; else d=$(srcdir); fi; \
|
||||
for file in `cd $$d && eval echo $$base*`; do \
|
||||
test -f $(distdir)/$$file \
|
||||
@ -274,32 +321,40 @@ subdir = doc
|
||||
distdir: $(DISTFILES)
|
||||
@for file in $(DISTFILES); do \
|
||||
if test -f $$file; then d=.; else d=$(srcdir); fi; \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file; \
|
||||
if test -d $$d/$$file; then \
|
||||
cp -pr $$d/$$file $(distdir)/$$file; \
|
||||
else \
|
||||
test -f $(distdir)/$$file \
|
||||
|| ln $$d/$$file $(distdir)/$$file 2> /dev/null \
|
||||
|| cp -p $$d/$$file $(distdir)/$$file || :; \
|
||||
fi; \
|
||||
done
|
||||
$(MAKE) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
|
||||
info: $(INFO_DEPS)
|
||||
dvi: $(DVIS)
|
||||
check:
|
||||
$(MAKE)
|
||||
installcheck:
|
||||
$(MAKE) $(AM_MAKEFLAGS) top_distdir="$(top_distdir)" distdir="$(distdir)" dist-info
|
||||
info-am: $(INFO_DEPS)
|
||||
info: info-am
|
||||
dvi-am: $(DVIS)
|
||||
dvi: dvi-am
|
||||
check-am:
|
||||
check: check-am
|
||||
installcheck-am:
|
||||
installcheck: installcheck-am
|
||||
install-info-am:
|
||||
install-info: install-info-am
|
||||
install-exec:
|
||||
@$(NORMAL_INSTALL)
|
||||
install-exec-am:
|
||||
install-exec: install-exec-am
|
||||
|
||||
install-data:
|
||||
@$(NORMAL_INSTALL)
|
||||
|
||||
install: install-exec install-data all
|
||||
@:
|
||||
|
||||
uninstall:
|
||||
|
||||
all: Makefile
|
||||
install-data-am:
|
||||
install-data: install-data-am
|
||||
|
||||
install-am: all-am
|
||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
||||
install: install-am
|
||||
uninstall-am:
|
||||
uninstall: uninstall-am
|
||||
all-am: Makefile
|
||||
all-redirect: all-am
|
||||
install-strip:
|
||||
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' INSTALL_SCRIPT='$(INSTALL_PROGRAM)' install
|
||||
$(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install
|
||||
installdirs:
|
||||
|
||||
|
||||
@ -310,39 +365,47 @@ clean-generic:
|
||||
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
|
||||
|
||||
distclean-generic:
|
||||
-rm -f Makefile $(DISTCLEANFILES)
|
||||
-rm -f Makefile $(CONFIG_CLEAN_FILES)
|
||||
-rm -f config.cache config.log stamp-h stamp-h[0-9]*
|
||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
||||
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
|
||||
|
||||
maintainer-clean-generic:
|
||||
-test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
|
||||
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
|
||||
mostlyclean: mostlyclean-aminfo mostlyclean-generic
|
||||
mostlyclean-am: mostlyclean-aminfo mostlyclean-generic
|
||||
|
||||
clean: clean-aminfo clean-generic mostlyclean
|
||||
mostlyclean: mostlyclean-am
|
||||
|
||||
distclean: distclean-aminfo distclean-generic clean
|
||||
-rm -f config.status
|
||||
clean-am: clean-aminfo clean-generic mostlyclean-am
|
||||
|
||||
clean: clean-am
|
||||
|
||||
distclean-am: distclean-aminfo distclean-generic clean-am
|
||||
-rm -f libtool
|
||||
|
||||
maintainer-clean: maintainer-clean-aminfo maintainer-clean-generic \
|
||||
distclean
|
||||
distclean: distclean-am
|
||||
|
||||
maintainer-clean-am: maintainer-clean-aminfo maintainer-clean-generic \
|
||||
distclean-am
|
||||
@echo "This command is intended for maintainers to use;"
|
||||
@echo "it deletes files that may require special tools to rebuild."
|
||||
|
||||
.PHONY: default install-info-am uninstall-info mostlyclean-aminfo \
|
||||
distclean-aminfo clean-aminfo maintainer-clean-aminfo tags distdir info \
|
||||
dvi installcheck install-info install-exec install-data install \
|
||||
uninstall all installdirs mostlyclean-generic distclean-generic \
|
||||
clean-generic maintainer-clean-generic clean mostlyclean distclean \
|
||||
maintainer-clean
|
||||
maintainer-clean: maintainer-clean-am
|
||||
|
||||
.PHONY: install-info-am uninstall-info mostlyclean-aminfo \
|
||||
distclean-aminfo clean-aminfo maintainer-clean-aminfo tags distdir \
|
||||
info-am info dvi-am dvi check check-am installcheck-am installcheck \
|
||||
install-info-am install-info install-exec-am install-exec \
|
||||
install-data-am install-data install-am install uninstall-am uninstall \
|
||||
all-redirect all-am all installdirs mostlyclean-generic \
|
||||
distclean-generic clean-generic maintainer-clean-generic clean \
|
||||
mostlyclean distclean maintainer-clean
|
||||
|
||||
|
||||
$(MKDOC): chew.o
|
||||
$(CC_FOR_BUILD) -o $(MKDOC) chew.o $(LOADLIBES) $(LDFLAGS)
|
||||
|
||||
chew.o: chew.c
|
||||
$(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
|
||||
$(CC_FOR_BUILD) -c -I.. -I$(srcdir)/.. -I$(srcdir)/../../include -I$(srcdir)/../../intl -I../../intl $(H_CFLAGS) $(CFLAGS) $(srcdir)/chew.c
|
||||
|
||||
protos: libbfd.h libcoff.h bfd.h
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
\input texinfo.tex
|
||||
@setfilename bfd.info
|
||||
@c $Id: bfd.texinfo,v 1.29 1997/07/22 18:47:29 ian Exp $
|
||||
@c $Id: bfd.texinfo,v 1.1.1.1 1999/05/03 07:28:58 rth Exp $
|
||||
@tex
|
||||
% NOTE LOCAL KLUGE TO AVOID TOO MUCH WHITESPACE
|
||||
\global\long\def\example{%
|
||||
@ -67,7 +67,7 @@ into another language, under the above conditions for modified versions.
|
||||
|
||||
@tex
|
||||
\def\$#1${{#1}} % Kluge: collect RCS revision info without $...$
|
||||
\xdef\manvers{\$Revision: 1.29 $} % For use in headers, footers too
|
||||
\xdef\manvers{\$Revision: 1.1.1.1 $} % For use in headers, footers too
|
||||
{\parskip=0pt
|
||||
\hfill Cygnus Support\par
|
||||
\hfill sac\@cygnus.com\par
|
||||
|
1885
contrib/binutils/bfd/doc/bfdint.texi
Normal file
1885
contrib/binutils/bfd/doc/bfdint.texi
Normal file
File diff suppressed because it is too large
Load Diff
578
contrib/binutils/bfd/dwarf1.c
Normal file
578
contrib/binutils/bfd/dwarf1.c
Normal file
@ -0,0 +1,578 @@
|
||||
/* DWARF 1 find nearest line (_bfd_dwarf1_find_nearest_line).
|
||||
Copyright 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
Written by Gavin Romig-Koch of Cygnus Solutions (gavin@cygnus.com).
|
||||
|
||||
This file is part of BFD.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or (at
|
||||
your option) any later version.
|
||||
|
||||
This program is 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 "libiberty.h"
|
||||
#include "libbfd.h"
|
||||
#include "elf-bfd.h"
|
||||
#include "elf/dwarf.h"
|
||||
|
||||
/* dwarf1_debug is the starting point for all dwarf1 info. */
|
||||
|
||||
struct dwarf1_debug {
|
||||
|
||||
/* The bfd we are working with. */
|
||||
bfd* abfd;
|
||||
|
||||
/* List of already parsed compilation units. */
|
||||
struct dwarf1_unit* lastUnit;
|
||||
|
||||
/* The buffer for the .debug section.
|
||||
Zero indicates that the .debug section failed to load. */
|
||||
char* debug_section;
|
||||
|
||||
/* Pointer to the end of the .debug_info section memory buffer. */
|
||||
char* debug_section_end;
|
||||
|
||||
/* The buffer for the .line section. */
|
||||
char* line_section;
|
||||
|
||||
/* End of that buffer. */
|
||||
char* line_section_end;
|
||||
|
||||
/* The current or next unread die within the .debug section. */
|
||||
char* currentDie;
|
||||
};
|
||||
|
||||
/* One dwarf1_unit for each parsed compilation unit die. */
|
||||
|
||||
struct dwarf1_unit {
|
||||
/* Linked starting from stash->lastUnit. */
|
||||
struct dwarf1_unit* prev;
|
||||
|
||||
/* Name of the compilation unit. */
|
||||
char* name;
|
||||
|
||||
/* The highest and lowest address used in the compilation unit. */
|
||||
unsigned long low_pc;
|
||||
unsigned long high_pc;
|
||||
|
||||
/* Does this unit have a statement list? */
|
||||
int has_stmt_list;
|
||||
|
||||
/* If any, the offset of the line number table in the .line section. */
|
||||
unsigned long stmt_list_offset;
|
||||
|
||||
/* If non-zero, a pointer to the first child of this unit. */
|
||||
char* first_child;
|
||||
|
||||
/* How many line entries? */
|
||||
unsigned long line_count;
|
||||
|
||||
/* The decoded line number table (line_count entries). */
|
||||
struct linenumber* linenumber_table;
|
||||
|
||||
/* The list of functions in this unit. */
|
||||
struct dwarf1_func* func_list;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* One dwarf1_func for each parsed function die. */
|
||||
|
||||
struct dwarf1_func {
|
||||
/* Linked starting from aUnit->func_list. */
|
||||
struct dwarf1_func* prev;
|
||||
|
||||
/* Name of function. */
|
||||
char* name;
|
||||
|
||||
/* The highest and lowest address used in the compilation unit. */
|
||||
unsigned long low_pc;
|
||||
unsigned long high_pc;
|
||||
};
|
||||
|
||||
|
||||
/* Used to return info about a parsed die. */
|
||||
struct die_info {
|
||||
unsigned long length;
|
||||
unsigned long sibling;
|
||||
unsigned long low_pc;
|
||||
unsigned long high_pc;
|
||||
unsigned long stmt_list_offset;
|
||||
|
||||
char* name;
|
||||
|
||||
int has_stmt_list;
|
||||
|
||||
unsigned short tag;
|
||||
};
|
||||
|
||||
|
||||
/* Parsed line number information. */
|
||||
struct linenumber {
|
||||
/* First address in the line. */
|
||||
unsigned long addr;
|
||||
|
||||
/* The line number. */
|
||||
unsigned long linenumber;
|
||||
};
|
||||
|
||||
|
||||
/* Find the form of an attr, from the attr field. */
|
||||
#define FORM_FROM_ATTR(attr) ((attr) & 0xF) /* Implicitly specified */
|
||||
|
||||
|
||||
/* Return a newly allocated dwarf1_unit. It should be cleared and
|
||||
then attached into the 'stash' at 'stash->lastUnit'. */
|
||||
|
||||
static struct dwarf1_unit*
|
||||
alloc_dwarf1_unit (stash)
|
||||
struct dwarf1_debug* stash;
|
||||
{
|
||||
struct dwarf1_unit* x =
|
||||
(struct dwarf1_unit*) bfd_zalloc (stash->abfd,
|
||||
sizeof (struct dwarf1_unit));
|
||||
x->prev = stash->lastUnit;
|
||||
stash->lastUnit = x;
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
/* Return a newly allocated dwarf1_func. It must be cleared and
|
||||
attached into 'aUnit' at 'aUnit->func_list'. */
|
||||
|
||||
static struct dwarf1_func*
|
||||
alloc_dwarf1_func (stash, aUnit)
|
||||
struct dwarf1_debug* stash;
|
||||
struct dwarf1_unit* aUnit;
|
||||
{
|
||||
struct dwarf1_func* x =
|
||||
(struct dwarf1_func*) bfd_zalloc (stash->abfd,
|
||||
sizeof (struct dwarf1_func));
|
||||
x->prev = aUnit->func_list;
|
||||
aUnit->func_list = x;
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
/* parse_die - parse a Dwarf1 die.
|
||||
Parse the die starting at 'aDiePtr' into 'aDieInfo'.
|
||||
'abfd' must be the bfd from which the section that 'aDiePtr'
|
||||
points to was pulled from.
|
||||
|
||||
Return false if the die is invalidly formatted; true otherwise. */
|
||||
|
||||
static boolean
|
||||
parse_die (abfd, aDieInfo, aDiePtr)
|
||||
bfd* abfd;
|
||||
struct die_info* aDieInfo;
|
||||
char* aDiePtr;
|
||||
{
|
||||
char* this_die = aDiePtr;
|
||||
char* xptr = this_die;
|
||||
|
||||
memset (aDieInfo,0,sizeof(*aDieInfo));
|
||||
|
||||
/* First comes the length. */
|
||||
aDieInfo->length = bfd_get_32 (abfd, xptr);
|
||||
xptr += 4;
|
||||
if (aDieInfo->length == 0)
|
||||
return false;
|
||||
if (aDieInfo->length < 6)
|
||||
{
|
||||
/* Just padding bytes. */
|
||||
aDieInfo->tag = TAG_padding;
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Then the tag. */
|
||||
aDieInfo->tag = bfd_get_16 (abfd, xptr);
|
||||
xptr += 2;
|
||||
|
||||
/* Then the attributes. */
|
||||
while (xptr < (this_die + aDieInfo->length))
|
||||
{
|
||||
unsigned short attr;
|
||||
|
||||
/* Parse the attribute based on its form. This section
|
||||
must handle all dwarf1 forms, but need only handle the
|
||||
actual attributes that we care about. */
|
||||
|
||||
attr = bfd_get_16 (abfd, xptr);
|
||||
xptr += 2;
|
||||
|
||||
switch (FORM_FROM_ATTR (attr))
|
||||
{
|
||||
case FORM_DATA2:
|
||||
xptr += 2;
|
||||
break;
|
||||
case FORM_DATA4:
|
||||
case FORM_REF:
|
||||
if (attr == AT_sibling)
|
||||
aDieInfo->sibling = bfd_get_32 (abfd, xptr);
|
||||
else if (attr == AT_stmt_list)
|
||||
{
|
||||
aDieInfo->stmt_list_offset = bfd_get_32 (abfd, xptr);
|
||||
aDieInfo->has_stmt_list = 1;
|
||||
}
|
||||
xptr += 4;
|
||||
break;
|
||||
case FORM_DATA8:
|
||||
xptr += 8;
|
||||
break;
|
||||
case FORM_ADDR:
|
||||
if (attr == AT_low_pc)
|
||||
aDieInfo->low_pc = bfd_get_32 (abfd, xptr);
|
||||
else if (attr == AT_high_pc)
|
||||
aDieInfo->high_pc = bfd_get_32 (abfd, xptr);
|
||||
xptr += 4;
|
||||
break;
|
||||
case FORM_BLOCK2:
|
||||
xptr += 2 + bfd_get_16 (abfd, xptr);
|
||||
break;
|
||||
case FORM_BLOCK4:
|
||||
xptr += 4 + bfd_get_32 (abfd, xptr);
|
||||
break;
|
||||
case FORM_STRING:
|
||||
if (attr == AT_name)
|
||||
aDieInfo->name = xptr;
|
||||
xptr += strlen (xptr) + 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Parse a dwarf1 line number table for 'aUnit->stmt_list_offset'
|
||||
into 'aUnit->linenumber_table'. Return false if an error
|
||||
occurs; true otherwise. */
|
||||
|
||||
static boolean
|
||||
parse_line_table (stash, aUnit)
|
||||
struct dwarf1_debug* stash;
|
||||
struct dwarf1_unit* aUnit;
|
||||
{
|
||||
char* xptr;
|
||||
|
||||
/* Load the ".line" section from the bfd if we haven't already. */
|
||||
if (stash->line_section == 0)
|
||||
{
|
||||
asection *msec;
|
||||
unsigned long size;
|
||||
|
||||
msec = bfd_get_section_by_name (stash->abfd, ".line");
|
||||
if (! msec)
|
||||
return false;
|
||||
|
||||
size = bfd_get_section_size_before_reloc (msec);
|
||||
stash->line_section = (unsigned char*) bfd_alloc (stash->abfd, size);
|
||||
|
||||
if (! stash->line_section)
|
||||
return false;
|
||||
|
||||
if (! bfd_get_section_contents (stash->abfd, msec, stash->line_section, 0, size))
|
||||
{
|
||||
stash->line_section = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
stash->line_section_end = stash->line_section + size;
|
||||
}
|
||||
|
||||
xptr = stash->line_section + aUnit->stmt_list_offset;
|
||||
if (xptr < stash->line_section_end)
|
||||
{
|
||||
unsigned long eachLine;
|
||||
|
||||
char* tblend;
|
||||
unsigned long base;
|
||||
|
||||
/* First comes the length. */
|
||||
tblend = bfd_get_32 (stash->abfd, xptr) + xptr;
|
||||
xptr += 4;
|
||||
|
||||
/* Then the base address for each address in the table. */
|
||||
base = bfd_get_32 (stash->abfd, xptr);
|
||||
xptr += 4;
|
||||
|
||||
/* How many line entrys?
|
||||
10 = 4 (line number) + 2 (pos in line) + 4 (address in line) */
|
||||
aUnit->line_count = (tblend - xptr) / 10;
|
||||
|
||||
/* Allocate an array for the entries. */
|
||||
aUnit->linenumber_table = (struct linenumber*)
|
||||
bfd_alloc (stash->abfd,
|
||||
sizeof (struct linenumber) * aUnit->line_count);
|
||||
|
||||
for (eachLine = 0; eachLine < aUnit->line_count; eachLine++)
|
||||
{
|
||||
/* A line number. */
|
||||
aUnit->linenumber_table[eachLine].linenumber
|
||||
= bfd_get_32 (stash->abfd, xptr);
|
||||
xptr += 4;
|
||||
|
||||
/* Skip the position within the line. */
|
||||
xptr += 2;
|
||||
|
||||
/* And finally the address. */
|
||||
aUnit->linenumber_table[eachLine].addr
|
||||
= base + bfd_get_32 (stash->abfd, xptr);
|
||||
xptr += 4;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Parse each function die in a compilation unit 'aUnit'.
|
||||
The first child die of 'aUnit' should be in 'aUnit->first_child',
|
||||
the result is placed in 'aUnit->func_list'.
|
||||
Return false if error; true otherwise. */
|
||||
|
||||
static boolean
|
||||
parse_functions_in_unit (stash, aUnit)
|
||||
struct dwarf1_debug* stash;
|
||||
struct dwarf1_unit* aUnit;
|
||||
{
|
||||
char* eachDie;
|
||||
|
||||
if (aUnit->first_child)
|
||||
for (eachDie = aUnit->first_child;
|
||||
eachDie < stash->debug_section_end;
|
||||
)
|
||||
{
|
||||
struct die_info eachDieInfo;
|
||||
|
||||
if (! parse_die (stash->abfd, &eachDieInfo, eachDie))
|
||||
return false;
|
||||
|
||||
if (eachDieInfo.tag == TAG_global_subroutine
|
||||
|| eachDieInfo.tag == TAG_subroutine
|
||||
|| eachDieInfo.tag == TAG_inlined_subroutine
|
||||
|| eachDieInfo.tag == TAG_entry_point)
|
||||
{
|
||||
struct dwarf1_func* aFunc = alloc_dwarf1_func (stash,aUnit);
|
||||
|
||||
aFunc->name = eachDieInfo.name;
|
||||
aFunc->low_pc = eachDieInfo.low_pc;
|
||||
aFunc->high_pc = eachDieInfo.high_pc;
|
||||
}
|
||||
|
||||
/* Move to next sibling, if none, end loop */
|
||||
if (eachDieInfo.sibling)
|
||||
eachDie = stash->debug_section + eachDieInfo.sibling;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Find the nearest line to 'addr' in 'aUnit'.
|
||||
Return whether we found the line (or a function) without error. */
|
||||
|
||||
static boolean
|
||||
dwarf1_unit_find_nearest_line (stash, aUnit, addr,
|
||||
filename_ptr, functionname_ptr,
|
||||
linenumber_ptr)
|
||||
struct dwarf1_debug* stash;
|
||||
struct dwarf1_unit* aUnit;
|
||||
unsigned long addr;
|
||||
const char **filename_ptr;
|
||||
const char **functionname_ptr;
|
||||
unsigned int *linenumber_ptr;
|
||||
{
|
||||
int line_p = false;
|
||||
int func_p = false;
|
||||
|
||||
if (aUnit->low_pc <= addr && addr < aUnit->high_pc)
|
||||
{
|
||||
if (aUnit->has_stmt_list)
|
||||
{
|
||||
unsigned long i;
|
||||
struct dwarf1_func* eachFunc;
|
||||
|
||||
if (! aUnit->linenumber_table)
|
||||
{
|
||||
if (! parse_line_table (stash, aUnit))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! aUnit->func_list)
|
||||
{
|
||||
if (! parse_functions_in_unit (stash, aUnit))
|
||||
return false;
|
||||
}
|
||||
|
||||
for (i = 0; i < aUnit->line_count; i++)
|
||||
{
|
||||
if (aUnit->linenumber_table[i].addr <= addr
|
||||
&& addr < aUnit->linenumber_table[i+1].addr)
|
||||
{
|
||||
*filename_ptr = aUnit->name;
|
||||
*linenumber_ptr = aUnit->linenumber_table[i].linenumber;
|
||||
line_p = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
for (eachFunc = aUnit->func_list;
|
||||
eachFunc;
|
||||
eachFunc = eachFunc->prev)
|
||||
{
|
||||
if (eachFunc->low_pc <= addr
|
||||
&& addr < eachFunc->high_pc)
|
||||
{
|
||||
*functionname_ptr = eachFunc->name;
|
||||
func_p = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return line_p || func_p;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* The DWARF 1 version of find_nearest line.
|
||||
Return true if the line is found without error. */
|
||||
|
||||
boolean
|
||||
_bfd_dwarf1_find_nearest_line (abfd, section, symbols, offset,
|
||||
filename_ptr, functionname_ptr, linenumber_ptr)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
asymbol **symbols ATTRIBUTE_UNUSED;
|
||||
bfd_vma offset;
|
||||
const char **filename_ptr;
|
||||
const char **functionname_ptr;
|
||||
unsigned int *linenumber_ptr;
|
||||
{
|
||||
struct dwarf1_debug *stash = elf_tdata (abfd)->dwarf1_find_line_info;
|
||||
|
||||
struct dwarf1_unit* eachUnit;
|
||||
|
||||
/* What address are we looking for? */
|
||||
bfd_vma addr = offset + section->vma;
|
||||
|
||||
*filename_ptr = NULL;
|
||||
*functionname_ptr = NULL;
|
||||
*linenumber_ptr = 0;
|
||||
|
||||
|
||||
if (! stash)
|
||||
{
|
||||
asection *msec;
|
||||
unsigned long size;
|
||||
|
||||
stash = elf_tdata (abfd)->dwarf1_find_line_info =
|
||||
(struct dwarf1_debug*) bfd_zalloc (abfd, sizeof (struct dwarf1_debug));
|
||||
|
||||
if (! stash)
|
||||
return false;
|
||||
|
||||
msec = bfd_get_section_by_name (abfd, ".debug");
|
||||
if (! msec)
|
||||
{
|
||||
/* No dwarf1 info. Note that at this point the stash
|
||||
has been allocated, but contains zeros, this lets
|
||||
future calls to this function fail quicker. */
|
||||
return false;
|
||||
}
|
||||
|
||||
size = bfd_get_section_size_before_reloc (msec);
|
||||
stash->debug_section = (unsigned char*) bfd_alloc (abfd, size);
|
||||
|
||||
if (! stash->debug_section)
|
||||
return false;
|
||||
|
||||
if (! bfd_get_section_contents (abfd, msec, stash->debug_section, 0, size))
|
||||
{
|
||||
stash->debug_section = 0;
|
||||
return false;
|
||||
}
|
||||
|
||||
stash->debug_section_end = stash->debug_section + size;
|
||||
stash->currentDie = stash->debug_section;
|
||||
stash->abfd = abfd;
|
||||
}
|
||||
|
||||
/* A null debug_section indicates that there was no dwarf1 info
|
||||
or that an error occured while setting up the stash. */
|
||||
|
||||
if (! stash->debug_section)
|
||||
return false;
|
||||
|
||||
|
||||
/* Look at the previously parsed units to see if any contain
|
||||
the addr. */
|
||||
for (eachUnit = stash->lastUnit; eachUnit; eachUnit = eachUnit->prev)
|
||||
{
|
||||
if (eachUnit->low_pc <= addr && addr < eachUnit->high_pc)
|
||||
return dwarf1_unit_find_nearest_line (stash, eachUnit, addr,
|
||||
filename_ptr,
|
||||
functionname_ptr,
|
||||
linenumber_ptr);
|
||||
}
|
||||
|
||||
while (stash->currentDie < stash->debug_section_end)
|
||||
{
|
||||
struct die_info aDieInfo;
|
||||
|
||||
if (! parse_die (stash->abfd, &aDieInfo, stash->currentDie))
|
||||
return false;
|
||||
|
||||
if (aDieInfo.tag == TAG_compile_unit)
|
||||
{
|
||||
struct dwarf1_unit* aUnit
|
||||
= alloc_dwarf1_unit (stash);
|
||||
|
||||
aUnit->name = aDieInfo.name;
|
||||
aUnit->low_pc = aDieInfo.low_pc;
|
||||
aUnit->high_pc = aDieInfo.high_pc;
|
||||
aUnit->has_stmt_list = aDieInfo.has_stmt_list;
|
||||
aUnit->stmt_list_offset = aDieInfo.stmt_list_offset;
|
||||
|
||||
/* A die has a child if it's followed by a die that is
|
||||
not it's sibling. */
|
||||
if (aDieInfo.sibling
|
||||
&& stash->currentDie + aDieInfo.length
|
||||
< stash->debug_section_end
|
||||
&& stash->currentDie + aDieInfo.length
|
||||
!= stash->debug_section + aDieInfo.sibling)
|
||||
aUnit->first_child = stash->currentDie + aDieInfo.length;
|
||||
else
|
||||
aUnit->first_child = 0;
|
||||
|
||||
if (aUnit->low_pc <= addr && addr < aUnit->high_pc)
|
||||
return dwarf1_unit_find_nearest_line (stash, aUnit, addr,
|
||||
filename_ptr,
|
||||
functionname_ptr,
|
||||
linenumber_ptr);
|
||||
}
|
||||
|
||||
if (aDieInfo.sibling != 0)
|
||||
stash->currentDie = stash->debug_section + aDieInfo.sibling;
|
||||
else
|
||||
stash->currentDie += aDieInfo.length;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
@ -1,5 +1,5 @@
|
||||
/* DWARF 2 support.
|
||||
Copyright 1994, 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright 1994, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
|
||||
|
||||
Adapted from gdb/dwarf2read.c by Gavin Koch of Cygnus Solutions
|
||||
(gavin@cygnus.com).
|
||||
@ -99,18 +99,78 @@ struct dwarf2_debug {
|
||||
|
||||
/* Length of the loaded .debug_abbrev section. */
|
||||
unsigned long dwarf_abbrev_size;
|
||||
|
||||
/* Buffer for decode_line_info. */
|
||||
char *dwarf_line_buffer;
|
||||
};
|
||||
|
||||
struct arange {
|
||||
struct arange *next;
|
||||
bfd_vma low;
|
||||
bfd_vma high;
|
||||
};
|
||||
|
||||
|
||||
/* VERBATUM
|
||||
The following function up to the END VERBATUM mark are
|
||||
/* A minimal decoding of DWARF2 compilation units. We only decode
|
||||
what's needed to get to the line number information. */
|
||||
|
||||
struct comp_unit {
|
||||
|
||||
/* Chain the previously read compilation units. */
|
||||
struct comp_unit* next_unit;
|
||||
|
||||
/* Keep the bdf convenient (for memory allocation). */
|
||||
bfd* abfd;
|
||||
|
||||
/* The lowest and higest addresses contained in this compilation
|
||||
unit as specified in the compilation unit header. */
|
||||
struct arange arange;
|
||||
|
||||
/* The DW_AT_name attribute (for error messages). */
|
||||
char* name;
|
||||
|
||||
/* The abbrev hash table. */
|
||||
struct abbrev_info** abbrevs;
|
||||
|
||||
/* Note that an error was found by comp_unit_find_nearest_line. */
|
||||
int error;
|
||||
|
||||
/* The DW_AT_comp_dir attribute */
|
||||
char* comp_dir;
|
||||
|
||||
/* True if there is a line number table associated with this comp. unit. */
|
||||
int stmtlist;
|
||||
|
||||
/* The offset into .debug_line of the line number table. */
|
||||
unsigned long line_offset;
|
||||
|
||||
/* Pointer to the first child die for the comp unit. */
|
||||
char *first_child_die_ptr;
|
||||
|
||||
/* The end of the comp unit. */
|
||||
char *end_ptr;
|
||||
|
||||
/* The decoded line number, NULL if not yet decoded. */
|
||||
struct line_info_table* line_table;
|
||||
|
||||
/* A list of the functions found in this comp. unit. */
|
||||
struct funcinfo* function_table;
|
||||
|
||||
/* Address size for this unit - from unit header */
|
||||
unsigned char addr_size;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* VERBATIM
|
||||
The following function up to the END VERBATIM mark are
|
||||
copied directly from dwarf2read.c. */
|
||||
|
||||
/* read dwarf information from a buffer */
|
||||
|
||||
static unsigned int
|
||||
read_1_byte (abfd, buf)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
char *buf;
|
||||
{
|
||||
return bfd_get_8 (abfd, (bfd_byte *) buf);
|
||||
@ -118,7 +178,7 @@ read_1_byte (abfd, buf)
|
||||
|
||||
static int
|
||||
read_1_signed_byte (abfd, buf)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
char *buf;
|
||||
{
|
||||
return bfd_get_signed_8 (abfd, (bfd_byte *) buf);
|
||||
@ -178,9 +238,9 @@ read_8_bytes (abfd, buf)
|
||||
|
||||
static char *
|
||||
read_n_bytes (abfd, buf, size)
|
||||
bfd * abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
char *buf;
|
||||
unsigned int size;
|
||||
unsigned int size ATTRIBUTE_UNUSED;
|
||||
{
|
||||
/* If the size of a host char is 8 bits, we can return a pointer
|
||||
to the buffer, otherwise we have to copy the data to a buffer
|
||||
@ -190,7 +250,7 @@ read_n_bytes (abfd, buf, size)
|
||||
|
||||
static char *
|
||||
read_string (abfd, buf, bytes_read_ptr)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
char *buf;
|
||||
unsigned int *bytes_read_ptr;
|
||||
{
|
||||
@ -208,86 +268,85 @@ read_string (abfd, buf, bytes_read_ptr)
|
||||
|
||||
static unsigned int
|
||||
read_unsigned_leb128 (abfd, buf, bytes_read_ptr)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
char *buf;
|
||||
unsigned int *bytes_read_ptr;
|
||||
{
|
||||
unsigned int result, num_read;
|
||||
int i, shift;
|
||||
unsigned int result;
|
||||
unsigned int num_read;
|
||||
int shift;
|
||||
unsigned char byte;
|
||||
|
||||
result = 0;
|
||||
shift = 0;
|
||||
result = 0;
|
||||
shift = 0;
|
||||
num_read = 0;
|
||||
i = 0;
|
||||
while (1)
|
||||
|
||||
do
|
||||
{
|
||||
byte = bfd_get_8 (abfd, (bfd_byte *) buf);
|
||||
buf++;
|
||||
num_read++;
|
||||
result |= ((byte & 127) << shift);
|
||||
if ((byte & 128) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
buf ++;
|
||||
num_read ++;
|
||||
result |= ((byte & 0x7f) << shift);
|
||||
shift += 7;
|
||||
}
|
||||
*bytes_read_ptr = num_read;
|
||||
while (byte & 0x80);
|
||||
|
||||
* bytes_read_ptr = num_read;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static int
|
||||
read_signed_leb128 (abfd, buf, bytes_read_ptr)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
char *buf;
|
||||
unsigned int *bytes_read_ptr;
|
||||
unsigned int * bytes_read_ptr;
|
||||
{
|
||||
int result;
|
||||
int i, shift, size, num_read;
|
||||
int result;
|
||||
int shift;
|
||||
int num_read;
|
||||
unsigned char byte;
|
||||
|
||||
result = 0;
|
||||
shift = 0;
|
||||
size = 32;
|
||||
num_read = 0;
|
||||
i = 0;
|
||||
while (1)
|
||||
|
||||
do
|
||||
{
|
||||
byte = bfd_get_8 (abfd, (bfd_byte *) buf);
|
||||
buf++;
|
||||
num_read++;
|
||||
result |= ((byte & 127) << shift);
|
||||
buf ++;
|
||||
num_read ++;
|
||||
result |= ((byte & 0x7f) << shift);
|
||||
shift += 7;
|
||||
if ((byte & 128) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if ((shift < size) && (byte & 0x40))
|
||||
{
|
||||
result |= -(1 << shift);
|
||||
}
|
||||
*bytes_read_ptr = num_read;
|
||||
while (byte & 0x80);
|
||||
|
||||
if ((shift < 32) && (byte & 0x40))
|
||||
result |= -(1 << shift);
|
||||
|
||||
* bytes_read_ptr = num_read;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/* END VERBATUM */
|
||||
|
||||
/* END VERBATIM */
|
||||
|
||||
static bfd_vma
|
||||
read_address (abfd, buf)
|
||||
bfd *abfd;
|
||||
read_address (unit, buf)
|
||||
struct comp_unit* unit;
|
||||
char *buf;
|
||||
{
|
||||
bfd_vma retval = 0;
|
||||
|
||||
if (sizeof(retval) == 4)
|
||||
switch (unit->addr_size)
|
||||
{
|
||||
retval = bfd_get_32 (abfd, (bfd_byte *) buf);
|
||||
} else {
|
||||
retval = bfd_get_64 (abfd, (bfd_byte *) buf);
|
||||
case 8:
|
||||
return bfd_get_64 (unit->abfd, (bfd_byte *) buf);
|
||||
case 4:
|
||||
return bfd_get_32 (unit->abfd, (bfd_byte *) buf);
|
||||
case 2:
|
||||
return bfd_get_16 (unit->abfd, (bfd_byte *) buf);
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
@ -367,13 +426,13 @@ read_abbrevs (abfd, offset)
|
||||
msec = bfd_get_section_by_name (abfd, ".debug_abbrev");
|
||||
if (! msec)
|
||||
{
|
||||
(*_bfd_error_handler) ("Dwarf Error: Can't find .debug_abbrev section.");
|
||||
(*_bfd_error_handler) (_("Dwarf Error: Can't find .debug_abbrev section."));
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
stash->dwarf_abbrev_size = bfd_get_section_size_before_reloc (msec);
|
||||
stash->dwarf_abbrev_buffer = (unsigned char*) bfd_alloc (abfd, stash->dwarf_abbrev_size);
|
||||
stash->dwarf_abbrev_size = msec->_raw_size;
|
||||
stash->dwarf_abbrev_buffer = (char*) bfd_alloc (abfd, stash->dwarf_abbrev_size);
|
||||
if (! stash->dwarf_abbrev_buffer)
|
||||
return 0;
|
||||
|
||||
@ -385,7 +444,7 @@ read_abbrevs (abfd, offset)
|
||||
|
||||
if (offset > stash->dwarf_abbrev_size)
|
||||
{
|
||||
(*_bfd_error_handler) ("Dwarf Error: Abbrev offset (%u) bigger than abbrev size (%u).",
|
||||
(*_bfd_error_handler) (_("Dwarf Error: Abbrev offset (%u) bigger than abbrev size (%u)."),
|
||||
offset, stash->dwarf_abbrev_size );
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return 0;
|
||||
@ -459,12 +518,13 @@ read_abbrevs (abfd, offset)
|
||||
/* Read an attribute described by an abbreviated attribute. */
|
||||
|
||||
static char *
|
||||
read_attribute (attr, abbrev, abfd, info_ptr)
|
||||
struct attribute *attr;
|
||||
read_attribute (attr, abbrev, unit, info_ptr)
|
||||
struct attribute *attr;
|
||||
struct attr_abbrev *abbrev;
|
||||
bfd *abfd;
|
||||
char *info_ptr;
|
||||
struct comp_unit *unit;
|
||||
char *info_ptr;
|
||||
{
|
||||
bfd *abfd = unit->abfd;
|
||||
unsigned int bytes_read;
|
||||
struct dwarf_block *blk;
|
||||
|
||||
@ -474,8 +534,8 @@ read_attribute (attr, abbrev, abfd, info_ptr)
|
||||
{
|
||||
case DW_FORM_addr:
|
||||
case DW_FORM_ref_addr:
|
||||
DW_ADDR (attr) = read_address (abfd, info_ptr);
|
||||
info_ptr += sizeof(bfd_vma);
|
||||
DW_ADDR (attr) = read_address (unit, info_ptr);
|
||||
info_ptr += unit->addr_size;
|
||||
break;
|
||||
case DW_FORM_block2:
|
||||
blk = (struct dwarf_block *) bfd_alloc (abfd, sizeof (struct dwarf_block));
|
||||
@ -553,6 +613,10 @@ read_attribute (attr, abbrev, abfd, info_ptr)
|
||||
DW_UNSND (attr) = read_4_bytes (abfd, info_ptr);
|
||||
info_ptr += 4;
|
||||
break;
|
||||
case DW_FORM_ref8:
|
||||
DW_UNSND (attr) = read_8_bytes (abfd, info_ptr);
|
||||
info_ptr += 8;
|
||||
break;
|
||||
case DW_FORM_ref_udata:
|
||||
DW_UNSND (attr) = read_unsigned_leb128 (abfd, info_ptr, &bytes_read);
|
||||
info_ptr += bytes_read;
|
||||
@ -560,7 +624,7 @@ read_attribute (attr, abbrev, abfd, info_ptr)
|
||||
case DW_FORM_strp:
|
||||
case DW_FORM_indirect:
|
||||
default:
|
||||
(*_bfd_error_handler) ("Dwarf Error: Invalid or unhandled FORM value: %d.",
|
||||
(*_bfd_error_handler) (_("Dwarf Error: Invalid or unhandled FORM value: %d."),
|
||||
abbrev->form);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
}
|
||||
@ -580,6 +644,7 @@ struct line_info {
|
||||
char* filename;
|
||||
unsigned int line;
|
||||
unsigned int column;
|
||||
int end_sequence; /* end of (sequential) code sequence */
|
||||
};
|
||||
|
||||
struct fileinfo {
|
||||
@ -602,12 +667,13 @@ struct line_info_table {
|
||||
};
|
||||
|
||||
static void
|
||||
add_line_info (table, address, filename, line, column)
|
||||
add_line_info (table, address, filename, line, column, end_sequence)
|
||||
struct line_info_table* table;
|
||||
bfd_vma address;
|
||||
char* filename;
|
||||
unsigned int line;
|
||||
unsigned int column;
|
||||
int end_sequence;
|
||||
{
|
||||
struct line_info* info = (struct line_info*)
|
||||
bfd_alloc (table->abfd, sizeof (struct line_info));
|
||||
@ -619,6 +685,7 @@ add_line_info (table, address, filename, line, column)
|
||||
info->filename = filename;
|
||||
info->line = line;
|
||||
info->column = column;
|
||||
info->end_sequence = end_sequence;
|
||||
}
|
||||
|
||||
static char*
|
||||
@ -626,7 +693,16 @@ concat_filename (table, file)
|
||||
struct line_info_table* table;
|
||||
unsigned int file;
|
||||
{
|
||||
char* filename = table->files[file - 1].name;
|
||||
char* filename;
|
||||
|
||||
if (file - 1 >= table->num_files)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
(_("Dwarf Error: mangled line number section (bad file number)."));
|
||||
return "<unknown>";
|
||||
}
|
||||
|
||||
filename = table->files[file - 1].name;
|
||||
if (*filename == '/')
|
||||
return filename;
|
||||
|
||||
@ -639,17 +715,59 @@ concat_filename (table, file)
|
||||
}
|
||||
}
|
||||
|
||||
/* Decode the line number information for the compilation unit whose
|
||||
line number info is at OFFSET in the .debug_line section.
|
||||
The compilation directory of the file is passed in COMP_DIR. */
|
||||
static void
|
||||
arange_add (unit, low_pc, high_pc)
|
||||
struct comp_unit *unit;
|
||||
bfd_vma low_pc;
|
||||
bfd_vma high_pc;
|
||||
{
|
||||
struct arange *arange;
|
||||
|
||||
/* first see if we can cheaply extend an existing range: */
|
||||
arange = &unit->arange;
|
||||
do
|
||||
{
|
||||
if (low_pc == arange->high)
|
||||
{
|
||||
arange->high = high_pc;
|
||||
return;
|
||||
}
|
||||
if (high_pc == arange->low)
|
||||
{
|
||||
arange->low = low_pc;
|
||||
return;
|
||||
}
|
||||
arange = arange->next;
|
||||
}
|
||||
while (arange);
|
||||
|
||||
if (unit->arange.high == 0)
|
||||
{
|
||||
/* this is the first address range: store it in unit->arange: */
|
||||
unit->arange.next = 0;
|
||||
unit->arange.low = low_pc;
|
||||
unit->arange.high = high_pc;
|
||||
return;
|
||||
}
|
||||
|
||||
/* need to allocate a new arange and insert it into the arange list: */
|
||||
arange = bfd_zalloc (unit->abfd, sizeof (*arange));
|
||||
arange->low = low_pc;
|
||||
arange->high = high_pc;
|
||||
|
||||
arange->next = unit->arange.next;
|
||||
unit->arange.next = arange;
|
||||
}
|
||||
|
||||
/* Decode the line number information for UNIT. */
|
||||
|
||||
static struct line_info_table*
|
||||
decode_line_info (abfd, offset, comp_dir)
|
||||
bfd *abfd;
|
||||
unsigned int offset;
|
||||
char *comp_dir;
|
||||
decode_line_info (unit)
|
||||
struct comp_unit *unit;
|
||||
{
|
||||
static char* dwarf_line_buffer = 0;
|
||||
bfd *abfd = unit->abfd;
|
||||
|
||||
struct dwarf2_debug *stash;
|
||||
|
||||
struct line_info_table* table;
|
||||
|
||||
@ -660,7 +778,9 @@ decode_line_info (abfd, offset, comp_dir)
|
||||
char *cur_file, *cur_dir;
|
||||
unsigned char op_code, extended_op, adj_opcode;
|
||||
|
||||
if (! dwarf_line_buffer)
|
||||
stash = elf_tdata (abfd)->dwarf2_find_line_info;
|
||||
|
||||
if (! stash->dwarf_line_buffer)
|
||||
{
|
||||
asection *msec;
|
||||
unsigned long size;
|
||||
@ -668,26 +788,29 @@ decode_line_info (abfd, offset, comp_dir)
|
||||
msec = bfd_get_section_by_name (abfd, ".debug_line");
|
||||
if (! msec)
|
||||
{
|
||||
(*_bfd_error_handler) ("Dwarf Error: Can't find .debug_line section.");
|
||||
(*_bfd_error_handler) (_("Dwarf Error: Can't find .debug_line section."));
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
size = bfd_get_section_size_before_reloc (msec);
|
||||
dwarf_line_buffer = (unsigned char*) bfd_alloc (abfd, size);
|
||||
if (! dwarf_line_buffer)
|
||||
size = msec->_raw_size;
|
||||
stash->dwarf_line_buffer = (char *) bfd_alloc (abfd, size);
|
||||
if (! stash->dwarf_line_buffer)
|
||||
return 0;
|
||||
|
||||
if (! bfd_get_section_contents (abfd, msec,
|
||||
dwarf_line_buffer, 0,
|
||||
stash->dwarf_line_buffer, 0,
|
||||
size))
|
||||
return 0;
|
||||
|
||||
/* FIXME: We ought to apply the relocs against this section before
|
||||
we process it.... */
|
||||
}
|
||||
|
||||
table = (struct line_info_table*) bfd_alloc (abfd,
|
||||
sizeof (struct line_info_table));
|
||||
table->abfd = abfd;
|
||||
table->comp_dir = comp_dir;
|
||||
table->comp_dir = unit->comp_dir;
|
||||
|
||||
table->num_files = 0;
|
||||
table->files = NULL;
|
||||
@ -695,7 +818,10 @@ decode_line_info (abfd, offset, comp_dir)
|
||||
table->num_dirs = 0;
|
||||
table->dirs = NULL;
|
||||
|
||||
line_ptr = dwarf_line_buffer + offset;
|
||||
table->files = NULL;
|
||||
table->last_line = NULL;
|
||||
|
||||
line_ptr = stash->dwarf_line_buffer + unit->line_offset;
|
||||
|
||||
/* read in the prologue */
|
||||
lh.total_length = read_4_bytes (abfd, line_ptr);
|
||||
@ -778,7 +904,8 @@ decode_line_info (abfd, offset, comp_dir)
|
||||
unsigned int column = 0;
|
||||
int is_stmt = lh.default_is_stmt;
|
||||
int basic_block = 0;
|
||||
int end_sequence = 0;
|
||||
int end_sequence = 0, need_low_pc = 1;
|
||||
bfd_vma low_pc = 0;
|
||||
|
||||
/* Decode the table. */
|
||||
while (! end_sequence)
|
||||
@ -795,12 +922,18 @@ decode_line_info (abfd, offset, comp_dir)
|
||||
{
|
||||
case DW_LNE_end_sequence:
|
||||
end_sequence = 1;
|
||||
add_line_info (table, address, filename, line, column);
|
||||
add_line_info (table, address, filename, line, column,
|
||||
end_sequence);
|
||||
if (need_low_pc)
|
||||
{
|
||||
need_low_pc = 0;
|
||||
low_pc = address;
|
||||
}
|
||||
arange_add (unit, low_pc, address);
|
||||
break;
|
||||
case DW_LNE_set_address:
|
||||
address = read_address (abfd, line_ptr);
|
||||
address &= 0xffffffff;
|
||||
line_ptr += sizeof (bfd_vma);
|
||||
address = read_address (unit, line_ptr);
|
||||
line_ptr += unit->addr_size;
|
||||
break;
|
||||
case DW_LNE_define_file:
|
||||
cur_file = read_string (abfd, line_ptr, &bytes_read);
|
||||
@ -827,14 +960,19 @@ decode_line_info (abfd, offset, comp_dir)
|
||||
table->num_files++;
|
||||
break;
|
||||
default:
|
||||
(*_bfd_error_handler) ("Dwarf Error: mangled line number section.");
|
||||
(*_bfd_error_handler) (_("Dwarf Error: mangled line number section."));
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case DW_LNS_copy:
|
||||
add_line_info (table, address, filename, line, column);
|
||||
add_line_info (table, address, filename, line, column, 0);
|
||||
basic_block = 0;
|
||||
if (need_low_pc)
|
||||
{
|
||||
need_low_pc = 0;
|
||||
low_pc = address;
|
||||
}
|
||||
break;
|
||||
case DW_LNS_advance_pc:
|
||||
address += lh.minimum_instruction_length
|
||||
@ -867,7 +1005,8 @@ decode_line_info (abfd, offset, comp_dir)
|
||||
basic_block = 1;
|
||||
break;
|
||||
case DW_LNS_const_add_pc:
|
||||
address += (255 - lh.opcode_base) / lh.line_range;
|
||||
address += lh.minimum_instruction_length
|
||||
* ((255 - lh.opcode_base) / lh.line_range);
|
||||
break;
|
||||
case DW_LNS_fixed_advance_pc:
|
||||
address += read_2_bytes (abfd, line_ptr);
|
||||
@ -879,8 +1018,13 @@ decode_line_info (abfd, offset, comp_dir)
|
||||
* lh.minimum_instruction_length;
|
||||
line += lh.line_base + (adj_opcode % lh.line_range);
|
||||
/* append row to matrix using current values */
|
||||
add_line_info (table, address, filename, line, column);
|
||||
add_line_info (table, address, filename, line, column, 0);
|
||||
basic_block = 1;
|
||||
if (need_low_pc)
|
||||
{
|
||||
need_low_pc = 0;
|
||||
low_pc = address;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -903,21 +1047,25 @@ lookup_address_in_line_info_table (table,
|
||||
const char **filename_ptr;
|
||||
unsigned int *linenumber_ptr;
|
||||
{
|
||||
struct line_info* next_line = table->last_line;
|
||||
struct line_info* each_line;
|
||||
struct line_info* next_line;
|
||||
|
||||
for (next_line = 0, each_line = table->last_line;
|
||||
each_line;
|
||||
next_line = each_line, each_line = each_line->prev_line)
|
||||
if (!next_line)
|
||||
return false;
|
||||
|
||||
each_line = next_line->prev_line;
|
||||
|
||||
while (each_line && next_line)
|
||||
{
|
||||
if (addr >= each_line->address
|
||||
&& (next_line == 0
|
||||
|| addr < next_line->address))
|
||||
if (!each_line->end_sequence
|
||||
&& addr >= each_line->address && addr < next_line->address)
|
||||
{
|
||||
*filename_ptr = each_line->filename;
|
||||
*linenumber_ptr = each_line->line;
|
||||
return true;
|
||||
}
|
||||
next_line = each_line;
|
||||
each_line = each_line->prev_line;
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -953,8 +1101,7 @@ lookup_address_in_function_table (table,
|
||||
each_func;
|
||||
each_func = each_func->prev_func)
|
||||
{
|
||||
if (addr >= (each_func->low & 0xffffffff)
|
||||
&& addr < (each_func->high & 0xffffffff))
|
||||
if (addr >= each_func->low && addr < each_func->high)
|
||||
{
|
||||
*functionname_ptr = each_func->name;
|
||||
return true;
|
||||
@ -970,56 +1117,6 @@ lookup_address_in_function_table (table,
|
||||
/* DWARF2 Compilation unit functions. */
|
||||
|
||||
|
||||
/* A minimal decoding of DWARF2 compilation units. We only decode
|
||||
what's needed to get to the line number information. */
|
||||
|
||||
struct comp_unit {
|
||||
|
||||
/* Chain the previously read compilation units. */
|
||||
struct comp_unit* next_unit;
|
||||
|
||||
/* Keep the bdf convenient (for memory allocation). */
|
||||
bfd* abfd;
|
||||
|
||||
/* The lowest and higest addresses contained in this compilation
|
||||
unit as specified in the compilation unit header. */
|
||||
bfd_vma low;
|
||||
bfd_vma high;
|
||||
|
||||
/* The DW_AT_name attribute (for error messages). */
|
||||
char* name;
|
||||
|
||||
/* The abbrev hash table. */
|
||||
struct abbrev_info** abbrevs;
|
||||
|
||||
/* Note that an error was found by comp_unit_find_nearest_line. */
|
||||
int error;
|
||||
|
||||
/* The DW_AT_comp_dir attribute */
|
||||
char* comp_dir;
|
||||
|
||||
/* True if there is a line number table associated with this comp. unit. */
|
||||
int stmtlist;
|
||||
|
||||
/* The offset into .debug_line of the line number table. */
|
||||
unsigned long line_offset;
|
||||
|
||||
/* Pointer to the first child die for the comp unit. */
|
||||
char *first_child_die_ptr;
|
||||
|
||||
/* The end of the comp unit. */
|
||||
char *end_ptr;
|
||||
|
||||
/* The decoded line number, NULL if not yet decoded. */
|
||||
struct line_info_table* line_table;
|
||||
|
||||
/* A list of the functions found in this comp. unit. */
|
||||
struct funcinfo* function_table;
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
/* Scan over each die in a comp. unit looking for functions to add
|
||||
to the function table. */
|
||||
|
||||
@ -1051,7 +1148,7 @@ scan_unit_for_functions (unit)
|
||||
abbrev = lookup_abbrev (abbrev_number,unit->abbrevs);
|
||||
if (! abbrev)
|
||||
{
|
||||
(*_bfd_error_handler) ("Dwarf Error: Could not find abbrev number %d.",
|
||||
(*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %d."),
|
||||
abbrev_number);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
@ -1068,7 +1165,7 @@ scan_unit_for_functions (unit)
|
||||
|
||||
for (i = 0; i < abbrev->num_attrs; ++i)
|
||||
{
|
||||
info_ptr = read_attribute (&attr, &abbrev->attrs[i], abfd, info_ptr);
|
||||
info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr);
|
||||
|
||||
if (func)
|
||||
{
|
||||
@ -1125,25 +1222,27 @@ scan_unit_for_functions (unit)
|
||||
|
||||
|
||||
|
||||
/* Parse a DWARF2 compilation unit starting at INFO_PTR. This includes
|
||||
the compilation unit header that proceeds the DIE's, but does not
|
||||
include the length field that preceeds each compilation unit header.
|
||||
END_PTR points one past the end of this comp unit.
|
||||
/* Parse a DWARF2 compilation unit starting at INFO_PTR. This
|
||||
includes the compilation unit header that proceeds the DIE's, but
|
||||
does not include the length field that preceeds each compilation
|
||||
unit header. END_PTR points one past the end of this comp unit.
|
||||
If ABBREV_LENGTH is 0, then the length of the abbreviation offset
|
||||
is assumed to be four bytes. Otherwise, it it is the size given.
|
||||
|
||||
This routine does not read the whole compilation unit; only enough
|
||||
to get to the line number information for the compilation unit.
|
||||
*/
|
||||
to get to the line number information for the compilation unit. */
|
||||
|
||||
static struct comp_unit*
|
||||
parse_comp_unit (abfd, info_ptr, end_ptr)
|
||||
static struct comp_unit *
|
||||
parse_comp_unit (abfd, info_ptr, end_ptr, abbrev_length)
|
||||
bfd* abfd;
|
||||
char* info_ptr;
|
||||
char* end_ptr;
|
||||
unsigned int abbrev_length;
|
||||
{
|
||||
struct comp_unit* unit;
|
||||
|
||||
unsigned short version;
|
||||
unsigned int abbrev_offset;
|
||||
unsigned int abbrev_offset = 0;
|
||||
unsigned char addr_size;
|
||||
struct abbrev_info** abbrevs;
|
||||
|
||||
@ -1153,30 +1252,40 @@ parse_comp_unit (abfd, info_ptr, end_ptr)
|
||||
|
||||
version = read_2_bytes (abfd, info_ptr);
|
||||
info_ptr += 2;
|
||||
abbrev_offset = read_4_bytes (abfd, info_ptr);
|
||||
info_ptr += 4;
|
||||
BFD_ASSERT (abbrev_length == 0
|
||||
|| abbrev_length == 4
|
||||
|| abbrev_length == 8);
|
||||
if (abbrev_length == 0 || abbrev_length == 4)
|
||||
abbrev_offset = read_4_bytes (abfd, info_ptr);
|
||||
else if (abbrev_length == 8)
|
||||
abbrev_offset = read_8_bytes (abfd, info_ptr);
|
||||
info_ptr += abbrev_length;
|
||||
addr_size = read_1_byte (abfd, info_ptr);
|
||||
info_ptr += 1;
|
||||
|
||||
if (version != 2)
|
||||
{
|
||||
(*_bfd_error_handler) ("Dwarf Error: found dwarf version '%hu' in compilation unit '%s', this reader only handles version 2 information.",
|
||||
version,
|
||||
unit->name);
|
||||
(*_bfd_error_handler) (_("Dwarf Error: found dwarf version '%hu', this reader only handles version 2 information."), version );
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (addr_size != sizeof (bfd_vma))
|
||||
if (addr_size > sizeof (bfd_vma))
|
||||
{
|
||||
(*_bfd_error_handler) ("Dwarf Error: found address size '%u' in compilation unit '%s', this readers only handles address size '%u'.",
|
||||
(*_bfd_error_handler) (_("Dwarf Error: found address size '%u', this reader can not handle sizes greater than '%u'."),
|
||||
addr_size,
|
||||
unit->name,
|
||||
sizeof (bfd_vma));
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (addr_size != 2 && addr_size != 4 && addr_size != 8)
|
||||
{
|
||||
(*_bfd_error_handler) ("Dwarf Error: found address size '%u', this reader can only handle address sizes '2', '4' and '8'.", addr_size );
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Read the abbrevs for this compilation unit into a table */
|
||||
abbrevs = read_abbrevs (abfd, abbrev_offset);
|
||||
if (! abbrevs)
|
||||
@ -1186,7 +1295,7 @@ parse_comp_unit (abfd, info_ptr, end_ptr)
|
||||
info_ptr += bytes_read;
|
||||
if (! abbrev_number)
|
||||
{
|
||||
(*_bfd_error_handler) ("Dwarf Error: Bad abbrev number: %d.",
|
||||
(*_bfd_error_handler) (_("Dwarf Error: Bad abbrev number: %d."),
|
||||
abbrev_number);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return 0;
|
||||
@ -1195,7 +1304,7 @@ parse_comp_unit (abfd, info_ptr, end_ptr)
|
||||
abbrev = lookup_abbrev (abbrev_number, abbrevs);
|
||||
if (! abbrev)
|
||||
{
|
||||
(*_bfd_error_handler) ("Dwarf Error: Could not find abbrev number %d.",
|
||||
(*_bfd_error_handler) (_("Dwarf Error: Could not find abbrev number %d."),
|
||||
abbrev_number);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return 0;
|
||||
@ -1203,12 +1312,13 @@ parse_comp_unit (abfd, info_ptr, end_ptr)
|
||||
|
||||
unit = (struct comp_unit*) bfd_zalloc (abfd, sizeof (struct comp_unit));
|
||||
unit->abfd = abfd;
|
||||
unit->addr_size = addr_size;
|
||||
unit->abbrevs = abbrevs;
|
||||
unit->end_ptr = end_ptr;
|
||||
|
||||
for (i = 0; i < abbrev->num_attrs; ++i)
|
||||
{
|
||||
info_ptr = read_attribute (&attr, &abbrev->attrs[i], abfd, info_ptr);
|
||||
info_ptr = read_attribute (&attr, &abbrev->attrs[i], unit, info_ptr);
|
||||
|
||||
/* Store the data if it is of an attribute we want to keep in a
|
||||
partial symbol table. */
|
||||
@ -1224,11 +1334,11 @@ parse_comp_unit (abfd, info_ptr, end_ptr)
|
||||
break;
|
||||
|
||||
case DW_AT_low_pc:
|
||||
unit->low = DW_ADDR (&attr);
|
||||
unit->arange.low = DW_ADDR (&attr);
|
||||
break;
|
||||
|
||||
case DW_AT_high_pc:
|
||||
unit->high = DW_ADDR (&attr);
|
||||
unit->arange.high = DW_ADDR (&attr);
|
||||
break;
|
||||
|
||||
case DW_AT_comp_dir:
|
||||
@ -1267,9 +1377,20 @@ comp_unit_contains_address (unit, addr)
|
||||
struct comp_unit* unit;
|
||||
bfd_vma addr;
|
||||
{
|
||||
return ! unit->error
|
||||
&& ( addr >= (unit->low & 0xffffffff)
|
||||
&& addr <= (unit->high & 0xffffffff));
|
||||
struct arange *arange;
|
||||
|
||||
if (unit->error)
|
||||
return 0;
|
||||
|
||||
arange = &unit->arange;
|
||||
do
|
||||
{
|
||||
if (addr >= arange->low && addr < arange->high)
|
||||
return 1;
|
||||
arange = arange->next;
|
||||
}
|
||||
while (arange);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@ -1304,9 +1425,7 @@ comp_unit_find_nearest_line (unit, addr,
|
||||
return false;
|
||||
}
|
||||
|
||||
unit->line_table = decode_line_info (unit->abfd,
|
||||
unit->line_offset,
|
||||
unit->comp_dir);
|
||||
unit->line_table = decode_line_info (unit);
|
||||
|
||||
if (! unit->line_table)
|
||||
{
|
||||
@ -1331,19 +1450,25 @@ comp_unit_find_nearest_line (unit, addr,
|
||||
return line_p || func_p;
|
||||
}
|
||||
|
||||
/* The DWARF2 version of find_nearest line.
|
||||
Return true if the line is found without error. */
|
||||
/* The DWARF2 version of find_nearest line. Return true if the line
|
||||
is found without error. ADDR_SIZE is the number of bytes in the
|
||||
initial .debug_info length field and in the abbreviation offset.
|
||||
You may use zero to indicate that the default value should be
|
||||
used. */
|
||||
|
||||
boolean
|
||||
_bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
|
||||
filename_ptr, functionname_ptr, linenumber_ptr)
|
||||
filename_ptr, functionname_ptr,
|
||||
linenumber_ptr,
|
||||
addr_size)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
asymbol **symbols;
|
||||
asymbol **symbols ATTRIBUTE_UNUSED;
|
||||
bfd_vma offset;
|
||||
const char **filename_ptr;
|
||||
const char **functionname_ptr;
|
||||
unsigned int *linenumber_ptr;
|
||||
unsigned int addr_size;
|
||||
{
|
||||
/* Read each compilation unit from the section .debug_info, and check
|
||||
to see if it contains the address we are searching for. If yes,
|
||||
@ -1366,6 +1491,13 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
|
||||
*functionname_ptr = NULL;
|
||||
*linenumber_ptr = 0;
|
||||
|
||||
/* The DWARF2 spec says that the initial length field, and the
|
||||
offset of the abbreviation table, should both be 4-byte values.
|
||||
However, some compilers do things differently. */
|
||||
if (addr_size == 0)
|
||||
addr_size = 4;
|
||||
BFD_ASSERT (addr_size == 4 || addr_size == 8);
|
||||
|
||||
if (! stash)
|
||||
{
|
||||
asection *msec;
|
||||
@ -1386,8 +1518,11 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
|
||||
return false;
|
||||
}
|
||||
|
||||
size = bfd_get_section_size_before_reloc (msec);
|
||||
stash->info_ptr = (unsigned char*) bfd_alloc (abfd, size);
|
||||
size = msec->_raw_size;
|
||||
if (size == 0)
|
||||
return false;
|
||||
|
||||
stash->info_ptr = (char *) bfd_alloc (abfd, size);
|
||||
|
||||
if (! stash->info_ptr)
|
||||
return false;
|
||||
@ -1399,8 +1534,22 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
|
||||
}
|
||||
|
||||
stash->info_ptr_end = stash->info_ptr + size;
|
||||
}
|
||||
|
||||
/* FIXME: There is a problem with the contents of the
|
||||
.debug_info section. The 'low' and 'high' addresses of the
|
||||
comp_units are computed by relocs against symbols in the
|
||||
.text segment. We need these addresses in order to determine
|
||||
the nearest line number, and so we have to resolve the
|
||||
relocs. There is a similar problem when the .debug_line
|
||||
section is processed as well (e.g., there may be relocs
|
||||
against the operand of the DW_LNE_set_address operator).
|
||||
|
||||
Unfortunately getting hold of the reloc information is hard...
|
||||
|
||||
For now, this means that disassembling object files (as
|
||||
opposed to fully executables) does not always work as well as
|
||||
we would like. */
|
||||
}
|
||||
|
||||
/* A null info_ptr indicates that there is no dwarf2 info
|
||||
(or that an error occured while setting up the stash). */
|
||||
@ -1408,45 +1557,60 @@ _bfd_dwarf2_find_nearest_line (abfd, section, symbols, offset,
|
||||
if (! stash->info_ptr)
|
||||
return false;
|
||||
|
||||
|
||||
|
||||
/* Check the previously read comp. units first. */
|
||||
|
||||
for (each = stash->all_comp_units; each; each = each->next_unit)
|
||||
{
|
||||
if (comp_unit_contains_address (each, addr))
|
||||
return comp_unit_find_nearest_line (each, addr,
|
||||
filename_ptr,
|
||||
functionname_ptr,
|
||||
linenumber_ptr);
|
||||
}
|
||||
|
||||
if (comp_unit_contains_address (each, addr))
|
||||
return comp_unit_find_nearest_line (each, addr, filename_ptr,
|
||||
functionname_ptr, linenumber_ptr);
|
||||
|
||||
/* Read each remaining comp. units checking each as they are read. */
|
||||
while (stash->info_ptr < stash->info_ptr_end)
|
||||
{
|
||||
struct comp_unit* each;
|
||||
unsigned int length;
|
||||
bfd_vma length;
|
||||
boolean found;
|
||||
|
||||
length = read_4_bytes (abfd, stash->info_ptr);
|
||||
stash->info_ptr += 4;
|
||||
if (addr_size == 4)
|
||||
length = read_4_bytes (abfd, stash->info_ptr);
|
||||
else
|
||||
length = read_8_bytes (abfd, stash->info_ptr);
|
||||
stash->info_ptr += addr_size;
|
||||
|
||||
if (length > 0)
|
||||
{
|
||||
each = parse_comp_unit (abfd, stash->info_ptr,
|
||||
stash->info_ptr + length);
|
||||
stash->info_ptr + length,
|
||||
addr_size);
|
||||
stash->info_ptr += length;
|
||||
|
||||
if (each)
|
||||
{
|
||||
each->next_unit = stash->all_comp_units;
|
||||
stash->all_comp_units = each;
|
||||
|
||||
if (comp_unit_contains_address (each, addr))
|
||||
return comp_unit_find_nearest_line (each, addr,
|
||||
filename_ptr,
|
||||
functionname_ptr,
|
||||
linenumber_ptr);
|
||||
|
||||
/* DW_AT_low_pc and DW_AT_high_pc are optional for
|
||||
compilation units. If we don't have them (i.e.,
|
||||
unit->high == 0), we need to consult the line info
|
||||
table to see if a compilation unit contains the given
|
||||
address. */
|
||||
if (each->arange.high > 0)
|
||||
{
|
||||
if (comp_unit_contains_address (each, addr))
|
||||
return comp_unit_find_nearest_line (each, addr,
|
||||
filename_ptr,
|
||||
functionname_ptr,
|
||||
linenumber_ptr);
|
||||
}
|
||||
else
|
||||
{
|
||||
found = comp_unit_find_nearest_line (each, addr,
|
||||
filename_ptr,
|
||||
functionname_ptr,
|
||||
linenumber_ptr);
|
||||
if (found)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Generic ECOFF (Extended-COFF) routines.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
|
||||
Free Software Foundation, Inc.
|
||||
Original version by Per Bothner.
|
||||
Full support added by Ian Lance Taylor, ian@cygnus.com.
|
||||
@ -72,7 +72,23 @@ static unsigned int ecoff_armap_hash PARAMS ((CONST char *s,
|
||||
|
||||
/* This stuff is somewhat copied from coffcode.h. */
|
||||
|
||||
static asection bfd_debug_section = { "*DEBUG*" };
|
||||
static asection bfd_debug_section =
|
||||
{
|
||||
/* name, index, next, flags, set_vma, reloc_done, linker_mark, gc_mark */
|
||||
"*DEBUG*", 0, 0, 0, 0, 0, 0, 0,
|
||||
/* vma, lma, _cooked_size, _raw_size, output_offset, output_section, */
|
||||
0, 0, 0, 0, 0, NULL,
|
||||
/* alig, reloc..., orel..., reloc_count, filepos, rel_..., line_... */
|
||||
0, 0, 0, 0, 0, 0, 0,
|
||||
/* userdata, contents, lineno, lineno_count */
|
||||
0, 0, 0, 0,
|
||||
/* comdat_info, moving_line_filepos, target_index, used_by_bfd, */
|
||||
NULL, 0, 0, 0,
|
||||
/* cons, owner, symbol */
|
||||
0, 0, (struct symbol_cache_entry *) NULL,
|
||||
/* symbol_ptr_ptr, link_order_head, ..._tail */
|
||||
(struct symbol_cache_entry **) NULL, NULL, NULL
|
||||
};
|
||||
|
||||
/* Create an ECOFF object. */
|
||||
|
||||
@ -138,7 +154,7 @@ _bfd_ecoff_mkobject_hook (abfd, filehdr, aouthdr)
|
||||
|
||||
boolean
|
||||
_bfd_ecoff_new_section_hook (abfd, section)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
asection *section;
|
||||
{
|
||||
section->alignment_power = 4;
|
||||
@ -349,10 +365,11 @@ ecoff_sec_to_styp_flags (name, flags)
|
||||
|
||||
/*ARGSUSED*/
|
||||
flagword
|
||||
_bfd_ecoff_styp_to_sec_flags (abfd, hdr, name)
|
||||
bfd *abfd;
|
||||
_bfd_ecoff_styp_to_sec_flags (abfd, hdr, name, section)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
PTR hdr;
|
||||
const char *name;
|
||||
const char *name ATTRIBUTE_UNUSED;
|
||||
asection *section ATTRIBUTE_UNUSED;
|
||||
{
|
||||
struct internal_scnhdr *internal_s = (struct internal_scnhdr *) hdr;
|
||||
long styp_flags = internal_s->s_flags;
|
||||
@ -496,7 +513,7 @@ ecoff_slurp_symbolic_header (abfd)
|
||||
boolean
|
||||
_bfd_ecoff_slurp_symbolic_info (abfd, ignore, debug)
|
||||
bfd *abfd;
|
||||
asection *ignore;
|
||||
asection *ignore ATTRIBUTE_UNUSED;
|
||||
struct ecoff_debug_info *debug;
|
||||
{
|
||||
const struct ecoff_backend_data * const backend = ecoff_backend (abfd);
|
||||
@ -1305,7 +1322,7 @@ ecoff_type_to_string (abfd, fdr, indx)
|
||||
break;
|
||||
|
||||
default:
|
||||
sprintf (p1, "Unknown basic type %d", (int) basic_type);
|
||||
sprintf (p1, _("Unknown basic type %d"), (int) basic_type);
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1433,7 +1450,7 @@ ecoff_type_to_string (abfd, fdr, indx)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
_bfd_ecoff_get_symbol_info (abfd, symbol, ret)
|
||||
bfd *abfd; /* Ignored. */
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
asymbol *symbol;
|
||||
symbol_info *ret;
|
||||
{
|
||||
@ -1445,7 +1462,7 @@ _bfd_ecoff_get_symbol_info (abfd, symbol, ret)
|
||||
/*ARGSUSED*/
|
||||
boolean
|
||||
_bfd_ecoff_bfd_is_local_label_name (abfd, name)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
const char *name;
|
||||
{
|
||||
return name[0] == '$';
|
||||
@ -1577,17 +1594,17 @@ _bfd_ecoff_print_symbol (abfd, filep, symbol, how)
|
||||
|
||||
case stFile:
|
||||
case stBlock:
|
||||
fprintf (file, "\n End+1 symbol: %ld",
|
||||
fprintf (file, _("\n End+1 symbol: %ld"),
|
||||
(long) (indx + sym_base));
|
||||
break;
|
||||
|
||||
case stEnd:
|
||||
if (ecoff_ext.asym.sc == scText
|
||||
|| ecoff_ext.asym.sc == scInfo)
|
||||
fprintf (file, "\n First symbol: %ld",
|
||||
fprintf (file, _("\n First symbol: %ld"),
|
||||
(long) (indx + sym_base));
|
||||
else
|
||||
fprintf (file, "\n First symbol: %ld",
|
||||
fprintf (file, _("\n First symbol: %ld"),
|
||||
((long)
|
||||
(AUX_GET_ISYM (bigendian,
|
||||
&aux_base[ecoff_ext.asym.index])
|
||||
@ -1599,14 +1616,14 @@ _bfd_ecoff_print_symbol (abfd, filep, symbol, how)
|
||||
if (ECOFF_IS_STAB (&ecoff_ext.asym))
|
||||
;
|
||||
else if (ecoffsymbol (symbol)->local)
|
||||
fprintf (file, "\n End+1 symbol: %-7ld Type: %s",
|
||||
fprintf (file, _("\n End+1 symbol: %-7ld Type: %s"),
|
||||
((long)
|
||||
(AUX_GET_ISYM (bigendian,
|
||||
&aux_base[ecoff_ext.asym.index])
|
||||
+ sym_base)),
|
||||
ecoff_type_to_string (abfd, fdr, indx + 1));
|
||||
else
|
||||
fprintf (file, "\n Local symbol: %ld",
|
||||
fprintf (file, _("\n Local symbol: %ld"),
|
||||
((long) indx
|
||||
+ (long) sym_base
|
||||
+ (ecoff_data (abfd)
|
||||
@ -1614,23 +1631,23 @@ _bfd_ecoff_print_symbol (abfd, filep, symbol, how)
|
||||
break;
|
||||
|
||||
case stStruct:
|
||||
fprintf (file, "\n struct; End+1 symbol: %ld",
|
||||
fprintf (file, _("\n struct; End+1 symbol: %ld"),
|
||||
(long) (indx + sym_base));
|
||||
break;
|
||||
|
||||
case stUnion:
|
||||
fprintf (file, "\n union; End+1 symbol: %ld",
|
||||
fprintf (file, _("\n union; End+1 symbol: %ld"),
|
||||
(long) (indx + sym_base));
|
||||
break;
|
||||
|
||||
case stEnum:
|
||||
fprintf (file, "\n enum; End+1 symbol: %ld",
|
||||
fprintf (file, _("\n enum; End+1 symbol: %ld"),
|
||||
(long) (indx + sym_base));
|
||||
break;
|
||||
|
||||
default:
|
||||
if (! ECOFF_IS_STAB (&ecoff_ext.asym))
|
||||
fprintf (file, "\n Type: %s",
|
||||
fprintf (file, _("\n Type: %s"),
|
||||
ecoff_type_to_string (abfd, fdr, indx));
|
||||
break;
|
||||
}
|
||||
@ -1801,7 +1818,7 @@ _bfd_ecoff_find_nearest_line (abfd, section, ignore_symbols, offset,
|
||||
filename_ptr, functionname_ptr, retline_ptr)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
asymbol **ignore_symbols;
|
||||
asymbol **ignore_symbols ATTRIBUTE_UNUSED;
|
||||
bfd_vma offset;
|
||||
CONST char **filename_ptr;
|
||||
CONST char **functionname_ptr;
|
||||
@ -1971,7 +1988,7 @@ _bfd_ecoff_set_arch_mach (abfd, arch, machine)
|
||||
int
|
||||
_bfd_ecoff_sizeof_headers (abfd, reloc)
|
||||
bfd *abfd;
|
||||
boolean reloc;
|
||||
boolean reloc ATTRIBUTE_UNUSED;
|
||||
{
|
||||
asection *current;
|
||||
int c;
|
||||
@ -3181,7 +3198,14 @@ _bfd_ecoff_write_armap (abfd, elength, map, orl_count, stridx)
|
||||
armap. */
|
||||
hdr.ar_uid[0] = '0';
|
||||
hdr.ar_gid[0] = '0';
|
||||
#if 0
|
||||
hdr.ar_mode[0] = '0';
|
||||
#else
|
||||
/* Building gcc ends up extracting the armap as a file - twice. */
|
||||
hdr.ar_mode[0] = '6';
|
||||
hdr.ar_mode[1] = '4';
|
||||
hdr.ar_mode[2] = '4';
|
||||
#endif
|
||||
|
||||
sprintf (hdr.ar_size, "%-10d", (int) mapsize);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Routines to link ECOFF debugging information.
|
||||
Copyright 1993, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
Copyright 1993, 94, 95, 96, 97, 1999 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -491,9 +491,9 @@ add_memory_shuffle (ainfo, head, tail, data, size)
|
||||
/*ARGSUSED*/
|
||||
PTR
|
||||
bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info)
|
||||
bfd *output_bfd;
|
||||
bfd *output_bfd ATTRIBUTE_UNUSED;
|
||||
struct ecoff_debug_info *output_debug;
|
||||
const struct ecoff_debug_swap *output_swap;
|
||||
const struct ecoff_debug_swap *output_swap ATTRIBUTE_UNUSED;
|
||||
struct bfd_link_info *info;
|
||||
{
|
||||
struct accumulate *ainfo;
|
||||
@ -551,9 +551,9 @@ bfd_ecoff_debug_init (output_bfd, output_debug, output_swap, info)
|
||||
void
|
||||
bfd_ecoff_debug_free (handle, output_bfd, output_debug, output_swap, info)
|
||||
PTR handle;
|
||||
bfd *output_bfd;
|
||||
struct ecoff_debug_info *output_debug;
|
||||
const struct ecoff_debug_swap *output_swap;
|
||||
bfd *output_bfd ATTRIBUTE_UNUSED;
|
||||
struct ecoff_debug_info *output_debug ATTRIBUTE_UNUSED;
|
||||
const struct ecoff_debug_swap *output_swap ATTRIBUTE_UNUSED;
|
||||
struct bfd_link_info *info;
|
||||
{
|
||||
struct accumulate *ainfo = (struct accumulate *) handle;
|
||||
@ -1412,7 +1412,7 @@ bfd_ecoff_debug_one_external (abfd, debug, swap, name, esym)
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
ecoff_align_debug (abfd, debug, swap)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
struct ecoff_debug_info *debug;
|
||||
const struct ecoff_debug_swap *swap;
|
||||
{
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* BFD back-end data structures for ELF files.
|
||||
Copyright (C) 1992, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999, 2000 Free Software
|
||||
Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -85,6 +86,16 @@ struct elf_link_hash_entry
|
||||
|
||||
/* Symbol index as a dynamic symbol. Initialized to -1, and remains
|
||||
-1 if this is not a dynamic symbol. */
|
||||
/* ??? Note that this is consistently used as a synonym for tests
|
||||
against whether we can perform various simplifying transformations
|
||||
to the code. (E.g. changing a pc-relative jump to a PLT entry
|
||||
into a pc-relative jump to the target function.) That test, which
|
||||
is often relatively complex, and someplaces wrong or incomplete,
|
||||
should really be replaced by a predicate in elflink.c.
|
||||
|
||||
End result: this field -1 does not indicate that the symbol is
|
||||
not in the dynamic symbol table, but rather that the symbol is
|
||||
not visible outside this DSO. */
|
||||
long dynindx;
|
||||
|
||||
/* String table index in .dynstr if this is a dynamic symbol. */
|
||||
@ -96,17 +107,24 @@ struct elf_link_hash_entry
|
||||
struct elf_link_hash_entry *weakdef;
|
||||
|
||||
/* If this symbol requires an entry in the global offset table, the
|
||||
processor specific backend uses this field to hold the offset
|
||||
into the .got section. If this field is -1, then the symbol does
|
||||
not require a global offset table entry. */
|
||||
bfd_vma got_offset;
|
||||
processor specific backend uses this field to track usage and
|
||||
final offset. We use a union and two names primarily to document
|
||||
the intent of any particular piece of code. The field should be
|
||||
used as a count until size_dynamic_sections, at which point the
|
||||
contents of the .got is fixed. Afterward, if this field is -1,
|
||||
then the symbol does not require a global offset table entry. */
|
||||
union
|
||||
{
|
||||
bfd_signed_vma refcount;
|
||||
bfd_vma offset;
|
||||
} got;
|
||||
|
||||
/* If this symbol requires an entry in the procedure linkage table,
|
||||
the processor specific backend uses these two fields to hold the
|
||||
offset into the procedure linkage section and the offset into the
|
||||
.got section. If plt_offset is -1, then the symbol does not
|
||||
require an entry in the procedure linkage table. */
|
||||
bfd_vma plt_offset;
|
||||
/* Same, but tracks a procedure linkage table entry. */
|
||||
union
|
||||
{
|
||||
bfd_signed_vma refcount;
|
||||
bfd_vma offset;
|
||||
} plt;
|
||||
|
||||
/* If this symbol is used in the linker created sections, the processor
|
||||
specific backend uses this field to map the field into the offset
|
||||
@ -126,12 +144,25 @@ struct elf_link_hash_entry
|
||||
struct bfd_elf_version_tree *vertree;
|
||||
} verinfo;
|
||||
|
||||
/* Virtual table entry use information. This array is nominally of size
|
||||
size/sizeof(target_void_pointer), though we have to be able to assume
|
||||
and track a size while the symbol is still undefined. It is indexed
|
||||
via offset/sizeof(target_void_pointer). */
|
||||
size_t vtable_entries_size;
|
||||
boolean *vtable_entries_used;
|
||||
|
||||
/* Virtual table derivation info. */
|
||||
struct elf_link_hash_entry *vtable_parent;
|
||||
|
||||
/* Symbol type (STT_NOTYPE, STT_OBJECT, etc.). */
|
||||
char type;
|
||||
|
||||
/* Symbol st_other value. */
|
||||
/* Symbol st_other value, symbol visibility. */
|
||||
unsigned char other;
|
||||
|
||||
/* Hash value of the name computed using the ELF hash function. */
|
||||
unsigned long elf_hash_value;
|
||||
|
||||
/* Some flags; legal values follow. */
|
||||
unsigned short elf_link_hash_flags;
|
||||
/* Symbol is referenced by a non-shared object. */
|
||||
@ -142,18 +173,44 @@ struct elf_link_hash_entry
|
||||
#define ELF_LINK_HASH_REF_DYNAMIC 04
|
||||
/* Symbol is defined by a shared object. */
|
||||
#define ELF_LINK_HASH_DEF_DYNAMIC 010
|
||||
/* Symbol has a non-weak reference from a non-shared object. */
|
||||
#define ELF_LINK_HASH_REF_REGULAR_NONWEAK 020
|
||||
/* Dynamic symbol has been adjustd. */
|
||||
#define ELF_LINK_HASH_DYNAMIC_ADJUSTED 020
|
||||
#define ELF_LINK_HASH_DYNAMIC_ADJUSTED 040
|
||||
/* Symbol needs a copy reloc. */
|
||||
#define ELF_LINK_HASH_NEEDS_COPY 040
|
||||
#define ELF_LINK_HASH_NEEDS_COPY 0100
|
||||
/* Symbol needs a procedure linkage table entry. */
|
||||
#define ELF_LINK_HASH_NEEDS_PLT 0100
|
||||
#define ELF_LINK_HASH_NEEDS_PLT 0200
|
||||
/* Symbol appears in a non-ELF input file. */
|
||||
#define ELF_LINK_NON_ELF 0200
|
||||
#define ELF_LINK_NON_ELF 0400
|
||||
/* Symbol should be marked as hidden in the version information. */
|
||||
#define ELF_LINK_HIDDEN 0400
|
||||
#define ELF_LINK_HIDDEN 01000
|
||||
/* Symbol was forced to local scope due to a version script file. */
|
||||
#define ELF_LINK_FORCED_LOCAL 01000
|
||||
#define ELF_LINK_FORCED_LOCAL 02000
|
||||
/* Symbol was marked during garbage collection. */
|
||||
#define ELF_LINK_HASH_MARK 04000
|
||||
/* Symbol is referenced by a non-GOT/non-PLT relocation. This is
|
||||
not currently set by all the backends. */
|
||||
#define ELF_LINK_NON_GOT_REF 010000
|
||||
};
|
||||
|
||||
/* Records local symbols to be emitted in the dynamic symbol table. */
|
||||
|
||||
struct elf_link_local_dynamic_entry
|
||||
{
|
||||
struct elf_link_local_dynamic_entry *next;
|
||||
|
||||
/* The input bfd this symbol came from. */
|
||||
bfd *input_bfd;
|
||||
|
||||
/* The index of the local symbol being copied. */
|
||||
long input_indx;
|
||||
|
||||
/* The index in the outgoing dynamic symbol table. */
|
||||
long dynindx;
|
||||
|
||||
/* A copy of the input symbol. */
|
||||
Elf_Internal_Sym isym;
|
||||
};
|
||||
|
||||
/* ELF linker hash table. */
|
||||
@ -184,6 +241,8 @@ struct elf_link_hash_table
|
||||
struct elf_link_hash_entry *hgot;
|
||||
/* A pointer to information used to link stabs in sections. */
|
||||
PTR stab_info;
|
||||
/* A linked list of local symbols to be added to .dynsym. */
|
||||
struct elf_link_local_dynamic_entry *dynlocal;
|
||||
};
|
||||
|
||||
/* Look up an entry in an ELF linker hash table. */
|
||||
@ -211,6 +270,13 @@ struct elf_size_info {
|
||||
unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr;
|
||||
unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note;
|
||||
|
||||
/* The size of entries in the .hash section. */
|
||||
unsigned char sizeof_hash_entry;
|
||||
|
||||
/* The number of internal relocations to allocate per external
|
||||
relocation entry. */
|
||||
unsigned char int_rels_per_ext_rel;
|
||||
|
||||
unsigned char arch_size, file_align;
|
||||
unsigned char elfclass, ev_current;
|
||||
int (*write_out_phdrs) PARAMS ((bfd *, const Elf_Internal_Phdr *, int));
|
||||
@ -221,6 +287,32 @@ struct elf_size_info {
|
||||
PARAMS ((bfd *, asection *, asymbol **, boolean));
|
||||
long (*slurp_symbol_table) PARAMS ((bfd *, asymbol **, boolean));
|
||||
void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
|
||||
void (*swap_dyn_out) PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
|
||||
|
||||
/* This function, if defined, is called to swap in a REL
|
||||
relocation. If an external relocation corresponds to more than
|
||||
one internal relocation, then all relocations are swapped in at
|
||||
once. */
|
||||
void (*swap_reloc_in)
|
||||
PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rel *));
|
||||
|
||||
/* This function, if defined, is called to swap out a REL
|
||||
relocation. */
|
||||
void (*swap_reloc_out)
|
||||
PARAMS ((bfd *, const Elf_Internal_Rel *, bfd_byte *));
|
||||
|
||||
/* This function, if defined, is called to swap in a RELA
|
||||
relocation. If an external relocation corresponds to more than
|
||||
one internal relocation, then all relocations are swapped in at
|
||||
once. */
|
||||
void (*swap_reloca_in)
|
||||
PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
|
||||
|
||||
/* This function, if defined, is called to swap out a RELA
|
||||
relocation. */
|
||||
void (*swap_reloca_out)
|
||||
PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
|
||||
|
||||
};
|
||||
|
||||
#define elf_symbol_from(ABFD,S) \
|
||||
@ -231,11 +323,6 @@ struct elf_size_info {
|
||||
|
||||
struct elf_backend_data
|
||||
{
|
||||
/* Whether the backend uses REL or RELA relocations. FIXME: some
|
||||
ELF backends use both. When we need to support one, this whole
|
||||
approach will need to be changed. */
|
||||
int use_rela_p;
|
||||
|
||||
/* The architecture for this backend. */
|
||||
enum bfd_architecture arch;
|
||||
|
||||
@ -245,18 +332,6 @@ struct elf_backend_data
|
||||
/* The maximum page size for this backend. */
|
||||
bfd_vma maxpagesize;
|
||||
|
||||
/* This is true if the linker should act like collect and gather
|
||||
global constructors and destructors by name. This is true for
|
||||
MIPS ELF because the Irix 5 tools can not handle the .init
|
||||
section. */
|
||||
boolean collect;
|
||||
|
||||
/* This is true if the linker should ignore changes to the type of a
|
||||
symbol. This is true for MIPS ELF because some Irix 5 objects
|
||||
record undefined functions as STT_OBJECT although the definitions
|
||||
are STT_FUNC. */
|
||||
boolean type_change_ok;
|
||||
|
||||
/* A function to translate an ELF RELA relocation to a BFD arelent
|
||||
structure. */
|
||||
void (*elf_info_to_howto) PARAMS ((bfd *, arelent *,
|
||||
@ -296,6 +371,10 @@ struct elf_backend_data
|
||||
elf_symbol_type *,
|
||||
unsigned int));
|
||||
|
||||
/* A function to set the type of the info field. Processor-specific
|
||||
types should be handled here. */
|
||||
int (*elf_backend_get_symbol_type) PARAMS (( Elf_Internal_Sym *, int));
|
||||
|
||||
/* A function to do additional processing on the ELF section header
|
||||
just before writing it out. This is used to set the flags and
|
||||
type fields for some sections, or to actually write out data for
|
||||
@ -309,6 +388,12 @@ struct elf_backend_data
|
||||
Elf32_Internal_Shdr *,
|
||||
char *));
|
||||
|
||||
/* A function to handle unusual program segment types when creating BFD
|
||||
sections from ELF program segments. */
|
||||
boolean (*elf_backend_section_from_phdr) PARAMS ((bfd *,
|
||||
Elf32_Internal_Phdr *,
|
||||
int));
|
||||
|
||||
/* A function to set up the ELF section header for a BFD section in
|
||||
preparation for writing it out. This is where the flags and type
|
||||
fields are set for unusual sections. */
|
||||
@ -473,6 +558,51 @@ struct elf_backend_data
|
||||
backend specific fashion. */
|
||||
boolean (*elf_backend_modify_segment_map) PARAMS ((bfd *));
|
||||
|
||||
/* This function is called during section gc to discover the section a
|
||||
particular relocation refers to. It need not be defined for hosts
|
||||
that have no queer relocation types. */
|
||||
asection * (*gc_mark_hook)
|
||||
PARAMS ((bfd *abfd, struct bfd_link_info *, Elf_Internal_Rela *,
|
||||
struct elf_link_hash_entry *h, Elf_Internal_Sym *));
|
||||
|
||||
/* This function, if defined, is called during the sweep phase of gc
|
||||
in order that a backend might update any data structures it might
|
||||
be maintaining. */
|
||||
boolean (*gc_sweep_hook)
|
||||
PARAMS ((bfd *abfd, struct bfd_link_info *info, asection *o,
|
||||
const Elf_Internal_Rela *relocs));
|
||||
|
||||
/* This function, if defined, is called after the ELF headers have
|
||||
been created. This allows for things like the OS and ABI versions
|
||||
to be changed. */
|
||||
void (*elf_backend_post_process_headers)
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
/* This function, if defined, prints a symbol to file and returns the
|
||||
name of the symbol to be printed. It should return NULL to fall
|
||||
back to default symbol printing. */
|
||||
const char *(*elf_backend_print_symbol_all)
|
||||
PARAMS ((bfd *, PTR, asymbol *));
|
||||
|
||||
/* This function, if defined, is called after all local symbols and
|
||||
global symbols converted to locals are emited into the symtab
|
||||
section. It allows the backend to emit special global symbols
|
||||
not handled in the hash table. */
|
||||
boolean (*elf_backend_output_arch_syms)
|
||||
PARAMS ((bfd *, struct bfd_link_info *, PTR,
|
||||
boolean (*) PARAMS ((PTR, const char *,
|
||||
Elf_Internal_Sym *, asection *))));
|
||||
|
||||
/* Copy any information related to dynamic linking from a pre-existing
|
||||
symbol IND to a newly created symbol DIR. */
|
||||
void (*elf_backend_copy_indirect_symbol)
|
||||
PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
|
||||
|
||||
/* Modify any information related to dynamic linking such that the
|
||||
symbol is not exported. */
|
||||
void (*elf_backend_hide_symbol)
|
||||
PARAMS ((struct elf_link_hash_entry *));
|
||||
|
||||
/* The swapping table to use when dealing with ECOFF information.
|
||||
Used for the MIPS ELF .mdebug section. */
|
||||
const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
|
||||
@ -487,11 +617,51 @@ struct elf_backend_data
|
||||
.got section */
|
||||
bfd_vma got_symbol_offset;
|
||||
|
||||
/* The size in bytes of the headers for the GOT and PLT. This includes
|
||||
the so-called reserved entries on some systems. */
|
||||
bfd_vma got_header_size;
|
||||
bfd_vma plt_header_size;
|
||||
|
||||
/* This is true if the linker should act like collect and gather
|
||||
global constructors and destructors by name. This is true for
|
||||
MIPS ELF because the Irix 5 tools can not handle the .init
|
||||
section. */
|
||||
unsigned collect : 1;
|
||||
|
||||
/* This is true if the linker should ignore changes to the type of a
|
||||
symbol. This is true for MIPS ELF because some Irix 5 objects
|
||||
record undefined functions as STT_OBJECT although the definitions
|
||||
are STT_FUNC. */
|
||||
unsigned type_change_ok : 1;
|
||||
|
||||
/* Whether the backend may use REL relocations. (Some backends use
|
||||
both REL and RELA relocations, and this flag is set for those
|
||||
backends.) */
|
||||
unsigned may_use_rel_p : 1;
|
||||
|
||||
/* Whether the backend may use RELA relocations. (Some backends use
|
||||
both REL and RELA relocations, and this flag is set for those
|
||||
backends.) */
|
||||
unsigned may_use_rela_p : 1;
|
||||
|
||||
/* Whether the default relocation type is RELA. If a backend with
|
||||
this flag set wants REL relocations for a particular section,
|
||||
it must note that explicitly. Similarly, if this flag is clear,
|
||||
and the backend wants RELA relocations for a particular
|
||||
section. */
|
||||
unsigned default_use_rela_p : 1;
|
||||
|
||||
/* True if addresses "naturally" sign extend. This is used when
|
||||
swapping in from Elf32 when BFD64. */
|
||||
unsigned sign_extend_vma : 1;
|
||||
|
||||
unsigned want_got_plt : 1;
|
||||
unsigned plt_readonly : 1;
|
||||
unsigned want_plt_sym : 1;
|
||||
unsigned plt_not_loaded : 1;
|
||||
unsigned plt_alignment : 4;
|
||||
unsigned can_gc_sections : 1;
|
||||
unsigned want_dynbss : 1;
|
||||
};
|
||||
|
||||
/* Information stored for each BFD section in an ELF file. This
|
||||
@ -507,12 +677,19 @@ struct bfd_elf_section_data
|
||||
/* If there is a second reloc section associated with this section,
|
||||
as can happen on Irix 6, this field points to the header. */
|
||||
Elf_Internal_Shdr *rel_hdr2;
|
||||
/* The number of relocations currently assigned to REL_HDR. */
|
||||
unsigned int rel_count;
|
||||
/* The number of relocations currently assigned to REL_HDR2. */
|
||||
unsigned int rel_count2;
|
||||
/* The ELF section number of this section. Only used for an output
|
||||
file. */
|
||||
int this_idx;
|
||||
/* The ELF section number of the reloc section associated with this
|
||||
section, if any. Only used for an output file. */
|
||||
/* The ELF section number of the reloc section indicated by
|
||||
REL_HDR if any. Only used for an output file. */
|
||||
int rel_idx;
|
||||
/* The ELF section number of the reloc section indicated by
|
||||
REL_HDR2 if any. Only used for an output file. */
|
||||
int rel_idx2;
|
||||
/* Used by the backend linker to store the symbol hash table entries
|
||||
associated with relocs against global symbols. */
|
||||
struct elf_link_hash_entry **rel_hashes;
|
||||
@ -522,12 +699,15 @@ struct bfd_elf_section_data
|
||||
Elf_Internal_Rela *relocs;
|
||||
/* Used by the backend linker when generating a shared library to
|
||||
record the dynamic symbol index for a section symbol
|
||||
corresponding to this section. */
|
||||
corresponding to this section. A value of 0 means that there is
|
||||
no dynamic symbol for this section. */
|
||||
long dynindx;
|
||||
/* A pointer used for .stab linking optimizations. */
|
||||
PTR stab_info;
|
||||
/* A pointer available for the processor specific ELF backend. */
|
||||
PTR tdata;
|
||||
/* Nonzero if this section uses RELA relocations, rather than REL. */
|
||||
unsigned int use_rela_p:1;
|
||||
};
|
||||
|
||||
#define elf_section_data(sec) ((struct bfd_elf_section_data*)sec->used_by_bfd)
|
||||
@ -606,11 +786,22 @@ struct elf_obj_tdata
|
||||
unsigned int strtab_section, dynsymtab_section;
|
||||
unsigned int dynversym_section, dynverdef_section, dynverref_section;
|
||||
file_ptr next_file_pos;
|
||||
#if 0
|
||||
/* we don't need these inside bfd anymore, and I think
|
||||
these weren't used outside bfd. */
|
||||
void *prstatus; /* The raw /proc prstatus structure */
|
||||
void *prpsinfo; /* The raw /proc prpsinfo structure */
|
||||
#endif
|
||||
bfd_vma gp; /* The gp value (MIPS only, for now) */
|
||||
unsigned int gp_size; /* The gp size (MIPS only, for now) */
|
||||
|
||||
/* Information grabbed from an elf core file. */
|
||||
int core_signal;
|
||||
int core_pid;
|
||||
int core_lwpid;
|
||||
char* core_program;
|
||||
char* core_command;
|
||||
|
||||
/* This is set to true if the object was created by the backend
|
||||
linker. */
|
||||
boolean linker;
|
||||
@ -621,8 +812,17 @@ struct elf_obj_tdata
|
||||
struct elf_link_hash_entry **sym_hashes;
|
||||
|
||||
/* A mapping from local symbols to offsets into the global offset
|
||||
table, used when linking. This is indexed by the symbol index. */
|
||||
bfd_vma *local_got_offsets;
|
||||
table, used when linking. This is indexed by the symbol index.
|
||||
Like for the globals, we use a union and two names primarily to
|
||||
document the intent of any particular piece of code. The field
|
||||
should be used as a count until size_dynamic_sections, at which
|
||||
point the contents of the .got is fixed. Afterward, if an entry
|
||||
is -1, then the symbol does not require a global offset table entry. */
|
||||
union
|
||||
{
|
||||
bfd_signed_vma *refcounts;
|
||||
bfd_vma *offsets;
|
||||
} local_got;
|
||||
|
||||
/* A mapping from local symbols to offsets into the various linker
|
||||
sections added. This is index by the symbol index. */
|
||||
@ -657,6 +857,9 @@ struct elf_obj_tdata
|
||||
find_nearest_line. */
|
||||
struct mips_elf_find_line *find_line_info;
|
||||
|
||||
/* A place to stash dwarf1 info for this bfd. */
|
||||
struct dwarf1_debug *dwarf1_find_line_info;
|
||||
|
||||
/* A place to stash dwarf2 info for this bfd. */
|
||||
struct dwarf2_debug *dwarf2_find_line_info;
|
||||
|
||||
@ -701,7 +904,8 @@ struct elf_obj_tdata
|
||||
#define elf_gp(bfd) (elf_tdata(bfd) -> gp)
|
||||
#define elf_gp_size(bfd) (elf_tdata(bfd) -> gp_size)
|
||||
#define elf_sym_hashes(bfd) (elf_tdata(bfd) -> sym_hashes)
|
||||
#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got_offsets)
|
||||
#define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
|
||||
#define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
|
||||
#define elf_local_ptr_offsets(bfd) (elf_tdata(bfd) -> linker_section_pointers)
|
||||
#define elf_dt_name(bfd) (elf_tdata(bfd) -> dt_name)
|
||||
#define elf_bad_symtab(bfd) (elf_tdata(bfd) -> bad_symtab)
|
||||
@ -743,7 +947,7 @@ extern void bfd_elf_print_symbol PARAMS ((bfd *, PTR, asymbol *,
|
||||
#define bfd_elf32_print_symbol bfd_elf_print_symbol
|
||||
#define bfd_elf64_print_symbol bfd_elf_print_symbol
|
||||
|
||||
extern unsigned long bfd_elf_hash PARAMS ((CONST unsigned char *));
|
||||
extern unsigned long bfd_elf_hash PARAMS ((const char *));
|
||||
|
||||
extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *,
|
||||
arelent *,
|
||||
@ -753,13 +957,20 @@ extern bfd_reloc_status_type bfd_elf_generic_reloc PARAMS ((bfd *,
|
||||
bfd *,
|
||||
char **));
|
||||
extern boolean bfd_elf_mkobject PARAMS ((bfd *));
|
||||
extern boolean bfd_elf_mkcorefile PARAMS ((bfd *));
|
||||
extern Elf_Internal_Shdr *bfd_elf_find_section PARAMS ((bfd *, char *));
|
||||
extern boolean _bfd_elf_make_section_from_shdr
|
||||
PARAMS ((bfd *abfd, Elf_Internal_Shdr *hdr, const char *name));
|
||||
extern boolean _bfd_elf_make_section_from_phdr
|
||||
PARAMS ((bfd *abfd, Elf_Internal_Phdr *hdr, int index, const char *typename));
|
||||
extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
|
||||
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
||||
extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
|
||||
PARAMS ((bfd *));
|
||||
extern void _bfd_elf_link_hash_copy_indirect
|
||||
PARAMS ((struct elf_link_hash_entry *, struct elf_link_hash_entry *));
|
||||
extern void _bfd_elf_link_hash_hide_symbol
|
||||
PARAMS ((struct elf_link_hash_entry *));
|
||||
extern boolean _bfd_elf_link_hash_table_init
|
||||
PARAMS ((struct elf_link_hash_table *, bfd *,
|
||||
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
|
||||
@ -772,6 +983,7 @@ extern boolean _bfd_elf_copy_private_symbol_data
|
||||
extern boolean _bfd_elf_copy_private_section_data
|
||||
PARAMS ((bfd *, asection *, bfd *, asection *));
|
||||
extern boolean _bfd_elf_write_object_contents PARAMS ((bfd *));
|
||||
extern boolean _bfd_elf_write_corefile_contents PARAMS ((bfd *));
|
||||
extern boolean _bfd_elf_set_section_contents PARAMS ((bfd *, sec_ptr, PTR,
|
||||
file_ptr,
|
||||
bfd_size_type));
|
||||
@ -801,6 +1013,8 @@ extern boolean _bfd_elf_find_nearest_line PARAMS ((bfd *, asection *,
|
||||
#define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
|
||||
extern int _bfd_elf_sizeof_headers PARAMS ((bfd *, boolean));
|
||||
extern boolean _bfd_elf_new_section_hook PARAMS ((bfd *, asection *));
|
||||
extern boolean _bfd_elf_init_reloc_shdr
|
||||
PARAMS ((bfd *, Elf_Internal_Shdr *, asection *, boolean));
|
||||
|
||||
/* If the target doesn't have reloc handling written yet: */
|
||||
extern void _bfd_elf_no_info_to_howto PARAMS ((bfd *, arelent *,
|
||||
@ -818,6 +1032,9 @@ struct bfd_strtab_hash *_bfd_elf_stringtab_init PARAMS ((void));
|
||||
boolean
|
||||
_bfd_elf_link_record_dynamic_symbol PARAMS ((struct bfd_link_info *,
|
||||
struct elf_link_hash_entry *));
|
||||
long
|
||||
_bfd_elf_link_lookup_local_dynindx PARAMS ((struct bfd_link_info *,
|
||||
bfd *, long));
|
||||
boolean
|
||||
_bfd_elf_compute_section_file_positions PARAMS ((bfd *,
|
||||
struct bfd_link_info *));
|
||||
@ -832,6 +1049,8 @@ boolean _bfd_elf_create_dynamic_sections PARAMS ((bfd *,
|
||||
struct bfd_link_info *));
|
||||
boolean _bfd_elf_create_got_section PARAMS ((bfd *,
|
||||
struct bfd_link_info *));
|
||||
unsigned long _bfd_elf_link_renumber_dynsyms PARAMS ((bfd *,
|
||||
struct bfd_link_info *));
|
||||
|
||||
elf_linker_section_t *_bfd_elf_create_linker_section
|
||||
PARAMS ((bfd *abfd,
|
||||
@ -883,6 +1102,9 @@ boolean _bfd_elf_make_linker_section_rela
|
||||
elf_linker_section_t *lsect,
|
||||
int alignment));
|
||||
|
||||
boolean _bfd_elfcore_section_from_phdr
|
||||
PARAMS ((bfd *, Elf_Internal_Phdr *, int));
|
||||
|
||||
extern const bfd_target *bfd_elf32_object_p PARAMS ((bfd *));
|
||||
extern const bfd_target *bfd_elf32_core_file_p PARAMS ((bfd *));
|
||||
extern char *bfd_elf32_core_file_failing_command PARAMS ((bfd *));
|
||||
@ -914,7 +1136,7 @@ extern void bfd_elf32_swap_phdr_out
|
||||
extern void bfd_elf32_swap_dyn_in
|
||||
PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
|
||||
extern void bfd_elf32_swap_dyn_out
|
||||
PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf32_External_Dyn *));
|
||||
PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
|
||||
extern long bfd_elf32_slurp_symbol_table
|
||||
PARAMS ((bfd *, asymbol **, boolean));
|
||||
extern boolean bfd_elf32_write_shdrs_and_ehdr PARAMS ((bfd *));
|
||||
@ -957,7 +1179,7 @@ extern void bfd_elf64_swap_phdr_out
|
||||
extern void bfd_elf64_swap_dyn_in
|
||||
PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));
|
||||
extern void bfd_elf64_swap_dyn_out
|
||||
PARAMS ((bfd *, const Elf_Internal_Dyn *, Elf64_External_Dyn *));
|
||||
PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));
|
||||
extern long bfd_elf64_slurp_symbol_table
|
||||
PARAMS ((bfd *, asymbol **, boolean));
|
||||
extern boolean bfd_elf64_write_shdrs_and_ehdr PARAMS ((bfd *));
|
||||
@ -970,16 +1192,48 @@ extern boolean bfd_elf64_link_create_dynamic_sections
|
||||
extern Elf_Internal_Rela *_bfd_elf64_link_read_relocs
|
||||
PARAMS ((bfd *, asection *, PTR, Elf_Internal_Rela *, boolean));
|
||||
|
||||
#define bfd_elf32_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
|
||||
#define bfd_elf64_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
|
||||
#define bfd_elf32_link_record_dynamic_symbol \
|
||||
_bfd_elf_link_record_dynamic_symbol
|
||||
#define bfd_elf64_link_record_dynamic_symbol \
|
||||
_bfd_elf_link_record_dynamic_symbol
|
||||
|
||||
boolean _bfd_elf32_link_record_local_dynamic_symbol
|
||||
PARAMS ((struct bfd_link_info *, bfd *, long));
|
||||
boolean _bfd_elf64_link_record_local_dynamic_symbol
|
||||
PARAMS ((struct bfd_link_info *, bfd *, long));
|
||||
|
||||
extern boolean _bfd_elf_close_and_cleanup PARAMS ((bfd *));
|
||||
extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
|
||||
PARAMS ((bfd *, arelent *, struct symbol_cache_entry *, PTR,
|
||||
asection *, bfd *, char **));
|
||||
|
||||
boolean _bfd_elf32_gc_sections
|
||||
PARAMS ((bfd *abfd, struct bfd_link_info *info));
|
||||
boolean _bfd_elf32_gc_common_finalize_got_offsets
|
||||
PARAMS ((bfd *abfd, struct bfd_link_info *info));
|
||||
boolean _bfd_elf32_gc_common_final_link
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
boolean _bfd_elf32_gc_record_vtinherit
|
||||
PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
|
||||
boolean _bfd_elf32_gc_record_vtentry
|
||||
PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
|
||||
|
||||
boolean _bfd_elf64_gc_sections
|
||||
PARAMS ((bfd *abfd, struct bfd_link_info *info));
|
||||
boolean _bfd_elf64_gc_common_finalize_got_offsets
|
||||
PARAMS ((bfd *abfd, struct bfd_link_info *info));
|
||||
boolean _bfd_elf64_gc_common_final_link
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
boolean _bfd_elf64_gc_record_vtinherit
|
||||
PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
|
||||
boolean _bfd_elf64_gc_record_vtentry
|
||||
PARAMS ((bfd *, asection *, struct elf_link_hash_entry *, bfd_vma));
|
||||
|
||||
/* MIPS ELF specific routines. */
|
||||
|
||||
extern boolean _bfd_mips_elf_object_p PARAMS ((bfd *));
|
||||
extern boolean _bfd_mips_elf_section_from_shdr
|
||||
PARAMS ((bfd *, Elf_Internal_Shdr *, const char *));
|
||||
PARAMS ((bfd *, Elf_Internal_Shdr *, char *));
|
||||
extern boolean _bfd_mips_elf_fake_sections
|
||||
PARAMS ((bfd *, Elf_Internal_Shdr *, asection *));
|
||||
extern boolean _bfd_mips_elf_section_from_bfd_section
|
||||
@ -1008,5 +1262,48 @@ extern boolean _bfd_mips_elf_find_nearest_line
|
||||
const char **, unsigned int *));
|
||||
extern boolean _bfd_mips_elf_set_section_contents
|
||||
PARAMS ((bfd *, asection *, PTR, file_ptr, bfd_size_type));
|
||||
extern boolean _bfd_mips_elf_create_dynamic_sections
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean _bfd_mips_elf_add_symbol_hook
|
||||
PARAMS ((bfd *, struct bfd_link_info *, const Elf_Internal_Sym *,
|
||||
const char **, flagword *, asection **, bfd_vma *));
|
||||
extern boolean _bfd_mips_elf_adjust_dynamic_symbol
|
||||
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
|
||||
extern boolean _bfd_mips_elf_finish_dynamic_symbol
|
||||
PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *,
|
||||
Elf_Internal_Sym *));
|
||||
extern boolean _bfd_mips_elf_finish_dynamic_sections
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern asection * _bfd_mips_elf_gc_mark_hook
|
||||
PARAMS ((bfd *, struct bfd_link_info *, Elf_Internal_Rela *,
|
||||
struct elf_link_hash_entry *, Elf_Internal_Sym *));
|
||||
extern boolean _bfd_mips_elf_gc_sweep_hook
|
||||
PARAMS ((bfd *, struct bfd_link_info *, asection *,
|
||||
const Elf_Internal_Rela *));
|
||||
extern boolean _bfd_mips_elf_always_size_sections
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean _bfd_mips_elf_size_dynamic_sections
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern boolean _bfd_mips_elf_check_relocs
|
||||
PARAMS ((bfd *, struct bfd_link_info *, asection *,
|
||||
const Elf_Internal_Rela *));
|
||||
extern struct bfd_link_hash_table *_bfd_mips_elf_link_hash_table_create
|
||||
PARAMS ((bfd *));
|
||||
extern boolean _bfd_mips_elf_print_private_bfd_data
|
||||
PARAMS ((bfd *, PTR));
|
||||
extern boolean _bfd_mips_elf_link_output_symbol_hook
|
||||
PARAMS ((bfd *, struct bfd_link_info *, const char *, Elf_Internal_Sym *,
|
||||
asection *));
|
||||
extern boolean _bfd_mips_elf_final_link
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
extern int _bfd_mips_elf_additional_program_headers PARAMS ((bfd *));
|
||||
extern boolean _bfd_mips_elf_modify_segment_map PARAMS ((bfd *));
|
||||
extern boolean _bfd_mips_elf_relocate_section
|
||||
PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *,
|
||||
Elf_Internal_Rela *, Elf_Internal_Sym *, asection **));
|
||||
|
||||
/* SH ELF specific routine. */
|
||||
|
||||
extern boolean _sh_elf_set_mach_from_flags PARAMS ((bfd *));
|
||||
|
||||
#endif /* _LIBELF_H_ */
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ARC-specific support for 32-bit ELF
|
||||
Copyright (C) 1994, 1995, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1994, 1995, 1997, 1999 Free Software Foundation, Inc.
|
||||
Contributed by Doug Evans (dje@cygnus.com).
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -25,7 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "elf/arc.h"
|
||||
|
||||
static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup
|
||||
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
|
||||
PARAMS ((bfd *abfd, bfd_reloc_code_real_type code));
|
||||
static void arc_info_to_howto_rel
|
||||
PARAMS ((bfd *, arelent *, Elf32_Internal_Rel *));
|
||||
static boolean arc_elf_object_p PARAMS ((bfd *));
|
||||
@ -103,7 +103,7 @@ static reloc_howto_type elf_arc_howto_table[] =
|
||||
|
||||
struct arc_reloc_map
|
||||
{
|
||||
unsigned char bfd_reloc_val;
|
||||
bfd_reloc_code_real_type bfd_reloc_val;
|
||||
unsigned char elf_reloc_val;
|
||||
};
|
||||
|
||||
@ -118,7 +118,7 @@ static const struct arc_reloc_map arc_reloc_map[] =
|
||||
|
||||
static reloc_howto_type *
|
||||
bfd_elf32_bfd_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
unsigned int i;
|
||||
@ -138,7 +138,7 @@ bfd_elf32_bfd_reloc_type_lookup (abfd, code)
|
||||
|
||||
static void
|
||||
arc_info_to_howto_rel (abfd, cache_ptr, dst)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *cache_ptr;
|
||||
Elf32_Internal_Rel *dst;
|
||||
{
|
||||
@ -178,7 +178,7 @@ arc_elf_object_p (abfd)
|
||||
static void
|
||||
arc_elf_final_write_processing (abfd, linker)
|
||||
bfd *abfd;
|
||||
boolean linker;
|
||||
boolean linker ATTRIBUTE_UNUSED;
|
||||
{
|
||||
int mach;
|
||||
unsigned long val;
|
||||
|
3239
contrib/binutils/bfd/elf32-arm.h
Normal file
3239
contrib/binutils/bfd/elf32-arm.h
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/* Generic support for 32-bit ELF
|
||||
Copyright 1993 Free Software Foundation, Inc.
|
||||
Copyright 1993, 1995, 1998, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
@ -22,8 +22,41 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "libbfd.h"
|
||||
#include "elf-bfd.h"
|
||||
|
||||
/* This does not include any relocations, but should be good enough
|
||||
for GDB to read the file. */
|
||||
/* This does not include any relocation information, but should be
|
||||
good enough for GDB or objdump to read the file. */
|
||||
|
||||
static reloc_howto_type dummy =
|
||||
HOWTO (0, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"UNKNOWN", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false); /* pcrel_offset */
|
||||
|
||||
static void
|
||||
elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *bfd_reloc;
|
||||
Elf32_Internal_Rela *elf_reloc ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_reloc->howto = &dummy;
|
||||
}
|
||||
|
||||
static void
|
||||
elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *bfd_reloc;
|
||||
Elf32_Internal_Rel *elf_reloc ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_reloc->howto = &dummy;
|
||||
}
|
||||
|
||||
#define TARGET_LITTLE_SYM bfd_elf32_little_generic_vec
|
||||
#define TARGET_LITTLE_NAME "elf32-little"
|
||||
@ -31,7 +64,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#define TARGET_BIG_NAME "elf32-big"
|
||||
#define ELF_ARCH bfd_arch_unknown
|
||||
#define ELF_MACHINE_CODE EM_NONE
|
||||
#define ELF_MAXPAGESIZE 0x1
|
||||
#define bfd_elf32_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
|
||||
#define elf_info_to_howto _bfd_elf_no_info_to_howto
|
||||
#define elf_info_to_howto elf_generic_info_to_howto
|
||||
#define elf_info_to_howto_rel elf_generic_info_to_howto_rel
|
||||
|
||||
#include "elf32-target.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
3761
contrib/binutils/bfd/elf32-ppc.c
Normal file
3761
contrib/binutils/bfd/elf32-ppc.c
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,6 @@
|
||||
/* SPARC-specific support for 32-bit ELF
|
||||
Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 94, 95, 96, 97, 98, 99, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
@ -33,8 +34,6 @@ static boolean elf32_sparc_check_relocs
|
||||
const Elf_Internal_Rela *));
|
||||
static boolean elf32_sparc_adjust_dynamic_symbol
|
||||
PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *));
|
||||
static boolean elf32_sparc_adjust_dynindx
|
||||
PARAMS ((struct elf_link_hash_entry *, PTR));
|
||||
static boolean elf32_sparc_size_dynamic_sections
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
static boolean elf32_sparc_relocate_section
|
||||
@ -109,11 +108,27 @@ reloc_howto_type _bfd_sparc_elf_howto_table[] =
|
||||
HOWTO(R_SPARC_UNUSED_42, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_UNUSED_42",false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_7, 0,2, 7,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_7", false,0,0x0000007f,true),
|
||||
HOWTO(R_SPARC_5, 0,2, 5,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_5", false,0,0x0000001f,true),
|
||||
HOWTO(R_SPARC_6, 0,2, 6,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_6", false,0,0x0000003f,true)
|
||||
HOWTO(R_SPARC_6, 0,2, 6,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_6", false,0,0x0000003f,true),
|
||||
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_NONE, 0,0, 0,false,0,complain_overflow_dont, bfd_elf_generic_reloc, "R_SPARC_NONE", false,0,0x00000000,true),
|
||||
HOWTO(R_SPARC_REV32, 0,2,32,false,0,complain_overflow_bitfield,bfd_elf_generic_reloc, "R_SPARC_REV32", false,0,0xffffffff,true),
|
||||
};
|
||||
static reloc_howto_type elf32_sparc_vtinherit_howto =
|
||||
HOWTO (R_SPARC_GNU_VTINHERIT, 0,2,0,false,0,complain_overflow_dont, NULL, "R_SPARC_GNU_VTINHERIT", false,0, 0, false);
|
||||
static reloc_howto_type elf32_sparc_vtentry_howto =
|
||||
HOWTO (R_SPARC_GNU_VTENTRY, 0,2,0,false,0,complain_overflow_dont, _bfd_elf_rel_vtable_reloc_fn,"R_SPARC_GNU_VTENTRY", false,0,0, false);
|
||||
|
||||
|
||||
struct elf_reloc_map {
|
||||
unsigned char bfd_reloc_val;
|
||||
bfd_reloc_code_real_type bfd_reloc_val;
|
||||
unsigned char elf_reloc_val;
|
||||
};
|
||||
|
||||
@ -158,21 +173,36 @@ static CONST struct elf_reloc_map sparc_reloc_map[] =
|
||||
{BFD_RELOC_SPARC_WDISP19, R_SPARC_WDISP19},
|
||||
{BFD_RELOC_SPARC_7, R_SPARC_7},
|
||||
{BFD_RELOC_SPARC_5, R_SPARC_5},
|
||||
{BFD_RELOC_SPARC_6, R_SPARC_6}
|
||||
{BFD_RELOC_SPARC_6, R_SPARC_6},
|
||||
{BFD_RELOC_SPARC_REV32, R_SPARC_REV32 },
|
||||
{BFD_RELOC_VTABLE_INHERIT, R_SPARC_GNU_VTINHERIT},
|
||||
{BFD_RELOC_VTABLE_ENTRY, R_SPARC_GNU_VTENTRY},
|
||||
};
|
||||
|
||||
static reloc_howto_type *
|
||||
elf32_sparc_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
unsigned int i;
|
||||
for (i = 0; i < sizeof (sparc_reloc_map) / sizeof (struct elf_reloc_map); i++)
|
||||
|
||||
switch (code)
|
||||
{
|
||||
if (sparc_reloc_map[i].bfd_reloc_val == code)
|
||||
return &_bfd_sparc_elf_howto_table[(int) sparc_reloc_map[i].elf_reloc_val];
|
||||
case BFD_RELOC_VTABLE_INHERIT:
|
||||
return &elf32_sparc_vtinherit_howto;
|
||||
|
||||
case BFD_RELOC_VTABLE_ENTRY:
|
||||
return &elf32_sparc_vtentry_howto;
|
||||
|
||||
default:
|
||||
for (i = 0; i < sizeof (sparc_reloc_map) / sizeof (struct elf_reloc_map); i++)
|
||||
{
|
||||
if (sparc_reloc_map[i].bfd_reloc_val == code)
|
||||
return &_bfd_sparc_elf_howto_table[(int) sparc_reloc_map[i].elf_reloc_val];
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* We need to use ELF32_R_TYPE so we have our own copy of this function,
|
||||
@ -180,12 +210,24 @@ elf32_sparc_reloc_type_lookup (abfd, code)
|
||||
|
||||
static void
|
||||
elf32_sparc_info_to_howto (abfd, cache_ptr, dst)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *cache_ptr;
|
||||
Elf_Internal_Rela *dst;
|
||||
{
|
||||
BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_SPARC_max);
|
||||
cache_ptr->howto = &_bfd_sparc_elf_howto_table[ELF32_R_TYPE(dst->r_info)];
|
||||
switch (ELF32_R_TYPE(dst->r_info))
|
||||
{
|
||||
case R_SPARC_GNU_VTINHERIT:
|
||||
cache_ptr->howto = &elf32_sparc_vtinherit_howto;
|
||||
break;
|
||||
|
||||
case R_SPARC_GNU_VTENTRY:
|
||||
cache_ptr->howto = &elf32_sparc_vtentry_howto;
|
||||
break;
|
||||
|
||||
default:
|
||||
BFD_ASSERT (ELF32_R_TYPE(dst->r_info) < (unsigned int) R_SPARC_max_std);
|
||||
cache_ptr->howto = &_bfd_sparc_elf_howto_table[ELF32_R_TYPE(dst->r_info)];
|
||||
}
|
||||
}
|
||||
|
||||
/* For unsupported relocs. */
|
||||
@ -198,13 +240,13 @@ sparc_elf_notsupported_reloc (abfd,
|
||||
input_section,
|
||||
output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *reloc_entry ATTRIBUTE_UNUSED;
|
||||
asymbol *symbol ATTRIBUTE_UNUSED;
|
||||
PTR data ATTRIBUTE_UNUSED;
|
||||
asection *input_section ATTRIBUTE_UNUSED;
|
||||
bfd *output_bfd ATTRIBUTE_UNUSED;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return bfd_reloc_notsupported;
|
||||
}
|
||||
@ -225,7 +267,7 @@ sparc_elf_wdisp16_reloc (abfd,
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_vma relocation;
|
||||
bfd_vma x;
|
||||
@ -380,12 +422,12 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
|
||||
|
||||
if (h != NULL)
|
||||
{
|
||||
if (h->got_offset != (bfd_vma) -1)
|
||||
if (h->got.offset != (bfd_vma) -1)
|
||||
{
|
||||
/* We have already allocated space in the .got. */
|
||||
break;
|
||||
}
|
||||
h->got_offset = sgot->_raw_size;
|
||||
h->got.offset = sgot->_raw_size;
|
||||
|
||||
/* Make sure this symbol is output as a dynamic symbol. */
|
||||
if (h->dynindx == -1)
|
||||
@ -449,10 +491,11 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
|
||||
|
||||
if (h == NULL)
|
||||
{
|
||||
/* It does not make sense to have a procedure linkage
|
||||
table entry for a local symbol. */
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
/* The Solaris native assembler will generate a WPLT30
|
||||
reloc for a local symbol if you assemble a call from
|
||||
one section to another when using -K pic. We treat
|
||||
it as WDISP30. */
|
||||
break;
|
||||
}
|
||||
|
||||
/* Make sure this symbol is output as a dynamic symbol. */
|
||||
@ -468,6 +511,9 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
|
||||
|
||||
case R_SPARC_PC10:
|
||||
case R_SPARC_PC22:
|
||||
if (h != NULL)
|
||||
h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
|
||||
|
||||
if (h != NULL
|
||||
&& strcmp (h->root.root.string, "_GLOBAL_OFFSET_TABLE_") == 0)
|
||||
break;
|
||||
@ -479,6 +525,9 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
|
||||
case R_SPARC_WDISP22:
|
||||
case R_SPARC_WDISP19:
|
||||
case R_SPARC_WDISP16:
|
||||
if (h != NULL)
|
||||
h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
|
||||
|
||||
/* If we are linking with -Bsymbolic, we do not need to copy
|
||||
a PC relative reloc against a global symbol which is
|
||||
defined in an object we are including in the link (i.e.,
|
||||
@ -501,6 +550,9 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
|
||||
case R_SPARC_13:
|
||||
case R_SPARC_LO10:
|
||||
case R_SPARC_UA32:
|
||||
if (h != NULL)
|
||||
h->elf_link_hash_flags |= ELF_LINK_NON_GOT_REF;
|
||||
|
||||
if (info->shared)
|
||||
{
|
||||
/* When creating a shared object, we must copy these
|
||||
@ -543,6 +595,16 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
|
||||
|
||||
break;
|
||||
|
||||
case R_SPARC_GNU_VTINHERIT:
|
||||
if (!_bfd_elf32_gc_record_vtinherit (abfd, sec, h, rel->r_offset))
|
||||
return false;
|
||||
break;
|
||||
|
||||
case R_SPARC_GNU_VTENTRY:
|
||||
if (!_bfd_elf32_gc_record_vtentry (abfd, sec, h, rel->r_addend))
|
||||
return false;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -551,6 +613,114 @@ elf32_sparc_check_relocs (abfd, info, sec, relocs)
|
||||
return true;
|
||||
}
|
||||
|
||||
static asection *
|
||||
elf32_sparc_gc_mark_hook (abfd, info, rel, h, sym)
|
||||
bfd *abfd;
|
||||
struct bfd_link_info *info ATTRIBUTE_UNUSED;
|
||||
Elf_Internal_Rela *rel;
|
||||
struct elf_link_hash_entry *h;
|
||||
Elf_Internal_Sym *sym;
|
||||
{
|
||||
|
||||
if (h != NULL)
|
||||
{
|
||||
switch (ELF32_R_TYPE (rel->r_info))
|
||||
{
|
||||
case R_SPARC_GNU_VTINHERIT:
|
||||
case R_SPARC_GNU_VTENTRY:
|
||||
break;
|
||||
|
||||
default:
|
||||
switch (h->root.type)
|
||||
{
|
||||
case bfd_link_hash_defined:
|
||||
case bfd_link_hash_defweak:
|
||||
return h->root.u.def.section;
|
||||
|
||||
case bfd_link_hash_common:
|
||||
return h->root.u.c.p->section;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!(elf_bad_symtab (abfd)
|
||||
&& ELF_ST_BIND (sym->st_info) != STB_LOCAL)
|
||||
&& ! ((sym->st_shndx <= 0 || sym->st_shndx >= SHN_LORESERVE)
|
||||
&& sym->st_shndx != SHN_COMMON))
|
||||
{
|
||||
return bfd_section_from_elf_index (abfd, sym->st_shndx);
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Update the got entry reference counts for the section being removed. */
|
||||
static boolean
|
||||
elf32_sparc_gc_sweep_hook (abfd, info, sec, relocs)
|
||||
bfd *abfd;
|
||||
struct bfd_link_info *info ATTRIBUTE_UNUSED;
|
||||
asection *sec;
|
||||
const Elf_Internal_Rela *relocs;
|
||||
{
|
||||
|
||||
Elf_Internal_Shdr *symtab_hdr;
|
||||
struct elf_link_hash_entry **sym_hashes;
|
||||
bfd_signed_vma *local_got_refcounts;
|
||||
const Elf_Internal_Rela *rel, *relend;
|
||||
unsigned long r_symndx;
|
||||
struct elf_link_hash_entry *h;
|
||||
|
||||
symtab_hdr = &elf_tdata (abfd)->symtab_hdr;
|
||||
sym_hashes = elf_sym_hashes (abfd);
|
||||
local_got_refcounts = elf_local_got_refcounts (abfd);
|
||||
|
||||
relend = relocs + sec->reloc_count;
|
||||
for (rel = relocs; rel < relend; rel++)
|
||||
switch (ELF32_R_TYPE (rel->r_info))
|
||||
{
|
||||
case R_SPARC_GOT10:
|
||||
case R_SPARC_GOT13:
|
||||
case R_SPARC_GOT22:
|
||||
r_symndx = ELF32_R_SYM (rel->r_info);
|
||||
if (r_symndx >= symtab_hdr->sh_info)
|
||||
{
|
||||
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
|
||||
if (h->got.refcount > 0)
|
||||
h->got.refcount--;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (local_got_refcounts[r_symndx] > 0)
|
||||
local_got_refcounts[r_symndx]--;
|
||||
}
|
||||
break;
|
||||
|
||||
case R_SPARC_PLT32:
|
||||
case R_SPARC_HIPLT22:
|
||||
case R_SPARC_LOPLT10:
|
||||
case R_SPARC_PCPLT32:
|
||||
case R_SPARC_PCPLT10:
|
||||
r_symndx = ELF32_R_SYM (rel->r_info);
|
||||
if (r_symndx >= symtab_hdr->sh_info)
|
||||
{
|
||||
h = sym_hashes[r_symndx - symtab_hdr->sh_info];
|
||||
if (h->plt.refcount > 0)
|
||||
h->plt.refcount--;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Adjust a symbol defined by a dynamic object and referenced by a
|
||||
regular object. The current definition is in some section of the
|
||||
dynamic object, but we're not including those sections. We have to
|
||||
@ -638,7 +808,7 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
|
||||
h->root.u.def.value = s->_raw_size;
|
||||
}
|
||||
|
||||
h->plt_offset = s->_raw_size;
|
||||
h->plt.offset = s->_raw_size;
|
||||
|
||||
/* Make room for this entry. */
|
||||
s->_raw_size += PLT_ENTRY_SIZE;
|
||||
@ -674,6 +844,11 @@ elf32_sparc_adjust_dynamic_symbol (info, h)
|
||||
if (info->shared)
|
||||
return true;
|
||||
|
||||
/* If there are no references to this symbol that do not use the
|
||||
GOT, we don't need to generate a copy reloc. */
|
||||
if ((h->elf_link_hash_flags & ELF_LINK_NON_GOT_REF) == 0)
|
||||
return true;
|
||||
|
||||
/* We must allocate the symbol in our .dynbss section, which will
|
||||
become part of the .bss section of the executable. There will be
|
||||
an entry for this symbol in the .dynsym section. The dynamic
|
||||
@ -836,15 +1011,7 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
|
||||
|
||||
if (strip)
|
||||
{
|
||||
asection **spp;
|
||||
|
||||
for (spp = &s->output_section->owner->sections;
|
||||
*spp != s->output_section;
|
||||
spp = &(*spp)->next)
|
||||
;
|
||||
*spp = s->output_section->next;
|
||||
--s->output_section->owner->section_count;
|
||||
|
||||
_bfd_strip_section_from_output (info, s);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -889,51 +1056,6 @@ elf32_sparc_size_dynamic_sections (output_bfd, info)
|
||||
}
|
||||
}
|
||||
|
||||
/* If we are generating a shared library, we generate a section
|
||||
symbol for each output section for which we might need to copy
|
||||
relocs. These are local symbols, which means that they must come
|
||||
first in the dynamic symbol table. That means we must increment
|
||||
the dynamic symbol index of every other dynamic symbol. */
|
||||
if (info->shared)
|
||||
{
|
||||
int c;
|
||||
|
||||
c = 0;
|
||||
for (s = output_bfd->sections; s != NULL; s = s->next)
|
||||
{
|
||||
if ((s->flags & SEC_LINKER_CREATED) != 0
|
||||
|| (s->flags & SEC_ALLOC) == 0)
|
||||
continue;
|
||||
|
||||
elf_section_data (s)->dynindx = c + 1;
|
||||
|
||||
/* These symbols will have no names, so we don't need to
|
||||
fiddle with dynstr_index. */
|
||||
|
||||
++c;
|
||||
}
|
||||
|
||||
elf_link_hash_traverse (elf_hash_table (info),
|
||||
elf32_sparc_adjust_dynindx,
|
||||
(PTR) &c);
|
||||
elf_hash_table (info)->dynsymcount += c;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Increment the index of a dynamic symbol by a given amount. Called
|
||||
via elf_link_hash_traverse. */
|
||||
|
||||
static boolean
|
||||
elf32_sparc_adjust_dynindx (h, cparg)
|
||||
struct elf_link_hash_entry *h;
|
||||
PTR cparg;
|
||||
{
|
||||
int *cp = (int *) cparg;
|
||||
|
||||
if (h->dynindx != -1)
|
||||
h->dynindx += *cp;
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -990,7 +1112,12 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
bfd_reloc_status_type r;
|
||||
|
||||
r_type = ELF32_R_TYPE (rel->r_info);
|
||||
if (r_type < 0 || r_type >= (int) R_SPARC_max)
|
||||
|
||||
if (r_type == R_SPARC_GNU_VTINHERIT
|
||||
|| r_type == R_SPARC_GNU_VTENTRY)
|
||||
continue;
|
||||
|
||||
if (r_type < 0 || r_type >= (int) R_SPARC_max_std)
|
||||
{
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
@ -1041,7 +1168,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
{
|
||||
sec = h->root.u.def.section;
|
||||
if ((r_type == R_SPARC_WPLT30
|
||||
&& h->plt_offset != (bfd_vma) -1)
|
||||
&& h->plt.offset != (bfd_vma) -1)
|
||||
|| ((r_type == R_SPARC_GOT10
|
||||
|| r_type == R_SPARC_GOT13
|
||||
|| r_type == R_SPARC_GOT22)
|
||||
@ -1086,13 +1213,14 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
}
|
||||
else if (h->root.type == bfd_link_hash_undefweak)
|
||||
relocation = 0;
|
||||
else if (info->shared && !info->symbolic)
|
||||
else if (info->shared && !info->symbolic && !info->no_undefined)
|
||||
relocation = 0;
|
||||
else
|
||||
{
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.string, input_bfd,
|
||||
input_section, rel->r_offset)))
|
||||
input_section, rel->r_offset,
|
||||
(!info->shared || info->no_undefined))))
|
||||
return false;
|
||||
relocation = 0;
|
||||
}
|
||||
@ -1115,7 +1243,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
{
|
||||
bfd_vma off;
|
||||
|
||||
off = h->got_offset;
|
||||
off = h->got.offset;
|
||||
BFD_ASSERT (off != (bfd_vma) -1);
|
||||
|
||||
if (! elf_hash_table (info)->dynamic_sections_created
|
||||
@ -1141,7 +1269,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
{
|
||||
bfd_put_32 (output_bfd, relocation,
|
||||
sgot->contents + off);
|
||||
h->got_offset |= 1;
|
||||
h->got.offset |= 1;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1198,9 +1326,15 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
case R_SPARC_WPLT30:
|
||||
/* Relocation is to the entry for this symbol in the
|
||||
procedure linkage table. */
|
||||
BFD_ASSERT (h != NULL);
|
||||
|
||||
if (h->plt_offset == (bfd_vma) -1)
|
||||
/* The Solaris native assembler will generate a WPLT30 reloc
|
||||
for a local symbol if you assemble a call from one
|
||||
section to another when using -K pic. We treat it as
|
||||
WDISP30. */
|
||||
if (h == NULL)
|
||||
break;
|
||||
|
||||
if (h->plt.offset == (bfd_vma) -1)
|
||||
{
|
||||
/* We didn't make a PLT entry for this symbol. This
|
||||
happens when statically linking PIC code, or when
|
||||
@ -1216,7 +1350,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
|
||||
relocation = (splt->output_section->vma
|
||||
+ splt->output_offset
|
||||
+ h->plt_offset);
|
||||
+ h->plt.offset);
|
||||
break;
|
||||
|
||||
case R_SPARC_PC10:
|
||||
@ -1349,7 +1483,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
{
|
||||
BFD_FAIL ();
|
||||
(*_bfd_error_handler)
|
||||
("%s: probably compiled without -fPIC?",
|
||||
(_("%s: probably compiled without -fPIC?"),
|
||||
bfd_get_filename (input_bfd));
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
@ -1381,11 +1515,7 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
break;
|
||||
}
|
||||
|
||||
if (r_type != R_SPARC_WDISP16)
|
||||
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
|
||||
contents, rel->r_offset,
|
||||
relocation, rel->r_addend);
|
||||
else
|
||||
if (r_type == R_SPARC_WDISP16)
|
||||
{
|
||||
bfd_vma x;
|
||||
|
||||
@ -1405,6 +1535,22 @@ elf32_sparc_relocate_section (output_bfd, info, input_bfd, input_section,
|
||||
else
|
||||
r = bfd_reloc_ok;
|
||||
}
|
||||
else if (r_type == R_SPARC_REV32)
|
||||
{
|
||||
bfd_vma x;
|
||||
|
||||
relocation = relocation + rel->r_addend;
|
||||
|
||||
x = bfd_get_32 (input_bfd, contents + rel->r_offset);
|
||||
x = x + relocation;
|
||||
bfd_putl32 (/*input_bfd,*/ x, contents + rel->r_offset);
|
||||
r = bfd_reloc_ok;
|
||||
}
|
||||
else
|
||||
r = _bfd_final_link_relocate (howto, input_bfd, input_section,
|
||||
contents, rel->r_offset,
|
||||
relocation, rel->r_addend);
|
||||
|
||||
|
||||
if (r != bfd_reloc_ok)
|
||||
{
|
||||
@ -1456,7 +1602,7 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
|
||||
|
||||
dynobj = elf_hash_table (info)->dynobj;
|
||||
|
||||
if (h->plt_offset != (bfd_vma) -1)
|
||||
if (h->plt.offset != (bfd_vma) -1)
|
||||
{
|
||||
asection *splt;
|
||||
asection *srela;
|
||||
@ -1473,24 +1619,24 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
|
||||
|
||||
/* Fill in the entry in the procedure linkage table. */
|
||||
bfd_put_32 (output_bfd,
|
||||
PLT_ENTRY_WORD0 + h->plt_offset,
|
||||
splt->contents + h->plt_offset);
|
||||
PLT_ENTRY_WORD0 + h->plt.offset,
|
||||
splt->contents + h->plt.offset);
|
||||
bfd_put_32 (output_bfd,
|
||||
(PLT_ENTRY_WORD1
|
||||
+ (((- (h->plt_offset + 4)) >> 2) & 0x3fffff)),
|
||||
splt->contents + h->plt_offset + 4);
|
||||
+ (((- (h->plt.offset + 4)) >> 2) & 0x3fffff)),
|
||||
splt->contents + h->plt.offset + 4);
|
||||
bfd_put_32 (output_bfd, PLT_ENTRY_WORD2,
|
||||
splt->contents + h->plt_offset + 8);
|
||||
splt->contents + h->plt.offset + 8);
|
||||
|
||||
/* Fill in the entry in the .rela.plt section. */
|
||||
rela.r_offset = (splt->output_section->vma
|
||||
+ splt->output_offset
|
||||
+ h->plt_offset);
|
||||
+ h->plt.offset);
|
||||
rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_JMP_SLOT);
|
||||
rela.r_addend = 0;
|
||||
bfd_elf32_swap_reloca_out (output_bfd, &rela,
|
||||
((Elf32_External_Rela *) srela->contents
|
||||
+ h->plt_offset / PLT_ENTRY_SIZE - 4));
|
||||
+ h->plt.offset / PLT_ENTRY_SIZE - 4));
|
||||
|
||||
if ((h->elf_link_hash_flags & ELF_LINK_HASH_DEF_REGULAR) == 0)
|
||||
{
|
||||
@ -1500,7 +1646,7 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
|
||||
}
|
||||
}
|
||||
|
||||
if (h->got_offset != (bfd_vma) -1)
|
||||
if (h->got.offset != (bfd_vma) -1)
|
||||
{
|
||||
asection *sgot;
|
||||
asection *srela;
|
||||
@ -1515,7 +1661,7 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
|
||||
|
||||
rela.r_offset = (sgot->output_section->vma
|
||||
+ sgot->output_offset
|
||||
+ (h->got_offset &~ 1));
|
||||
+ (h->got.offset &~ 1));
|
||||
|
||||
/* If this is a -Bsymbolic link, and the symbol is defined
|
||||
locally, we just want to emit a RELATIVE reloc. Likewise if
|
||||
@ -1528,7 +1674,7 @@ elf32_sparc_finish_dynamic_symbol (output_bfd, info, h, sym)
|
||||
rela.r_info = ELF32_R_INFO (0, R_SPARC_RELATIVE);
|
||||
else
|
||||
{
|
||||
bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got_offset);
|
||||
bfd_put_32 (output_bfd, (bfd_vma) 0, sgot->contents + h->got.offset);
|
||||
rela.r_info = ELF32_R_INFO (h->dynindx, R_SPARC_GLOB_DAT);
|
||||
}
|
||||
|
||||
@ -1665,50 +1811,6 @@ elf32_sparc_finish_dynamic_sections (output_bfd, info)
|
||||
|
||||
elf_section_data (sgot->output_section)->this_hdr.sh_entsize = 4;
|
||||
|
||||
if (info->shared)
|
||||
{
|
||||
asection *sdynsym;
|
||||
asection *s;
|
||||
Elf_Internal_Sym sym;
|
||||
int c;
|
||||
|
||||
/* Set up the section symbols for the output sections. */
|
||||
|
||||
sdynsym = bfd_get_section_by_name (dynobj, ".dynsym");
|
||||
BFD_ASSERT (sdynsym != NULL);
|
||||
|
||||
sym.st_size = 0;
|
||||
sym.st_name = 0;
|
||||
sym.st_info = ELF_ST_INFO (STB_LOCAL, STT_SECTION);
|
||||
sym.st_other = 0;
|
||||
|
||||
c = 0;
|
||||
for (s = output_bfd->sections; s != NULL; s = s->next)
|
||||
{
|
||||
int indx;
|
||||
|
||||
if (elf_section_data (s)->dynindx == 0)
|
||||
continue;
|
||||
|
||||
sym.st_value = s->vma;
|
||||
|
||||
indx = elf_section_data (s)->this_idx;
|
||||
BFD_ASSERT (indx > 0);
|
||||
sym.st_shndx = indx;
|
||||
|
||||
bfd_elf32_swap_symbol_out (output_bfd, &sym,
|
||||
(PTR) (((Elf32_External_Sym *)
|
||||
sdynsym->contents)
|
||||
+ elf_section_data (s)->dynindx));
|
||||
|
||||
++c;
|
||||
}
|
||||
|
||||
/* Set the sh_info field of the output .dynsym section to the
|
||||
index of the first global symbol. */
|
||||
elf_section_data (sdynsym->output_section)->this_hdr.sh_info = c + 1;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1728,6 +1830,8 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd)
|
||||
bfd *obfd;
|
||||
{
|
||||
boolean error;
|
||||
/* FIXME: This should not be static. */
|
||||
static unsigned long previous_ibfd_e_flags = (unsigned long) -1;
|
||||
|
||||
if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
|
||||
|| bfd_get_flavour (obfd) != bfd_target_elf_flavour)
|
||||
@ -1749,7 +1853,7 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd)
|
||||
{
|
||||
error = true;
|
||||
(*_bfd_error_handler)
|
||||
("%s: compiled for a v8plus system and target is v8",
|
||||
(_("%s: compiled for a v8plus system and target is v8"),
|
||||
bfd_get_filename (ibfd));
|
||||
}
|
||||
/* If the output machine is v9, we can't allow v9+vis input files. */
|
||||
@ -1758,7 +1862,7 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd)
|
||||
{
|
||||
error = true;
|
||||
(*_bfd_error_handler)
|
||||
("%s: compiled for a v8plusa system and target is v8plus",
|
||||
(_("%s: compiled for a v8plusa system and target is v8plus"),
|
||||
bfd_get_filename (ibfd));
|
||||
}
|
||||
#else
|
||||
@ -1766,13 +1870,27 @@ elf32_sparc_merge_private_bfd_data (ibfd, obfd)
|
||||
{
|
||||
error = true;
|
||||
(*_bfd_error_handler)
|
||||
("%s: compiled for a 64 bit system and target is 32 bit",
|
||||
(_("%s: compiled for a 64 bit system and target is 32 bit"),
|
||||
bfd_get_filename (ibfd));
|
||||
}
|
||||
else if (bfd_get_mach (obfd) < bfd_get_mach (ibfd))
|
||||
bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd));
|
||||
else if ((ibfd->flags & DYNAMIC) == 0)
|
||||
{
|
||||
if (bfd_get_mach (obfd) < bfd_get_mach (ibfd))
|
||||
bfd_set_arch_mach (obfd, bfd_arch_sparc, bfd_get_mach (ibfd));
|
||||
}
|
||||
#endif
|
||||
|
||||
if (((elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA)
|
||||
!= previous_ibfd_e_flags)
|
||||
&& previous_ibfd_e_flags != (unsigned long) -1)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
(_("%s: linking little endian files with big endian files"),
|
||||
bfd_get_filename (ibfd));
|
||||
error = true;
|
||||
}
|
||||
previous_ibfd_e_flags = elf_elfheader (ibfd)->e_flags & EF_SPARC_LEDATA;
|
||||
|
||||
if (error)
|
||||
{
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
@ -1799,6 +1917,9 @@ elf32_sparc_object_p (abfd)
|
||||
else
|
||||
return false;
|
||||
}
|
||||
else if (elf_elfheader (abfd)->e_flags & EF_SPARC_LEDATA)
|
||||
return bfd_default_set_arch_mach (abfd, bfd_arch_sparc,
|
||||
bfd_mach_sparc_sparclite_le);
|
||||
else
|
||||
return bfd_default_set_arch_mach (abfd, bfd_arch_sparc, bfd_mach_sparc);
|
||||
}
|
||||
@ -1809,7 +1930,7 @@ elf32_sparc_object_p (abfd)
|
||||
static void
|
||||
elf32_sparc_final_write_processing (abfd, linker)
|
||||
bfd *abfd;
|
||||
boolean linker;
|
||||
boolean linker ATTRIBUTE_UNUSED;
|
||||
{
|
||||
switch (bfd_get_mach (abfd))
|
||||
{
|
||||
@ -1825,8 +1946,13 @@ elf32_sparc_final_write_processing (abfd, linker)
|
||||
elf_elfheader (abfd)->e_flags &=~ EF_SPARC_32PLUS_MASK;
|
||||
elf_elfheader (abfd)->e_flags |= EF_SPARC_32PLUS | EF_SPARC_SUN_US1;
|
||||
break;
|
||||
case bfd_mach_sparc_sparclite_le :
|
||||
elf_elfheader (abfd)->e_machine = EM_SPARC;
|
||||
elf_elfheader (abfd)->e_flags |= EF_SPARC_LEDATA;
|
||||
break;
|
||||
default :
|
||||
abort ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1856,8 +1982,14 @@ elf32_sparc_final_write_processing (abfd, linker)
|
||||
#define elf_backend_object_p elf32_sparc_object_p
|
||||
#define elf_backend_final_write_processing \
|
||||
elf32_sparc_final_write_processing
|
||||
#define elf_backend_gc_mark_hook elf32_sparc_gc_mark_hook
|
||||
#define elf_backend_gc_sweep_hook elf32_sparc_gc_sweep_hook
|
||||
|
||||
#define elf_backend_can_gc_sections 1
|
||||
#define elf_backend_want_got_plt 0
|
||||
#define elf_backend_plt_readonly 0
|
||||
#define elf_backend_want_plt_sym 1
|
||||
#define elf_backend_got_header_size 4
|
||||
#define elf_backend_plt_header_size (4*PLT_ENTRY_SIZE)
|
||||
|
||||
#include "elf32-target.h"
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,5 +1,5 @@
|
||||
/* Generic support for 64-bit ELF
|
||||
Copyright 1993 Free Software Foundation, Inc.
|
||||
Copyright 1993, 1995, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
@ -22,8 +22,41 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "libbfd.h"
|
||||
#include "elf-bfd.h"
|
||||
|
||||
/* This does not include any relocations, but should be good enough
|
||||
for GDB to read the file. */
|
||||
/* This does not include any relocation information, but should be
|
||||
good enough for GDB or objdump to read the file. */
|
||||
|
||||
static reloc_howto_type dummy =
|
||||
HOWTO (0, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"UNKNOWN", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false); /* pcrel_offset */
|
||||
|
||||
static void
|
||||
elf_generic_info_to_howto (abfd, bfd_reloc, elf_reloc)
|
||||
bfd *abfd;
|
||||
arelent *bfd_reloc;
|
||||
Elf64_Internal_Rela *elf_reloc;
|
||||
{
|
||||
bfd_reloc->howto = &dummy;
|
||||
}
|
||||
|
||||
static void
|
||||
elf_generic_info_to_howto_rel (abfd, bfd_reloc, elf_reloc)
|
||||
bfd *abfd;
|
||||
arelent *bfd_reloc;
|
||||
Elf64_Internal_Rel *elf_reloc;
|
||||
{
|
||||
bfd_reloc->howto = &dummy;
|
||||
}
|
||||
|
||||
#define TARGET_LITTLE_SYM bfd_elf64_little_generic_vec
|
||||
#define TARGET_LITTLE_NAME "elf64-little"
|
||||
@ -31,7 +64,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#define TARGET_BIG_NAME "elf64-big"
|
||||
#define ELF_ARCH bfd_arch_unknown
|
||||
#define ELF_MACHINE_CODE EM_NONE
|
||||
#define ELF_MAXPAGESIZE 0x1
|
||||
#define bfd_elf64_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
|
||||
#define elf_info_to_howto _bfd_elf_no_info_to_howto
|
||||
#define elf_info_to_howto elf_generic_info_to_howto
|
||||
#define elf_info_to_howto_rel elf_generic_info_to_howto_rel
|
||||
|
||||
#include "elf64-target.h"
|
||||
|
@ -1,6 +1,8 @@
|
||||
/* MIPS-specific support for 64-bit ELF
|
||||
Copyright 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
Ian Lance Taylor, Cygnus Support
|
||||
Linker support added by Mark Mitchell, CodeSourcery, LLC.
|
||||
<mark@codesourcery.com>
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
@ -52,14 +54,20 @@ static void mips_elf64_swap_reloc_in
|
||||
static void mips_elf64_swap_reloca_in
|
||||
PARAMS ((bfd *, const Elf64_Mips_External_Rela *,
|
||||
Elf64_Mips_Internal_Rela *));
|
||||
#if 0
|
||||
static void mips_elf64_swap_reloc_out
|
||||
PARAMS ((bfd *, const Elf64_Mips_Internal_Rel *,
|
||||
Elf64_Mips_External_Rel *));
|
||||
#endif
|
||||
static void mips_elf64_swap_reloca_out
|
||||
PARAMS ((bfd *, const Elf64_Mips_Internal_Rela *,
|
||||
Elf64_Mips_External_Rela *));
|
||||
static void mips_elf64_be_swap_reloc_in
|
||||
PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rel *));
|
||||
static void mips_elf64_be_swap_reloc_out
|
||||
PARAMS ((bfd *, const Elf_Internal_Rel *, bfd_byte *));
|
||||
static void mips_elf64_be_swap_reloca_in
|
||||
PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));
|
||||
static void mips_elf64_be_swap_reloca_out
|
||||
PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));
|
||||
static reloc_howto_type *mips_elf64_reloc_type_lookup
|
||||
PARAMS ((bfd *, bfd_reloc_code_real_type));
|
||||
static long mips_elf64_get_reloc_upper_bound PARAMS ((bfd *, asection *));
|
||||
@ -68,63 +76,17 @@ static boolean mips_elf64_slurp_one_reloc_table
|
||||
static boolean mips_elf64_slurp_reloc_table
|
||||
PARAMS ((bfd *, asection *, asymbol **, boolean));
|
||||
static void mips_elf64_write_relocs PARAMS ((bfd *, asection *, PTR));
|
||||
static boolean mips_elf64_section_from_shdr
|
||||
PARAMS ((bfd *, Elf_Internal_Shdr *, char *));
|
||||
static boolean mips_elf64_section_processing
|
||||
PARAMS ((bfd *, Elf_Internal_Shdr *));
|
||||
static boolean mips_elf64_slurp_armap PARAMS ((bfd *));
|
||||
static boolean mips_elf64_write_armap
|
||||
PARAMS ((bfd *, unsigned int, struct orl *, unsigned int, int));
|
||||
|
||||
/* The relocation types. */
|
||||
|
||||
enum mips_elf64_reloc_type
|
||||
{
|
||||
R_MIPS_NONE = 0,
|
||||
R_MIPS_16 = 1,
|
||||
R_MIPS_32 = 2,
|
||||
R_MIPS_ADD = 2,
|
||||
R_MIPS_REL32 = 3,
|
||||
R_MIPS_REL = 3,
|
||||
R_MIPS_26 = 4,
|
||||
R_MIPS_HI16 = 5,
|
||||
R_MIPS_LO16 = 6,
|
||||
R_MIPS_GPREL16 = 7,
|
||||
R_MIPS_GPREL = 7,
|
||||
R_MIPS_LITERAL = 8,
|
||||
R_MIPS_GOT16 = 9,
|
||||
R_MIPS_GOT = 9,
|
||||
R_MIPS_PC16 = 10,
|
||||
R_MIPS_CALL16 = 11,
|
||||
R_MIPS_CALL = 11,
|
||||
R_MIPS_GPREL32 = 12,
|
||||
R_MIPS_SHIFT5 = 16,
|
||||
R_MIPS_SHIFT6 = 17,
|
||||
R_MIPS_64 = 18,
|
||||
R_MIPS_GOT_DISP = 19,
|
||||
R_MIPS_GOT_PAGE = 20,
|
||||
R_MIPS_GOT_OFST = 21,
|
||||
R_MIPS_GOT_HI16 = 22,
|
||||
R_MIPS_GOT_LO16 = 23,
|
||||
R_MIPS_SUB = 24,
|
||||
R_MIPS_INSERT_A = 25,
|
||||
R_MIPS_INSERT_B = 26,
|
||||
R_MIPS_DELETE = 27,
|
||||
R_MIPS_HIGHER = 28,
|
||||
R_MIPS_HIGHEST = 29,
|
||||
R_MIPS_CALL_HI16 = 30,
|
||||
R_MIPS_CALL_LO16 = 31,
|
||||
R_MIPS_SCN_DISP = 32,
|
||||
R_MIPS_REL16 = 33,
|
||||
R_MIPS_ADD_IMMEDIATE = 34,
|
||||
R_MIPS_PJUMP = 35,
|
||||
R_MIPS_RELGOT = 36
|
||||
};
|
||||
|
||||
/* 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)
|
||||
|
||||
/* The number of local .got entries we reserve. */
|
||||
#define MIPS_RESERVED_GOTNO (2)
|
||||
|
||||
/* The relocation table used for SHT_REL sections. */
|
||||
|
||||
static reloc_howto_type mips_elf64_howto_table_rel[] =
|
||||
@ -659,7 +621,23 @@ static reloc_howto_type mips_elf64_howto_table_rel[] =
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false) /* pcrel_offset */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* Protected jump conversion. This is an optimization hint. No
|
||||
relocation is required for correctness. */
|
||||
HOWTO (R_MIPS_JALR, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MIPS_JALR", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x00000000, /* src_mask */
|
||||
0x00000000, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
};
|
||||
|
||||
/* The relocation table used for SHT_RELA sections. */
|
||||
@ -1197,7 +1175,23 @@ static reloc_howto_type mips_elf64_howto_table_rela[] =
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false) /* pcrel_offset */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* Protected jump conversion. This is an optimization hint. No
|
||||
relocation is required for correctness. */
|
||||
HOWTO (R_MIPS_JALR, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_MIPS_JALR", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x00000000, /* src_mask */
|
||||
0x00000000, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
};
|
||||
|
||||
/* Swap in a MIPS 64-bit Rel reloc. */
|
||||
@ -1233,10 +1227,6 @@ mips_elf64_swap_reloca_in (abfd, src, dst)
|
||||
dst->r_addend = bfd_h_get_signed_64 (abfd, (bfd_byte *) src->r_addend);
|
||||
}
|
||||
|
||||
#if 0
|
||||
|
||||
/* This is not currently used. */
|
||||
|
||||
/* Swap out a MIPS 64-bit Rel reloc. */
|
||||
|
||||
static void
|
||||
@ -1253,8 +1243,6 @@ mips_elf64_swap_reloc_out (abfd, src, dst)
|
||||
bfd_h_put_8 (abfd, src->r_type, (bfd_byte *) dst->r_type);
|
||||
}
|
||||
|
||||
#endif /* 0 */
|
||||
|
||||
/* Swap out a MIPS 64-bit Rela reloc. */
|
||||
|
||||
static void
|
||||
@ -1272,12 +1260,102 @@ mips_elf64_swap_reloca_out (abfd, src, dst)
|
||||
bfd_h_put_64 (abfd, src->r_addend, (bfd_byte *) dst->r_addend);
|
||||
}
|
||||
|
||||
/* Swap in a MIPS 64-bit Rel reloc. */
|
||||
|
||||
static void
|
||||
mips_elf64_be_swap_reloc_in (abfd, src, dst)
|
||||
bfd *abfd;
|
||||
const bfd_byte *src;
|
||||
Elf_Internal_Rel *dst;
|
||||
{
|
||||
Elf64_Mips_Internal_Rel mirel;
|
||||
|
||||
mips_elf64_swap_reloc_in (abfd,
|
||||
(const Elf64_Mips_External_Rel *) src,
|
||||
&mirel);
|
||||
|
||||
dst[0].r_offset = mirel.r_offset;
|
||||
dst[0].r_info = ELF32_R_INFO (mirel.r_sym, mirel.r_type);
|
||||
dst[1].r_offset = mirel.r_offset;
|
||||
dst[1].r_info = ELF32_R_INFO (mirel.r_ssym, mirel.r_type2);
|
||||
dst[2].r_offset = mirel.r_offset;
|
||||
dst[2].r_info = ELF32_R_INFO (STN_UNDEF, mirel.r_type3);
|
||||
}
|
||||
|
||||
/* Swap in a MIPS 64-bit Rela reloc. */
|
||||
|
||||
static void
|
||||
mips_elf64_be_swap_reloca_in (abfd, src, dst)
|
||||
bfd *abfd;
|
||||
const bfd_byte *src;
|
||||
Elf_Internal_Rela *dst;
|
||||
{
|
||||
Elf64_Mips_Internal_Rela mirela;
|
||||
|
||||
mips_elf64_swap_reloca_in (abfd,
|
||||
(const Elf64_Mips_External_Rela *) src,
|
||||
&mirela);
|
||||
|
||||
dst[0].r_offset = mirela.r_offset;
|
||||
dst[0].r_info = ELF32_R_INFO (mirela.r_sym, mirela.r_type);
|
||||
dst[0].r_addend = mirela.r_addend;
|
||||
dst[1].r_offset = mirela.r_offset;
|
||||
dst[1].r_info = ELF32_R_INFO (mirela.r_ssym, mirela.r_type2);
|
||||
dst[1].r_addend = 0;
|
||||
dst[2].r_offset = mirela.r_offset;
|
||||
dst[2].r_info = ELF32_R_INFO (STN_UNDEF, mirela.r_type3);
|
||||
dst[2].r_addend = 0;
|
||||
}
|
||||
|
||||
/* Swap out a MIPS 64-bit Rel reloc. */
|
||||
|
||||
static void
|
||||
mips_elf64_be_swap_reloc_out (abfd, src, dst)
|
||||
bfd *abfd;
|
||||
const Elf_Internal_Rel *src;
|
||||
bfd_byte *dst;
|
||||
{
|
||||
Elf64_Mips_Internal_Rel mirel;
|
||||
|
||||
mirel.r_offset = src->r_offset;
|
||||
mirel.r_type = ELF32_R_TYPE (src->r_info);
|
||||
mirel.r_sym = ELF32_R_SYM (src->r_info);
|
||||
mirel.r_type2 = R_MIPS_NONE;
|
||||
mirel.r_ssym = STN_UNDEF;
|
||||
mirel.r_type3 = R_MIPS_NONE;
|
||||
|
||||
mips_elf64_swap_reloc_out (abfd, &mirel,
|
||||
(Elf64_Mips_External_Rel *) dst);
|
||||
}
|
||||
|
||||
/* Swap out a MIPS 64-bit Rela reloc. */
|
||||
|
||||
static void
|
||||
mips_elf64_be_swap_reloca_out (abfd, src, dst)
|
||||
bfd *abfd;
|
||||
const Elf_Internal_Rela *src;
|
||||
bfd_byte *dst;
|
||||
{
|
||||
Elf64_Mips_Internal_Rela mirela;
|
||||
|
||||
mirela.r_offset = src->r_offset;
|
||||
mirela.r_type = ELF32_R_TYPE (src->r_info);
|
||||
mirela.r_addend = src->r_addend;
|
||||
mirela.r_sym = ELF32_R_SYM (src->r_info);
|
||||
mirela.r_type2 = R_MIPS_NONE;
|
||||
mirela.r_ssym = STN_UNDEF;
|
||||
mirela.r_type3 = R_MIPS_NONE;
|
||||
|
||||
mips_elf64_swap_reloca_out (abfd, &mirela,
|
||||
(Elf64_Mips_External_Rela *) dst);
|
||||
}
|
||||
|
||||
/* A mapping from BFD reloc types to MIPS ELF reloc types. */
|
||||
|
||||
struct elf_reloc_map
|
||||
{
|
||||
bfd_reloc_code_real_type bfd_reloc_val;
|
||||
enum mips_elf64_reloc_type elf_reloc_val;
|
||||
enum elf_mips_reloc_type elf_reloc_val;
|
||||
};
|
||||
|
||||
static CONST struct elf_reloc_map mips_reloc_map[] =
|
||||
@ -1300,7 +1378,11 @@ static CONST struct elf_reloc_map mips_reloc_map[] =
|
||||
{ BFD_RELOC_MIPS_GOT_HI16, R_MIPS_GOT_HI16 },
|
||||
{ BFD_RELOC_MIPS_GOT_LO16, R_MIPS_GOT_LO16 },
|
||||
{ BFD_RELOC_MIPS_CALL_HI16, R_MIPS_CALL_HI16 },
|
||||
{ BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 }
|
||||
{ BFD_RELOC_MIPS_CALL_LO16, R_MIPS_CALL_LO16 },
|
||||
{ BFD_RELOC_MIPS_SUB, R_MIPS_SUB },
|
||||
{ BFD_RELOC_MIPS_GOT_PAGE, R_MIPS_GOT_PAGE },
|
||||
{ BFD_RELOC_MIPS_GOT_OFST, R_MIPS_GOT_OFST },
|
||||
{ BFD_RELOC_MIPS_GOT_DISP, R_MIPS_GOT_DISP }
|
||||
};
|
||||
|
||||
/* Given a BFD reloc type, return a howto structure. */
|
||||
@ -1411,20 +1493,20 @@ mips_elf64_slurp_one_reloc_table (abfd, asect, symbols, rel_hdr)
|
||||
used_ssym = false;
|
||||
for (ir = 0; ir < 3; ir++)
|
||||
{
|
||||
enum mips_elf64_reloc_type type;
|
||||
enum elf_mips_reloc_type type;
|
||||
|
||||
switch (ir)
|
||||
{
|
||||
default:
|
||||
abort ();
|
||||
case 0:
|
||||
type = (enum mips_elf64_reloc_type) rela.r_type;
|
||||
type = (enum elf_mips_reloc_type) rela.r_type;
|
||||
break;
|
||||
case 1:
|
||||
type = (enum mips_elf64_reloc_type) rela.r_type2;
|
||||
type = (enum elf_mips_reloc_type) rela.r_type2;
|
||||
break;
|
||||
case 2:
|
||||
type = (enum mips_elf64_reloc_type) rela.r_type3;
|
||||
type = (enum elf_mips_reloc_type) rela.r_type3;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -1733,115 +1815,6 @@ mips_elf64_write_relocs (abfd, sec, data)
|
||||
== count);
|
||||
}
|
||||
|
||||
/* Handle a 64-bit MIPS ELF specific section. */
|
||||
|
||||
static boolean
|
||||
mips_elf64_section_from_shdr (abfd, hdr, name)
|
||||
bfd *abfd;
|
||||
Elf_Internal_Shdr *hdr;
|
||||
char *name;
|
||||
{
|
||||
if (! _bfd_mips_elf_section_from_shdr (abfd, hdr, name))
|
||||
return false;
|
||||
|
||||
/* For a SHT_MIPS_OPTIONS section, look for a ODK_REGINFO entry, and
|
||||
set the gp value based on what we find. We may see both
|
||||
SHT_MIPS_REGINFO and SHT_MIPS_OPTIONS/ODK_REGINFO; in that case,
|
||||
they should agree. */
|
||||
if (hdr->sh_type == SHT_MIPS_OPTIONS)
|
||||
{
|
||||
bfd_byte *contents, *l, *lend;
|
||||
|
||||
contents = (bfd_byte *) bfd_malloc (hdr->sh_size);
|
||||
if (contents == NULL)
|
||||
return false;
|
||||
if (! bfd_get_section_contents (abfd, hdr->bfd_section, contents,
|
||||
(file_ptr) 0, hdr->sh_size))
|
||||
{
|
||||
free (contents);
|
||||
return false;
|
||||
}
|
||||
l = contents;
|
||||
lend = contents + hdr->sh_size;
|
||||
while (l + sizeof (Elf_External_Options) <= lend)
|
||||
{
|
||||
Elf_Internal_Options intopt;
|
||||
|
||||
bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l,
|
||||
&intopt);
|
||||
if (intopt.kind == ODK_REGINFO)
|
||||
{
|
||||
Elf64_Internal_RegInfo intreg;
|
||||
|
||||
bfd_mips_elf64_swap_reginfo_in
|
||||
(abfd,
|
||||
((Elf64_External_RegInfo *)
|
||||
(l + sizeof (Elf_External_Options))),
|
||||
&intreg);
|
||||
elf_gp (abfd) = intreg.ri_gp_value;
|
||||
}
|
||||
l += intopt.size;
|
||||
}
|
||||
free (contents);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Work over a section just before writing it out. We update the GP
|
||||
value in the SHT_MIPS_OPTIONS section based on the value we are
|
||||
using. */
|
||||
|
||||
static boolean
|
||||
mips_elf64_section_processing (abfd, hdr)
|
||||
bfd *abfd;
|
||||
Elf_Internal_Shdr *hdr;
|
||||
{
|
||||
if (hdr->sh_type == SHT_MIPS_OPTIONS
|
||||
&& hdr->bfd_section != NULL
|
||||
&& elf_section_data (hdr->bfd_section) != NULL
|
||||
&& elf_section_data (hdr->bfd_section)->tdata != NULL)
|
||||
{
|
||||
bfd_byte *contents, *l, *lend;
|
||||
|
||||
/* We stored the section contents in the elf_section_data tdata
|
||||
field in the set_section_contents routine. We save the
|
||||
section contents so that we don't have to read them again.
|
||||
At this point we know that elf_gp is set, so we can look
|
||||
through the section contents to see if there is an
|
||||
ODK_REGINFO structure. */
|
||||
|
||||
contents = (bfd_byte *) elf_section_data (hdr->bfd_section)->tdata;
|
||||
l = contents;
|
||||
lend = contents + hdr->sh_size;
|
||||
while (l + sizeof (Elf_External_Options) <= lend)
|
||||
{
|
||||
Elf_Internal_Options intopt;
|
||||
|
||||
bfd_mips_elf_swap_options_in (abfd, (Elf_External_Options *) l,
|
||||
&intopt);
|
||||
if (intopt.kind == ODK_REGINFO)
|
||||
{
|
||||
bfd_byte buf[8];
|
||||
|
||||
if (bfd_seek (abfd,
|
||||
(hdr->sh_offset
|
||||
+ (l - contents)
|
||||
+ sizeof (Elf_External_Options)
|
||||
+ (sizeof (Elf64_External_RegInfo) - 8)),
|
||||
SEEK_SET) == -1)
|
||||
return false;
|
||||
bfd_h_put_64 (abfd, elf_gp (abfd), buf);
|
||||
if (bfd_write (buf, 1, 8, abfd) != 8)
|
||||
return false;
|
||||
}
|
||||
l += intopt.size;
|
||||
}
|
||||
}
|
||||
|
||||
return _bfd_mips_elf_section_processing (abfd, hdr);
|
||||
}
|
||||
|
||||
/* Irix 6 defines a brand new archive map format, so that they can
|
||||
have archives more than 4 GB in size. */
|
||||
|
||||
@ -2108,6 +2081,8 @@ const struct elf_size_info mips_elf64_size_info =
|
||||
sizeof (Elf64_External_Sym),
|
||||
sizeof (Elf64_External_Dyn),
|
||||
sizeof (Elf_External_Note),
|
||||
4, /* hash-table entry size */
|
||||
3, /* internal relocations per external relocations */
|
||||
64, /* arch_size */
|
||||
8, /* file_align */
|
||||
ELFCLASS64,
|
||||
@ -2118,7 +2093,12 @@ const struct elf_size_info mips_elf64_size_info =
|
||||
bfd_elf64_swap_symbol_out,
|
||||
mips_elf64_slurp_reloc_table,
|
||||
bfd_elf64_slurp_symbol_table,
|
||||
bfd_elf64_swap_dyn_in
|
||||
bfd_elf64_swap_dyn_in,
|
||||
bfd_elf64_swap_dyn_out,
|
||||
mips_elf64_be_swap_reloc_in,
|
||||
mips_elf64_be_swap_reloc_out,
|
||||
mips_elf64_be_swap_reloca_in,
|
||||
mips_elf64_be_swap_reloca_out
|
||||
};
|
||||
|
||||
#define TARGET_LITTLE_SYM bfd_elf64_littlemips_vec
|
||||
@ -2127,29 +2107,67 @@ const struct elf_size_info mips_elf64_size_info =
|
||||
#define TARGET_BIG_NAME "elf64-bigmips"
|
||||
#define ELF_ARCH bfd_arch_mips
|
||||
#define ELF_MACHINE_CODE EM_MIPS
|
||||
|
||||
#define ELF_MAXPAGESIZE 0x1000
|
||||
|
||||
#define elf_backend_collect true
|
||||
#define elf_backend_type_change_ok true
|
||||
#define elf_backend_can_gc_sections true
|
||||
#define elf_backend_size_info mips_elf64_size_info
|
||||
#define elf_backend_object_p _bfd_mips_elf_object_p
|
||||
#define elf_backend_section_from_shdr mips_elf64_section_from_shdr
|
||||
#define elf_backend_section_from_shdr _bfd_mips_elf_section_from_shdr
|
||||
#define elf_backend_fake_sections _bfd_mips_elf_fake_sections
|
||||
#define elf_backend_section_from_bfd_section \
|
||||
_bfd_mips_elf_section_from_bfd_section
|
||||
#define elf_backend_section_processing mips_elf64_section_processing
|
||||
#define elf_backend_section_processing _bfd_mips_elf_section_processing
|
||||
#define elf_backend_symbol_processing _bfd_mips_elf_symbol_processing
|
||||
#define elf_backend_additional_program_headers \
|
||||
_bfd_mips_elf_additional_program_headers
|
||||
#define elf_backend_modify_segment_map _bfd_mips_elf_modify_segment_map
|
||||
#define elf_backend_final_write_processing \
|
||||
_bfd_mips_elf_final_write_processing
|
||||
#define elf_backend_ecoff_debug_swap &mips_elf64_ecoff_debug_swap
|
||||
#define elf_backend_add_symbol_hook _bfd_mips_elf_add_symbol_hook
|
||||
#define elf_backend_create_dynamic_sections \
|
||||
_bfd_mips_elf_create_dynamic_sections
|
||||
#define elf_backend_check_relocs _bfd_mips_elf_check_relocs
|
||||
#define elf_backend_adjust_dynamic_symbol \
|
||||
_bfd_mips_elf_adjust_dynamic_symbol
|
||||
#define elf_backend_always_size_sections \
|
||||
_bfd_mips_elf_always_size_sections
|
||||
#define elf_backend_size_dynamic_sections \
|
||||
_bfd_mips_elf_size_dynamic_sections
|
||||
#define elf_backend_relocate_section _bfd_mips_elf_relocate_section
|
||||
#define elf_backend_link_output_symbol_hook \
|
||||
_bfd_mips_elf_link_output_symbol_hook
|
||||
#define elf_backend_finish_dynamic_symbol \
|
||||
_bfd_mips_elf_finish_dynamic_symbol
|
||||
#define elf_backend_finish_dynamic_sections \
|
||||
_bfd_mips_elf_finish_dynamic_sections
|
||||
#define elf_backend_gc_mark_hook _bfd_mips_elf_gc_mark_hook
|
||||
#define elf_backend_gc_sweep_hook _bfd_mips_elf_gc_sweep_hook
|
||||
#define elf_backend_got_header_size (4*MIPS_RESERVED_GOTNO)
|
||||
#define elf_backend_plt_header_size 0
|
||||
#define elf_backend_may_use_rel_p 1
|
||||
|
||||
/* We don't set bfd_elf64_bfd_is_local_label_name because the 32-bit
|
||||
MIPS-specific function only applies to IRIX5, which had no 64-bit
|
||||
ABI. */
|
||||
#define bfd_elf64_find_nearest_line _bfd_mips_elf_find_nearest_line
|
||||
#define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound
|
||||
#define bfd_elf64_bfd_reloc_type_lookup mips_elf64_reloc_type_lookup
|
||||
#define bfd_elf64_set_section_contents _bfd_mips_elf_set_section_contents
|
||||
#define bfd_elf64_bfd_link_hash_table_create \
|
||||
_bfd_mips_elf_link_hash_table_create
|
||||
#define bfd_elf64_bfd_final_link _bfd_mips_elf_final_link
|
||||
#define bfd_elf64_bfd_copy_private_bfd_data \
|
||||
_bfd_mips_elf_copy_private_bfd_data
|
||||
#define bfd_elf64_bfd_merge_private_bfd_data \
|
||||
_bfd_mips_elf_merge_private_bfd_data
|
||||
#define bfd_elf64_bfd_set_private_flags _bfd_mips_elf_set_private_flags
|
||||
#define bfd_elf64_bfd_print_private_bfd_data \
|
||||
_bfd_mips_elf_print_private_bfd_data
|
||||
|
||||
#define bfd_elf64_get_reloc_upper_bound mips_elf64_get_reloc_upper_bound
|
||||
#define bfd_elf64_bfd_reloc_type_lookup mips_elf64_reloc_type_lookup
|
||||
#define bfd_elf64_archive_functions
|
||||
#define bfd_elf64_archive_slurp_armap mips_elf64_slurp_armap
|
||||
#define bfd_elf64_archive_slurp_extended_name_table \
|
||||
|
File diff suppressed because it is too large
Load Diff
672
contrib/binutils/bfd/elfarm-nabi.c
Normal file
672
contrib/binutils/bfd/elfarm-nabi.c
Normal file
@ -0,0 +1,672 @@
|
||||
/* 32-bit ELF support for ARM new abi option.
|
||||
Copyright 1999 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 "elf/arm.h"
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "elf-bfd.h"
|
||||
|
||||
#ifndef NUM_ELEM
|
||||
#define NUM_ELEM(a) (sizeof (a) / (sizeof (a)[0]))
|
||||
#endif
|
||||
|
||||
#define USE_REL
|
||||
|
||||
#define TARGET_LITTLE_SYM bfd_elf32_littlearm_vec
|
||||
#define TARGET_LITTLE_NAME "elf32-littlearm"
|
||||
#define TARGET_BIG_SYM bfd_elf32_bigarm_vec
|
||||
#define TARGET_BIG_NAME "elf32-bigarm"
|
||||
|
||||
#define elf_info_to_howto 0
|
||||
#define elf_info_to_howto_rel elf32_arm_info_to_howto
|
||||
|
||||
#define ARM_ELF_ABI_VERSION 0
|
||||
#define ARM_ELF_OS_ABI_VERSION ELFOSABI_ARM
|
||||
|
||||
static reloc_howto_type * elf32_arm_reloc_type_lookup
|
||||
PARAMS ((bfd * abfd, bfd_reloc_code_real_type code));
|
||||
|
||||
static reloc_howto_type elf32_arm_howto_table[] =
|
||||
{
|
||||
/* No relocation */
|
||||
HOWTO (R_ARM_NONE, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_NONE", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_PC24, /* type */
|
||||
2, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
24, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_PC24", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x00ffffff, /* src_mask */
|
||||
0x00ffffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
/* 32 bit absolute */
|
||||
HOWTO (R_ARM_ABS32, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_ABS32", /* name */
|
||||
false, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* standard 32bit pc-relative reloc */
|
||||
HOWTO (R_ARM_REL32, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_REL32", /* name */
|
||||
false, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
/* 8 bit absolute */
|
||||
HOWTO (R_ARM_PC13, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_PC13", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x000000ff, /* src_mask */
|
||||
0x000000ff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* 16 bit absolute */
|
||||
HOWTO (R_ARM_ABS16, /* type */
|
||||
0, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_ABS16", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* 12 bit absolute */
|
||||
HOWTO (R_ARM_ABS12, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
12, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_ABS12", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x000008ff, /* src_mask */
|
||||
0x000008ff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_THM_ABS5, /* type */
|
||||
6, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
5, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_THM_ABS5", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x000007e0, /* src_mask */
|
||||
0x000007e0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* 8 bit absolute */
|
||||
HOWTO (R_ARM_ABS8, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_ABS8", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x000000ff, /* src_mask */
|
||||
0x000000ff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_SBREL32, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_SBREL32", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_THM_PC22, /* type */
|
||||
1, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
23, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_THM_PC22", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x07ff07ff, /* src_mask */
|
||||
0x07ff07ff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_THM_PC8, /* type */
|
||||
1, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_THM_PC8", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x000000ff, /* src_mask */
|
||||
0x000000ff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_AMP_VCALL9, /* type */
|
||||
1, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_AMP_VCALL9", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x000000ff, /* src_mask */
|
||||
0x000000ff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_SWI24, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_SWI24", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x00000000, /* src_mask */
|
||||
0x00000000, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_THM_SWI8, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_SWI8", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x00000000, /* src_mask */
|
||||
0x00000000, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* These next two relocs are defined, but I do not know what they do. */
|
||||
|
||||
HOWTO (R_ARM_XPC25, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_XPC25", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x00000000, /* src_mask */
|
||||
0x00000000, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_THM_XPC22, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_THM_XPC22", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x00000000, /* src_mask */
|
||||
0x00000000, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* These next three relocs are not defined, but we need to fill the space. */
|
||||
|
||||
HOWTO (R_ARM_NONE, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_unknown_17", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_NONE, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_unknown_18", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_NONE, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_unknown_19", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* Relocs used in ARM Linux */
|
||||
|
||||
HOWTO (R_ARM_COPY, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_COPY", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_GLOB_DAT, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_GLOB_DAT", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_JUMP_SLOT, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_JUMP_SLOT", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_RELATIVE, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_RELATIVE", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_GOTOFF, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_GOTOFF", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_GOTPC, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_GOTPC", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_GOT32, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_GOT32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_PLT32, /* type */
|
||||
2, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
26, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_PLT32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x00ffffff, /* src_mask */
|
||||
0x00ffffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
/* End of relocs used in ARM Linux */
|
||||
|
||||
HOWTO (R_ARM_RREL32, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_RREL32", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_RABS32, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_RABS32", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_RPC24, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_RPC24", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_RBASE, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_RBASE", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
};
|
||||
|
||||
/* GNU extension to record C++ vtable hierarchy */
|
||||
static reloc_howto_type elf32_arm_vtinherit_howto =
|
||||
HOWTO (R_ARM_GNU_VTINHERIT, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"R_ARM_GNU_VTINHERIT", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false); /* pcrel_offset */
|
||||
|
||||
/* GNU extension to record C++ vtable member usage */
|
||||
static reloc_howto_type elf32_arm_vtentry_howto =
|
||||
HOWTO (R_ARM_GNU_VTENTRY, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
_bfd_elf_rel_vtable_reloc_fn, /* special_function */
|
||||
"R_ARM_GNU_VTENTRY", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false); /* pcrel_offset */
|
||||
|
||||
/* 12 bit pc relative */
|
||||
static reloc_howto_type elf32_arm_thm_pc11_howto =
|
||||
HOWTO (R_ARM_THM_PC11, /* type */
|
||||
1, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
11, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_THM_PC11", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x000007ff, /* src_mask */
|
||||
0x000007ff, /* dst_mask */
|
||||
true); /* pcrel_offset */
|
||||
|
||||
/* 12 bit pc relative */
|
||||
static reloc_howto_type elf32_arm_thm_pc9_howto =
|
||||
HOWTO (R_ARM_THM_PC9, /* type */
|
||||
1, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_THM_PC9", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x000000ff, /* src_mask */
|
||||
0x000000ff, /* dst_mask */
|
||||
true); /* pcrel_offset */
|
||||
|
||||
|
||||
static void
|
||||
elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
|
||||
bfd * abfd ATTRIBUTE_UNUSED;
|
||||
arelent * bfd_reloc;
|
||||
Elf32_Internal_Rel * elf_reloc;
|
||||
{
|
||||
unsigned int r_type;
|
||||
|
||||
r_type = ELF32_R_TYPE (elf_reloc->r_info);
|
||||
|
||||
switch (r_type)
|
||||
{
|
||||
case R_ARM_GNU_VTINHERIT:
|
||||
bfd_reloc->howto = & elf32_arm_vtinherit_howto;
|
||||
break;
|
||||
|
||||
case R_ARM_GNU_VTENTRY:
|
||||
bfd_reloc->howto = & elf32_arm_vtentry_howto;
|
||||
break;
|
||||
|
||||
case R_ARM_THM_PC11:
|
||||
bfd_reloc->howto = & elf32_arm_thm_pc11_howto;
|
||||
break;
|
||||
|
||||
case R_ARM_THM_PC9:
|
||||
bfd_reloc->howto = & elf32_arm_thm_pc9_howto;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (r_type >= NUM_ELEM (elf32_arm_howto_table))
|
||||
bfd_reloc->howto = NULL;
|
||||
else
|
||||
bfd_reloc->howto = & elf32_arm_howto_table[r_type];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
struct elf32_arm_reloc_map
|
||||
{
|
||||
bfd_reloc_code_real_type bfd_reloc_val;
|
||||
unsigned char elf_reloc_val;
|
||||
};
|
||||
|
||||
static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] =
|
||||
{
|
||||
{BFD_RELOC_NONE, R_ARM_NONE},
|
||||
{BFD_RELOC_ARM_PCREL_BRANCH, R_ARM_PC24},
|
||||
{BFD_RELOC_32, R_ARM_ABS32},
|
||||
{BFD_RELOC_32_PCREL, R_ARM_REL32},
|
||||
{BFD_RELOC_8, R_ARM_ABS8},
|
||||
{BFD_RELOC_16, R_ARM_ABS16},
|
||||
{BFD_RELOC_ARM_OFFSET_IMM, R_ARM_ABS12},
|
||||
{BFD_RELOC_ARM_THUMB_OFFSET, R_ARM_THM_ABS5},
|
||||
{BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22},
|
||||
{BFD_RELOC_ARM_COPY, R_ARM_COPY},
|
||||
{BFD_RELOC_ARM_GLOB_DAT, R_ARM_GLOB_DAT},
|
||||
{BFD_RELOC_ARM_JUMP_SLOT, R_ARM_JUMP_SLOT},
|
||||
{BFD_RELOC_ARM_RELATIVE, R_ARM_RELATIVE},
|
||||
{BFD_RELOC_ARM_GOTOFF, R_ARM_GOTOFF},
|
||||
{BFD_RELOC_ARM_GOTPC, R_ARM_GOTPC},
|
||||
{BFD_RELOC_ARM_GOT32, R_ARM_GOT32},
|
||||
{BFD_RELOC_ARM_PLT32, R_ARM_PLT32}
|
||||
};
|
||||
|
||||
static reloc_howto_type *
|
||||
elf32_arm_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
switch (code)
|
||||
{
|
||||
case BFD_RELOC_VTABLE_INHERIT:
|
||||
return & elf32_arm_vtinherit_howto;
|
||||
|
||||
case BFD_RELOC_VTABLE_ENTRY:
|
||||
return & elf32_arm_vtentry_howto;
|
||||
|
||||
case BFD_RELOC_THUMB_PCREL_BRANCH12:
|
||||
return & elf32_arm_thm_pc11_howto;
|
||||
|
||||
case BFD_RELOC_THUMB_PCREL_BRANCH9:
|
||||
return & elf32_arm_thm_pc9_howto;
|
||||
|
||||
default:
|
||||
for (i = 0; i < NUM_ELEM (elf32_arm_reloc_map); i ++)
|
||||
if (elf32_arm_reloc_map[i].bfd_reloc_val == code)
|
||||
return & elf32_arm_howto_table[elf32_arm_reloc_map[i].elf_reloc_val];
|
||||
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#include "elf32-arm.h"
|
420
contrib/binutils/bfd/elfarm-oabi.c
Normal file
420
contrib/binutils/bfd/elfarm-oabi.c
Normal file
@ -0,0 +1,420 @@
|
||||
/* 32-bit ELF support for ARM old abi option.
|
||||
Copyright 1999 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 "elf/arm-oabi.h"
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
#include "elf-bfd.h"
|
||||
|
||||
#ifndef NUM_ELEM
|
||||
#define NUM_ELEM(a) (sizeof (a) / sizeof (a)[0])
|
||||
#endif
|
||||
|
||||
#define USE_RELA
|
||||
|
||||
#define TARGET_LITTLE_SYM bfd_elf32_littlearm_oabi_vec
|
||||
#define TARGET_LITTLE_NAME "elf32-littlearm-oabi"
|
||||
#define TARGET_BIG_SYM bfd_elf32_bigarm_oabi_vec
|
||||
#define TARGET_BIG_NAME "elf32-bigarm-oabi"
|
||||
|
||||
#define elf_info_to_howto elf32_arm_info_to_howto
|
||||
#define elf_info_to_howto_rel 0
|
||||
|
||||
#define ARM_ELF_ABI_VERSION 0
|
||||
#define ARM_ELF_OS_ABI_VERSION 0
|
||||
|
||||
static reloc_howto_type elf32_arm_howto_table[] =
|
||||
{
|
||||
/* No relocation */
|
||||
HOWTO (R_ARM_NONE, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_NONE", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_PC24, /* type */
|
||||
2, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
24, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_PC24", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x00ffffff, /* src_mask */
|
||||
0x00ffffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
/* 32 bit absolute */
|
||||
HOWTO (R_ARM_ABS32, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_ABS32", /* name */
|
||||
false, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* standard 32bit pc-relative reloc */
|
||||
HOWTO (R_ARM_REL32, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
32, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_REL32", /* name */
|
||||
false, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
/* 8 bit absolute */
|
||||
HOWTO (R_ARM_ABS8, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_ABS8", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x000000ff, /* src_mask */
|
||||
0x000000ff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* 16 bit absolute */
|
||||
HOWTO (R_ARM_ABS16, /* type */
|
||||
0, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_ABS16", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* 12 bit absolute */
|
||||
HOWTO (R_ARM_ABS12, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
12, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_ABS12", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x000008ff, /* src_mask */
|
||||
0x000008ff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_THM_ABS5, /* type */
|
||||
6, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
5, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_THM_ABS5", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x000007e0, /* src_mask */
|
||||
0x000007e0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_THM_PC22, /* type */
|
||||
1, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
23, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_THM_PC22", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x07ff07ff, /* src_mask */
|
||||
0x07ff07ff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_SBREL32, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_SBREL32", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_AMP_VCALL9, /* type */
|
||||
1, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_AMP_VCALL9", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x000000ff, /* src_mask */
|
||||
0x000000ff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
/* 12 bit pc relative */
|
||||
HOWTO (R_ARM_THM_PC11, /* type */
|
||||
1, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
11, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_THM_PC11", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x000007ff, /* src_mask */
|
||||
0x000007ff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
/* 12 bit pc relative */
|
||||
HOWTO (R_ARM_THM_PC9, /* type */
|
||||
1, /* rightshift */
|
||||
1, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_THM_PC9", /* name */
|
||||
false, /* partial_inplace */
|
||||
0x000000ff, /* src_mask */
|
||||
0x000000ff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
/* GNU extension to record C++ vtable hierarchy */
|
||||
HOWTO (R_ARM_GNU_VTINHERIT, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
NULL, /* special_function */
|
||||
"R_ARM_GNU_VTINHERIT", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* GNU extension to record C++ vtable member usage */
|
||||
HOWTO (R_ARM_GNU_VTENTRY, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
_bfd_elf_rel_vtable_reloc_fn, /* special_function */
|
||||
"R_ARM_GNU_VTENTRY", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* XXX - gap in index numbering here. */
|
||||
|
||||
HOWTO (R_ARM_PLT32, /* type */
|
||||
2, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
26, /* bitsize */
|
||||
true, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield,/* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_PLT32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x00ffffff, /* src_mask */
|
||||
0x00ffffff, /* dst_mask */
|
||||
true), /* pcrel_offset */
|
||||
|
||||
/* XXX - gap in index numbering here. */
|
||||
|
||||
HOWTO (R_ARM_RREL32, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_RREL32", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_RABS32, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_RABS32", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_RPC24, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_RPC24", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
HOWTO (R_ARM_RBASE, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
0, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
bfd_elf_generic_reloc, /* special_function */
|
||||
"R_ARM_RBASE", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false) /* pcrel_offset */
|
||||
};
|
||||
|
||||
/* Locate a reloc in the howto table. This function must be used
|
||||
when the entry number is is > R_ARM_GNU_VTINHERIT. */
|
||||
static reloc_howto_type *
|
||||
find_howto (r_type)
|
||||
unsigned int r_type;
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = NUM_ELEM (elf32_arm_howto_table); i--;)
|
||||
if (elf32_arm_howto_table [i].type == r_type)
|
||||
return elf32_arm_howto_table + i;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
elf32_arm_info_to_howto (abfd, bfd_reloc, elf_reloc)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *bfd_reloc;
|
||||
Elf32_Internal_Rela *elf_reloc;
|
||||
{
|
||||
unsigned int r_type;
|
||||
|
||||
r_type = ELF32_R_TYPE (elf_reloc->r_info);
|
||||
|
||||
if (r_type <= R_ARM_GNU_VTINHERIT)
|
||||
bfd_reloc->howto = & elf32_arm_howto_table[r_type];
|
||||
else
|
||||
bfd_reloc->howto = find_howto (r_type);
|
||||
}
|
||||
|
||||
struct elf32_arm_reloc_map
|
||||
{
|
||||
bfd_reloc_code_real_type bfd_reloc_val;
|
||||
unsigned char elf_reloc_val;
|
||||
};
|
||||
|
||||
static const struct elf32_arm_reloc_map elf32_arm_reloc_map[] =
|
||||
{
|
||||
{BFD_RELOC_NONE, R_ARM_NONE },
|
||||
{BFD_RELOC_ARM_PCREL_BRANCH, R_ARM_PC24 },
|
||||
{BFD_RELOC_32, R_ARM_ABS32 },
|
||||
{BFD_RELOC_32_PCREL, R_ARM_REL32 },
|
||||
{BFD_RELOC_8, R_ARM_ABS8 },
|
||||
{BFD_RELOC_16, R_ARM_ABS16 },
|
||||
{BFD_RELOC_ARM_OFFSET_IMM, R_ARM_ABS12 },
|
||||
{BFD_RELOC_ARM_THUMB_OFFSET, R_ARM_THM_ABS5 },
|
||||
{BFD_RELOC_THUMB_PCREL_BRANCH23, R_ARM_THM_PC22 },
|
||||
{BFD_RELOC_NONE, R_ARM_SBREL32 },
|
||||
{BFD_RELOC_NONE, R_ARM_AMP_VCALL9 },
|
||||
{BFD_RELOC_THUMB_PCREL_BRANCH12, R_ARM_THM_PC11 },
|
||||
{BFD_RELOC_THUMB_PCREL_BRANCH9, R_ARM_THM_PC9 },
|
||||
{BFD_RELOC_VTABLE_INHERIT, R_ARM_GNU_VTINHERIT },
|
||||
{BFD_RELOC_VTABLE_ENTRY, R_ARM_GNU_VTENTRY }
|
||||
};
|
||||
|
||||
static reloc_howto_type *
|
||||
elf32_arm_reloc_type_lookup (abfd, code)
|
||||
bfd * abfd ATTRIBUTE_UNUSED;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = NUM_ELEM (elf32_arm_reloc_map); i--;)
|
||||
if (elf32_arm_reloc_map[i].bfd_reloc_val == code)
|
||||
return & elf32_arm_howto_table [elf32_arm_reloc_map[i].elf_reloc_val];
|
||||
|
||||
if (code == BFD_RELOC_ARM_PLT32)
|
||||
return find_howto (R_ARM_PLT32);
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
#define bfd_elf32_arm_allocate_interworking_sections \
|
||||
bfd_elf32_arm_oabi_allocate_interworking_sections
|
||||
#define bfd_elf32_arm_get_bfd_for_interworking \
|
||||
bfd_elf32_arm_oabi_get_bfd_for_interworking
|
||||
#define bfd_elf32_arm_process_before_allocation \
|
||||
bfd_elf32_arm_oabi_process_before_allocation
|
||||
|
||||
#include "elf32-arm.h"
|
@ -1,5 +1,6 @@
|
||||
/* ELF executable support for BFD.
|
||||
Copyright 1991, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
|
||||
Copyright 1991, 92, 93, 94, 95, 96, 97, 98, 1999 Free Software
|
||||
Foundation, Inc.
|
||||
|
||||
Written by Fred Fish @ Cygnus Support, from information published
|
||||
in "UNIX System V Release 4, Programmers Guide: ANSI C and
|
||||
@ -68,7 +69,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "bfdlink.h"
|
||||
#include "libbfd.h"
|
||||
#include "elf-bfd.h"
|
||||
#include "fnmatch.h"
|
||||
|
||||
/* Renaming structures, typedefs, macros and functions to be size-specific. */
|
||||
#define Elf_External_Ehdr NAME(Elf,External_Ehdr)
|
||||
@ -124,6 +124,14 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#define elf_bfd_final_link NAME(bfd_elf,bfd_final_link)
|
||||
#define elf_create_pointer_linker_section NAME(bfd_elf,create_pointer_linker_section)
|
||||
#define elf_finish_pointer_linker_section NAME(bfd_elf,finish_pointer_linker_section)
|
||||
#define elf_gc_sections NAME(_bfd_elf,gc_sections)
|
||||
#define elf_gc_common_finalize_got_offsets \
|
||||
NAME(_bfd_elf,gc_common_finalize_got_offsets)
|
||||
#define elf_gc_common_final_link NAME(_bfd_elf,gc_common_final_link)
|
||||
#define elf_gc_record_vtinherit NAME(_bfd_elf,gc_record_vtinherit)
|
||||
#define elf_gc_record_vtentry NAME(_bfd_elf,gc_record_vtentry)
|
||||
#define elf_link_record_local_dynamic_symbol \
|
||||
NAME(_bfd_elf,link_record_local_dynamic_symbol)
|
||||
|
||||
#if ARCH_SIZE == 64
|
||||
#define ELF_R_INFO(X,Y) ELF64_R_INFO(X,Y)
|
||||
@ -157,6 +165,9 @@ static void elf_swap_shdr_out
|
||||
|
||||
#define section_from_elf_index bfd_section_from_elf_index
|
||||
|
||||
static boolean elf_slurp_reloc_table_from_section
|
||||
PARAMS ((bfd *, asection *, Elf_Internal_Shdr *, bfd_size_type,
|
||||
arelent *, asymbol **, boolean));
|
||||
static boolean elf_slurp_reloc_table
|
||||
PARAMS ((bfd *, asection *, asymbol **, boolean));
|
||||
|
||||
@ -196,8 +207,13 @@ elf_swap_symbol_in (abfd, src, dst)
|
||||
const Elf_External_Sym *src;
|
||||
Elf_Internal_Sym *dst;
|
||||
{
|
||||
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
|
||||
|
||||
dst->st_name = bfd_h_get_32 (abfd, (bfd_byte *) src->st_name);
|
||||
dst->st_value = get_word (abfd, (bfd_byte *) src->st_value);
|
||||
if (signed_vma)
|
||||
dst->st_value = get_signed_word (abfd, (bfd_byte *) src->st_value);
|
||||
else
|
||||
dst->st_value = get_word (abfd, (bfd_byte *) src->st_value);
|
||||
dst->st_size = get_word (abfd, (bfd_byte *) src->st_size);
|
||||
dst->st_info = bfd_h_get_8 (abfd, (bfd_byte *) src->st_info);
|
||||
dst->st_other = bfd_h_get_8 (abfd, (bfd_byte *) src->st_other);
|
||||
@ -284,10 +300,15 @@ elf_swap_shdr_in (abfd, src, dst)
|
||||
const Elf_External_Shdr *src;
|
||||
Elf_Internal_Shdr *dst;
|
||||
{
|
||||
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
|
||||
|
||||
dst->sh_name = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_name);
|
||||
dst->sh_type = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_type);
|
||||
dst->sh_flags = get_word (abfd, (bfd_byte *) src->sh_flags);
|
||||
dst->sh_addr = get_word (abfd, (bfd_byte *) src->sh_addr);
|
||||
if (signed_vma)
|
||||
dst->sh_addr = get_signed_word (abfd, (bfd_byte *) src->sh_addr);
|
||||
else
|
||||
dst->sh_addr = get_word (abfd, (bfd_byte *) src->sh_addr);
|
||||
dst->sh_offset = get_word (abfd, (bfd_byte *) src->sh_offset);
|
||||
dst->sh_size = get_word (abfd, (bfd_byte *) src->sh_size);
|
||||
dst->sh_link = bfd_h_get_32 (abfd, (bfd_byte *) src->sh_link);
|
||||
@ -330,11 +351,21 @@ elf_swap_phdr_in (abfd, src, dst)
|
||||
const Elf_External_Phdr *src;
|
||||
Elf_Internal_Phdr *dst;
|
||||
{
|
||||
int signed_vma = get_elf_backend_data (abfd)->sign_extend_vma;
|
||||
|
||||
dst->p_type = bfd_h_get_32 (abfd, (bfd_byte *) src->p_type);
|
||||
dst->p_flags = bfd_h_get_32 (abfd, (bfd_byte *) src->p_flags);
|
||||
dst->p_offset = get_word (abfd, (bfd_byte *) src->p_offset);
|
||||
dst->p_vaddr = get_word (abfd, (bfd_byte *) src->p_vaddr);
|
||||
dst->p_paddr = get_word (abfd, (bfd_byte *) src->p_paddr);
|
||||
if (signed_vma)
|
||||
{
|
||||
dst->p_vaddr = get_signed_word (abfd, (bfd_byte *) src->p_vaddr);
|
||||
dst->p_paddr = get_signed_word (abfd, (bfd_byte *) src->p_paddr);
|
||||
}
|
||||
else
|
||||
{
|
||||
dst->p_vaddr = get_word (abfd, (bfd_byte *) src->p_vaddr);
|
||||
dst->p_paddr = get_word (abfd, (bfd_byte *) src->p_paddr);
|
||||
}
|
||||
dst->p_filesz = get_word (abfd, (bfd_byte *) src->p_filesz);
|
||||
dst->p_memsz = get_word (abfd, (bfd_byte *) src->p_memsz);
|
||||
dst->p_align = get_word (abfd, (bfd_byte *) src->p_align);
|
||||
@ -414,11 +445,13 @@ elf_swap_dyn_in (abfd, p, dst)
|
||||
}
|
||||
|
||||
INLINE void
|
||||
elf_swap_dyn_out (abfd, src, dst)
|
||||
elf_swap_dyn_out (abfd, src, p)
|
||||
bfd *abfd;
|
||||
const Elf_Internal_Dyn *src;
|
||||
Elf_External_Dyn *dst;
|
||||
PTR p;
|
||||
{
|
||||
Elf_External_Dyn *dst = (Elf_External_Dyn *) p;
|
||||
|
||||
put_word (abfd, src->d_tag, dst->d_tag);
|
||||
put_word (abfd, src->d_un.d_val, dst->d_un.d_val);
|
||||
}
|
||||
@ -517,6 +550,10 @@ elf_object_p (abfd)
|
||||
elf_debug_file (i_ehdrp);
|
||||
#endif
|
||||
|
||||
/* Reject ET_CORE (header indicates core file, not object file) */
|
||||
if (i_ehdrp->e_type == ET_CORE)
|
||||
goto got_wrong_format_error;
|
||||
|
||||
/* If there is no section header table, we're hosed. */
|
||||
if (i_ehdrp->e_shoff == 0)
|
||||
goto got_wrong_format_error;
|
||||
@ -571,7 +608,11 @@ elf_object_p (abfd)
|
||||
abfd->flags |= D_PAGED;
|
||||
|
||||
if (! bfd_default_set_arch_mach (abfd, ebd->arch, 0))
|
||||
goto got_no_match;
|
||||
{
|
||||
/* It's OK if this fails for the generic target. */
|
||||
if (ebd->elf_machine_code != EM_NONE)
|
||||
goto got_no_match;
|
||||
}
|
||||
|
||||
/* Remember the entry point specified in the ELF file header. */
|
||||
bfd_get_start_address (abfd) = i_ehdrp->e_entry;
|
||||
@ -687,10 +728,9 @@ elf_object_p (abfd)
|
||||
|
||||
return (abfd->xvec);
|
||||
|
||||
got_wrong_format_error:
|
||||
got_wrong_format_error:
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
goto got_no_match;
|
||||
got_no_match:
|
||||
got_no_match:
|
||||
if (new_tdata != NULL
|
||||
&& new_tdata->elf_sect_ptr != NULL)
|
||||
bfd_release (abfd, new_tdata->elf_sect_ptr);
|
||||
@ -717,7 +757,7 @@ write_relocs (abfd, sec, data)
|
||||
Elf_External_Rela *outbound_relocas;
|
||||
Elf_External_Rel *outbound_relocs;
|
||||
unsigned int idx;
|
||||
int use_rela_p = get_elf_backend_data (abfd)->use_rela_p;
|
||||
int use_rela_p;
|
||||
asymbol *last_sym = 0;
|
||||
int last_sym_idx = 0;
|
||||
|
||||
@ -745,6 +785,16 @@ write_relocs (abfd, sec, data)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Figure out whether the relocations are RELA or REL relocations. */
|
||||
if (rela_hdr->sh_type == SHT_RELA)
|
||||
use_rela_p = true;
|
||||
else if (rela_hdr->sh_type == SHT_REL)
|
||||
use_rela_p = false;
|
||||
else
|
||||
/* Every relocation section should be either an SHT_RELA or an
|
||||
SHT_REL section. */
|
||||
abort ();
|
||||
|
||||
/* orelocation has the data, reloc_count has the count... */
|
||||
if (use_rela_p)
|
||||
{
|
||||
@ -827,6 +877,8 @@ write_relocs (abfd, sec, data)
|
||||
|
||||
if (sym == last_sym)
|
||||
n = last_sym_idx;
|
||||
else if (bfd_is_abs_section (sym->section) && sym->value == 0)
|
||||
n = STN_UNDEF;
|
||||
else
|
||||
{
|
||||
last_sym = sym;
|
||||
@ -839,7 +891,8 @@ write_relocs (abfd, sec, data)
|
||||
last_sym_idx = n;
|
||||
}
|
||||
|
||||
if ((*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
|
||||
if ((*ptr->sym_ptr_ptr)->the_bfd != NULL
|
||||
&& (*ptr->sym_ptr_ptr)->the_bfd->xvec != abfd->xvec
|
||||
&& ! _bfd_elf_validate_reloc (abfd, ptr))
|
||||
{
|
||||
*failedp = true;
|
||||
@ -1005,7 +1058,7 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
|
||||
&& verhdr->sh_size / sizeof (Elf_External_Versym) != symcount)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s: version count (%ld) does not match symbol count (%ld)",
|
||||
(_("%s: version count (%ld) does not match symbol count (%ld)"),
|
||||
abfd->filename,
|
||||
(long) (verhdr->sh_size / sizeof (Elf_External_Versym)),
|
||||
symcount);
|
||||
@ -1173,50 +1226,27 @@ elf_slurp_symbol_table (abfd, symptrs, dynamic)
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Read in and swap the external relocs. */
|
||||
/* Read relocations for ASECT from REL_HDR. There are RELOC_COUNT of
|
||||
them. */
|
||||
|
||||
static boolean
|
||||
elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
|
||||
elf_slurp_reloc_table_from_section (abfd, asect, rel_hdr, reloc_count,
|
||||
relents, symbols, dynamic)
|
||||
bfd *abfd;
|
||||
asection *asect;
|
||||
Elf_Internal_Shdr *rel_hdr;
|
||||
bfd_size_type reloc_count;
|
||||
arelent *relents;
|
||||
asymbol **symbols;
|
||||
boolean dynamic;
|
||||
{
|
||||
struct elf_backend_data * const ebd = get_elf_backend_data (abfd);
|
||||
struct bfd_elf_section_data * const d = elf_section_data (asect);
|
||||
Elf_Internal_Shdr *rel_hdr;
|
||||
bfd_size_type reloc_count;
|
||||
PTR allocated = NULL;
|
||||
bfd_byte *native_relocs;
|
||||
arelent *relents;
|
||||
arelent *relent;
|
||||
unsigned int i;
|
||||
int entsize;
|
||||
|
||||
if (asect->relocation != NULL)
|
||||
return true;
|
||||
|
||||
if (! dynamic)
|
||||
{
|
||||
if ((asect->flags & SEC_RELOC) == 0
|
||||
|| asect->reloc_count == 0)
|
||||
return true;
|
||||
|
||||
rel_hdr = &d->rel_hdr;
|
||||
reloc_count = asect->reloc_count;
|
||||
|
||||
BFD_ASSERT (asect->rel_filepos == rel_hdr->sh_offset
|
||||
&& reloc_count == rel_hdr->sh_size / rel_hdr->sh_entsize);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (asect->_raw_size == 0)
|
||||
return true;
|
||||
|
||||
rel_hdr = &d->this_hdr;
|
||||
reloc_count = rel_hdr->sh_size / rel_hdr->sh_entsize;
|
||||
}
|
||||
|
||||
allocated = (PTR) bfd_malloc ((size_t) rel_hdr->sh_size);
|
||||
if (allocated == NULL)
|
||||
goto error_return;
|
||||
@ -1228,10 +1258,6 @@ elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
|
||||
|
||||
native_relocs = (bfd_byte *) allocated;
|
||||
|
||||
relents = (arelent *) bfd_alloc (abfd, reloc_count * sizeof (arelent));
|
||||
if (relents == NULL)
|
||||
goto error_return;
|
||||
|
||||
entsize = rel_hdr->sh_entsize;
|
||||
BFD_ASSERT (entsize == sizeof (Elf_External_Rel)
|
||||
|| entsize == sizeof (Elf_External_Rela));
|
||||
@ -1286,8 +1312,6 @@ elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
|
||||
(*ebd->elf_info_to_howto_rel) (abfd, relent, &rel);
|
||||
}
|
||||
|
||||
asect->relocation = relents;
|
||||
|
||||
if (allocated != NULL)
|
||||
free (allocated);
|
||||
|
||||
@ -1299,6 +1323,82 @@ elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Read in and swap the external relocs. */
|
||||
|
||||
static boolean
|
||||
elf_slurp_reloc_table (abfd, asect, symbols, dynamic)
|
||||
bfd *abfd;
|
||||
asection *asect;
|
||||
asymbol **symbols;
|
||||
boolean dynamic;
|
||||
{
|
||||
struct bfd_elf_section_data * const d = elf_section_data (asect);
|
||||
Elf_Internal_Shdr *rel_hdr;
|
||||
Elf_Internal_Shdr *rel_hdr2;
|
||||
bfd_size_type reloc_count;
|
||||
bfd_size_type reloc_count2;
|
||||
arelent *relents;
|
||||
|
||||
if (asect->relocation != NULL)
|
||||
return true;
|
||||
|
||||
if (! dynamic)
|
||||
{
|
||||
if ((asect->flags & SEC_RELOC) == 0
|
||||
|| asect->reloc_count == 0)
|
||||
return true;
|
||||
|
||||
rel_hdr = &d->rel_hdr;
|
||||
reloc_count = rel_hdr->sh_size / rel_hdr->sh_entsize;
|
||||
rel_hdr2 = d->rel_hdr2;
|
||||
reloc_count2 = (rel_hdr2
|
||||
? (rel_hdr2->sh_size / rel_hdr2->sh_entsize)
|
||||
: 0);
|
||||
|
||||
BFD_ASSERT (asect->reloc_count == reloc_count + reloc_count2);
|
||||
BFD_ASSERT (asect->rel_filepos == rel_hdr->sh_offset
|
||||
|| (rel_hdr2 && asect->rel_filepos == rel_hdr2->sh_offset));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Note that ASECT->RELOC_COUNT tends not to be accurate in this
|
||||
case because relocations against this section may use the
|
||||
dynamic symbol table, and in that case bfd_section_from_shdr
|
||||
in elf.c does not update the RELOC_COUNT. */
|
||||
if (asect->_raw_size == 0)
|
||||
return true;
|
||||
|
||||
rel_hdr = &d->this_hdr;
|
||||
reloc_count = rel_hdr->sh_size / rel_hdr->sh_entsize;
|
||||
rel_hdr2 = NULL;
|
||||
reloc_count2 = 0;
|
||||
}
|
||||
|
||||
relents = ((arelent *)
|
||||
bfd_alloc (abfd,
|
||||
(reloc_count + reloc_count2) * sizeof (arelent)));
|
||||
if (relents == NULL)
|
||||
return false;
|
||||
|
||||
if (!elf_slurp_reloc_table_from_section (abfd, asect,
|
||||
rel_hdr, reloc_count,
|
||||
relents,
|
||||
symbols, dynamic))
|
||||
return false;
|
||||
|
||||
if (rel_hdr2
|
||||
&& !elf_slurp_reloc_table_from_section (abfd, asect,
|
||||
rel_hdr2, reloc_count2,
|
||||
relents + reloc_count,
|
||||
symbols, dynamic))
|
||||
return false;
|
||||
|
||||
|
||||
asect->relocation = relents;
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
static void
|
||||
elf_debug_section (num, hdr)
|
||||
@ -1427,7 +1527,8 @@ const struct elf_size_info NAME(_bfd_elf,size_info) = {
|
||||
sizeof (Elf_External_Sym),
|
||||
sizeof (Elf_External_Dyn),
|
||||
sizeof (Elf_External_Note),
|
||||
|
||||
ARCH_SIZE / 8,
|
||||
1,
|
||||
ARCH_SIZE, FILE_ALIGN,
|
||||
ELFCLASS, EV_CURRENT,
|
||||
elf_write_out_phdrs,
|
||||
@ -1436,5 +1537,10 @@ const struct elf_size_info NAME(_bfd_elf,size_info) = {
|
||||
elf_swap_symbol_out,
|
||||
elf_slurp_reloc_table,
|
||||
elf_slurp_symbol_table,
|
||||
elf_swap_dyn_in
|
||||
elf_swap_dyn_in,
|
||||
elf_swap_dyn_out,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ELF core file support for BFD.
|
||||
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
@ -16,216 +16,31 @@ 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. */
|
||||
/* Core file support */
|
||||
|
||||
#ifdef HAVE_SYS_PROCFS_H /* Some core file support requires host /proc files */
|
||||
#include <signal.h>
|
||||
#include <sys/procfs.h>
|
||||
|
||||
/* Solaris includes the field pr_who that indicates the thread number within
|
||||
the process. */
|
||||
|
||||
#ifdef PIOCOPENLWP
|
||||
#define get_thread(STATUS) ((((prstatus_t *)(STATUS))->pr_who << 16) \
|
||||
| ((prstatus_t *)(STATUS))->pr_pid)
|
||||
#else
|
||||
#define get_thread(STATUS) (((prstatus_t *)(STATUS))->pr_pid)
|
||||
#endif
|
||||
|
||||
static boolean bfd_prstatus PARAMS ((bfd *, char *, int, long, int));
|
||||
static boolean bfd_prpsinfo PARAMS ((bfd *, char *, int, long));
|
||||
static boolean bfd_fpregset PARAMS ((bfd *, char *, int, long, int));
|
||||
|
||||
#else
|
||||
#define bfd_prstatus(abfd, descdata, descsz, filepos, thread) true
|
||||
#define bfd_fpregset(abfd, descdata, descsz, filepos, thread) true
|
||||
#define bfd_prpsinfo(abfd, descdata, descsz, filepos) true
|
||||
#define get_thread(STATUS) (1)
|
||||
#endif
|
||||
|
||||
static boolean elf_corefile_note PARAMS ((bfd *, Elf_Internal_Phdr *));
|
||||
|
||||
#ifdef HAVE_SYS_PROCFS_H
|
||||
|
||||
static int did_reg;
|
||||
static int did_reg2;
|
||||
|
||||
static boolean
|
||||
bfd_prstatus (abfd, descdata, descsz, filepos, thread)
|
||||
bfd *abfd;
|
||||
char *descdata;
|
||||
int descsz;
|
||||
long filepos;
|
||||
int thread;
|
||||
{
|
||||
asection *newsect;
|
||||
prstatus_t *status = (prstatus_t *) 0;
|
||||
|
||||
if (descsz == sizeof (prstatus_t))
|
||||
{
|
||||
char secname[100];
|
||||
char *p;
|
||||
|
||||
sprintf (secname, ".reg/%d", thread);
|
||||
p = bfd_alloc (abfd, strlen (secname) + 1);
|
||||
if (!p)
|
||||
return false;
|
||||
strcpy (p, secname);
|
||||
|
||||
newsect = bfd_make_section (abfd, p);
|
||||
if (newsect == NULL)
|
||||
return false;
|
||||
newsect->_raw_size = sizeof (status->pr_reg);
|
||||
newsect->filepos = filepos + (long) &status->pr_reg;
|
||||
newsect->flags = SEC_HAS_CONTENTS;
|
||||
newsect->alignment_power = LOG_FILE_ALIGN;
|
||||
if ((core_prstatus (abfd) = bfd_alloc (abfd, descsz)) != NULL)
|
||||
{
|
||||
memcpy (core_prstatus (abfd), descdata, descsz);
|
||||
}
|
||||
|
||||
if (!did_reg++)
|
||||
{
|
||||
asection *regsect;
|
||||
|
||||
regsect = bfd_make_section (abfd, ".reg");
|
||||
if (regsect == NULL)
|
||||
return false;
|
||||
regsect->_raw_size = newsect->_raw_size;
|
||||
regsect->filepos = newsect->filepos;
|
||||
regsect->flags = newsect->flags;
|
||||
regsect->alignment_power = newsect->alignment_power;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Stash a copy of the prpsinfo structure away for future use. */
|
||||
|
||||
static boolean
|
||||
bfd_prpsinfo (abfd, descdata, descsz, filepos)
|
||||
bfd *abfd;
|
||||
char *descdata;
|
||||
int descsz;
|
||||
long filepos;
|
||||
{
|
||||
if (descsz == sizeof (prpsinfo_t))
|
||||
{
|
||||
if ((core_prpsinfo (abfd) = bfd_alloc (abfd, descsz)) == NULL)
|
||||
return false;
|
||||
memcpy (core_prpsinfo (abfd), descdata, descsz);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static boolean
|
||||
bfd_fpregset (abfd, descdata, descsz, filepos, thread)
|
||||
bfd *abfd;
|
||||
char *descdata;
|
||||
int descsz;
|
||||
long filepos;
|
||||
int thread;
|
||||
{
|
||||
asection *newsect;
|
||||
char secname[100];
|
||||
char *p;
|
||||
|
||||
sprintf (secname, ".reg2/%d", thread);
|
||||
p = bfd_alloc (abfd, strlen (secname) + 1);
|
||||
if (!p)
|
||||
return false;
|
||||
strcpy (p, secname);
|
||||
|
||||
newsect = bfd_make_section (abfd, p);
|
||||
if (newsect == NULL)
|
||||
return false;
|
||||
newsect->_raw_size = descsz;
|
||||
newsect->filepos = filepos;
|
||||
newsect->flags = SEC_HAS_CONTENTS;
|
||||
newsect->alignment_power = 2;
|
||||
|
||||
if (!did_reg2++)
|
||||
{
|
||||
asection *regsect;
|
||||
|
||||
regsect = bfd_make_section (abfd, ".reg2");
|
||||
if (regsect == NULL)
|
||||
return false;
|
||||
regsect->_raw_size = newsect->_raw_size;
|
||||
regsect->filepos = newsect->filepos;
|
||||
regsect->flags = newsect->flags;
|
||||
regsect->alignment_power = newsect->alignment_power;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif /* HAVE_SYS_PROCFS_H */
|
||||
|
||||
/* Return a pointer to the args (including the command name) that were
|
||||
seen by the program that generated the core dump. Note that for
|
||||
some reason, a spurious space is tacked onto the end of the args
|
||||
in some (at least one anyway) implementations, so strip it off if
|
||||
it exists. */
|
||||
|
||||
char *
|
||||
char*
|
||||
elf_core_file_failing_command (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
#ifdef HAVE_SYS_PROCFS_H
|
||||
if (core_prpsinfo (abfd))
|
||||
{
|
||||
prpsinfo_t *p = core_prpsinfo (abfd);
|
||||
char *scan = p->pr_psargs;
|
||||
while (*scan++)
|
||||
{;
|
||||
}
|
||||
scan -= 2;
|
||||
if ((scan > p->pr_psargs) && (*scan == ' '))
|
||||
{
|
||||
*scan = '\000';
|
||||
}
|
||||
return p->pr_psargs;
|
||||
}
|
||||
#endif
|
||||
return NULL;
|
||||
return elf_tdata (abfd)->core_command;
|
||||
}
|
||||
|
||||
/* Return the number of the signal that caused the core dump. Presumably,
|
||||
since we have a core file, we got a signal of some kind, so don't bother
|
||||
checking the other process status fields, just return the signal number.
|
||||
*/
|
||||
|
||||
int
|
||||
elf_core_file_failing_signal (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
#ifdef HAVE_SYS_PROCFS_H
|
||||
if (core_prstatus (abfd))
|
||||
{
|
||||
return ((prstatus_t *) (core_prstatus (abfd)))->pr_cursig;
|
||||
}
|
||||
#endif
|
||||
return -1;
|
||||
return elf_tdata (abfd)->core_signal;
|
||||
}
|
||||
|
||||
/* Check to see if the core file could reasonably be expected to have
|
||||
come for the current executable file. Note that by default we return
|
||||
true unless we find something that indicates that there might be a
|
||||
problem.
|
||||
*/
|
||||
|
||||
boolean
|
||||
elf_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
bfd *core_bfd;
|
||||
bfd *exec_bfd;
|
||||
{
|
||||
#ifdef HAVE_SYS_PROCFS_H
|
||||
char *corename;
|
||||
char *execname;
|
||||
#endif
|
||||
char* corename;
|
||||
|
||||
/* First, xvecs must match since both are ELF files for the same target. */
|
||||
/* xvecs must match if both are ELF files for the same target. */
|
||||
|
||||
if (core_bfd->xvec != exec_bfd->xvec)
|
||||
{
|
||||
@ -233,151 +48,21 @@ elf_core_file_matches_executable_p (core_bfd, exec_bfd)
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef HAVE_SYS_PROCFS_H
|
||||
/* See if the name in the corefile matches the executable name. */
|
||||
|
||||
/* If no prpsinfo, just return true. Otherwise, grab the last component
|
||||
of the exec'd pathname from the prpsinfo. */
|
||||
|
||||
if (core_prpsinfo (core_bfd))
|
||||
corename = elf_tdata (core_bfd)->core_program;
|
||||
if (corename != NULL)
|
||||
{
|
||||
corename = (((prpsinfo_t *) core_prpsinfo (core_bfd))->pr_fname);
|
||||
const char* execname = strrchr (exec_bfd->filename, '/');
|
||||
execname = execname ? execname + 1 : exec_bfd->filename;
|
||||
|
||||
if (strcmp(execname, corename) != 0)
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Find the last component of the executable pathname. */
|
||||
|
||||
if ((execname = strrchr (exec_bfd->filename, '/')) != NULL)
|
||||
{
|
||||
execname++;
|
||||
}
|
||||
else
|
||||
{
|
||||
execname = (char *) exec_bfd->filename;
|
||||
}
|
||||
|
||||
/* See if they match */
|
||||
|
||||
return strcmp (execname, corename) ? false : true;
|
||||
|
||||
#else
|
||||
|
||||
return true;
|
||||
|
||||
#endif /* HAVE_SYS_PROCFS_H */
|
||||
}
|
||||
|
||||
/* ELF core files contain a segment of type PT_NOTE, that holds much of
|
||||
the information that would normally be available from the /proc interface
|
||||
for the process, at the time the process dumped core. Currently this
|
||||
includes copies of the prstatus, prpsinfo, and fpregset structures.
|
||||
|
||||
Since these structures are potentially machine dependent in size and
|
||||
ordering, bfd provides two levels of support for them. The first level,
|
||||
available on all machines since it does not require that the host
|
||||
have /proc support or the relevant include files, is to create a bfd
|
||||
section for each of the prstatus, prpsinfo, and fpregset structures,
|
||||
without any interpretation of their contents. With just this support,
|
||||
the bfd client will have to interpret the structures itself. Even with
|
||||
/proc support, it might want these full structures for it's own reasons.
|
||||
|
||||
In the second level of support, where HAVE_SYS_PROCFS_H is defined,
|
||||
bfd will pick apart the structures to gather some additional
|
||||
information that clients may want, such as the general register
|
||||
set, the name of the exec'ed file and its arguments, the signal (if
|
||||
any) that caused the core dump, etc.
|
||||
|
||||
*/
|
||||
|
||||
static boolean
|
||||
elf_corefile_note (abfd, hdr)
|
||||
bfd *abfd;
|
||||
Elf_Internal_Phdr *hdr;
|
||||
{
|
||||
Elf_External_Note *x_note_p; /* Elf note, external form */
|
||||
Elf_Internal_Note i_note; /* Elf note, internal form */
|
||||
char *buf = NULL; /* Entire note segment contents */
|
||||
char *namedata; /* Name portion of the note */
|
||||
char *descdata; /* Descriptor portion of the note */
|
||||
char *sectname; /* Name to use for new section */
|
||||
long filepos; /* File offset to descriptor data */
|
||||
asection *newsect;
|
||||
int thread = 1; /* Current thread number */
|
||||
|
||||
#ifdef HAVE_SYS_PROCFS_H
|
||||
did_reg = 0; /* Non-zero if we made .reg section */
|
||||
did_reg2 = 0; /* Ditto for .reg2 */
|
||||
#endif
|
||||
|
||||
if (hdr->p_filesz > 0
|
||||
&& (buf = (char *) bfd_malloc ((size_t) hdr->p_filesz)) != NULL
|
||||
&& bfd_seek (abfd, hdr->p_offset, SEEK_SET) != -1
|
||||
&& bfd_read ((PTR) buf, hdr->p_filesz, 1, abfd) == hdr->p_filesz)
|
||||
{
|
||||
x_note_p = (Elf_External_Note *) buf;
|
||||
while ((char *) x_note_p < (buf + hdr->p_filesz))
|
||||
{
|
||||
i_note.namesz = bfd_h_get_32 (abfd, (bfd_byte *) x_note_p->namesz);
|
||||
i_note.descsz = bfd_h_get_32 (abfd, (bfd_byte *) x_note_p->descsz);
|
||||
i_note.type = bfd_h_get_32 (abfd, (bfd_byte *) x_note_p->type);
|
||||
namedata = x_note_p->name;
|
||||
descdata = namedata + BFD_ALIGN (i_note.namesz, 4);
|
||||
filepos = hdr->p_offset + (descdata - buf);
|
||||
switch (i_note.type)
|
||||
{
|
||||
case NT_PRSTATUS:
|
||||
/* process descdata as prstatus info */
|
||||
thread = get_thread (descdata);
|
||||
if (! bfd_prstatus (abfd, descdata, i_note.descsz, filepos,
|
||||
thread))
|
||||
return false;
|
||||
sectname = NULL;
|
||||
break;
|
||||
case NT_FPREGSET:
|
||||
/* process descdata as fpregset info */
|
||||
if (! bfd_fpregset (abfd, descdata, i_note.descsz, filepos,
|
||||
thread))
|
||||
return false;
|
||||
sectname = NULL;
|
||||
break;
|
||||
case NT_PRPSINFO:
|
||||
/* process descdata as prpsinfo */
|
||||
if (! bfd_prpsinfo (abfd, descdata, i_note.descsz, filepos))
|
||||
return false;
|
||||
sectname = ".prpsinfo";
|
||||
break;
|
||||
default:
|
||||
/* Unknown descriptor, just ignore it. */
|
||||
sectname = NULL;
|
||||
break;
|
||||
}
|
||||
if (sectname != NULL)
|
||||
{
|
||||
newsect = bfd_make_section (abfd, sectname);
|
||||
if (newsect == NULL)
|
||||
return false;
|
||||
newsect->_raw_size = i_note.descsz;
|
||||
newsect->filepos = filepos;
|
||||
newsect->flags = SEC_ALLOC | SEC_HAS_CONTENTS;
|
||||
newsect->alignment_power = 2;
|
||||
}
|
||||
x_note_p = (Elf_External_Note *)
|
||||
(descdata + BFD_ALIGN (i_note.descsz, 4));
|
||||
}
|
||||
}
|
||||
if (buf != NULL)
|
||||
{
|
||||
free (buf);
|
||||
}
|
||||
else if (hdr->p_filesz > 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/* Core files are simply standard ELF formatted files that partition
|
||||
the file using the execution view of the file (program header table)
|
||||
@ -398,13 +83,11 @@ elf_core_file_p (abfd)
|
||||
{
|
||||
Elf_External_Ehdr x_ehdr; /* Elf file header, external form */
|
||||
Elf_Internal_Ehdr *i_ehdrp; /* Elf file header, internal form */
|
||||
Elf_External_Phdr x_phdr; /* Program header table entry, external form */
|
||||
Elf_Internal_Phdr *i_phdrp; /* Program header table, internal form */
|
||||
Elf_Internal_Phdr *i_phdrp; /* Elf program header, internal form */
|
||||
unsigned int phindex;
|
||||
struct elf_backend_data *ebd;
|
||||
|
||||
/* Read in the ELF header in external format. */
|
||||
|
||||
if (bfd_read ((PTR) & x_ehdr, sizeof (x_ehdr), 1, abfd) != sizeof (x_ehdr))
|
||||
{
|
||||
if (bfd_get_error () != bfd_error_system_call)
|
||||
@ -412,12 +95,7 @@ elf_core_file_p (abfd)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Now check to see if we have a valid ELF file, and one that BFD can
|
||||
make use of. The magic number must match, the address size ('class')
|
||||
and byte-swapping must match our XVEC entry, and it must have a
|
||||
program header table (FIXME: See comments re segments at top of this
|
||||
file). */
|
||||
|
||||
/* Check the magic number. */
|
||||
if (elf_file_p (&x_ehdr) == false)
|
||||
{
|
||||
wrong:
|
||||
@ -425,21 +103,13 @@ elf_core_file_p (abfd)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* FIXME, Check EI_VERSION here ! */
|
||||
/* FIXME: Check EI_VERSION here ! */
|
||||
|
||||
{
|
||||
#if ARCH_SIZE == 32
|
||||
int desired_address_size = ELFCLASS32;
|
||||
#endif
|
||||
#if ARCH_SIZE == 64
|
||||
int desired_address_size = ELFCLASS64;
|
||||
#endif
|
||||
/* Check the address size ("class"). */
|
||||
if (x_ehdr.e_ident[EI_CLASS] != ELFCLASS)
|
||||
goto wrong;
|
||||
|
||||
if (x_ehdr.e_ident[EI_CLASS] != desired_address_size)
|
||||
goto wrong;
|
||||
}
|
||||
|
||||
/* Switch xvec to match the specified byte order. */
|
||||
/* Check the byteorder. */
|
||||
switch (x_ehdr.e_ident[EI_DATA])
|
||||
{
|
||||
case ELFDATA2MSB: /* Big-endian */
|
||||
@ -450,24 +120,22 @@ elf_core_file_p (abfd)
|
||||
if (! bfd_little_endian (abfd))
|
||||
goto wrong;
|
||||
break;
|
||||
case ELFDATANONE: /* No data encoding specified */
|
||||
default: /* Unknown data encoding specified */
|
||||
default:
|
||||
goto wrong;
|
||||
}
|
||||
|
||||
/* Allocate an instance of the elf_obj_tdata structure and hook it up to
|
||||
the tdata pointer in the bfd. */
|
||||
|
||||
/* Give abfd an elf_obj_tdata. */
|
||||
elf_tdata (abfd) =
|
||||
(struct elf_obj_tdata *) bfd_zalloc (abfd, sizeof (struct elf_obj_tdata));
|
||||
if (elf_tdata (abfd) == NULL)
|
||||
return NULL;
|
||||
|
||||
/* FIXME, `wrong' returns from this point onward, leak memory. */
|
||||
/* FIXME: from here on down, "goto wrong" will leak memory. */
|
||||
|
||||
/* Now that we know the byte order, swap in the rest of the header */
|
||||
/* Swap in the rest of the header, now that we have the byte order. */
|
||||
i_ehdrp = elf_elfheader (abfd);
|
||||
elf_swap_ehdr_in (abfd, &x_ehdr, i_ehdrp);
|
||||
|
||||
#if DEBUG & 1
|
||||
elf_debug_file (i_ehdrp);
|
||||
#endif
|
||||
@ -476,9 +144,12 @@ elf_core_file_p (abfd)
|
||||
|
||||
/* Check that the ELF e_machine field matches what this particular
|
||||
BFD format expects. */
|
||||
|
||||
if (ebd->elf_machine_code != i_ehdrp->e_machine
|
||||
&& (ebd->elf_machine_alt1 == 0 || i_ehdrp->e_machine != ebd->elf_machine_alt1)
|
||||
&& (ebd->elf_machine_alt2 == 0 || i_ehdrp->e_machine != ebd->elf_machine_alt2))
|
||||
&& (ebd->elf_machine_alt1 == 0
|
||||
|| i_ehdrp->e_machine != ebd->elf_machine_alt1)
|
||||
&& (ebd->elf_machine_alt2 == 0
|
||||
|| i_ehdrp->e_machine != ebd->elf_machine_alt2))
|
||||
{
|
||||
const bfd_target * const *target_ptr;
|
||||
|
||||
@ -487,6 +158,7 @@ elf_core_file_p (abfd)
|
||||
|
||||
/* This is the generic ELF target. Let it match any ELF target
|
||||
for which we do not have a specific backend. */
|
||||
|
||||
for (target_ptr = bfd_target_vector; *target_ptr != NULL; target_ptr++)
|
||||
{
|
||||
struct elf_backend_data *back;
|
||||
@ -508,43 +180,46 @@ elf_core_file_p (abfd)
|
||||
if (i_ehdrp->e_phoff == 0 || i_ehdrp->e_type != ET_CORE)
|
||||
goto wrong;
|
||||
|
||||
/* Allocate space for a copy of the program header table in
|
||||
internal form, seek to the program header table in the file,
|
||||
read it in, and convert it to internal form. As a simple sanity
|
||||
check, verify that the what BFD thinks is the size of each program
|
||||
header table entry actually matches the size recorded in the file. */
|
||||
|
||||
if (i_ehdrp->e_phentsize != sizeof (x_phdr))
|
||||
/* Does BFD's idea of the phdr size match the size
|
||||
recorded in the file? */
|
||||
if (i_ehdrp->e_phentsize != sizeof (Elf_External_Phdr))
|
||||
goto wrong;
|
||||
|
||||
/* Allocate space for the program headers. */
|
||||
i_phdrp = (Elf_Internal_Phdr *)
|
||||
bfd_alloc (abfd, sizeof (*i_phdrp) * i_ehdrp->e_phnum);
|
||||
if (!i_phdrp)
|
||||
return NULL;
|
||||
if (bfd_seek (abfd, i_ehdrp->e_phoff, SEEK_SET) == -1)
|
||||
return NULL;
|
||||
for (phindex = 0; phindex < i_ehdrp->e_phnum; phindex++)
|
||||
|
||||
elf_tdata (abfd)->phdr = i_phdrp;
|
||||
|
||||
/* Read and convert to internal form. */
|
||||
for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
|
||||
{
|
||||
if (bfd_read ((PTR) & x_phdr, sizeof (x_phdr), 1, abfd)
|
||||
Elf_External_Phdr x_phdr;
|
||||
if (bfd_read ((PTR) &x_phdr, sizeof (x_phdr), 1, abfd)
|
||||
!= sizeof (x_phdr))
|
||||
return NULL;
|
||||
|
||||
elf_swap_phdr_in (abfd, &x_phdr, i_phdrp + phindex);
|
||||
}
|
||||
|
||||
/* Once all of the program headers have been read and converted, we
|
||||
can start processing them. */
|
||||
|
||||
for (phindex = 0; phindex < i_ehdrp->e_phnum; phindex++)
|
||||
/* Process each program header. */
|
||||
for (phindex = 0; phindex < i_ehdrp->e_phnum; ++phindex)
|
||||
{
|
||||
bfd_section_from_phdr (abfd, i_phdrp + phindex, phindex);
|
||||
if ((i_phdrp + phindex)->p_type == PT_NOTE)
|
||||
{
|
||||
if (! elf_corefile_note (abfd, i_phdrp + phindex))
|
||||
return NULL;
|
||||
}
|
||||
if (!_bfd_elfcore_section_from_phdr (abfd, i_phdrp + phindex, phindex))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Remember the entry point specified in the ELF file header. */
|
||||
/* Set the machine architecture. */
|
||||
if (! bfd_default_set_arch_mach (abfd, ebd->arch, 0))
|
||||
{
|
||||
/* It's OK if this fails for the generic target. */
|
||||
if (ebd->elf_machine_code != EM_NONE)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Save the entry point from the ELF header. */
|
||||
bfd_get_start_address (abfd) = i_ehdrp->e_entry;
|
||||
|
||||
return abfd->xvec;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* ELF linking support for BFD.
|
||||
Copyright 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
Copyright 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
@ -83,9 +83,8 @@ _bfd_elf_create_got_section (abfd, info)
|
||||
|
||||
elf_hash_table (info)->hgot = h;
|
||||
|
||||
/* The first three global offset table entries after
|
||||
'_GLOBAL_OFFSET_TABLE_' are reserved. */
|
||||
s->_raw_size += (3 << ptralign) + bed->got_symbol_offset;
|
||||
/* The first bit of the global offset table is the header. */
|
||||
s->_raw_size += bed->got_header_size + bed->got_symbol_offset;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -101,7 +100,7 @@ _bfd_elf_create_dynamic_sections (abfd, info)
|
||||
flagword flags, pltflags;
|
||||
register asection *s;
|
||||
struct elf_backend_data *bed = get_elf_backend_data (abfd);
|
||||
int ptralign;
|
||||
int ptralign = 0;
|
||||
|
||||
switch (bed->s->arch_size)
|
||||
{
|
||||
@ -148,7 +147,8 @@ _bfd_elf_create_dynamic_sections (abfd, info)
|
||||
return false;
|
||||
}
|
||||
|
||||
s = bfd_make_section (abfd, bed->use_rela_p ? ".rela.plt" : ".rel.plt");
|
||||
s = bfd_make_section (abfd,
|
||||
bed->default_use_rela_p ? ".rela.plt" : ".rel.plt");
|
||||
if (s == NULL
|
||||
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|
||||
|| ! bfd_set_section_alignment (abfd, s, ptralign))
|
||||
@ -157,18 +157,20 @@ _bfd_elf_create_dynamic_sections (abfd, info)
|
||||
if (! _bfd_elf_create_got_section (abfd, info))
|
||||
return false;
|
||||
|
||||
/* The .dynbss section is a place to put symbols which are defined
|
||||
by dynamic objects, are referenced by regular objects, and are
|
||||
not functions. We must allocate space for them in the process
|
||||
image and use a R_*_COPY reloc to tell the dynamic linker to
|
||||
initialize them at run time. The linker script puts the .dynbss
|
||||
section into the .bss section of the final image. */
|
||||
s = bfd_make_section (abfd, ".dynbss");
|
||||
if (s == NULL
|
||||
|| ! bfd_set_section_flags (abfd, s, SEC_ALLOC))
|
||||
return false;
|
||||
if (bed->want_dynbss)
|
||||
{
|
||||
/* The .dynbss section is a place to put symbols which are defined
|
||||
by dynamic objects, are referenced by regular objects, and are
|
||||
not functions. We must allocate space for them in the process
|
||||
image and use a R_*_COPY reloc to tell the dynamic linker to
|
||||
initialize them at run time. The linker script puts the .dynbss
|
||||
section into the .bss section of the final image. */
|
||||
s = bfd_make_section (abfd, ".dynbss");
|
||||
if (s == NULL
|
||||
|| ! bfd_set_section_flags (abfd, s, SEC_ALLOC))
|
||||
return false;
|
||||
|
||||
/* The .rel[a].bss section holds copy relocs. This section is not
|
||||
/* The .rel[a].bss section holds copy relocs. This section is not
|
||||
normally needed. We need to create it here, though, so that the
|
||||
linker will map it to an output section. We can't just create it
|
||||
only if we need it, because we will not know whether we need it
|
||||
@ -179,13 +181,16 @@ _bfd_elf_create_dynamic_sections (abfd, info)
|
||||
be needed, we can discard it later. We will never need this
|
||||
section when generating a shared object, since they do not use
|
||||
copy relocs. */
|
||||
if (! info->shared)
|
||||
{
|
||||
s = bfd_make_section (abfd, bed->use_rela_p ? ".rela.bss" : ".rel.bss");
|
||||
if (s == NULL
|
||||
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|
||||
|| ! bfd_set_section_alignment (abfd, s, ptralign))
|
||||
return false;
|
||||
if (! info->shared)
|
||||
{
|
||||
s = bfd_make_section (abfd,
|
||||
(bed->default_use_rela_p
|
||||
? ".rela.bss" : ".rel.bss"));
|
||||
if (s == NULL
|
||||
|| ! bfd_set_section_flags (abfd, s, flags | SEC_READONLY)
|
||||
|| ! bfd_set_section_alignment (abfd, s, ptralign))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -213,6 +218,32 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
|
||||
boolean copy;
|
||||
bfd_size_type indx;
|
||||
|
||||
/* XXX: The ABI draft says the linker must turn hidden and
|
||||
internal symbols into STB_LOCAL symbols when producing the
|
||||
DSO. However, if ld.so honors st_other in the dynamic table,
|
||||
this would not be necessary. */
|
||||
switch (ELF_ST_VISIBILITY (h->other))
|
||||
{
|
||||
case STV_INTERNAL:
|
||||
case STV_HIDDEN:
|
||||
/* This symbol must be defined in the shared object or
|
||||
executable. */
|
||||
if (h->root.type == bfd_link_hash_undefined)
|
||||
{
|
||||
bfd * abfd = h->root.u.undef.abfd;
|
||||
const char * name = h->root.root.string;
|
||||
|
||||
(*info->callbacks->undefined_symbol)
|
||||
(info, name, abfd, bfd_und_section_ptr, 0, true);
|
||||
}
|
||||
|
||||
h->elf_link_hash_flags |= ELF_LINK_FORCED_LOCAL;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
h->dynindx = elf_hash_table (info)->dynsymcount;
|
||||
++elf_hash_table (info)->dynsymcount;
|
||||
|
||||
@ -257,8 +288,84 @@ _bfd_elf_link_record_dynamic_symbol (info, h)
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Return the dynindex of a local dynamic symbol. */
|
||||
|
||||
long
|
||||
_bfd_elf_link_lookup_local_dynindx (info, input_bfd, input_indx)
|
||||
struct bfd_link_info *info;
|
||||
bfd *input_bfd;
|
||||
long input_indx;
|
||||
{
|
||||
struct elf_link_local_dynamic_entry *e;
|
||||
|
||||
for (e = elf_hash_table (info)->dynlocal; e ; e = e->next)
|
||||
if (e->input_bfd == input_bfd && e->input_indx == input_indx)
|
||||
return e->dynindx;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* This function is used to renumber the dynamic symbols, if some of
|
||||
them are removed because they are marked as local. This is called
|
||||
via elf_link_hash_traverse. */
|
||||
|
||||
static boolean elf_link_renumber_hash_table_dynsyms
|
||||
PARAMS ((struct elf_link_hash_entry *, PTR));
|
||||
|
||||
static boolean
|
||||
elf_link_renumber_hash_table_dynsyms (h, data)
|
||||
struct elf_link_hash_entry *h;
|
||||
PTR data;
|
||||
{
|
||||
size_t *count = (size_t *) data;
|
||||
|
||||
if (h->dynindx != -1)
|
||||
h->dynindx = ++(*count);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Assign dynsym indicies. In a shared library we generate a section
|
||||
symbol for each output section, which come first. Next come all of
|
||||
the back-end allocated local dynamic syms, followed by the rest of
|
||||
the global symbols. */
|
||||
|
||||
unsigned long
|
||||
_bfd_elf_link_renumber_dynsyms (output_bfd, info)
|
||||
bfd *output_bfd;
|
||||
struct bfd_link_info *info;
|
||||
{
|
||||
unsigned long dynsymcount = 0;
|
||||
|
||||
if (info->shared)
|
||||
{
|
||||
asection *p;
|
||||
for (p = output_bfd->sections; p ; p = p->next)
|
||||
elf_section_data (p)->dynindx = ++dynsymcount;
|
||||
}
|
||||
|
||||
if (elf_hash_table (info)->dynlocal)
|
||||
{
|
||||
struct elf_link_local_dynamic_entry *p;
|
||||
for (p = elf_hash_table (info)->dynlocal; p ; p = p->next)
|
||||
p->dynindx = ++dynsymcount;
|
||||
}
|
||||
|
||||
elf_link_hash_traverse (elf_hash_table (info),
|
||||
elf_link_renumber_hash_table_dynsyms,
|
||||
&dynsymcount);
|
||||
|
||||
/* There is an unused NULL entry at the head of the table which
|
||||
we must account for in our count. Unless there weren't any
|
||||
symbols, which means we'll have no table at all. */
|
||||
if (dynsymcount != 0)
|
||||
++dynsymcount;
|
||||
|
||||
return elf_hash_table (info)->dynsymcount = dynsymcount;
|
||||
}
|
||||
|
||||
/* Create a special linker section, or return a pointer to a linker section already created */
|
||||
/* Create a special linker section, or return a pointer to a linker
|
||||
section already created */
|
||||
|
||||
elf_linker_section_t *
|
||||
_bfd_elf_create_linker_section (abfd, info, which, defaults)
|
||||
@ -313,7 +420,7 @@ _bfd_elf_create_linker_section (abfd, info, which, defaults)
|
||||
s->_raw_size += lsect->hole_size;
|
||||
if (lsect->hole_offset > lsect->max_hole_offset)
|
||||
{
|
||||
(*_bfd_error_handler) ("%s: Section %s is already to large to put hole of %ld bytes in",
|
||||
(*_bfd_error_handler) (_("%s: Section %s is already to large to put hole of %ld bytes in"),
|
||||
bfd_get_filename (abfd),
|
||||
lsect->name,
|
||||
(long)lsect->hole_size);
|
||||
|
@ -57,6 +57,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#endif
|
||||
#define bfd_elfNN_sizeof_headers _bfd_elf_sizeof_headers
|
||||
#define bfd_elfNN_write_object_contents _bfd_elf_write_object_contents
|
||||
#define bfd_elfNN_write_corefile_contents _bfd_elf_write_corefile_contents
|
||||
|
||||
#define bfd_elfNN_get_section_contents_in_window \
|
||||
_bfd_generic_get_section_contents_in_window
|
||||
@ -79,6 +80,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#ifndef elf_backend_plt_alignment
|
||||
#define elf_backend_plt_alignment 2
|
||||
#endif
|
||||
#ifndef elf_backend_want_dynbss
|
||||
#define elf_backend_want_dynbss 1
|
||||
#endif
|
||||
|
||||
#define bfd_elfNN_bfd_debug_info_start bfd_void
|
||||
#define bfd_elfNN_bfd_debug_info_end bfd_void
|
||||
@ -93,6 +97,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#define bfd_elfNN_bfd_relax_section bfd_generic_relax_section
|
||||
#endif
|
||||
|
||||
#ifndef elf_backend_can_gc_sections
|
||||
#define elf_backend_can_gc_sections 0
|
||||
#endif
|
||||
#ifndef elf_backend_gc_mark_hook
|
||||
#define elf_backend_gc_mark_hook NULL
|
||||
#endif
|
||||
#ifndef elf_backend_gc_sweep_hook
|
||||
#define elf_backend_gc_sweep_hook NULL
|
||||
#endif
|
||||
#ifndef bfd_elfNN_bfd_gc_sections
|
||||
#define bfd_elfNN_bfd_gc_sections _bfd_elfNN_gc_sections
|
||||
#endif
|
||||
|
||||
#define bfd_elfNN_bfd_make_debug_symbol \
|
||||
((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
|
||||
|
||||
@ -167,6 +184,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#define bfd_elfNN_mkobject bfd_elf_mkobject
|
||||
#endif
|
||||
|
||||
#ifndef bfd_elfNN_mkcorefile
|
||||
#define bfd_elfNN_mkcorefile bfd_elf_mkcorefile
|
||||
#endif
|
||||
|
||||
#ifndef bfd_elfNN_mkarchive
|
||||
#define bfd_elfNN_mkarchive _bfd_generic_mkarchive
|
||||
#endif
|
||||
@ -184,6 +205,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#endif
|
||||
|
||||
#ifndef ELF_MAXPAGESIZE
|
||||
#error ELF_MAXPAGESIZE is not defined
|
||||
#define ELF_MAXPAGESIZE 1
|
||||
#endif
|
||||
|
||||
@ -206,12 +228,18 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#ifndef elf_backend_symbol_table_processing
|
||||
#define elf_backend_symbol_table_processing 0
|
||||
#endif
|
||||
#ifndef elf_backend_get_symbol_type
|
||||
#define elf_backend_get_symbol_type 0
|
||||
#endif
|
||||
#ifndef elf_backend_section_processing
|
||||
#define elf_backend_section_processing 0
|
||||
#endif
|
||||
#ifndef elf_backend_section_from_shdr
|
||||
#define elf_backend_section_from_shdr 0
|
||||
#endif
|
||||
#ifndef elf_backend_section_from_phdr
|
||||
#define elf_backend_section_from_phdr 0
|
||||
#endif
|
||||
#ifndef elf_backend_fake_sections
|
||||
#define elf_backend_fake_sections 0
|
||||
#endif
|
||||
@ -263,6 +291,50 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#ifndef elf_backend_ecoff_debug_swap
|
||||
#define elf_backend_ecoff_debug_swap 0
|
||||
#endif
|
||||
#ifndef elf_backend_got_header_size
|
||||
#define elf_backend_got_header_size 0
|
||||
#endif
|
||||
#ifndef elf_backend_plt_header_size
|
||||
#define elf_backend_plt_header_size 0
|
||||
#endif
|
||||
#ifndef elf_backend_post_process_headers
|
||||
#define elf_backend_post_process_headers NULL
|
||||
#endif
|
||||
#ifndef elf_backend_print_symbol_all
|
||||
#define elf_backend_print_symbol_all NULL
|
||||
#endif
|
||||
#ifndef elf_backend_output_arch_syms
|
||||
#define elf_backend_output_arch_syms NULL
|
||||
#endif
|
||||
#ifndef elf_backend_copy_indirect_symbol
|
||||
#define elf_backend_copy_indirect_symbol _bfd_elf_link_hash_copy_indirect
|
||||
#endif
|
||||
#ifndef elf_backend_hide_symbol
|
||||
#define elf_backend_hide_symbol _bfd_elf_link_hash_hide_symbol
|
||||
#endif
|
||||
|
||||
|
||||
/* Previously, backends could only use SHT_REL or SHT_RELA relocation
|
||||
sections, but not both. They defined USE_REL to indicate SHT_REL
|
||||
sections, and left it undefined to indicated SHT_RELA sections.
|
||||
For backwards compatibility, we still support this usage. */
|
||||
#ifndef USE_REL
|
||||
#define USE_REL 0
|
||||
#else
|
||||
#undef USE_REL
|
||||
#define USE_REL 1
|
||||
#endif
|
||||
|
||||
/* Use these in new code. */
|
||||
#ifndef elf_backend_may_use_rel_p
|
||||
#define elf_backend_may_use_rel_p USE_REL
|
||||
#endif
|
||||
#ifndef elf_backend_may_use_rela_p
|
||||
#define elf_backend_may_use_rela_p !USE_REL
|
||||
#endif
|
||||
#ifndef elf_backend_default_use_rela_p
|
||||
#define elf_backend_default_use_rela_p !USE_REL
|
||||
#endif
|
||||
|
||||
#ifndef ELF_MACHINE_ALT1
|
||||
#define ELF_MACHINE_ALT1 0
|
||||
@ -276,28 +348,27 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#define elf_backend_size_info _bfd_elfNN_size_info
|
||||
#endif
|
||||
|
||||
#ifndef elf_backend_sign_extend_vma
|
||||
#define elf_backend_sign_extend_vma 0
|
||||
#endif
|
||||
|
||||
extern const struct elf_size_info _bfd_elfNN_size_info;
|
||||
|
||||
static CONST struct elf_backend_data elfNN_bed =
|
||||
{
|
||||
#ifdef USE_REL
|
||||
0, /* use_rela_p */
|
||||
#else
|
||||
1, /* use_rela_p */
|
||||
#endif
|
||||
ELF_ARCH, /* arch */
|
||||
ELF_MACHINE_CODE, /* elf_machine_code */
|
||||
ELF_MAXPAGESIZE, /* maxpagesize */
|
||||
elf_backend_collect,
|
||||
elf_backend_type_change_ok,
|
||||
elf_info_to_howto,
|
||||
elf_info_to_howto_rel,
|
||||
elf_backend_sym_is_global,
|
||||
elf_backend_object_p,
|
||||
elf_backend_symbol_processing,
|
||||
elf_backend_symbol_table_processing,
|
||||
elf_backend_get_symbol_type,
|
||||
elf_backend_section_processing,
|
||||
elf_backend_section_from_shdr,
|
||||
elf_backend_section_from_phdr,
|
||||
elf_backend_fake_sections,
|
||||
elf_backend_section_from_bfd_section,
|
||||
elf_backend_add_symbol_hook,
|
||||
@ -314,18 +385,40 @@ static CONST struct elf_backend_data elfNN_bed =
|
||||
elf_backend_final_write_processing,
|
||||
elf_backend_additional_program_headers,
|
||||
elf_backend_modify_segment_map,
|
||||
elf_backend_gc_mark_hook,
|
||||
elf_backend_gc_sweep_hook,
|
||||
elf_backend_post_process_headers,
|
||||
elf_backend_print_symbol_all,
|
||||
elf_backend_output_arch_syms,
|
||||
elf_backend_copy_indirect_symbol,
|
||||
elf_backend_hide_symbol,
|
||||
elf_backend_ecoff_debug_swap,
|
||||
ELF_MACHINE_ALT1,
|
||||
ELF_MACHINE_ALT2,
|
||||
&elf_backend_size_info,
|
||||
elf_backend_got_symbol_offset,
|
||||
elf_backend_got_header_size,
|
||||
elf_backend_plt_header_size,
|
||||
elf_backend_collect,
|
||||
elf_backend_type_change_ok,
|
||||
elf_backend_may_use_rel_p,
|
||||
elf_backend_may_use_rela_p,
|
||||
elf_backend_default_use_rela_p,
|
||||
elf_backend_sign_extend_vma,
|
||||
elf_backend_want_got_plt,
|
||||
elf_backend_plt_readonly,
|
||||
elf_backend_want_plt_sym,
|
||||
elf_backend_plt_not_loaded,
|
||||
elf_backend_plt_alignment
|
||||
elf_backend_plt_alignment,
|
||||
elf_backend_can_gc_sections,
|
||||
elf_backend_want_dynbss
|
||||
};
|
||||
|
||||
/* Forward declaration for use when initialising alternative_target field. */
|
||||
#ifdef TARGET_LITTLE_SYM
|
||||
extern const bfd_target TARGET_LITTLE_SYM;
|
||||
#endif
|
||||
|
||||
#ifdef TARGET_BIG_SYM
|
||||
const bfd_target TARGET_BIG_SYM =
|
||||
{
|
||||
@ -385,14 +478,14 @@ const bfd_target TARGET_BIG_SYM =
|
||||
{ bfd_false,
|
||||
bfd_elfNN_mkobject,
|
||||
bfd_elfNN_mkarchive,
|
||||
bfd_false
|
||||
bfd_elfNN_mkcorefile
|
||||
},
|
||||
|
||||
/* bfd_write_contents: write cached information into a file being written */
|
||||
{ bfd_false,
|
||||
bfd_elfNN_write_object_contents,
|
||||
bfd_elfNN_write_archive_contents,
|
||||
bfd_false
|
||||
bfd_elfNN_write_corefile_contents,
|
||||
},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
|
||||
@ -409,8 +502,15 @@ const bfd_target TARGET_BIG_SYM =
|
||||
BFD_JUMP_TABLE_LINK (bfd_elfNN),
|
||||
BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
|
||||
|
||||
/* Alternative endian target. */
|
||||
#ifdef TARGET_LITTLE_SYM
|
||||
& TARGET_LITTLE_SYM,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
|
||||
/* backend_data: */
|
||||
(PTR) &elfNN_bed,
|
||||
(PTR) &elfNN_bed
|
||||
};
|
||||
#endif
|
||||
|
||||
@ -473,14 +573,14 @@ const bfd_target TARGET_LITTLE_SYM =
|
||||
{ bfd_false,
|
||||
bfd_elfNN_mkobject,
|
||||
bfd_elfNN_mkarchive,
|
||||
bfd_false
|
||||
bfd_elfNN_mkcorefile
|
||||
},
|
||||
|
||||
/* bfd_write_contents: write cached information into a file being written */
|
||||
{ bfd_false,
|
||||
bfd_elfNN_write_object_contents,
|
||||
bfd_elfNN_write_archive_contents,
|
||||
bfd_false
|
||||
bfd_elfNN_write_corefile_contents,
|
||||
},
|
||||
|
||||
BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
|
||||
@ -497,7 +597,14 @@ const bfd_target TARGET_LITTLE_SYM =
|
||||
BFD_JUMP_TABLE_LINK (bfd_elfNN),
|
||||
BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
|
||||
|
||||
/* Alternative endian target. */
|
||||
#ifdef TARGET_BIG_SYM
|
||||
& TARGET_BIG_SYM,
|
||||
#else
|
||||
NULL,
|
||||
#endif
|
||||
|
||||
/* backend_data: */
|
||||
(PTR) &elfNN_bed,
|
||||
(PTR) &elfNN_bed
|
||||
};
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Generic BFD support for file formats.
|
||||
Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 1999 Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -118,6 +118,7 @@ bfd_check_format_matches (abfd, format, matching)
|
||||
bfd_format format;
|
||||
char ***matching;
|
||||
{
|
||||
extern const bfd_target binary_vec;
|
||||
const bfd_target * const *target, *save_targ, *right_targ;
|
||||
char **matching_vector = NULL;
|
||||
int match_count;
|
||||
@ -166,10 +167,32 @@ bfd_check_format_matches (abfd, format, matching)
|
||||
free (matching_vector);
|
||||
return true; /* File position has moved, BTW */
|
||||
}
|
||||
|
||||
/* For a long time the code has dropped through to check all
|
||||
targets if the specified target was wrong. I don't know why,
|
||||
and I'm reluctant to change it. However, in the case of an
|
||||
archive, it can cause problems. If the specified target does
|
||||
not permit archives (e.g., the binary target), then we should
|
||||
not allow some other target to recognize it as an archive, but
|
||||
should instead allow the specified target to recognize it as an
|
||||
object. When I first made this change, it broke the PE target,
|
||||
because the specified pei-i386 target did not recognize the
|
||||
actual pe-i386 archive. Since there may be other problems of
|
||||
this sort, I changed this test to check only for the binary
|
||||
target. */
|
||||
|
||||
if (format == bfd_archive && save_targ == &binary_vec)
|
||||
{
|
||||
abfd->xvec = save_targ;
|
||||
abfd->format = bfd_unknown;
|
||||
if (matching)
|
||||
free (matching_vector);
|
||||
bfd_set_error (bfd_error_file_not_recognized);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
for (target = bfd_target_vector; *target != NULL; target++) {
|
||||
extern const bfd_target binary_vec;
|
||||
const bfd_target *temp;
|
||||
|
||||
if (*target == &binary_vec)
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Generate parameters for an a.out system.
|
||||
Copyright (C) 1990, 91, 92, 93, 94 Free Software Foundation, Inc.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 98 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
@ -82,8 +82,8 @@ main (argc, argv)
|
||||
#endif
|
||||
if (arch[0] == '1')
|
||||
{
|
||||
fprintf (stderr, "warning: preprocessor substituted architecture name inside string;");
|
||||
fprintf (stderr, " fix DEFAULT_ARCH in the output file yourself\n");
|
||||
fprintf (stderr, _("warning: preprocessor substituted architecture name inside string;"));
|
||||
fprintf (stderr, _(" fix DEFAULT_ARCH in the output file yourself\n"));
|
||||
arch = "unknown";
|
||||
}
|
||||
printf("#define DEFAULT_ARCH bfd_arch_%s\n", arch);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* hash.c -- hash table routines for BFD
|
||||
Copyright (C) 1993, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 94, 95, 97, 1999 Free Software Foundation, Inc.
|
||||
Written by Steve Chamberlain <sac@cygnus.com>
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -73,7 +73,7 @@ SUBSECTION
|
||||
The function <<bfd_hash_table_init>> take as an argument a
|
||||
function to use to create new entries. For a basic hash
|
||||
table, use the function <<bfd_hash_newfunc>>. @xref{Deriving
|
||||
a New Hash Table Type} for why you would want to use a
|
||||
a New Hash Table Type}, for why you would want to use a
|
||||
different value for this argument.
|
||||
|
||||
@findex bfd_hash_allocate
|
||||
@ -450,7 +450,7 @@ struct bfd_hash_entry *
|
||||
bfd_hash_newfunc (entry, table, string)
|
||||
struct bfd_hash_entry *entry;
|
||||
struct bfd_hash_table *table;
|
||||
const char *string;
|
||||
const char *string ATTRIBUTE_UNUSED;
|
||||
{
|
||||
if (entry == (struct bfd_hash_entry *) NULL)
|
||||
entry = ((struct bfd_hash_entry *)
|
||||
|
@ -1,6 +1,6 @@
|
||||
/* Linux dumps "struct task_struct" at the end of the core-file. This
|
||||
structure is currently 920 bytes long, but we allow up to 1024
|
||||
structure is currently 1080 bytes long, but we allow up to 4096
|
||||
bytes to allow for some future growth. */
|
||||
#define TRAD_CORE_EXTRA_SIZE_ALLOWED 1024
|
||||
#define TRAD_CORE_EXTRA_SIZE_ALLOWED 4096
|
||||
#define TRAD_UNIX_CORE_FILE_FAILING_SIGNAL(abfd) \
|
||||
((abfd)->tdata.trad_core_data->u.signal)
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* BFD back-end for linux flavored i386 a.out binaries.
|
||||
Copyright (C) 1992, 93, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 1999
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
@ -297,7 +298,7 @@ new_fixup (info, h, value, builtin)
|
||||
static boolean
|
||||
linux_link_create_dynamic_sections (abfd, info)
|
||||
bfd *abfd;
|
||||
struct bfd_link_info *info;
|
||||
struct bfd_link_info *info ATTRIBUTE_UNUSED;
|
||||
{
|
||||
flagword flags;
|
||||
register asection *s;
|
||||
@ -446,7 +447,7 @@ linux_tally_symbols (h, data)
|
||||
alloc = (char *) bfd_malloc (strlen (name) + 1);
|
||||
|
||||
if (p == NULL || alloc == NULL)
|
||||
(*_bfd_error_handler) ("Output file requires shared library `%s'\n",
|
||||
(*_bfd_error_handler) (_("Output file requires shared library `%s'\n"),
|
||||
name);
|
||||
else
|
||||
{
|
||||
@ -454,7 +455,7 @@ linux_tally_symbols (h, data)
|
||||
p = strrchr (alloc, '_');
|
||||
*p++ = '\0';
|
||||
(*_bfd_error_handler)
|
||||
("Output file requires shared library `%s.so.%s'\n",
|
||||
(_("Output file requires shared library `%s.so.%s'\n"),
|
||||
alloc, p);
|
||||
free (alloc);
|
||||
}
|
||||
@ -642,7 +643,7 @@ linux_finish_dynamic_link (output_bfd, info)
|
||||
&& f->h->root.root.type != bfd_link_hash_defweak)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("Symbol %s not defined for fixups\n",
|
||||
(_("Symbol %s not defined for fixups\n"),
|
||||
f->h->root.root.root.string);
|
||||
continue;
|
||||
}
|
||||
@ -692,7 +693,7 @@ linux_finish_dynamic_link (output_bfd, info)
|
||||
&& f->h->root.root.type != bfd_link_hash_defweak)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("Symbol %s not defined for fixups\n",
|
||||
(_("Symbol %s not defined for fixups\n"),
|
||||
f->h->root.root.root.string);
|
||||
continue;
|
||||
}
|
||||
@ -716,7 +717,7 @@ linux_finish_dynamic_link (output_bfd, info)
|
||||
|
||||
if (linux_hash_table (info)->fixup_count != fixups_written)
|
||||
{
|
||||
(*_bfd_error_handler) ("Warning: fixup count mismatch\n");
|
||||
(*_bfd_error_handler) (_("Warning: fixup count mismatch\n"));
|
||||
while (linux_hash_table (info)->fixup_count > fixups_written)
|
||||
{
|
||||
bfd_put_32 (output_bfd, 0, fixup_table);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD back-end for ieee-695 objects.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
Written by Steve Chamberlain of Cygnus Support.
|
||||
@ -32,6 +32,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "ieee.h"
|
||||
#include "libieee.h"
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
static boolean ieee_write_byte PARAMS ((bfd *, int));
|
||||
static boolean ieee_write_2bytes PARAMS ((bfd *, int));
|
||||
static boolean ieee_write_int PARAMS ((bfd *, bfd_vma));
|
||||
@ -162,7 +164,7 @@ ieee_write_id (abfd, id)
|
||||
else
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s: string too long (%d chars, max 65535)",
|
||||
(_("%s: string too long (%d chars, max 65535)"),
|
||||
bfd_get_filename (abfd), length);
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
@ -292,7 +294,7 @@ ieee_write_expression (abfd, value, symbol, pcrel, index)
|
||||
else
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s: unrecognized symbol `%s' flags 0x%x",
|
||||
(_("%s: unrecognized symbol `%s' flags 0x%x"),
|
||||
bfd_get_filename (abfd), bfd_asymbol_name (symbol),
|
||||
symbol->flags);
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
@ -683,7 +685,7 @@ get_symbol (abfd,
|
||||
max_index,
|
||||
this_type
|
||||
)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
ieee_data_type *ieee;
|
||||
ieee_symbol_type *last_symbol;
|
||||
unsigned int *symbol_count;
|
||||
@ -788,7 +790,7 @@ ieee_slurp_external_symbols (abfd)
|
||||
break;
|
||||
default:
|
||||
(*_bfd_error_handler)
|
||||
("%s: unimplemented ATI record %u for symbol %u",
|
||||
(_("%s: unimplemented ATI record %u for symbol %u"),
|
||||
bfd_get_filename (abfd), symbol_attribute_def,
|
||||
symbol_name_index);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
@ -803,6 +805,44 @@ ieee_slurp_external_symbols (abfd)
|
||||
parse_int (&(ieee->h), &value);
|
||||
parse_int (&(ieee->h), &value);
|
||||
break;
|
||||
case ieee_atn_record_enum:
|
||||
/* We may get call optimization information here,
|
||||
which we just ignore. The format is
|
||||
{$F1}${CE}{index}{$00}{$3F}{$3F}{#_of_ASNs} */
|
||||
parse_int (&ieee->h, &value);
|
||||
parse_int (&ieee->h, &value);
|
||||
parse_int (&ieee->h, &value);
|
||||
if (value != 0x3f)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
(_("%s: unexpected ATN type %d in external part"),
|
||||
bfd_get_filename (abfd), (int) value);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
}
|
||||
parse_int (&ieee->h, &value);
|
||||
parse_int (&ieee->h, &value);
|
||||
while (value > 0)
|
||||
{
|
||||
bfd_vma val1;
|
||||
|
||||
--value;
|
||||
|
||||
switch (read_2bytes (ieee))
|
||||
{
|
||||
case ieee_asn_record_enum:
|
||||
parse_int (&ieee->h, &val1);
|
||||
parse_int (&ieee->h, &val1);
|
||||
break;
|
||||
|
||||
default:
|
||||
(*_bfd_error_handler)
|
||||
(_("%s: unexpected type after ATN"),
|
||||
bfd_get_filename (abfd));
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@ -823,6 +863,28 @@ ieee_slurp_external_symbols (abfd)
|
||||
&extra,
|
||||
&symbol->symbol.section);
|
||||
|
||||
/* Fully linked IEEE-695 files tend to give every symbol
|
||||
an absolute value. Try to convert that back into a
|
||||
section relative value. FIXME: This won't always to
|
||||
the right thing. */
|
||||
if (bfd_is_abs_section (symbol->symbol.section)
|
||||
&& (abfd->flags & HAS_RELOC) == 0)
|
||||
{
|
||||
bfd_vma val;
|
||||
asection *s;
|
||||
|
||||
val = symbol->symbol.value;
|
||||
for (s = abfd->sections; s != NULL; s = s->next)
|
||||
{
|
||||
if (val >= s->vma && val < s->vma + s->_raw_size)
|
||||
{
|
||||
symbol->symbol.section = s;
|
||||
symbol->symbol.value -= s->vma;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
symbol->symbol.flags = BSF_GLOBAL | BSF_EXPORT;
|
||||
|
||||
}
|
||||
@ -947,8 +1009,17 @@ ieee_get_symtab (abfd, location)
|
||||
ieee_symbol_type *symp;
|
||||
static bfd dummy_bfd;
|
||||
static asymbol empty_symbol =
|
||||
/* the_bfd, name, value, attr, section */
|
||||
{&dummy_bfd, " ieee empty", (symvalue) 0, BSF_DEBUGGING, bfd_abs_section_ptr};
|
||||
{
|
||||
&dummy_bfd,
|
||||
" ieee empty",
|
||||
(symvalue) 0,
|
||||
BSF_DEBUGGING,
|
||||
bfd_abs_section_ptr
|
||||
#ifdef __STDC__
|
||||
/* K&R compilers can't initialise unions. */
|
||||
, { 0 }
|
||||
#endif
|
||||
};
|
||||
|
||||
if (abfd->symcount)
|
||||
{
|
||||
@ -1218,6 +1289,7 @@ ieee_slurp_debug (abfd)
|
||||
{
|
||||
ieee_data_type *ieee = IEEE_DATA (abfd);
|
||||
asection *sec;
|
||||
file_ptr debug_end;
|
||||
|
||||
if (ieee->w.r.debug_information_part == 0)
|
||||
return true;
|
||||
@ -1227,7 +1299,13 @@ ieee_slurp_debug (abfd)
|
||||
return false;
|
||||
sec->flags |= SEC_DEBUGGING | SEC_HAS_CONTENTS;
|
||||
sec->filepos = ieee->w.r.debug_information_part;
|
||||
sec->_raw_size = ieee->w.r.data_part - ieee->w.r.debug_information_part;
|
||||
|
||||
debug_end = ieee->w.r.data_part;
|
||||
if (debug_end == 0)
|
||||
debug_end = ieee->w.r.trailer_part;
|
||||
if (debug_end == 0)
|
||||
debug_end = ieee->w.r.me_record;
|
||||
sec->_raw_size = debug_end - ieee->w.r.debug_information_part;
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -1267,7 +1345,7 @@ ieee_archive_p (abfd)
|
||||
if (this_byte (&(ieee->h)) != Module_Beginning)
|
||||
{
|
||||
abfd->tdata.ieee_ar_data = save;
|
||||
goto error_return;
|
||||
goto got_wrong_format_error;
|
||||
}
|
||||
|
||||
next_byte (&(ieee->h));
|
||||
@ -1276,7 +1354,7 @@ ieee_archive_p (abfd)
|
||||
{
|
||||
bfd_release (abfd, ieee);
|
||||
abfd->tdata.ieee_ar_data = save;
|
||||
goto error_return;
|
||||
goto got_wrong_format_error;
|
||||
}
|
||||
/* Throw away the filename */
|
||||
read_id (&(ieee->h));
|
||||
@ -1379,6 +1457,8 @@ ieee_archive_p (abfd)
|
||||
|
||||
return abfd->xvec;
|
||||
|
||||
got_wrong_format_error:
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
error_return:
|
||||
if (elts != NULL)
|
||||
free (elts);
|
||||
@ -1440,7 +1520,70 @@ ieee_object_p (abfd)
|
||||
/* Determine the architecture and machine type of the object file.
|
||||
*/
|
||||
{
|
||||
const bfd_arch_info_type *arch = bfd_scan_arch (processor);
|
||||
const bfd_arch_info_type *arch;
|
||||
char family[10];
|
||||
|
||||
/* IEEE does not specify the format of the processor identificaton
|
||||
string, so the compiler is free to put in it whatever it wants.
|
||||
We try here to recognize different processors belonging to the
|
||||
m68k family. Code for other processors can be added here. */
|
||||
if ((processor[0] == '6') && (processor[1] == '8'))
|
||||
{
|
||||
if (processor[2] == '3') /* 683xx integrated processors */
|
||||
{
|
||||
switch (processor[3])
|
||||
{
|
||||
case '0': /* 68302, 68306, 68307 */
|
||||
case '2': /* 68322, 68328 */
|
||||
case '5': /* 68356 */
|
||||
strcpy (family, "68000"); /* MC68000-based controllers */
|
||||
break;
|
||||
|
||||
case '3': /* 68330, 68331, 68332, 68333,
|
||||
68334, 68335, 68336, 68338 */
|
||||
case '6': /* 68360 */
|
||||
case '7': /* 68376 */
|
||||
strcpy (family, "68332"); /* CPU32 and CPU32+ */
|
||||
break;
|
||||
|
||||
case '4':
|
||||
if (processor[4] == '9') /* 68349 */
|
||||
strcpy (family, "68030"); /* CPU030 */
|
||||
else /* 68340, 68341 */
|
||||
strcpy (family, "68332"); /* CPU32 and CPU32+ */
|
||||
break;
|
||||
|
||||
default: /* Does not exist yet */
|
||||
strcpy (family, "68332"); /* Guess it will be CPU32 */
|
||||
}
|
||||
}
|
||||
else if (toupper (processor[3]) == 'F') /* 68F333 */
|
||||
strcpy (family, "68332"); /* CPU32 */
|
||||
else if ((toupper (processor[3]) == 'C') /* Embedded controllers */
|
||||
&& ((toupper (processor[2]) == 'E')
|
||||
|| (toupper (processor[2]) == 'H')
|
||||
|| (toupper (processor[2]) == 'L')))
|
||||
{
|
||||
strcpy (family, "68");
|
||||
strncat (family, processor + 4, 7);
|
||||
family[9] = '\0';
|
||||
}
|
||||
else /* "Regular" processors */
|
||||
{
|
||||
strncpy (family, processor, 9);
|
||||
family[9] = '\0';
|
||||
}
|
||||
}
|
||||
else if ((strncmp (processor, "cpu32", 5) == 0) /* CPU32 and CPU32+ */
|
||||
|| (strncmp (processor, "CPU32", 5) == 0))
|
||||
strcpy (family, "68332");
|
||||
else
|
||||
{
|
||||
strncpy (family, processor, 9);
|
||||
family[9] = '\0';
|
||||
}
|
||||
|
||||
arch = bfd_scan_arch (family);
|
||||
if (arch == 0)
|
||||
goto got_wrong_format;
|
||||
abfd->arch_info = arch;
|
||||
@ -1527,7 +1670,7 @@ ieee_object_p (abfd)
|
||||
|
||||
void
|
||||
ieee_get_symbol_info (ignore_abfd, symbol, ret)
|
||||
bfd *ignore_abfd;
|
||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
||||
asymbol *symbol;
|
||||
symbol_info *ret;
|
||||
{
|
||||
@ -1540,7 +1683,7 @@ ieee_get_symbol_info (ignore_abfd, symbol, ret)
|
||||
|
||||
void
|
||||
ieee_print_symbol (ignore_abfd, afile, symbol, how)
|
||||
bfd *ignore_abfd;
|
||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
||||
PTR afile;
|
||||
asymbol *symbol;
|
||||
bfd_print_symbol_type how;
|
||||
@ -3038,7 +3181,7 @@ block ()
|
||||
|
||||
static void
|
||||
relocate_debug (output, input)
|
||||
bfd *output;
|
||||
bfd *output ATTRIBUTE_UNUSED;
|
||||
bfd *input;
|
||||
{
|
||||
#define IBS 400
|
||||
@ -3433,10 +3576,22 @@ ieee_write_processor (abfd)
|
||||
|
||||
case bfd_arch_m68k:
|
||||
{
|
||||
char ab[20];
|
||||
const char *id;
|
||||
|
||||
sprintf (ab, "%lu", arch->mach);
|
||||
if (! ieee_write_id (abfd, ab))
|
||||
switch (arch->mach)
|
||||
{
|
||||
default: id = "68020"; break;
|
||||
case bfd_mach_m68000: id = "68000"; break;
|
||||
case bfd_mach_m68008: id = "68008"; break;
|
||||
case bfd_mach_m68010: id = "68010"; break;
|
||||
case bfd_mach_m68020: id = "68020"; break;
|
||||
case bfd_mach_m68030: id = "68030"; break;
|
||||
case bfd_mach_m68040: id = "68040"; break;
|
||||
case bfd_mach_m68060: id = "68060"; break;
|
||||
case bfd_mach_cpu32: id = "cpu32"; break;
|
||||
}
|
||||
|
||||
if (! ieee_write_id (abfd, id))
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
@ -3625,13 +3780,13 @@ ieee_find_nearest_line (abfd,
|
||||
filename_ptr,
|
||||
functionname_ptr,
|
||||
line_ptr)
|
||||
bfd *abfd;
|
||||
asection *section;
|
||||
asymbol **symbols;
|
||||
bfd_vma offset;
|
||||
char **filename_ptr;
|
||||
char **functionname_ptr;
|
||||
int *line_ptr;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
asection *section ATTRIBUTE_UNUSED;
|
||||
asymbol **symbols ATTRIBUTE_UNUSED;
|
||||
bfd_vma offset ATTRIBUTE_UNUSED;
|
||||
const char **filename_ptr ATTRIBUTE_UNUSED;
|
||||
const char **functionname_ptr ATTRIBUTE_UNUSED;
|
||||
unsigned int *line_ptr ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@ -3670,8 +3825,8 @@ ieee_generic_stat_arch_elt (abfd, buf)
|
||||
|
||||
static int
|
||||
ieee_sizeof_headers (abfd, x)
|
||||
bfd *abfd;
|
||||
boolean x;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
boolean x ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -3773,6 +3928,7 @@ ieee_bfd_debug_info_accumulate (abfd, section)
|
||||
#define ieee_bfd_get_relocated_section_contents \
|
||||
bfd_generic_get_relocated_section_contents
|
||||
#define ieee_bfd_relax_section bfd_generic_relax_section
|
||||
#define ieee_bfd_gc_sections bfd_generic_gc_sections
|
||||
#define ieee_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define ieee_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define ieee_bfd_final_link _bfd_generic_final_link
|
||||
@ -3828,5 +3984,7 @@ const bfd_target ieee_vec =
|
||||
BFD_JUMP_TABLE_LINK (ieee),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
NULL,
|
||||
|
||||
(PTR) 0
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD back-end for Intel Hex objects.
|
||||
Copyright 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
|
||||
Copyright 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor of Cygnus Support <ian@cygnus.com>.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -146,7 +146,7 @@ static int ihex_sizeof_headers PARAMS ((bfd *, boolean));
|
||||
|
||||
/* The number of bytes we put on one line during output. */
|
||||
|
||||
#define CHUNK (21)
|
||||
#define CHUNK 16
|
||||
|
||||
/* Macros for converting between hex and binary. */
|
||||
|
||||
@ -256,7 +256,7 @@ ihex_bad_byte (abfd, lineno, c, error)
|
||||
buf[1] = '\0';
|
||||
}
|
||||
(*_bfd_error_handler)
|
||||
("%s:%d: unexpected character `%s' in Intel Hex file\n",
|
||||
(_("%s:%d: unexpected character `%s' in Intel Hex file\n"),
|
||||
bfd_get_filename (abfd), lineno, buf);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
}
|
||||
@ -366,7 +366,7 @@ ihex_scan (abfd)
|
||||
if (((- chksum) & 0xff) != (unsigned int) HEX2 (buf + 2 * i))
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s:%d: bad checksum in Intel Hex file (expected %u, found %u)",
|
||||
(_("%s:%d: bad checksum in Intel Hex file (expected %u, found %u)"),
|
||||
bfd_get_filename (abfd), lineno,
|
||||
(- chksum) & 0xff, (unsigned int) HEX2 (buf + 2 * i));
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
@ -418,7 +418,7 @@ ihex_scan (abfd)
|
||||
if (len != 2)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s:%d: bad extended address record length in Intel Hex file",
|
||||
(_("%s:%d: bad extended address record length in Intel Hex file"),
|
||||
bfd_get_filename (abfd), lineno);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
goto error_return;
|
||||
@ -435,7 +435,7 @@ ihex_scan (abfd)
|
||||
if (len != 4)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s:%d: bad extended start address length in Intel Hex file",
|
||||
(_("%s:%d: bad extended start address length in Intel Hex file"),
|
||||
bfd_get_filename (abfd), lineno);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
goto error_return;
|
||||
@ -452,7 +452,7 @@ ihex_scan (abfd)
|
||||
if (len != 2)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s:%d: bad extended linear address record length in Intel Hex file",
|
||||
(_("%s:%d: bad extended linear address record length in Intel Hex file"),
|
||||
bfd_get_filename (abfd), lineno);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
goto error_return;
|
||||
@ -469,7 +469,7 @@ ihex_scan (abfd)
|
||||
if (len != 2 && len != 4)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s:%d: bad extended linear start address length in Intel Hex file",
|
||||
(_("%s:%d: bad extended linear start address length in Intel Hex file"),
|
||||
bfd_get_filename (abfd), lineno);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
goto error_return;
|
||||
@ -486,7 +486,7 @@ ihex_scan (abfd)
|
||||
|
||||
default:
|
||||
(*_bfd_error_handler)
|
||||
("%s:%d: unrecognized ihex type %u in Intel Hex file\n",
|
||||
(_("%s:%d: unrecognized ihex type %u in Intel Hex file\n"),
|
||||
bfd_get_filename (abfd), lineno, type);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
goto error_return;
|
||||
@ -606,7 +606,7 @@ ihex_read_section (abfd, section, contents)
|
||||
if (type != 0)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s: internal error in ihex_read_section",
|
||||
(_("%s: internal error in ihex_read_section"),
|
||||
bfd_get_filename (abfd));
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
goto error_return;
|
||||
@ -641,7 +641,7 @@ ihex_read_section (abfd, section, contents)
|
||||
if ((bfd_size_type) (p - contents) < section->_raw_size)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s: bad section length in ihex_read_section",
|
||||
(_("%s: bad section length in ihex_read_section"),
|
||||
bfd_get_filename (abfd));
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
goto error_return;
|
||||
@ -855,7 +855,7 @@ ihex_write_object_contents (abfd)
|
||||
|
||||
sprintf_vma (buf, where);
|
||||
(*_bfd_error_handler)
|
||||
("%s: address 0x%s out of range for Intex Hex file",
|
||||
(_("%s: address 0x%s out of range for Intex Hex file"),
|
||||
bfd_get_filename (abfd), buf);
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
@ -947,8 +947,8 @@ ihex_set_arch_mach (abfd, arch, mach)
|
||||
/*ARGSUSED*/
|
||||
static int
|
||||
ihex_sizeof_headers (abfd, exec)
|
||||
bfd *abfd;
|
||||
boolean exec;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
boolean exec ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -982,6 +982,7 @@ ihex_sizeof_headers (abfd, exec)
|
||||
#define ihex_bfd_get_relocated_section_contents \
|
||||
bfd_generic_get_relocated_section_contents
|
||||
#define ihex_bfd_relax_section bfd_generic_relax_section
|
||||
#define ihex_bfd_gc_sections bfd_generic_gc_sections
|
||||
#define ihex_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
|
||||
#define ihex_bfd_link_add_symbols _bfd_generic_link_add_symbols
|
||||
#define ihex_bfd_final_link _bfd_generic_final_link
|
||||
@ -1036,5 +1037,7 @@ const bfd_target ihex_vec =
|
||||
BFD_JUMP_TABLE_LINK (ihex),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
NULL,
|
||||
|
||||
(PTR) 0
|
||||
};
|
||||
|
@ -232,6 +232,7 @@ enum machine_type {
|
||||
M_PMAX_NETBSD = 139, /* NetBSD/pmax (MIPS little-endian) binary */
|
||||
M_VAX_NETBSD = 140, /* NetBSD/vax binary */
|
||||
M_ALPHA_NETBSD = 141, /* NetBSD/alpha binary */
|
||||
M_ARM6_NETBSD = 143, /* NetBSD/arm32 binary */
|
||||
M_SPARCLET_1 = 147, /* 0x93, reserved */
|
||||
M_MIPS1 = 151, /* MIPS R2000/R3000 binary */
|
||||
M_MIPS2 = 152, /* MIPS R4000/R6000 binary */
|
||||
@ -243,7 +244,8 @@ enum machine_type {
|
||||
M_HPUX = (0x20c % 256), /* HP 200/300 HPUX binary */
|
||||
M_SPARCLET_5 = 211, /* 0xd3, reserved */
|
||||
M_SPARCLET_6 = 227, /* 0xe3, reserved */
|
||||
M_SPARCLET_7 = 243 /* 0xf3, reserved */
|
||||
/* M_SPARCLET_7 = 243 / * 0xf3, reserved */
|
||||
M_SPARCLITE_LE = 243
|
||||
};
|
||||
|
||||
#define N_DYNAMIC(exec) ((exec).a_info & 0x80000000)
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* libbfd.h -- Declarations used by bfd library *implementation*.
|
||||
(This include file is not for users of the library.)
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||
Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
** NOTE: libbfd.h is a GENERATED file. Don't change it; instead,
|
||||
@ -317,6 +318,10 @@ extern boolean _bfd_generic_set_section_contents
|
||||
((boolean (*) \
|
||||
PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *))) \
|
||||
bfd_false)
|
||||
#define _bfd_nolink_bfd_gc_sections \
|
||||
((boolean (*) \
|
||||
PARAMS ((bfd *, struct bfd_link_info *))) \
|
||||
bfd_false)
|
||||
#define _bfd_nolink_bfd_link_hash_table_create \
|
||||
((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
|
||||
#define _bfd_nolink_bfd_link_add_symbols \
|
||||
@ -352,10 +357,15 @@ extern boolean _bfd_stab_section_find_nearest_line
|
||||
PARAMS ((bfd *, asymbol **, asection *, bfd_vma, boolean *, const char **,
|
||||
const char **, unsigned int *, PTR *));
|
||||
|
||||
/* Find the neaderst line using DWARF 1 debugging information. */
|
||||
extern boolean _bfd_dwarf1_find_nearest_line
|
||||
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
|
||||
const char **, unsigned int *));
|
||||
|
||||
/* Find the nearest line using DWARF 2 debugging information. */
|
||||
extern boolean _bfd_dwarf2_find_nearest_line
|
||||
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
|
||||
const char **, unsigned int *));
|
||||
const char **, unsigned int *, unsigned int));
|
||||
|
||||
/* A routine to create entries for a bfd_link_hash_table. */
|
||||
extern struct bfd_hash_entry *_bfd_link_hash_newfunc
|
||||
@ -469,6 +479,9 @@ extern bfd_size_type _bfd_stringtab_add
|
||||
|
||||
/* Write out a string table. */
|
||||
extern boolean _bfd_stringtab_emit PARAMS ((bfd *, struct bfd_strtab_hash *));
|
||||
|
||||
/* Check that endianness of input and output file match. */
|
||||
extern boolean _bfd_generic_verify_endian_match PARAMS ((bfd *, bfd *));
|
||||
|
||||
/* Macros to tell if bfds are read or write enabled.
|
||||
|
||||
@ -490,6 +503,17 @@ void bfd_assert PARAMS ((const char*,int));
|
||||
#define BFD_FAIL() \
|
||||
{ bfd_assert(__FILE__,__LINE__); }
|
||||
|
||||
extern void _bfd_abort PARAMS ((const char *, int, const char *))
|
||||
ATTRIBUTE_NORETURN;
|
||||
|
||||
/* if gcc >= 2.6, we can give a function name, too */
|
||||
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
|
||||
#define __PRETTY_FUNCTION__ ((char *) NULL)
|
||||
#endif
|
||||
|
||||
#undef abort
|
||||
#define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
|
||||
|
||||
FILE * bfd_cache_lookup_worker PARAMS ((bfd *));
|
||||
|
||||
extern bfd *bfd_last_cache;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* Assorted BFD support routines, only used internally.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
|
||||
Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
@ -45,7 +45,7 @@ DESCRIPTION
|
||||
/*ARGSUSED*/
|
||||
boolean
|
||||
bfd_false (ignore)
|
||||
bfd *ignore;
|
||||
bfd *ignore ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
@ -57,7 +57,7 @@ bfd_false (ignore)
|
||||
/*ARGSUSED*/
|
||||
boolean
|
||||
bfd_true (ignore)
|
||||
bfd *ignore;
|
||||
bfd *ignore ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -68,7 +68,7 @@ bfd_true (ignore)
|
||||
/*ARGSUSED*/
|
||||
PTR
|
||||
bfd_nullvoidptr (ignore)
|
||||
bfd *ignore;
|
||||
bfd *ignore ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return NULL;
|
||||
@ -77,7 +77,7 @@ bfd_nullvoidptr (ignore)
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
bfd_0 (ignore)
|
||||
bfd *ignore;
|
||||
bfd *ignore ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -85,7 +85,7 @@ bfd_0 (ignore)
|
||||
/*ARGSUSED*/
|
||||
unsigned int
|
||||
bfd_0u (ignore)
|
||||
bfd *ignore;
|
||||
bfd *ignore ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -93,7 +93,7 @@ bfd_0u (ignore)
|
||||
/*ARGUSED*/
|
||||
long
|
||||
bfd_0l (ignore)
|
||||
bfd *ignore;
|
||||
bfd *ignore ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@ -104,7 +104,7 @@ bfd_0l (ignore)
|
||||
/*ARGSUSED*/
|
||||
long
|
||||
_bfd_n1 (ignore_abfd)
|
||||
bfd *ignore_abfd;
|
||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return -1;
|
||||
@ -113,15 +113,15 @@ _bfd_n1 (ignore_abfd)
|
||||
/*ARGSUSED*/
|
||||
void
|
||||
bfd_void (ignore)
|
||||
bfd *ignore;
|
||||
bfd *ignore ATTRIBUTE_UNUSED;
|
||||
{
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
boolean
|
||||
_bfd_nocore_core_file_matches_executable_p (ignore_core_bfd, ignore_exec_bfd)
|
||||
bfd *ignore_core_bfd;
|
||||
bfd *ignore_exec_bfd;
|
||||
bfd *ignore_core_bfd ATTRIBUTE_UNUSED;
|
||||
bfd *ignore_exec_bfd ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
@ -133,7 +133,7 @@ _bfd_nocore_core_file_matches_executable_p (ignore_core_bfd, ignore_exec_bfd)
|
||||
/*ARGSUSED*/
|
||||
char *
|
||||
_bfd_nocore_core_file_failing_command (ignore_abfd)
|
||||
bfd *ignore_abfd;
|
||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return (char *)NULL;
|
||||
@ -145,7 +145,7 @@ _bfd_nocore_core_file_failing_command (ignore_abfd)
|
||||
/*ARGSUSED*/
|
||||
int
|
||||
_bfd_nocore_core_file_failing_signal (ignore_abfd)
|
||||
bfd *ignore_abfd;
|
||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return 0;
|
||||
@ -154,7 +154,7 @@ _bfd_nocore_core_file_failing_signal (ignore_abfd)
|
||||
/*ARGSUSED*/
|
||||
const bfd_target *
|
||||
_bfd_dummy_target (ignore_abfd)
|
||||
bfd *ignore_abfd;
|
||||
bfd *ignore_abfd ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return 0;
|
||||
@ -232,7 +232,25 @@ real_read (where, a,b, file)
|
||||
size_t b;
|
||||
FILE *file;
|
||||
{
|
||||
/* FIXME - this looks like an optimization, but it's really to cover
|
||||
up for a feature of some OSs (not solaris - sigh) that
|
||||
ld/pe-dll.c takes advantage of (apparently) when it creates BFDs
|
||||
internally and tries to link against them. BFD seems to be smart
|
||||
enough to realize there are no symbol records in the "file" that
|
||||
doesn't exist but attempts to read them anyway. On Solaris,
|
||||
attempting to read zero bytes from a NULL file results in a core
|
||||
dump, but on other platforms it just returns zero bytes read.
|
||||
This makes it to something reasonable. - DJ */
|
||||
if (a == 0 || b == 0)
|
||||
return 0;
|
||||
|
||||
#if defined (__VAX) && defined (VMS)
|
||||
/* Apparently fread on Vax VMS does not keep the record length
|
||||
information. */
|
||||
return read (fileno (file), where, a * b);
|
||||
#else
|
||||
return fread (where, a, b, file);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Return value is amount read (FIXME: how are errors and end of file dealt
|
||||
@ -256,7 +274,10 @@ bfd_read (ptr, size, nitems, abfd)
|
||||
get = size * nitems;
|
||||
if (abfd->where + get > bim->size)
|
||||
{
|
||||
get = bim->size - abfd->where;
|
||||
if (bim->size < (bfd_size_type) abfd->where)
|
||||
get = 0;
|
||||
else
|
||||
get = bim->size - abfd->where;
|
||||
bfd_set_error (bfd_error_file_truncated);
|
||||
}
|
||||
memcpy (ptr, bim->buffer + abfd->where, get);
|
||||
@ -275,7 +296,7 @@ bfd_read (ptr, size, nitems, abfd)
|
||||
|
||||
A BFD backend may wish to override bfd_error_file_truncated to
|
||||
provide something more useful (eg. no_symbols or wrong_format). */
|
||||
if (nread < (int)(size * nitems))
|
||||
if (nread != (int) (size * nitems))
|
||||
{
|
||||
if (ferror (bfd_cache_lookup (abfd)))
|
||||
bfd_set_error (bfd_error_system_call);
|
||||
@ -318,7 +339,6 @@ bfd_init_window (windowp)
|
||||
#undef HAVE_MPROTECT /* code's not tested yet */
|
||||
|
||||
#if HAVE_MMAP || HAVE_MPROTECT || HAVE_MADVISE
|
||||
#include <sys/types.h>
|
||||
#include <sys/mman.h>
|
||||
#endif
|
||||
|
||||
@ -461,10 +481,10 @@ bfd_get_file_window (abfd, offset, size, windowp, writable)
|
||||
else if (debug_windows)
|
||||
{
|
||||
if (ok_to_map)
|
||||
fprintf (stderr, "not mapping: data=%lx mapped=%d\n",
|
||||
fprintf (stderr, _("not mapping: data=%lx mapped=%d\n"),
|
||||
(unsigned long) i->data, (int) i->mapped);
|
||||
else
|
||||
fprintf (stderr, "not mapping: env var not set\n");
|
||||
fprintf (stderr, _("not mapping: env var not set\n"));
|
||||
}
|
||||
#else
|
||||
ok_to_map = 0;
|
||||
@ -523,7 +543,29 @@ bfd_write (ptr, size, nitems, abfd)
|
||||
long nwrote;
|
||||
|
||||
if ((abfd->flags & BFD_IN_MEMORY) != 0)
|
||||
abort ();
|
||||
{
|
||||
struct bfd_in_memory *bim = (struct bfd_in_memory *) (abfd->iostream);
|
||||
size *= nitems;
|
||||
if (abfd->where + size > bim->size)
|
||||
{
|
||||
long newsize, oldsize = (bim->size + 127) & ~127;
|
||||
bim->size = abfd->where + size;
|
||||
/* Round up to cut down on memory fragmentation */
|
||||
newsize = (bim->size + 127) & ~127;
|
||||
if (newsize > oldsize)
|
||||
{
|
||||
bim->buffer = bfd_realloc (bim->buffer, newsize);
|
||||
if (bim->buffer == 0)
|
||||
{
|
||||
bim->size = 0;
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
memcpy (bim->buffer + abfd->where, ptr, size);
|
||||
abfd->where += size;
|
||||
return size;
|
||||
}
|
||||
|
||||
nwrote = fwrite (ptr, 1, (size_t) (size * nitems),
|
||||
bfd_cache_lookup (abfd));
|
||||
@ -638,10 +680,22 @@ bfd_seek (abfd, position, direction)
|
||||
|
||||
if ((abfd->flags & BFD_IN_MEMORY) != 0)
|
||||
{
|
||||
struct bfd_in_memory *bim;
|
||||
|
||||
bim = (struct bfd_in_memory *) abfd->iostream;
|
||||
|
||||
if (direction == SEEK_SET)
|
||||
abfd->where = position;
|
||||
else
|
||||
abfd->where += position;
|
||||
|
||||
if ((bfd_size_type) abfd->where > bim->size)
|
||||
{
|
||||
abfd->where = bim->size;
|
||||
bfd_set_error (bfd_error_file_truncated);
|
||||
return -1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -753,7 +807,7 @@ DESCRIPTION
|
||||
.{* Byte swapping macros for user section data. *}
|
||||
.
|
||||
.#define bfd_put_8(abfd, val, ptr) \
|
||||
. (*((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) \
|
||||
@ -788,6 +842,20 @@ DESCRIPTION
|
||||
.#define bfd_get_signed_64(abfd, ptr) \
|
||||
. BFD_SEND(abfd, bfd_getx_signed_64, (ptr))
|
||||
.
|
||||
.#define bfd_get(bits, abfd, ptr) \
|
||||
. ((bits) == 8 ? bfd_get_8 (abfd, ptr) \
|
||||
. : (bits) == 16 ? bfd_get_16 (abfd, ptr) \
|
||||
. : (bits) == 32 ? bfd_get_32 (abfd, ptr) \
|
||||
. : (bits) == 64 ? bfd_get_64 (abfd, ptr) \
|
||||
. : (abort (), (bfd_vma) - 1))
|
||||
.
|
||||
.#define bfd_put(bits, abfd, val, ptr) \
|
||||
. ((bits) == 8 ? bfd_put_8 (abfd, val, ptr) \
|
||||
. : (bits) == 16 ? bfd_put_16 (abfd, val, ptr) \
|
||||
. : (bits) == 32 ? bfd_put_32 (abfd, val, ptr) \
|
||||
. : (bits) == 64 ? bfd_put_64 (abfd, val, ptr) \
|
||||
. : (abort (), (void) 0))
|
||||
.
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -844,7 +912,8 @@ DESCRIPTION
|
||||
|
||||
/* Sign extension to bfd_signed_vma. */
|
||||
#define COERCE16(x) (((bfd_signed_vma) (x) ^ 0x8000) - 0x8000)
|
||||
#define COERCE32(x) (((bfd_signed_vma) (x) ^ 0x80000000) - 0x80000000)
|
||||
#define COERCE32(x) \
|
||||
((bfd_signed_vma) (long) (((unsigned long) (x) ^ 0x80000000) - 0x80000000))
|
||||
#define EIGHT_GAZILLION (((BFD_HOST_64_BIT)0x80000000) << 32)
|
||||
#define COERCE64(x) \
|
||||
(((bfd_signed_vma) (x) ^ EIGHT_GAZILLION) - EIGHT_GAZILLION)
|
||||
@ -899,37 +968,57 @@ bfd_vma
|
||||
bfd_getb32 (addr)
|
||||
register const bfd_byte *addr;
|
||||
{
|
||||
return (((((bfd_vma)addr[0] << 8) | addr[1]) << 8)
|
||||
| addr[2]) << 8 | addr[3];
|
||||
unsigned long v;
|
||||
|
||||
v = (unsigned long) addr[0] << 24;
|
||||
v |= (unsigned long) addr[1] << 16;
|
||||
v |= (unsigned long) addr[2] << 8;
|
||||
v |= (unsigned long) addr[3];
|
||||
return (bfd_vma) v;
|
||||
}
|
||||
|
||||
bfd_vma
|
||||
bfd_getl32 (addr)
|
||||
register const bfd_byte *addr;
|
||||
{
|
||||
return (((((bfd_vma)addr[3] << 8) | addr[2]) << 8)
|
||||
| addr[1]) << 8 | addr[0];
|
||||
unsigned long v;
|
||||
|
||||
v = (unsigned long) addr[0];
|
||||
v |= (unsigned long) addr[1] << 8;
|
||||
v |= (unsigned long) addr[2] << 16;
|
||||
v |= (unsigned long) addr[3] << 24;
|
||||
return (bfd_vma) v;
|
||||
}
|
||||
|
||||
bfd_signed_vma
|
||||
bfd_getb_signed_32 (addr)
|
||||
register const bfd_byte *addr;
|
||||
{
|
||||
return COERCE32((((((bfd_vma)addr[0] << 8) | addr[1]) << 8)
|
||||
| addr[2]) << 8 | addr[3]);
|
||||
unsigned long v;
|
||||
|
||||
v = (unsigned long) addr[0] << 24;
|
||||
v |= (unsigned long) addr[1] << 16;
|
||||
v |= (unsigned long) addr[2] << 8;
|
||||
v |= (unsigned long) addr[3];
|
||||
return COERCE32 (v);
|
||||
}
|
||||
|
||||
bfd_signed_vma
|
||||
bfd_getl_signed_32 (addr)
|
||||
register const bfd_byte *addr;
|
||||
{
|
||||
return COERCE32((((((bfd_vma)addr[3] << 8) | addr[2]) << 8)
|
||||
| addr[1]) << 8 | addr[0]);
|
||||
unsigned long v;
|
||||
|
||||
v = (unsigned long) addr[0];
|
||||
v |= (unsigned long) addr[1] << 8;
|
||||
v |= (unsigned long) addr[2] << 16;
|
||||
v |= (unsigned long) addr[3] << 24;
|
||||
return COERCE32 (v);
|
||||
}
|
||||
|
||||
bfd_vma
|
||||
bfd_getb64 (addr)
|
||||
register const bfd_byte *addr;
|
||||
register const bfd_byte *addr ATTRIBUTE_UNUSED;
|
||||
{
|
||||
#ifdef BFD64
|
||||
bfd_vma low, high;
|
||||
@ -953,7 +1042,7 @@ bfd_getb64 (addr)
|
||||
|
||||
bfd_vma
|
||||
bfd_getl64 (addr)
|
||||
register const bfd_byte *addr;
|
||||
register const bfd_byte *addr ATTRIBUTE_UNUSED;
|
||||
{
|
||||
#ifdef BFD64
|
||||
bfd_vma low, high;
|
||||
@ -977,7 +1066,7 @@ bfd_getl64 (addr)
|
||||
|
||||
bfd_signed_vma
|
||||
bfd_getb_signed_64 (addr)
|
||||
register const bfd_byte *addr;
|
||||
register const bfd_byte *addr ATTRIBUTE_UNUSED;
|
||||
{
|
||||
#ifdef BFD64
|
||||
bfd_vma low, high;
|
||||
@ -1001,7 +1090,7 @@ bfd_getb_signed_64 (addr)
|
||||
|
||||
bfd_signed_vma
|
||||
bfd_getl_signed_64 (addr)
|
||||
register const bfd_byte *addr;
|
||||
register const bfd_byte *addr ATTRIBUTE_UNUSED;
|
||||
{
|
||||
#ifdef BFD64
|
||||
bfd_vma low, high;
|
||||
@ -1046,8 +1135,8 @@ bfd_putl32 (data, addr)
|
||||
|
||||
void
|
||||
bfd_putb64 (data, addr)
|
||||
bfd_vma data;
|
||||
register bfd_byte *addr;
|
||||
bfd_vma data ATTRIBUTE_UNUSED;
|
||||
register bfd_byte *addr ATTRIBUTE_UNUSED;
|
||||
{
|
||||
#ifdef BFD64
|
||||
addr[0] = (bfd_byte)(data >> (7*8));
|
||||
@ -1065,8 +1154,8 @@ bfd_putb64 (data, addr)
|
||||
|
||||
void
|
||||
bfd_putl64 (data, addr)
|
||||
bfd_vma data;
|
||||
register bfd_byte *addr;
|
||||
bfd_vma data ATTRIBUTE_UNUSED;
|
||||
register bfd_byte *addr ATTRIBUTE_UNUSED;
|
||||
{
|
||||
#ifdef BFD64
|
||||
addr[7] = (bfd_byte)(data >> (7*8));
|
||||
@ -1092,22 +1181,29 @@ _bfd_generic_get_section_contents (abfd, section, location, offset, count)
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
{
|
||||
if (count == 0)
|
||||
return true;
|
||||
if ((bfd_size_type)(offset+count) > section->_raw_size
|
||||
|| bfd_seek(abfd, (file_ptr)(section->filepos + offset), SEEK_SET) == -1
|
||||
|| bfd_read(location, (bfd_size_type)1, count, abfd) != count)
|
||||
return (false); /* on error */
|
||||
return (true);
|
||||
if (count == 0)
|
||||
return true;
|
||||
|
||||
if ((bfd_size_type) (offset + count) > section->_raw_size)
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
|
||||
|| bfd_read (location, (bfd_size_type) 1, count, abfd) != count)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean
|
||||
_bfd_generic_get_section_contents_in_window (abfd, section, w, offset, count)
|
||||
bfd *abfd;
|
||||
sec_ptr section;
|
||||
bfd_window *w;
|
||||
file_ptr offset;
|
||||
bfd_size_type count;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
sec_ptr section ATTRIBUTE_UNUSED;
|
||||
bfd_window *w ATTRIBUTE_UNUSED;
|
||||
file_ptr offset ATTRIBUTE_UNUSED;
|
||||
bfd_size_type count ATTRIBUTE_UNUSED;
|
||||
{
|
||||
#ifdef USE_MMAP
|
||||
if (count == 0)
|
||||
@ -1180,13 +1276,14 @@ DESCRIPTION
|
||||
@var{x} of 1025 returns 11.
|
||||
*/
|
||||
|
||||
unsigned
|
||||
bfd_log2(x)
|
||||
unsigned int
|
||||
bfd_log2 (x)
|
||||
bfd_vma x;
|
||||
{
|
||||
unsigned result = 0;
|
||||
while ( (bfd_vma)(1<< result) < x)
|
||||
result++;
|
||||
unsigned int result = 0;
|
||||
|
||||
while ((x = (x >> 1)) != 0)
|
||||
++result;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -1200,3 +1297,26 @@ bfd_generic_is_local_label_name (abfd, name)
|
||||
return (name[0] == locals_prefix);
|
||||
}
|
||||
|
||||
/* Can be used from / for bfd_merge_private_bfd_data to check that
|
||||
endianness matches between input and output file. Returns
|
||||
true for a match, otherwise returns false and emits an error. */
|
||||
boolean
|
||||
_bfd_generic_verify_endian_match (ibfd, obfd)
|
||||
bfd *ibfd;
|
||||
bfd *obfd;
|
||||
{
|
||||
if (ibfd->xvec->byteorder != obfd->xvec->byteorder
|
||||
&& obfd->xvec->byteorder != BFD_ENDIAN_UNKNOWN)
|
||||
{
|
||||
(*_bfd_error_handler)
|
||||
("%s: compiled for a %s endian system and target is %s endian",
|
||||
bfd_get_filename (ibfd),
|
||||
bfd_big_endian (ibfd) ? "big" : "little",
|
||||
bfd_big_endian (obfd) ? "big" : "little");
|
||||
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
/* libbfd.h -- Declarations used by bfd library *implementation*.
|
||||
(This include file is not for users of the library.)
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 1998 Free Software Foundation, Inc.
|
||||
Copyright 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000
|
||||
Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
** NOTE: libbfd.h is a GENERATED file. Don't change it; instead,
|
||||
@ -317,6 +318,10 @@ extern boolean _bfd_generic_set_section_contents
|
||||
((boolean (*) \
|
||||
PARAMS ((bfd *, asection *, struct bfd_link_info *, boolean *))) \
|
||||
bfd_false)
|
||||
#define _bfd_nolink_bfd_gc_sections \
|
||||
((boolean (*) \
|
||||
PARAMS ((bfd *, struct bfd_link_info *))) \
|
||||
bfd_false)
|
||||
#define _bfd_nolink_bfd_link_hash_table_create \
|
||||
((struct bfd_link_hash_table *(*) PARAMS ((bfd *))) bfd_nullvoidptr)
|
||||
#define _bfd_nolink_bfd_link_add_symbols \
|
||||
@ -352,10 +357,15 @@ extern boolean _bfd_stab_section_find_nearest_line
|
||||
PARAMS ((bfd *, asymbol **, asection *, bfd_vma, boolean *, const char **,
|
||||
const char **, unsigned int *, PTR *));
|
||||
|
||||
/* Find the neaderst line using DWARF 1 debugging information. */
|
||||
extern boolean _bfd_dwarf1_find_nearest_line
|
||||
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
|
||||
const char **, unsigned int *));
|
||||
|
||||
/* Find the nearest line using DWARF 2 debugging information. */
|
||||
extern boolean _bfd_dwarf2_find_nearest_line
|
||||
PARAMS ((bfd *, asection *, asymbol **, bfd_vma, const char **,
|
||||
const char **, unsigned int *));
|
||||
const char **, unsigned int *, unsigned int));
|
||||
|
||||
/* A routine to create entries for a bfd_link_hash_table. */
|
||||
extern struct bfd_hash_entry *_bfd_link_hash_newfunc
|
||||
@ -469,6 +479,9 @@ extern bfd_size_type _bfd_stringtab_add
|
||||
|
||||
/* Write out a string table. */
|
||||
extern boolean _bfd_stringtab_emit PARAMS ((bfd *, struct bfd_strtab_hash *));
|
||||
|
||||
/* Check that endianness of input and output file match. */
|
||||
extern boolean _bfd_generic_verify_endian_match PARAMS ((bfd *, bfd *));
|
||||
|
||||
/* Macros to tell if bfds are read or write enabled.
|
||||
|
||||
@ -490,6 +503,17 @@ void bfd_assert PARAMS ((const char*,int));
|
||||
#define BFD_FAIL() \
|
||||
{ bfd_assert(__FILE__,__LINE__); }
|
||||
|
||||
extern void _bfd_abort PARAMS ((const char *, int, const char *))
|
||||
ATTRIBUTE_NORETURN;
|
||||
|
||||
/* if gcc >= 2.6, we can give a function name, too */
|
||||
#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 6)
|
||||
#define __PRETTY_FUNCTION__ ((char *) NULL)
|
||||
#endif
|
||||
|
||||
#undef abort
|
||||
#define abort() _bfd_abort (__FILE__, __LINE__, __PRETTY_FUNCTION__)
|
||||
|
||||
FILE * bfd_cache_lookup_worker PARAMS ((bfd *));
|
||||
|
||||
extern bfd *bfd_last_cache;
|
||||
@ -645,12 +669,20 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
|
||||
"BFD_RELOC_SPARC_M44",
|
||||
"BFD_RELOC_SPARC_L44",
|
||||
"BFD_RELOC_SPARC_REGISTER",
|
||||
"BFD_RELOC_SPARC_REV32",
|
||||
"BFD_RELOC_ALPHA_GPDISP_HI16",
|
||||
"BFD_RELOC_ALPHA_GPDISP_LO16",
|
||||
"BFD_RELOC_ALPHA_GPDISP",
|
||||
"BFD_RELOC_ALPHA_LITERAL",
|
||||
"BFD_RELOC_ALPHA_ELF_LITERAL",
|
||||
"BFD_RELOC_ALPHA_LITUSE",
|
||||
"BFD_RELOC_ALPHA_USER_LITERAL",
|
||||
"BFD_RELOC_ALPHA_USER_LITUSE_BASE",
|
||||
"BFD_RELOC_ALPHA_USER_LITUSE_BYTOFF",
|
||||
"BFD_RELOC_ALPHA_USER_LITUSE_JSR",
|
||||
"BFD_RELOC_ALPHA_USER_GPDISP",
|
||||
"BFD_RELOC_ALPHA_USER_GPRELHIGH",
|
||||
"BFD_RELOC_ALPHA_USER_GPRELLOW",
|
||||
"BFD_RELOC_ALPHA_HINT",
|
||||
"BFD_RELOC_ALPHA_LINKAGE",
|
||||
"BFD_RELOC_ALPHA_CODEADDR",
|
||||
@ -669,6 +701,10 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
|
||||
"BFD_RELOC_MIPS_GOT_LO16",
|
||||
"BFD_RELOC_MIPS_CALL_HI16",
|
||||
"BFD_RELOC_MIPS_CALL_LO16",
|
||||
"BFD_RELOC_MIPS_SUB",
|
||||
"BFD_RELOC_MIPS_GOT_PAGE",
|
||||
"BFD_RELOC_MIPS_GOT_OFST",
|
||||
"BFD_RELOC_MIPS_GOT_DISP",
|
||||
|
||||
"BFD_RELOC_386_GOT32",
|
||||
"BFD_RELOC_386_PLT32",
|
||||
@ -690,6 +726,12 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
|
||||
"BFD_RELOC_NS32K_DISP_8_PCREL",
|
||||
"BFD_RELOC_NS32K_DISP_16_PCREL",
|
||||
"BFD_RELOC_NS32K_DISP_32_PCREL",
|
||||
"BFD_RELOC_PJ_CODE_HI16",
|
||||
"BFD_RELOC_PJ_CODE_LO16",
|
||||
"BFD_RELOC_PJ_CODE_DIR16",
|
||||
"BFD_RELOC_PJ_CODE_DIR32",
|
||||
"BFD_RELOC_PJ_CODE_REL16",
|
||||
"BFD_RELOC_PJ_CODE_REL32",
|
||||
"BFD_RELOC_PPC_B26",
|
||||
"BFD_RELOC_PPC_BA26",
|
||||
"BFD_RELOC_PPC_TOC16",
|
||||
@ -720,9 +762,11 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
|
||||
"BFD_RELOC_PPC_EMB_RELST_HA",
|
||||
"BFD_RELOC_PPC_EMB_BIT_FLD",
|
||||
"BFD_RELOC_PPC_EMB_RELSDA",
|
||||
"BFD_RELOC_I370_D12",
|
||||
"BFD_RELOC_CTOR",
|
||||
"BFD_RELOC_ARM_PCREL_BRANCH",
|
||||
"BFD_RELOC_ARM_IMMEDIATE",
|
||||
"BFD_RELOC_ARM_ADRL_IMMEDIATE",
|
||||
"BFD_RELOC_ARM_OFFSET_IMM",
|
||||
"BFD_RELOC_ARM_SHIFT_IMM",
|
||||
"BFD_RELOC_ARM_SWI",
|
||||
@ -738,6 +782,15 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
|
||||
"BFD_RELOC_ARM_THUMB_IMM",
|
||||
"BFD_RELOC_ARM_THUMB_SHIFT",
|
||||
"BFD_RELOC_ARM_THUMB_OFFSET",
|
||||
"BFD_RELOC_ARM_GOT12",
|
||||
"BFD_RELOC_ARM_GOT32",
|
||||
"BFD_RELOC_ARM_JUMP_SLOT",
|
||||
"BFD_RELOC_ARM_COPY",
|
||||
"BFD_RELOC_ARM_GLOB_DAT",
|
||||
"BFD_RELOC_ARM_PLT32",
|
||||
"BFD_RELOC_ARM_RELATIVE",
|
||||
"BFD_RELOC_ARM_GOTOFF",
|
||||
"BFD_RELOC_ARM_GOTPC",
|
||||
"BFD_RELOC_SH_PCDISP8BY2",
|
||||
"BFD_RELOC_SH_PCDISP12BY2",
|
||||
"BFD_RELOC_SH_IMM4",
|
||||
@ -765,8 +818,17 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
|
||||
"BFD_RELOC_D10V_10_PCREL_L",
|
||||
"BFD_RELOC_D10V_18",
|
||||
"BFD_RELOC_D10V_18_PCREL",
|
||||
|
||||
|
||||
"BFD_RELOC_D30V_6",
|
||||
"BFD_RELOC_D30V_9_PCREL",
|
||||
"BFD_RELOC_D30V_9_PCREL_R",
|
||||
"BFD_RELOC_D30V_15",
|
||||
"BFD_RELOC_D30V_15_PCREL",
|
||||
"BFD_RELOC_D30V_15_PCREL_R",
|
||||
"BFD_RELOC_D30V_21",
|
||||
"BFD_RELOC_D30V_21_PCREL",
|
||||
"BFD_RELOC_D30V_21_PCREL_R",
|
||||
"BFD_RELOC_D30V_32",
|
||||
"BFD_RELOC_D30V_32_PCREL",
|
||||
"BFD_RELOC_M32R_24",
|
||||
"BFD_RELOC_M32R_10_PCREL",
|
||||
"BFD_RELOC_M32R_18_PCREL",
|
||||
@ -785,10 +847,48 @@ static const char *const bfd_reloc_code_real_names[] = { "@@uninitialized@@",
|
||||
"BFD_RELOC_V850_TDA_7_8_OFFSET",
|
||||
"BFD_RELOC_V850_TDA_7_7_OFFSET",
|
||||
"BFD_RELOC_V850_TDA_16_16_OFFSET",
|
||||
"BFD_RELOC_V850_TDA_4_5_OFFSET",
|
||||
"BFD_RELOC_V850_TDA_4_4_OFFSET",
|
||||
"BFD_RELOC_V850_SDA_16_16_SPLIT_OFFSET",
|
||||
"BFD_RELOC_V850_ZDA_16_16_SPLIT_OFFSET",
|
||||
"BFD_RELOC_V850_CALLT_6_7_OFFSET",
|
||||
"BFD_RELOC_V850_CALLT_16_16_OFFSET",
|
||||
|
||||
"BFD_RELOC_MN10300_32_PCREL",
|
||||
"BFD_RELOC_MN10300_16_PCREL",
|
||||
"BFD_RELOC_TIC30_LDP",
|
||||
"BFD_RELOC_FR30_48",
|
||||
"BFD_RELOC_FR30_20",
|
||||
"BFD_RELOC_FR30_6_IN_4",
|
||||
"BFD_RELOC_FR30_8_IN_8",
|
||||
"BFD_RELOC_FR30_9_IN_8",
|
||||
"BFD_RELOC_FR30_10_IN_8",
|
||||
"BFD_RELOC_FR30_9_PCREL",
|
||||
"BFD_RELOC_FR30_12_PCREL",
|
||||
"BFD_RELOC_MCORE_PCREL_IMM8BY4",
|
||||
"BFD_RELOC_MCORE_PCREL_IMM11BY2",
|
||||
"BFD_RELOC_MCORE_PCREL_IMM4BY2",
|
||||
"BFD_RELOC_MCORE_PCREL_32",
|
||||
"BFD_RELOC_MCORE_PCREL_JSR_IMM11BY2",
|
||||
"BFD_RELOC_MCORE_RVA",
|
||||
"BFD_RELOC_AVR_7_PCREL",
|
||||
"BFD_RELOC_AVR_13_PCREL",
|
||||
"BFD_RELOC_AVR_16_PM",
|
||||
"BFD_RELOC_AVR_LO8_LDI",
|
||||
"BFD_RELOC_AVR_HI8_LDI",
|
||||
"BFD_RELOC_AVR_HH8_LDI",
|
||||
"BFD_RELOC_AVR_LO8_LDI_NEG",
|
||||
"BFD_RELOC_AVR_HI8_LDI_NEG",
|
||||
"BFD_RELOC_AVR_HH8_LDI_NEG",
|
||||
"BFD_RELOC_AVR_LO8_LDI_PM",
|
||||
"BFD_RELOC_AVR_HI8_LDI_PM",
|
||||
"BFD_RELOC_AVR_HH8_LDI_PM",
|
||||
"BFD_RELOC_AVR_LO8_LDI_PM_NEG",
|
||||
"BFD_RELOC_AVR_HI8_LDI_PM_NEG",
|
||||
"BFD_RELOC_AVR_HH8_LDI_PM_NEG",
|
||||
"BFD_RELOC_AVR_CALL",
|
||||
"BFD_RELOC_VTABLE_INHERIT",
|
||||
"BFD_RELOC_VTABLE_ENTRY",
|
||||
"@@overflow: BFD_RELOC_UNUSED@@",
|
||||
};
|
||||
#endif
|
||||
@ -804,6 +904,10 @@ bfd_generic_relax_section
|
||||
struct bfd_link_info *,
|
||||
boolean *));
|
||||
|
||||
boolean
|
||||
bfd_generic_gc_sections
|
||||
PARAMS ((bfd *, struct bfd_link_info *));
|
||||
|
||||
bfd_byte *
|
||||
|
||||
bfd_generic_get_relocated_section_contents PARAMS ((bfd *abfd,
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD COFF object file private structure.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
|
||||
Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
@ -56,7 +56,7 @@ typedef struct coff_tdata
|
||||
file_ptr sym_filepos;
|
||||
|
||||
struct coff_ptr_struct *raw_syments;
|
||||
unsigned int raw_syment_count;
|
||||
unsigned long raw_syment_count;
|
||||
|
||||
/* These are only valid once writing has begun */
|
||||
long int relocbase;
|
||||
@ -97,6 +97,9 @@ typedef struct coff_tdata
|
||||
/* Used by coff_find_nearest_line. */
|
||||
PTR line_info;
|
||||
|
||||
/* The timestamp from the COFF file header. */
|
||||
long timestamp;
|
||||
|
||||
/* Copy of some of the f_flags bits in the COFF filehdr structure,
|
||||
used by ARM code. */
|
||||
flagword flags;
|
||||
@ -213,12 +216,14 @@ struct xcoff_section_tdata
|
||||
#define xcoff_section_data(abfd, sec) \
|
||||
((struct xcoff_section_tdata *) coff_section_data ((abfd), (sec))->tdata)
|
||||
|
||||
/* Tdata for sections in PEI image files. */
|
||||
/* Tdata for sections in PE files. */
|
||||
|
||||
struct pei_section_tdata
|
||||
{
|
||||
/* The virtual size of the section. */
|
||||
bfd_size_type virt_size;
|
||||
/* The PE section flags. */
|
||||
long pe_flags;
|
||||
};
|
||||
|
||||
/* An accessor macro for the pei_section_tdata structure. */
|
||||
@ -249,6 +254,11 @@ struct coff_link_hash_entry
|
||||
|
||||
/* Pointer to array of auxiliary entries, if any. */
|
||||
union internal_auxent *aux;
|
||||
|
||||
/* Flag word; legal values follow. */
|
||||
unsigned short coff_link_hash_flags;
|
||||
/* Symbol is a PE section symbol. */
|
||||
#define COFF_LINK_HASH_PE_SECTION_SYMBOL (01)
|
||||
};
|
||||
|
||||
/* COFF linker hash table. */
|
||||
@ -462,6 +472,41 @@ struct coff_final_link_info
|
||||
struct internal_reloc *internal_relocs;
|
||||
};
|
||||
|
||||
/* Most COFF variants have no way to record the alignment of a
|
||||
section. This struct is used to set a specific alignment based on
|
||||
the name of the section. */
|
||||
|
||||
struct coff_section_alignment_entry
|
||||
{
|
||||
/* The section name. */
|
||||
const char *name;
|
||||
|
||||
/* This is either (unsigned int) -1, indicating that the section
|
||||
name must match exactly, or it is the number of letters which
|
||||
must match at the start of the name. */
|
||||
unsigned int comparison_length;
|
||||
|
||||
/* These macros may be used to fill in the first two fields in a
|
||||
structure initialization. */
|
||||
#define COFF_SECTION_NAME_EXACT_MATCH(name) (name), ((unsigned int) -1)
|
||||
#define COFF_SECTION_NAME_PARTIAL_MATCH(name) (name), (sizeof (name) - 1)
|
||||
|
||||
/* Only use this entry if the default section alignment for this
|
||||
target is at least that much (as a power of two). If this field
|
||||
is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored. */
|
||||
unsigned int default_alignment_min;
|
||||
|
||||
/* Only use this entry if the default section alignment for this
|
||||
target is no greater than this (as a power of two). If this
|
||||
field is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored. */
|
||||
unsigned int default_alignment_max;
|
||||
|
||||
#define COFF_ALIGNMENT_FIELD_EMPTY ((unsigned int) -1)
|
||||
|
||||
/* The desired alignment for this section (as a power of two). */
|
||||
unsigned int alignment_power;
|
||||
};
|
||||
|
||||
extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc
|
||||
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
||||
extern boolean _bfd_coff_link_hash_table_init
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD COFF object file private structure.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 1998
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 1999
|
||||
Free Software Foundation, Inc.
|
||||
Written by Cygnus Support.
|
||||
|
||||
@ -56,7 +56,7 @@ typedef struct coff_tdata
|
||||
file_ptr sym_filepos;
|
||||
|
||||
struct coff_ptr_struct *raw_syments;
|
||||
unsigned int raw_syment_count;
|
||||
unsigned long raw_syment_count;
|
||||
|
||||
/* These are only valid once writing has begun */
|
||||
long int relocbase;
|
||||
@ -97,6 +97,9 @@ typedef struct coff_tdata
|
||||
/* Used by coff_find_nearest_line. */
|
||||
PTR line_info;
|
||||
|
||||
/* The timestamp from the COFF file header. */
|
||||
long timestamp;
|
||||
|
||||
/* Copy of some of the f_flags bits in the COFF filehdr structure,
|
||||
used by ARM code. */
|
||||
flagword flags;
|
||||
@ -213,12 +216,14 @@ struct xcoff_section_tdata
|
||||
#define xcoff_section_data(abfd, sec) \
|
||||
((struct xcoff_section_tdata *) coff_section_data ((abfd), (sec))->tdata)
|
||||
|
||||
/* Tdata for sections in PEI image files. */
|
||||
/* Tdata for sections in PE files. */
|
||||
|
||||
struct pei_section_tdata
|
||||
{
|
||||
/* The virtual size of the section. */
|
||||
bfd_size_type virt_size;
|
||||
/* The PE section flags. */
|
||||
long pe_flags;
|
||||
};
|
||||
|
||||
/* An accessor macro for the pei_section_tdata structure. */
|
||||
@ -249,6 +254,11 @@ struct coff_link_hash_entry
|
||||
|
||||
/* Pointer to array of auxiliary entries, if any. */
|
||||
union internal_auxent *aux;
|
||||
|
||||
/* Flag word; legal values follow. */
|
||||
unsigned short coff_link_hash_flags;
|
||||
/* Symbol is a PE section symbol. */
|
||||
#define COFF_LINK_HASH_PE_SECTION_SYMBOL (01)
|
||||
};
|
||||
|
||||
/* COFF linker hash table. */
|
||||
@ -462,6 +472,41 @@ struct coff_final_link_info
|
||||
struct internal_reloc *internal_relocs;
|
||||
};
|
||||
|
||||
/* Most COFF variants have no way to record the alignment of a
|
||||
section. This struct is used to set a specific alignment based on
|
||||
the name of the section. */
|
||||
|
||||
struct coff_section_alignment_entry
|
||||
{
|
||||
/* The section name. */
|
||||
const char *name;
|
||||
|
||||
/* This is either (unsigned int) -1, indicating that the section
|
||||
name must match exactly, or it is the number of letters which
|
||||
must match at the start of the name. */
|
||||
unsigned int comparison_length;
|
||||
|
||||
/* These macros may be used to fill in the first two fields in a
|
||||
structure initialization. */
|
||||
#define COFF_SECTION_NAME_EXACT_MATCH(name) (name), ((unsigned int) -1)
|
||||
#define COFF_SECTION_NAME_PARTIAL_MATCH(name) (name), (sizeof (name) - 1)
|
||||
|
||||
/* Only use this entry if the default section alignment for this
|
||||
target is at least that much (as a power of two). If this field
|
||||
is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored. */
|
||||
unsigned int default_alignment_min;
|
||||
|
||||
/* Only use this entry if the default section alignment for this
|
||||
target is no greater than this (as a power of two). If this
|
||||
field is COFF_ALIGNMENT_FIELD_EMPTY, it should be ignored. */
|
||||
unsigned int default_alignment_max;
|
||||
|
||||
#define COFF_ALIGNMENT_FIELD_EMPTY ((unsigned int) -1)
|
||||
|
||||
/* The desired alignment for this section (as a power of two). */
|
||||
unsigned int alignment_power;
|
||||
};
|
||||
|
||||
extern struct bfd_hash_entry *_bfd_coff_link_hash_newfunc
|
||||
PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *));
|
||||
extern boolean _bfd_coff_link_hash_table_init
|
||||
@ -581,6 +626,22 @@ struct lineno_cache_entry *lineno;
|
||||
/* Have the line numbers been relocated yet ? */
|
||||
boolean done_lineno;
|
||||
} coff_symbol_type;
|
||||
/* COFF symbol classifications. */
|
||||
|
||||
enum coff_symbol_classification
|
||||
{
|
||||
/* Global symbol. */
|
||||
COFF_SYMBOL_GLOBAL,
|
||||
/* Common symbol. */
|
||||
COFF_SYMBOL_COMMON,
|
||||
/* Undefined symbol. */
|
||||
COFF_SYMBOL_UNDEFINED,
|
||||
/* Local symbol. */
|
||||
COFF_SYMBOL_LOCAL,
|
||||
/* PE section symbol. */
|
||||
COFF_SYMBOL_PE_SECTION
|
||||
};
|
||||
|
||||
typedef struct
|
||||
{
|
||||
void (*_bfd_coff_swap_aux_in) PARAMS ((
|
||||
@ -648,6 +709,7 @@ typedef struct
|
||||
unsigned int _bfd_auxesz;
|
||||
unsigned int _bfd_relsz;
|
||||
unsigned int _bfd_linesz;
|
||||
unsigned int _bfd_filnmlen;
|
||||
boolean _bfd_coff_long_filenames;
|
||||
boolean _bfd_coff_long_section_names;
|
||||
unsigned int _bfd_coff_default_section_alignment_power;
|
||||
@ -680,7 +742,8 @@ typedef struct
|
||||
flagword (*_bfd_styp_to_sec_flags_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
PTR internal_scnhdr,
|
||||
const char *name));
|
||||
const char *name,
|
||||
asection *section));
|
||||
void (*_bfd_set_alignment_hook) PARAMS ((
|
||||
bfd *abfd,
|
||||
asection *sec,
|
||||
@ -717,7 +780,7 @@ typedef struct
|
||||
arelent *r,
|
||||
unsigned int shrink,
|
||||
struct bfd_link_info *link_info));
|
||||
boolean (*_bfd_coff_sym_is_global) PARAMS ((
|
||||
enum coff_symbol_classification (*_bfd_coff_classify_symbol) PARAMS ((
|
||||
bfd *abfd,
|
||||
struct internal_syment *));
|
||||
boolean (*_bfd_coff_compute_section_file_positions) PARAMS ((
|
||||
@ -761,7 +824,8 @@ typedef struct
|
||||
struct bfd_link_hash_entry **hashp));
|
||||
|
||||
boolean (*_bfd_coff_link_output_has_begun) PARAMS ((
|
||||
bfd * abfd ));
|
||||
bfd * abfd,
|
||||
struct coff_final_link_info * pfinfo));
|
||||
boolean (*_bfd_coff_final_link_postscript) PARAMS ((
|
||||
bfd * abfd,
|
||||
struct coff_final_link_info * pfinfo));
|
||||
@ -807,6 +871,7 @@ typedef struct
|
||||
#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz)
|
||||
#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz)
|
||||
#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz)
|
||||
#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen)
|
||||
#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames)
|
||||
#define bfd_coff_long_section_names(abfd) \
|
||||
(coff_backend_info (abfd)->_bfd_coff_long_section_names)
|
||||
@ -832,8 +897,9 @@ typedef struct
|
||||
#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))
|
||||
|
||||
#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name)\
|
||||
((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook) (abfd, scnhdr, name))
|
||||
#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section)\
|
||||
((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\
|
||||
(abfd, scnhdr, name, section))
|
||||
|
||||
#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\
|
||||
((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))
|
||||
@ -856,8 +922,8 @@ typedef struct
|
||||
((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\
|
||||
(abfd, section, reloc, shrink, link_info))
|
||||
|
||||
#define bfd_coff_sym_is_global(abfd, sym)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_sym_is_global)\
|
||||
#define bfd_coff_classify_symbol(abfd, sym)\
|
||||
((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\
|
||||
(abfd, sym))
|
||||
|
||||
#define bfd_coff_compute_section_file_positions(abfd)\
|
||||
@ -880,8 +946,8 @@ typedef struct
|
||||
((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\
|
||||
(info, abfd, name, flags, section, value, string, cp, coll, hashp))
|
||||
|
||||
#define bfd_coff_link_output_has_begun(a) \
|
||||
((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a))
|
||||
#define bfd_coff_link_output_has_begun(a,p) \
|
||||
((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p))
|
||||
#define bfd_coff_final_link_postscript(a,p) \
|
||||
((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p))
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD ECOFF object file private structure.
|
||||
Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 94, 95, 96, 97, 1999 Free Software Foundation, Inc.
|
||||
Written by Ian Lance Taylor, Cygnus Support.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -341,7 +341,7 @@ extern PTR _bfd_ecoff_mkobject_hook PARAMS ((bfd *, PTR filehdr, PTR aouthdr));
|
||||
((void (*) PARAMS ((bfd *, asection *, PTR))) bfd_void)
|
||||
extern boolean _bfd_ecoff_set_arch_mach_hook PARAMS ((bfd *abfd, PTR filehdr));
|
||||
extern flagword _bfd_ecoff_styp_to_sec_flags
|
||||
PARAMS ((bfd *abfd, PTR hdr, const char *name));
|
||||
PARAMS ((bfd *abfd, PTR hdr, const char *name, asection *section));
|
||||
extern boolean _bfd_ecoff_slurp_symbol_table PARAMS ((bfd *abfd));
|
||||
|
||||
/* ECOFF auxiliary information swapping routines. These are the same
|
||||
|
@ -1,5 +1,6 @@
|
||||
/* linker.c -- BFD linker routines
|
||||
Copyright (C) 1993, 94, 95, 96, 1997 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 94, 95, 96, 97, 98, 1999
|
||||
Free Software Foundation, Inc.
|
||||
Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -74,7 +75,7 @@ SUBSECTION
|
||||
@cindex target vector (_bfd_link_hash_table_create)
|
||||
The linker routines must create a hash table, which must be
|
||||
derived from <<struct bfd_link_hash_table>> described in
|
||||
<<bfdlink.c>>. @xref{Hash Tables} for information on how to
|
||||
<<bfdlink.c>>. @xref{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.
|
||||
|
||||
@ -693,7 +694,7 @@ static boolean
|
||||
generic_link_read_symbols (abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (abfd->outsymbols == (asymbol **) NULL)
|
||||
if (bfd_get_outsymbols (abfd) == (asymbol **) NULL)
|
||||
{
|
||||
long symsize;
|
||||
long symcount;
|
||||
@ -701,13 +702,13 @@ generic_link_read_symbols (abfd)
|
||||
symsize = bfd_get_symtab_upper_bound (abfd);
|
||||
if (symsize < 0)
|
||||
return false;
|
||||
abfd->outsymbols = (asymbol **) bfd_alloc (abfd, symsize);
|
||||
if (abfd->outsymbols == NULL && symsize != 0)
|
||||
bfd_get_outsymbols (abfd) = (asymbol **) bfd_alloc (abfd, symsize);
|
||||
if (bfd_get_outsymbols (abfd) == NULL && symsize != 0)
|
||||
return false;
|
||||
symcount = bfd_canonicalize_symtab (abfd, abfd->outsymbols);
|
||||
symcount = bfd_canonicalize_symtab (abfd, bfd_get_outsymbols (abfd));
|
||||
if (symcount < 0)
|
||||
return false;
|
||||
abfd->symcount = symcount;
|
||||
bfd_get_symcount (abfd) = symcount;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1748,8 +1749,8 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
|
||||
case MDEF:
|
||||
/* Handle a multiple definition. */
|
||||
{
|
||||
asection *msec;
|
||||
bfd_vma mval;
|
||||
asection *msec = NULL;
|
||||
bfd_vma mval = 0;
|
||||
|
||||
switch (h->type)
|
||||
{
|
||||
@ -1935,8 +1936,8 @@ _bfd_generic_final_link (abfd, info)
|
||||
size_t outsymalloc;
|
||||
struct generic_write_global_symbol_info wginfo;
|
||||
|
||||
abfd->outsymbols = (asymbol **) NULL;
|
||||
abfd->symcount = 0;
|
||||
bfd_get_outsymbols (abfd) = (asymbol **) NULL;
|
||||
bfd_get_symcount (abfd) = 0;
|
||||
outsymalloc = 0;
|
||||
|
||||
/* Mark all sections which will be included in the output file. */
|
||||
@ -1958,6 +1959,12 @@ _bfd_generic_final_link (abfd, info)
|
||||
_bfd_generic_link_write_global_symbol,
|
||||
(PTR) &wginfo);
|
||||
|
||||
/* Make sure we have a trailing NULL pointer on OUTSYMBOLS. We
|
||||
shouldn't really need one, since we have SYMCOUNT, but some old
|
||||
code still expects one. */
|
||||
if (! generic_add_output_symbol (abfd, &outsymalloc, NULL))
|
||||
return false;
|
||||
|
||||
if (info->relocateable)
|
||||
{
|
||||
/* Allocate space for the output relocs for each section. */
|
||||
@ -2047,7 +2054,7 @@ _bfd_generic_final_link (abfd, info)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -2059,7 +2066,7 @@ generic_add_output_symbol (output_bfd, psymalloc, sym)
|
||||
size_t *psymalloc;
|
||||
asymbol *sym;
|
||||
{
|
||||
if (output_bfd->symcount >= *psymalloc)
|
||||
if (bfd_get_symcount (output_bfd) >= *psymalloc)
|
||||
{
|
||||
asymbol **newsyms;
|
||||
|
||||
@ -2067,15 +2074,16 @@ generic_add_output_symbol (output_bfd, psymalloc, sym)
|
||||
*psymalloc = 124;
|
||||
else
|
||||
*psymalloc *= 2;
|
||||
newsyms = (asymbol **) bfd_realloc (output_bfd->outsymbols,
|
||||
newsyms = (asymbol **) bfd_realloc (bfd_get_outsymbols (output_bfd),
|
||||
*psymalloc * sizeof (asymbol *));
|
||||
if (newsyms == (asymbol **) NULL)
|
||||
return false;
|
||||
output_bfd->outsymbols = newsyms;
|
||||
bfd_get_outsymbols (output_bfd) = newsyms;
|
||||
}
|
||||
|
||||
output_bfd->outsymbols[output_bfd->symcount] = sym;
|
||||
++output_bfd->symcount;
|
||||
bfd_get_outsymbols (output_bfd) [bfd_get_symcount (output_bfd)] = sym;
|
||||
if (sym != NULL)
|
||||
++ bfd_get_symcount (output_bfd);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -2516,7 +2524,9 @@ _bfd_generic_reloc_link_order (abfd, info, sec, link_order)
|
||||
break;
|
||||
}
|
||||
ok = bfd_set_section_contents (abfd, sec, (PTR) buf,
|
||||
(file_ptr) link_order->offset, size);
|
||||
(file_ptr)
|
||||
(link_order->offset *
|
||||
bfd_octets_per_byte (abfd)), size);
|
||||
free (buf);
|
||||
if (! ok)
|
||||
return false;
|
||||
@ -2584,7 +2594,9 @@ _bfd_default_link_order (abfd, info, sec, link_order)
|
||||
case bfd_data_link_order:
|
||||
return bfd_set_section_contents (abfd, sec,
|
||||
(PTR) link_order->u.data.contents,
|
||||
(file_ptr) link_order->offset,
|
||||
(file_ptr)
|
||||
(link_order->offset *
|
||||
bfd_octets_per_byte (abfd)),
|
||||
link_order->size);
|
||||
}
|
||||
}
|
||||
@ -2595,7 +2607,7 @@ _bfd_default_link_order (abfd, info, sec, link_order)
|
||||
static boolean
|
||||
default_fill_link_order (abfd, info, sec, link_order)
|
||||
bfd *abfd;
|
||||
struct bfd_link_info *info;
|
||||
struct bfd_link_info *info ATTRIBUTE_UNUSED;
|
||||
asection *sec;
|
||||
struct bfd_link_order *link_order;
|
||||
{
|
||||
@ -2618,7 +2630,9 @@ default_fill_link_order (abfd, info, sec, link_order)
|
||||
for (i = 1; i < size; i += 2)
|
||||
space[i] = fill;
|
||||
result = bfd_set_section_contents (abfd, sec, space,
|
||||
(file_ptr) link_order->offset,
|
||||
(file_ptr)
|
||||
(link_order->offset *
|
||||
bfd_octets_per_byte (abfd)),
|
||||
link_order->size);
|
||||
free (space);
|
||||
return result;
|
||||
@ -2662,7 +2676,7 @@ default_indirect_link_order (output_bfd, info, output_section, link_order,
|
||||
types of object files. Handling this case correctly is
|
||||
difficult, and sometimes impossible. */
|
||||
(*_bfd_error_handler)
|
||||
("Attempt to do relocateable link with %s input and %s output",
|
||||
(_("Attempt to do relocateable link with %s input and %s output"),
|
||||
bfd_get_target (input_bfd), bfd_get_target (output_bfd));
|
||||
bfd_set_error (bfd_error_wrong_format);
|
||||
return false;
|
||||
@ -2735,7 +2749,10 @@ default_indirect_link_order (output_bfd, info, output_section, link_order,
|
||||
/* Output the section contents. */
|
||||
if (! bfd_set_section_contents (output_bfd, output_section,
|
||||
(PTR) new_contents,
|
||||
link_order->offset, link_order->size))
|
||||
(file_ptr)
|
||||
(link_order->offset *
|
||||
bfd_octets_per_byte (output_bfd)),
|
||||
link_order->size))
|
||||
goto error_return;
|
||||
|
||||
if (contents != NULL)
|
||||
@ -2790,8 +2807,8 @@ DESCRIPTION
|
||||
|
||||
boolean
|
||||
_bfd_generic_link_split_section (abfd, sec)
|
||||
bfd *abfd;
|
||||
asection *sec;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
asection *sec ATTRIBUTE_UNUSED;
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD backend for MIPS BSD (a.out) binaries.
|
||||
Copyright (C) 1993, 94, 95, 97, 1998 Free Software Foundation, Inc.
|
||||
Copyright (C) 1993, 94, 95, 97, 98, 1999 Free Software Foundation, Inc.
|
||||
Written by Ralph Campbell.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -45,7 +45,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#define SET_ARCH_MACH(ABFD, EXEC) \
|
||||
MY(set_arch_mach)(ABFD, N_MACHTYPE (EXEC)); \
|
||||
MY(choose_reloc_size)(ABFD);
|
||||
void MY(set_arch_mach) PARAMS ((bfd *abfd, int machtype));
|
||||
static void MY(set_arch_mach) PARAMS ((bfd *abfd, int machtype));
|
||||
static void MY(choose_reloc_size) PARAMS ((bfd *abfd));
|
||||
|
||||
#define MY_write_object_contents MY(write_object_contents)
|
||||
@ -66,7 +66,7 @@ static boolean MY(write_object_contents) PARAMS ((bfd *abfd));
|
||||
|
||||
#include "aout-target.h"
|
||||
|
||||
void
|
||||
static void
|
||||
MY(set_arch_mach) (abfd, machtype)
|
||||
bfd *abfd;
|
||||
int machtype;
|
||||
@ -187,10 +187,10 @@ MY(write_object_contents) (abfd)
|
||||
*/
|
||||
static bfd_reloc_status_type
|
||||
mips_fix_jmp_addr (abfd,reloc_entry,symbol,data,input_section,output_bfd)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *reloc_entry;
|
||||
struct symbol_cache_entry *symbol;
|
||||
PTR data;
|
||||
PTR data ATTRIBUTE_UNUSED;
|
||||
asection *input_section;
|
||||
bfd *output_bfd;
|
||||
{
|
||||
@ -240,13 +240,13 @@ mips_fix_hi16_s PARAMS ((bfd *, arelent *, asymbol *, PTR,
|
||||
static bfd_reloc_status_type
|
||||
mips_fix_hi16_s (abfd, reloc_entry, symbol, data, input_section,
|
||||
output_bfd, error_message)
|
||||
bfd *abfd;
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section;
|
||||
PTR data ATTRIBUTE_UNUSED;
|
||||
asection *input_section ATTRIBUTE_UNUSED;
|
||||
bfd *output_bfd;
|
||||
char **error_message;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
bfd_vma relocation;
|
||||
|
||||
@ -389,6 +389,8 @@ static CONST struct aout_backend_data MY(backend_data) = {
|
||||
0 /* finish_dynamic_link */
|
||||
};
|
||||
|
||||
extern const bfd_target aout_mips_big_vec;
|
||||
|
||||
const bfd_target aout_mips_little_vec =
|
||||
{
|
||||
"a.out-mips-little", /* name */
|
||||
@ -425,7 +427,9 @@ const bfd_target aout_mips_little_vec =
|
||||
BFD_JUMP_TABLE_LINK (MY),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
(PTR) MY_backend_data,
|
||||
& aout_mips_big_vec,
|
||||
|
||||
(PTR) MY_backend_data
|
||||
};
|
||||
|
||||
const bfd_target aout_mips_big_vec =
|
||||
@ -464,5 +468,7 @@ const bfd_target aout_mips_big_vec =
|
||||
BFD_JUMP_TABLE_LINK (MY),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
(PTR) MY_backend_data,
|
||||
& aout_mips_little_vec,
|
||||
|
||||
(PTR) MY_backend_data
|
||||
};
|
||||
|
@ -23,13 +23,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "libbfd.h"
|
||||
#include "libaout.h" /* BFD a.out internal data structures */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/dir.h>
|
||||
#include <signal.h>
|
||||
#include <sys/core.h>
|
||||
#include <errno.h>
|
||||
|
||||
/*
|
||||
* FIXME: On NetBSD/sparc CORE_FPU_OFFSET should be (sizeof(struct trapframe))
|
||||
@ -250,5 +247,7 @@ const bfd_target netbsd_core_vec =
|
||||
BFD_JUMP_TABLE_LINK (_bfd_nolink),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
NULL,
|
||||
|
||||
(PTR) 0 /* backend_data */
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD back-end definitions used by all NetBSD targets.
|
||||
Copyright (C) 1990, 91, 92, 94, 95, 96, 97 1998
|
||||
Copyright (C) 1990, 91, 92, 94, 95, 96, 97, 98, 2000
|
||||
Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
@ -91,11 +91,7 @@ MY(write_object_contents) (abfd)
|
||||
NAME(aout,adjust_sizes_and_vmas) (abfd, &text_size, &text_end);
|
||||
}
|
||||
|
||||
#if CHOOSE_RELOC_SIZE
|
||||
CHOOSE_RELOC_SIZE(abfd);
|
||||
#else
|
||||
obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
|
||||
#endif
|
||||
|
||||
/* Magic number, maestro, please! */
|
||||
switch (bfd_get_arch(abfd)) {
|
||||
|
@ -530,6 +530,109 @@ bfd_create (filename, templ)
|
||||
return nbfd;
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_make_writable
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_make_writable(bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Takes a BFD as created by <<bfd_create>> and converts it
|
||||
into one like as returned by <<bfd_openw>>. It does this
|
||||
by converting the BFD to BFD_IN_MEMORY. It's assumed that
|
||||
you will call <<bfd_make_readable>> on this bfd later.
|
||||
|
||||
RETURNS
|
||||
<<true>> is returned if all is ok, otherwise <<false>>.
|
||||
*/
|
||||
|
||||
boolean
|
||||
bfd_make_writable(abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
struct bfd_in_memory *bim;
|
||||
|
||||
if (abfd->direction != no_direction)
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
}
|
||||
|
||||
bim = (struct bfd_in_memory *) bfd_malloc (sizeof (struct bfd_in_memory));
|
||||
abfd->iostream = (PTR) bim;
|
||||
/* bfd_write will grow these as needed */
|
||||
bim->size = 0;
|
||||
bim->buffer = 0;
|
||||
|
||||
abfd->flags |= BFD_IN_MEMORY;
|
||||
abfd->direction = write_direction;
|
||||
abfd->where = 0;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
FUNCTION
|
||||
bfd_make_readable
|
||||
|
||||
SYNOPSIS
|
||||
boolean bfd_make_readable(bfd *abfd);
|
||||
|
||||
DESCRIPTION
|
||||
Takes a BFD as created by <<bfd_create>> and
|
||||
<<bfd_make_writable>> and converts it into one like as
|
||||
returned by <<bfd_openr>>. It does this by writing the
|
||||
contents out to the memory buffer, then reversing the
|
||||
direction.
|
||||
|
||||
RETURNS
|
||||
<<true>> is returned if all is ok, otherwise <<false>>. */
|
||||
|
||||
boolean
|
||||
bfd_make_readable(abfd)
|
||||
bfd *abfd;
|
||||
{
|
||||
if (abfd->direction != write_direction || !(abfd->flags & BFD_IN_MEMORY))
|
||||
{
|
||||
bfd_set_error (bfd_error_invalid_operation);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (! BFD_SEND_FMT (abfd, _bfd_write_contents, (abfd)))
|
||||
return false;
|
||||
|
||||
if (! BFD_SEND (abfd, _close_and_cleanup, (abfd)))
|
||||
return false;
|
||||
|
||||
|
||||
abfd->arch_info = &bfd_default_arch_struct;
|
||||
|
||||
abfd->where = 0;
|
||||
abfd->sections = (asection *) NULL;
|
||||
abfd->format = bfd_unknown;
|
||||
abfd->my_archive = (bfd *) NULL;
|
||||
abfd->origin = 0;
|
||||
abfd->opened_once = false;
|
||||
abfd->output_has_begun = false;
|
||||
abfd->section_count = 0;
|
||||
abfd->usrdata = (PTR) NULL;
|
||||
abfd->cacheable = false;
|
||||
abfd->flags = BFD_IN_MEMORY;
|
||||
abfd->mtime_set = false;
|
||||
|
||||
abfd->target_defaulted = true;
|
||||
abfd->direction = read_direction;
|
||||
abfd->sections = 0;
|
||||
abfd->symcount = 0;
|
||||
abfd->outsymbols = 0;
|
||||
abfd->tdata.any = 0;
|
||||
|
||||
bfd_check_format(abfd, bfd_object);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
INTERNAL_FUNCTION
|
||||
bfd_alloc
|
||||
|
@ -1,5 +1,5 @@
|
||||
/* BFD back-end for OSF/1 core files.
|
||||
Copyright 1993, 94, 95, 1997 Free Software Foundation, Inc.
|
||||
Copyright 1993, 94, 95, 97, 1998 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
@ -24,8 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/user.h>
|
||||
#include <sys/core.h>
|
||||
|
||||
@ -145,7 +143,7 @@ osf_core_core_file_p (abfd)
|
||||
flags = SEC_HAS_CONTENTS;
|
||||
break;
|
||||
default:
|
||||
(*_bfd_error_handler) ("Unhandled OSF/1 core file section type %d\n",
|
||||
(*_bfd_error_handler) (_("Unhandled OSF/1 core file section type %d\n"),
|
||||
core_scnhdr.scntype);
|
||||
continue;
|
||||
}
|
||||
@ -252,5 +250,7 @@ const bfd_target osf_core_vec =
|
||||
BFD_JUMP_TABLE_LINK (_bfd_nolink),
|
||||
BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
|
||||
|
||||
NULL,
|
||||
|
||||
(PTR) 0 /* backend_data */
|
||||
};
|
||||
|
47
contrib/binutils/bfd/pe-arm.c
Normal file
47
contrib/binutils/bfd/pe-arm.c
Normal file
@ -0,0 +1,47 @@
|
||||
/* BFD back-end for ARM PECOFF files.
|
||||
Copyright 1995, 1999 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"
|
||||
|
||||
#ifndef TARGET_LITTLE_SYM
|
||||
#define TARGET_LITTLE_SYM armpe_little_vec
|
||||
#define TARGET_LITTLE_NAME "pe-arm-little"
|
||||
#define TARGET_BIG_SYM armpe_big_vec
|
||||
#define TARGET_BIG_NAME "pe-arm-big"
|
||||
#endif
|
||||
|
||||
#define COFF_WITH_PE
|
||||
#define PCRELOFFSET true
|
||||
#define COFF_LONG_SECTION_NAMES
|
||||
|
||||
#ifndef bfd_arm_allocate_interworking_sections
|
||||
#define bfd_arm_allocate_interworking_sections \
|
||||
bfd_arm_pe_allocate_interworking_sections
|
||||
#define bfd_arm_get_bfd_for_interworking \
|
||||
bfd_arm_pe_get_bfd_for_interworking
|
||||
#define bfd_arm_process_before_allocation \
|
||||
bfd_arm_pe_process_before_allocation
|
||||
#endif
|
||||
|
||||
#ifdef ARM_WINCE
|
||||
#define TARGET_UNDERSCORE 0
|
||||
#endif
|
||||
|
||||
#include "coff-arm.c"
|
@ -1,5 +1,5 @@
|
||||
/* BFD back-end for Intel 386 PECOFF files.
|
||||
Copyright 1995 Free Software Foundation, Inc.
|
||||
Copyright 1995, 1996, 1999 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of BFD, the Binary File Descriptor library.
|
||||
|
||||
@ -27,5 +27,12 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
|
||||
#define PCRELOFFSET true
|
||||
#define TARGET_UNDERSCORE '_'
|
||||
#define COFF_LONG_SECTION_NAMES
|
||||
#define COFF_LONG_FILENAMES
|
||||
|
||||
#define COFF_SECTION_ALIGNMENT_ENTRIES \
|
||||
{ COFF_SECTION_NAME_PARTIAL_MATCH (".idata"), \
|
||||
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, \
|
||||
{ COFF_SECTION_NAME_EXACT_MATCH (".pdata"), \
|
||||
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 2 }
|
||||
|
||||
#include "coff-i386.c"
|
||||
|
998
contrib/binutils/bfd/pe-mips.c
Normal file
998
contrib/binutils/bfd/pe-mips.c
Normal file
@ -0,0 +1,998 @@
|
||||
/* BFD back-end for MIPS PE COFF files.
|
||||
Copyright (C) 1990, 91, 92, 93, 94, 95, 96, 97, 98, 99, 2000 Free Software Foundation, Inc.
|
||||
Modified from coff-i386.c by DJ Delorie, dj@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. */
|
||||
|
||||
#define COFF_WITH_PE
|
||||
#define COFF_LONG_SECTION_NAMES
|
||||
#define PCRELOFFSET true
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
#include "libbfd.h"
|
||||
|
||||
#include "coff/mipspe.h"
|
||||
|
||||
#include "coff/internal.h"
|
||||
|
||||
#include "coff/pe.h"
|
||||
|
||||
#include "libcoff.h"
|
||||
|
||||
static bfd_reloc_status_type coff_mips_reloc
|
||||
PARAMS ((bfd *, arelent *, asymbol *, PTR, asection *, bfd *, char **));
|
||||
static reloc_howto_type *coff_mips_rtype_to_howto
|
||||
PARAMS ((bfd *, asection *, struct internal_reloc *,
|
||||
struct coff_link_hash_entry *, struct internal_syment *,
|
||||
|
||||
bfd_vma *));
|
||||
#if 0
|
||||
static void mips_ecoff_swap_reloc_in PARAMS ((bfd *, PTR,
|
||||
struct internal_reloc *));
|
||||
static void mips_ecoff_swap_reloc_out PARAMS ((bfd *,
|
||||
const struct internal_reloc *,
|
||||
PTR));
|
||||
static void mips_adjust_reloc_in PARAMS ((bfd *,
|
||||
const struct internal_reloc *,
|
||||
arelent *));
|
||||
static void mips_adjust_reloc_out PARAMS ((bfd *, const arelent *,
|
||||
struct internal_reloc *));
|
||||
#endif
|
||||
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
|
||||
/* The page size is a guess based on ELF. */
|
||||
|
||||
#define COFF_PAGE_SIZE 0x1000
|
||||
|
||||
/* For some reason when using mips COFF the value stored in the .text
|
||||
section for a reference to a common symbol is the value itself plus
|
||||
any desired offset. Ian Taylor, Cygnus Support. */
|
||||
|
||||
/* If we are producing relocateable output, we need to do some
|
||||
adjustments to the object file that are not done by the
|
||||
bfd_perform_relocation function. This function is called by every
|
||||
reloc type to make any required adjustments. */
|
||||
|
||||
static bfd_reloc_status_type
|
||||
coff_mips_reloc (abfd, reloc_entry, symbol, data, input_section, output_bfd,
|
||||
error_message)
|
||||
bfd *abfd;
|
||||
arelent *reloc_entry;
|
||||
asymbol *symbol;
|
||||
PTR data;
|
||||
asection *input_section ATTRIBUTE_UNUSED;
|
||||
bfd *output_bfd;
|
||||
char **error_message ATTRIBUTE_UNUSED;
|
||||
{
|
||||
symvalue diff;
|
||||
|
||||
if (output_bfd == (bfd *) NULL)
|
||||
return bfd_reloc_continue;
|
||||
|
||||
if (bfd_is_com_section (symbol->section))
|
||||
{
|
||||
#ifndef COFF_WITH_PE
|
||||
/* We are relocating a common symbol. The current value in the
|
||||
object file is ORIG + OFFSET, where ORIG is the value of the
|
||||
common symbol as seen by the object file when it was compiled
|
||||
(this may be zero if the symbol was undefined) and OFFSET is
|
||||
the offset into the common symbol (normally zero, but may be
|
||||
non-zero when referring to a field in a common structure).
|
||||
ORIG is the negative of reloc_entry->addend, which is set by
|
||||
the CALC_ADDEND macro below. We want to replace the value in
|
||||
the object file with NEW + OFFSET, where NEW is the value of
|
||||
the common symbol which we are going to put in the final
|
||||
object file. NEW is symbol->value. */
|
||||
diff = symbol->value + reloc_entry->addend;
|
||||
#else
|
||||
/* In PE mode, we do not offset the common symbol. */
|
||||
diff = reloc_entry->addend;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
/* For some reason bfd_perform_relocation always effectively
|
||||
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 0
|
||||
/* dj - handle it like any other reloc? */
|
||||
/* FIXME: How should this case be handled? */
|
||||
if (reloc_entry->howto->type == MIPS_R_RVA && diff != 0)
|
||||
abort ();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define DOIT(x) \
|
||||
x = ((x & ~howto->dst_mask) | (((x & howto->src_mask) + (diff >> howto->rightshift)) & howto->dst_mask))
|
||||
|
||||
if (diff != 0)
|
||||
{
|
||||
reloc_howto_type *howto = reloc_entry->howto;
|
||||
unsigned char *addr = (unsigned char *) data + reloc_entry->address;
|
||||
|
||||
switch (howto->size)
|
||||
{
|
||||
case 0:
|
||||
{
|
||||
char x = bfd_get_8 (abfd, addr);
|
||||
DOIT (x);
|
||||
bfd_put_8 (abfd, x, addr);
|
||||
}
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
short x = bfd_get_16 (abfd, addr);
|
||||
DOIT (x);
|
||||
bfd_put_16 (abfd, x, addr);
|
||||
}
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
long x = bfd_get_32 (abfd, addr);
|
||||
DOIT (x);
|
||||
bfd_put_32 (abfd, x, addr);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
abort ();
|
||||
}
|
||||
}
|
||||
|
||||
/* Now let bfd_perform_relocation finish everything up. */
|
||||
return bfd_reloc_continue;
|
||||
}
|
||||
|
||||
#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;
|
||||
{
|
||||
return ! howto->pc_relative && howto->type != MIPS_R_RVA;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef PCRELOFFSET
|
||||
#define PCRELOFFSET false
|
||||
#endif
|
||||
|
||||
static reloc_howto_type howto_table[] =
|
||||
{
|
||||
/* Reloc type 0 is ignored. The reloc reading code ensures that
|
||||
this is a reference to the .abs section, which will cause
|
||||
bfd_perform_relocation to do nothing. */
|
||||
HOWTO (MIPS_R_ABSOLUTE, /* type */
|
||||
0, /* rightshift */
|
||||
0, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
8, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
0, /* special_function */
|
||||
"IGNORE", /* name */
|
||||
false, /* partial_inplace */
|
||||
0, /* src_mask */
|
||||
0, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* A 16 bit reference to a symbol, normally from a data section. */
|
||||
HOWTO (MIPS_R_REFHALF, /* 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_mips_reloc, /* special_function */
|
||||
"REFHALF", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffff, /* src_mask */
|
||||
0xffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* A 32 bit reference to a symbol, normally from a data section. */
|
||||
HOWTO (MIPS_R_REFWORD, /* 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_mips_reloc, /* special_function */
|
||||
"REFWORD", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* A 26 bit absolute jump address. */
|
||||
HOWTO (MIPS_R_JMPADDR, /* type */
|
||||
2, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
26, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
/* This needs complex overflow
|
||||
detection, because the upper four
|
||||
bits must match the PC. */
|
||||
coff_mips_reloc, /* special_function */
|
||||
"JMPADDR", /* name */
|
||||
true, /* partial_inplace */
|
||||
0x3ffffff, /* src_mask */
|
||||
0x3ffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* The high 16 bits of a symbol value. Handled by the function
|
||||
mips_refhi_reloc. */
|
||||
HOWTO (MIPS_R_REFHI, /* type */
|
||||
16, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_bitfield, /* complain_on_overflow */
|
||||
coff_mips_reloc, /* special_function */
|
||||
"REFHI", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffff, /* src_mask */
|
||||
0xffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* The low 16 bits of a symbol value. */
|
||||
HOWTO (MIPS_R_REFLO, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_dont, /* complain_on_overflow */
|
||||
coff_mips_reloc, /* special_function */
|
||||
"REFLO", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffff, /* src_mask */
|
||||
0xffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* A reference to an offset from the gp register. Handled by the
|
||||
function mips_gprel_reloc. */
|
||||
HOWTO (MIPS_R_GPREL, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
coff_mips_reloc, /* special_function */
|
||||
"GPREL", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffff, /* src_mask */
|
||||
0xffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
/* A reference to a literal using an offset from the gp register.
|
||||
Handled by the function mips_gprel_reloc. */
|
||||
HOWTO (MIPS_R_LITERAL, /* type */
|
||||
0, /* rightshift */
|
||||
2, /* size (0 = byte, 1 = short, 2 = long) */
|
||||
16, /* bitsize */
|
||||
false, /* pc_relative */
|
||||
0, /* bitpos */
|
||||
complain_overflow_signed, /* complain_on_overflow */
|
||||
coff_mips_reloc, /* special_function */
|
||||
"LITERAL", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffff, /* src_mask */
|
||||
0xffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
|
||||
EMPTY_HOWTO (8),
|
||||
EMPTY_HOWTO (9),
|
||||
EMPTY_HOWTO (10),
|
||||
EMPTY_HOWTO (11),
|
||||
EMPTY_HOWTO (12),
|
||||
EMPTY_HOWTO (13),
|
||||
EMPTY_HOWTO (14),
|
||||
EMPTY_HOWTO (15),
|
||||
EMPTY_HOWTO (16),
|
||||
EMPTY_HOWTO (17),
|
||||
EMPTY_HOWTO (18),
|
||||
EMPTY_HOWTO (19),
|
||||
EMPTY_HOWTO (20),
|
||||
EMPTY_HOWTO (21),
|
||||
EMPTY_HOWTO (22),
|
||||
EMPTY_HOWTO (23),
|
||||
EMPTY_HOWTO (24),
|
||||
EMPTY_HOWTO (25),
|
||||
EMPTY_HOWTO (26),
|
||||
EMPTY_HOWTO (27),
|
||||
EMPTY_HOWTO (28),
|
||||
EMPTY_HOWTO (29),
|
||||
EMPTY_HOWTO (30),
|
||||
EMPTY_HOWTO (31),
|
||||
EMPTY_HOWTO (32),
|
||||
EMPTY_HOWTO (33),
|
||||
HOWTO (MIPS_R_RVA, /* 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_mips_reloc, /* special_function */
|
||||
"rva32", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
EMPTY_HOWTO (35),
|
||||
EMPTY_HOWTO (36),
|
||||
HOWTO (MIPS_R_PAIR, /* 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_mips_reloc, /* special_function */
|
||||
"PAIR", /* name */
|
||||
true, /* partial_inplace */
|
||||
0xffffffff, /* src_mask */
|
||||
0xffffffff, /* dst_mask */
|
||||
false), /* pcrel_offset */
|
||||
};
|
||||
|
||||
/* Turn a howto into a reloc nunmber */
|
||||
|
||||
#define SELECT_RELOC(x,howto) { x.r_type = howto->type; }
|
||||
#define BADMAG(x) MIPSBADMAG(x)
|
||||
#define MIPS 1 /* Customize coffcode.h */
|
||||
|
||||
#define RTYPE2HOWTO(cache_ptr, dst) \
|
||||
(cache_ptr)->howto = howto_table + (dst)->r_type;
|
||||
|
||||
/* Compute the addend of a reloc. If the reloc is to a common symbol,
|
||||
the object file contains the value of the common symbol. By the
|
||||
time this is called, the linker may be using a different symbol
|
||||
from a different object file with a different value. Therefore, we
|
||||
hack wildly to locate the original symbol from this file so that we
|
||||
can make the correct adjustment. This macro sets coffsym to the
|
||||
symbol from the original file, and uses it to set the addend value
|
||||
correctly. If this is not a common symbol, the usual addend
|
||||
calculation is done, except that an additional tweak is needed for
|
||||
PC relative relocs.
|
||||
FIXME: This macro refers to symbols and asect; these are from the
|
||||
calling function, not the macro arguments. */
|
||||
|
||||
#define CALC_ADDEND(abfd, ptr, reloc, cache_ptr) \
|
||||
{ \
|
||||
coff_symbol_type *coffsym = (coff_symbol_type *) NULL; \
|
||||
if (ptr && bfd_asymbol_bfd (ptr) != abfd) \
|
||||
coffsym = (obj_symbols (abfd) \
|
||||
+ (cache_ptr->sym_ptr_ptr - symbols)); \
|
||||
else if (ptr) \
|
||||
coffsym = coff_symbol_from (abfd, ptr); \
|
||||
if (coffsym != (coff_symbol_type *) NULL \
|
||||
&& coffsym->native->u.syment.n_scnum == 0) \
|
||||
cache_ptr->addend = - coffsym->native->u.syment.n_value; \
|
||||
else if (ptr && bfd_asymbol_bfd (ptr) == abfd \
|
||||
&& ptr->section != (asection *) NULL) \
|
||||
cache_ptr->addend = - (ptr->section->vma + ptr->value); \
|
||||
else \
|
||||
cache_ptr->addend = 0; \
|
||||
if (ptr && howto_table[reloc.r_type].pc_relative) \
|
||||
cache_ptr->addend += asect->vma; \
|
||||
}
|
||||
|
||||
|
||||
/* Convert an rtype to howto for the COFF backend linker. */
|
||||
|
||||
static reloc_howto_type *
|
||||
coff_mips_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;
|
||||
struct internal_syment *sym;
|
||||
bfd_vma *addendp;
|
||||
{
|
||||
|
||||
reloc_howto_type *howto;
|
||||
|
||||
howto = howto_table + rel->r_type;
|
||||
|
||||
#ifdef COFF_WITH_PE
|
||||
*addendp = 0;
|
||||
#endif
|
||||
|
||||
if (howto->pc_relative)
|
||||
*addendp += sec->vma;
|
||||
|
||||
if (sym != NULL && sym->n_scnum == 0 && sym->n_value != 0)
|
||||
{
|
||||
/* This is a common symbol. The section contents include the
|
||||
size (sym->n_value) as an addend. The relocate_section
|
||||
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);
|
||||
|
||||
#ifndef COFF_WITH_PE
|
||||
/* I think we *do* want to bypass this. If we don't, I have
|
||||
seen some data parameters get the wrong relocation 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 case in which
|
||||
this section has been bypassed has addresses which correspond
|
||||
to values I can find in the map. */
|
||||
*addendp -= sym->n_value;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef COFF_WITH_PE
|
||||
/* 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)
|
||||
*addendp += h->root.u.c.size;
|
||||
#endif
|
||||
|
||||
#ifdef COFF_WITH_PE
|
||||
if (howto->pc_relative)
|
||||
{
|
||||
*addendp -= 4;
|
||||
|
||||
/* 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
|
||||
to 0 at the start of this function. We need to adjust here,
|
||||
to avoid the adjustment the generic code will make. FIXME:
|
||||
This is getting a bit hackish. */
|
||||
if (sym != NULL && sym->n_scnum != 0)
|
||||
*addendp -= sym->n_value;
|
||||
}
|
||||
|
||||
if (rel->r_type == MIPS_R_RVA)
|
||||
{
|
||||
*addendp -= pe_data(sec->output_section->owner)->pe_opthdr.ImageBase;
|
||||
}
|
||||
#endif
|
||||
|
||||
return howto;
|
||||
}
|
||||
|
||||
#define coff_rtype_to_howto coff_mips_rtype_to_howto
|
||||
|
||||
|
||||
#define coff_bfd_reloc_type_lookup coff_mips_reloc_type_lookup
|
||||
|
||||
|
||||
|
||||
/* Get the howto structure for a generic reloc type. */
|
||||
|
||||
static reloc_howto_type *
|
||||
coff_mips_reloc_type_lookup (abfd, code)
|
||||
bfd *abfd ATTRIBUTE_UNUSED;
|
||||
bfd_reloc_code_real_type code;
|
||||
{
|
||||
int mips_type;
|
||||
|
||||
switch (code)
|
||||
{
|
||||
case BFD_RELOC_16:
|
||||
mips_type = MIPS_R_REFHALF;
|
||||
break;
|
||||
case BFD_RELOC_32:
|
||||
case BFD_RELOC_CTOR:
|
||||
mips_type = MIPS_R_REFWORD;
|
||||
break;
|
||||
case BFD_RELOC_MIPS_JMP:
|
||||
mips_type = MIPS_R_JMPADDR;
|
||||
break;
|
||||
case BFD_RELOC_HI16_S:
|
||||
mips_type = MIPS_R_REFHI;
|
||||
break;
|
||||
case BFD_RELOC_LO16:
|
||||
mips_type = MIPS_R_REFLO;
|
||||
break;
|
||||
case BFD_RELOC_MIPS_GPREL:
|
||||
mips_type = MIPS_R_GPREL;
|
||||
break;
|
||||
case BFD_RELOC_MIPS_LITERAL:
|
||||
mips_type = MIPS_R_LITERAL;
|
||||
break;
|
||||
/* FIXME?
|
||||
case BFD_RELOC_16_PCREL_S2:
|
||||
mips_type = MIPS_R_PCREL16;
|
||||
break;
|
||||
case BFD_RELOC_PCREL_HI16_S:
|
||||
mips_type = MIPS_R_RELHI;
|
||||
break;
|
||||
case BFD_RELOC_PCREL_LO16:
|
||||
mips_type = MIPS_R_RELLO;
|
||||
break;
|
||||
case BFD_RELOC_GPREL32:
|
||||
mips_type = MIPS_R_SWITCH;
|
||||
break;
|
||||
*/
|
||||
case BFD_RELOC_RVA:
|
||||
mips_type = MIPS_R_RVA;
|
||||
break;
|
||||
default:
|
||||
return (reloc_howto_type *) NULL;
|
||||
}
|
||||
|
||||
return &howto_table[mips_type];
|
||||
}
|
||||
|
||||
static void
|
||||
mips_swap_reloc_in (abfd, src, dst)
|
||||
bfd *abfd;
|
||||
PTR src;
|
||||
PTR dst;
|
||||
{
|
||||
static struct internal_reloc pair_prev;
|
||||
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_symndx =
|
||||
bfd_h_get_signed_32(abfd, (bfd_byte *) reloc_src->r_symndx);
|
||||
reloc_dst->r_type = bfd_h_get_16(abfd, (bfd_byte *) reloc_src->r_type);
|
||||
reloc_dst->r_size = 0;
|
||||
reloc_dst->r_extern = 0;
|
||||
reloc_dst->r_offset = 0;
|
||||
|
||||
switch (reloc_dst->r_type)
|
||||
{
|
||||
case MIPS_R_REFHI:
|
||||
pair_prev = *reloc_dst;
|
||||
break;
|
||||
case MIPS_R_PAIR:
|
||||
reloc_dst->r_offset = reloc_dst->r_symndx;
|
||||
if (reloc_dst->r_offset & 0x8000)
|
||||
reloc_dst->r_offset -= 0x10000;
|
||||
/*printf("dj: pair offset is %08x\n", reloc_dst->r_offset);*/
|
||||
reloc_dst->r_symndx = pair_prev.r_symndx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static unsigned int
|
||||
mips_swap_reloc_out (abfd, src, dst)
|
||||
bfd *abfd;
|
||||
PTR src;
|
||||
PTR dst;
|
||||
{
|
||||
static int prev_offset = 1;
|
||||
static bfd_vma prev_addr = 0;
|
||||
struct internal_reloc *reloc_src = (struct internal_reloc *)src;
|
||||
struct external_reloc *reloc_dst = (struct external_reloc *)dst;
|
||||
|
||||
switch (reloc_src->r_type)
|
||||
{
|
||||
case MIPS_R_REFHI:
|
||||
prev_addr = reloc_src->r_vaddr;
|
||||
prev_offset = reloc_src->r_offset;
|
||||
break;
|
||||
case MIPS_R_REFLO:
|
||||
if (reloc_src->r_vaddr == prev_addr)
|
||||
{
|
||||
/* FIXME: only slightly hackish. If we see a REFLO pointing to
|
||||
the same address as a REFHI, we assume this is the matching
|
||||
PAIR reloc and output it accordingly. The symndx is really
|
||||
the low 16 bits of the addend */
|
||||
bfd_h_put_32 (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);
|
||||
|
||||
bfd_h_put_16(abfd, MIPS_R_PAIR, (bfd_byte *)
|
||||
reloc_dst->r_type);
|
||||
return RELSZ;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
bfd_h_put_32(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);
|
||||
|
||||
bfd_h_put_16(abfd, reloc_src->r_type, (bfd_byte *)
|
||||
reloc_dst->r_type);
|
||||
return RELSZ;
|
||||
}
|
||||
|
||||
#define coff_swap_reloc_in mips_swap_reloc_in
|
||||
#define coff_swap_reloc_out mips_swap_reloc_out
|
||||
#define NO_COFF_RELOCS
|
||||
|
||||
static boolean
|
||||
coff_pe_mips_relocate_section (output_bfd, info, input_bfd,
|
||||
input_section, contents, relocs, syms,
|
||||
sections)
|
||||
bfd *output_bfd;
|
||||
struct bfd_link_info *info;
|
||||
bfd *input_bfd;
|
||||
asection *input_section;
|
||||
bfd_byte *contents;
|
||||
struct internal_reloc *relocs;
|
||||
struct internal_syment *syms;
|
||||
asection **sections;
|
||||
{
|
||||
bfd_vma gp;
|
||||
boolean gp_undefined;
|
||||
size_t adjust;
|
||||
struct internal_reloc *rel;
|
||||
struct internal_reloc *rel_end;
|
||||
unsigned int i;
|
||||
boolean got_lo;
|
||||
|
||||
if (info->relocateable)
|
||||
{
|
||||
(*_bfd_error_handler)(_("\
|
||||
%s: `ld -r' not supported with PE MIPS objects\n"),
|
||||
bfd_get_filename (input_bfd));
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
}
|
||||
|
||||
BFD_ASSERT (input_bfd->xvec->byteorder
|
||||
== output_bfd->xvec->byteorder);
|
||||
|
||||
#if 0
|
||||
printf("dj: relocate %s(%s) %08x\n",
|
||||
input_bfd->filename, input_section->name,
|
||||
input_section->output_section->vma + input_section->output_offset);
|
||||
#endif
|
||||
|
||||
gp = _bfd_get_gp_value (output_bfd);
|
||||
if (gp == 0)
|
||||
gp_undefined = true;
|
||||
else
|
||||
gp_undefined = false;
|
||||
|
||||
got_lo = false;
|
||||
|
||||
adjust = 0;
|
||||
|
||||
rel = relocs;
|
||||
rel_end = rel + input_section->reloc_count;
|
||||
for (i = 0; rel < rel_end; rel++, i++)
|
||||
{
|
||||
long symndx;
|
||||
struct coff_link_hash_entry *h;
|
||||
struct internal_syment *sym;
|
||||
bfd_vma addend = 0;
|
||||
bfd_vma val, tmp, targ, src, low;
|
||||
reloc_howto_type *howto;
|
||||
unsigned char *mem = contents + rel->r_vaddr;
|
||||
|
||||
symndx = rel->r_symndx;
|
||||
|
||||
if (symndx == -1)
|
||||
{
|
||||
h = NULL;
|
||||
sym = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
h = obj_coff_sym_hashes (input_bfd)[symndx];
|
||||
sym = syms + symndx;
|
||||
}
|
||||
|
||||
/* COFF treats common symbols in one of two ways. Either the
|
||||
size of the symbol is included in the section contents, or it
|
||||
is not. We assume that the size is not included, and force
|
||||
the rtype_to_howto function to adjust the addend as needed. */
|
||||
|
||||
if (sym != NULL && sym->n_scnum != 0)
|
||||
addend = - sym->n_value;
|
||||
else
|
||||
addend = 0;
|
||||
|
||||
|
||||
howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
|
||||
sym, &addend);
|
||||
if (howto == NULL)
|
||||
return false;
|
||||
|
||||
/* If we are doing a relocateable link, then we can just ignore
|
||||
a PC relative reloc that is pcrel_offset. It will already
|
||||
have the correct value. If this is not a relocateable link,
|
||||
then we should ignore the symbol value. */
|
||||
if (howto->pc_relative && howto->pcrel_offset)
|
||||
{
|
||||
if (info->relocateable)
|
||||
continue;
|
||||
if (sym != NULL && sym->n_scnum != 0)
|
||||
addend += sym->n_value;
|
||||
}
|
||||
|
||||
val = 0;
|
||||
|
||||
if (h == NULL)
|
||||
{
|
||||
asection *sec;
|
||||
|
||||
if (symndx == -1)
|
||||
{
|
||||
sec = bfd_abs_section_ptr;
|
||||
val = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
sec = sections[symndx];
|
||||
val = (sec->output_section->vma
|
||||
+ sec->output_offset
|
||||
+ sym->n_value);
|
||||
if (! obj_pe (input_bfd))
|
||||
val -= sec->vma;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (h->root.type == bfd_link_hash_defined
|
||||
|| h->root.type == bfd_link_hash_defweak)
|
||||
{
|
||||
asection *sec;
|
||||
|
||||
sec = h->root.u.def.section;
|
||||
val = (h->root.u.def.value
|
||||
+ sec->output_section->vma
|
||||
+ sec->output_offset);
|
||||
}
|
||||
|
||||
else if (! info->relocateable)
|
||||
{
|
||||
if (! ((*info->callbacks->undefined_symbol)
|
||||
(info, h->root.root.string, input_bfd, input_section,
|
||||
rel->r_vaddr - input_section->vma, true)))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
src = rel->r_vaddr + input_section->output_section->vma
|
||||
+ input_section->output_offset;
|
||||
#if 0
|
||||
printf("dj: reloc %02x %-8s a=%08x/%08x(%08x) v=%08x+%08x %s\n",
|
||||
rel->r_type, howto_table[rel->r_type].name,
|
||||
src, rel->r_vaddr, *(unsigned long *)mem, val, rel->r_offset,
|
||||
h?h->root.root.string:"(none)");
|
||||
#endif
|
||||
|
||||
/* OK, at this point the following variables are set up:
|
||||
src = VMA of the memory we're fixing up
|
||||
mem = pointer to memory we're fixing up
|
||||
val = VMA of what we need to refer to
|
||||
*/
|
||||
|
||||
#define UI(x) (*_bfd_error_handler)(_("%s: unimplemented %s\n"), \
|
||||
bfd_get_filename (input_bfd), x); \
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
|
||||
switch (rel->r_type)
|
||||
{
|
||||
case MIPS_R_ABSOLUTE:
|
||||
/* ignore these */
|
||||
break;
|
||||
|
||||
case MIPS_R_REFHALF:
|
||||
UI("refhalf");
|
||||
break;
|
||||
|
||||
case MIPS_R_REFWORD:
|
||||
tmp = bfd_get_32(input_bfd, mem);
|
||||
/* printf("refword: src=%08x targ=%08x+%08x\n", src, tmp, val); */
|
||||
tmp += val;
|
||||
bfd_put_32(input_bfd, tmp, mem);
|
||||
break;
|
||||
|
||||
case MIPS_R_JMPADDR:
|
||||
tmp = bfd_get_32(input_bfd, mem);
|
||||
targ = val + (tmp&0x03ffffff)*4;
|
||||
if ((src & 0xf0000000) != (targ & 0xf0000000))
|
||||
{
|
||||
(*_bfd_error_handler)(_("%s: jump too far away\n"),
|
||||
bfd_get_filename (input_bfd));
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
}
|
||||
tmp &= 0xfc000000;
|
||||
tmp |= (targ/4) & 0x3ffffff;
|
||||
bfd_put_32(input_bfd, tmp, mem);
|
||||
break;
|
||||
|
||||
case MIPS_R_REFHI:
|
||||
tmp = bfd_get_32(input_bfd, mem);
|
||||
switch (rel[1].r_type)
|
||||
{
|
||||
case MIPS_R_PAIR:
|
||||
/* MS PE object */
|
||||
targ = val + rel[1].r_offset + ((tmp & 0xffff) << 16);
|
||||
break;
|
||||
case MIPS_R_REFLO:
|
||||
/* GNU COFF object */
|
||||
low = bfd_get_32(input_bfd, contents + rel[1].r_vaddr);
|
||||
low &= 0xffff;
|
||||
if (low & 0x8000)
|
||||
low -= 0x10000;
|
||||
targ = val + low + ((tmp & 0xffff) << 16);
|
||||
break;
|
||||
default:
|
||||
(*_bfd_error_handler)(_("%s: bad pair/reflo after refhi\n"),
|
||||
bfd_get_filename (input_bfd));
|
||||
bfd_set_error (bfd_error_bad_value);
|
||||
return false;
|
||||
}
|
||||
tmp &= 0xffff0000;
|
||||
tmp |= (targ >> 16) & 0xffff;
|
||||
bfd_put_32(input_bfd, tmp, mem);
|
||||
break;
|
||||
|
||||
case MIPS_R_REFLO:
|
||||
tmp = bfd_get_32(input_bfd, mem);
|
||||
targ = val + (tmp & 0xffff);
|
||||
/* printf("refword: src=%08x targ=%08x\n", src, targ); */
|
||||
tmp &= 0xffff0000;
|
||||
tmp |= targ & 0xffff;
|
||||
bfd_put_32(input_bfd, tmp, mem);
|
||||
break;
|
||||
|
||||
case MIPS_R_GPREL:
|
||||
case MIPS_R_LITERAL:
|
||||
UI("gprel");
|
||||
break;
|
||||
|
||||
case MIPS_R_SECTION:
|
||||
UI("section");
|
||||
break;
|
||||
|
||||
case MIPS_R_SECREL:
|
||||
UI("secrel");
|
||||
break;
|
||||
|
||||
case MIPS_R_SECRELLO:
|
||||
UI("secrello");
|
||||
break;
|
||||
|
||||
case MIPS_R_SECRELHI:
|
||||
UI("secrelhi");
|
||||
break;
|
||||
|
||||
case MIPS_R_RVA:
|
||||
tmp = bfd_get_32 (input_bfd, mem);
|
||||
/* printf("rva: src=%08x targ=%08x+%08x\n", src, tmp, val); */
|
||||
tmp += val
|
||||
- pe_data (input_section->output_section->owner)->pe_opthdr.ImageBase;
|
||||
bfd_put_32 (input_bfd, tmp, mem);
|
||||
break;
|
||||
|
||||
case MIPS_R_PAIR:
|
||||
/* ignore these */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#define coff_relocate_section coff_pe_mips_relocate_section
|
||||
|
||||
#ifdef TARGET_UNDERSCORE
|
||||
|
||||
/* If mips gcc uses underscores for symbol names, then it does not use
|
||||
a leading dot for local labels, so if TARGET_UNDERSCORE is defined
|
||||
we treat all symbols starting with L as local. */
|
||||
|
||||
static boolean coff_mips_is_local_label_name PARAMS ((bfd *, const char *));
|
||||
|
||||
static boolean
|
||||
coff_mips_is_local_label_name (abfd, name)
|
||||
bfd *abfd;
|
||||
const char *name;
|
||||
{
|
||||
if (name[0] == 'L')
|
||||
return true;
|
||||
|
||||
return _bfd_coff_is_local_label_name (abfd, name);
|
||||
}
|
||||
|
||||
#define coff_bfd_is_local_label_name coff_mips_is_local_label_name
|
||||
|
||||
#endif /* TARGET_UNDERSCORE */
|
||||
|
||||
#define COFF_NO_HACK_SCNHDR_SIZE
|
||||
|
||||
#include "coffcode.h"
|
||||
|
||||
const bfd_target
|
||||
#ifdef TARGET_SYM
|
||||
TARGET_SYM =
|
||||
#else
|
||||
mipslpe_vec =
|
||||
#endif
|
||||
{
|
||||
#ifdef TARGET_NAME
|
||||
TARGET_NAME,
|
||||
#else
|
||||
"pe-mips", /* 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, coff_object_p, /* bfd_check_format */
|
||||
bfd_generic_archive_p, coff_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
|
||||
};
|
44
contrib/binutils/bfd/pe-ppc.c
Normal file
44
contrib/binutils/bfd/pe-ppc.c
Normal file
@ -0,0 +1,44 @@
|
||||
/* BFD back-end for PowerPC PECOFF files.
|
||||
Copyright 1995 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, 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#include "bfd.h"
|
||||
#include "sysdep.h"
|
||||
|
||||
|
||||
#define E_FILENMLEN 18
|
||||
|
||||
#define PPC_PE
|
||||
|
||||
#define TARGET_LITTLE_SYM bfd_powerpcle_pe_vec
|
||||
#define TARGET_LITTLE_NAME "pe-powerpcle"
|
||||
|
||||
#define TARGET_BIG_SYM bfd_powerpc_pe_vec
|
||||
#define TARGET_BIG_NAME "pe-powerpc"
|
||||
|
||||
#define COFF_WITH_PE
|
||||
|
||||
#define COFF_LONG_SECTION_NAMES
|
||||
|
||||
/* FIXME: verify PCRELOFFSET is always false */
|
||||
|
||||
/* FIXME: This target no longer works. Search for POWERPC_LE_PE in
|
||||
coff-ppc.c and peigen.c. */
|
||||
|
||||
#include "coff-ppc.c"
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user