binutils 2.39

This commit is contained in:
Wolfgang Thaller
2022-10-27 20:45:45 +02:00
parent 6ea1bcda2b
commit f485e125c4
12498 changed files with 1714827 additions and 576503 deletions
+1159 -5
View File
File diff suppressed because it is too large Load Diff
+3 -3
View File
@@ -14,7 +14,7 @@ Makefile.*; configure; configure.ac; src-release
gdb-patches@sourceware.org
bfd/; binutils/; elfcpp/; gas/; gold/; gprof/; ld/; opcodes/; cpu/;
BFD's part of include/
libctf/; BFD's and libctf's parts of include/
binutils: http://sourceware.org/binutils/
Patches to binutils@sourceware.org.
@@ -27,7 +27,7 @@ cgen/; cgen parts of opcodes/, sim/ & include/
May need separate opcodes/ or sim/ approval for
commits of regenerated files there.
config.guess; config.sub; readline/support/config.{sub,guess}
config.guess; config.sub; readline/readline/support/config.{sub,guess}
config: http://savannah.gnu.org/projects/config
Patches to config-patches@gnu.org.
Changes need to be done in tandem with the official CONFIG
@@ -41,7 +41,7 @@ config.guess; config.sub; readline/support/config.{sub,guess}
depcomp; mkinstalldirs
Send bug reports and patches to bug-automake@gnu.org.
gdb/; readline/; sim/; GDB's part of include/
gdb/; gdbserver/; gdbsupport/; gnulib/; readline/; sim/; GDB's part of include/
GDB: http://www.gnu.org/software/gdb/
Patches to gdb-patches@sourceware.org.
See also gdb/MAINTAINERS and sim/MAINTAINERS.
+121 -18
View File
@@ -4,7 +4,7 @@ AutoGen definitions Makefile.tpl;
// Makefile.in is generated from Makefile.tpl by 'autogen Makefile.def'.
// This file was originally written by Nathanael Nerode.
//
// Copyright 2002-2017 Free Software Foundation
// Copyright 2002-2021 Free Software Foundation
//
// This file is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
@@ -42,7 +42,8 @@ host_modules= { module= dejagnu; };
host_modules= { module= etc; };
host_modules= { module= fastjar; no_check_cross= true; };
host_modules= { module= fixincludes; bootstrap=true;
missing= TAGS; };
missing= TAGS;
missing= install-dvi; };
host_modules= { module= flex; no_check_cross= true; };
host_modules= { module= gas; bootstrap=true; };
host_modules= { module= gcc; bootstrap=true;
@@ -63,7 +64,7 @@ host_modules= { module= mpfr; lib_path=src/.libs; bootstrap=true;
extra_make_flags='AM_CFLAGS="-DNO_ASM"';
no_install= true; };
host_modules= { module= mpc; lib_path=src/.libs; bootstrap=true;
extra_configure_flags='--disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@';
extra_configure_flags='--disable-shared @extra_mpc_gmp_configure_flags@ @extra_mpc_mpfr_configure_flags@ --disable-maintainer-mode';
no_install= true; };
host_modules= { module= isl; lib_path=.libs; bootstrap=true;
extra_configure_flags='--disable-shared @extra_isl_gmp_configure_flags@';
@@ -74,6 +75,7 @@ host_modules= { module= libelf; lib_path=.libs; bootstrap=true;
no_install= true; };
host_modules= { module= gold; bootstrap=true; };
host_modules= { module= gprof; };
host_modules= { module= gprofng; };
host_modules= { module= intl; bootstrap=true; };
host_modules= { module= tcl;
missing=mostlyclean; };
@@ -81,7 +83,20 @@ host_modules= { module= itcl; };
host_modules= { module= ld; bootstrap=true; };
host_modules= { module= libbacktrace; bootstrap=true; };
host_modules= { module= libcpp; bootstrap=true; };
host_modules= { module= libdecnumber; bootstrap=true; };
// As with libiconv, don't install any of libcody
host_modules= { module= libcody; bootstrap=true;
no_install= true;
missing= pdf;
missing= html;
missing= info;
missing= dvi;
missing= install-pdf;
missing= install-html;
missing= install-info;
missing= install-dvi;
missing=TAGS; };
host_modules= { module= libdecnumber; bootstrap=true;
missing=TAGS; };
host_modules= { module= libgui; };
host_modules= { module= libiberty; bootstrap=true;
extra_configure_flags='@extra_host_libiberty_configure_flags@';};
@@ -112,6 +127,9 @@ host_modules= { module= texinfo; no_install= true; };
host_modules= { module= zlib; no_install=true; no_check=true;
bootstrap=true;
extra_configure_flags='@extra_host_zlib_configure_flags@';};
host_modules= { module= gnulib; };
host_modules= { module= gdbsupport; };
host_modules= { module= gdbserver; };
host_modules= { module= gdb; };
host_modules= { module= expect; };
host_modules= { module= guile; };
@@ -122,12 +140,15 @@ host_modules= { module= libtermcap; no_check=true;
missing=distclean;
missing=maintainer-clean; };
host_modules= { module= utils; no_check=true; };
host_modules= { module= c++tools;
missing=TAGS; };
host_modules= { module= gnattools; };
host_modules= { module= lto-plugin; bootstrap=true;
extra_configure_flags='--enable-shared @extra_linker_plugin_flags@ @extra_linker_plugin_configure_flags@';
extra_make_flags='@extra_linker_plugin_flags@'; };
host_modules= { module= libcc1; extra_configure_flags=--enable-shared; };
host_modules= { module= gotools; };
host_modules= { module= libctf; bootstrap=true; };
target_modules = { module= libstdc++-v3;
bootstrap=true;
@@ -137,26 +158,27 @@ target_modules = { module= libsanitizer;
bootstrap=true;
lib_path=.libs;
raw_cxx=true; };
target_modules = { module= libmpx;
bootstrap=true;
lib_path=.libs; };
target_modules = { module= libvtv;
bootstrap=true;
lib_path=.libs;
raw_cxx=true; };
target_modules = { module= libcilkrts;
lib_path=.libs; };
target_modules = { module= liboffloadmic;
lib_path=.libs;
extra_configure_flags='@extra_liboffloadmic_configure_flags@'; };
target_modules = { module= libssp; lib_path=.libs; };
target_modules = { module= newlib; };
target_modules = { module= libgcc; bootstrap=true; no_check=true; };
target_modules = { module= libgcc; bootstrap=true; no_check=true;
missing=TAGS;
missing=install-dvi; };
target_modules = { module= libbacktrace; };
target_modules = { module= libquadmath; };
target_modules = { module= libgfortran; };
target_modules = { module= libobjc; };
target_modules = { module= libobjc;
missing=TAGS;
missing=install-dvi; };
target_modules = { module= libgo; };
target_modules = { module= libphobos;
lib_path=src/.libs; };
target_modules = { module= libtermcap; no_check=true;
missing=mostlyclean;
missing=clean;
@@ -189,6 +211,9 @@ recursive_targets = { make_target= TAGS;
recursive_targets = { make_target= install-info;
depend=configure;
depend=info; };
recursive_targets = { make_target= install-dvi;
depend=configure;
depend=dvi; };
recursive_targets = { make_target= install-pdf;
depend=configure;
depend=pdf; };
@@ -269,6 +294,8 @@ flags_to_pass = { flag= STAGE1_CHECKING ; };
flags_to_pass = { flag= STAGE1_LANGUAGES ; };
flags_to_pass = { flag= GNATBIND ; };
flags_to_pass = { flag= GNATMAKE ; };
flags_to_pass = { flag= GDC ; };
flags_to_pass = { flag= GDCFLAGS ; };
// Target tools
flags_to_pass = { flag= AR_FOR_TARGET ; };
@@ -278,10 +305,13 @@ flags_to_pass = { flag= CFLAGS_FOR_TARGET ; };
flags_to_pass = { flag= CPPFLAGS_FOR_TARGET ; };
flags_to_pass = { flag= CXXFLAGS_FOR_TARGET ; };
flags_to_pass = { flag= DLLTOOL_FOR_TARGET ; };
flags_to_pass = { flag= DSYMUTIL_FOR_TARGET ; };
flags_to_pass = { flag= FLAGS_FOR_TARGET ; };
flags_to_pass = { flag= GFORTRAN_FOR_TARGET ; };
flags_to_pass = { flag= GOC_FOR_TARGET ; };
flags_to_pass = { flag= GOCFLAGS_FOR_TARGET ; };
flags_to_pass = { flag= GDC_FOR_TARGET ; };
flags_to_pass = { flag= GDCFLAGS_FOR_TARGET ; };
flags_to_pass = { flag= LD_FOR_TARGET ; };
flags_to_pass = { flag= LIPO_FOR_TARGET ; };
flags_to_pass = { flag= LDFLAGS_FOR_TARGET ; };
@@ -340,6 +370,7 @@ dependencies = { module=all-gcc; on=all-build-libcpp; };
dependencies = { module=all-gcc; on=all-zlib; };
dependencies = { module=all-gcc; on=all-libbacktrace; hard=true; };
dependencies = { module=all-gcc; on=all-libcpp; hard=true; };
dependencies = { module=all-gcc; on=all-libcody; hard=true; };
dependencies = { module=all-gcc; on=all-libdecnumber; hard=true; };
dependencies = { module=all-gcc; on=all-libiberty; };
dependencies = { module=all-gcc; on=all-fixincludes; };
@@ -374,6 +405,8 @@ dependencies = { module=all-lto-plugin; on=all-libiberty-linker-plugin; };
dependencies = { module=configure-libcc1; on=configure-gcc; };
dependencies = { module=all-libcc1; on=all-gcc; };
// we want version.o from gcc, and implicitly depend on libcody
dependencies = { module=all-c++tools; on=all-gcc; };
dependencies = { module=all-gotools; on=all-target-libgo; };
dependencies = { module=all-utils; on=all-libiberty; };
@@ -388,17 +421,29 @@ dependencies = { module=all-intl; on=all-libiconv; };
dependencies = { module=configure-gdb; on=all-intl; };
dependencies = { module=configure-gdb; on=configure-sim; };
dependencies = { module=configure-gdb; on=all-bfd; };
dependencies = { module=configure-gdb; on=all-gnulib; };
dependencies = { module=configure-gdb; on=all-gdbsupport; };
// Depend on all-libiconv so that configure checks for iconv
// functions will work.
dependencies = { module=configure-gdb; on=all-libiconv; };
dependencies = { module=all-gdb; on=all-libiberty; };
dependencies = { module=all-gdb; on=all-libiconv; };
dependencies = { module=all-gdb; on=all-gnulib; };
dependencies = { module=all-gdb; on=all-gdbsupport; };
dependencies = { module=all-gdb; on=all-opcodes; };
dependencies = { module=all-gdb; on=all-readline; };
dependencies = { module=all-gdb; on=all-build-bison; };
dependencies = { module=all-gdb; on=all-sim; };
dependencies = { module=all-gdb; on=all-libdecnumber; };
dependencies = { module=all-gdb; on=all-libtermcap; };
dependencies = { module=all-gdb; on=all-libctf; };
dependencies = { module=all-gdb; on=all-libbacktrace; };
// Host modules specific to gdbserver.
dependencies = { module=configure-gdbserver; on=all-gnulib; };
dependencies = { module=all-gdbserver; on=all-gdbsupport; };
dependencies = { module=all-gdbserver; on=all-gnulib; };
dependencies = { module=all-gdbserver; on=all-libiberty; };
dependencies = { module=configure-libgui; on=configure-tcl; };
dependencies = { module=configure-libgui; on=configure-tk; };
@@ -406,6 +451,11 @@ dependencies = { module=all-libgui; on=all-tcl; };
dependencies = { module=all-libgui; on=all-tk; };
dependencies = { module=all-libgui; on=all-itcl; };
dependencies = { module=configure-gdbsupport; on=configure-gnulib; };
dependencies = { module=configure-gdbsupport; on=configure-intl; };
dependencies = { module=all-gdbsupport; on=all-gnulib; };
dependencies = { module=all-gdbsupport; on=all-intl; };
// Host modules specific to binutils.
dependencies = { module=configure-bfd; on=configure-libiberty; hard=true; };
dependencies = { module=configure-bfd; on=configure-intl; };
@@ -426,6 +476,8 @@ dependencies = { module=all-binutils; on=all-build-flex; };
dependencies = { module=all-binutils; on=all-build-bison; };
dependencies = { module=all-binutils; on=all-intl; };
dependencies = { module=all-binutils; on=all-gas; };
dependencies = { module=all-binutils; on=all-libctf; };
dependencies = { module=all-ld; on=all-libctf; };
// We put install-opcodes before install-binutils because the installed
// binutils might be on PATH, and they might need the shared opcodes
@@ -433,7 +485,16 @@ dependencies = { module=all-binutils; on=all-gas; };
dependencies = { module=install-binutils; on=install-opcodes; };
dependencies = { module=install-strip-binutils; on=install-strip-opcodes; };
// Likewise for ld, libctf, and bfd.
dependencies = { module=install-libctf; on=install-bfd; };
dependencies = { module=install-ld; on=install-bfd; };
dependencies = { module=install-ld; on=install-libctf; };
dependencies = { module=install-strip-libctf; on=install-strip-bfd; };
dependencies = { module=install-strip-ld; on=install-strip-bfd; };
dependencies = { module=install-strip-ld; on=install-strip-libctf; };
// libopcodes depends on libbfd
dependencies = { module=configure-opcodes; on=configure-bfd; hard=true; };
dependencies = { module=install-opcodes; on=install-bfd; };
dependencies = { module=install-strip-opcodes; on=install-strip-bfd; };
@@ -448,6 +509,16 @@ dependencies = { module=all-gprof; on=all-bfd; };
dependencies = { module=all-gprof; on=all-opcodes; };
dependencies = { module=all-gprof; on=all-intl; };
dependencies = { module=all-gprof; on=all-gas; };
dependencies = { module=configure-gprofng; on=configure-intl; };
dependencies = { module=all-gprofng; on=all-libiberty; };
dependencies = { module=all-gprofng; on=all-bfd; };
dependencies = { module=all-gprofng; on=all-opcodes; };
dependencies = { module=all-gprofng; on=all-intl; };
dependencies = { module=all-gprofng; on=all-gas; };
dependencies = { module=install-gprofng; on=install-opcodes; };
dependencies = { module=install-gprofng; on=install-bfd; };
dependencies = { module=configure-ld; on=configure-intl; };
dependencies = { module=all-ld; on=all-libiberty; };
dependencies = { module=all-ld; on=all-bfd; };
@@ -504,18 +575,33 @@ dependencies = { module=install-strip-sid; on=install-strip-tcl; };
dependencies = { module=install-sid; on=install-tk; };
dependencies = { module=install-strip-sid; on=install-strip-tk; };
dependencies = { module=configure-sim; on=all-gnulib; };
dependencies = { module=configure-sim; on=configure-intl; };
dependencies = { module=all-sim; on=all-intl; };
dependencies = { module=all-sim; on=all-libiberty; };
dependencies = { module=all-sim; on=all-bfd; };
dependencies = { module=all-sim; on=all-opcodes; };
dependencies = { module=all-sim; on=all-readline; };
dependencies = { module=all-sim; on=configure-gdb; };
dependencies = { module=configure-sim; on=all-readline; };
// Other host modules.
dependencies = { module=all-fastjar; on=all-zlib; };
dependencies = { module=all-fastjar; on=all-build-texinfo; };
dependencies = { module=all-fastjar; on=all-libiberty; };
dependencies = { module=all-libctf; on=all-libiberty; hard=true; };
dependencies = { module=all-libctf; on=all-bfd; };
dependencies = { module=all-libctf; on=all-zlib; };
// So that checking for ELF support in BFD from libctf configure is possible.
dependencies = { module=configure-libctf; on=all-bfd; };
dependencies = { module=configure-libctf; on=all-intl; };
dependencies = { module=configure-libctf; on=all-zlib; };
dependencies = { module=configure-libctf; on=all-libiconv; };
dependencies = { module=check-libctf; on=all-ld; };
// The Makefiles in gdb and gdbserver pull in a file that configure
// generates in the gnulib directory, so distclean gnulib only after
// gdb and gdbserver.
dependencies = { module=distclean-gnulib; on=distclean-gdb; };
dependencies = { module=distclean-gnulib; on=distclean-gdbserver; };
// Warning, these are not well tested.
dependencies = { module=all-bison; on=all-intl; };
@@ -532,7 +618,6 @@ dependencies = { module=all-m4; on=all-build-texinfo; };
// on libgcc and newlib/libgloss.
lang_env_dependencies = { module=libitm; cxx=true; };
lang_env_dependencies = { module=libffi; cxx=true; };
lang_env_dependencies = { module=libcilkrts; cxx=true; };
lang_env_dependencies = { module=liboffloadmic; cxx=true; };
lang_env_dependencies = { module=newlib; no_c=true; };
lang_env_dependencies = { module=libgloss; no_c=true; };
@@ -546,9 +631,15 @@ dependencies = { module=configure-target-fastjar; on=configure-target-zlib; };
dependencies = { module=all-target-fastjar; on=all-target-zlib; };
dependencies = { module=configure-target-libgo; on=configure-target-libffi; };
dependencies = { module=configure-target-libgo; on=all-target-libstdc++-v3; };
dependencies = { module=configure-target-libffi; on=all-target-libstdc++-v3; };
dependencies = { module=all-target-libgo; on=all-target-libbacktrace; };
dependencies = { module=all-target-libgo; on=all-target-libffi; };
dependencies = { module=all-target-libgo; on=all-target-libatomic; };
dependencies = { module=configure-target-libphobos; on=configure-target-libbacktrace; };
dependencies = { module=configure-target-libphobos; on=configure-target-zlib; };
dependencies = { module=all-target-libphobos; on=all-target-libbacktrace; };
dependencies = { module=all-target-libphobos; on=all-target-zlib; };
dependencies = { module=all-target-libphobos; on=all-target-libatomic; };
dependencies = { module=configure-target-libstdc++-v3; on=configure-target-libgomp; };
dependencies = { module=configure-target-liboffloadmic; on=configure-target-libgomp; };
dependencies = { module=configure-target-libsanitizer; on=all-target-libstdc++-v3; };
@@ -562,12 +653,11 @@ dependencies = { module=all-target-liboffloadmic; on=all-target-libgomp; };
dependencies = { module=install-target-libgo; on=install-target-libatomic; };
dependencies = { module=install-target-libgfortran; on=install-target-libquadmath; };
dependencies = { module=install-target-libgfortran; on=install-target-libgcc; };
dependencies = { module=install-target-libphobos; on=install-target-libatomic; };
dependencies = { module=install-target-libsanitizer; on=install-target-libstdc++-v3; };
dependencies = { module=install-target-libsanitizer; on=install-target-libgcc; };
dependencies = { module=install-target-libvtv; on=install-target-libstdc++-v3; };
dependencies = { module=install-target-libvtv; on=install-target-libgcc; };
dependencies = { module=install-target-libcilkrts; on=install-target-libstdc++-v3; };
dependencies = { module=install-target-libcilkrts; on=install-target-libgcc; };
dependencies = { module=install-target-liboffloadmic; on=install-target-libstdc++-v3; };
dependencies = { module=install-target-liboffloadmic; on=install-target-libgcc; };
dependencies = { module=install-target-libitm; on=install-target-libgcc; };
@@ -601,7 +691,11 @@ languages = { language=objc; gcc-check-target=check-objc;
lib-check-target=check-target-libobjc; };
languages = { language=obj-c++; gcc-check-target=check-obj-c++; };
languages = { language=go; gcc-check-target=check-go;
lib-check-target=check-target-libgo; };
lib-check-target=check-target-libgo;
lib-check-target=check-gotools; };
languages = { language=d; gcc-check-target=check-d;
lib-check-target=check-target-libphobos; };
languages = { language=jit; gcc-check-target=check-jit; };
// Toplevel bootstrap
bootstrap_stage = { id=1 ; };
@@ -620,5 +714,14 @@ bootstrap_stage = {
bootstrap_stage = {
id=profile ; prev=1 ; };
bootstrap_stage = {
id=feedback ; prev=profile ;
id=train; prev=profile ; } ;
bootstrap_stage = {
id=feedback ; prev=train;
bootstrap_target=profiledbootstrap ; };
bootstrap_stage = {
id=autoprofile ; prev=1 ;
autoprofile="$$s/gcc/config/i386/$(AUTO_PROFILE)" ; };
bootstrap_stage = {
id=autofeedback ; prev=autoprofile ;
bootstrap_target=autoprofiledbootstrap ;
profile_data="PERF_DATA=perf.data" ; };
+15433 -1774
View File
File diff suppressed because it is too large Load Diff
+190 -41
View File
@@ -6,8 +6,7 @@ in
#
# Makefile for directory with subdirs to build.
# Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
# 2011, 2012, 2013, 2014, 2015, 2016, 2017
# 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011
# Free Software Foundation
#
# This file is free software; you can redistribute it and/or modify
@@ -113,6 +112,9 @@ RPATH_ENVVAR = @RPATH_ENVVAR@
# executables in PATH.
GCC_SHLIB_SUBDIR = @GCC_SHLIB_SUBDIR@
# If the build should make suitable code for shared host resources.
host_shared = @host_shared@
# Build programs are put under this directory.
BUILD_SUBDIR = @build_subdir@
# This is set by the configure script to the arguments to use when configuring
@@ -155,12 +157,17 @@ BUILD_EXPORTS = \
CC="$(CC_FOR_BUILD)"; export CC; \
CFLAGS="$(CFLAGS_FOR_BUILD)"; export CFLAGS; \
CONFIG_SHELL="$(SHELL)"; export CONFIG_SHELL; \
CPP="$(CPP_FOR_BUILD)"; export CPP; \
CPPFLAGS="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS; \
CXX="$(CXX_FOR_BUILD)"; export CXX; \
CXXFLAGS="$(CXXFLAGS_FOR_BUILD)"; export CXXFLAGS; \
GFORTRAN="$(GFORTRAN_FOR_BUILD)"; export GFORTRAN; \
GOC="$(GOC_FOR_BUILD)"; export GOC; \
GOCFLAGS="$(GOCFLAGS_FOR_BUILD)"; export GOCFLAGS; \
GDC="$(GDC_FOR_BUILD)"; export GDC; \
GDCFLAGS="$(GDCFLAGS_FOR_BUILD)"; export GDCFLAGS; \
DLLTOOL="$(DLLTOOL_FOR_BUILD)"; export DLLTOOL; \
DSYMUTIL="$(DSYMUTIL_FOR_BUILD)"; export DSYMUTIL; \
LD="$(LD_FOR_BUILD)"; export LD; \
LDFLAGS="$(LDFLAGS_FOR_BUILD)"; export LDFLAGS; \
NM="$(NM_FOR_BUILD)"; export NM; \
@@ -196,10 +203,15 @@ HOST_EXPORTS = \
CXXFLAGS="$(CXXFLAGS)"; export CXXFLAGS; \
GFORTRAN="$(GFORTRAN)"; export GFORTRAN; \
GOC="$(GOC)"; export GOC; \
GDC="$(GDC)"; export GDC; \
AR="$(AR)"; export AR; \
AS="$(AS)"; export AS; \
CC_FOR_BUILD="$(CC_FOR_BUILD)"; export CC_FOR_BUILD; \
CPP_FOR_BUILD="$(CPP_FOR_BUILD)"; export CPP_FOR_BUILD; \
CPPFLAGS_FOR_BUILD="$(CPPFLAGS_FOR_BUILD)"; export CPPFLAGS_FOR_BUILD; \
CXX_FOR_BUILD="$(CXX_FOR_BUILD)"; export CXX_FOR_BUILD; \
DLLTOOL="$(DLLTOOL)"; export DLLTOOL; \
DSYMUTIL="$(DSYMUTIL)"; export DSYMUTIL; \
LD="$(LD)"; export LD; \
LDFLAGS="$(STAGE1_LDFLAGS) $(LDFLAGS)"; export LDFLAGS; \
NM="$(NM)"; export NM; \
@@ -208,14 +220,18 @@ HOST_EXPORTS = \
WINDMC="$(WINDMC)"; export WINDMC; \
OBJCOPY="$(OBJCOPY)"; export OBJCOPY; \
OBJDUMP="$(OBJDUMP)"; export OBJDUMP; \
OTOOL="$(OTOOL)"; export OTOOL; \
PKG_CONFIG_PATH="$(PKG_CONFIG_PATH)"; export PKG_CONFIG_PATH; \
READELF="$(READELF)"; export READELF; \
AR_FOR_TARGET="$(AR_FOR_TARGET)"; export AR_FOR_TARGET; \
AS_FOR_TARGET="$(AS_FOR_TARGET)"; export AS_FOR_TARGET; \
DSYMUTIL_FOR_TARGET="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL_FOR_TARGET; \
GCC_FOR_TARGET="$(GCC_FOR_TARGET)"; export GCC_FOR_TARGET; \
LD_FOR_TARGET="$(LD_FOR_TARGET)"; export LD_FOR_TARGET; \
NM_FOR_TARGET="$(NM_FOR_TARGET)"; export NM_FOR_TARGET; \
OBJDUMP_FOR_TARGET="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP_FOR_TARGET; \
OBJCOPY_FOR_TARGET="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY_FOR_TARGET; \
OTOOL_FOR_TARGET="$(OTOOL_FOR_TARGET)"; export OTOOL_FOR_TARGET; \
RANLIB_FOR_TARGET="$(RANLIB_FOR_TARGET)"; export RANLIB_FOR_TARGET; \
READELF_FOR_TARGET="$(READELF_FOR_TARGET)"; export READELF_FOR_TARGET; \
TOPLEVEL_CONFIGURE_ARGUMENTS="$(TOPLEVEL_CONFIGURE_ARGUMENTS)"; export TOPLEVEL_CONFIGURE_ARGUMENTS; \
@@ -224,7 +240,6 @@ HOST_EXPORTS = \
GMPINC="$(HOST_GMPINC)"; export GMPINC; \
ISLLIBS="$(HOST_ISLLIBS)"; export ISLLIBS; \
ISLINC="$(HOST_ISLINC)"; export ISLINC; \
ISLVER="$(HOST_ISLVER)"; export ISLVER; \
LIBELFLIBS="$(HOST_LIBELFLIBS)"; export LIBELFLIBS; \
LIBELFINC="$(HOST_LIBELFINC)"; export LIBELFINC; \
XGCC_FLAGS_FOR_TARGET="$(XGCC_FLAGS_FOR_TARGET)"; export XGCC_FLAGS_FOR_TARGET; \
@@ -261,6 +276,14 @@ POSTSTAGE1_HOST_EXPORTS = \
CC_FOR_BUILD="$$CC"; export CC_FOR_BUILD; \
$(POSTSTAGE1_CXX_EXPORT) \
$(LTO_EXPORTS) \
GDC="$$r/$(HOST_SUBDIR)/prev-gcc/gdc$(exeext) -B$$r/$(HOST_SUBDIR)/prev-gcc/ \
-B$(build_tooldir)/bin/ $(GDC_FLAGS_FOR_TARGET) \
-B$$r/prev-$(TARGET_SUBDIR)/libphobos/src \
-I$$r/prev-$(TARGET_SUBDIR)/libphobos/libdruntime -I$$s/libphobos/libdruntime \
-L$$r/prev-$(TARGET_SUBDIR)/libphobos/src/.libs \
-L$$r/prev-$(TARGET_SUBDIR)/libphobos/libdruntime/.libs"; \
export GDC; \
GDC_FOR_BUILD="$$GDC"; export GDC_FOR_BUILD; \
GNATBIND="$$r/$(HOST_SUBDIR)/prev-gcc/gnatbind"; export GNATBIND; \
LDFLAGS="$(POSTSTAGE1_LDFLAGS) $(BOOT_LDFLAGS)"; export LDFLAGS; \
HOST_LIBS="$(POSTSTAGE1_LIBS)"; export HOST_LIBS;
@@ -283,13 +306,16 @@ BASE_TARGET_EXPORTS = \
CXXFLAGS="$(CXXFLAGS_FOR_TARGET)"; export CXXFLAGS; \
GFORTRAN="$(GFORTRAN_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GFORTRAN; \
GOC="$(GOC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GOC; \
GDC="$(GDC_FOR_TARGET) $(XGCC_FLAGS_FOR_TARGET) $$TFLAGS"; export GDC; \
DLLTOOL="$(DLLTOOL_FOR_TARGET)"; export DLLTOOL; \
DSYMUTIL="$(DSYMUTIL_FOR_TARGET)"; export DSYMUTIL; \
LD="$(COMPILER_LD_FOR_TARGET)"; export LD; \
LDFLAGS="$(LDFLAGS_FOR_TARGET)"; export LDFLAGS; \
LIPO="$(LIPO_FOR_TARGET)"; export LIPO; \
NM="$(COMPILER_NM_FOR_TARGET)"; export NM; \
OBJDUMP="$(OBJDUMP_FOR_TARGET)"; export OBJDUMP; \
OBJCOPY="$(OBJCOPY_FOR_TARGET)"; export OBJCOPY; \
OTOOL="$(OTOOL_FOR_TARGET)"; export OTOOL; \
RANLIB="$(RANLIB_FOR_TARGET)"; export RANLIB; \
READELF="$(READELF_FOR_TARGET)"; export READELF; \
STRIP="$(STRIP_FOR_TARGET)"; export STRIP; \
@@ -317,7 +343,6 @@ HOST_GMPINC = @gmpinc@
# Where to find isl
HOST_ISLLIBS = @isllibs@
HOST_ISLINC = @islinc@
HOST_ISLVER = @islver@
# Where to find libelf
HOST_LIBELFLIBS = @libelflibs@
@@ -343,11 +368,15 @@ AR_FOR_BUILD = @AR_FOR_BUILD@
AS_FOR_BUILD = @AS_FOR_BUILD@
CC_FOR_BUILD = @CC_FOR_BUILD@
CFLAGS_FOR_BUILD = @CFLAGS_FOR_BUILD@
CPP_FOR_BUILD = @CPP_FOR_BUILD@
CPPFLAGS_FOR_BUILD = @CPPFLAGS_FOR_BUILD@
CXXFLAGS_FOR_BUILD = @CXXFLAGS_FOR_BUILD@
CXX_FOR_BUILD = @CXX_FOR_BUILD@
DLLTOOL_FOR_BUILD = @DLLTOOL_FOR_BUILD@
DSYMUTIL_FOR_BUILD = @DSYMUTIL_FOR_BUILD@
GFORTRAN_FOR_BUILD = @GFORTRAN_FOR_BUILD@
GOC_FOR_BUILD = @GOC_FOR_BUILD@
GDC_FOR_BUILD = @GDC_FOR_BUILD@
LDFLAGS_FOR_BUILD = @LDFLAGS_FOR_BUILD@
LD_FOR_BUILD = @LD_FOR_BUILD@
NM_FOR_BUILD = @NM_FOR_BUILD@
@@ -377,7 +406,7 @@ MAKEINFO = @MAKEINFO@
EXPECT = @EXPECT@
RUNTEST = @RUNTEST@
AUTO_PROFILE = gcc-auto-profile -c 1000000
AUTO_PROFILE = gcc-auto-profile -c 10000000
# This just becomes part of the MAKEINFO definition passed down to
# sub-makes. It lets flags be given on the command line while still
@@ -390,21 +419,24 @@ MAKEINFOFLAGS = --split-size=5000000
# ---------------------------------------------
AS = @AS@
AR = @AR@
AR = @AR@ @AR_PLUGIN_OPTION@
AR_FLAGS = rc
CC = @CC@
CXX = @CXX@
DLLTOOL = @DLLTOOL@
DSYMUTIL = @DSYMUTIL@
LD = @LD@
LIPO = @LIPO@
NM = @NM@
OBJDUMP = @OBJDUMP@
RANLIB = @RANLIB@
OTOOL = @OTOOL@
RANLIB = @RANLIB@ @RANLIB_PLUGIN_OPTION@
READELF = @READELF@
STRIP = @STRIP@
WINDRES = @WINDRES@
WINDMC = @WINDMC@
GDC = @GDC@
GNATBIND = @GNATBIND@
GNATMAKE = @GNATMAKE@
@@ -414,6 +446,52 @@ LIBCFLAGS = $(CFLAGS)
CXXFLAGS = @CXXFLAGS@
LIBCXXFLAGS = $(CXXFLAGS) -fno-implicit-templates
GOCFLAGS = $(CFLAGS)
GDCFLAGS = $(CFLAGS)
PKG_CONFIG_PATH = @PKG_CONFIG_PATH@
# Pass additional PGO and LTO compiler options to the PGO build.
BUILD_CFLAGS = $(PGO_BUILD_CFLAGS) $(PGO_BUILD_LTO_CFLAGS)
override CFLAGS += $(BUILD_CFLAGS)
override CXXFLAGS += $(BUILD_CFLAGS)
# Additional PGO and LTO compiler options to generate profiling data
# for the PGO build.
PGO_BUILD_GEN_FLAGS_TO_PASS = \
PGO_BUILD_CFLAGS="@PGO_BUILD_GEN_CFLAGS@" \
PGO_BUILD_LTO_CFLAGS="@PGO_BUILD_LTO_CFLAGS@"
# NB: Filter out any compiler options which may fail PGO training runs.
PGO_BUILD_TRAINING_CFLAGS:= \
$(filter-out -Werror=%,$(CFLAGS))
PGO_BUILD_TRAINING_CXXFLAGS:=\
$(filter-out -Werror=%,$(CXXFLAGS))
PGO_BUILD_TRAINING_CFLAGS:= \
$(filter-out -Wall,$(PGO_BUILD_TRAINING_CFLAGS))
PGO_BUILD_TRAINING_CXXFLAGS:= \
$(filter-out -Wall,$(PGO_BUILD_TRAINING_CXXFLAGS))
PGO_BUILD_TRAINING_CFLAGS:= \
$(filter-out -specs=%,$(PGO_BUILD_TRAINING_CFLAGS))
PGO_BUILD_TRAINING_CXXFLAGS:= \
$(filter-out -specs=%,$(PGO_BUILD_TRAINING_CXXFLAGS))
PGO_BUILD_TRAINING_FLAGS_TO_PASS = \
PGO_BUILD_TRAINING=yes \
CFLAGS_FOR_TARGET="$(PGO_BUILD_TRAINING_CFLAGS)" \
CXXFLAGS_FOR_TARGET="$(PGO_BUILD_TRAINING_CXXFLAGS)"
# Ignore "make check" errors in PGO training runs.
PGO_BUILD_TRAINING_MFLAGS = -i
# Additional PGO and LTO compiler options to use profiling data for the
# PGO build.
PGO_BUILD_USE_FLAGS_TO_PASS = \
PGO_BUILD_CFLAGS="@PGO_BUILD_USE_CFLAGS@" \
PGO_BUILD_LTO_CFLAGS="@PGO_BUILD_LTO_CFLAGS@"
# PGO training targets for the PGO build. FIXME: Add gold tests to
# training.
PGO-TRAINING-TARGETS = binutils gas gdb ld sim
PGO_BUILD_TRAINING = $(addprefix maybe-check-,$(PGO-TRAINING-TARGETS))
CREATE_GCOV = create_gcov
@@ -455,11 +533,24 @@ STAGE1_CONFIGURE_FLAGS = --disable-intermodule $(STAGE1_CHECKING) \
--disable-coverage --enable-languages="$(STAGE1_LANGUAGES)" \
--disable-build-format-warnings
# When using the slow stage1 compiler disable IL verification and forcefully
# enable it when using the stage2 compiler instead. As we later compare
# stage2 and stage3 we are merely avoid doing redundant work, plus we apply
# checking when building all target libraries for release builds.
STAGE1_TFLAGS += -fno-checking
STAGE2_CFLAGS += -fno-checking
STAGE2_TFLAGS += -fno-checking
STAGE3_CFLAGS += -fchecking=1
STAGE3_TFLAGS += -fchecking=1
STAGEprofile_CFLAGS = $(STAGE2_CFLAGS) -fprofile-generate
STAGEprofile_TFLAGS = $(STAGE2_TFLAGS)
STAGEfeedback_CFLAGS = $(STAGE3_CFLAGS) -fprofile-use
STAGEfeedback_TFLAGS = $(STAGE3_TFLAGS)
STAGEtrain_CFLAGS = $(filter-out -fchecking=1,$(STAGE3_CFLAGS))
STAGEtrain_TFLAGS = $(filter-out -fchecking=1,$(STAGE3_TFLAGS))
STAGEfeedback_CFLAGS = $(STAGE4_CFLAGS) -fprofile-use -fprofile-reproducible=parallel-runs
STAGEfeedback_TFLAGS = $(STAGE4_TFLAGS)
STAGEautoprofile_CFLAGS = $(STAGE2_CFLAGS) -g
STAGEautoprofile_TFLAGS = $(STAGE2_TFLAGS)
@@ -487,13 +578,16 @@ CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @CXX_FOR_TARGET@
RAW_CXX_FOR_TARGET=$(STAGE_CC_WRAPPER) @RAW_CXX_FOR_TARGET@
GFORTRAN_FOR_TARGET=$(STAGE_CC_WRAPPER) @GFORTRAN_FOR_TARGET@
GOC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GOC_FOR_TARGET@
GDC_FOR_TARGET=$(STAGE_CC_WRAPPER) @GDC_FOR_TARGET@
DLLTOOL_FOR_TARGET=@DLLTOOL_FOR_TARGET@
DSYMUTIL_FOR_TARGET=@DSYMUTIL_FOR_TARGET@
LD_FOR_TARGET=@LD_FOR_TARGET@
LIPO_FOR_TARGET=@LIPO_FOR_TARGET@
NM_FOR_TARGET=@NM_FOR_TARGET@
OBJDUMP_FOR_TARGET=@OBJDUMP_FOR_TARGET@
OBJCOPY_FOR_TARGET=@OBJCOPY_FOR_TARGET@
OTOOL_FOR_TARGET=@OTOOL_FOR_TARGET@
RANLIB_FOR_TARGET=@RANLIB_FOR_TARGET@
READELF_FOR_TARGET=@READELF_FOR_TARGET@
STRIP_FOR_TARGET=@STRIP_FOR_TARGET@
@@ -511,6 +605,7 @@ LIBCFLAGS_FOR_TARGET = $(CFLAGS_FOR_TARGET)
LIBCXXFLAGS_FOR_TARGET = $(CXXFLAGS_FOR_TARGET) -fno-implicit-templates
LDFLAGS_FOR_TARGET = @LDFLAGS_FOR_TARGET@
GOCFLAGS_FOR_TARGET = -O2 -g
GDCFLAGS_FOR_TARGET = -O2 -g
FLAGS_FOR_TARGET = @FLAGS_FOR_TARGET@
SYSROOT_CFLAGS_FOR_TARGET = @SYSROOT_CFLAGS_FOR_TARGET@
@@ -592,6 +687,7 @@ BASE_FLAGS_TO_PASS =[+ FOR flags_to_pass +][+ IF optional +] \
"[+flag+]=$([+flag+])"[+ ENDIF optional+][+ ENDFOR flags_to_pass +][+ FOR bootstrap-stage +] \
"STAGE[+id+]_CFLAGS=$(STAGE[+id+]_CFLAGS)" \
"STAGE[+id+]_CXXFLAGS=$(STAGE[+id+]_CXXFLAGS)" \
"STAGE[+id+]_GENERATOR_CFLAGS=$(STAGE[+id+]_GENERATOR_CFLAGS)" \
"STAGE[+id+]_TFLAGS=$(STAGE[+id+]_TFLAGS)"[+ ENDFOR bootstrap-stage +] \
$(CXX_FOR_TARGET_FLAG_TO_PASS) \
"TFLAGS=$(TFLAGS)" \
@@ -610,12 +706,15 @@ EXTRA_HOST_FLAGS = \
'CC=$(CC)' \
'CXX=$(CXX)' \
'DLLTOOL=$(DLLTOOL)' \
'DSYMUTIL=$(DSYMUTIL)' \
'GFORTRAN=$(GFORTRAN)' \
'GOC=$(GOC)' \
'GDC=$(GDC)' \
'LD=$(LD)' \
'LIPO=$(LIPO)' \
'NM=$(NM)' \
'OBJDUMP=$(OBJDUMP)' \
'OTOOL=$(OTOOL)' \
'RANLIB=$(RANLIB)' \
'READELF=$(READELF)' \
'STRIP=$(STRIP)' \
@@ -636,6 +735,7 @@ STAGE1_FLAGS_TO_PASS = \
POSTSTAGE1_FLAGS_TO_PASS = \
CC="$${CC}" CC_FOR_BUILD="$${CC_FOR_BUILD}" \
CXX="$${CXX}" CXX_FOR_BUILD="$${CXX_FOR_BUILD}" \
GDC="$${GDC}" GDC_FOR_BUILD="$${GDC_FOR_BUILD}" \
GNATBIND="$${GNATBIND}" \
LDFLAGS="$${LDFLAGS}" \
HOST_LIBS="$${HOST_LIBS}" \
@@ -665,9 +765,12 @@ EXTRA_TARGET_FLAGS = \
$$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'CXXFLAGS=$$(CXXFLAGS_FOR_TARGET)' \
'DLLTOOL=$$(DLLTOOL_FOR_TARGET)' \
'DSYMUTIL=$$(DSYMUTIL_FOR_TARGET)' \
'GFORTRAN=$$(GFORTRAN_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'GOC=$$(GOC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'GOCFLAGS=$$(GOCFLAGS_FOR_TARGET)' \
'GDC=$$(GDC_FOR_TARGET) $$(XGCC_FLAGS_FOR_TARGET) $$(TFLAGS)' \
'GDCFLAGS=$$(GDCFLAGS_FOR_TARGET)' \
'LD=$(COMPILER_LD_FOR_TARGET)' \
'LDFLAGS=$$(LDFLAGS_FOR_TARGET)' \
'LIBCFLAGS=$$(LIBCFLAGS_FOR_TARGET)' \
@@ -719,6 +822,12 @@ configure-target: [+
# The target built for a native non-bootstrap build.
.PHONY: all
# --enable-pgo-build enables the PGO build.
# 1. First build with -fprofile-generate.
# 2. Use "make maybe-check-*" to generate profiling data.
# 3. Use "make clean" to remove the previous build.
# 4. Rebuild with -fprofile-use.
all:
@if gcc-bootstrap
[ -f stage_final ] || echo stage3 > stage_final
@@ -727,7 +836,7 @@ all:
$(MAKE) $(RECURSE_FLAGS_TO_PASS) `cat stage_final`-bubble
@endif gcc-bootstrap
@: $(MAKE); $(unstage)
@r=`${PWD_COMMAND}`; export r; \
+@r=`${PWD_COMMAND}`; export r; \
s=`cd $(srcdir); ${PWD_COMMAND}`; export s; \
@if gcc-bootstrap
if [ -f stage_last ]; then \
@@ -735,7 +844,17 @@ all:
$(MAKE) $(TARGET_FLAGS_TO_PASS) all-host all-target; \
else \
@endif gcc-bootstrap
$(MAKE) $(RECURSE_FLAGS_TO_PASS) all-host all-target \
$(MAKE) $(RECURSE_FLAGS_TO_PASS) \
$(PGO_BUILD_GEN_FLAGS_TO_PASS) all-host all-target \
@if pgo-build
&& $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
$(PGO_BUILD_TRAINING_MFLAGS) \
$(PGO_BUILD_TRAINING_FLAGS_TO_PASS) \
$(PGO_BUILD_TRAINING) \
&& $(MAKE) $(RECURSE_FLAGS_TO_PASS) clean \
&& $(MAKE) $(RECURSE_FLAGS_TO_PASS) \
$(PGO_BUILD_USE_FLAGS_TO_PASS) all-host all-target \
@endif pgo-build
@if gcc-bootstrap
; \
fi \
@@ -785,7 +904,7 @@ do-[+make_target+]:
# Here are the targets which correspond to the do-X targets.
.PHONY: info installcheck dvi pdf html
.PHONY: install-info install-pdf install-html
.PHONY: install-info install-dvi install-pdf install-html
.PHONY: clean distclean mostlyclean maintainer-clean realclean
.PHONY: local-clean local-distclean local-maintainer-clean
info: do-info
@@ -804,6 +923,8 @@ install-info: do-install-info dir.info
$(INSTALL_DATA) dir.info $(DESTDIR)$(infodir)/dir.info; \
else true; fi
install-dvi: do-install-dvi
install-pdf: do-install-pdf
install-html: do-install-html
@@ -825,8 +946,8 @@ local-distclean:
-rm -f texinfo/doc/Makefile texinfo/po/POTFILES
-rmdir texinfo/doc texinfo/info texinfo/intl texinfo/lib 2>/dev/null
-rmdir texinfo/makeinfo texinfo/po texinfo/util 2>/dev/null
-rmdir fastjar gcc gnattools gotools libcc1 libiberty 2>/dev/null
-rmdir texinfo zlib 2>/dev/null
-rmdir c++tools fastjar gcc gnattools gotools 2>/dev/null
-rmdir libcc1 libiberty texinfo zlib 2>/dev/null
-find . -name config.cache -exec rm -f {} \; \; 2>/dev/null
local-maintainer-clean:
@@ -1156,6 +1277,7 @@ all-stage[+id+]-[+prefix+][+module+]: configure-stage[+id+]-[+prefix+][+module+]
CXXFLAGS="$(CXXFLAGS_FOR_TARGET)" \
LIBCFLAGS="$(LIBCFLAGS_FOR_TARGET)"[+ ELSE prefix +] \
CFLAGS="$(STAGE[+id+]_CFLAGS)" \
GENERATOR_CFLAGS="$(STAGE[+id+]_GENERATOR_CFLAGS)" \
CXXFLAGS="$(STAGE[+id+]_CXXFLAGS)"[+ IF prev +] \
LIBCFLAGS="$(STAGE[+id+]_CFLAGS)"[+ ELSE prev +] \
LIBCFLAGS="$(LIBCFLAGS)"[+ ENDIF prev +][+ ENDIF prefix +] \
@@ -1638,7 +1760,7 @@ do-clean: clean-stage[+id+]
sed=`echo stage[+id+] | sed 's,^stage,,;s,.,.,g'`; \
files=`find stage[+id+]-* -name "*$(objext)" -print | \
sed -n s,^stage$$sed-,,p`; \
for file in $${files}; do \
for file in $${files} ${extra-compare}; do \
f1=$$r/stage[+prev+]-$$file; f2=$$r/stage[+id+]-$$file; \
if test ! -f $$f1; then continue; fi; \
$(do-[+compare-target+]) > /dev/null 2>&1; \
@@ -1818,25 +1940,46 @@ configure-target-[+module+]: maybe-all-gcc[+
(define dep-maybe (lambda ()
(if (exist? "hard") "" "maybe-")))
;; dep-kind returns "normal" if the dependency is on an "install" target,
;; or if either module is not bootstrapped. It returns "bootstrap" for
;; configure or build dependencies between bootstrapped modules; it returns
;; "prebootstrap" for configure or build dependencies of bootstrapped
;; modules on a build module (e.g. all-gcc on all-build-bison). All this
;; is only necessary for host modules.
;; dep-kind returns returns "prebootstrap" for configure or build
;; dependencies of bootstrapped modules on a build module
;; (e.g. all-gcc on all-build-bison); "normal" if the dependency is
;; on an "install" target, or if the dependence module is not
;; bootstrapped; otherwise, it returns "bootstrap" or
;; "postbootstrap" depending on whether the dependent module is
;; bootstrapped. All this is only necessary for host and target
;; modules. It might seem like, in order to avoid build races, we
;; might need more elaborate detection between prebootstrap and
;; postbootstrap modules, but there are no host prebootstrap
;; modules. If there were any non-bootstrap host modules that
;; bootstrap modules depended on, we'd get unsatisfied per-stage
;; dependencies on them, which would be immediately noticed.
(define dep-kind (lambda ()
(if (and (hash-ref boot-modules (dep-module "module"))
(=* (dep-module "on") "build-"))
"prebootstrap"
(cond
((and (hash-ref boot-modules (dep-module "module"))
(=* (dep-module "on") "build-"))
"prebootstrap")
(if (or (= (dep-subtarget "on") "install-")
(not (hash-ref boot-modules (dep-module "module")))
(not (hash-ref boot-modules (dep-module "on"))))
"normal"
"bootstrap"))))
((or (= (dep-subtarget "on") "install-")
(not (hash-ref boot-modules (dep-module "on"))))
"normal")
((hash-ref boot-modules (dep-module "module"))
"bootstrap")
(1 "postbootstrap"))))
(define make-postboot-dep (lambda ()
(let ((target (dep-module "module")) (dep "stage_last"))
(unless (= (hash-ref postboot-targets target) dep)
(hash-create-handle! postboot-targets target dep)
;; All non-bootstrap modules' configure target already
;; depend on dep.
(unless (=* target "target-")
(string-append "configure-" target ": " dep "\n"))))))
;; We now build the hash table that is used by dep-kind.
(define boot-modules (make-hash-table 113))
(define postboot-targets (make-hash-table 113))
+]
[+ FOR host_modules +][+
@@ -1853,18 +1996,23 @@ configure-target-[+module+]: maybe-all-gcc[+
# to check for bootstrap/prebootstrap dependencies. To resolve
# prebootstrap dependencies, prebootstrap modules are gathered in
# a hash table.
[+ FOR dependencies +][+ (make-dep "" "") +]
[+ CASE (dep-kind) +]
[+ == "prebootstrap"
+][+ FOR bootstrap_stage +]
[+ (make-dep (dep-stage) "") +][+
ENDFOR bootstrap_stage +]
[+ == "bootstrap"
+][+ FOR bootstrap_stage +]
[+ (make-dep (dep-stage) (dep-stage)) +][+
ENDFOR bootstrap_stage +]
[+ ESAC +][+
ENDFOR dependencies +]
[+ FOR dependencies +][+ CASE (dep-kind) +]
[+ == "prebootstrap" +][+ (make-dep "" "") +][+ FOR bootstrap_stage +]
[+ (make-dep (dep-stage) "") +][+ ENDFOR bootstrap_stage +]
[+ == "bootstrap" +][+ (make-dep "" "") +][+ FOR bootstrap_stage +]
[+ (make-dep (dep-stage) (dep-stage)) +][+ ENDFOR bootstrap_stage +]
[+ == "normal" +][+ (make-dep "" "") +]
[+ ESAC +][+ ENDFOR dependencies +]
@if gcc-bootstrap
[+ FOR dependencies +][+ CASE (dep-kind) +]
[+ == "postbootstrap" +][+ (make-postboot-dep) +][+ ESAC +][+
ENDFOR dependencies +]@endif gcc-bootstrap
@unless gcc-bootstrap
[+ FOR dependencies +][+ CASE (dep-kind) +]
[+ == "postbootstrap" +][+ (make-dep "" "") +]
[+ ESAC +][+ ENDFOR dependencies +]@endunless gcc-bootstrap
# Dependencies for target modules on other target modules are
# described by lang_env_dependencies; the defaults apply to anything
@@ -1941,6 +2089,7 @@ AUTOCONF = autoconf
$(srcdir)/configure: @MAINT@ $(srcdir)/configure.ac $(srcdir)/config/acx.m4 \
$(srcdir)/config/override.m4 $(srcdir)/config/proginstall.m4 \
$(srcdir)/config/elf.m4 $(srcdir)/config/isl.m4 \
$(srcdir)/config/gcc-plugin.m4 \
$(srcdir)/libtool.m4 $(srcdir)/ltoptions.m4 $(srcdir)/ltsugar.m4 \
$(srcdir)/ltversion.m4 $(srcdir)/lt~obsolete.m4
cd $(srcdir) && $(AUTOCONF)
+2 -2
View File
@@ -1,6 +1,5 @@
/bfd-in3.h
/bfd.h
/bfd_stdint.h
/bfdver.h
/elf32-ia64.c
/elf32-target.h
@@ -11,6 +10,7 @@
/peigen.c
/pepigen.c
/pex64igen.c
/pe-aarch64igen.c
/stmp-bfd-h
/targmatch.h
@@ -24,7 +24,7 @@
/doc/cache.texi
/doc/chew
/doc/coffcode.texi
/doc/core.texi
/doc/corefile.texi
/doc/elf.texi
/doc/elfcode.texi
/doc/format.texi
+2208 -3092
View File
File diff suppressed because it is too large Load Diff
+4 -4
View File
@@ -3868,15 +3868,15 @@
* coffcode.h (coff_pointerize_aux_hook): Update CSECT_SYM_P to
check whether a symbol has csect information.
(coff_print_aux): Likewise.
* coff-rs6000.c (_bfd_xcoff_swap_aux_in): Handle auxillary csect
* coff-rs6000.c (_bfd_xcoff_swap_aux_in): Handle auxiliary csect
information for C_AIX_WEAKEXT too.
(_bfd_xcoff_swap_aux_out): Likewise.
(xcoff_reloc_type_br): Handle defweak symbols too.
* coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Handle auxillary csect
* coff64-rs6000.c (_bfd_xcoff64_swap_aux_in): Handle auxiliary csect
information for C_AIX_WEAKEXT too.
(_bfd_xcoff64_swap_aux_out): Likewise.
(xcoff64_reloc_type_br): Handle defweak symbols too.
* coffgen.c (coff_print_symbol): Handle auxillary function
* coffgen.c (coff_print_symbol): Handle auxiliary function
information for C_AIX_WEAKEXT too.
* xcofflink.c (_bfd_xcoff_canonicalize_dynamic_symtab): Set BSF_WEAK
instead of BSF_GLOBAL if the L_WEAK flag is set.
@@ -3942,7 +3942,7 @@
objects in a dynamic link, rather than checking whether csectpp
is null. Always allocate debug_index for other objects,
and always go through the loop. Update the type of debug_index
after the change above. Read the auxillary csect information
after the change above. Read the auxiliary csect information
and use xcoff_keep_symbol_p to decide whether a symbol should
be kept. Set its debug_index to -2 if not.
(xcoff_link_input_bfd): Update the type of debug_index after
+1 -1
View File
@@ -621,7 +621,7 @@
PR binutils/17512
* coffgen.c (coff_get_normalized_symtab): Check for an excessive
number of auxillary entries.
number of auxiliary entries.
* ieee.c (next_byte): Convert to a function. Return FALSE if the
next byte is beyond the end of the buffer.
(parse_int): Test the return value of next_byte.
+1 -1
View File
@@ -3076,7 +3076,7 @@
PR binutils/17512
* coffgen.c (coff_get_normalized_symtab): Fix test for out of
range auxillary sections.
range auxiliary sections.
2015-03-24 Marcus Shawcroft <marcus.shawcroft@arm.com>
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
See ../binutils/MAINTAINERS
Copyright (C) 2012-2018 Free Software Foundation, Inc.
Copyright (C) 2012-2022 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
+162 -138
View File
@@ -1,6 +1,6 @@
## Process this file with automake to generate Makefile.in
#
# Copyright (C) 2012-2018 Free Software Foundation, Inc.
# Copyright (C) 2012-2022 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -17,13 +17,18 @@
# <http://www.gnu.org/licenses/>.
#
AUTOMAKE_OPTIONS = no-dist foreign
AUTOMAKE_OPTIONS = no-dist foreign info-in-builddir no-texinfo.tex
ACLOCAL_AMFLAGS = -I . -I .. -I ../config
MOSTLYCLEANFILES =
CLEANFILES =
DISTCLEANFILES =
MAINTAINERCLEANFILES =
INCDIR = $(srcdir)/../include
CSEARCH = -I. -I$(srcdir) -I$(INCDIR)
SUBDIRS = doc po
SUBDIRS = po
bfddocdir = doc
@@ -33,7 +38,7 @@ bfdlibdir = @bfdlibdir@
bfdincludedir = @bfdincludedir@
bfdlib_LTLIBRARIES = libbfd.la
bfdinclude_HEADERS = $(BFD_H) $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h \
$(INCDIR)/bfdlink.h $(INCDIR)/diagnostics.h
$(INCDIR)/diagnostics.h $(INCDIR)/bfdlink.h
else !INSTALL_LIBBFD
# Empty these so that the respective installation directories will not be created.
bfdlibdir =
@@ -53,7 +58,7 @@ ZLIBINC = @zlibinc@
WARN_CFLAGS = @WARN_CFLAGS@
NO_WERROR = @NO_WERROR@
AM_CFLAGS = $(WARN_CFLAGS) $(ZLIBINC)
AM_CPPFLAGS = -DBINDIR='"$(bindir)"'
AM_CPPFLAGS = -DBINDIR='"$(bindir)"' -DLIBDIR='"$(libdir)"' @LARGEFILE_CPPFLAGS@
if PLUGINS
bfdinclude_HEADERS += $(INCDIR)/plugin-api.h
LIBDL = @lt_cv_dlopen_libs@
@@ -70,17 +75,17 @@ BFD_H = bfd.h
# need two copies of the executable, one to download and one for the
# debugger).
BFD32_LIBS = \
archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo \
cache.lo coff-bfd.lo compress.lo corefile.lo format.lo hash.lo \
init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo \
archive.lo archures.lo bfd.lo bfdio.lo bfdwin.lo cache.lo \
coff-bfd.lo compress.lo corefile.lo elf-properties.lo format.lo \
hash.lo init.lo libbfd.lo linker.lo merge.lo opncls.lo reloc.lo \
section.lo simple.lo stab-syms.lo stabs.lo syms.lo targets.lo \
binary.lo ihex.lo srec.lo tekhex.lo verilog.lo
BFD64_LIBS = archive64.lo
BFD32_LIBS_CFILES = \
archive.c archures.c bfd.c bfdio.c bfdwin.c \
cache.c coff-bfd.c compress.c corefile.c format.c hash.c \
archive.c archures.c bfd.c bfdio.c bfdwin.c cache.c coff-bfd.c \
compress.c corefile.c elf-properties.c format.c hash.c \
init.c libbfd.c linker.c merge.c opncls.c reloc.c \
section.c simple.c stab-syms.c stabs.c syms.c targets.c \
binary.c ihex.c srec.c tekhex.c verilog.c
@@ -92,14 +97,16 @@ BFD64_LIBS_CFILES = archive64.c
ALL_MACHINES = \
cpu-aarch64.lo \
cpu-alpha.lo \
cpu-amdgcn.lo \
cpu-arc.lo \
cpu-arm.lo \
cpu-avr.lo \
cpu-bfin.lo \
cpu-bpf.lo \
cpu-cr16.lo \
cpu-cr16c.lo \
cpu-cris.lo \
cpu-crx.lo \
cpu-csky.lo \
cpu-d10v.lo \
cpu-d30v.lo \
cpu-dlx.lo \
@@ -111,12 +118,11 @@ ALL_MACHINES = \
cpu-hppa.lo \
cpu-i386.lo \
cpu-iamcu.lo \
cpu-l1om.lo \
cpu-k1om.lo \
cpu-ia64.lo \
cpu-ip2k.lo \
cpu-iq2000.lo \
cpu-lm32.lo \
cpu-loongarch.lo \
cpu-m10200.lo \
cpu-m10300.lo \
cpu-m32c.lo \
@@ -143,7 +149,6 @@ ALL_MACHINES = \
cpu-or1k.lo \
cpu-pdp11.lo \
cpu-pj.lo \
cpu-plugin.lo \
cpu-powerpc.lo \
cpu-pru.lo \
cpu-rs6000.lo \
@@ -159,7 +164,6 @@ ALL_MACHINES = \
cpu-tic4x.lo \
cpu-tic54x.lo \
cpu-tic6x.lo \
cpu-tic80.lo \
cpu-tilegx.lo \
cpu-tilepro.lo \
cpu-v850.lo \
@@ -167,7 +171,6 @@ ALL_MACHINES = \
cpu-vax.lo \
cpu-visium.lo \
cpu-wasm32.lo \
cpu-xc16x.lo \
cpu-xgate.lo \
cpu-xstormy16.lo \
cpu-xtensa.lo \
@@ -177,14 +180,16 @@ ALL_MACHINES = \
ALL_MACHINES_CFILES = \
cpu-aarch64.c \
cpu-alpha.c \
cpu-amdgcn.c \
cpu-arc.c \
cpu-arm.c \
cpu-avr.c \
cpu-bfin.c \
cpu-bpf.c \
cpu-cr16.c \
cpu-cr16c.c \
cpu-cris.c \
cpu-crx.c \
cpu-csky.c \
cpu-d10v.c \
cpu-d30v.c \
cpu-dlx.c \
@@ -196,12 +201,11 @@ ALL_MACHINES_CFILES = \
cpu-hppa.c \
cpu-i386.c \
cpu-iamcu.c \
cpu-l1om.c \
cpu-k1om.c \
cpu-ia64.c \
cpu-ip2k.c \
cpu-iq2000.c \
cpu-lm32.c \
cpu-loongarch.c \
cpu-m10200.c \
cpu-m10300.c \
cpu-m32c.c \
@@ -228,7 +232,6 @@ ALL_MACHINES_CFILES = \
cpu-or1k.c \
cpu-pdp11.c \
cpu-pj.c \
cpu-plugin.c \
cpu-powerpc.c \
cpu-pru.c \
cpu-rs6000.c \
@@ -244,7 +247,6 @@ ALL_MACHINES_CFILES = \
cpu-tic4x.c \
cpu-tic54x.c \
cpu-tic6x.c \
cpu-tic80.c \
cpu-tilegx.c \
cpu-tilepro.c \
cpu-v850.c \
@@ -252,7 +254,6 @@ ALL_MACHINES_CFILES = \
cpu-vax.c \
cpu-visium.c \
cpu-wasm32.c \
cpu-xc16x.c \
cpu-xgate.c \
cpu-xstormy16.c \
cpu-xtensa.c \
@@ -264,7 +265,6 @@ ALL_MACHINES_CFILES = \
BFD32_BACKENDS = \
aout-cris.lo \
aout-ns32k.lo \
aout-tic30.lo \
aout32.lo \
cf-i386lynx.lo \
coff-go32.lo \
@@ -276,7 +276,6 @@ BFD32_BACKENDS = \
coff-tic30.lo \
coff-tic4x.lo \
coff-tic54x.lo \
coff-tic80.lo \
coff-z80.lo \
coff-z8k.lo \
coffgen.lo \
@@ -291,7 +290,6 @@ BFD32_BACKENDS = \
elf-m10200.lo \
elf-m10300.lo \
elf-nacl.lo \
elf-properties.lo \
elf-strtab.lo \
elf-vxworks.lo \
elf.lo \
@@ -301,9 +299,9 @@ BFD32_BACKENDS = \
elf32-avr.lo \
elf32-bfin.lo \
elf32-cr16.lo \
elf32-cr16c.lo \
elf32-cris.lo \
elf32-crx.lo \
elf32-csky.lo \
elf32-d10v.lo \
elf32-d30v.lo \
elf32-dlx.lo \
@@ -352,10 +350,10 @@ BFD32_BACKENDS = \
elf32-vax.lo \
elf32-visium.lo \
elf32-wasm32.lo \
elf32-xc16x.lo \
elf32-xgate.lo \
elf32-xstormy16.lo \
elf32-xtensa.lo \
elf32-z80.lo \
elf32.lo \
elflink.lo \
elfxx-sparc.lo \
@@ -374,14 +372,12 @@ BFD32_BACKENDS = \
pe-arm.lo \
pe-i386.lo \
pe-mcore.lo \
pe-ppc.lo \
pe-sh.lo \
pef.lo \
pei-arm-wince.lo \
pei-arm.lo \
pei-i386.lo \
pei-mcore.lo \
pei-ppc.lo \
pei-sh.lo \
peigen.lo \
plugin.lo \
@@ -401,7 +397,6 @@ BFD32_BACKENDS = \
BFD32_BACKENDS_CFILES = \
aout-cris.c \
aout-ns32k.c \
aout-tic30.c \
aout32.c \
cf-i386lynx.c \
coff-go32.c \
@@ -413,7 +408,6 @@ BFD32_BACKENDS_CFILES = \
coff-tic30.c \
coff-tic4x.c \
coff-tic54x.c \
coff-tic80.c \
coff-z80.c \
coff-z8k.c \
coffgen.c \
@@ -428,7 +422,6 @@ BFD32_BACKENDS_CFILES = \
elf-m10200.c \
elf-m10300.c \
elf-nacl.c \
elf-properties.c \
elf-strtab.c \
elf-vxworks.c \
elf.c \
@@ -438,9 +431,9 @@ BFD32_BACKENDS_CFILES = \
elf32-avr.c \
elf32-bfin.c \
elf32-cr16.c \
elf32-cr16c.c \
elf32-cris.c \
elf32-crx.c \
elf32-csky.c \
elf32-d10v.c \
elf32-d30v.c \
elf32-dlx.c \
@@ -489,10 +482,10 @@ BFD32_BACKENDS_CFILES = \
elf32-vax.c \
elf32-visium.c \
elf32-wasm32.c \
elf32-xc16x.c \
elf32-xgate.c \
elf32-xstormy16.c \
elf32-xtensa.c \
elf32-z80.c \
elf32.c \
elflink.c \
elfxx-sparc.c \
@@ -511,14 +504,12 @@ BFD32_BACKENDS_CFILES = \
pe-arm.c \
pe-i386.c \
pe-mcore.c \
pe-ppc.c \
pe-sh.c \
pef.c \
pei-arm-wince.c \
pei-arm.c \
pei-i386.c \
pei-mcore.c \
pei-ppc.c \
pei-sh.c \
plugin.c \
ppcboot.c \
@@ -553,11 +544,15 @@ BFD64_BACKENDS = \
elf32-score.lo \
elf32-score7.lo \
elf64-alpha.lo \
elf64-amdgcn.lo \
elf64-gen.lo \
elf64-hppa.lo \
elf64-ia64.lo \
elf64-ia64-vms.lo \
elfxx-ia64.lo \
elf32-loongarch.lo \
elf64-loongarch.lo \
elfxx-loongarch.lo \
elfn32-mips.lo \
elf64-mips.lo \
elfxx-mips.lo \
@@ -572,11 +567,14 @@ BFD64_BACKENDS = \
elf64-tilegx.lo \
elf64-x86-64.lo \
elfxx-x86.lo \
elf64-bpf.lo \
elf64.lo \
mach-o-aarch64.lo \
mach-o-x86-64.lo \
mmo.lo \
pe-aarch64igen.lo \
pe-x86_64.lo \
pei-aarch64.lo \
pei-ia64.lo \
pei-x86_64.lo \
pepigen.lo \
@@ -593,6 +591,7 @@ BFD64_BACKENDS_CFILES = \
elf32-score.c \
elf32-score7.c \
elf64-alpha.c \
elf64-amdgcn.c \
elf64-gen.c \
elf64-hppa.c \
elf64-ia64-vms.c \
@@ -605,16 +604,19 @@ BFD64_BACKENDS_CFILES = \
elf64-tilegx.c \
elf64-x86-64.c \
elfxx-x86.c \
elf64-bpf.c \
elf64.c \
elfn32-mips.c \
elfxx-aarch64.c \
elfxx-ia64.c \
elfxx-loongarch.c \
elfxx-mips.c \
elfxx-riscv.c \
mach-o-aarch64.c \
mach-o-x86-64.c \
mmo.c \
pe-x86_64.c \
pei-aarch64.c \
pei-ia64.c \
pei-x86_64.c \
vms-alpha.c
@@ -673,32 +675,58 @@ SOURCE_CFILES = \
BUILD_CFILES = \
elf32-aarch64.c elf64-aarch64.c \
elf32-ia64.c elf64-ia64.c \
elf32-loongarch.c elf64-loongarch.c \
elf32-riscv.c elf64-riscv.c \
peigen.c pepigen.c pex64igen.c
peigen.c pepigen.c pex64igen.c pe-aarch64igen.c
CFILES = $(SOURCE_CFILES) $(BUILD_CFILES)
## This is a list of all .h files which are in the source tree.
## This is a list of all .h files in the source tree minus those that
## are processed to produce other .h files
SOURCE_HFILES = \
aout-target.h aoutx.h coffcode.h coffswap.h ecoffswap.h \
elf-bfd.h elf-hppa.h elf-linux-core.h elf32-hppa.h \
elf64-hppa.h elfcode.h elfcore.h \
aout-target.h aoutx.h arc-got.h arc-plt.h \
coff-arm.h coff-bfd.h coffcode.h coffswap.h \
cpu-aarch64.h cpu-arm.h cpu-h8300.h cpu-m68k.h cpu-riscv.h \
ecoff-bfd.h ecoffswap.h \
elf32-arm.h elf32-avr.h elf32-bfin.h elf32-cr16.h elf32-csky.h \
elf32-dlx.h elf32-hppa.h elf32-m68hc1x.h elf32-m68k.h \
elf32-metag.h elf32-nds32.h elf32-nios2.h elf32-ppc.h \
elf32-rx.h elf32-score.h elf32-sh-relocs.h elf32-spu.h \
elf32-tic6x.h elf32-tilegx.h elf32-tilepro.h elf32-v850.h \
elf64-hppa.h elf64-ppc.h elf64-tilegx.h \
elf-bfd.h elfcode.h elfcore.h elf-hppa.h elf-linker-x86.h \
elf-linux-core.h elf-nacl.h elf-s390.h elf-vxworks.h \
elfxx-aarch64.h elfxx-ia64.h elfxx-mips.h elfxx-riscv.h \
elfxx-sparc.h elfxx-tilegx.h elfxx-x86.h elfxx-loongarch.h \
genlink.h go32stub.h \
libaout.h libbfd.h libcoff.h libecoff.h libhppa.h \
libpei.h libxcoff.h mach-o.h \
libpei.h libxcoff.h \
mach-o.h \
netbsd.h ns32k.h \
pef.h pef-traceback.h peicode.h som.h version.h \
vms.h xsym.h
pef.h pef-traceback.h peicode.h plugin.h \
som.h sysdep.h \
version.h vms.h \
wasm-module.h \
xcofflink.h xsym.h
## ... and all .h files which are in the build tree.
## ... and .h files which are in the build tree, minus config.h and bfd.h
BUILD_HFILES = \
bfdver.h elf32-target.h elf64-target.h targmatch.h bfd_stdint.h
bfdver.h elf32-target.h elf64-target.h targmatch.h
# Ensure they are built early:
BUILT_SOURCES = $(BUILD_HFILES)
HFILES = $(SOURCE_HFILES) $(BUILD_HFILES)
BFD_H_DEPS = $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h $(INCDIR)/diagnostics.h
LOCAL_H_DEPS = libbfd.h sysdep.h config.h
$(BFD32_LIBS) \
$(BFD64_LIBS) \
$(ALL_MACHINES) \
$(BFD32_BACKENDS) \
$(BFD64_BACKENDS) \
$(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
SRC_POTFILES = $(SOURCE_CFILES) $(SOURCE_HFILES)
BLD_POTFILES = $(BUILD_CFILES) $(BUILD_HFILES)
@@ -769,116 +797,102 @@ libbfd.a: stamp-lib ; @true
# vector names. It is built from config.bfd. It is not compiled by
# itself, but is included by targets.c.
targmatch.h: config.bfd targmatch.sed
rm -f targmatch.h
$(SED) -f $(srcdir)/targmatch.sed < $(srcdir)/config.bfd > targmatch.new
mv -f targmatch.new targmatch.h
$(AM_V_at)rm -f targmatch.new
$(AM_V_GEN)$(SED) -f $(srcdir)/targmatch.sed < $(srcdir)/config.bfd > targmatch.new
$(AM_V_at)mv -f targmatch.new targmatch.h
# When compiling archures.c and targets.c, supply the default target
# info from configure.
targets.lo: targets.c Makefile
if am__fastdepCC
$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $(TDEFAULTS) $(srcdir)/targets.c
mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $(TDEFAULTS) $(srcdir)/targets.c
$(AM_V_at)mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
else
if AMDEP
source='targets.c' object='$@' libtool=yes @AMDEPBACKSLASH@
DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
endif
$(LTCOMPILE) -c -o $@ $(TDEFAULTS) $(srcdir)/targets.c
$(AM_V_CC)$(LTCOMPILE) -c -o $@ $(TDEFAULTS) $(srcdir)/targets.c
endif
archures.lo: archures.c Makefile
if am__fastdepCC
$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $(TDEFAULTS) $(srcdir)/archures.c
mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $(TDEFAULTS) $(srcdir)/archures.c
$(AM_V_at)mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
else
if AMDEP
source='archures.c' object='$@' libtool=yes @AMDEPBACKSLASH@
DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
endif
$(LTCOMPILE) -c -o $@ $(TDEFAULTS) $(srcdir)/archures.c
$(AM_V_CC)$(LTCOMPILE) -c -o $@ $(TDEFAULTS) $(srcdir)/archures.c
endif
dwarf2.lo: dwarf2.c Makefile
if am__fastdepCC
$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.c
mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
$(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.c
$(AM_V_at)mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
else
if AMDEP
source='dwarf2.c' object='$@' libtool=yes @AMDEPBACKSLASH@
DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
endif
$(LTCOMPILE) -c -o $@ -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.c
$(AM_V_CC)$(LTCOMPILE) -c -o $@ -DDEBUGDIR=\"$(DEBUGDIR)\" $(srcdir)/dwarf2.c
endif
elf32-target.h : elfxx-target.h
rm -f elf32-target.h
$(SED) -e s/NN/32/g < $(srcdir)/elfxx-target.h > elf32-target.new
mv -f elf32-target.new elf32-target.h
$(AM_V_GEN)$(SED) -e s/NN/32/g < $< > $@
elf64-target.h : elfxx-target.h
rm -f elf64-target.h
$(SED) -e s/NN/64/g < $(srcdir)/elfxx-target.h > elf64-target.new
mv -f elf64-target.new elf64-target.h
$(AM_V_GEN)$(SED) -e s/NN/64/g < $< > $@
elf32-aarch64.c : elfnn-aarch64.c
rm -f elf32-aarch64.c
echo "#line 1 \"$(srcdir)/elfnn-aarch64.c\"" > elf32-aarch64.new
$(SED) -e s/NN/32/g < $(srcdir)/elfnn-aarch64.c >> elf32-aarch64.new
mv -f elf32-aarch64.new elf32-aarch64.c
$(AM_V_at)echo "#line 1 \"elfnn-aarch64.c\"" > $@
$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
elf64-aarch64.c : elfnn-aarch64.c
rm -f elf64-aarch64.c
echo "#line 1 \"$(srcdir)/elfnn-aarch64.c\"" > elf64-aarch64.new
$(SED) -e s/NN/64/g < $(srcdir)/elfnn-aarch64.c >> elf64-aarch64.new
mv -f elf64-aarch64.new elf64-aarch64.c
$(AM_V_at)echo "#line 1 \"elfnn-aarch64.c\"" > $@
$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
elf32-ia64.c : elfnn-ia64.c
rm -f elf32-ia64.c
$(SED) -e s/NN/32/g < $(srcdir)/elfnn-ia64.c > elf32-ia64.new
mv -f elf32-ia64.new elf32-ia64.c
$(AM_V_at)echo "#line 1 \"elfnn-ia64.c\"" > $@
$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
elf64-ia64.c : elfnn-ia64.c
rm -f elf64-ia64.c
$(SED) -e s/NN/64/g < $(srcdir)/elfnn-ia64.c > elf64-ia64.new
mv -f elf64-ia64.new elf64-ia64.c
$(AM_V_at)echo "#line 1 \"elfnn-ia64.c\"" > $@
$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
elf32-loongarch.c : elfnn-loongarch.c
$(AM_V_at)echo "#line 1 \"elfnn-loongarch.c\"" > $@
$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
elf64-loongarch.c : elfnn-loongarch.c
$(AM_V_at)echo "#line 1 \"elfnn-loongarch.c\"" > $@
$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
elf32-riscv.c : elfnn-riscv.c
rm -f elf32-riscv.c
echo "#line 1 \"$(srcdir)/elfnn-riscv.c\"" > elf32-riscv.new
sed -e s/NN/32/g < $(srcdir)/elfnn-riscv.c >> elf32-riscv.new
mv -f elf32-riscv.new elf32-riscv.c
$(AM_V_at)echo "#line 1 \"elfnn-riscv.c\"" > $@
$(AM_V_GEN)$(SED) -e s/NN/32/g < $< >> $@
elf64-riscv.c : elfnn-riscv.c
rm -f elf64-riscv.c
echo "#line 1 \"$(srcdir)/elfnn-riscv.c\"" > elf64-riscv.new
sed -e s/NN/64/g < $(srcdir)/elfnn-riscv.c >> elf64-riscv.new
mv -f elf64-riscv.new elf64-riscv.c
$(AM_V_at)echo "#line 1 \"elfnn-riscv.c\"" > $@
$(AM_V_GEN)$(SED) -e s/NN/64/g < $< >> $@
peigen.c : peXXigen.c
rm -f peigen.c
$(SED) -e s/XX/pe/g < $(srcdir)/peXXigen.c > peigen.new
mv -f peigen.new peigen.c
$(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
$(AM_V_GEN)$(SED) -e s/XX/pe/g < $< >> $@
pepigen.c : peXXigen.c
rm -f pepigen.c
$(SED) -e s/XX/pep/g < $(srcdir)/peXXigen.c > pepigen.new
mv -f pepigen.new pepigen.c
$(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
$(AM_V_GEN)$(SED) -e s/XX/pep/g < $< >> $@
pex64igen.c: peXXigen.c
rm -f pex64igen.c
$(SED) -e s/XX/pex64/g < $(srcdir)/peXXigen.c > pex64igen.new
mv -f pex64igen.new pex64igen.c
$(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
$(AM_V_GEN)$(SED) -e s/XX/pex64/g < $< >> $@
BFD_H_DEPS= $(INCDIR)/ansidecl.h $(INCDIR)/symcat.h
LOCAL_H_DEPS= libbfd.h sysdep.h config.h
$(BFD32_LIBS) \
$(BFD64_LIBS) \
$(ALL_MACHINES) \
$(BFD32_BACKENDS) \
$(BFD64_BACKENDS) \
$(OPTIONAL_BACKENDS): $(BFD_H) $(BFD_H_DEPS) $(LOCAL_H_DEPS)
pe-aarch64igen.c: peXXigen.c
$(AM_V_at)echo "#line 1 \"peXXigen.c\"" > $@
$(AM_V_GEN)$(SED) -e s/XX/peAArch64/g < $< >> $@
host-aout.lo: Makefile
@@ -907,50 +921,58 @@ LIBBFD_H_FILES = libbfd-in.h libbfd.c bfdio.c bfdwin.c \
cache.c reloc.c archures.c linker.c
LIBCOFF_H_FILES = libcoff-in.h coffcode.h
# Could really use a "copy-if-change"...
headers:
(cd $(bfddocdir); $(MAKE) protos $(FLAGS_TO_PASS))
cp $(bfddocdir)/bfd.h bfd-in2.h-new
$(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h
cp $(bfddocdir)/libbfd.h libbfd.h-new
$(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h
cp $(bfddocdir)/libcoff.h libcoff.h-new
$(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h
headers: stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
# We only rebuild the header files automatically if we have been
# configured with --enable-maintainer-mode.
REGEN_HEADER = \
( \
set -e; \
echo "$$H_FILES" | sed -f $(srcdir)/doc/header.sed; \
for file in $$H_FILES; do \
file="$(srcdir)/$$file"; \
case $$file in \
*-in.h) cat $$file;; \
*) echo $$file | sed -e 's,.*/,,' -e 's,^,/* Extracted from ,' \
-e 's,$$,. */,'; \
$(MKDOC) $$CHEW_FLAGS -f $(srcdir)/doc/proto.str < $$file;; \
esac; \
done; \
echo "\#ifdef __cplusplus"; \
echo "}"; \
echo "\#endif"; \
echo "\#endif"; \
)
$(srcdir)/bfd-in2.h: @MAINT@ stmp-bin2-h ; @true
stmp-bin2-h: $(BFD_H_FILES) $(BFD64_H_FILES)
(cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) bfd.h)
cp $(bfddocdir)/bfd.h bfd-in2.h-new
$(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h
touch stmp-bin2-h
stmp-bin2-h: $(BFD_H_FILES) $(BFD64_H_FILES) $(MKDOC)
$(AM_V_GEN)H_FILES="$(BFD_H_FILES)" CHEW_FLAGS= ; $(REGEN_HEADER) > bfd-in2.h-new
$(AM_V_at)$(SHELL) $(srcdir)/../move-if-change bfd-in2.h-new $(srcdir)/bfd-in2.h
$(AM_V_at)touch stmp-bin2-h
$(srcdir)/libbfd.h: @MAINT@ stmp-lbfd-h ; @true
stmp-lbfd-h: $(LIBBFD_H_FILES)
(cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libbfd.h)
cp $(bfddocdir)/libbfd.h libbfd.h-new
$(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h
touch stmp-lbfd-h
stmp-lbfd-h: $(LIBBFD_H_FILES) $(MKDOC)
$(AM_V_GEN)H_FILES="$(LIBBFD_H_FILES)" CHEW_FLAGS=-i ; $(REGEN_HEADER) > libbfd.h-new
$(AM_V_at)$(SHELL) $(srcdir)/../move-if-change libbfd.h-new $(srcdir)/libbfd.h
$(AM_V_at)touch stmp-lbfd-h
$(srcdir)/libcoff.h: @MAINT@ stmp-lcoff-h ; @true
stmp-lcoff-h: $(LIBCOFF_H_FILES)
(cd $(bfddocdir); $(MAKE) $(FLAGS_TO_PASS) libcoff.h)
cp $(bfddocdir)/libcoff.h libcoff.h-new
$(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h
touch stmp-lcoff-h
stmp-lcoff-h: $(LIBCOFF_H_FILES) $(MKDOC)
$(AM_V_GEN)H_FILES="$(LIBCOFF_H_FILES)" CHEW_FLAGS=-i ; $(REGEN_HEADER) > libcoff.h-new
$(AM_V_at)$(SHELL) $(srcdir)/../move-if-change libcoff.h-new $(srcdir)/libcoff.h
$(AM_V_at)touch stmp-lcoff-h
MOSTLYCLEANFILES = ofiles stamp-ofiles
MOSTLYCLEANFILES += ofiles stamp-ofiles
CLEANFILES = bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \
CLEANFILES += bfd.h dep.sed stmp-bfd-h DEP DEPA DEP1 DEP2 libbfd.a stamp-lib \
stmp-bin2-h stmp-lbfd-h stmp-lcoff-h
DISTCLEANFILES = $(BUILD_CFILES) $(BUILD_HFILES) libtool-soversion
DISTCLEANFILES += $(BUILD_CFILES) $(BUILD_HFILES) libtool-soversion
bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
@echo "creating $@"
@bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
$(AM_V_GEN)\
bfd_version=`echo "$(VERSION)" | $(SED) -e 's/\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\)\.*\([^\.]*\).*/\1.00\2.00\3.00\4.00\5/' -e 's/\([^\.]*\)\..*\(..\)\..*\(..\)\..*\(..\)\..*\(..\)$$/\1\2\3\4\5/'` ;\
bfd_version_string="\"$(VERSION)\"" ;\
bfd_soversion="$(VERSION)" ;\
bfd_version_package="\"$(PKGVERSION)\"" ;\
@@ -971,15 +993,17 @@ bfdver.h: $(srcdir)/version.h $(srcdir)/development.sh $(srcdir)/Makefile.in
# Disable -Werror, if it has been enabled, since coffswap.h won't
# compile with gcc 4.5 and above.
coff-tic4x.lo: coff-tic4x.c
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< $(NO_WERROR)
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< $(NO_WERROR)
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< $(NO_WERROR)
@am__fastdepCC_FALSE@ $(AM_V_CC)$(LTCOMPILE) -c -o $@ $< $(NO_WERROR)
coff-tic54x.lo: coff-tic54x.c
@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< $(NO_WERROR)
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< $(NO_WERROR)
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< $(NO_WERROR)
@am__fastdepCC_FALSE@ $(AM_V_CC)$(LTCOMPILE) -c -o $@ $< $(NO_WERROR)
include doc/local.mk
+632 -209
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -82,7 +82,7 @@ TARGETNAME
The name of the target, for run-time lookups.
Usually "a.out-<target>"
Copyright (C) 2012-2018 Free Software Foundation, Inc.
Copyright (C) 2012-2022 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
+2 -2
View File
@@ -34,7 +34,7 @@ BFD supports the following configure options:
Use mmap when accessing files. This is faster on some hosts,
but slower on others. It may not work on all hosts.
Report bugs with BFD to bug-binutils@gnu.org.
Report bugs in BFD to https://sourceware.org/bugzilla/
Patches are encouraged. When sending patches, always send the output
of diff -u or diff -c from the original file to the new file. Do not
@@ -48,7 +48,7 @@ gcc manual.
Bug reports without patches will be remembered, but they may never get
fixed until somebody volunteers to fix them.
Copyright (C) 2012-2018 Free Software Foundation, Inc.
Copyright (C) 2012-2022 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
+1 -1
View File
@@ -20,7 +20,7 @@ Things that still need to be done: -*- Text -*-
o - upgrade the reloc handling as per Steve's suggestion.
Copyright (C) 2012-2018 Free Software Foundation, Inc.
Copyright (C) 2012-2022 Free Software Foundation, Inc.
Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
+1 -1
View File
@@ -1,5 +1,5 @@
dnl
dnl Copyright (C) 2012-2018 Free Software Foundation, Inc.
dnl Copyright (C) 2012-2022 Free Software Foundation, Inc.
dnl
dnl This file is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
+2 -1
View File
@@ -1168,8 +1168,10 @@ AC_SUBST([am__untar])
]) # _AM_PROG_TAR
m4_include([../config/acx.m4])
m4_include([../config/bfd64.m4])
m4_include([../config/depstand.m4])
m4_include([../config/gettext-sister.m4])
m4_include([../config/jobserver.m4])
m4_include([../config/largefile.m4])
m4_include([../config/lead-dot.m4])
m4_include([../config/nls.m4])
@@ -1177,7 +1179,6 @@ m4_include([../config/override.m4])
m4_include([../config/plugins.m4])
m4_include([../config/po.m4])
m4_include([../config/progtest.m4])
m4_include([../config/stdint.m4])
m4_include([../config/zlib.m4])
m4_include([../libtool.m4])
m4_include([../ltoptions.m4])
+8 -7
View File
@@ -1,7 +1,7 @@
/* BFD back-end for AIX on PS/2 core files.
This was based on trad-core.c, which was written by John Gilmore of
Cygnus Support.
Copyright (C) 1988-2018 Free Software Foundation, Inc.
Copyright (C) 1988-2022 Free Software Foundation, Inc.
Written by Minh Tran-Le <TRANLE@INTELLICORP.COM>.
Converted to back end form by Ian Lance Taylor <ian@cygnus.com>.
@@ -65,13 +65,13 @@ struct trad_core_struct
asection *sections[MAX_CORE_SEGS];
};
static const bfd_target *
static bfd_cleanup
aix386_core_file_p (bfd *abfd)
{
int i, n;
unsigned char longbuf[4]; /* Raw bytes of various header fields */
bfd_size_type core_size = sizeof (struct corehdr);
bfd_size_type amt;
size_t amt;
struct corehdr *core;
struct mergem
{
@@ -189,7 +189,7 @@ aix386_core_file_p (bfd *abfd)
n++;
}
return abfd->xvec;
return _bfd_no_cleanup;
}
static char *
@@ -220,9 +220,9 @@ swap_abort (void)
#define NO_GET ((bfd_vma (*) (const void *)) swap_abort)
#define NO_PUT ((void (*) (bfd_vma, void *)) swap_abort)
#define NO_GETS ((bfd_signed_vma (*) (const void *)) swap_abort)
#define NO_GET64 ((bfd_uint64_t (*) (const void *)) swap_abort)
#define NO_PUT64 ((void (*) (bfd_uint64_t, void *)) swap_abort)
#define NO_GETS64 ((bfd_int64_t (*) (const void *)) swap_abort)
#define NO_GET64 ((uint64_t (*) (const void *)) swap_abort)
#define NO_PUT64 ((void (*) (uint64_t, void *)) swap_abort)
#define NO_GETS64 ((int64_t (*) (const void *)) swap_abort)
const bfd_target core_aix386_vec =
{
@@ -239,6 +239,7 @@ const bfd_target core_aix386_vec =
' ', /* ar_pad_char */
16, /* ar_max_namelen */
0, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
NO_GET64, NO_GETS64, NO_PUT64,
NO_GET, NO_GETS, NO_PUT,
NO_GET, NO_GETS, NO_PUT, /* data */
+25 -26
View File
@@ -1,5 +1,5 @@
/* IBM RS/6000 "XCOFF" back-end for BFD.
Copyright (C) 2001-2018 Free Software Foundation, Inc.
Copyright (C) 2001-2022 Free Software Foundation, Inc.
Written by Tom Rix
Contributed by Red Hat Inc.
@@ -23,8 +23,8 @@
#include "sysdep.h"
#include "bfd.h"
const bfd_target *xcoff64_core_p (bfd *);
bfd_boolean xcoff64_core_file_matches_executable_p (bfd *, bfd *);
bfd_cleanup xcoff64_core_p (bfd *);
bool xcoff64_core_file_matches_executable_p (bfd *, bfd *);
char *xcoff64_core_file_failing_command (bfd *);
int xcoff64_core_file_failing_signal (bfd *);
@@ -48,7 +48,7 @@ int xcoff64_core_file_failing_signal (bfd *);
#define CHECK_FILE_OFFSET(s, v) \
((bfd_signed_vma)(v) < 0 || (bfd_signed_vma)(v) > (bfd_signed_vma)(s).st_size)
const bfd_target *
bfd_cleanup
xcoff64_core_p (bfd *abfd)
{
enum bfd_architecture arch;
@@ -60,7 +60,6 @@ xcoff64_core_p (bfd *abfd)
bfd_vma ld_offset;
bfd_size_type i;
struct vm_infox vminfo;
const bfd_target *return_value = NULL;
flagword flags;
/* Get the header. */
@@ -109,12 +108,12 @@ xcoff64_core_p (bfd *abfd)
{
bfd_set_error (bfd_error_file_truncated);
return return_value;
return NULL;
}
new_core_hdr = bfd_zalloc (abfd, sizeof (struct core_dumpxx));
if (NULL == new_core_hdr)
return return_value;
return NULL;
memcpy (new_core_hdr, &core, sizeof (struct core_dumpxx));
/* The core_hdr() macro is no longer used here because it would
@@ -126,7 +125,7 @@ xcoff64_core_p (bfd *abfd)
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec = bfd_make_section_anyway_with_flags (abfd, ".stack", flags);
if (NULL == sec)
return return_value;
return NULL;
sec->size = core.c_size;
sec->vma = core.c_stackorg;
@@ -136,7 +135,7 @@ xcoff64_core_p (bfd *abfd)
flags = SEC_HAS_CONTENTS | SEC_IN_MEMORY;
sec = bfd_make_section_anyway_with_flags (abfd, ".reg", flags);
if (NULL == sec)
return return_value;
return NULL;
sec->size = sizeof (struct __context64);
sec->vma = 0;
@@ -150,7 +149,7 @@ xcoff64_core_p (bfd *abfd)
flags = SEC_HAS_CONTENTS;
sec = bfd_make_section_anyway_with_flags (abfd, ".ldinfo", flags);
if (NULL == sec)
return return_value;
return NULL;
sec->size = core.c_lsize;
sec->vma = 0;
@@ -164,7 +163,7 @@ xcoff64_core_p (bfd *abfd)
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec = bfd_make_section_anyway_with_flags (abfd, ".data", flags);
if (NULL == sec)
return return_value;
return NULL;
sec->size = core.c_datasize;
sec->vma = core.c_dataorg;
@@ -176,18 +175,18 @@ xcoff64_core_p (bfd *abfd)
while (1)
{
if (bfd_seek (abfd, ld_offset, SEEK_SET) != 0)
return return_value;
return NULL;
if (sizeof (struct __ld_info64) !=
bfd_bread (&ldinfo, sizeof (struct __ld_info64), abfd))
return return_value;
return NULL;
if (ldinfo.ldinfo_core)
{
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec = bfd_make_section_anyway_with_flags (abfd, ".data", flags);
if (NULL == sec)
return return_value;
return NULL;
sec->size = ldinfo.ldinfo_datasize;
sec->vma = ldinfo.ldinfo_dataorg;
@@ -203,19 +202,19 @@ xcoff64_core_p (bfd *abfd)
if (core.c_vmregions)
{
if (bfd_seek (abfd, core.c_vmm, SEEK_SET) != 0)
return return_value;
return NULL;
for (i = 0; i < core.c_vmregions; i++)
if (sizeof (struct vm_infox) !=
bfd_bread (&vminfo, sizeof (struct vm_infox), abfd))
return return_value;
return NULL;
if (vminfo.vminfo_offset)
{
flags = SEC_ALLOC | SEC_LOAD | SEC_HAS_CONTENTS;
sec = bfd_make_section_anyway_with_flags (abfd, ".vmdata", flags);
if (NULL == sec)
return return_value;
return NULL;
sec->size = vminfo.vminfo_size;
sec->vma = vminfo.vminfo_addr;
@@ -228,25 +227,25 @@ xcoff64_core_p (bfd *abfd)
mach = DEFAULT_MACHINE;
bfd_default_set_arch_mach (abfd, arch, mach);
return_value = (bfd_target *) abfd->xvec; /* This is garbage for now. */
return _bfd_no_cleanup;
xcoff64_core_p_error:
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_wrong_format);
return return_value;
return NULL;
}
/* Return `TRUE' if given core is from the given executable. */
bfd_boolean
bool
xcoff64_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
{
struct core_dumpxx core;
char *path, *s;
size_t alloc;
const char *str1, *str2;
bfd_boolean return_value = FALSE;
bool return_value = false;
/* Get the header. */
if (bfd_seek (core_bfd, 0, SEEK_SET) != 0)
@@ -289,14 +288,14 @@ xcoff64_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
}
str1 = strrchr (path, '/');
str2 = strrchr (exec_bfd->filename, '/');
str2 = strrchr (bfd_get_filename (exec_bfd), '/');
/* Step over character '/'. */
str1 = str1 != NULL ? str1 + 1 : path;
str2 = str2 != NULL ? str2 + 1 : exec_bfd->filename;
str2 = str2 != NULL ? str2 + 1 : bfd_get_filename (exec_bfd);
if (strcmp (str1, str2) == 0)
return_value = TRUE;
return_value = true;
xcoff64_core_file_matches_executable_p_end_1:
free (path);
@@ -329,14 +328,14 @@ xcoff64_core_file_failing_signal (bfd *abfd)
#else /* AIX_5_CORE */
const bfd_target *
bfd_cleanup
xcoff64_core_p (bfd *abfd ATTRIBUTE_UNUSED)
{
bfd_set_error (bfd_error_wrong_format);
return 0;
}
bfd_boolean
bool
xcoff64_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
{
return generic_core_file_matches_executable_p (core_bfd, exec_bfd);
+17 -19
View File
@@ -1,5 +1,5 @@
/* BFD backend for CRIS a.out binaries.
Copyright (C) 2000-2018 Free Software Foundation, Inc.
Copyright (C) 2000-2022 Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hans-Peter Nilsson.
@@ -56,9 +56,6 @@
#define TARGET_PAGE_SIZE SEGMENT_SIZE
#define TARGETNAME "a.out-cris"
/* The definition here seems not used; just provided as a convention. */
#define DEFAULT_ARCH bfd_arch_cris
/* Do not "beautify" the CONCAT* macro args. Traditional C will not
remove whitespace added here, and thus will fail to concatenate
the tokens. */
@@ -72,7 +69,7 @@
#define MY_exec_hdr_flags 1
#define MY_write_object_contents MY (write_object_contents)
static bfd_boolean MY (write_object_contents) (bfd *);
static bool MY (write_object_contents) (bfd *);
/* Forward this, so we can use a pointer to it in PARAMS. */
struct reloc_ext_external;
@@ -85,16 +82,15 @@ static void MY (swap_ext_reloc_in) (bfd *, struct reloc_ext_external *,
arelent *, asymbol **, bfd_size_type);
#define MY_set_sizes MY (set_sizes)
static bfd_boolean MY (set_sizes) (bfd *);
static bool MY (set_sizes) (bfd *);
/* To set back reloc_size to ext, we make MY (set_sizes) be called
through this construct. Note that MY_set_arch_mach is only called
through SET_ARCH_MACH. The default bfd_default_set_arch_mach will
not call set_sizes. */
#define MY_set_arch_mach NAME (aout, set_arch_mach)
#define SET_ARCH_MACH(BFD, EXECP) \
MY_set_arch_mach (BFD, DEFAULT_ARCH, N_MACHTYPE (EXECP))
bfd_set_arch_mach (BFD, bfd_arch_cris, N_MACHTYPE (EXECP))
/* These macros describe the binary layout of the reloc information we
use in a file. */
@@ -114,7 +110,7 @@ static bfd_boolean MY (set_sizes) (bfd *);
/* We need our own version to set header flags. */
static bfd_boolean
static bool
MY (write_object_contents) (bfd *abfd)
{
struct external_exec exec_bytes;
@@ -135,7 +131,7 @@ MY (write_object_contents) (bfd *abfd)
WRITE_HEADERS (abfd, execp);
return TRUE;
return true;
}
/* We need our own for these reasons:
@@ -169,14 +165,14 @@ MY (swap_ext_reloc_out) (bfd *abfd,
from the abs section, or as a symbol which has an abs value.
check for that here. */
if (bfd_is_abs_section (bfd_get_section (sym)))
if (bfd_is_abs_section (bfd_asymbol_section (sym)))
{
r_extern = 0;
r_index = N_ABS;
}
else if ((sym->flags & BSF_SECTION_SYM) == 0)
{
if (bfd_is_und_section (bfd_get_section (sym))
if (bfd_is_und_section (bfd_asymbol_section (sym))
/* Remember to check for weak symbols; they count as global. */
|| (sym->flags & (BSF_GLOBAL | BSF_WEAK)) != 0)
r_extern = 1;
@@ -231,12 +227,14 @@ MY (swap_ext_reloc_in) (bfd *abfd,
cache_ptr->address = (GET_SWORD (abfd, bytes->r_address));
/* Now the fun stuff. */
r_index = (bytes->r_index[2] << 16)
| (bytes->r_index[1] << 8)
| bytes->r_index[0];
r_index = (((unsigned int) bytes->r_index[2] << 16)
| ((unsigned int) bytes->r_index[1] << 8)
| bytes->r_index[0]);
r_extern = (0 != (bytes->r_type[0] & RELOC_EXT_BITS_EXTERN_LITTLE));
r_type = ((bytes->r_type[0]) >> RELOC_EXT_BITS_TYPE_SH_LITTLE)
& RELOC_EXT_BITS_TYPE_LITTLE;
r_type = ((bytes->r_type[0] & RELOC_EXT_BITS_TYPE_LITTLE)
>> RELOC_EXT_BITS_TYPE_SH_LITTLE);
if (r_type > 2)
{
@@ -271,7 +269,7 @@ MY (swap_ext_reloc_in) (bfd *abfd,
"obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;", to avoid changing
NAME (aout, set_arch_mach) in aoutx. */
static bfd_boolean
static bool
MY (set_sizes) (bfd *abfd)
{
/* Just as the default in aout-target.h (with some #ifdefs folded)... */
@@ -288,5 +286,5 @@ MY (set_sizes) (bfd *abfd)
obj_reloc_entry_size (abfd) = RELOC_EXT_SIZE;
return TRUE;
return true;
}
+45 -42
View File
@@ -1,5 +1,5 @@
/* BFD back-end for ns32k a.out-ish binaries.
Copyright (C) 1990-2018 Free Software Foundation, Inc.
Copyright (C) 1990-2022 Free Software Foundation, Inc.
Contributed by Ian Dall (idall@eleceng.adelaide.edu.au).
This file is part of BFD, the Binary File Descriptor library.
@@ -21,6 +21,7 @@
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
#include "aout/aout64.h"
#include "ns32k.h"
@@ -31,7 +32,7 @@
reloc_howto_type * MYNS (bfd_reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
reloc_howto_type * MYNS (bfd_reloc_name_lookup) (bfd *, const char *);
bfd_boolean MYNS (write_object_contents) (bfd *);
bool MYNS (write_object_contents) (bfd *);
/* Avoid multiple definitions from aoutx if supporting
standard a.out format(s) as well as this one. */
@@ -79,58 +80,58 @@ void bfd_ns32k_arch (void);
reloc_howto_type MY (howto_table)[] =
{
/* ns32k immediate operands. */
HOWTO (BFD_RELOC_NS32K_IMM_8, 0, 0, 8, FALSE, 0, complain_overflow_signed,
HOWTO (BFD_RELOC_NS32K_IMM_8, 0, 1, 8, false, 0, complain_overflow_signed,
_bfd_ns32k_reloc_imm, "NS32K_IMM_8",
TRUE, 0x000000ff,0x000000ff, FALSE),
HOWTO (BFD_RELOC_NS32K_IMM_16, 0, 1, 16, FALSE, 0, complain_overflow_signed,
true, 0x000000ff,0x000000ff, false),
HOWTO (BFD_RELOC_NS32K_IMM_16, 0, 2, 16, false, 0, complain_overflow_signed,
_bfd_ns32k_reloc_imm, "NS32K_IMM_16",
TRUE, 0x0000ffff,0x0000ffff, FALSE),
HOWTO (BFD_RELOC_NS32K_IMM_32, 0, 2, 32, FALSE, 0, complain_overflow_signed,
true, 0x0000ffff,0x0000ffff, false),
HOWTO (BFD_RELOC_NS32K_IMM_32, 0, 4, 32, false, 0, complain_overflow_signed,
_bfd_ns32k_reloc_imm, "NS32K_IMM_32",
TRUE, 0xffffffff,0xffffffff, FALSE),
HOWTO (BFD_RELOC_NS32K_IMM_8_PCREL, 0, 0, 8, TRUE, 0, complain_overflow_signed,
true, 0xffffffff,0xffffffff, false),
HOWTO (BFD_RELOC_NS32K_IMM_8_PCREL, 0, 1, 8, true, 0, complain_overflow_signed,
_bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_8",
TRUE, 0x000000ff, 0x000000ff, FALSE),
HOWTO (BFD_RELOC_NS32K_IMM_16_PCREL, 0, 1, 16, TRUE, 0, complain_overflow_signed,
true, 0x000000ff, 0x000000ff, false),
HOWTO (BFD_RELOC_NS32K_IMM_16_PCREL, 0, 2, 16, true, 0, complain_overflow_signed,
_bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_16",
TRUE, 0x0000ffff,0x0000ffff, FALSE),
HOWTO (BFD_RELOC_NS32K_IMM_32_PCREL, 0, 2, 32, TRUE, 0, complain_overflow_signed,
true, 0x0000ffff,0x0000ffff, false),
HOWTO (BFD_RELOC_NS32K_IMM_32_PCREL, 0, 4, 32, true, 0, complain_overflow_signed,
_bfd_ns32k_reloc_imm, "PCREL_NS32K_IMM_32",
TRUE, 0xffffffff,0xffffffff, FALSE),
true, 0xffffffff,0xffffffff, false),
/* ns32k displacements. */
HOWTO (BFD_RELOC_NS32K_DISP_8, 0, 0, 7, FALSE, 0, complain_overflow_signed,
HOWTO (BFD_RELOC_NS32K_DISP_8, 0, 1, 7, false, 0, complain_overflow_signed,
_bfd_ns32k_reloc_disp, "NS32K_DISP_8",
TRUE, 0x000000ff,0x000000ff, FALSE),
HOWTO (BFD_RELOC_NS32K_DISP_16, 0, 1, 14, FALSE, 0, complain_overflow_signed,
true, 0x000000ff,0x000000ff, false),
HOWTO (BFD_RELOC_NS32K_DISP_16, 0, 2, 14, false, 0, complain_overflow_signed,
_bfd_ns32k_reloc_disp, "NS32K_DISP_16",
TRUE, 0x0000ffff, 0x0000ffff, FALSE),
HOWTO (BFD_RELOC_NS32K_DISP_32, 0, 2, 30, FALSE, 0, complain_overflow_signed,
true, 0x0000ffff, 0x0000ffff, false),
HOWTO (BFD_RELOC_NS32K_DISP_32, 0, 4, 30, false, 0, complain_overflow_signed,
_bfd_ns32k_reloc_disp, "NS32K_DISP_32",
TRUE, 0xffffffff, 0xffffffff, FALSE),
HOWTO (BFD_RELOC_NS32K_DISP_8_PCREL, 0, 0, 7, TRUE, 0, complain_overflow_signed,
true, 0xffffffff, 0xffffffff, false),
HOWTO (BFD_RELOC_NS32K_DISP_8_PCREL, 0, 1, 7, true, 0, complain_overflow_signed,
_bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_8",
TRUE, 0x000000ff,0x000000ff, FALSE),
HOWTO (BFD_RELOC_NS32K_DISP_16_PCREL, 0, 1, 14, TRUE, 0, complain_overflow_signed,
true, 0x000000ff,0x000000ff, false),
HOWTO (BFD_RELOC_NS32K_DISP_16_PCREL, 0, 2, 14, true, 0, complain_overflow_signed,
_bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_16",
TRUE, 0x0000ffff,0x0000ffff, FALSE),
HOWTO (BFD_RELOC_NS32K_DISP_32_PCREL, 0, 2, 30, TRUE, 0, complain_overflow_signed,
true, 0x0000ffff,0x0000ffff, false),
HOWTO (BFD_RELOC_NS32K_DISP_32_PCREL, 0, 4, 30, true, 0, complain_overflow_signed,
_bfd_ns32k_reloc_disp, "PCREL_NS32K_DISP_32",
TRUE, 0xffffffff,0xffffffff, FALSE),
true, 0xffffffff,0xffffffff, false),
/* Normal 2's complement. */
HOWTO (BFD_RELOC_8, 0, 0, 8, FALSE, 0, complain_overflow_bitfield,0,
"8", TRUE, 0x000000ff,0x000000ff, FALSE),
HOWTO (BFD_RELOC_16, 0, 1, 16, FALSE, 0, complain_overflow_bitfield,0,
"16", TRUE, 0x0000ffff,0x0000ffff, FALSE),
HOWTO (BFD_RELOC_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield,0,
"32", TRUE, 0xffffffff,0xffffffff, FALSE),
HOWTO (BFD_RELOC_8_PCREL, 0, 0, 8, TRUE, 0, complain_overflow_signed, 0,
"PCREL_8", TRUE, 0x000000ff,0x000000ff, FALSE),
HOWTO (BFD_RELOC_16_PCREL, 0, 1, 16, TRUE, 0, complain_overflow_signed, 0,
"PCREL_16", TRUE, 0x0000ffff,0x0000ffff, FALSE),
HOWTO (BFD_RELOC_32_PCREL, 0, 2, 32, TRUE, 0, complain_overflow_signed, 0,
"PCREL_32", TRUE, 0xffffffff,0xffffffff, FALSE),
HOWTO (BFD_RELOC_8, 0, 1, 8, false, 0, complain_overflow_bitfield,0,
"8", true, 0x000000ff,0x000000ff, false),
HOWTO (BFD_RELOC_16, 0, 2, 16, false, 0, complain_overflow_bitfield,0,
"16", true, 0x0000ffff,0x0000ffff, false),
HOWTO (BFD_RELOC_32, 0, 4, 32, false, 0, complain_overflow_bitfield,0,
"32", true, 0xffffffff,0xffffffff, false),
HOWTO (BFD_RELOC_8_PCREL, 0, 1, 8, true, 0, complain_overflow_signed, 0,
"PCREL_8", true, 0x000000ff,0x000000ff, false),
HOWTO (BFD_RELOC_16_PCREL, 0, 2, 16, true, 0, complain_overflow_signed, 0,
"PCREL_16", true, 0x0000ffff,0x0000ffff, false),
HOWTO (BFD_RELOC_32_PCREL, 0, 4, 32, true, 0, complain_overflow_signed, 0,
"PCREL_32", true, 0xffffffff,0xffffffff, false),
};
#define CTOR_TABLE_RELOC_HOWTO(BFD) (MY (howto_table) + 14)
@@ -143,12 +144,12 @@ reloc_howto_type MY (howto_table)[] =
static reloc_howto_type *
MY (reloc_howto) (bfd *abfd ATTRIBUTE_UNUSED,
struct reloc_std_external *rel,
int *r_index,
unsigned int *r_index,
int *r_extern,
int *r_pcrel)
{
unsigned int r_length;
int r_ns32k_type;
unsigned int r_ns32k_type;
*r_index = ((rel->r_index[2] << 16)
| (rel->r_index[1] << 8)
@@ -159,6 +160,8 @@ MY (reloc_howto) (bfd *abfd ATTRIBUTE_UNUSED,
>> RELOC_STD_BITS_LENGTH_SH_LITTLE);
r_ns32k_type = ((rel->r_type[0] & RELOC_STD_BITS_NS32K_TYPE_LITTLE)
>> RELOC_STD_BITS_NS32K_TYPE_SH_LITTLE);
if (r_length > 2 || r_ns32k_type > 2)
return NULL;
return (MY (howto_table) + r_length + 3 * (*r_pcrel) + 6 * r_ns32k_type);
}
@@ -178,7 +181,7 @@ MY (put_reloc) (bfd *abfd,
int r_ns32k_type;
PUT_WORD (abfd, value, reloc->r_address);
r_length = howto->size ; /* Size as a power of two. */
r_length = bfd_log2 (bfd_get_reloc_size (howto));
r_pcrel = (int) howto->pc_relative; /* Relative to PC? */
r_ns32k_type = (howto - MY (howto_table) )/6;
@@ -271,7 +274,7 @@ MY_swap_std_reloc_in (bfd *abfd,
asymbol **symbols,
bfd_size_type symcount ATTRIBUTE_UNUSED)
{
int r_index;
unsigned int r_index;
int r_extern;
int r_pcrel;
struct aoutdata *su = &(abfd->tdata.aout_data->a);
+24 -19
View File
@@ -1,5 +1,5 @@
/* Define a target vector and some small routines for a variant of a.out.
Copyright (C) 1990-2018 Free Software Foundation, Inc.
Copyright (C) 1990-2022 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -34,7 +34,7 @@ extern reloc_howto_type * NAME (aout, reloc_name_lookup) (bfd *, const char *);
This routine is called from some_aout_object_p just before it returns. */
#ifndef MY_callback
static const bfd_target *
static bfd_cleanup
MY (callback) (bfd *abfd)
{
struct internal_exec *execp = exec_hdr (abfd);
@@ -121,20 +121,20 @@ MY (callback) (bfd *abfd)
/* Don't set sizes now -- can't be sure until we know arch & mach.
Sizes get set in set_sizes callback, later. */
return abfd->xvec;
return _bfd_no_cleanup;
}
#endif
#ifndef MY_object_p
/* Finish up the reading of an a.out file header. */
static const bfd_target *
static bfd_cleanup
MY (object_p) (bfd *abfd)
{
struct external_exec exec_bytes; /* Raw exec header from file. */
struct internal_exec exec; /* Cleaned-up exec header. */
const bfd_target *target;
bfd_size_type amt = EXEC_BYTES_SIZE;
bfd_cleanup cleanup;
size_t amt = EXEC_BYTES_SIZE;
if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt)
{
@@ -164,7 +164,7 @@ MY (object_p) (bfd *abfd)
exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
#endif
target = NAME (aout, some_aout_object_p) (abfd, &exec, MY (callback));
cleanup = NAME (aout, some_aout_object_p) (abfd, &exec, MY (callback));
#ifdef ENTRY_CAN_BE_ZERO
/* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
@@ -180,19 +180,20 @@ MY (object_p) (bfd *abfd)
#ifndef S_IXUSR
#define S_IXUSR 0100 /* Execute by owner. */
#endif
if (stat(abfd->filename, &buf) == 0 && (buf.st_mode & S_IXUSR))
if (stat (bfd_get_filename (abfd), &buf) == 0
&& (buf.st_mode & S_IXUSR) != 0)
abfd->flags |= EXEC_P;
}
#endif /* ENTRY_CAN_BE_ZERO */
return target;
return cleanup;
}
#define MY_object_p MY (object_p)
#endif
#ifndef MY_mkobject
static bfd_boolean
static bool
MY (mkobject) (bfd *abfd)
{
return NAME (aout, mkobject (abfd));
@@ -209,7 +210,7 @@ MY (mkobject) (bfd *abfd)
section contents, and copy_private_bfd_data is not called until
after the section contents have been set. */
static bfd_boolean
static bool
MY_bfd_copy_private_section_data (bfd *ibfd,
asection *isec ATTRIBUTE_UNUSED,
bfd *obfd,
@@ -218,7 +219,7 @@ MY_bfd_copy_private_section_data (bfd *ibfd,
if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour
&& bfd_get_flavour (obfd) == bfd_target_aout_flavour)
obj_aout_subformat (obfd) = obj_aout_subformat (ibfd);
return TRUE;
return true;
}
#endif
@@ -229,7 +230,7 @@ MY_bfd_copy_private_section_data (bfd *ibfd,
#ifndef MY_write_object_contents
static bfd_boolean
static bool
MY (write_object_contents) (bfd *abfd)
{
struct external_exec exec_bytes;
@@ -239,14 +240,14 @@ MY (write_object_contents) (bfd *abfd)
WRITE_HEADERS (abfd, execp);
return TRUE;
return true;
}
#define MY_write_object_contents MY (write_object_contents)
#endif
#ifndef MY_set_sizes
static bfd_boolean
static bool
MY (set_sizes) (bfd *abfd)
{
adata(abfd).page_size = TARGET_PAGE_SIZE;
@@ -259,7 +260,7 @@ MY (set_sizes) (bfd *abfd)
#endif
adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
return TRUE;
return true;
}
#define MY_set_sizes MY (set_sizes)
#endif
@@ -344,7 +345,7 @@ MY_final_link_callback (bfd *abfd,
/* Final link routine. We need to use a call back to get the correct
offsets in the output file. */
static bfd_boolean
static bool
MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
{
return NAME (aout, final_link) (abfd, info, MY_final_link_callback);
@@ -502,6 +503,9 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
#ifndef MY_bfd_is_group_section
#define MY_bfd_is_group_section bfd_generic_is_group_section
#endif
#ifndef MY_bfd_group_name
#define MY_bfd_group_name bfd_generic_group_name
#endif
#ifndef MY_bfd_discard_group
#define MY_bfd_discard_group bfd_generic_discard_group
#endif
@@ -594,11 +598,11 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
/* Handle closing of a BFD including the resource-releasing parts. */
static bfd_boolean
static bool
MY_close_and_cleanup (bfd *abfd)
{
if (!MY_bfd_free_cached_info (abfd))
return FALSE;
return false;
return _bfd_generic_close_and_cleanup (abfd);
}
@@ -656,6 +660,7 @@ const bfd_target MY (vec) =
AR_PAD_CHAR, /* AR_pad_char. */
15, /* AR_max_namelen. */
0, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
#ifdef TARGET_IS_BIG_ENDIAN_P
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,5 +1,5 @@
/* BFD back-end for 32-bit a.out files.
Copyright (C) 1990-2018 Free Software Foundation, Inc.
Copyright (C) 1990-2022 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
+1 -9
View File
@@ -1,5 +1,5 @@
/* BFD back-end for 64-bit a.out files.
Copyright (C) 1990-2018 Free Software Foundation, Inc.
Copyright (C) 1990-2022 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -21,12 +21,4 @@
#define ARCH_SIZE 64
/* aoutx.h requires definitions for BMAGIC and QMAGIC. */
#ifndef BMAGIC
#define BMAGIC 0
#endif
#ifndef QMAGIC
#define QMAGIC 0
#endif
#include "aoutx.h"
+515 -540
View File
File diff suppressed because it is too large Load Diff
+121 -87
View File
@@ -1,5 +1,5 @@
/* ARC-specific support for 32-bit ELF
Copyright (C) 1994-2018 Free Software Foundation, Inc.
Copyright (C) 1994-2022 Free Software Foundation, Inc.
Contributed by Cupertino Miranda (cmiranda@synopsys.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -24,6 +24,9 @@
#define TCB_SIZE (8)
#define align_power(addr, align) \
(((addr) + ((bfd_vma) 1 << (align)) - 1) & (-((bfd_vma) 1 << (align))))
enum tls_type_e
{
GOT_UNKNOWN = 0,
@@ -46,32 +49,31 @@ struct got_entry
struct got_entry *next;
enum tls_type_e type;
bfd_vma offset;
bfd_boolean processed;
bfd_boolean created_dyn_relocation;
bool processed;
bool created_dyn_relocation;
enum tls_got_entries existing_entries;
};
/* Return the local got list, if not defined, create an empty one. */
static struct got_entry **
arc_get_local_got_ents (bfd * abfd)
{
static struct got_entry **local_got_ents = NULL;
if (local_got_ents == NULL)
if (elf_local_got_ents (abfd) == NULL)
{
size_t size;
Elf_Internal_Shdr *symtab_hdr = &((elf_tdata (abfd))->symtab_hdr);
size = symtab_hdr->sh_info * sizeof (bfd_vma);
local_got_ents = (struct got_entry **)
bfd_alloc (abfd, sizeof (struct got_entry *) * size);
if (local_got_ents == NULL)
return FALSE;
memset (local_got_ents, 0, sizeof (struct got_entry *) * size);
elf_local_got_ents (abfd) = local_got_ents;
bfd_size_type amt = (elf_tdata (abfd)->symtab_hdr.sh_info
* sizeof (*elf_local_got_ents (abfd)));
elf_local_got_ents (abfd) = bfd_zmalloc (amt);
if (elf_local_got_ents (abfd) == NULL)
{
_bfd_error_handler (_("%pB: cannot allocate memory for local "
"GOT entries"), abfd);
bfd_set_error (bfd_error_bad_value);
return NULL;
}
}
return local_got_ents;
return elf_local_got_ents (abfd);
}
static struct got_entry *
@@ -112,8 +114,8 @@ new_got_entry_to_list (struct got_entry **list,
entry->type = type;
entry->offset = offset;
entry->next = NULL;
entry->processed = FALSE;
entry->created_dyn_relocation = FALSE;
entry->processed = false;
entry->created_dyn_relocation = false;
entry->existing_entries = existing_entries;
ARC_DEBUG ("New GOT got entry added to list: "
@@ -156,15 +158,15 @@ get_got_entry_list_for_symbol (bfd *abfd,
unsigned long r_symndx,
struct elf_link_hash_entry *h)
{
if (h != NULL)
struct elf_arc_link_hash_entry *h1 =
((struct elf_arc_link_hash_entry *) h);
if (h1 != NULL)
{
return &h->got.glist;
return &h1->got_ents;
}
else
{
struct got_entry **local_got_ents
= arc_get_local_got_ents (abfd);
return &local_got_ents[r_symndx];
return arc_get_local_got_ents (abfd) + r_symndx;
}
}
@@ -206,13 +208,13 @@ arc_got_entry_type_for_reloc (reloc_howto_type *howto)
__LINE__, name_for_global_symbol (H)); \
} \
if (H) \
if (h->dynindx == -1 && !h->forced_local) \
if (H->dynindx == -1 && !H->forced_local) \
if (! bfd_elf_link_record_dynamic_symbol (info, H)) \
return FALSE; \
return false; \
htab->s##SECNAME->size += 4; \
} \
static bfd_boolean
static bool
arc_fill_got_info_for_reloc (enum tls_type_e type,
struct got_entry **list,
struct bfd_link_info * info,
@@ -221,7 +223,7 @@ arc_fill_got_info_for_reloc (enum tls_type_e type,
struct elf_link_hash_table *htab = elf_hash_table (info);
if (got_entry_for_type (list, type) != NULL)
return TRUE;
return true;
switch (type)
{
@@ -238,9 +240,9 @@ arc_fill_got_info_for_reloc (enum tls_type_e type,
case GOT_TLS_GD:
{
bfd_vma offset
= ADD_SYMBOL_REF_SEC_AND_RELOC (got, TRUE, h);
= ADD_SYMBOL_REF_SEC_AND_RELOC (got, true, h);
bfd_vma ATTRIBUTE_UNUSED notneeded
= ADD_SYMBOL_REF_SEC_AND_RELOC (got, TRUE, h);
= ADD_SYMBOL_REF_SEC_AND_RELOC (got, true, h);
new_got_entry_to_list (list, type, offset, TLS_GOT_MOD_AND_OFF);
}
break;
@@ -248,18 +250,60 @@ arc_fill_got_info_for_reloc (enum tls_type_e type,
case GOT_TLS_LE:
{
bfd_vma offset
= ADD_SYMBOL_REF_SEC_AND_RELOC (got, TRUE, h);
= ADD_SYMBOL_REF_SEC_AND_RELOC (got, true, h);
new_got_entry_to_list (list, type, offset, TLS_GOT_OFF);
}
break;
default:
return FALSE;
return false;
break;
}
return TRUE;
return true;
}
struct arc_static_sym_data {
bfd_vma sym_value;
const char *symbol_name;
};
static struct arc_static_sym_data
get_static_sym_data (unsigned long r_symndx,
Elf_Internal_Sym *local_syms,
asection **local_sections,
struct elf_link_hash_entry *h,
struct arc_relocation_data *reloc_data)
{
static const char local_name[] = "(local)";
struct arc_static_sym_data ret = { 0, NULL };
if (h != NULL)
{
BFD_ASSERT (h->root.type != bfd_link_hash_undefweak
&& h->root.type != bfd_link_hash_undefined);
/* TODO: This should not be here. */
reloc_data->sym_value = h->root.u.def.value;
reloc_data->sym_section = h->root.u.def.section;
ret.sym_value = h->root.u.def.value
+ h->root.u.def.section->output_section->vma
+ h->root.u.def.section->output_offset;
ret.symbol_name = h->root.root.string;
}
else
{
Elf_Internal_Sym *sym = local_syms + r_symndx;
asection *sec = local_sections[r_symndx];
ret.sym_value = sym->st_value
+ sec->output_section->vma
+ sec->output_offset;
ret.symbol_name = local_name;
}
return ret;
}
static bfd_vma
relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
@@ -282,43 +326,13 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
BFD_ASSERT (entry);
if (h == NULL
|| h->forced_local == true
|| (! elf_hash_table (info)->dynamic_sections_created
|| (bfd_link_pic (info)
&& SYMBOL_REFERENCES_LOCAL (info, h))))
{
const char ATTRIBUTE_UNUSED *symbol_name;
static const char local_name[] = "(local)";
asection *tls_sec = NULL;
bfd_vma sym_value = 0;
if (h != NULL)
{
// TODO: This should not be here.
reloc_data->sym_value = h->root.u.def.value;
reloc_data->sym_section = h->root.u.def.section;
sym_value = h->root.u.def.value
+ h->root.u.def.section->output_section->vma
+ h->root.u.def.section->output_offset;
tls_sec = elf_hash_table (info)->tls_sec;
symbol_name = h->root.root.string;
}
else
{
Elf_Internal_Sym *sym = local_syms + r_symndx;
asection *sec = local_sections[r_symndx];
sym_value = sym->st_value
+ sec->output_section->vma
+ sec->output_offset;
tls_sec = elf_hash_table (info)->tls_sec;
symbol_name = local_name;
}
asection *tls_sec = elf_hash_table (info)->tls_sec;
if (entry && !entry->processed)
{
@@ -329,23 +343,35 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
BFD_ASSERT (tls_sec && tls_sec->output_section);
bfd_vma sec_vma = tls_sec->output_section->vma;
bfd_put_32 (output_bfd,
sym_value - sec_vma,
if (h == NULL || h->forced_local
|| !elf_hash_table (info)->dynamic_sections_created)
{
struct arc_static_sym_data tmp =
get_static_sym_data (r_symndx, local_syms, local_sections,
h, reloc_data);
bfd_put_32 (output_bfd,
tmp.sym_value - sec_vma
+ (elf_hash_table (info)->dynamic_sections_created
? 0
: (align_power (0,
tls_sec->alignment_power))),
htab->sgot->contents + entry->offset
+ (entry->existing_entries == TLS_GOT_MOD_AND_OFF
? 4 : 0));
ARC_DEBUG ("arc_info: FIXED -> %s value = %#lx "
"@ %lx, for symbol %s\n",
(entry->type == GOT_TLS_GD ? "GOT_TLS_GD" :
"GOT_TLS_IE"),
(long) (sym_value - sec_vma),
(long) (htab->sgot->output_section->vma
+ htab->sgot->output_offset->vma
+ entry->offset
+ (entry->existing_entries == TLS_GOT_MOD_AND_OFF
? 4 : 0)),
symbol_name);
ARC_DEBUG ("arc_info: FIXED -> %s value = %#lx "
"@ %lx, for symbol %s\n",
(entry->type == GOT_TLS_GD ? "GOT_TLS_GD" :
"GOT_TLS_IE"),
(long) (sym_value - sec_vma),
(long) (htab->sgot->output_section->vma
+ htab->sgot->output_offset
+ entry->offset
+ (entry->existing_entries == TLS_GOT_MOD_AND_OFF
? 4 : 0)),
tmp.symbol_name);
}
}
break;
@@ -355,9 +381,16 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
bfd_vma ATTRIBUTE_UNUSED sec_vma
= tls_sec->output_section->vma;
struct arc_static_sym_data tmp =
get_static_sym_data (r_symndx, local_syms, local_sections,
h, reloc_data);
bfd_put_32 (output_bfd,
sym_value - sec_vma
+ (elf_hash_table (info)->dynamic_sections_created ? 0 : TCB_SIZE),
tmp.sym_value - sec_vma
+ (elf_hash_table (info)->dynamic_sections_created
? 0
: (align_power (TCB_SIZE,
tls_sec->alignment_power))),
htab->sgot->contents + entry->offset
+ (entry->existing_entries == TLS_GOT_MOD_AND_OFF
? 4 : 0));
@@ -368,11 +401,11 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
"GOT_TLS_IE"),
(long) (sym_value - sec_vma),
(long) (htab->sgot->output_section->vma
+ htab->sgot->output_offset->vma
+ htab->sgot->output_offset
+ entry->offset
+ (entry->existing_entries == TLS_GOT_MOD_AND_OFF
? 4 : 0)),
symbol_name);
tmp.symbol_name);
}
break;
@@ -401,7 +434,8 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
"@ %#08lx for sym %s in got offset %#lx\n",
(long) (reloc_data->sym_value + sec_vma),
(long) (htab->sgot->output_section->vma
+ htab->sgot->output_offset + entry->offset),
+ htab->sgot->output_offset
+ entry->offset),
symbol_name,
(long) entry->offset);
}
@@ -411,7 +445,7 @@ relocate_fix_got_relocs_for_got_info (struct got_entry ** list_p,
BFD_ASSERT (0);
break;
}
entry->processed = TRUE;
entry->processed = true;
}
}
@@ -446,7 +480,7 @@ create_got_dynrelocs_for_single_entry (struct got_entry *list,
{
ADD_RELA (output_bfd, got, got_offset, h->dynindx, R_ARC_GLOB_DAT, 0);
}
list->created_dyn_relocation = TRUE;
list->created_dyn_relocation = true;
}
else if (list->existing_entries != TLS_GOT_NONE
&& !list->created_dyn_relocation)
@@ -501,7 +535,7 @@ GOT_OFFSET = %#lx, GOT_VMA = %#lx, INDEX = %ld, ADDEND = %#lx\n",
+ htab->sgot->output_offset + got_offset),
(long) dynindx, (long) addend);
}
list->created_dyn_relocation = TRUE;
list->created_dyn_relocation = true;
}
}
+1 -1
View File
@@ -1,5 +1,5 @@
/* Arc V2 Related PLT entries.
Copyright (C) 2016-2018 Free Software Foundation, Inc.
Copyright (C) 2016-2022 Free Software Foundation, Inc.
Contributed by Cupertino Miranda (cmiranda@synopsys.com).
This file is part of BFD, the Binary File Descriptor library.
+2 -4
View File
@@ -1,5 +1,5 @@
/* ARC-specific header file for PLT support.
Copyright (C) 2016-2018 Free Software Foundation, Inc.
Copyright (C) 2016-2022 Free Software Foundation, Inc.
Contributed by Cupertino Miranda (cmiranda@synopsys.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -22,8 +22,6 @@
#ifndef ARC_PLT_H
#define ARC_PLT_H
#include <stdint.h>
/* Instructions appear in memory as a sequence of half-words (16 bit);
individual half-words are represented on the target in target byte order.
We use 'unsigned short' on the host to represent the PLT templates,
@@ -180,7 +178,7 @@ struct plt_version_t
#define PLT_ELEM(...)
#define ENTRY_RELOC(...)
#define ELEM_RELOC(...)
struct plt_version_t plt_versions[PLT_MAX] = {
const struct plt_version_t plt_versions[PLT_MAX] = {
#include "arc-plt.def"
+389 -322
View File
File diff suppressed because it is too large Load Diff
+50 -40
View File
@@ -1,5 +1,5 @@
/* Support for 64-bit archives.
Copyright (C) 1996-2018 Free Software Foundation, Inc.
Copyright (C) 1996-2022 Free Software Foundation, Inc.
Ian Lance Taylor, Cygnus Support
Linker support added by Mark Mitchell, CodeSourcery, LLC.
<mark@codesourcery.com>
@@ -34,7 +34,7 @@
/* Read an Irix 6 armap. */
bfd_boolean
bool
_bfd_archive_64_bit_slurp_armap (bfd *abfd)
{
struct artdata *ardata = bfd_ardata (abfd);
@@ -47,40 +47,48 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd)
bfd_byte *raw_armap = NULL;
carsym *carsyms;
bfd_size_type amt;
ufile_ptr filesize;
ardata->symdefs = NULL;
/* Get the name of the first element. */
i = bfd_bread (nextname, 16, abfd);
if (i == 0)
return TRUE;
return true;
if (i != 16)
return FALSE;
return false;
if (bfd_seek (abfd, (file_ptr) - 16, SEEK_CUR) != 0)
return FALSE;
return false;
/* Archives with traditional armaps are still permitted. */
if (CONST_STRNEQ (nextname, "/ "))
if (startswith (nextname, "/ "))
return bfd_slurp_armap (abfd);
if (! CONST_STRNEQ (nextname, "/SYM64/ "))
if (! startswith (nextname, "/SYM64/ "))
{
bfd_has_map (abfd) = FALSE;
return TRUE;
abfd->has_armap = false;
return true;
}
mapdata = (struct areltdata *) _bfd_read_ar_hdr (abfd);
if (mapdata == NULL)
return FALSE;
return false;
parsed_size = mapdata->parsed_size;
free (mapdata);
filesize = bfd_get_file_size (abfd);
if (filesize != 0 && parsed_size > filesize)
{
bfd_set_error (bfd_error_malformed_archive);
return false;
}
if (bfd_bread (int_buf, 8, abfd) != 8)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
return FALSE;
return false;
}
nsymz = bfd_getb64 (int_buf);
@@ -90,63 +98,65 @@ _bfd_archive_64_bit_slurp_armap (bfd *abfd)
ptrsize = 8 * nsymz;
amt = carsym_size + stringsize + 1;
if (carsym_size < nsymz || ptrsize < nsymz || amt < nsymz)
if (/* Catch overflow in stringsize (and ptrsize) expression. */
nsymz >= (bfd_size_type) -1 / 8
|| stringsize > parsed_size
/* Catch overflow in carsym_size expression. */
|| nsymz > (bfd_size_type) -1 / sizeof (carsym)
/* Catch overflow in amt expression. */
|| amt <= carsym_size
|| amt <= stringsize)
{
bfd_set_error (bfd_error_malformed_archive);
return FALSE;
return false;
}
ardata->symdefs = (struct carsym *) bfd_zalloc (abfd, amt);
ardata->symdefs = (struct carsym *) bfd_alloc (abfd, amt);
if (ardata->symdefs == NULL)
return FALSE;
return false;
carsyms = ardata->symdefs;
stringbase = ((char *) ardata->symdefs) + carsym_size;
stringbase[stringsize] = 0;
stringend = stringbase + stringsize;
raw_armap = (bfd_byte *) bfd_alloc (abfd, ptrsize);
if (raw_armap == NULL)
goto release_symdefs;
if (bfd_bread (raw_armap, ptrsize, abfd) != ptrsize
raw_armap = (bfd_byte *) _bfd_alloc_and_read (abfd, ptrsize, ptrsize);
if (raw_armap == NULL
|| bfd_bread (stringbase, stringsize, abfd) != stringsize)
{
if (bfd_get_error () != bfd_error_system_call)
bfd_set_error (bfd_error_malformed_archive);
goto release_raw_armap;
goto release_symdefs;
}
stringend = stringbase + stringsize;
*stringend = 0;
for (i = 0; i < nsymz; i++)
{
carsyms->file_offset = bfd_getb64 (raw_armap + i * 8);
carsyms->name = stringbase;
if (stringbase < stringend)
stringbase += strlen (stringbase) + 1;
stringbase += strlen (stringbase);
if (stringbase != stringend)
++stringbase;
++carsyms;
}
*stringbase = '\0';
ardata->symdef_count = nsymz;
ardata->first_file_filepos = bfd_tell (abfd);
/* Pad to an even boundary if you have to. */
ardata->first_file_filepos += (ardata->first_file_filepos) % 2;
bfd_has_map (abfd) = TRUE;
abfd->has_armap = true;
bfd_release (abfd, raw_armap);
return TRUE;
return true;
release_raw_armap:
bfd_release (abfd, raw_armap);
release_symdefs:
release_symdefs:
bfd_release (abfd, ardata->symdefs);
return FALSE;
return false;
}
/* Write out an Irix 6 armap. The Irix 6 tools are supposed to be
able to handle ordinary ELF armaps, but at least on Irix 6.2 the
linker crashes. */
bfd_boolean
bool
_bfd_archive_64_bit_write_armap (bfd *arch,
unsigned int elength,
struct orl *map,
@@ -175,7 +185,7 @@ _bfd_archive_64_bit_write_armap (bfd *arch,
memset (&hdr, ' ', sizeof (struct ar_hdr));
memcpy (hdr.ar_name, "/SYM64/", strlen ("/SYM64/"));
if (!_bfd_ar_sizepad (hdr.ar_size, sizeof (hdr.ar_size), mapsize))
return FALSE;
return false;
_bfd_ar_spacepad (hdr.ar_date, sizeof (hdr.ar_date), "%ld",
time (NULL));
/* This, at least, is what Intel coff sets the values to.: */
@@ -188,11 +198,11 @@ _bfd_archive_64_bit_write_armap (bfd *arch,
if (bfd_bwrite (&hdr, sizeof (struct ar_hdr), arch)
!= sizeof (struct ar_hdr))
return FALSE;
return false;
bfd_putb64 ((bfd_vma) symbol_count, buf);
if (bfd_bwrite (buf, 8, arch) != 8)
return FALSE;
return false;
/* Two passes, first write the file offsets for each symbol -
remembering that each offset is on a two byte boundary. */
@@ -213,7 +223,7 @@ _bfd_archive_64_bit_write_armap (bfd *arch,
{
bfd_putb64 ((bfd_vma) archive_member_file_ptr, buf);
if (bfd_bwrite (buf, 8, arch) != 8)
return FALSE;
return false;
}
/* Add size of this archive entry */
@@ -230,7 +240,7 @@ _bfd_archive_64_bit_write_armap (bfd *arch,
size_t len = strlen (*map[count].name) + 1;
if (bfd_bwrite (*map[count].name, len, arch) != len)
return FALSE;
return false;
}
/* The spec says that this should be padded to an 8 byte boundary.
@@ -238,9 +248,9 @@ _bfd_archive_64_bit_write_armap (bfd *arch,
while (padding != 0)
{
if (bfd_bwrite ("", 1, arch) != 1)
return FALSE;
return false;
--padding;
}
return TRUE;
return true;
}
+139 -79
View File
@@ -1,5 +1,5 @@
/* BFD library support routines for architectures.
Copyright (C) 1990-2018 Free Software Foundation, Inc.
Copyright (C) 1990-2022 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.
@@ -175,7 +175,9 @@ DESCRIPTION
.#define bfd_mach_mips5 5
.#define bfd_mach_mips_loongson_2e 3001
.#define bfd_mach_mips_loongson_2f 3002
.#define bfd_mach_mips_loongson_3a 3003
.#define bfd_mach_mips_gs464 3003
.#define bfd_mach_mips_gs464e 3004
.#define bfd_mach_mips_gs264e 3005
.#define bfd_mach_mips_sb1 12310201 {* octal 'SB', 01. *}
.#define bfd_mach_mips_octeon 6501
.#define bfd_mach_mips_octeonp 6601
@@ -203,16 +205,6 @@ DESCRIPTION
.#define bfd_mach_i386_i386_intel_syntax (bfd_mach_i386_i386 | bfd_mach_i386_intel_syntax)
.#define bfd_mach_x86_64_intel_syntax (bfd_mach_x86_64 | bfd_mach_i386_intel_syntax)
.#define bfd_mach_x64_32_intel_syntax (bfd_mach_x64_32 | bfd_mach_i386_intel_syntax)
. bfd_arch_l1om, {* Intel L1OM. *}
.#define bfd_mach_l1om (1 << 5)
.#define bfd_mach_l1om_intel_syntax (bfd_mach_l1om | bfd_mach_i386_intel_syntax)
. bfd_arch_k1om, {* Intel K1OM. *}
.#define bfd_mach_k1om (1 << 6)
.#define bfd_mach_k1om_intel_syntax (bfd_mach_k1om | bfd_mach_i386_intel_syntax)
.#define bfd_mach_i386_nacl (1 << 7)
.#define bfd_mach_i386_i386_nacl (bfd_mach_i386_i386 | bfd_mach_i386_nacl)
.#define bfd_mach_x86_64_nacl (bfd_mach_x86_64 | bfd_mach_i386_nacl)
.#define bfd_mach_x64_32_nacl (bfd_mach_x64_32 | bfd_mach_i386_nacl)
. bfd_arch_iamcu, {* Intel MCU. *}
.#define bfd_mach_iamcu (1 << 8)
.#define bfd_mach_i386_iamcu (bfd_mach_i386_i386 | bfd_mach_iamcu)
@@ -230,7 +222,6 @@ DESCRIPTION
.#define bfd_mach_h8300sx 6
.#define bfd_mach_h8300sxn 7
. bfd_arch_pdp11, {* DEC PDP-11. *}
. bfd_arch_plugin,
. bfd_arch_powerpc, {* PowerPC. *}
.#define bfd_mach_ppc 32
.#define bfd_mach_ppc64 64
@@ -326,6 +317,21 @@ DESCRIPTION
.#define bfd_mach_arm_ep9312 11
.#define bfd_mach_arm_iWMMXt 12
.#define bfd_mach_arm_iWMMXt2 13
.#define bfd_mach_arm_5TEJ 14
.#define bfd_mach_arm_6 15
.#define bfd_mach_arm_6KZ 16
.#define bfd_mach_arm_6T2 17
.#define bfd_mach_arm_6K 18
.#define bfd_mach_arm_7 19
.#define bfd_mach_arm_6M 20
.#define bfd_mach_arm_6SM 21
.#define bfd_mach_arm_7EM 22
.#define bfd_mach_arm_8 23
.#define bfd_mach_arm_8R 24
.#define bfd_mach_arm_8M_BASE 25
.#define bfd_mach_arm_8M_MAIN 26
.#define bfd_mach_arm_8_1M_MAIN 27
.#define bfd_mach_arm_9 28
. bfd_arch_nds32, {* Andes NDS32. *}
.#define bfd_mach_n1 1
.#define bfd_mach_n1h 2
@@ -339,7 +345,6 @@ DESCRIPTION
.#define bfd_mach_tic4x 40
. bfd_arch_tic54x, {* Texas Instruments TMS320C54X. *}
. bfd_arch_tic6x, {* Texas Instruments TMS320C6X. *}
. bfd_arch_tic80, {* TI TMS320c80 (MVP). *}
. bfd_arch_v850, {* NEC V850. *}
. bfd_arch_v850_rh850,{* NEC V850 (using RH850 ABI). *}
.#define bfd_mach_v850 1
@@ -399,6 +404,9 @@ DESCRIPTION
. bfd_arch_iq2000, {* Vitesse IQ2000. *}
.#define bfd_mach_iq2000 1
.#define bfd_mach_iq10 2
. bfd_arch_bpf, {* Linux eBPF. *}
.#define bfd_mach_bpf 1
.#define bfd_mach_xbpf 2
. bfd_arch_epiphany, {* Adapteva EPIPHANY. *}
.#define bfd_mach_epiphany16 1
.#define bfd_mach_epiphany32 2
@@ -430,8 +438,6 @@ DESCRIPTION
.#define bfd_mach_bfin 1
. bfd_arch_cr16, {* National Semiconductor CompactRISC (ie CR16). *}
.#define bfd_mach_cr16 1
. bfd_arch_cr16c, {* National Semiconductor CompactRISC. *}
.#define bfd_mach_cr16c 1
. bfd_arch_crx, {* National Semiconductor CRX. *}
.#define bfd_mach_crx 1
. bfd_arch_cris, {* Axis CRIS. *}
@@ -445,6 +451,8 @@ DESCRIPTION
.#define bfd_mach_rl78 0x75
. bfd_arch_rx, {* Renesas RX. *}
.#define bfd_mach_rx 0x75
.#define bfd_mach_rx_v2 0x76
.#define bfd_mach_rx_v3 0x77
. bfd_arch_s390, {* IBM s390. *}
.#define bfd_mach_s390_31 31
.#define bfd_mach_s390_64 64
@@ -479,19 +487,30 @@ DESCRIPTION
.#define bfd_mach_msp46 46
.#define bfd_mach_msp47 47
.#define bfd_mach_msp54 54
. bfd_arch_xc16x, {* Infineon's XC16X Series. *}
.#define bfd_mach_xc16x 1
.#define bfd_mach_xc16xl 2
.#define bfd_mach_xc16xs 3
. bfd_arch_xgate, {* Freescale XGATE. *}
.#define bfd_mach_xgate 1
. bfd_arch_xtensa, {* Tensilica's Xtensa cores. *}
.#define bfd_mach_xtensa 1
. bfd_arch_z80,
.#define bfd_mach_z80strict 1 {* No undocumented opcodes. *}
.#define bfd_mach_z80 3 {* With ixl, ixh, iyl, and iyh. *}
.#define bfd_mach_z80full 7 {* All undocumented instructions. *}
.#define bfd_mach_r800 11 {* R800: successor with multiplication. *}
.{* Zilog Z80 without undocumented opcodes. *}
.#define bfd_mach_z80strict 1
.{* Zilog Z180: successor with additional instructions, but without
. halves of ix and iy. *}
.#define bfd_mach_z180 2
.{* Zilog Z80 with ixl, ixh, iyl, and iyh. *}
.#define bfd_mach_z80 3
.{* Zilog eZ80 (successor of Z80 & Z180) in Z80 (16-bit address) mode. *}
.#define bfd_mach_ez80_z80 4
.{* Zilog eZ80 (successor of Z80 & Z180) in ADL (24-bit address) mode. *}
.#define bfd_mach_ez80_adl 5
.{* Z80N *}
.#define bfd_mach_z80n 6
.{* Zilog Z80 with all undocumented instructions. *}
.#define bfd_mach_z80full 7
.{* GameBoy Z80 (reduced instruction set). *}
.#define bfd_mach_gbz80 8
.{* ASCII R800: successor with multiplication. *}
.#define bfd_mach_r800 11
. bfd_arch_lm32, {* Lattice Mico32. *}
.#define bfd_mach_lm32 1
. bfd_arch_microblaze,{* Xilinx MicroBlaze. *}
@@ -502,6 +521,7 @@ DESCRIPTION
.#define bfd_mach_tilegx32 2
. bfd_arch_aarch64, {* AArch64. *}
.#define bfd_mach_aarch64 0
.#define bfd_mach_aarch64_8R 1
.#define bfd_mach_aarch64_ilp32 32
. bfd_arch_nios2, {* Nios II. *}
.#define bfd_mach_nios2 0
@@ -516,6 +536,32 @@ DESCRIPTION
. bfd_arch_nfp, {* Netronome Flow Processor *}
.#define bfd_mach_nfp3200 0x3200
.#define bfd_mach_nfp6000 0x6000
. bfd_arch_csky, {* C-SKY. *}
.#define bfd_mach_ck_unknown 0
.#define bfd_mach_ck510 1
.#define bfd_mach_ck610 2
.#define bfd_mach_ck801 3
.#define bfd_mach_ck802 4
.#define bfd_mach_ck803 5
.#define bfd_mach_ck807 6
.#define bfd_mach_ck810 7
.#define bfd_mach_ck860 8
. bfd_arch_loongarch, {* LoongArch *}
.#define bfd_mach_loongarch32 1
.#define bfd_mach_loongarch64 2
. bfd_arch_amdgcn, {* AMDGCN *}
.#define bfd_mach_amdgcn_unknown 0x000
.#define bfd_mach_amdgcn_gfx900 0x02c
.#define bfd_mach_amdgcn_gfx904 0x02e
.#define bfd_mach_amdgcn_gfx906 0x02f
.#define bfd_mach_amdgcn_gfx908 0x030
.#define bfd_mach_amdgcn_gfx90a 0x03f
.#define bfd_mach_amdgcn_gfx1010 0x033
.#define bfd_mach_amdgcn_gfx1011 0x034
.#define bfd_mach_amdgcn_gfx1012 0x035
.#define bfd_mach_amdgcn_gfx1030 0x036
.#define bfd_mach_amdgcn_gfx1031 0x037
.#define bfd_mach_amdgcn_gfx1032 0x038
. bfd_arch_last
. };
*/
@@ -542,19 +588,28 @@ DESCRIPTION
. {* TRUE if this is the default machine for the architecture.
. The default arch should be the first entry for an arch so that
. all the entries for that arch can be accessed via <<next>>. *}
. bfd_boolean the_default;
. bool the_default;
. const struct bfd_arch_info * (*compatible) (const struct bfd_arch_info *,
. const struct bfd_arch_info *);
.
. bfd_boolean (*scan) (const struct bfd_arch_info *, const char *);
. bool (*scan) (const struct bfd_arch_info *, const char *);
.
. {* Allocate via bfd_malloc and return a fill buffer of size COUNT. If
. IS_BIGENDIAN is TRUE, the order of bytes is big endian. If CODE is
. TRUE, the buffer contains code. *}
. void *(*fill) (bfd_size_type count, bfd_boolean is_bigendian,
. bfd_boolean code);
. void *(*fill) (bfd_size_type count, bool is_bigendian, bool code);
.
. const struct bfd_arch_info *next;
.
. {* On some architectures the offset for a relocation can point into
. the middle of an instruction. This field specifies the maximum
. offset such a relocation can have (in octets). This affects the
. behaviour of the disassembler, since a value greater than zero
. means that it may need to disassemble an instruction twice, once
. to get its length and then a second time to display it. If the
. value is negative then this has to be done for every single
. instruction, regardless of the offset of the reloc. *}
. signed int max_reloc_offset_into_insn;
.}
.bfd_arch_info_type;
.
@@ -562,17 +617,19 @@ DESCRIPTION
extern const bfd_arch_info_type bfd_aarch64_arch;
extern const bfd_arch_info_type bfd_alpha_arch;
extern const bfd_arch_info_type bfd_amdgcn_arch;
extern const bfd_arch_info_type bfd_arc_arch;
extern const bfd_arch_info_type bfd_arm_arch;
extern const bfd_arch_info_type bfd_avr_arch;
extern const bfd_arch_info_type bfd_bfin_arch;
extern const bfd_arch_info_type bfd_cr16_arch;
extern const bfd_arch_info_type bfd_cr16c_arch;
extern const bfd_arch_info_type bfd_cris_arch;
extern const bfd_arch_info_type bfd_crx_arch;
extern const bfd_arch_info_type bfd_csky_arch;
extern const bfd_arch_info_type bfd_d10v_arch;
extern const bfd_arch_info_type bfd_d30v_arch;
extern const bfd_arch_info_type bfd_dlx_arch;
extern const bfd_arch_info_type bfd_bpf_arch;
extern const bfd_arch_info_type bfd_epiphany_arch;
extern const bfd_arch_info_type bfd_fr30_arch;
extern const bfd_arch_info_type bfd_frv_arch;
@@ -583,9 +640,8 @@ extern const bfd_arch_info_type bfd_iamcu_arch;
extern const bfd_arch_info_type bfd_ia64_arch;
extern const bfd_arch_info_type bfd_ip2k_arch;
extern const bfd_arch_info_type bfd_iq2000_arch;
extern const bfd_arch_info_type bfd_k1om_arch;
extern const bfd_arch_info_type bfd_l1om_arch;
extern const bfd_arch_info_type bfd_lm32_arch;
extern const bfd_arch_info_type bfd_loongarch_arch;
extern const bfd_arch_info_type bfd_m32c_arch;
extern const bfd_arch_info_type bfd_m32r_arch;
extern const bfd_arch_info_type bfd_m68hc11_arch;
@@ -613,7 +669,6 @@ extern const bfd_arch_info_type bfd_ns32k_arch;
extern const bfd_arch_info_type bfd_or1k_arch;
extern const bfd_arch_info_type bfd_pdp11_arch;
extern const bfd_arch_info_type bfd_pj_arch;
extern const bfd_arch_info_type bfd_plugin_arch;
extern const bfd_arch_info_type bfd_powerpc_archs[];
#define bfd_powerpc_arch bfd_powerpc_archs[0]
extern const bfd_arch_info_type bfd_pru_arch;
@@ -630,7 +685,6 @@ extern const bfd_arch_info_type bfd_tic30_arch;
extern const bfd_arch_info_type bfd_tic4x_arch;
extern const bfd_arch_info_type bfd_tic54x_arch;
extern const bfd_arch_info_type bfd_tic6x_arch;
extern const bfd_arch_info_type bfd_tic80_arch;
extern const bfd_arch_info_type bfd_tilegx_arch;
extern const bfd_arch_info_type bfd_tilepro_arch;
extern const bfd_arch_info_type bfd_v850_arch;
@@ -640,7 +694,6 @@ extern const bfd_arch_info_type bfd_visium_arch;
extern const bfd_arch_info_type bfd_wasm32_arch;
extern const bfd_arch_info_type bfd_xstormy16_arch;
extern const bfd_arch_info_type bfd_xtensa_arch;
extern const bfd_arch_info_type bfd_xc16x_arch;
extern const bfd_arch_info_type bfd_xgate_arch;
extern const bfd_arch_info_type bfd_z80_arch;
extern const bfd_arch_info_type bfd_z8k_arch;
@@ -652,17 +705,19 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
#else
&bfd_aarch64_arch,
&bfd_alpha_arch,
&bfd_amdgcn_arch,
&bfd_arc_arch,
&bfd_arm_arch,
&bfd_avr_arch,
&bfd_bfin_arch,
&bfd_cr16_arch,
&bfd_cr16c_arch,
&bfd_cris_arch,
&bfd_crx_arch,
&bfd_csky_arch,
&bfd_d10v_arch,
&bfd_d30v_arch,
&bfd_dlx_arch,
&bfd_bpf_arch,
&bfd_epiphany_arch,
&bfd_fr30_arch,
&bfd_frv_arch,
@@ -673,9 +728,8 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_ia64_arch,
&bfd_ip2k_arch,
&bfd_iq2000_arch,
&bfd_k1om_arch,
&bfd_l1om_arch,
&bfd_lm32_arch,
&bfd_loongarch_arch,
&bfd_m32c_arch,
&bfd_m32r_arch,
&bfd_m68hc11_arch,
@@ -717,7 +771,6 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_tic4x_arch,
&bfd_tic54x_arch,
&bfd_tic6x_arch,
&bfd_tic80_arch,
&bfd_tilegx_arch,
&bfd_tilepro_arch,
&bfd_v850_arch,
@@ -727,7 +780,6 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_wasm32_arch,
&bfd_xstormy16_arch,
&bfd_xtensa_arch,
&bfd_xc16x_arch,
&bfd_xgate_arch,
&bfd_z80_arch,
&bfd_z8k_arch,
@@ -804,7 +856,7 @@ bfd_arch_list (void)
const char **name_ptr;
const char **name_list;
const bfd_arch_info_type * const *app;
bfd_size_type amt;
size_t amt;
/* Determine the number of architectures. */
vec_length = 0;
@@ -817,7 +869,7 @@ bfd_arch_list (void)
}
}
amt = (vec_length + 1) * sizeof (char **);
amt = (vec_length + 1) * sizeof (char *);
name_list = (const char **) bfd_malloc (amt);
if (name_list == NULL)
return NULL;
@@ -844,7 +896,7 @@ FUNCTION
SYNOPSIS
const bfd_arch_info_type *bfd_arch_get_compatible
(const bfd *abfd, const bfd *bbfd, bfd_boolean accept_unknowns);
(const bfd *abfd, const bfd *bbfd, bool accept_unknowns);
DESCRIPTION
Determine whether two BFDs' architectures and machine types
@@ -857,7 +909,7 @@ DESCRIPTION
const bfd_arch_info_type *
bfd_arch_get_compatible (const bfd *abfd,
const bfd *bbfd,
bfd_boolean accept_unknowns)
bool accept_unknowns)
{
const bfd *ubfd, *kbfd;
@@ -870,12 +922,13 @@ bfd_arch_get_compatible (const bfd *abfd,
/* Otherwise architecture-specific code has to decide. */
return abfd->arch_info->compatible (abfd->arch_info, bbfd->arch_info);
/* We can allow an unknown architecture if accept_unknowns
is true, or if the target is the "binary" format, which
has an unknown architecture. Since the binary format can
/* We can allow an unknown architecture if accept_unknowns is true,
if UBFD is an IR object, or if the target is the "binary" format,
which has an unknown architecture. Since the binary format can
only be set by explicit request from the user, it is safe
to assume that they know what they are doing. */
if (accept_unknowns
|| ubfd->plugin_format == bfd_plugin_yes
|| strcmp (bfd_get_target (ubfd), "binary") == 0)
return kbfd->arch_info;
return NULL;
@@ -895,12 +948,13 @@ DESCRIPTION
.extern const bfd_arch_info_type bfd_default_arch_struct;
*/
const bfd_arch_info_type bfd_default_arch_struct = {
32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, TRUE,
const bfd_arch_info_type bfd_default_arch_struct =
{
32, 32, 8, bfd_arch_unknown, 0, "unknown", "unknown", 2, true,
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
0,
0, 0
};
/*
@@ -925,7 +979,7 @@ FUNCTION
bfd_default_set_arch_mach
SYNOPSIS
bfd_boolean bfd_default_set_arch_mach
bool bfd_default_set_arch_mach
(bfd *abfd, enum bfd_architecture arch, unsigned long mach);
DESCRIPTION
@@ -935,18 +989,18 @@ DESCRIPTION
pointer.
*/
bfd_boolean
bool
bfd_default_set_arch_mach (bfd *abfd,
enum bfd_architecture arch,
unsigned long mach)
{
abfd->arch_info = bfd_lookup_arch (arch, mach);
if (abfd->arch_info != NULL)
return TRUE;
return true;
abfd->arch_info = &bfd_default_arch_struct;
bfd_set_error (bfd_error_bad_value);
return FALSE;
return false;
}
/*
@@ -954,7 +1008,7 @@ FUNCTION
bfd_get_arch
SYNOPSIS
enum bfd_architecture bfd_get_arch (bfd *abfd);
enum bfd_architecture bfd_get_arch (const bfd *abfd);
DESCRIPTION
Return the enumerated type which describes the BFD @var{abfd}'s
@@ -962,7 +1016,7 @@ DESCRIPTION
*/
enum bfd_architecture
bfd_get_arch (bfd *abfd)
bfd_get_arch (const bfd *abfd)
{
return abfd->arch_info->arch;
}
@@ -972,7 +1026,7 @@ FUNCTION
bfd_get_mach
SYNOPSIS
unsigned long bfd_get_mach (bfd *abfd);
unsigned long bfd_get_mach (const bfd *abfd);
DESCRIPTION
Return the long type which describes the BFD @var{abfd}'s
@@ -980,7 +1034,7 @@ DESCRIPTION
*/
unsigned long
bfd_get_mach (bfd *abfd)
bfd_get_mach (const bfd *abfd)
{
return abfd->arch_info->mach;
}
@@ -990,7 +1044,7 @@ FUNCTION
bfd_arch_bits_per_byte
SYNOPSIS
unsigned int bfd_arch_bits_per_byte (bfd *abfd);
unsigned int bfd_arch_bits_per_byte (const bfd *abfd);
DESCRIPTION
Return the number of bits in one of the BFD @var{abfd}'s
@@ -998,7 +1052,7 @@ DESCRIPTION
*/
unsigned int
bfd_arch_bits_per_byte (bfd *abfd)
bfd_arch_bits_per_byte (const bfd *abfd)
{
return abfd->arch_info->bits_per_byte;
}
@@ -1008,7 +1062,7 @@ FUNCTION
bfd_arch_bits_per_address
SYNOPSIS
unsigned int bfd_arch_bits_per_address (bfd *abfd);
unsigned int bfd_arch_bits_per_address (const bfd *abfd);
DESCRIPTION
Return the number of bits in one of the BFD @var{abfd}'s
@@ -1016,7 +1070,7 @@ DESCRIPTION
*/
unsigned int
bfd_arch_bits_per_address (bfd *abfd)
bfd_arch_bits_per_address (const bfd *abfd)
{
return abfd->arch_info->bits_per_address;
}
@@ -1057,7 +1111,7 @@ INTERNAL_FUNCTION
bfd_default_scan
SYNOPSIS
bfd_boolean bfd_default_scan
bool bfd_default_scan
(const struct bfd_arch_info *info, const char *string);
DESCRIPTION
@@ -1065,7 +1119,7 @@ DESCRIPTION
architecture hit and a machine hit.
*/
bfd_boolean
bool
bfd_default_scan (const bfd_arch_info_type *info, const char *string)
{
const char *ptr_src;
@@ -1078,11 +1132,11 @@ bfd_default_scan (const bfd_arch_info_type *info, const char *string)
default architecture? */
if (strcasecmp (string, info->arch_name) == 0
&& info->the_default)
return TRUE;
return true;
/* Exact match of the machine name (PRINTABLE_NAME)? */
if (strcasecmp (string, info->printable_name) == 0)
return TRUE;
return true;
/* Given that printable_name contains no colon, attempt to match:
ARCH_NAME [ ":" ] PRINTABLE_NAME? */
@@ -1096,13 +1150,13 @@ bfd_default_scan (const bfd_arch_info_type *info, const char *string)
{
if (strcasecmp (string + strlen_arch_name + 1,
info->printable_name) == 0)
return TRUE;
return true;
}
else
{
if (strcasecmp (string + strlen_arch_name,
info->printable_name) == 0)
return TRUE;
return true;
}
}
}
@@ -1115,7 +1169,7 @@ bfd_default_scan (const bfd_arch_info_type *info, const char *string)
if (strncasecmp (string, info->printable_name, colon_index) == 0
&& strcasecmp (string + colon_index,
info->printable_name + colon_index + 1) == 0)
return TRUE;
return true;
}
/* Given that PRINTABLE_NAME has the form: <arch> ":" <mach>; Do not
@@ -1245,16 +1299,16 @@ bfd_default_scan (const bfd_arch_info_type *info, const char *string)
break;
default:
return FALSE;
return false;
}
if (arch != info->arch)
return FALSE;
return false;
if (number != info->mach)
return FALSE;
return false;
return TRUE;
return true;
}
/*
@@ -1338,7 +1392,8 @@ FUNCTION
bfd_octets_per_byte
SYNOPSIS
unsigned int bfd_octets_per_byte (bfd *abfd);
unsigned int bfd_octets_per_byte (const bfd *abfd,
const asection *sec);
DESCRIPTION
Return the number of octets (8-bit quantities) per target byte
@@ -1347,8 +1402,13 @@ DESCRIPTION
*/
unsigned int
bfd_octets_per_byte (bfd *abfd)
bfd_octets_per_byte (const bfd *abfd, const asection *sec)
{
if (bfd_get_flavour (abfd) == bfd_target_elf_flavour
&& sec != NULL
&& (sec->flags & SEC_ELF_OCTETS) != 0)
return 1;
return bfd_arch_mach_octets_per_byte (bfd_get_arch (abfd),
bfd_get_mach (abfd));
}
@@ -1385,8 +1445,8 @@ INTERNAL_FUNCTION
SYNOPSIS
void *bfd_arch_default_fill (bfd_size_type count,
bfd_boolean is_bigendian,
bfd_boolean code);
bool is_bigendian,
bool code);
DESCRIPTION
Allocate via bfd_malloc and return a fill buffer of size COUNT.
@@ -1396,8 +1456,8 @@ DESCRIPTION
void *
bfd_arch_default_fill (bfd_size_type count,
bfd_boolean is_bigendian ATTRIBUTE_UNUSED,
bfd_boolean code ATTRIBUTE_UNUSED)
bool is_bigendian ATTRIBUTE_UNUSED,
bool code ATTRIBUTE_UNUSED)
{
void *fill = bfd_malloc (count);
if (fill != NULL)
@@ -1405,7 +1465,7 @@ bfd_arch_default_fill (bfd_size_type count,
return fill;
}
bfd_boolean
bool
_bfd_nowrite_set_arch_mach (bfd *abfd,
enum bfd_architecture arch ATTRIBUTE_UNUSED,
unsigned long mach ATTRIBUTE_UNUSED)
+86 -647
View File
@@ -1,6 +1,6 @@
/* Main header file for the bfd library -- portable access to object files.
Copyright (C) 1990-2018 Free Software Foundation, Inc.
Copyright (C) 1990-2022 Free Software Foundation, Inc.
Contributed by Cygnus Support.
@@ -34,8 +34,11 @@ extern "C" {
#include "ansidecl.h"
#include "symcat.h"
#include <stdint.h>
#include <stdbool.h>
#include "diagnostics.h"
#include <stdarg.h>
#include <string.h>
#include <sys/stat.h>
#if defined (__STDC__) || defined (ALMOST_STDC) || defined (HAVE_STRINGIZE)
@@ -55,23 +58,6 @@ extern "C" {
comma and then the length of the string. Doing this by hand
is error prone, so using this macro is safer. */
#define STRING_COMMA_LEN(STR) (STR), (sizeof (STR) - 1)
/* Unfortunately it is not possible to use the STRING_COMMA_LEN macro
to create the arguments to another macro, since the preprocessor
will mis-count the number of arguments to the outer macro (by not
evaluating STRING_COMMA_LEN and so missing the comma). This is a
problem for example when trying to use STRING_COMMA_LEN to build
the arguments to the strncmp() macro. Hence this alternative
definition of strncmp is provided here.
Note - these macros do NOT work if STR2 is not a constant string. */
#define CONST_STRNEQ(STR1,STR2) (strncmp ((STR1), (STR2), sizeof (STR2) - 1) == 0)
/* strcpy() can have a similar problem, but since we know we are
copying a constant string, we can use memcpy which will be faster
since there is no need to check for a NUL byte inside STR. We
can also save time if we do not need to copy the terminating NUL. */
#define LITMEMCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2) - 1)
#define LITSTRCPY(DEST,STR2) memcpy ((DEST), (STR2), sizeof (STR2))
#define BFD_SUPPORTS_PLUGINS @supports_plugins@
@@ -83,109 +69,64 @@ extern "C" {
/* The word size of the default bfd target. */
#define BFD_DEFAULT_TARGET_SIZE @bfd_default_target_size@
#define BFD_HOST_64BIT_LONG @BFD_HOST_64BIT_LONG@
#define BFD_HOST_64BIT_LONG_LONG @BFD_HOST_64BIT_LONG_LONG@
#if @BFD_HOST_64_BIT_DEFINED@
#define BFD_HOST_64_BIT @BFD_HOST_64_BIT@
#define BFD_HOST_U_64_BIT @BFD_HOST_U_64_BIT@
typedef BFD_HOST_64_BIT bfd_int64_t;
typedef BFD_HOST_U_64_BIT bfd_uint64_t;
#endif
#ifdef HAVE_INTTYPES_H
# include <inttypes.h>
#else
# if BFD_HOST_64BIT_LONG
# define BFD_PRI64 "l"
# elif defined (__MSVCRT__)
# define BFD_PRI64 "I64"
# else
# define BFD_PRI64 "ll"
# endif
# undef PRId64
# define PRId64 BFD_PRI64 "d"
# undef PRIu64
# define PRIu64 BFD_PRI64 "u"
# undef PRIx64
# define PRIx64 BFD_PRI64 "x"
#endif
#include <inttypes.h>
#if BFD_ARCH_SIZE >= 64
#define BFD64
#endif
#ifndef INLINE
#if __GNUC__ >= 2
#define INLINE __inline__
#else
#define INLINE
#endif
#endif
/* Declaring a type wide enough to hold a host long and a host pointer. */
#define BFD_HOSTPTR_T @BFD_HOSTPTR_T@
typedef BFD_HOSTPTR_T bfd_hostptr_t;
/* Forward declaration. */
typedef struct bfd bfd;
/* Boolean type used in bfd. Too many systems define their own
versions of "boolean" for us to safely typedef a "boolean" of
our own. Using an enum for "bfd_boolean" has its own set of
problems, with strange looking casts required to avoid warnings
on some older compilers. Thus we just use an int.
/* Boolean type used in bfd.
General rule: Functions which are bfd_boolean return TRUE on
success and FALSE on failure (unless they're a predicate). */
typedef int bfd_boolean;
#undef FALSE
#undef TRUE
#define FALSE 0
#define TRUE 1
#ifdef POISON_BFD_BOOLEAN
# pragma GCC poison bfd_boolean
#else
# define bfd_boolean bool
# undef FALSE
# undef TRUE
# define FALSE 0
# define TRUE 1
#endif
/* Silence "applying zero offset to null pointer" UBSAN warnings. */
#define PTR_ADD(P,A) ((A) != 0 ? (P) + (A) : (P))
/* Also prevent non-zero offsets from being applied to a null pointer. */
#define NPTR_ADD(P,A) ((P) != NULL ? (P) + (A) : (P))
#ifdef BFD64
#ifndef BFD_HOST_64_BIT
#error No 64 bit integer type available
#endif /* ! defined (BFD_HOST_64_BIT) */
typedef BFD_HOST_U_64_BIT bfd_vma;
typedef BFD_HOST_64_BIT bfd_signed_vma;
typedef BFD_HOST_U_64_BIT bfd_size_type;
typedef BFD_HOST_U_64_BIT symvalue;
#if BFD_HOST_64BIT_LONG
#define BFD_VMA_FMT "l"
#elif defined (__MSVCRT__)
#define BFD_VMA_FMT "I64"
#else
#define BFD_VMA_FMT "ll"
#endif
#ifndef fprintf_vma
#define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x)
#define fprintf_vma(f,x) fprintf (f, "%016" BFD_VMA_FMT "x", x)
#endif
#else /* not BFD64 */
/* Represent a target address. Also used as a generic unsigned type
which is guaranteed to be big enough to hold any arithmetic types
we need to deal with. */
typedef unsigned long bfd_vma;
typedef uint64_t bfd_vma;
/* A generic signed type which is guaranteed to be big enough to hold any
arithmetic types we need to deal with. Can be assumed to be compatible
with bfd_vma in the same way that signed and unsigned ints are compatible
(as parameters, in assignment, etc). */
typedef long bfd_signed_vma;
typedef int64_t bfd_signed_vma;
typedef uint64_t bfd_size_type;
typedef uint64_t symvalue;
#define BFD_VMA_FMT @BFD_INT64_FMT@
#define fprintf_vma(f,x) fprintf (f, "%016" BFD_VMA_FMT "x", x)
#define sprintf_vma(s,x) sprintf (s, "%016" BFD_VMA_FMT "x", x)
#else /* not BFD64 */
typedef unsigned long bfd_vma;
typedef long bfd_signed_vma;
typedef unsigned long symvalue;
typedef unsigned long bfd_size_type;
/* Print a bfd_vma x on stream s. */
#define BFD_VMA_FMT "l"
#define fprintf_vma(s,x) fprintf (s, "%08" BFD_VMA_FMT "x", x)
#define sprintf_vma(s,x) sprintf (s, "%08" BFD_VMA_FMT "x", x)
@@ -194,19 +135,10 @@ typedef unsigned long bfd_size_type;
#define HALF_BFD_SIZE_TYPE \
(((bfd_size_type) 1) << (8 * sizeof (bfd_size_type) / 2))
#ifndef BFD_HOST_64_BIT
/* Fall back on a 32 bit type. The idea is to make these types always
available for function return types, but in the case that
BFD_HOST_64_BIT is undefined such a function should abort or
otherwise signal an error. */
typedef bfd_signed_vma bfd_int64_t;
typedef bfd_vma bfd_uint64_t;
#endif
/* An offset into a file. BFD always uses the largest possible offset
based on the build time availability of fseek, fseeko, or fseeko64. */
typedef @bfd_file_ptr@ file_ptr;
typedef unsigned @bfd_file_ptr@ ufile_ptr;
typedef @bfd_ufile_ptr@ ufile_ptr;
extern void bfd_sprintf_vma (bfd *, char *, bfd_vma);
extern void bfd_fprintf_vma (bfd *, void *, bfd_vma);
@@ -234,32 +166,13 @@ bfd_format;
/* A count of carsyms (canonical archive symbols). */
typedef unsigned long symindex;
/* How to perform a relocation. */
typedef const struct reloc_howto_struct reloc_howto_type;
#define BFD_NO_MORE_SYMBOLS ((symindex) ~0)
/* General purpose part of a symbol X;
target specific parts are in libcoff.h, libaout.h, etc. */
#define bfd_get_section(x) ((x)->section)
#define bfd_get_output_section(x) ((x)->section->output_section)
#define bfd_set_section(x,y) ((x)->section) = (y)
#define bfd_asymbol_base(x) ((x)->section->vma)
#define bfd_asymbol_value(x) (bfd_asymbol_base(x) + (x)->value)
#define bfd_asymbol_name(x) ((x)->name)
/*Perhaps future: #define bfd_asymbol_bfd(x) ((x)->section->owner)*/
#define bfd_asymbol_bfd(x) ((x)->the_bfd)
#define bfd_asymbol_flavour(x) \
(((x)->flags & BSF_SYNTHETIC) != 0 \
? bfd_target_unknown_flavour \
: bfd_asymbol_bfd (x)->xvec->flavour)
/* A canonical archive symbol. */
/* This is a type pun with struct ranlib on purpose! */
typedef struct carsym
{
char *name;
const char *name;
file_ptr file_offset; /* Look here to find the file. */
}
carsym; /* To make these you call a carsymogen. */
@@ -303,37 +216,6 @@ typedef struct bfd_section *sec_ptr;
((((bfd_vma) (this) + (boundary) - 1) >= (bfd_vma) (this)) \
? (((bfd_vma) (this) + ((boundary) - 1)) & ~ (bfd_vma) ((boundary)-1)) \
: ~ (bfd_vma) 0)
#define bfd_get_section_name(bfd, ptr) ((void) bfd, (ptr)->name)
#define bfd_get_section_vma(bfd, ptr) ((void) bfd, (ptr)->vma)
#define bfd_get_section_lma(bfd, ptr) ((void) bfd, (ptr)->lma)
#define bfd_get_section_alignment(bfd, ptr) ((void) bfd, \
(ptr)->alignment_power)
#define bfd_section_name(bfd, ptr) ((ptr)->name)
#define bfd_section_size(bfd, ptr) ((ptr)->size)
#define bfd_get_section_size(ptr) ((ptr)->size)
#define bfd_section_vma(bfd, ptr) ((ptr)->vma)
#define bfd_section_lma(bfd, ptr) ((ptr)->lma)
#define bfd_section_alignment(bfd, ptr) ((ptr)->alignment_power)
#define bfd_get_section_flags(bfd, ptr) ((void) bfd, (ptr)->flags)
#define bfd_get_section_userdata(bfd, ptr) ((void) bfd, (ptr)->userdata)
#define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
#define bfd_get_section_limit_octets(bfd, sec) \
((bfd)->direction != write_direction && (sec)->rawsize != 0 \
? (sec)->rawsize : (sec)->size)
/* Find the address one past the end of SEC. */
#define bfd_get_section_limit(bfd, sec) \
(bfd_get_section_limit_octets(bfd, sec) / bfd_octets_per_byte (bfd))
/* Return TRUE if input section SEC has been discarded. */
#define discarded_section(sec) \
(!bfd_is_abs_section (sec) \
&& bfd_is_abs_section ((sec)->output_section) \
&& (sec)->sec_info_type != SEC_INFO_TYPE_MERGE \
&& (sec)->sec_info_type != SEC_INFO_TYPE_JUST_SYMS)
typedef enum bfd_print_symbol
{
@@ -404,7 +286,7 @@ struct bfd_hash_table
};
/* Initialize a hash table. */
extern bfd_boolean bfd_hash_table_init
extern bool bfd_hash_table_init
(struct bfd_hash_table *,
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
struct bfd_hash_table *,
@@ -412,7 +294,7 @@ extern bfd_boolean bfd_hash_table_init
unsigned int);
/* Initialize a hash table specifying a size. */
extern bfd_boolean bfd_hash_table_init_n
extern bool bfd_hash_table_init_n
(struct bfd_hash_table *,
struct bfd_hash_entry *(*) (struct bfd_hash_entry *,
struct bfd_hash_table *,
@@ -428,8 +310,7 @@ extern void bfd_hash_table_free
COPY argument must be TRUE if this routine should copy the string
into newly allocated memory when adding an entry. */
extern struct bfd_hash_entry *bfd_hash_lookup
(struct bfd_hash_table *, const char *, bfd_boolean create,
bfd_boolean copy);
(struct bfd_hash_table *, const char *, bool create, bool copy);
/* Insert an entry in a hash table. */
extern struct bfd_hash_entry *bfd_hash_insert
@@ -457,7 +338,7 @@ extern void *bfd_hash_allocate
INFO argument is passed to the function. */
extern void bfd_hash_traverse
(struct bfd_hash_table *,
bfd_boolean (*) (struct bfd_hash_entry *, void *),
bool (*) (struct bfd_hash_entry *, void *),
void *info);
/* Allows the default size of a hash table to be configured. New hash
@@ -520,56 +401,22 @@ extern int bfd_stat (bfd *, struct stat *);
#endif
extern void _bfd_warn_deprecated (const char *, const char *, int, const char *);
/* Cast from const char * to char * so that caller can assign to
a char * without a warning. */
#define bfd_get_filename(abfd) ((char *) (abfd)->filename)
#define bfd_get_cacheable(abfd) ((abfd)->cacheable)
#define bfd_get_format(abfd) ((abfd)->format)
#define bfd_get_target(abfd) ((abfd)->xvec->name)
#define bfd_get_flavour(abfd) ((abfd)->xvec->flavour)
#define bfd_family_coff(abfd) \
(bfd_get_flavour (abfd) == bfd_target_coff_flavour || \
bfd_get_flavour (abfd) == bfd_target_xcoff_flavour)
#define bfd_big_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_BIG)
#define bfd_little_endian(abfd) ((abfd)->xvec->byteorder == BFD_ENDIAN_LITTLE)
#define bfd_header_big_endian(abfd) \
((abfd)->xvec->header_byteorder == BFD_ENDIAN_BIG)
#define bfd_header_little_endian(abfd) \
((abfd)->xvec->header_byteorder == BFD_ENDIAN_LITTLE)
#define bfd_get_file_flags(abfd) ((abfd)->flags)
#define bfd_applicable_file_flags(abfd) ((abfd)->xvec->object_flags)
#define bfd_applicable_section_flags(abfd) ((abfd)->xvec->section_flags)
#define bfd_has_map(abfd) ((abfd)->has_armap)
#define bfd_is_thin_archive(abfd) ((abfd)->is_thin_archive)
#define bfd_valid_reloc_types(abfd) ((abfd)->xvec->valid_reloc_types)
#define bfd_usrdata(abfd) ((abfd)->usrdata)
#define bfd_get_start_address(abfd) ((abfd)->start_address)
#define bfd_get_symcount(abfd) ((abfd)->symcount)
#define bfd_get_outsymbols(abfd) ((abfd)->outsymbols)
#define bfd_count_sections(abfd) ((abfd)->section_count)
#define bfd_get_dynamic_symcount(abfd) ((abfd)->dynsymcount)
#define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
extern bfd_boolean bfd_cache_close
extern bool bfd_cache_close
(bfd *abfd);
/* NB: This declaration should match the autogenerated one in libbfd.h. */
extern bfd_boolean bfd_cache_close_all (void);
extern bool bfd_cache_close_all (void);
extern bfd_boolean bfd_record_phdr
(bfd *, unsigned long, bfd_boolean, flagword, bfd_boolean, bfd_vma,
bfd_boolean, bfd_boolean, unsigned int, struct bfd_section **);
extern bool bfd_record_phdr
(bfd *, unsigned long, bool, flagword, bool, bfd_vma,
bool, bool, unsigned int, struct bfd_section **);
/* Byte swapping routines. */
bfd_uint64_t bfd_getb64 (const void *);
bfd_uint64_t bfd_getl64 (const void *);
bfd_int64_t bfd_getb_signed_64 (const void *);
bfd_int64_t bfd_getl_signed_64 (const void *);
uint64_t bfd_getb64 (const void *);
uint64_t bfd_getl64 (const void *);
int64_t bfd_getb_signed_64 (const void *);
int64_t bfd_getl_signed_64 (const void *);
bfd_vma bfd_getb32 (const void *);
bfd_vma bfd_getl32 (const void *);
bfd_signed_vma bfd_getb_signed_32 (const void *);
@@ -578,8 +425,8 @@ bfd_vma bfd_getb16 (const void *);
bfd_vma bfd_getl16 (const void *);
bfd_signed_vma bfd_getb_signed_16 (const void *);
bfd_signed_vma bfd_getl_signed_16 (const void *);
void bfd_putb64 (bfd_uint64_t, void *);
void bfd_putl64 (bfd_uint64_t, void *);
void bfd_putb64 (uint64_t, void *);
void bfd_putl64 (uint64_t, void *);
void bfd_putb32 (bfd_vma, void *);
void bfd_putl32 (bfd_vma, void *);
void bfd_putb24 (bfd_vma, void *);
@@ -589,198 +436,9 @@ void bfd_putl16 (bfd_vma, void *);
/* Byte swapping routines which take size and endiannes as arguments. */
bfd_uint64_t bfd_get_bits (const void *, int, bfd_boolean);
void bfd_put_bits (bfd_uint64_t, void *, int, bfd_boolean);
uint64_t bfd_get_bits (const void *, int, bool);
void bfd_put_bits (uint64_t, void *, int, bool);
#if defined(__STDC__) || defined(ALMOST_STDC)
struct ecoff_debug_info;
struct ecoff_debug_swap;
struct ecoff_extr;
struct bfd_symbol;
struct bfd_link_info;
struct bfd_link_hash_entry;
struct bfd_section_already_linked;
struct bfd_elf_version_tree;
#endif
extern bfd_boolean bfd_section_already_linked_table_init (void);
extern void bfd_section_already_linked_table_free (void);
extern bfd_boolean _bfd_handle_already_linked
(struct bfd_section *, struct bfd_section_already_linked *,
struct bfd_link_info *);
/* Externally visible ECOFF routines. */
extern bfd_boolean bfd_ecoff_set_gp_value
(bfd *abfd, bfd_vma gp_value);
extern bfd_boolean bfd_ecoff_set_regmasks
(bfd *abfd, unsigned long gprmask, unsigned long fprmask,
unsigned long *cprmask);
extern void *bfd_ecoff_debug_init
(bfd *output_bfd, struct ecoff_debug_info *output_debug,
const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
extern void bfd_ecoff_debug_free
(void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
const struct ecoff_debug_swap *output_swap, struct bfd_link_info *);
extern bfd_boolean bfd_ecoff_debug_accumulate
(void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
struct ecoff_debug_info *input_debug,
const struct ecoff_debug_swap *input_swap, struct bfd_link_info *);
extern bfd_boolean bfd_ecoff_debug_accumulate_other
(void *handle, bfd *output_bfd, struct ecoff_debug_info *output_debug,
const struct ecoff_debug_swap *output_swap, bfd *input_bfd,
struct bfd_link_info *);
extern bfd_boolean bfd_ecoff_debug_externals
(bfd *abfd, struct ecoff_debug_info *debug,
const struct ecoff_debug_swap *swap, bfd_boolean relocatable,
bfd_boolean (*get_extr) (struct bfd_symbol *, struct ecoff_extr *),
void (*set_index) (struct bfd_symbol *, bfd_size_type));
extern bfd_boolean bfd_ecoff_debug_one_external
(bfd *abfd, struct ecoff_debug_info *debug,
const struct ecoff_debug_swap *swap, const char *name,
struct ecoff_extr *esym);
extern bfd_size_type bfd_ecoff_debug_size
(bfd *abfd, struct ecoff_debug_info *debug,
const struct ecoff_debug_swap *swap);
extern bfd_boolean bfd_ecoff_write_debug
(bfd *abfd, struct ecoff_debug_info *debug,
const struct ecoff_debug_swap *swap, file_ptr where);
extern bfd_boolean bfd_ecoff_write_accumulated_debug
(void *handle, bfd *abfd, struct ecoff_debug_info *debug,
const struct ecoff_debug_swap *swap,
struct bfd_link_info *info, file_ptr where);
/* Externally visible ELF routines. */
struct bfd_link_needed_list
{
struct bfd_link_needed_list *next;
bfd *by;
const char *name;
};
enum dynamic_lib_link_class {
DYN_NORMAL = 0,
DYN_AS_NEEDED = 1,
DYN_DT_NEEDED = 2,
DYN_NO_ADD_NEEDED = 4,
DYN_NO_NEEDED = 8
};
enum notice_asneeded_action {
notice_as_needed,
notice_not_needed,
notice_needed
};
extern bfd_boolean bfd_elf_record_link_assignment
(bfd *, struct bfd_link_info *, const char *, bfd_boolean,
bfd_boolean);
extern struct bfd_link_needed_list *bfd_elf_get_needed_list
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_elf_get_bfd_needed_list
(bfd *, struct bfd_link_needed_list **);
extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *,
const char *, bfd_vma);
extern bfd_boolean bfd_elf_size_dynamic_sections
(bfd *, const char *, const char *, const char *, const char *, const char *,
const char * const *, struct bfd_link_info *, struct bfd_section **);
extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr
(bfd *, struct bfd_link_info *);
extern void bfd_elf_set_dt_needed_name
(bfd *, const char *);
extern const char *bfd_elf_get_dt_soname
(bfd *);
extern void bfd_elf_set_dyn_lib_class
(bfd *, enum dynamic_lib_link_class);
extern int bfd_elf_get_dyn_lib_class
(bfd *);
extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
(bfd *, struct bfd_link_info *);
extern int bfd_elf_discard_info
(bfd *, struct bfd_link_info *);
extern unsigned int _bfd_elf_default_action_discarded
(struct bfd_section *);
/* Return an upper bound on the number of bytes required to store a
copy of ABFD's program header table entries. Return -1 if an error
occurs; bfd_get_error will return an appropriate code. */
extern long bfd_get_elf_phdr_upper_bound
(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
(bfd *abfd, void *phdrs);
/* Create a new BFD as if by bfd_openr. Rather than opening a file,
reconstruct an ELF file by reading the segments out of remote
memory based on the ELF file header at EHDR_VMA and the ELF program
headers it points to. If non-zero, SIZE is the known extent of the
object. If not null, *LOADBASEP is filled in with the difference
between the VMAs from which the segments were read, and the VMAs
the file headers (and hence BFD's idea of each section's VMA) put
them at.
The function TARGET_READ_MEMORY is called to copy LEN bytes from
the remote memory at target address VMA into the local buffer at
MYADDR; it should return zero on success or an `errno' code on
failure. TEMPL must be a BFD for a target with the word size and
byte order found in the remote memory. */
extern bfd *bfd_elf_bfd_from_remote_memory
(bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep,
int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
bfd_size_type len));
extern struct bfd_section *_bfd_elf_tls_setup
(bfd *, struct bfd_link_info *);
extern struct bfd_section *
_bfd_nearby_section (bfd *, struct bfd_section *, bfd_vma);
extern void _bfd_fix_excluded_sec_syms
(bfd *, struct bfd_link_info *);
extern unsigned bfd_m68k_mach_to_features (int);
extern int bfd_m68k_features_to_mach (unsigned);
extern bfd_boolean bfd_m68k_elf32_create_embedded_relocs
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
char **);
extern void bfd_elf_m68k_set_target_options (struct bfd_link_info *, int);
extern bfd_boolean bfd_bfin_elf32_create_embedded_relocs
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
char **);
extern bfd_boolean bfd_cr16_elf32_create_embedded_relocs
(bfd *, struct bfd_link_info *, struct bfd_section *, struct bfd_section *,
char **);
/* SunOS shared library support routines for the linker. */
extern struct bfd_link_needed_list *bfd_sunos_get_needed_list
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_sunos_record_link_assignment
(bfd *, struct bfd_link_info *, const char *);
extern bfd_boolean bfd_sunos_size_dynamic_sections
(bfd *, struct bfd_link_info *, struct bfd_section **,
struct bfd_section **, struct bfd_section **);
/* Linux shared library support routines for the linker. */
extern bfd_boolean bfd_i386linux_size_dynamic_sections
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_sparclinux_size_dynamic_sections
(bfd *, struct bfd_link_info *);
/* mmap hacks */
@@ -806,260 +464,41 @@ extern void bfd_init_window
(bfd_window *);
extern void bfd_free_window
(bfd_window *);
extern bfd_boolean bfd_get_file_window
(bfd *, file_ptr, bfd_size_type, bfd_window *, bfd_boolean);
extern bool bfd_get_file_window
(bfd *, file_ptr, bfd_size_type, bfd_window *, bool);
/* Externally visible ELF routines. */
/* XCOFF support routines for the linker. */
/* Create a new BFD as if by bfd_openr. Rather than opening a file,
reconstruct an ELF file by reading the segments out of remote
memory based on the ELF file header at EHDR_VMA and the ELF program
headers it points to. If non-zero, SIZE is the known extent of the
object. If not null, *LOADBASEP is filled in with the difference
between the VMAs from which the segments were read, and the VMAs
the file headers (and hence BFD's idea of each section's VMA) put
them at.
extern bfd_boolean bfd_xcoff_split_import_path
(bfd *, const char *, const char **, const char **);
extern bfd_boolean bfd_xcoff_set_archive_import_path
(struct bfd_link_info *, bfd *, const char *);
extern bfd_boolean bfd_xcoff_link_record_set
(bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_size_type);
extern bfd_boolean bfd_xcoff_import_symbol
(bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *, bfd_vma,
const char *, const char *, const char *, unsigned int);
extern bfd_boolean bfd_xcoff_export_symbol
(bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *);
extern bfd_boolean bfd_xcoff_link_count_reloc
(bfd *, struct bfd_link_info *, const char *);
extern bfd_boolean bfd_xcoff_record_link_assignment
(bfd *, struct bfd_link_info *, const char *);
extern bfd_boolean bfd_xcoff_size_dynamic_sections
(bfd *, struct bfd_link_info *, const char *, const char *,
unsigned long, unsigned long, unsigned long, bfd_boolean,
int, bfd_boolean, unsigned int, struct bfd_section **, bfd_boolean);
extern bfd_boolean bfd_xcoff_link_generate_rtinit
(bfd *, const char *, const char *, bfd_boolean);
The function TARGET_READ_MEMORY is called to copy LEN bytes from
the remote memory at target address VMA into the local buffer at
MYADDR; it should return zero on success or an `errno' code on
failure. TEMPL must be a BFD for a target with the word size and
byte order found in the remote memory. */
extern bfd *bfd_elf_bfd_from_remote_memory
(bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep,
int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
bfd_size_type len));
/* XCOFF support routines for ar. */
extern bfd_boolean bfd_xcoff_ar_archive_set_magic
(bfd *, char *);
/* Forward declarations. */
struct ecoff_debug_info;
struct ecoff_debug_swap;
struct ecoff_extr;
struct bfd_link_info;
struct bfd_link_hash_entry;
/* Externally visible COFF routines. */
/* Return TRUE if the start of STR matches PREFIX, FALSE otherwise. */
#if defined(__STDC__) || defined(ALMOST_STDC)
struct internal_syment;
union internal_auxent;
#endif
extern bfd_boolean bfd_coff_set_symbol_class
(bfd *, struct bfd_symbol *, unsigned int);
/* ARM VFP11 erratum workaround support. */
typedef enum
static inline bool
startswith (const char *str, const char *prefix)
{
BFD_ARM_VFP11_FIX_DEFAULT,
BFD_ARM_VFP11_FIX_NONE,
BFD_ARM_VFP11_FIX_SCALAR,
BFD_ARM_VFP11_FIX_VECTOR
} bfd_arm_vfp11_fix;
extern void bfd_elf32_arm_init_maps
(bfd *);
extern void bfd_elf32_arm_set_vfp11_fix
(bfd *, struct bfd_link_info *);
extern void bfd_elf32_arm_set_cortex_a8_fix
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_elf32_arm_vfp11_erratum_scan
(bfd *, struct bfd_link_info *);
extern void bfd_elf32_arm_vfp11_fix_veneer_locations
(bfd *, struct bfd_link_info *);
/* ARM STM STM32L4XX erratum workaround support. */
typedef enum
{
BFD_ARM_STM32L4XX_FIX_NONE,
BFD_ARM_STM32L4XX_FIX_DEFAULT,
BFD_ARM_STM32L4XX_FIX_ALL
} bfd_arm_stm32l4xx_fix;
extern void bfd_elf32_arm_set_stm32l4xx_fix
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_elf32_arm_stm32l4xx_erratum_scan
(bfd *, struct bfd_link_info *);
extern void bfd_elf32_arm_stm32l4xx_fix_veneer_locations
(bfd *, struct bfd_link_info *);
/* ARM Interworking support. Called from linker. */
extern bfd_boolean bfd_arm_allocate_interworking_sections
(struct bfd_link_info *);
extern bfd_boolean bfd_arm_process_before_allocation
(bfd *, struct bfd_link_info *, int);
extern bfd_boolean bfd_arm_get_bfd_for_interworking
(bfd *, struct bfd_link_info *);
/* PE ARM Interworking support. Called from linker. */
extern bfd_boolean bfd_arm_pe_allocate_interworking_sections
(struct bfd_link_info *);
extern bfd_boolean bfd_arm_pe_process_before_allocation
(bfd *, struct bfd_link_info *, int);
extern bfd_boolean bfd_arm_pe_get_bfd_for_interworking
(bfd *, struct bfd_link_info *);
/* ELF ARM Interworking support. Called from linker. */
extern bfd_boolean bfd_elf32_arm_allocate_interworking_sections
(struct bfd_link_info *);
extern bfd_boolean bfd_elf32_arm_process_before_allocation
(bfd *, struct bfd_link_info *);
struct elf32_arm_params {
char *thumb_entry_symbol;
int byteswap_code;
int target1_is_rel;
char * target2_type;
int fix_v4bx;
int use_blx;
bfd_arm_vfp11_fix vfp11_denorm_fix;
bfd_arm_stm32l4xx_fix stm32l4xx_fix;
int no_enum_size_warning;
int no_wchar_size_warning;
int pic_veneer;
int fix_cortex_a8;
int fix_arm1176;
int merge_exidx_entries;
int cmse_implib;
bfd *in_implib_bfd;
};
void bfd_elf32_arm_set_target_params
(bfd *, struct bfd_link_info *, struct elf32_arm_params *);
extern bfd_boolean bfd_elf32_arm_get_bfd_for_interworking
(bfd *, struct bfd_link_info *);
extern bfd_boolean bfd_elf32_arm_add_glue_sections_to_bfd
(bfd *, struct bfd_link_info *);
extern void bfd_elf32_arm_keep_private_stub_output_sections
(struct bfd_link_info *);
/* ELF ARM mapping symbol support. */
#define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0)
#define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1)
#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2)
#define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0)
extern bfd_boolean bfd_is_arm_special_symbol_name
(const char *, int);
extern void bfd_elf32_arm_set_byteswap_code
(struct bfd_link_info *, int);
extern void bfd_elf32_arm_use_long_plt (void);
/* ARM Note section processing. */
extern bfd_boolean bfd_arm_merge_machines
(bfd *, bfd *);
extern bfd_boolean bfd_arm_update_notes
(bfd *, const char *);
extern unsigned int bfd_arm_get_mach_from_notes
(bfd *, const char *);
/* ARM stub generation support. Called from the linker. */
extern int elf32_arm_setup_section_lists
(bfd *, struct bfd_link_info *);
extern void elf32_arm_next_input_section
(struct bfd_link_info *, struct bfd_section *);
extern bfd_boolean elf32_arm_size_stubs
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
struct bfd_section * (*) (const char *, struct bfd_section *,
struct bfd_section *, unsigned int),
void (*) (void));
extern bfd_boolean elf32_arm_build_stubs
(struct bfd_link_info *);
/* ARM unwind section editing support. */
extern bfd_boolean elf32_arm_fix_exidx_coverage
(struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean);
/* C6x unwind section editing support. */
extern bfd_boolean elf32_tic6x_fix_exidx_coverage
(struct bfd_section **, unsigned int, struct bfd_link_info *, bfd_boolean);
extern void bfd_elf64_aarch64_init_maps
(bfd *);
extern void bfd_elf32_aarch64_init_maps
(bfd *);
extern void bfd_elf64_aarch64_set_options
(bfd *, struct bfd_link_info *, int, int, int, int, int, int);
extern void bfd_elf32_aarch64_set_options
(bfd *, struct bfd_link_info *, int, int, int, int, int, int);
/* ELF AArch64 mapping symbol support. */
#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0)
#define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG (1 << 1)
#define BFD_AARCH64_SPECIAL_SYM_TYPE_OTHER (1 << 2)
#define BFD_AARCH64_SPECIAL_SYM_TYPE_ANY (~0)
extern bfd_boolean bfd_is_aarch64_special_symbol_name
(const char * name, int type);
/* AArch64 stub generation support for ELF64. Called from the linker. */
extern int elf64_aarch64_setup_section_lists
(bfd *, struct bfd_link_info *);
extern void elf64_aarch64_next_input_section
(struct bfd_link_info *, struct bfd_section *);
extern bfd_boolean elf64_aarch64_size_stubs
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
struct bfd_section * (*) (const char *, struct bfd_section *),
void (*) (void));
extern bfd_boolean elf64_aarch64_build_stubs
(struct bfd_link_info *);
/* AArch64 stub generation support for ELF32. Called from the linker. */
extern int elf32_aarch64_setup_section_lists
(bfd *, struct bfd_link_info *);
extern void elf32_aarch64_next_input_section
(struct bfd_link_info *, struct bfd_section *);
extern bfd_boolean elf32_aarch64_size_stubs
(bfd *, bfd *, struct bfd_link_info *, bfd_signed_vma,
struct bfd_section * (*) (const char *, struct bfd_section *),
void (*) (void));
extern bfd_boolean elf32_aarch64_build_stubs
(struct bfd_link_info *);
/* TI COFF load page support. */
extern void bfd_ticoff_set_section_load_page
(struct bfd_section *, int);
extern int bfd_ticoff_get_section_load_page
(struct bfd_section *);
/* H8/300 functions. */
extern bfd_vma bfd_h8300_pad_address
(bfd *, bfd_vma);
/* IA64 Itanium code generation. Called from linker. */
extern void bfd_elf32_ia64_after_parse
(int);
extern void bfd_elf64_ia64_after_parse
(int);
/* V850 Note manipulation routines. */
extern bfd_boolean v850_elf_create_sections
(struct bfd_link_info *);
extern bfd_boolean v850_elf_set_note
(bfd *, unsigned int, unsigned int);
/* MIPS ABI flags data access. For the disassembler. */
struct elf_internal_abiflags_v0;
extern struct elf_internal_abiflags_v0 *bfd_mips_elf_get_abiflags (bfd *);
return strncmp (str, prefix, strlen (prefix)) == 0;
}
+1233 -1177
View File
File diff suppressed because it is too large Load Diff
+443 -230
View File
File diff suppressed because it is too large Load Diff
+11 -7
View File
@@ -1,6 +1,6 @@
dnl This file was derived from acinclude.m4.
dnl
dnl Copyright (C) 2012-2018 Free Software Foundation, Inc.
dnl Copyright (C) 2012-2022 Free Software Foundation, Inc.
dnl
dnl This file is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@@ -17,15 +17,20 @@ dnl along with this program; see the file COPYING3. If not see
dnl <http://www.gnu.org/licenses/>.
dnl
dnl Check for sys/procfs.h, enforcing structured /proc on Solaris.
AC_DEFUN([BFD_SYS_PROCFS_H],
[AC_DEFINE(_STRUCTURED_PROC, 1, [Use structured /proc on Solaris.])
AC_CHECK_HEADERS(sys/procfs.h)])
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_REQUIRE([BFD_SYS_PROCFS_H])
AC_MSG_CHECKING([for $1 in sys/procfs.h])
AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_$1,
[AC_TRY_COMPILE([
#define _SYSCALL32
/* Needed for new procfs interface on sparc-solaris. */
#define _STRUCTURED_PROC 1
#include <sys/procfs.h>],
[$1 avar],
bfd_cv_have_sys_procfs_type_$1=yes,
@@ -41,12 +46,11 @@ AC_DEFUN([BFD_HAVE_SYS_PROCFS_TYPE],
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_REQUIRE([BFD_SYS_PROCFS_H])
AC_MSG_CHECKING([for $1.$2 in sys/procfs.h])
AC_CACHE_VAL(bfd_cv_have_sys_procfs_type_member_$1_$2,
[AC_TRY_COMPILE([
#define _SYSCALL32
/* Needed for new procfs interface on sparc-solaris. */
#define _STRUCTURED_PROC 1
#include <sys/procfs.h>],
[$1 avar; void* aref = (void*) &avar.$2],
bfd_cv_have_sys_procfs_type_member_$1_$2=yes,
+107 -20
View File
@@ -1,6 +1,6 @@
/* Low-level I/O routines for BFDs.
Copyright (C) 1990-2018 Free Software Foundation, Inc.
Copyright (C) 1990-2022 Free Software Foundation, Inc.
Written by Cygnus Support.
@@ -25,6 +25,11 @@
#include <limits.h>
#include "bfd.h"
#include "libbfd.h"
#include "aout/ar.h"
#if defined (_WIN32)
#include <windows.h>
#include <locale.h>
#endif
#ifndef S_IXUSR
#define S_IXUSR 0100 /* Execute by owner. */
@@ -92,12 +97,7 @@ _bfd_real_fopen (const char *filename, const char *modes)
In fopen-vms.h, they are separated from the mode with a comma.
Split here. */
vms_attr = strchr (modes, ',');
if (vms_attr == NULL)
{
/* No attributes. */
return close_on_exec (fopen (filename, modes));
}
else
if (vms_attr != NULL)
{
/* Attributes found. Split. */
size_t modes_len = strlen (modes) + 1;
@@ -115,13 +115,62 @@ _bfd_real_fopen (const char *filename, const char *modes)
}
return close_on_exec (fopen (filename, at[0], at[1], at[2]));
}
#else /* !VMS */
#if defined (HAVE_FOPEN64)
#elif defined (_WIN32)
/* PR 25713: Handle extra long path names possibly containing '..' and '.'. */
wchar_t ** lpFilePart = {NULL};
const wchar_t prefix[] = L"\\\\?\\";
const size_t partPathLen = strlen (filename) + 1;
#ifdef __MINGW32__
const unsigned int cp = ___lc_codepage_func();
#else
const unsigned int cp = CP_UTF8;
#endif
/* Converting the partial path from ascii to unicode.
1) Get the length: Calling with lpWideCharStr set to null returns the length.
2) Convert the string: Calling with cbMultiByte set to -1 includes the terminating null. */
size_t partPathWSize = MultiByteToWideChar (cp, 0, filename, -1, NULL, 0);
wchar_t * partPath = calloc (partPathWSize, sizeof(wchar_t));
size_t ix;
MultiByteToWideChar (cp, 0, filename, -1, partPath, partPathWSize);
/* Convert any UNIX style path separators into the DOS i.e. backslash separator. */
for (ix = 0; ix < partPathLen; ix++)
if (IS_UNIX_DIR_SEPARATOR(filename[ix]))
partPath[ix] = '\\';
/* Getting the full path from the provided partial path.
1) Get the length.
2) Resolve the path. */
long fullPathWSize = GetFullPathNameW (partPath, 0, NULL, lpFilePart);
wchar_t * fullPath = calloc (fullPathWSize + sizeof(prefix) + 1, sizeof(wchar_t));
wcscpy (fullPath, prefix);
int prefixLen = sizeof(prefix) / sizeof(wchar_t);
wchar_t * fullPathOffset = fullPath + prefixLen - 1;
GetFullPathNameW (partPath, fullPathWSize, fullPathOffset, lpFilePart);
free (partPath);
/* It is non-standard for modes to exceed 16 characters. */
wchar_t modesW[16];
MultiByteToWideChar (cp, 0, modes, -1, modesW, sizeof(modesW));
FILE * file = _wfopen (fullPath, modesW);
free (fullPath);
return close_on_exec (file);
#elif defined (HAVE_FOPEN64)
return close_on_exec (fopen64 (filename, modes));
#else
return close_on_exec (fopen (filename, modes));
#endif
#endif /* !VMS */
}
/*
@@ -186,10 +235,13 @@ bfd_bread (void *ptr, bfd_size_type size, bfd *abfd)
offset += abfd->origin;
abfd = abfd->my_archive;
}
offset += abfd->origin;
/* If this is an archive element, don't read past the end of
/* If this is a non-thin archive element, don't read past the end of
this element. */
if (element_bfd->arelt_data != NULL)
if (element_bfd->arelt_data != NULL
&& element_bfd->my_archive != NULL
&& !bfd_is_thin_archive (element_bfd->my_archive))
{
bfd_size_type maxbytes = arelt_size (element_bfd);
@@ -255,6 +307,7 @@ bfd_tell (bfd *abfd)
offset += abfd->origin;
abfd = abfd->my_archive;
}
offset += abfd->origin;
if (abfd->iovec == NULL)
return 0;
@@ -315,6 +368,7 @@ bfd_seek (bfd *abfd, file_ptr position, int direction)
offset += abfd->origin;
abfd = abfd->my_archive;
}
offset += abfd->origin;
if (abfd->iovec == NULL)
{
@@ -415,17 +469,32 @@ DESCRIPTION
of space for the 15 bazillon byte table it is about to read.
This function at least allows us to answer the question, "is the
size reasonable?".
A return value of zero indicates the file size is unknown.
*/
ufile_ptr
bfd_get_size (bfd *abfd)
{
struct stat buf;
/* A size of 0 means we haven't yet called bfd_stat. A size of 1
means we have a cached value of 0, ie. unknown. */
if (abfd->size <= 1 || bfd_write_p (abfd))
{
struct stat buf;
if (bfd_stat (abfd, &buf) != 0)
return 0;
if (abfd->size == 1 && !bfd_write_p (abfd))
return 0;
return buf.st_size;
if (bfd_stat (abfd, &buf) != 0
|| buf.st_size == 0
|| buf.st_size - (ufile_ptr) buf.st_size != 0)
{
abfd->size = 1;
return 0;
}
abfd->size = buf.st_size;
}
return abfd->size;
}
/*
@@ -445,11 +514,29 @@ DESCRIPTION
ufile_ptr
bfd_get_file_size (bfd *abfd)
{
ufile_ptr file_size, archive_size = (ufile_ptr) -1;
if (abfd->my_archive != NULL
&& !bfd_is_thin_archive (abfd->my_archive))
return arelt_size (abfd);
{
struct areltdata *adata = (struct areltdata *) abfd->arelt_data;
if (adata != NULL)
{
archive_size = adata->parsed_size;
/* If the archive is compressed we can't compare against
file size. */
if (adata->arch_header != NULL
&& memcmp (((struct ar_hdr *) adata->arch_header)->ar_fmag,
"Z\012", 2) == 0)
return archive_size;
abfd = abfd->my_archive;
}
}
return bfd_get_size (abfd);
file_size = bfd_get_size (abfd);
if (archive_size < file_size)
return archive_size;
return file_size;
}
/*
@@ -479,6 +566,7 @@ bfd_mmap (bfd *abfd, void *addr, bfd_size_type len,
offset += abfd->origin;
abfd = abfd->my_archive;
}
offset += abfd->origin;
if (abfd->iovec == NULL)
{
@@ -606,8 +694,7 @@ memory_bclose (struct bfd *abfd)
{
struct bfd_in_memory *bim = (struct bfd_in_memory *) abfd->iostream;
if (bim->buffer != NULL)
free (bim->buffer);
free (bim->buffer);
free (bim);
abfd->iostream = NULL;
+9 -8
View File
@@ -1,5 +1,5 @@
/* Support for memory-mapped windows into a BFD.
Copyright (C) 1995-2018 Free Software Foundation, Inc.
Copyright (C) 1995-2022 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -104,12 +104,12 @@ bfd_free_window (bfd_window *windowp)
static int ok_to_map = 1;
bfd_boolean
bool
bfd_get_file_window (bfd *abfd,
file_ptr offset,
bfd_size_type size,
bfd_window *windowp,
bfd_boolean writable)
bool writable)
{
static size_t pagesize;
bfd_window_internal *i = windowp->i;
@@ -131,7 +131,7 @@ bfd_get_file_window (bfd *abfd,
{
i = bfd_zmalloc (sizeof (bfd_window_internal));
if (i == NULL)
return FALSE;
return false;
i->data = NULL;
}
#ifdef HAVE_MMAP
@@ -150,6 +150,7 @@ bfd_get_file_window (bfd *abfd,
offset += abfd->origin;
abfd = abfd->my_archive;
}
offset += abfd->origin;
/* Seek into the file, to ensure it is open if cacheable. */
if (abfd->iostream == NULL
@@ -198,7 +199,7 @@ bfd_get_file_window (bfd *abfd,
i->mapped = 1;
i->refcount = 1;
windowp->i = i;
return TRUE;
return true;
}
else if (debug_windows)
{
@@ -230,7 +231,7 @@ bfd_get_file_window (bfd *abfd,
if (size_to_alloc == 0)
{
windowp->i = i;
return TRUE;
return true;
}
goto free_and_fail;
}
@@ -253,12 +254,12 @@ bfd_get_file_window (bfd *abfd,
windowp->data = i->data;
windowp->size = i->size;
windowp->i = i;
return TRUE;
return true;
free_and_fail:
/* We have a bfd_window_internal, but an error occurred. Free it. */
free (i);
return FALSE;
return false;
}
#endif /* USE_MMAP */
+27 -25
View File
@@ -1,5 +1,5 @@
/* BFD back-end for binary objects.
Copyright (C) 1994-2018 Free Software Foundation, Inc.
Copyright (C) 1994-2022 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.
@@ -19,10 +19,10 @@
Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
/* This is a BFD backend which may be used to write binary objects.
It may only be used for output, not input. The intention is that
this may be used as an output format for objcopy in order to
generate raw binary data.
/* This is a BFD backend which may be used to read or write binary
objects. Historically, it was used as an output format for objcopy
in order to generate raw binary data, but is now used for other
purposes as well.
This is very simple. The only complication is that the real data
will start at some address X, and in some cases we will not want to
@@ -43,17 +43,17 @@
/* Create a binary object. Invoked via bfd_set_format. */
static bfd_boolean
static bool
binary_mkobject (bfd *abfd ATTRIBUTE_UNUSED)
{
return TRUE;
return true;
}
/* Any file may be considered to be a binary file, provided the target
was not defaulted. That is, it must be explicitly specified as
being binary. */
static const bfd_target *
static bfd_cleanup
binary_object_p (bfd *abfd)
{
struct stat statbuf;
@@ -86,7 +86,7 @@ binary_object_p (bfd *abfd)
abfd->tdata.any = (void *) sec;
return abfd->xvec;
return _bfd_no_cleanup;
}
#define binary_close_and_cleanup _bfd_generic_close_and_cleanup
@@ -95,17 +95,17 @@ binary_object_p (bfd *abfd)
/* Get contents of the only section. */
static bfd_boolean
static bool
binary_get_section_contents (bfd *abfd,
asection *section ATTRIBUTE_UNUSED,
asection *section,
void * location,
file_ptr offset,
bfd_size_type count)
{
if (bfd_seek (abfd, offset, SEEK_SET) != 0
if (bfd_seek (abfd, section->filepos + offset, SEEK_SET) != 0
|| bfd_bread (location, count, abfd) != count)
return FALSE;
return TRUE;
return false;
return true;
}
/* Return the amount of memory needed to read the symbol table. */
@@ -151,7 +151,7 @@ binary_canonicalize_symtab (bfd *abfd, asymbol **alocation)
asection *sec = (asection *) abfd->tdata.any;
asymbol *syms;
unsigned int i;
bfd_size_type amt = BIN_SYMS * sizeof (asymbol);
size_t amt = BIN_SYMS * sizeof (asymbol);
syms = (asymbol *) bfd_alloc (abfd, amt);
if (syms == NULL)
@@ -218,7 +218,7 @@ binary_get_symbol_info (bfd *ignore_abfd ATTRIBUTE_UNUSED,
/* Write section contents of a binary file. */
static bfd_boolean
static bool
binary_set_section_contents (bfd *abfd,
asection *sec,
const void * data,
@@ -226,19 +226,18 @@ binary_set_section_contents (bfd *abfd,
bfd_size_type size)
{
if (size == 0)
return TRUE;
return true;
if (! abfd->output_has_begun)
{
unsigned int opb;
bfd_boolean found_low;
bool found_low;
bfd_vma low;
asection *s;
/* The lowest section LMA sets the virtual address of the start
of the file. We use this to set the file position of all the
sections. */
found_low = FALSE;
found_low = false;
low = 0;
for (s = abfd->sections; s != NULL; s = s->next)
if (((s->flags
@@ -248,12 +247,13 @@ binary_set_section_contents (bfd *abfd,
&& (! found_low || s->lma < low))
{
low = s->lma;
found_low = TRUE;
found_low = true;
}
opb = bfd_octets_per_byte (abfd);
for (s = abfd->sections; s != NULL; s = s->next)
{
unsigned int opb = bfd_octets_per_byte (abfd, s);
s->filepos = (s->lma - low) * opb;
/* Skip following warning check for sections that will not
@@ -278,16 +278,16 @@ binary_set_section_contents (bfd *abfd,
s);
}
abfd->output_has_begun = TRUE;
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;
return true;
if ((sec->flags & SEC_NEVER_LOAD) != 0)
return TRUE;
return true;
return _bfd_generic_set_section_contents (abfd, sec, data, offset, size);
}
@@ -307,6 +307,7 @@ binary_sizeof_headers (bfd *abfd ATTRIBUTE_UNUSED,
#define binary_bfd_lookup_section_flags bfd_generic_lookup_section_flags
#define binary_bfd_merge_sections bfd_generic_merge_sections
#define binary_bfd_is_group_section bfd_generic_is_group_section
#define binary_bfd_group_name bfd_generic_group_name
#define binary_bfd_discard_group bfd_generic_discard_group
#define binary_section_already_linked _bfd_generic_section_already_linked
#define binary_bfd_define_common_symbol bfd_generic_define_common_symbol
@@ -334,6 +335,7 @@ const bfd_target binary_vec =
' ', /* ar_pad_char */
16, /* ar_max_namelen */
255, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
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 */
+29 -27
View File
@@ -1,6 +1,6 @@
/* BFD library -- caching of file descriptors.
Copyright (C) 1990-2018 Free Software Foundation, Inc.
Copyright (C) 1990-2022 Free Software Foundation, Inc.
Hacked by Steve Chamberlain of Cygnus Support (steve@cygnus.com).
@@ -44,7 +44,6 @@ SUBSECTION
#include "bfd.h"
#include "libbfd.h"
#include "libiberty.h"
#include "bfd_stdint.h"
#ifdef HAVE_MMAP
#include <sys/mman.h>
@@ -161,16 +160,16 @@ snip (bfd *abfd)
/* Close a BFD and remove it from the cache. */
static bfd_boolean
static bool
bfd_cache_delete (bfd *abfd)
{
bfd_boolean ret;
bool ret;
if (fclose ((FILE *) abfd->iostream) == 0)
ret = TRUE;
ret = true;
else
{
ret = FALSE;
ret = false;
bfd_set_error (bfd_error_system_call);
}
@@ -185,7 +184,7 @@ bfd_cache_delete (bfd *abfd)
/* We need to open a new file, and the cache is full. Find the least
recently used cacheable BFD and close it. */
static bfd_boolean
static bool
close_one (void)
{
register bfd *to_kill;
@@ -209,7 +208,7 @@ close_one (void)
if (to_kill == NULL)
{
/* There are no open cacheable BFD's. */
return TRUE;
return true;
}
to_kill->where = _bfd_real_ftell ((FILE *) to_kill->iostream);
@@ -486,25 +485,25 @@ INTERNAL_FUNCTION
bfd_cache_init
SYNOPSIS
bfd_boolean bfd_cache_init (bfd *abfd);
bool bfd_cache_init (bfd *abfd);
DESCRIPTION
Add a newly opened BFD to the cache.
*/
bfd_boolean
bool
bfd_cache_init (bfd *abfd)
{
BFD_ASSERT (abfd->iostream != NULL);
if (open_files >= bfd_cache_max_open ())
{
if (! close_one ())
return FALSE;
return false;
}
abfd->iovec = &cache_iovec;
insert (abfd);
++open_files;
return TRUE;
return true;
}
/*
@@ -512,7 +511,7 @@ INTERNAL_FUNCTION
bfd_cache_close
SYNOPSIS
bfd_boolean bfd_cache_close (bfd *abfd);
bool bfd_cache_close (bfd *abfd);
DESCRIPTION
Remove the BFD @var{abfd} from the cache. If the attached file is open,
@@ -523,15 +522,15 @@ RETURNS
returned if all is well.
*/
bfd_boolean
bool
bfd_cache_close (bfd *abfd)
{
if (abfd->iovec != &cache_iovec)
return TRUE;
return true;
if (abfd->iostream == NULL)
/* Previously closed. */
return TRUE;
return true;
return bfd_cache_delete (abfd);
}
@@ -541,7 +540,7 @@ FUNCTION
bfd_cache_close_all
SYNOPSIS
bfd_boolean bfd_cache_close_all (void);
bool bfd_cache_close_all (void);
DESCRIPTION
Remove all BFDs from the cache. If the attached file is open,
@@ -552,10 +551,10 @@ RETURNS
returned if all is well.
*/
bfd_boolean
bool
bfd_cache_close_all (void)
{
bfd_boolean ret = TRUE;
bool ret = true;
while (bfd_last_cache != NULL)
ret &= bfd_cache_close (bfd_last_cache);
@@ -581,7 +580,7 @@ DESCRIPTION
FILE *
bfd_open_file (bfd *abfd)
{
abfd->cacheable = TRUE; /* Allow it to be closed later. */
abfd->cacheable = true; /* Allow it to be closed later. */
if (open_files >= bfd_cache_max_open ())
{
@@ -593,15 +592,17 @@ bfd_open_file (bfd *abfd)
{
case read_direction:
case no_direction:
abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_RB);
abfd->iostream = _bfd_real_fopen (bfd_get_filename (abfd), FOPEN_RB);
break;
case both_direction:
case write_direction:
if (abfd->opened_once)
{
abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_RUB);
abfd->iostream = _bfd_real_fopen (bfd_get_filename (abfd),
FOPEN_RUB);
if (abfd->iostream == NULL)
abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_WUB);
abfd->iostream = _bfd_real_fopen (bfd_get_filename (abfd),
FOPEN_WUB);
}
else
{
@@ -628,11 +629,12 @@ bfd_open_file (bfd *abfd)
the --info option. */
struct stat s;
if (stat (abfd->filename, &s) == 0 && s.st_size != 0)
unlink_if_ordinary (abfd->filename);
if (stat (bfd_get_filename (abfd), &s) == 0 && s.st_size != 0)
unlink_if_ordinary (bfd_get_filename (abfd));
#endif
abfd->iostream = _bfd_real_fopen (abfd->filename, FOPEN_WUB);
abfd->opened_once = TRUE;
abfd->iostream = _bfd_real_fopen (bfd_get_filename (abfd),
FOPEN_WUB);
abfd->opened_once = true;
}
break;
}
+1 -1
View File
@@ -1,5 +1,5 @@
/* BFD back-end for Intel 386 COFF LynxOS files.
Copyright (C) 1993-2018 Free Software Foundation, Inc.
Copyright (C) 1993-2022 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
+11 -9
View File
@@ -1,5 +1,5 @@
/* BFD back-end for CISCO crash dumps.
Copyright (C) 1994-2018 Free Software Foundation, Inc.
Copyright (C) 1994-2022 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -80,7 +80,7 @@ struct cisco_core_struct
/* Examine the file for a crash info struct at the offset given by
CRASH_INFO_LOC. */
static const bfd_target *
static bfd_cleanup
cisco_core_file_validate (bfd *abfd, int crash_info_loc)
{
char buf[4];
@@ -92,7 +92,7 @@ cisco_core_file_validate (bfd *abfd, int crash_info_loc)
unsigned int rambase;
sec_ptr asect;
struct stat statbuf;
bfd_size_type amt;
size_t amt;
flagword flags;
if (bfd_seek (abfd, (file_ptr) crash_info_loc, SEEK_SET) != 0)
@@ -274,7 +274,7 @@ cisco_core_file_validate (bfd *abfd, int crash_info_loc)
nread = statbuf.st_size - asect->filepos;
asect->size = (nread < 1024) ? nread : 1024;
return abfd->xvec;
return _bfd_no_cleanup;
/* Get here if we have already started filling out the BFD
and there is an error of some kind. */
@@ -286,19 +286,19 @@ cisco_core_file_validate (bfd *abfd, int crash_info_loc)
return NULL;
}
static const bfd_target *
static bfd_cleanup
cisco_core_file_p (bfd *abfd)
{
int *crash_info_locp;
const bfd_target *target = NULL;
bfd_cleanup cleanup = NULL;
for (crash_info_locp = crash_info_locs;
*crash_info_locp != -1 && target == NULL;
*crash_info_locp != -1 && cleanup == NULL;
crash_info_locp++)
{
target = cisco_core_file_validate (abfd, *crash_info_locp);
cleanup = cisco_core_file_validate (abfd, *crash_info_locp);
}
return (target);
return cleanup;
}
static char *
@@ -329,6 +329,7 @@ const bfd_target core_cisco_be_vec =
' ', /* ar_pad_char */
16, /* ar_max_namelen */
0, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
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 */
@@ -384,6 +385,7 @@ const bfd_target core_cisco_le_vec =
' ', /* ar_pad_char */
16, /* ar_max_namelen */
0, /* match_priority */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
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 */
+166
View File
@@ -0,0 +1,166 @@
/* BFD back-end for AArch64 COFF files.
Copyright (C) 2021-2022 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#ifndef COFF_WITH_peAArch64
#define COFF_WITH_peAArch64
#endif
/* Note we have to make sure not to include headers twice.
Not all headers are wrapped in #ifdef guards, so we define
PEI_HEADERS to prevent double including here. */
#ifndef PEI_HEADERS
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
#include "coff/aarch64.h"
#include "coff/internal.h"
#include "coff/pe.h"
#include "libcoff.h"
#include "libiberty.h"
#endif
#include "libcoff.h"
/* The page size is a guess based on ELF. */
#define COFF_PAGE_SIZE 0x1000
/* All users of this file have bfd_octets_per_byte (abfd, sec) == 1. */
#define OCTETS_PER_BYTE(ABFD, SEC) 1
#ifndef PCRELOFFSET
#define PCRELOFFSET true
#endif
/* Currently we don't handle any relocations. */
static reloc_howto_type pe_aarch64_std_reloc_howto[] =
{
};
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 2
#define COFF_PAGE_SIZE 0x1000
#ifndef NUM_ELEM
#define NUM_ELEM(a) ((sizeof (a)) / sizeof ((a)[0]))
#endif
#define NUM_RELOCS NUM_ELEM (pe_aarch64_std_reloc_howto)
#define RTYPE2HOWTO(cache_ptr, dst) \
(cache_ptr)->howto = NULL
#ifndef bfd_pe_print_pdata
#define bfd_pe_print_pdata NULL
#endif
/* Return TRUE if this relocation should
appear in the output .reloc section. */
static bool
in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED,
reloc_howto_type * howto)
{
return !howto->pc_relative;
}
#include "coffcode.h"
/* Target vectors. */
const bfd_target
#ifdef TARGET_SYM
TARGET_SYM =
#else
aarch64_pei_vec =
#endif
{
#ifdef TARGET_NAME
TARGET_NAME,
#else
"pei-aarch64-little", /* 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 | BFD_COMPRESS | BFD_DECOMPRESS),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* Section flags. */
#if defined(COFF_WITH_PE)
| SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY | SEC_DEBUGGING
#endif
| SEC_CODE | SEC_DATA | SEC_EXCLUDE ),
#ifdef TARGET_UNDERSCORE
TARGET_UNDERSCORE, /* Leading underscore. */
#else
0, /* Leading underscore. */
#endif
'/', /* Ar_pad_char. */
15, /* Ar_max_namelen. */
0, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
/* Data conversion functions. */
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. */
/* Header conversion functions. */
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_check_format. */
_bfd_dummy_target,
coff_object_p,
bfd_generic_archive_p,
coff_object_p
},
{ /* bfd_set_format. */
_bfd_bool_bfd_false_error,
coff_mkobject,
_bfd_generic_mkarchive,
_bfd_bool_bfd_false_error
},
{ /* bfd_write_contents. */
_bfd_bool_bfd_false_error,
coff_write_object_contents,
_bfd_write_archive_contents,
_bfd_bool_bfd_false_error
},
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
};
+159 -140
View File
@@ -1,5 +1,5 @@
/* BFD back-end for ALPHA Extended-Coff files.
Copyright (C) 1993-2018 Free Software Foundation, Inc.
Copyright (C) 1993-2022 Free Software Foundation, Inc.
Modified from coff-mips.c by Steve Chamberlain <sac@cygnus.com> and
Ian Lance Taylor <ian@cygnus.com>.
@@ -116,81 +116,81 @@ static reloc_howto_type alpha_howto_table[] =
of the gp register are loaded. */
HOWTO (ALPHA_R_IGNORE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
1, /* size */
8, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
reloc_nil, /* special_function */
"IGNORE", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
TRUE), /* pcrel_offset */
true), /* pcrel_offset */
/* A 32 bit reference to a symbol. */
HOWTO (ALPHA_R_REFLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"REFLONG", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* A 64 bit reference to a symbol. */
HOWTO (ALPHA_R_REFQUAD, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
8, /* size */
64, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"REFQUAD", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* A 32 bit GP relative offset. This is just like REFLONG except
that when the value is used the value of the gp register will be
added in. */
HOWTO (ALPHA_R_GPREL32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"GPREL32", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* Used for an instruction that refers to memory off the GP
register. The offset is 16 bits of the 32 bit instruction. This
reloc always seems to be against the .lita section. */
HOWTO (ALPHA_R_LITERAL, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
16, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"LITERAL", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* This reloc only appears immediately following a LITERAL reloc.
It identifies a use of the literal. It seems that the linker can
@@ -203,17 +203,17 @@ static reloc_howto_type alpha_howto_table[] =
relocation. */
HOWTO (ALPHA_R_LITUSE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
reloc_nil, /* special_function */
"LITUSE", /* name */
FALSE, /* partial_inplace */
false, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* Load the gp register. This is always used for a ldah instruction
which loads the upper 16 bits of the gp register. The next reloc
@@ -228,180 +228,180 @@ static reloc_howto_type alpha_howto_table[] =
address. */
HOWTO (ALPHA_R_GPDISP, /* type */
16, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
16, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
reloc_nil, /* special_function */
"GPDISP", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
TRUE), /* pcrel_offset */
true), /* pcrel_offset */
/* A 21 bit branch. The native assembler generates these for
branches within the text segment, and also fills in the PC
relative offset in the instruction. */
HOWTO (ALPHA_R_BRADDR, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
21, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"BRADDR", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0x1fffff, /* src_mask */
0x1fffff, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* A hint for a jump to a register. */
HOWTO (ALPHA_R_HINT, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
14, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"HINT", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0x3fff, /* src_mask */
0x3fff, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* 16 bit PC relative offset. */
HOWTO (ALPHA_R_SREL16, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
2, /* size */
16, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"SREL16", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* 32 bit PC relative offset. */
HOWTO (ALPHA_R_SREL32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"SREL32", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* A 64 bit PC relative offset. */
HOWTO (ALPHA_R_SREL64, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
8, /* size */
64, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"SREL64", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
MINUS_ONE, /* src_mask */
MINUS_ONE, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* Push a value on the reloc evaluation stack. */
HOWTO (ALPHA_R_OP_PUSH, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* size */
0, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"OP_PUSH", /* name */
FALSE, /* partial_inplace */
false, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* Store the value from the stack at the given address. Store it in
a bitfield of size r_size starting at bit position r_offset. */
HOWTO (ALPHA_R_OP_STORE, /* type */
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
8, /* size */
64, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"OP_STORE", /* name */
FALSE, /* partial_inplace */
false, /* partial_inplace */
0, /* src_mask */
MINUS_ONE, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* Subtract the reloc address from the value on the top of the
relocation stack. */
HOWTO (ALPHA_R_OP_PSUB, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* size */
0, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"OP_PSUB", /* name */
FALSE, /* partial_inplace */
false, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* Shift the value on the top of the relocation stack right by the
given value. */
HOWTO (ALPHA_R_OP_PRSHIFT, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* size */
0, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"OP_PRSHIFT", /* name */
FALSE, /* partial_inplace */
false, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* Adjust the GP value for a new range in the object file. */
HOWTO (ALPHA_R_GPVALUE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* size */
0, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"GPVALUE", /* name */
FALSE, /* partial_inplace */
false, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE) /* pcrel_offset */
false) /* pcrel_offset */
};
/* Recognize an Alpha ECOFF file. */
static const bfd_target *
static bfd_cleanup
alpha_ecoff_object_p (bfd *abfd)
{
static const bfd_target *ret;
bfd_cleanup ret;
ret = coff_object_p (abfd);
@@ -423,10 +423,10 @@ alpha_ecoff_object_p (bfd *abfd)
{
bfd_size_type size;
size = sec->line_filepos * 8;
size = (bfd_size_type) sec->line_filepos * 8;
BFD_ASSERT (size == sec->size
|| size + 8 == sec->size);
if (! bfd_set_section_size (abfd, sec, size))
if (!bfd_set_section_size (sec, size))
return NULL;
}
}
@@ -436,14 +436,14 @@ alpha_ecoff_object_p (bfd *abfd)
/* See whether the magic number matches. */
static bfd_boolean
static bool
alpha_ecoff_bad_format_hook (bfd *abfd ATTRIBUTE_UNUSED,
void * filehdr)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
if (! ALPHA_ECOFF_BADMAG (*internal_f))
return TRUE;
return true;
if (ALPHA_ECOFF_COMPRESSEDMAG (*internal_f))
_bfd_error_handler
@@ -451,7 +451,7 @@ alpha_ecoff_bad_format_hook (bfd *abfd ATTRIBUTE_UNUSED,
"use compiler flags, or objZ, to generate uncompressed binaries"),
abfd);
return FALSE;
return false;
}
/* This is a hook called by coff_real_object_p to create any backend
@@ -727,30 +727,36 @@ alpha_ecoff_get_relocated_section_contents (bfd *abfd,
struct bfd_link_info *link_info,
struct bfd_link_order *link_order,
bfd_byte *data,
bfd_boolean relocatable,
bool relocatable,
asymbol **symbols)
{
bfd *input_bfd = link_order->u.indirect.section->owner;
asection *input_section = link_order->u.indirect.section;
long reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
arelent **reloc_vector = NULL;
long reloc_size;
arelent **reloc_vector;
long reloc_count;
bfd *output_bfd = relocatable ? abfd : (bfd *) NULL;
bfd_vma gp;
bfd_size_type sz;
bfd_boolean gp_undefined;
bool gp_undefined;
bfd_vma stack[RELOC_STACKSIZE];
int tos = 0;
reloc_size = bfd_get_reloc_upper_bound (input_bfd, input_section);
if (reloc_size < 0)
goto error_return;
reloc_vector = (arelent **) bfd_malloc ((bfd_size_type) reloc_size);
if (reloc_vector == NULL && reloc_size != 0)
goto error_return;
return NULL;
sz = input_section->rawsize ? input_section->rawsize : input_section->size;
if (! bfd_get_section_contents (input_bfd, input_section, data, 0, sz))
goto error_return;
if (!bfd_get_full_section_contents (input_bfd, input_section, &data))
return NULL;
if (data == NULL)
return NULL;
if (reloc_size == 0)
return data;
reloc_vector = (arelent **) bfd_malloc (reloc_size);
if (reloc_vector == NULL)
return NULL;
reloc_count = bfd_canonicalize_reloc (input_bfd, input_section,
reloc_vector, symbols);
@@ -760,7 +766,7 @@ alpha_ecoff_get_relocated_section_contents (bfd *abfd,
goto successful_return;
/* Get the GP value for the output BFD. */
gp_undefined = FALSE;
gp_undefined = false;
gp = _bfd_get_gp_value (abfd);
if (gp == 0)
{
@@ -788,11 +794,11 @@ alpha_ecoff_get_relocated_section_contents (bfd *abfd,
{
struct bfd_link_hash_entry *h;
h = bfd_link_hash_lookup (link_info->hash, "_gp", FALSE, FALSE,
TRUE);
h = bfd_link_hash_lookup (link_info->hash, "_gp", false, false,
true);
if (h == (struct bfd_link_hash_entry *) NULL
|| h->type != bfd_link_hash_defined)
gp_undefined = TRUE;
gp_undefined = true;
else
{
gp = (h->u.def.value
@@ -1080,7 +1086,7 @@ alpha_ecoff_get_relocated_section_contents (bfd *abfd,
case ALPHA_R_GPVALUE:
/* I really don't know if this does the right thing. */
gp = rel->addend;
gp_undefined = FALSE;
gp_undefined = false;
break;
default:
@@ -1103,7 +1109,7 @@ alpha_ecoff_get_relocated_section_contents (bfd *abfd,
case bfd_reloc_undefined:
(*link_info->callbacks->undefined_symbol)
(link_info, bfd_asymbol_name (*rel->sym_ptr_ptr),
input_bfd, input_section, rel->address, TRUE);
input_bfd, input_section, rel->address, true);
break;
case bfd_reloc_dangerous:
(*link_info->callbacks->reloc_dangerous)
@@ -1127,13 +1133,11 @@ alpha_ecoff_get_relocated_section_contents (bfd *abfd,
abort ();
successful_return:
if (reloc_vector != NULL)
free (reloc_vector);
free (reloc_vector);
return data;
error_return:
if (reloc_vector != NULL)
free (reloc_vector);
free (reloc_vector);
return NULL;
}
@@ -1237,7 +1241,7 @@ alpha_convert_external_reloc (bfd *output_bfd ATTRIBUTE_UNUSED,
/* Compute a new r_symndx value. */
hsec = h->root.u.def.section;
name = bfd_get_section_name (output_bfd, hsec->output_section);
name = bfd_section_name (hsec->output_section);
r_symndx = (unsigned long) -1;
switch (name[1])
@@ -1327,7 +1331,7 @@ alpha_convert_external_reloc (bfd *output_bfd ATTRIBUTE_UNUSED,
quite similar to get_relocated_section_contents. Perhaps they
could be combined somehow. */
static bfd_boolean
static bool
alpha_relocate_section (bfd *output_bfd,
struct bfd_link_info *info,
bfd *input_bfd,
@@ -1338,7 +1342,7 @@ alpha_relocate_section (bfd *output_bfd,
asection **symndx_to_section, *lita_sec;
struct ecoff_link_hash_entry **sym_hashes;
bfd_vma gp;
bfd_boolean gp_undefined;
bool gp_undefined;
bfd_vma stack[RELOC_STACKSIZE];
int tos = 0;
struct external_reloc *ext_rel;
@@ -1354,7 +1358,7 @@ alpha_relocate_section (bfd *output_bfd,
amt = NUM_RELOC_SECTIONS * sizeof (asection *);
symndx_to_section = (asection **) bfd_alloc (input_bfd, amt);
if (!symndx_to_section)
return FALSE;
return false;
symndx_to_section[RELOC_SECTION_NONE] = NULL;
symndx_to_section[RELOC_SECTION_TEXT] =
@@ -1443,7 +1447,7 @@ alpha_relocate_section (bfd *output_bfd,
_("using multiple gp values"),
(char *) NULL, output_bfd,
(asection *) NULL, (bfd_vma) 0);
ecoff_data (output_bfd)->issued_multiple_gp_warning = TRUE;
ecoff_data (output_bfd)->issued_multiple_gp_warning = true;
}
if (lita_vma < gp - 0x8000)
gp = lita_vma + lita_size - 0x8000;
@@ -1473,9 +1477,9 @@ alpha_relocate_section (bfd *output_bfd,
int r_extern;
int r_offset;
int r_size;
bfd_boolean relocatep;
bfd_boolean adjust_addrp;
bfd_boolean gp_usedp;
bool relocatep;
bool adjust_addrp;
bool gp_usedp;
bfd_vma addend;
r_vaddr = H_GET_64 (input_bfd, ext_rel->r_vaddr);
@@ -1490,9 +1494,9 @@ alpha_relocate_section (bfd *output_bfd,
r_size = ((ext_rel->r_bits[3] & RELOC_BITS3_SIZE_LITTLE)
>> RELOC_BITS3_SIZE_SH_LITTLE);
relocatep = FALSE;
adjust_addrp = TRUE;
gp_usedp = FALSE;
relocatep = false;
adjust_addrp = true;
gp_usedp = false;
addend = 0;
switch (r_type)
@@ -1526,13 +1530,13 @@ alpha_relocate_section (bfd *output_bfd,
if (bfd_link_relocatable (info))
H_PUT_64 (input_bfd, input_section->output_offset + r_vaddr,
ext_rel->r_vaddr);
adjust_addrp = FALSE;
adjust_addrp = false;
break;
case ALPHA_R_REFLONG:
case ALPHA_R_REFQUAD:
case ALPHA_R_HINT:
relocatep = TRUE;
relocatep = true;
break;
case ALPHA_R_BRADDR:
@@ -1541,7 +1545,7 @@ alpha_relocate_section (bfd *output_bfd,
case ALPHA_R_SREL64:
if (r_extern)
addend += - (r_vaddr + 4);
relocatep = TRUE;
relocatep = true;
break;
case ALPHA_R_GPREL32:
@@ -1549,9 +1553,9 @@ alpha_relocate_section (bfd *output_bfd,
bit offset from the current GP value. We must adjust it
by the different between the original GP value and the
current GP value. */
relocatep = TRUE;
relocatep = true;
addend = ecoff_data (input_bfd)->gp - gp;
gp_usedp = TRUE;
gp_usedp = true;
break;
case ALPHA_R_LITERAL:
@@ -1582,9 +1586,9 @@ alpha_relocate_section (bfd *output_bfd,
|| ((insn >> 26) & 0x3f) == 0x28);
}
relocatep = TRUE;
relocatep = true;
addend = ecoff_data (input_bfd)->gp - gp;
gp_usedp = TRUE;
gp_usedp = true;
break;
case ALPHA_R_LITUSE:
@@ -1648,7 +1652,7 @@ alpha_relocate_section (bfd *output_bfd,
bfd_put_32 (input_bfd, (bfd_vma) insn2,
contents + r_vaddr - input_section->vma + r_symndx);
gp_usedp = TRUE;
gp_usedp = true;
}
break;
@@ -1691,7 +1695,7 @@ alpha_relocate_section (bfd *output_bfd,
relocated. */
(*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd,
input_section, (bfd_vma) 0, TRUE);
input_section, (bfd_vma) 0, true);
addend = 0;
}
}
@@ -1746,7 +1750,7 @@ alpha_relocate_section (bfd *output_bfd,
}
}
adjust_addrp = FALSE;
adjust_addrp = false;
break;
case ALPHA_R_OP_STORE:
@@ -1783,7 +1787,7 @@ alpha_relocate_section (bfd *output_bfd,
case ALPHA_R_GPVALUE:
/* I really don't know if this does the right thing. */
gp = ecoff_data (input_bfd)->gp + r_symndx;
gp_undefined = FALSE;
gp_undefined = false;
break;
}
@@ -1888,7 +1892,7 @@ alpha_relocate_section (bfd *output_bfd,
{
(*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
r_vaddr - input_section->vma, TRUE);
r_vaddr - input_section->vma, true);
relocation = 0;
}
}
@@ -1928,8 +1932,7 @@ alpha_relocate_section (bfd *output_bfd,
if (r_extern)
name = sym_hashes[r_symndx]->root.root.string;
else
name = bfd_section_name (input_bfd,
symndx_to_section[r_symndx]);
name = bfd_section_name (symndx_to_section[r_symndx]);
(*info->callbacks->reloc_overflow)
(info, NULL, name, alpha_howto_table[r_type].name,
(bfd_vma) 0, input_bfd, input_section,
@@ -1959,20 +1962,20 @@ alpha_relocate_section (bfd *output_bfd,
/* Only give the error once per link. */
gp = 4;
_bfd_set_gp_value (output_bfd, gp);
gp_undefined = FALSE;
gp_undefined = false;
}
}
if (tos != 0)
abort ();
return TRUE;
return true;
}
/* Do final adjustments to the filehdr and the aouthdr. This routine
sets the dynamic bits in the file header. */
static bfd_boolean
static bool
alpha_adjust_headers (bfd *abfd,
struct internal_filehdr *fhdr,
struct internal_aouthdr *ahdr ATTRIBUTE_UNUSED)
@@ -1981,7 +1984,7 @@ alpha_adjust_headers (bfd *abfd,
fhdr->f_flags |= F_ALPHA_CALL_SHARED;
else if ((abfd->flags & DYNAMIC) != 0)
fhdr->f_flags |= F_ALPHA_SHARABLE;
return TRUE;
return true;
}
/* Archive handling. In OSF/1 (or Digital Unix) v3.2, Digital
@@ -2027,7 +2030,10 @@ alpha_ecoff_read_ar_hdr (bfd *abfd)
if (bfd_seek (abfd, (file_ptr) FILHSZ, SEEK_CUR) != 0
|| bfd_bread (ab, (bfd_size_type) 8, abfd) != 8
|| bfd_seek (abfd, (file_ptr) (- (FILHSZ + 8)), SEEK_CUR) != 0)
return NULL;
{
free (ret);
return NULL;
}
ret->parsed_size = H_GET_64 (abfd, ab);
}
@@ -2039,7 +2045,8 @@ alpha_ecoff_read_ar_hdr (bfd *abfd)
we uncompress the archive element if necessary. */
static bfd *
alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos)
alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos,
struct bfd_link_info *info)
{
bfd *nbfd = NULL;
struct areltdata *tdata;
@@ -2048,9 +2055,10 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos)
bfd_size_type size;
bfd_byte *buf, *p;
struct bfd_in_memory *bim;
ufile_ptr filesize;
buf = NULL;
nbfd = _bfd_get_elt_at_filepos (archive, filepos);
nbfd = _bfd_get_elt_at_filepos (archive, filepos, info);
if (nbfd == NULL)
goto error_return;
@@ -2081,6 +2089,14 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos)
goto error_return;
size = H_GET_64 (nbfd, ab);
/* The decompression algorithm will at most expand by eight times. */
filesize = bfd_get_file_size (archive);
if (filesize != 0 && size / 8 > filesize)
{
bfd_set_error (bfd_error_malformed_archive);
goto error_return;
}
if (size != 0)
{
bfd_size_type left;
@@ -2119,7 +2135,7 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos)
n = dict[h];
else
{
if (! bfd_bread (&n, (bfd_size_type) 1, nbfd))
if (bfd_bread (&n, 1, nbfd) != 1)
goto error_return;
dict[h] = n;
}
@@ -2148,7 +2164,7 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos)
bim->size = size;
bim->buffer = buf;
nbfd->mtime_set = TRUE;
nbfd->mtime_set = true;
nbfd->mtime = strtol (hdr->ar_date, (char **) NULL, 10);
nbfd->flags |= BFD_IN_MEMORY;
@@ -2160,8 +2176,7 @@ alpha_ecoff_get_elt_at_filepos (bfd *archive, file_ptr filepos)
return nbfd;
error_return:
if (buf != NULL)
free (buf);
free (buf);
if (nbfd != NULL)
bfd_close (nbfd);
return NULL;
@@ -2201,7 +2216,7 @@ alpha_ecoff_openr_next_archived_file (bfd *archive, bfd *last_file)
}
}
return alpha_ecoff_get_elt_at_filepos (archive, filestart);
return alpha_ecoff_get_elt_at_filepos (archive, filestart, NULL);
}
/* Open the archive file given an index into the armap. */
@@ -2212,7 +2227,8 @@ alpha_ecoff_get_elt_at_index (bfd *abfd, symindex sym_index)
carsym *entry;
entry = bfd_ardata (abfd)->symdefs + sym_index;
return alpha_ecoff_get_elt_at_filepos (abfd, entry->file_offset);
return alpha_ecoff_get_elt_at_filepos (abfd, entry->file_offset,
NULL);
}
static void
@@ -2289,8 +2305,8 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
alpha_ecoff_swap_coff_reloc_out,
alpha_ecoff_swap_filehdr_out, alpha_ecoff_swap_aouthdr_out,
alpha_ecoff_swap_scnhdr_out,
FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, TRUE,
ECOFF_NO_LONG_SECTION_NAMES, 4, FALSE, 2, 32768,
FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true,
ECOFF_NO_LONG_SECTION_NAMES, 4, false, 2, 32768,
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,
@@ -2309,7 +2325,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
/* TRUE if the .rdata section is part of the text segment, as on the
Alpha. FALSE if .rdata is part of the data segment, as on the
MIPS. */
TRUE,
true,
/* Bitsize of constructor entries. */
64,
/* Reloc to use for constructor entries. */
@@ -2390,6 +2406,7 @@ static const struct ecoff_backend_data alpha_ecoff_backend_data =
#define _bfd_ecoff_bfd_gc_sections bfd_generic_gc_sections
#define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
#define _bfd_ecoff_bfd_is_group_section bfd_generic_is_group_section
#define _bfd_ecoff_bfd_group_name bfd_generic_group_name
#define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group
#define _bfd_ecoff_section_already_linked \
_bfd_coff_section_already_linked
@@ -2412,11 +2429,13 @@ const bfd_target alpha_ecoff_le_vec =
| 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),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE
| SEC_DATA | SEC_SMALL_DATA),
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */
0, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
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 */
+197 -184
View File
File diff suppressed because it is too large Load Diff
+29
View File
@@ -0,0 +1,29 @@
/* BFD back-end for ARM COFF files.
Copyright (C) 2019-2022 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
/* ARM Interworking support. Called from linker. */
extern bool bfd_arm_allocate_interworking_sections
(struct bfd_link_info *);
extern bool bfd_arm_process_before_allocation
(bfd *, struct bfd_link_info *, int);
extern bool bfd_arm_get_bfd_for_interworking
(bfd *, struct bfd_link_info *);
+10 -9
View File
@@ -1,5 +1,5 @@
/* BFD COFF interfaces used outside of BFD.
Copyright (C) 1990-2018 Free Software Foundation, Inc.
Copyright (C) 1990-2022 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -27,7 +27,7 @@
/* Return the COFF syment for a symbol. */
bfd_boolean
bool
bfd_coff_get_syment (bfd *abfd,
asymbol *symbol,
struct internal_syment *psyment)
@@ -39,23 +39,24 @@ bfd_coff_get_syment (bfd *abfd,
|| ! csym->native->is_sym)
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
return false;
}
*psyment = csym->native->u.syment;
if (csym->native->fix_value)
psyment->n_value = psyment->n_value -
(bfd_hostptr_t) obj_raw_syments (abfd);
psyment->n_value =
((psyment->n_value - (uintptr_t) obj_raw_syments (abfd))
/ sizeof (combined_entry_type));
/* FIXME: We should handle fix_line here. */
return TRUE;
return true;
}
/* Return the COFF auxent for a symbol. */
bfd_boolean
bool
bfd_coff_get_auxent (bfd *abfd,
asymbol *symbol,
int indx,
@@ -72,7 +73,7 @@ bfd_coff_get_auxent (bfd *abfd,
|| indx >= csym->native->u.syment.n_numaux)
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
return false;
}
ent = csym->native + indx + 1;
@@ -95,5 +96,5 @@ bfd_coff_get_auxent (bfd *abfd,
((combined_entry_type *) pauxent->x_csect.x_scnlen.p
- obj_raw_syments (abfd));
return TRUE;
return true;
}
+9 -6
View File
@@ -1,5 +1,5 @@
/* BFD COFF interfaces used outside of BFD.
Copyright (C) 1990-2018 Free Software Foundation, Inc.
Copyright (C) 1990-2022 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -44,13 +44,13 @@ struct coff_section_tdata
/* The relocs, swapped into COFF internal form. This may be NULL. */
struct internal_reloc *relocs;
/* If this is TRUE, the relocs entry may not be freed. */
bfd_boolean keep_relocs;
bool keep_relocs;
/* The section contents. This may be NULL. */
bfd_byte *contents;
/* If this is TRUE, the contents entry may not be freed. */
bfd_boolean keep_contents;
bool keep_contents;
/* Information cached by coff_find_nearest_line. */
bfd_boolean saved_bias;
bool saved_bias;
bfd_signed_vma bias;
bfd_vma offset;
unsigned int i;
@@ -81,8 +81,11 @@ struct coff_section_tdata
struct internal_syment;
union internal_auxent;
extern bfd_boolean bfd_coff_get_syment
extern bool bfd_coff_get_syment
(bfd *, struct bfd_symbol *, struct internal_syment *);
extern bfd_boolean bfd_coff_get_auxent
extern bool bfd_coff_get_auxent
(bfd *, struct bfd_symbol *, int, union internal_auxent *);
extern bool bfd_coff_set_symbol_class
(bfd *, struct bfd_symbol *, unsigned int);
+145 -3
View File
@@ -1,5 +1,5 @@
/* BFD back-end for Intel 386 COFF files (DJGPP variant).
Copyright (C) 1990-2018 Free Software Foundation, Inc.
Copyright (C) 1990-2022 Free Software Foundation, Inc.
Written by DJ Delorie.
This file is part of BFD, the Binary File Descriptor library.
@@ -22,14 +22,21 @@
#define TARGET_SYM i386_coff_go32_vec
#define TARGET_NAME "coff-go32"
#define TARGET_UNDERSCORE '_'
#define COFF_GO32
#define COFF_LONG_SECTION_NAMES
#define COFF_SUPPORT_GNU_LINKONCE
#define COFF_LONG_FILENAMES
#define COFF_SECTION_ALIGNMENT_ENTRIES \
{ COFF_SECTION_NAME_EXACT_MATCH (".data"), \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".data"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_EXACT_MATCH (".text"), \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".text"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".const"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".rodata"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".bss"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.d"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
@@ -37,9 +44,144 @@
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.r"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.b"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 4 }, \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".debug"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, \
{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }
/* Section contains extended relocations. */
#define IMAGE_SCN_LNK_NRELOC_OVFL (0x01000000)
#include "sysdep.h"
#include "bfd.h"
/* The following functions are not static, because they are also
used for coff-go32-exe (coff-stgo32.c). */
bool _bfd_go32_mkobject (bfd *);
void _bfd_go32_swap_scnhdr_in (bfd *, void *, void *);
unsigned int _bfd_go32_swap_scnhdr_out (bfd *, void *, void *);
#define coff_mkobject _bfd_go32_mkobject
#define coff_SWAP_scnhdr_in _bfd_go32_swap_scnhdr_in
#define coff_SWAP_scnhdr_out _bfd_go32_swap_scnhdr_out
#include "coff-i386.c"
bool
_bfd_go32_mkobject (bfd * abfd)
{
const bfd_size_type amt = sizeof (coff_data_type);
abfd->tdata.coff_obj_data = bfd_zalloc (abfd, amt);
if (abfd->tdata.coff_obj_data == NULL)
return false;
coff_data (abfd)->go32 = true;
return true;
}
void
_bfd_go32_swap_scnhdr_in (bfd * abfd, void * ext, void * in)
{
SCNHDR *scnhdr_ext = (SCNHDR *) ext;
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
memcpy (scnhdr_int->s_name, scnhdr_ext->s_name, sizeof (scnhdr_int->s_name));
scnhdr_int->s_vaddr = GET_SCNHDR_VADDR (abfd, scnhdr_ext->s_vaddr);
scnhdr_int->s_paddr = GET_SCNHDR_PADDR (abfd, scnhdr_ext->s_paddr);
scnhdr_int->s_size = GET_SCNHDR_SIZE (abfd, scnhdr_ext->s_size);
scnhdr_int->s_scnptr = GET_SCNHDR_SCNPTR (abfd, scnhdr_ext->s_scnptr);
scnhdr_int->s_relptr = GET_SCNHDR_RELPTR (abfd, scnhdr_ext->s_relptr);
scnhdr_int->s_lnnoptr = GET_SCNHDR_LNNOPTR (abfd, scnhdr_ext->s_lnnoptr);
scnhdr_int->s_flags = GET_SCNHDR_FLAGS (abfd, scnhdr_ext->s_flags);
scnhdr_int->s_nreloc = GET_SCNHDR_NRELOC (abfd, scnhdr_ext->s_nreloc);
scnhdr_int->s_nlnno = GET_SCNHDR_NLNNO (abfd, scnhdr_ext->s_nlnno);
/* DJGPP follows the same strategy as PE COFF.
Iff the file is an executable then the higher 16 bits
of the line number have been stored in the relocation
counter field. */
if (abfd->flags & EXEC_P && (strcmp (scnhdr_ext->s_name, ".text") == 0))
{
scnhdr_int->s_nlnno
= (GET_SCNHDR_NRELOC (abfd, scnhdr_ext->s_nreloc) << 16)
+ GET_SCNHDR_NLNNO (abfd, scnhdr_ext->s_nlnno);
scnhdr_int->s_nreloc = 0;
}
}
unsigned int
_bfd_go32_swap_scnhdr_out (bfd * abfd, void * in, void * out)
{
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
SCNHDR *scnhdr_ext = (SCNHDR *) out;
unsigned int ret = bfd_coff_scnhsz (abfd);
memcpy (scnhdr_ext->s_name, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
PUT_SCNHDR_VADDR (abfd, scnhdr_int->s_vaddr, scnhdr_ext->s_vaddr);
PUT_SCNHDR_PADDR (abfd, scnhdr_int->s_paddr, scnhdr_ext->s_paddr);
PUT_SCNHDR_SIZE (abfd, scnhdr_int->s_size, scnhdr_ext->s_size);
PUT_SCNHDR_SCNPTR (abfd, scnhdr_int->s_scnptr, scnhdr_ext->s_scnptr);
PUT_SCNHDR_RELPTR (abfd, scnhdr_int->s_relptr, scnhdr_ext->s_relptr);
PUT_SCNHDR_LNNOPTR (abfd, scnhdr_int->s_lnnoptr, scnhdr_ext->s_lnnoptr);
PUT_SCNHDR_FLAGS (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags);
if (abfd->flags & EXEC_P && (strcmp (scnhdr_int->s_name, ".text") == 0))
{
/* DJGPP follows the same strategy as PE COFF.
By inference from looking at MS output, the 32 bit field
which is the combination of the number_of_relocs and
number_of_linenos is used for the line number count in
executables. A 16-bit field won't do for cc1. The MS
document says that the number of relocs is zero for
executables, but the 17-th bit has been observed to be there.
Overflow is not an issue: a 4G-line program will overflow a
bunch of other fields long before this! */
PUT_SCNHDR_NLNNO (abfd, (scnhdr_int->s_nlnno & 0xffff),
scnhdr_ext->s_nlnno);
PUT_SCNHDR_NRELOC (abfd, (scnhdr_int->s_nlnno >> 16),
scnhdr_ext->s_nreloc);
}
else
{
/* DJGPP follows the same strategy as PE COFF. */
if (scnhdr_int->s_nlnno <= MAX_SCNHDR_NLNNO)
PUT_SCNHDR_NLNNO (abfd, scnhdr_int->s_nlnno, scnhdr_ext->s_nlnno);
else
{
char buf[sizeof (scnhdr_int->s_name) + 1];
memcpy (buf, scnhdr_int->s_name, sizeof (scnhdr_int->s_name));
buf[sizeof (scnhdr_int->s_name)] = '\0';
_bfd_error_handler
/* xgettext:c-format */
(_("%pB: warning: %s: line number overflow: 0x%lx > 0xffff"),
abfd, buf, scnhdr_int->s_nlnno);
bfd_set_error (bfd_error_file_truncated);
PUT_SCNHDR_NLNNO (abfd, 0xffff, scnhdr_ext->s_nlnno);
ret = 0;
}
/* Although we could encode 0xffff relocs here, we do not, to be
consistent with other parts of bfd. Also it lets us warn, as
we should never see 0xffff here w/o having the overflow flag
set. */
if (scnhdr_int->s_nreloc < MAX_SCNHDR_NRELOC)
PUT_SCNHDR_NRELOC (abfd, scnhdr_int->s_nreloc, scnhdr_ext->s_nreloc);
else
{
/* DJGPP can deal with large #s of relocs, but not here. */
PUT_SCNHDR_NRELOC (abfd, 0xffff, scnhdr_ext->s_nreloc);
scnhdr_int->s_flags |= IMAGE_SCN_LNK_NRELOC_OVFL;
PUT_SCNHDR_FLAGS (abfd, scnhdr_int->s_flags, scnhdr_ext->s_flags);
}
}
return ret;
}
+228 -70
View File
@@ -1,5 +1,5 @@
/* BFD back-end for Intel 386 COFF files.
Copyright (C) 1990-2018 Free Software Foundation, Inc.
Copyright (C) 1990-2022 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -31,16 +31,15 @@
#include "coff/pe.h"
#endif
#ifdef COFF_GO32_EXE
#include "coff/go32exe.h"
#endif
#ifndef bfd_pe_print_pdata
#define bfd_pe_print_pdata NULL
#endif
#include "libcoff.h"
/* All users of this file have bfd_octets_per_byte (abfd, sec) == 1. */
#define OCTETS_PER_BYTE(ABFD, SEC) 1
static reloc_howto_type *coff_i386_rtype_to_howto
(bfd *, asection *, struct internal_reloc *,
struct coff_link_hash_entry *, struct internal_syment *,
@@ -67,7 +66,7 @@ coff_i386_reloc (bfd *abfd,
arelent *reloc_entry,
asymbol *symbol,
void * data,
asection *input_section ATTRIBUTE_UNUSED,
asection *input_section,
bfd *output_bfd,
char **error_message ATTRIBUTE_UNUSED)
{
@@ -110,14 +109,14 @@ coff_i386_reloc (bfd *abfd,
reloc_howto_type *howto = reloc_entry->howto;
/* Although PC relative relocations are very similar between
PE and non-PE formats, but they are off by 1 << howto->size
PE and non-PE formats, but they are off by howto->size
bytes. For the external relocation, PE is very different
from others. See md_apply_fix3 () in gas/config/tc-i386.c.
When we link PE and non-PE object files together to
generate a non-PE executable, we have to compensate it
here. */
if (howto->pc_relative && howto->pcrel_offset)
diff = -(1 << howto->size);
diff = -bfd_get_reloc_size (howto);
else if (symbol->flags & BSF_WEAK)
diff = reloc_entry->addend - symbol->value;
else
@@ -142,16 +141,16 @@ coff_i386_reloc (bfd *abfd,
if (diff != 0)
{
reloc_howto_type *howto = reloc_entry->howto;
unsigned char *addr = (unsigned char *) data + reloc_entry->address;
bfd_size_type octets = (reloc_entry->address
* OCTETS_PER_BYTE (abfd, input_section));
unsigned char *addr = (unsigned char *) data + octets;
if (! bfd_reloc_offset_in_range (howto, abfd, input_section,
reloc_entry->address
* bfd_octets_per_byte (abfd)))
if (!bfd_reloc_offset_in_range (howto, abfd, input_section, octets))
return bfd_reloc_outofrange;
switch (howto->size)
switch (bfd_get_reloc_size (howto))
{
case 0:
case 1:
{
char x = bfd_get_8 (abfd, addr);
DOIT (x);
@@ -159,7 +158,7 @@ coff_i386_reloc (bfd *abfd,
}
break;
case 1:
case 2:
{
short x = bfd_get_16 (abfd, addr);
DOIT (x);
@@ -167,7 +166,7 @@ coff_i386_reloc (bfd *abfd,
}
break;
case 2:
case 4:
{
long x = bfd_get_32 (abfd, addr);
DOIT (x);
@@ -188,16 +187,18 @@ coff_i386_reloc (bfd *abfd,
/* Return TRUE if this relocation should appear in the output .reloc
section. */
static bfd_boolean in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED,
reloc_howto_type *howto)
static bool
in_reloc_p (bfd *abfd ATTRIBUTE_UNUSED, reloc_howto_type *howto)
{
return ! howto->pc_relative && howto->type != R_IMAGEBASE
&& howto->type != R_SECREL32;
return ! howto->pc_relative
&& howto->type != R_IMAGEBASE
&& howto->type != R_SECREL32
&& howto->type != R_SECTION;
}
#endif /* COFF_WITH_PE */
#ifndef PCRELOFFSET
#define PCRELOFFSET FALSE
#define PCRELOFFSET false
#endif
static reloc_howto_type howto_table[] =
@@ -210,50 +211,64 @@ static reloc_howto_type howto_table[] =
EMPTY_HOWTO (5),
HOWTO (R_DIR32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"dir32", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
TRUE), /* pcrel_offset */
true), /* pcrel_offset */
/* PE IMAGE_REL_I386_DIR32NB relocation (7). */
HOWTO (R_IMAGEBASE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"rva32", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
EMPTY_HOWTO (010),
EMPTY_HOWTO (011),
EMPTY_HOWTO (012),
#ifdef COFF_WITH_PE
/* 16-bit word section relocation (012). */
HOWTO (R_SECTION, /* type */
0, /* rightshift */
2, /* size */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"secidx", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
true), /* pcrel_offset */
/* 32-bit longword section relative relocation (013). */
HOWTO (R_SECREL32, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"secrel32", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
TRUE), /* pcrel_offset */
true), /* pcrel_offset */
#else
EMPTY_HOWTO (012),
EMPTY_HOWTO (013),
#endif
EMPTY_HOWTO (014),
@@ -262,84 +277,84 @@ static reloc_howto_type howto_table[] =
/* Byte relocation (017). */
HOWTO (R_RELBYTE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
1, /* size */
8, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"8", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
/* 16-bit word relocation (020). */
HOWTO (R_RELWORD, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
2, /* size */
16, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"16", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
/* 32-bit longword relocation (021). */
HOWTO (R_RELLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"32", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
/* Byte PC relative relocation (022). */
HOWTO (R_PCRBYTE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
1, /* size */
8, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"DISP8", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
/* 16-bit word PC relative relocation (023). */
HOWTO (R_PCRWORD, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
2, /* size */
16, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"DISP16", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
/* 32-bit longword PC relative relocation (024). */
HOWTO (R_PCRLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_i386_reloc, /* special_function */
"DISP32", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
PCRELOFFSET) /* pcrel_offset */
@@ -408,11 +423,11 @@ static reloc_howto_type howto_table[] =
#else /* COFF_WITH_PE */
/* The PE relocate section routine. The only difference between this
and the regular routine is that we don't want to do anything for a
relocatable link. */
/* The PE relocate section routine. We handle secidx relocations here,
as well as making sure that we don't do anything for a relocatable
link. */
static bfd_boolean
static bool
coff_pe_i386_relocate_section (bfd *output_bfd,
struct bfd_link_info *info,
bfd *input_bfd,
@@ -422,8 +437,77 @@ coff_pe_i386_relocate_section (bfd *output_bfd,
struct internal_syment *syms,
asection **sections)
{
struct internal_reloc *rel;
struct internal_reloc *relend;
if (bfd_link_relocatable (info))
return TRUE;
return true;
rel = relocs;
relend = rel + input_section->reloc_count;
for (; rel < relend; rel++)
{
long symndx;
struct coff_link_hash_entry *h;
asection *sec, *s;
uint16_t idx = 0, i = 1;
if (rel->r_type != R_SECTION)
continue;
/* Make sure that _bfd_coff_generic_relocate_section won't parse
this reloc after us. */
rel->r_type = 0;
symndx = rel->r_symndx;
if (symndx < 0
|| (unsigned long) symndx >= obj_raw_syment_count (input_bfd))
continue;
h = obj_coff_sym_hashes (input_bfd)[symndx];
if (h == NULL)
sec = sections[symndx];
else
{
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
{
/* Defined weak symbols are a GNU extension. */
sec = h->root.u.def.section;
}
else
{
sec = NULL;
}
}
if (!sec)
continue;
if (bfd_is_abs_section (sec))
continue;
if (discarded_section (sec))
continue;
s = output_bfd->sections;
while (s)
{
if (s == sec->output_section)
{
idx = i;
break;
}
i++;
s = s->next;
}
bfd_putl16 (idx, contents + rel->r_vaddr - input_section->vma);
}
return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,
input_section, contents,
@@ -574,6 +658,8 @@ coff_i386_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
#ifdef COFF_WITH_PE
case BFD_RELOC_32_SECREL:
return howto_table + R_SECREL32;
case BFD_RELOC_16_SECIDX:
return howto_table + R_SECTION;
#endif
default:
BFD_FAIL ();
@@ -603,11 +689,11 @@ coff_i386_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
a leading dot for local labels, so if TARGET_UNDERSCORE is defined
we treat all symbols starting with L as local. */
static bfd_boolean
static bool
coff_i386_is_local_label_name (bfd *abfd, const char *name)
{
if (name[0] == 'L')
return TRUE;
return true;
return _bfd_coff_is_local_label_name (abfd, name);
}
@@ -652,6 +738,7 @@ const bfd_target
'/', /* ar_pad_char */
15, /* ar_max_namelen */
0, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
@@ -660,23 +747,21 @@ const bfd_target
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* hdrs */
#ifndef COFF_CHECK_FORMAT
#define COFF_CHECK_FORMAT coff_object_p
#endif
#ifndef COFF_WRITE_CONTENTS
#define COFF_WRITE_CONTENTS coff_write_object_contents
#endif
/* Note that we allow an object file to be treated as a core file as well. */
#ifdef COFF_CHECK_FORMAT
{ /* bfd_check_format */
_bfd_dummy_target,
COFF_CHECK_FORMAT,
bfd_generic_archive_p,
COFF_CHECK_FORMAT
},
#else
{
_bfd_dummy_target,
coff_object_p,
bfd_generic_archive_p,
coff_object_p
},
#endif
{ /* bfd_set_format */
_bfd_bool_bfd_false_error,
coff_mkobject,
@@ -685,7 +770,7 @@ const bfd_target
},
{ /* bfd_write_contents */
_bfd_bool_bfd_false_error,
coff_write_object_contents,
COFF_WRITE_CONTENTS,
_bfd_write_archive_contents,
_bfd_bool_bfd_false_error
},
@@ -704,3 +789,76 @@ const bfd_target
COFF_SWAP_TABLE
};
#ifdef COFF_WITH_PE_BIGOBJ
const bfd_target
TARGET_SYM_BIG =
{
TARGET_NAME_BIG,
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 | BFD_COMPRESS | BFD_DECOMPRESS ),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* section flags */
#ifdef COFF_WITH_PE
| SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY | SEC_DEBUGGING
#endif
| SEC_CODE | SEC_DATA | SEC_EXCLUDE ),
#ifdef TARGET_UNDERSCORE
TARGET_UNDERSCORE, /* leading underscore */
#else
0, /* leading underscore */
#endif
'/', /* ar_pad_char */
15, /* ar_max_namelen */
0, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
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_check_format */
_bfd_dummy_target,
COFF_CHECK_FORMAT,
bfd_generic_archive_p,
COFF_CHECK_FORMAT
},
{ /* bfd_set_format */
_bfd_bool_bfd_false_error,
coff_mkobject,
_bfd_generic_mkarchive,
_bfd_bool_bfd_false_error
},
{ /* bfd_write_contents */
_bfd_bool_bfd_false_error,
COFF_WRITE_CONTENTS,
_bfd_write_archive_contents,
_bfd_bool_bfd_false_error
},
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,
&bigobj_swap_table
};
#endif
+5 -4
View File
@@ -1,5 +1,5 @@
/* BFD back-end for HP/Intel IA-64 COFF files.
Copyright (C) 1999-2018 Free Software Foundation, Inc.
Copyright (C) 1999-2022 Free Software Foundation, Inc.
Contributed by David Mosberger <davidm@hpl.hp.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -53,11 +53,11 @@ static reloc_howto_type howto_table[] =
/* Return TRUE if this relocation should
appear in the output .reloc section. */
static bfd_boolean
static bool
in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED,
reloc_howto_type *howto ATTRIBUTE_UNUSED)
{
return FALSE; /* We don't do relocs for now... */
return false; /* We don't do relocs for now... */
}
#endif
@@ -67,7 +67,7 @@ in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED,
#include "coffcode.h"
static const bfd_target *
static bfd_cleanup
ia64coff_object_p (bfd *abfd)
{
#ifdef COFF_IMAGE_WITH_PE
@@ -170,6 +170,7 @@ const bfd_target
'/', /* ar_pad_char */
15, /* ar_max_namelen */
0, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
+47 -48
View File
@@ -1,5 +1,5 @@
/* BFD back-end for Motorola MCore COFF/PE
Copyright (C) 1999-2018 Free Software Foundation, Inc.
Copyright (C) 1999-2022 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -37,7 +37,7 @@
/* This file is compiled more than once, but we only compile the
final_link routine once. */
extern bfd_boolean mcore_bfd_coff_final_link
extern bool mcore_bfd_coff_final_link
(bfd *, struct bfd_link_info *);
static bfd_reloc_status_type mcore_coff_unsupported_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
@@ -61,94 +61,94 @@ static reloc_howto_type mcore_coff_howto_table[] =
/* Unused: */
HOWTO (IMAGE_REL_MCORE_ABSOLUTE,/* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
0, /* size */
0, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* dont complain_on_overflow */
NULL, /* special_function */
"ABSOLUTE", /* name */
FALSE, /* partial_inplace */
false, /* partial_inplace */
0x00, /* src_mask */
0x00, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
HOWTO (IMAGE_REL_MCORE_ADDR32,/* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
NULL, /* special_function */
"ADDR32", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* 8 bits + 2 zero bits; jmpi/jsri/lrw instructions.
Should not appear in object files. */
HOWTO (IMAGE_REL_MCORE_PCREL_IMM8BY4, /* type */
2, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
2, /* size */
8, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
mcore_coff_unsupported_reloc, /* special_function */
"IMM8BY4", /* name */
FALSE, /* partial_inplace */
false, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
TRUE), /* pcrel_offset */
true), /* pcrel_offset */
/* bsr/bt/bf/br instructions; 11 bits + 1 zero bit
Span 2k instructions == 4k bytes.
Only useful pieces at the relocated address are the opcode (5 bits) */
HOWTO (IMAGE_REL_MCORE_PCREL_IMM11BY2,/* type */
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
2, /* size */
11, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
NULL, /* special_function */
"IMM11BY2", /* name */
FALSE, /* partial_inplace */
false, /* partial_inplace */
0x0, /* src_mask */
0x7ff, /* dst_mask */
TRUE), /* pcrel_offset */
true), /* pcrel_offset */
/* 4 bits + 1 zero bit; 'loopt' instruction only; unsupported. */
HOWTO (IMAGE_REL_MCORE_PCREL_IMM4BY2, /* type */
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
2, /* size */
4, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
mcore_coff_unsupported_reloc, /* special_function */
"IMM4BY2", /* name */
FALSE, /* partial_inplace */
false, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
TRUE), /* pcrel_offset */
true), /* pcrel_offset */
/* 32-bit pc-relative. Eventually this will help support PIC code. */
HOWTO (IMAGE_REL_MCORE_PCREL_32,/* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
NULL, /* special_function */
"PCREL_32", /* name */
FALSE, /* partial_inplace */
false, /* partial_inplace */
0x0, /* src_mask */
0xffffffff, /* dst_mask */
TRUE), /* pcrel_offset */
true), /* pcrel_offset */
/* Like PCREL_IMM11BY2, this relocation indicates that there is a
'jsri' at the specified address. There is a separate relocation
@@ -159,31 +159,31 @@ static reloc_howto_type mcore_coff_howto_table[] =
is a relocation that we are allowed to safely ignore. */
HOWTO (IMAGE_REL_MCORE_PCREL_JSR_IMM11BY2,/* type */
1, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
2, /* size */
11, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
NULL, /* special_function */
"JSR_IMM11BY2", /* name */
FALSE, /* partial_inplace */
false, /* partial_inplace */
0x0, /* src_mask */
0x7ff, /* dst_mask */
TRUE), /* pcrel_offset */
true), /* pcrel_offset */
HOWTO (IMAGE_REL_MCORE_RVA, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
NULL, /* special_function */
"MCORE_RVA", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
TRUE) /* pcrel_offset */
true) /* pcrel_offset */
};
/* Extend the coff_link_hash_table structure with a few M*Core specific fields.
@@ -209,7 +209,7 @@ mcore_hash_table;
/* Add an entry to the base file. */
static bfd_boolean
static bool
mcore_emit_base_file_entry (struct bfd_link_info *info,
bfd *output_bfd,
asection *input_section,
@@ -224,10 +224,10 @@ mcore_emit_base_file_entry (struct bfd_link_info *info,
addr -= pe_data (output_bfd)->pe_opthdr.ImageBase;
if (fwrite (&addr, sizeof (addr), 1, (FILE *) info->base_file) == 1)
return TRUE;
return true;
bfd_set_error (bfd_error_system_call);
return FALSE;
return false;
}
static bfd_reloc_status_type
@@ -336,14 +336,14 @@ coff_mcore_rtype_to_howto (bfd * abfd ATTRIBUTE_UNUSED,
/* Return TRUE if this relocation should appear in the output .reloc section.
This function is referenced in pe_mkobject in peicode.h. */
static bfd_boolean
static bool
in_reloc_p (bfd * abfd ATTRIBUTE_UNUSED, reloc_howto_type * howto)
{
return ! howto->pc_relative && howto->type != IMAGE_REL_MCORE_RVA;
}
/* The reloc processing routine for the optimized COFF linker. */
static bfd_boolean
static bool
coff_mcore_relocate_section (bfd * output_bfd,
struct bfd_link_info * info,
bfd * input_bfd,
@@ -360,7 +360,7 @@ coff_mcore_relocate_section (bfd * output_bfd,
thing. The caller will take care of adjusting the reloc
addresses and symbol indices. */
if (bfd_link_relocatable (info))
return TRUE;
return true;
/* Check if we have the same endianness */
if ( input_bfd->xvec->byteorder != output_bfd->xvec->byteorder
@@ -374,7 +374,7 @@ coff_mcore_relocate_section (bfd * output_bfd,
bfd_big_endian (output_bfd) ? _("big endian") : _("little endian"));
bfd_set_error (bfd_error_wrong_format);
return FALSE;
return false;
}
rel = relocs;
@@ -392,6 +392,7 @@ coff_mcore_relocate_section (bfd * output_bfd,
reloc_howto_type * howto = NULL;
struct coff_link_hash_entry * h;
const char * my_name;
char buf[SYMNMLEN + 1];
symndx = rel->r_symndx;
loc = contents + rel->r_vaddr - input_section->vma;
@@ -413,7 +414,7 @@ coff_mcore_relocate_section (bfd * output_bfd,
howto = bfd_coff_rtype_to_howto (input_bfd, input_section, rel, h,
sym, & addend);
if (howto == NULL)
return FALSE;
return false;
val = 0;
@@ -436,8 +437,6 @@ coff_mcore_relocate_section (bfd * output_bfd,
my_name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset;
else
{
static char buf [SYMNMLEN + 1];
strncpy (buf, sym->_n._n_name, SYMNMLEN);
buf[SYMNMLEN] = '\0';
my_name = buf;
@@ -458,7 +457,7 @@ coff_mcore_relocate_section (bfd * output_bfd,
else
(*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
rel->r_vaddr - input_section->vma, TRUE);
rel->r_vaddr - input_section->vma, true);
my_name = h->root.root.string;
}
@@ -473,7 +472,7 @@ coff_mcore_relocate_section (bfd * output_bfd,
_bfd_error_handler (_("%pB: unsupported relocation type %#x"),
input_bfd, r_type);
bfd_set_error (bfd_error_bad_value);
return FALSE;
return false;
case IMAGE_REL_MCORE_ABSOLUTE:
_bfd_error_handler
@@ -509,7 +508,7 @@ coff_mcore_relocate_section (bfd * output_bfd,
&& pe_data (output_bfd)->in_reloc_p (output_bfd, howto)
&& !mcore_emit_base_file_entry (info, output_bfd, input_section,
rel->r_vaddr))
return FALSE;
return false;
switch (rstat)
{
@@ -527,7 +526,7 @@ coff_mcore_relocate_section (bfd * output_bfd,
}
}
return TRUE;
return true;
}
/* Tailor coffcode.h -- macro heaven. */
+94 -79
View File
@@ -1,5 +1,5 @@
/* BFD back-end for MIPS Extended-Coff files.
Copyright (C) 1990-2018 Free Software Foundation, Inc.
Copyright (C) 1990-2022 Free Software Foundation, Inc.
Original version by Per Bothner.
Full support added by Ian Lance Taylor, ian@cygnus.com.
@@ -31,6 +31,9 @@
#include "coff/mips.h"
#include "libcoff.h"
#include "libecoff.h"
/* All users of this file have bfd_octets_per_byte (abfd, sec) == 1. */
#define OCTETS_PER_BYTE(ABFD, SEC) 1
/* Prototypes for static functions. */
static bfd_reloc_status_type
@@ -81,54 +84,54 @@ static reloc_howto_type mips_howto_table[] =
bfd_perform_relocation to do nothing. */
HOWTO (MIPS_R_IGNORE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
1, /* size */
8, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"IGNORE", /* name */
FALSE, /* partial_inplace */
false, /* partial_inplace */
0, /* src_mask */
0, /* dst_mask */
FALSE), /* pcrel_offset */
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) */
2, /* size */
16, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
mips_generic_reloc, /* special_function */
"REFHALF", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
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) */
4, /* size */
32, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
mips_generic_reloc, /* special_function */
"REFWORD", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* A 26 bit absolute jump address. */
HOWTO (MIPS_R_JMPADDR, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
26, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
/* This needs complex overflow
@@ -136,73 +139,73 @@ static reloc_howto_type mips_howto_table[] =
bits must match the PC. */
mips_generic_reloc, /* special_function */
"JMPADDR", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0x3ffffff, /* src_mask */
0x3ffffff, /* dst_mask */
FALSE), /* pcrel_offset */
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) */
4, /* size */
16, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
mips_refhi_reloc, /* special_function */
"REFHI", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
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) */
4, /* size */
16, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
mips_reflo_reloc, /* special_function */
"REFLO", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
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) */
4, /* size */
16, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mips_gprel_reloc, /* special_function */
"GPREL", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
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) */
4, /* size */
16, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mips_gprel_reloc, /* special_function */
"LITERAL", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
EMPTY_HOWTO (8),
EMPTY_HOWTO (9),
@@ -214,17 +217,17 @@ static reloc_howto_type mips_howto_table[] =
be removed. (It used to be used for embedded-PIC support.) */
HOWTO (MIPS_R_PCREL16, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
16, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
mips_generic_reloc, /* special_function */
"PCREL16", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
TRUE), /* pcrel_offset */
true), /* pcrel_offset */
};
#define MIPS_HOWTO_COUNT \
@@ -232,7 +235,7 @@ static reloc_howto_type mips_howto_table[] =
/* See whether the magic number matches. */
static bfd_boolean
static bool
mips_ecoff_bad_format_hook (bfd * abfd, void * filehdr)
{
struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr;
@@ -241,7 +244,7 @@ mips_ecoff_bad_format_hook (bfd * abfd, void * filehdr)
{
case MIPS_MAGIC_1:
/* I don't know what endianness this implies. */
return TRUE;
return true;
case MIPS_MAGIC_BIG:
case MIPS_MAGIC_BIG2:
@@ -254,7 +257,7 @@ mips_ecoff_bad_format_hook (bfd * abfd, void * filehdr)
return bfd_little_endian (abfd);
default:
return FALSE;
return false;
}
}
@@ -348,7 +351,14 @@ mips_adjust_reloc_in (bfd *abfd,
arelent *rptr)
{
if (intern->r_type > MIPS_R_PCREL16)
abort ();
{
/* xgettext:c-format */
_bfd_error_handler (_("%pB: unsupported relocation type %#x"),
abfd, intern->r_type);
bfd_set_error (bfd_error_bad_value);
rptr->howto = NULL;
return;
}
if (! intern->r_extern
&& (intern->r_type == MIPS_R_GPREL
@@ -484,13 +494,13 @@ mips_refhi_reloc (bfd *abfd ATTRIBUTE_UNUSED,
relocation described above. */
static bfd_reloc_status_type
mips_reflo_reloc (bfd *abfd ATTRIBUTE_UNUSED,
mips_reflo_reloc (bfd *abfd,
arelent *reloc_entry,
asymbol *symbol,
void * data,
asection *input_section,
bfd *output_bfd,
char **error_message ATTRIBUTE_UNUSED)
char **error_message)
{
if (mips_refhi_list != NULL)
{
@@ -503,11 +513,12 @@ mips_reflo_reloc (bfd *abfd ATTRIBUTE_UNUSED,
unsigned long val;
unsigned long vallo;
struct mips_hi *next;
bfd_size_type octets = (reloc_entry->address
* OCTETS_PER_BYTE (abfd, input_section));
bfd_byte *loc = (bfd_byte *) data + octets;
if (! bfd_reloc_offset_in_range (reloc_entry->howto, abfd,
input_section,
reloc_entry->address
* bfd_octets_per_byte (abfd)))
if (!bfd_reloc_offset_in_range (reloc_entry->howto, abfd,
input_section, octets))
return bfd_reloc_outofrange;
/* Do the REFHI relocation. Note that we actually don't
@@ -515,8 +526,7 @@ mips_reflo_reloc (bfd *abfd ATTRIBUTE_UNUSED,
where to find the low 16 bits of the addend needed by the
REFHI. */
insn = bfd_get_32 (abfd, l->addr);
vallo = (bfd_get_32 (abfd, (bfd_byte *) data + reloc_entry->address)
& 0xffff);
vallo = bfd_get_32 (abfd, loc) & 0xffff;
val = ((insn & 0xffff) << 16) + vallo;
val += l->addend;
@@ -544,7 +554,7 @@ mips_reflo_reloc (bfd *abfd ATTRIBUTE_UNUSED,
/* Now do the REFLO reloc in the usual way. */
return mips_generic_reloc (abfd, reloc_entry, symbol, data,
input_section, output_bfd, error_message);
input_section, output_bfd, error_message);
}
/* Do a GPREL relocation. This is a 16 bit value which must become
@@ -559,7 +569,7 @@ mips_gprel_reloc (bfd *abfd ATTRIBUTE_UNUSED,
bfd *output_bfd,
char **error_message ATTRIBUTE_UNUSED)
{
bfd_boolean relocatable;
bool relocatable;
bfd_vma gp;
bfd_vma relocation;
unsigned long val;
@@ -578,16 +588,15 @@ mips_gprel_reloc (bfd *abfd ATTRIBUTE_UNUSED,
}
if (output_bfd != (bfd *) NULL)
relocatable = TRUE;
relocatable = true;
else
{
relocatable = FALSE;
relocatable = false;
output_bfd = symbol->section->output_section->owner;
if (output_bfd == NULL)
return bfd_reloc_undefined;
}
if (bfd_is_und_section (symbol->section) && ! relocatable)
return bfd_reloc_undefined;
/* We have to figure out the gp value, so that we can adjust the
symbol value correctly. We look up the symbol _gp in the output
BFD. If we can't find it, we're stuck. We cache it in the ECOFF
@@ -789,7 +798,7 @@ mips_relocate_hi (struct internal_reloc *refhi,
/* Relocate a section while linking a MIPS ECOFF file. */
static bfd_boolean
static bool
mips_relocate_section (bfd *output_bfd,
struct bfd_link_info *info,
bfd *input_bfd,
@@ -800,11 +809,11 @@ mips_relocate_section (bfd *output_bfd,
asection **symndx_to_section;
struct ecoff_link_hash_entry **sym_hashes;
bfd_vma gp;
bfd_boolean gp_undefined;
bool gp_undefined;
struct external_reloc *ext_rel;
struct external_reloc *ext_rel_end;
unsigned int i;
bfd_boolean got_lo;
bool got_lo;
struct internal_reloc lo_int_rel;
bfd_size_type amt;
@@ -820,7 +829,7 @@ mips_relocate_section (bfd *output_bfd,
amt = NUM_RELOC_SECTIONS * sizeof (asection *);
symndx_to_section = (asection **) bfd_alloc (input_bfd, amt);
if (!symndx_to_section)
return FALSE;
return false;
symndx_to_section[RELOC_SECTION_NONE] = NULL;
symndx_to_section[RELOC_SECTION_TEXT] =
@@ -855,18 +864,18 @@ mips_relocate_section (bfd *output_bfd,
gp = _bfd_get_gp_value (output_bfd);
if (gp == 0)
gp_undefined = TRUE;
gp_undefined = true;
else
gp_undefined = FALSE;
gp_undefined = false;
got_lo = FALSE;
got_lo = false;
ext_rel = (struct external_reloc *) external_relocs;
ext_rel_end = ext_rel + input_section->reloc_count;
for (i = 0; ext_rel < ext_rel_end; ext_rel++, i++)
{
struct internal_reloc int_rel;
bfd_boolean use_lo = FALSE;
bool use_lo = false;
bfd_vma addend;
reloc_howto_type *howto;
struct ecoff_link_hash_entry *h = NULL;
@@ -879,7 +888,7 @@ mips_relocate_section (bfd *output_bfd,
else
{
int_rel = lo_int_rel;
got_lo = FALSE;
got_lo = false;
}
BFD_ASSERT (int_rel.r_type
@@ -909,9 +918,9 @@ mips_relocate_section (bfd *output_bfd,
&& int_rel.r_extern == lo_int_rel.r_extern
&& int_rel.r_symndx == lo_int_rel.r_symndx)
{
use_lo = TRUE;
use_lo = true;
if (lo_ext_rel == ext_rel + 1)
got_lo = TRUE;
got_lo = true;
}
}
@@ -953,7 +962,7 @@ mips_relocate_section (bfd *output_bfd,
/* Only give the error once per link. */
gp = 4;
_bfd_set_gp_value (output_bfd, gp);
gp_undefined = FALSE;
gp_undefined = false;
}
if (! int_rel.r_extern)
{
@@ -1012,8 +1021,7 @@ mips_relocate_section (bfd *output_bfd,
/* Compute a new r_symndx value. */
s = h->root.u.def.section;
name = bfd_get_section_name (output_bfd,
s->output_section);
name = bfd_section_name (s->output_section);
int_rel.r_symndx = -1;
switch (name[1])
@@ -1156,7 +1164,7 @@ mips_relocate_section (bfd *output_bfd,
{
(*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
int_rel.r_vaddr - input_section->vma, TRUE);
int_rel.r_vaddr - input_section->vma, true);
relocation = 0;
}
}
@@ -1223,7 +1231,7 @@ mips_relocate_section (bfd *output_bfd,
if (int_rel.r_extern)
name = NULL;
else
name = bfd_section_name (input_bfd, s);
name = bfd_section_name (s);
(*info->callbacks->reloc_overflow)
(info, (h ? &h->root : NULL), name, howto->name,
(bfd_vma) 0, input_bfd, input_section,
@@ -1234,7 +1242,7 @@ mips_relocate_section (bfd *output_bfd,
}
}
return TRUE;
return true;
}
static void
@@ -1311,8 +1319,8 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
mips_ecoff_swap_coff_reloc_out,
mips_ecoff_swap_filehdr_out, mips_ecoff_swap_aouthdr_out,
mips_ecoff_swap_scnhdr_out,
FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, TRUE,
ECOFF_NO_LONG_SECTION_NAMES, 4, FALSE, 2, 32768,
FILHSZ, AOUTSZ, SCNHSZ, 0, 0, 0, 0, FILNMLEN, true,
ECOFF_NO_LONG_SECTION_NAMES, 4, false, 2, 32768,
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,
@@ -1331,7 +1339,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
/* TRUE if the .rdata section is part of the text segment, as on the
Alpha. FALSE if .rdata is part of the data segment, as on the
MIPS. */
FALSE,
false,
/* Bitsize of constructor entries. */
32,
/* Reloc to use for constructor entries. */
@@ -1416,6 +1424,7 @@ static const struct ecoff_backend_data mips_ecoff_backend_data =
#define _bfd_ecoff_bfd_merge_sections bfd_generic_merge_sections
#define _bfd_ecoff_bfd_is_group_section bfd_generic_is_group_section
#define _bfd_ecoff_bfd_group_name bfd_generic_group_name
#define _bfd_ecoff_bfd_discard_group bfd_generic_discard_group
#define _bfd_ecoff_section_already_linked \
_bfd_coff_section_already_linked
@@ -1437,11 +1446,13 @@ const bfd_target mips_ecoff_le_vec =
| HAS_LINENO | HAS_DEBUG
| HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE
| SEC_DATA | SEC_SMALL_DATA),
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */
0, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
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 */
@@ -1494,11 +1505,13 @@ const bfd_target mips_ecoff_be_vec =
| HAS_LINENO | HAS_DEBUG
| HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE
| SEC_DATA | SEC_SMALL_DATA),
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */
0, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
bfd_getb64, bfd_getb_signed_64, bfd_putb64,
bfd_getb32, bfd_getb_signed_32, bfd_putb32,
bfd_getb16, bfd_getb_signed_16, bfd_putb16,
@@ -1551,11 +1564,13 @@ const bfd_target mips_ecoff_bele_vec =
| HAS_LINENO | HAS_DEBUG
| HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE
| SEC_DATA | SEC_SMALL_DATA),
0, /* leading underscore */
' ', /* ar_pad_char */
15, /* ar_max_namelen */
0, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
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 */
File diff suppressed because it is too large Load Diff
+1112 -689
View File
File diff suppressed because it is too large Load Diff
+219 -224
View File
File diff suppressed because it is too large Load Diff
+209 -251
View File
@@ -1,5 +1,5 @@
/* BFD back-end for Intel 386 COFF files (DJGPP variant with a stub).
Copyright (C) 1997-2018 Free Software Foundation, Inc.
Copyright (C) 1997-2022 Free Software Foundation, Inc.
Written by Robert Hoehne.
This file is part of BFD, the Binary File Descriptor library.
@@ -23,17 +23,10 @@
DOS executable program before the coff image to load it in memory
and execute it. This is needed, because DOS cannot run coff files.
All the functions below are called by the corresponding functions
from coffswap.h.
The only thing what they do is to adjust the information stored in
the COFF file which are offset into the file.
This is needed, because DJGPP uses a very special way to load and run
the coff image. It loads the image in memory and assumes then, that the
image had no stub by using the filepointers as pointers in the coff
image and NOT in the file.
To be compatible with any existing executables I have fixed this
here and NOT in the DJGPP startup code. */
The COFF image is loaded in memory without the stub attached, so
all offsets are relative to the beginning of the image, not the
actual file. We handle this in bfd by setting bfd->origin to where
the COFF image starts. */
#define TARGET_SYM i386_coff_go32stubbed_vec
#define TARGET_NAME "coff-go32-exe"
@@ -53,54 +46,29 @@
{ COFF_SECTION_NAME_PARTIAL_MATCH (".gnu.linkonce.wi"), \
COFF_ALIGNMENT_FIELD_EMPTY, COFF_ALIGNMENT_FIELD_EMPTY, 0 }
/* Section contains extended relocations. */
#define IMAGE_SCN_LNK_NRELOC_OVFL (0x01000000)
#include "sysdep.h"
#include "bfd.h"
#include "coff/msdos.h"
/* All that ..._PRE and ...POST functions are called from the corresponding
coff_swap... functions. The ...PRE functions are called at the beginning
of the function and the ...POST functions at the end of the swap routines. */
static bfd_cleanup go32exe_check_format (bfd *);
static bool go32exe_write_object_contents (bfd *);
static bool go32exe_mkobject (bfd *);
static bool go32exe_copy_private_bfd_data (bfd *, bfd *);
static void
adjust_filehdr_in_post (bfd *, void *, void *);
static void
adjust_filehdr_out_pre (bfd *, void *, void *);
static void
adjust_filehdr_out_post (bfd *, void *, void *);
static void
adjust_scnhdr_in_post (bfd *, void *, void *);
static void
adjust_scnhdr_out_pre (bfd *, void *, void *);
static void
adjust_scnhdr_out_post (bfd *, void *, void *);
static void
adjust_aux_in_post (bfd *, void *, int, int, int, int, void *);
static void
adjust_aux_out_pre (bfd *, void *, int, int, int, int, void *);
static void
adjust_aux_out_post (bfd *, void *, int, int, int, int, void *);
static void
create_go32_stub (bfd *);
/* Defined in coff-go32.c. */
bool _bfd_go32_mkobject (bfd *);
void _bfd_go32_swap_scnhdr_in (bfd *, void *, void *);
unsigned int _bfd_go32_swap_scnhdr_out (bfd *, void *, void *);
#define COFF_ADJUST_FILEHDR_IN_POST adjust_filehdr_in_post
#define COFF_ADJUST_FILEHDR_OUT_PRE adjust_filehdr_out_pre
#define COFF_ADJUST_FILEHDR_OUT_POST adjust_filehdr_out_post
#define COFF_ADJUST_SCNHDR_IN_POST adjust_scnhdr_in_post
#define COFF_ADJUST_SCNHDR_OUT_PRE adjust_scnhdr_out_pre
#define COFF_ADJUST_SCNHDR_OUT_POST adjust_scnhdr_out_post
#define COFF_ADJUST_AUX_IN_POST adjust_aux_in_post
#define COFF_ADJUST_AUX_OUT_PRE adjust_aux_out_pre
#define COFF_ADJUST_AUX_OUT_POST adjust_aux_out_post
static const bfd_target *go32_check_format (bfd *);
#define COFF_CHECK_FORMAT go32_check_format
static bfd_boolean
go32_stubbed_coff_bfd_copy_private_bfd_data (bfd *, bfd *);
#define coff_bfd_copy_private_bfd_data go32_stubbed_coff_bfd_copy_private_bfd_data
#define COFF_CHECK_FORMAT go32exe_check_format
#define COFF_WRITE_CONTENTS go32exe_write_object_contents
#define coff_mkobject go32exe_mkobject
#define coff_bfd_copy_private_bfd_data go32exe_copy_private_bfd_data
#define coff_SWAP_scnhdr_in _bfd_go32_swap_scnhdr_in
#define coff_SWAP_scnhdr_out _bfd_go32_swap_scnhdr_out
#include "coff-i386.c"
@@ -110,160 +78,15 @@ static bfd_boolean
/* These bytes are a 2048-byte DOS executable, which loads the COFF
image into memory and then runs it. It is called 'stub'. */
static const unsigned char stub_bytes[GO32_STUBSIZE] =
#define GO32EXE_DEFAULT_STUB_SIZE 2048
static const unsigned char go32exe_default_stub[GO32EXE_DEFAULT_STUB_SIZE] =
{
#include "go32stub.h"
};
/*
I have not commented each swap function below, because the
technique is in any function the same. For the ...in function,
all the pointers are adjusted by adding GO32_STUBSIZE and for the
...out function, it is subtracted first and after calling the
standard swap function it is reset to the old value. */
/* This macro is used for adjusting the filepointers, which
is done only, if the pointer is nonzero. */
#define ADJUST_VAL(val,diff) \
if (val != 0) val += diff
static void
adjust_filehdr_in_post (bfd * abfd ATTRIBUTE_UNUSED,
void * src,
void * dst)
{
FILHDR *filehdr_src = (FILHDR *) src;
struct internal_filehdr *filehdr_dst = (struct internal_filehdr *) dst;
ADJUST_VAL (filehdr_dst->f_symptr, GO32_STUBSIZE);
/* Save now the stub to be used later. Put the stub data to FILEHDR_DST
first as coff_data (abfd) still does not exist. It may not even be ever
created as we are just checking the file format of ABFD. */
memcpy (filehdr_dst->go32stub, filehdr_src->stub, GO32_STUBSIZE);
filehdr_dst->f_flags |= F_GO32STUB;
}
static void
adjust_filehdr_out_pre (bfd * abfd, void * in, void * out)
{
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
FILHDR *filehdr_out = (FILHDR *) out;
/* Generate the stub. */
create_go32_stub (abfd);
/* Copy the stub to the file header. */
if (coff_data (abfd)->go32stub != NULL)
memcpy (filehdr_out->stub, coff_data (abfd)->go32stub, GO32_STUBSIZE);
else
/* Use the default. */
memcpy (filehdr_out->stub, stub_bytes, GO32_STUBSIZE);
ADJUST_VAL (filehdr_in->f_symptr, -GO32_STUBSIZE);
}
static void
adjust_filehdr_out_post (bfd * abfd ATTRIBUTE_UNUSED,
void * in,
void * out ATTRIBUTE_UNUSED)
{
struct internal_filehdr *filehdr_in = (struct internal_filehdr *) in;
/* Undo the above change. */
ADJUST_VAL (filehdr_in->f_symptr, GO32_STUBSIZE);
}
static void
adjust_scnhdr_in_post (bfd * abfd ATTRIBUTE_UNUSED,
void * ext ATTRIBUTE_UNUSED,
void * in)
{
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
ADJUST_VAL (scnhdr_int->s_scnptr, GO32_STUBSIZE);
ADJUST_VAL (scnhdr_int->s_relptr, GO32_STUBSIZE);
ADJUST_VAL (scnhdr_int->s_lnnoptr, GO32_STUBSIZE);
}
static void
adjust_scnhdr_out_pre (bfd * abfd ATTRIBUTE_UNUSED,
void * in,
void * out ATTRIBUTE_UNUSED)
{
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
ADJUST_VAL (scnhdr_int->s_scnptr, -GO32_STUBSIZE);
ADJUST_VAL (scnhdr_int->s_relptr, -GO32_STUBSIZE);
ADJUST_VAL (scnhdr_int->s_lnnoptr, -GO32_STUBSIZE);
}
static void
adjust_scnhdr_out_post (bfd * abfd ATTRIBUTE_UNUSED,
void * in,
void * out ATTRIBUTE_UNUSED)
{
struct internal_scnhdr *scnhdr_int = (struct internal_scnhdr *) in;
ADJUST_VAL (scnhdr_int->s_scnptr, GO32_STUBSIZE);
ADJUST_VAL (scnhdr_int->s_relptr, GO32_STUBSIZE);
ADJUST_VAL (scnhdr_int->s_lnnoptr, GO32_STUBSIZE);
}
static void
adjust_aux_in_post (bfd * abfd ATTRIBUTE_UNUSED,
void * ext1 ATTRIBUTE_UNUSED,
int type,
int in_class,
int indx ATTRIBUTE_UNUSED,
int numaux ATTRIBUTE_UNUSED,
void * in1)
{
union internal_auxent *in = (union internal_auxent *) in1;
if (in_class == C_BLOCK || in_class == C_FCN || ISFCN (type)
|| ISTAG (in_class))
{
ADJUST_VAL (in->x_sym.x_fcnary.x_fcn.x_lnnoptr, GO32_STUBSIZE);
}
}
static void
adjust_aux_out_pre (bfd *abfd ATTRIBUTE_UNUSED,
void * inp,
int type,
int in_class,
int indx ATTRIBUTE_UNUSED,
int numaux ATTRIBUTE_UNUSED,
void * extp ATTRIBUTE_UNUSED)
{
union internal_auxent *in = (union internal_auxent *) inp;
if (in_class == C_BLOCK || in_class == C_FCN || ISFCN (type)
|| ISTAG (in_class))
{
ADJUST_VAL (in->x_sym.x_fcnary.x_fcn.x_lnnoptr, -GO32_STUBSIZE);
}
}
static void
adjust_aux_out_post (bfd *abfd ATTRIBUTE_UNUSED,
void * inp,
int type,
int in_class,
int indx ATTRIBUTE_UNUSED,
int numaux ATTRIBUTE_UNUSED,
void * extp ATTRIBUTE_UNUSED)
{
union internal_auxent *in = (union internal_auxent *) inp;
if (in_class == C_BLOCK || in_class == C_FCN || ISFCN (type)
|| ISTAG (in_class))
{
ADJUST_VAL (in->x_sym.x_fcnary.x_fcn.x_lnnoptr, GO32_STUBSIZE);
}
}
/* Temporary location for stub read from input file. */
static char * go32exe_temp_stub = NULL;
static bfd_size_type go32exe_temp_stub_size = 0;
/* That's the function, which creates the stub. There are
different cases from where the stub is taken.
@@ -275,13 +98,16 @@ adjust_aux_out_post (bfd *abfd ATTRIBUTE_UNUSED,
file.
If there was any error, the standard stub (compiled in this file)
is taken. */
is taken.
Ideally this function should exec '$(TARGET)-stubify' to generate
a stub, like gcc does. */
static void
create_go32_stub (bfd *abfd)
go32exe_create_stub (bfd *abfd)
{
/* Do it only once. */
if (coff_data (abfd)->go32stub == NULL)
if (coff_data (abfd)->stub == NULL)
{
char *stub;
struct stat st;
@@ -291,6 +117,22 @@ create_go32_stub (bfd *abfd)
unsigned long coff_start;
long exe_start;
/* If we read a stub from an input file, use that one. */
if (go32exe_temp_stub != NULL)
{
coff_data (abfd)->stub = bfd_alloc (abfd,
go32exe_temp_stub_size);
if (coff_data (abfd)->stub == NULL)
return;
memcpy (coff_data (abfd)->stub, go32exe_temp_stub,
go32exe_temp_stub_size);
coff_data (abfd)->stub_size = go32exe_temp_stub_size;
free (go32exe_temp_stub);
go32exe_temp_stub = NULL;
go32exe_temp_stub_size = 0;
return;
}
/* Check at first the environment variable $(GO32STUB). */
stub = getenv ("GO32STUB");
/* Now check the environment variable $(STUB). */
@@ -323,13 +165,6 @@ create_go32_stub (bfd *abfd)
if (_H (1))
coff_start += (long) _H (1) - 512L;
/* Currently there is only a fixed stub size of 2048 bytes
supported. */
if (coff_start != 2048)
{
close (f);
goto stub_end;
}
exe_start = _H (4) * 16;
if ((long) lseek (f, exe_start, SEEK_SET) != exe_start)
{
@@ -341,84 +176,207 @@ create_go32_stub (bfd *abfd)
close (f);
goto stub_end;
}
if (! CONST_STRNEQ (magic, "go32stub"))
if (! startswith (magic, "go32stub"))
{
close (f);
goto stub_end;
}
/* Now we found a correct stub (hopefully). */
coff_data (abfd)->go32stub = bfd_alloc (abfd, (bfd_size_type) coff_start);
if (coff_data (abfd)->go32stub == NULL)
coff_data (abfd)->stub = bfd_alloc (abfd, (bfd_size_type) coff_start);
if (coff_data (abfd)->stub == NULL)
{
close (f);
return;
}
lseek (f, 0L, SEEK_SET);
if ((unsigned long) read (f, coff_data (abfd)->go32stub, coff_start)
if ((unsigned long) read (f, coff_data (abfd)->stub, coff_start)
!= coff_start)
{
bfd_release (abfd, coff_data (abfd)->go32stub);
coff_data (abfd)->go32stub = NULL;
bfd_release (abfd, coff_data (abfd)->stub);
coff_data (abfd)->stub = NULL;
}
else
coff_data (abfd)->stub_size = coff_start;
close (f);
}
stub_end:
stub_end:
/* There was something wrong above, so use now the standard builtin
stub. */
if (coff_data (abfd)->go32stub == NULL)
if (coff_data (abfd)->stub == NULL)
{
coff_data (abfd)->go32stub
= bfd_alloc (abfd, (bfd_size_type) GO32_STUBSIZE);
if (coff_data (abfd)->go32stub == NULL)
coff_data (abfd)->stub
= bfd_alloc (abfd, (bfd_size_type) GO32EXE_DEFAULT_STUB_SIZE);
if (coff_data (abfd)->stub == NULL)
return;
memcpy (coff_data (abfd)->go32stub, stub_bytes, GO32_STUBSIZE);
memcpy (coff_data (abfd)->stub, go32exe_default_stub,
GO32EXE_DEFAULT_STUB_SIZE);
coff_data (abfd)->stub_size = GO32EXE_DEFAULT_STUB_SIZE;
}
}
/* If ibfd was a stubbed coff image, copy the stub from that bfd
to the new obfd. */
static bfd_boolean
go32_stubbed_coff_bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
static bool
go32exe_copy_private_bfd_data (bfd *ibfd, bfd *obfd)
{
/* Check if both are the same targets. */
if (ibfd->xvec != obfd->xvec)
return TRUE;
return true;
/* Check if we have a source stub. */
if (coff_data (ibfd)->go32stub == NULL)
return TRUE;
/* Make sure we have a source stub. */
BFD_ASSERT (coff_data (ibfd)->stub != NULL);
/* As adjust_filehdr_out_pre may get called only after this function,
optionally allocate the output stub. */
if (coff_data (obfd)->go32stub == NULL)
coff_data (obfd)->go32stub = bfd_alloc (obfd,
(bfd_size_type) GO32_STUBSIZE);
/* Reallocate the output stub if necessary. */
if (coff_data (ibfd)->stub_size > coff_data (obfd)->stub_size)
coff_data (obfd)->stub = bfd_alloc (obfd, coff_data (ibfd)->stub_size);
if (coff_data (obfd)->stub == NULL)
return false;
/* Now copy the stub. */
if (coff_data (obfd)->go32stub != NULL)
memcpy (coff_data (obfd)->go32stub, coff_data (ibfd)->go32stub,
GO32_STUBSIZE);
memcpy (coff_data (obfd)->stub, coff_data (ibfd)->stub,
coff_data (ibfd)->stub_size);
coff_data (obfd)->stub_size = coff_data (ibfd)->stub_size;
obfd->origin = coff_data (obfd)->stub_size;
return TRUE;
return true;
}
/* coff_object_p only checks 2 bytes F_MAGIC at GO32_STUBSIZE inside the file
which is too fragile. */
/* Cleanup function, returned from check_format hook. */
static const bfd_target *
go32_check_format (bfd *abfd)
static void
go32exe_cleanup (bfd *abfd)
{
char mz[2];
abfd->origin = 0;
if (bfd_bread (mz, 2, abfd) != 2 || mz[0] != 'M' || mz[1] != 'Z')
free (go32exe_temp_stub);
go32exe_temp_stub = NULL;
go32exe_temp_stub_size = 0;
}
/* Check that there is a GO32 stub and read it to go32exe_temp_stub.
Then set abfd->origin so that the COFF image is read at the correct
file offset. */
static bfd_cleanup
go32exe_check_format (bfd *abfd)
{
struct external_DOS_hdr filehdr_dos;
uint16_t num_pages;
uint16_t last_page_size;
uint32_t header_end;
bfd_size_type stubsize;
/* This format can not appear in an archive. */
if (abfd->origin != 0)
{
bfd_set_error (bfd_error_wrong_format);
return NULL;
}
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
return NULL;
bfd_set_error (bfd_error_system_call);
return coff_object_p (abfd);
/* Read in the stub file header, which is a DOS MZ executable. */
if (bfd_bread (&filehdr_dos, DOS_HDR_SIZE, abfd) != DOS_HDR_SIZE)
goto fail;
/* Make sure that this is an MZ executable. */
if (H_GET_16 (abfd, filehdr_dos.e_magic) != IMAGE_DOS_SIGNATURE)
goto fail_format;
/* Determine the size of the stub */
num_pages = H_GET_16 (abfd, filehdr_dos.e_cp);
last_page_size = H_GET_16 (abfd, filehdr_dos.e_cblp);
stubsize = num_pages * 512;
if (last_page_size != 0)
stubsize += last_page_size - 512;
/* Save now the stub to be used later. Put the stub data to a temporary
location first as tdata still does not exist. It may not even
be ever created if we are just checking the file format of ABFD. */
bfd_seek (abfd, 0, SEEK_SET);
go32exe_temp_stub = bfd_malloc (stubsize);
if (go32exe_temp_stub == NULL)
goto fail;
if (bfd_bread (go32exe_temp_stub, stubsize, abfd) != stubsize)
goto fail;
go32exe_temp_stub_size = stubsize;
/* Confirm that this is a go32stub. */
header_end = H_GET_16 (abfd, filehdr_dos.e_cparhdr) * 16UL;
if (go32exe_temp_stub_size < header_end
|| go32exe_temp_stub_size - header_end < sizeof "go32stub" - 1
|| !startswith (go32exe_temp_stub + header_end, "go32stub"))
goto fail_format;
/* Set origin to where the COFF header starts and seek there. */
abfd->origin = stubsize;
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
goto fail;
/* Call coff_object_p to read the COFF image. If this fails then the file
must be just a stub with no COFF data attached. */
bfd_cleanup cleanup = coff_object_p (abfd);
if (cleanup == NULL)
goto fail;
BFD_ASSERT (cleanup == _bfd_no_cleanup);
return go32exe_cleanup;
fail_format:
bfd_set_error (bfd_error_wrong_format);
fail:
go32exe_cleanup (abfd);
return NULL;
}
/* Write the stub to the output file, then call coff_write_object_contents. */
static bool
go32exe_write_object_contents (bfd *abfd)
{
const bfd_size_type pos = bfd_tell (abfd);
const bfd_size_type stubsize = coff_data (abfd)->stub_size;
BFD_ASSERT (stubsize != 0);
bfd_set_error (bfd_error_system_call);
/* Write the stub. */
abfd->origin = 0;
if (bfd_seek (abfd, 0, SEEK_SET) != 0)
return false;
if (bfd_bwrite (coff_data (abfd)->stub, stubsize, abfd) != stubsize)
return false;
/* Seek back to where we were. */
abfd->origin = stubsize;
if (bfd_seek (abfd, pos, SEEK_SET) != 0)
return false;
return coff_write_object_contents (abfd);
}
/* mkobject hook. Called directly through bfd_set_format or via
coff_mkobject_hook etc from bfd_check_format. */
static bool
go32exe_mkobject (bfd *abfd)
{
/* Don't output to an archive. */
if (abfd->my_archive != NULL)
return false;
if (!_bfd_go32_mkobject (abfd))
return false;
go32exe_create_stub (abfd);
if (coff_data (abfd)->stub == NULL)
{
bfd_release (abfd, coff_data (abfd));
return false;
}
abfd->origin = coff_data (abfd)->stub_size;
return true;
}
+22 -14
View File
@@ -1,5 +1,5 @@
/* BFD back-end for TMS320C30 coff binaries.
Copyright (C) 1998-2018 Free Software Foundation, Inc.
Copyright (C) 1998-2022 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.
@@ -31,16 +31,16 @@
reloc_howto_type tic30_coff_howto_table[] =
{
HOWTO (R_TIC30_ABS16, 2, 1, 16, FALSE, 0, 0, NULL,
"16", FALSE, 0x0000FFFF, 0x0000FFFF, FALSE),
HOWTO (R_TIC30_ABS24, 2, 2, 24, FALSE, 8, complain_overflow_bitfield, NULL,
"24", FALSE, 0xFFFFFF00, 0xFFFFFF00, FALSE),
HOWTO (R_TIC30_LDP, 18, 0, 24, FALSE, 0, complain_overflow_bitfield, NULL,
"LDP", FALSE, 0x00FF0000, 0x000000FF, FALSE),
HOWTO (R_TIC30_ABS32, 2, 2, 32, FALSE, 0, complain_overflow_bitfield, NULL,
"32", FALSE, 0xFFFFFFFF, 0xFFFFFFFF, FALSE),
HOWTO (R_TIC30_PC16, 2, 1, 16, TRUE, 0, complain_overflow_signed, NULL,
"PCREL", FALSE, 0x0000FFFF, 0x0000FFFF, FALSE),
HOWTO (R_TIC30_ABS16, 2, 2, 16, false, 0, 0, NULL,
"16", false, 0x0000FFFF, 0x0000FFFF, false),
HOWTO (R_TIC30_ABS24, 2, 4, 24, false, 8, complain_overflow_bitfield, NULL,
"24", false, 0xFFFFFF00, 0xFFFFFF00, false),
HOWTO (R_TIC30_LDP, 18, 1, 24, false, 0, complain_overflow_bitfield, NULL,
"LDP", false, 0x00FF0000, 0x000000FF, false),
HOWTO (R_TIC30_ABS32, 2, 4, 32, false, 0, complain_overflow_bitfield, NULL,
"32", false, 0xFFFFFFFF, 0xFFFFFFFF, false),
HOWTO (R_TIC30_PC16, 2, 2, 16, true, 0, complain_overflow_signed, NULL,
"PCREL", false, 0x0000FFFF, 0x0000FFFF, false),
EMPTY_HOWTO (-1)
};
@@ -161,11 +161,18 @@ reloc_processing (arelent *relent,
relent->address = reloc->r_vaddr;
rtype2howto (relent, reloc);
if (reloc->r_symndx > 0)
if (reloc->r_symndx == -1)
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
else if (reloc->r_symndx >= 0 && reloc->r_symndx < obj_conv_table_size (abfd))
relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
else
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
{
_bfd_error_handler
/* xgettext:c-format */
(_("%pB: warning: illegal symbol index %ld in relocs"),
abfd, reloc->r_symndx);
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
}
relent->addend = reloc->r_offset;
relent->address -= section->vma;
}
@@ -192,6 +199,7 @@ const bfd_target tic30_coff_vec =
'/', /* ar_pad_char */
15, /* ar_max_namelen */
0, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
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 */
+18 -18
View File
@@ -1,5 +1,5 @@
/* BFD back-end for TMS320C4X coff binaries.
Copyright (C) 1996-2018 Free Software Foundation, Inc.
Copyright (C) 1996-2022 Free Software Foundation, Inc.
Contributed by Michael Hayes (m.hayes@elec.canterbury.ac.nz)
@@ -41,13 +41,13 @@ tic4x_reloc_processing (arelent *, struct internal_reloc *,
/* Replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local
labels. */
static bfd_boolean
static bool
ticoff_bfd_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED,
const char *name)
{
if (TICOFF_LOCAL_LABEL_P(name))
return TRUE;
return FALSE;
return true;
return false;
}
#define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name
@@ -92,20 +92,20 @@ tic4x_relocation (bfd *abfd ATTRIBUTE_UNUSED,
reloc_howto_type tic4x_howto_table[] =
{
HOWTO(R_RELWORD, 0, 2, 16, FALSE, 0, complain_overflow_signed, tic4x_relocation, "RELWORD", TRUE, 0x0000ffff, 0x0000ffff, FALSE),
HOWTO(R_REL24, 0, 2, 24, FALSE, 0, complain_overflow_bitfield, tic4x_relocation, "REL24", TRUE, 0x00ffffff, 0x00ffffff, FALSE),
HOWTO(R_RELLONG, 0, 2, 32, FALSE, 0, complain_overflow_dont, tic4x_relocation, "RELLONG", TRUE, 0xffffffff, 0xffffffff, FALSE),
HOWTO(R_PCRWORD, 0, 2, 16, TRUE, 0, complain_overflow_signed, tic4x_relocation, "PCRWORD", TRUE, 0x0000ffff, 0x0000ffff, FALSE),
HOWTO(R_PCR24, 0, 2, 24, TRUE, 0, complain_overflow_signed, tic4x_relocation, "PCR24", TRUE, 0x00ffffff, 0x00ffffff, FALSE),
HOWTO(R_PARTLS16, 0, 2, 16, FALSE, 0, complain_overflow_dont, tic4x_relocation, "PARTLS16", TRUE, 0x0000ffff, 0x0000ffff, FALSE),
HOWTO(R_PARTMS8, 16, 2, 16, FALSE, 0, complain_overflow_dont, tic4x_relocation, "PARTMS8", TRUE, 0x0000ffff, 0x0000ffff, FALSE),
HOWTO(R_RELWORD, 0, 2, 16, FALSE, 0, complain_overflow_signed, tic4x_relocation, "ARELWORD", TRUE, 0x0000ffff, 0x0000ffff, FALSE),
HOWTO(R_REL24, 0, 2, 24, FALSE, 0, complain_overflow_signed, tic4x_relocation, "AREL24", TRUE, 0x00ffffff, 0x00ffffff, FALSE),
HOWTO(R_RELLONG, 0, 2, 32, FALSE, 0, complain_overflow_signed, tic4x_relocation, "ARELLONG", TRUE, 0xffffffff, 0xffffffff, FALSE),
HOWTO(R_PCRWORD, 0, 2, 16, TRUE, 0, complain_overflow_signed, tic4x_relocation, "APCRWORD", TRUE, 0x0000ffff, 0x0000ffff, FALSE),
HOWTO(R_PCR24, 0, 2, 24, TRUE, 0, complain_overflow_signed, tic4x_relocation, "APCR24", TRUE, 0x00ffffff, 0x00ffffff, FALSE),
HOWTO(R_PARTLS16, 0, 2, 16, FALSE, 0, complain_overflow_dont, tic4x_relocation, "APARTLS16", TRUE, 0x0000ffff, 0x0000ffff, FALSE),
HOWTO(R_PARTMS8, 16, 2, 16, FALSE, 0, complain_overflow_dont, tic4x_relocation, "APARTMS8", TRUE, 0x0000ffff, 0x0000ffff, FALSE),
HOWTO(R_RELWORD, 0, 4, 16, false, 0, complain_overflow_signed, tic4x_relocation, "RELWORD", true, 0x0000ffff, 0x0000ffff, false),
HOWTO(R_REL24, 0, 4, 24, false, 0, complain_overflow_bitfield, tic4x_relocation, "REL24", true, 0x00ffffff, 0x00ffffff, false),
HOWTO(R_RELLONG, 0, 4, 32, false, 0, complain_overflow_dont, tic4x_relocation, "RELLONG", true, 0xffffffff, 0xffffffff, false),
HOWTO(R_PCRWORD, 0, 4, 16, true, 0, complain_overflow_signed, tic4x_relocation, "PCRWORD", true, 0x0000ffff, 0x0000ffff, false),
HOWTO(R_PCR24, 0, 4, 24, true, 0, complain_overflow_signed, tic4x_relocation, "PCR24", true, 0x00ffffff, 0x00ffffff, false),
HOWTO(R_PARTLS16, 0, 4, 16, false, 0, complain_overflow_dont, tic4x_relocation, "PARTLS16", true, 0x0000ffff, 0x0000ffff, false),
HOWTO(R_PARTMS8, 16, 4, 16, false, 0, complain_overflow_dont, tic4x_relocation, "PARTMS8", true, 0x0000ffff, 0x0000ffff, false),
HOWTO(R_RELWORD, 0, 4, 16, false, 0, complain_overflow_signed, tic4x_relocation, "ARELWORD", true, 0x0000ffff, 0x0000ffff, false),
HOWTO(R_REL24, 0, 4, 24, false, 0, complain_overflow_signed, tic4x_relocation, "AREL24", true, 0x00ffffff, 0x00ffffff, false),
HOWTO(R_RELLONG, 0, 4, 32, false, 0, complain_overflow_signed, tic4x_relocation, "ARELLONG", true, 0xffffffff, 0xffffffff, false),
HOWTO(R_PCRWORD, 0, 4, 16, true, 0, complain_overflow_signed, tic4x_relocation, "APCRWORD", true, 0x0000ffff, 0x0000ffff, false),
HOWTO(R_PCR24, 0, 4, 24, true, 0, complain_overflow_signed, tic4x_relocation, "APCR24", true, 0x00ffffff, 0x00ffffff, false),
HOWTO(R_PARTLS16, 0, 4, 16, false, 0, complain_overflow_dont, tic4x_relocation, "APARTLS16", true, 0x0000ffff, 0x0000ffff, false),
HOWTO(R_PARTMS8, 16, 4, 16, false, 0, complain_overflow_dont, tic4x_relocation, "APARTMS8", true, 0x0000ffff, 0x0000ffff, false),
};
#define HOWTO_SIZE (sizeof(tic4x_howto_table) / sizeof(tic4x_howto_table[0]))
+63 -37
View File
@@ -1,5 +1,5 @@
/* BFD back-end for TMS320C54X coff binaries.
Copyright (C) 1999-2018 Free Software Foundation, Inc.
Copyright (C) 1999-2022 Free Software Foundation, Inc.
Contributed by Timothy Wall (twall@cygnus.com)
This file is part of BFD, the Binary File Descriptor library.
@@ -82,14 +82,14 @@ tic54x_getl_signed_32 (const void *p)
#define coff_get_section_load_page bfd_ticoff_get_section_load_page
#define coff_set_section_load_page bfd_ticoff_set_section_load_page
void
static void
bfd_ticoff_set_section_load_page (asection *sect,
int page)
{
sect->lma = (sect->lma & ADDR_MASK) | PG_TO_FLAG(page);
}
int
static int
bfd_ticoff_get_section_load_page (asection *sect)
{
int page;
@@ -112,7 +112,7 @@ bfd_ticoff_get_section_load_page (asection *sect)
/* Set the architecture appropriately. Allow unkown architectures
(e.g. binary). */
static bfd_boolean
static bool
tic54x_set_arch_mach (bfd *abfd,
enum bfd_architecture arch,
unsigned long machine)
@@ -121,7 +121,7 @@ tic54x_set_arch_mach (bfd *abfd,
arch = bfd_arch_tic54x;
else if (arch != bfd_arch_tic54x)
return FALSE;
return false;
return bfd_default_set_arch_mach (abfd, arch, machine);
}
@@ -148,65 +148,65 @@ tic54x_relocation (bfd *abfd ATTRIBUTE_UNUSED,
reloc_howto_type tic54x_howto_table[] =
{
/* type,rightshift,size (0=byte, 1=short, 2=long),
/* type,rightshift,size,
bit size, pc_relative, bitpos, dont complain_on_overflow,
special_function, name, partial_inplace, src_mask, dst_mask, pcrel_offset. */
/* NORMAL BANK */
/* 16-bit direct reference to symbol's address. */
HOWTO (R_RELWORD,0,1,16,FALSE,0,complain_overflow_dont,
tic54x_relocation,"REL16",FALSE,0xFFFF,0xFFFF,FALSE),
HOWTO (R_RELWORD,0,2,16,false,0,complain_overflow_dont,
tic54x_relocation,"REL16",false,0xFFFF,0xFFFF,false),
/* 7 LSBs of an address */
HOWTO (R_PARTLS7,0,1,7,FALSE,0,complain_overflow_dont,
tic54x_relocation,"LS7",FALSE,0x007F,0x007F,FALSE),
HOWTO (R_PARTLS7,0,2,7,false,0,complain_overflow_dont,
tic54x_relocation,"LS7",false,0x007F,0x007F,false),
/* 9 MSBs of an address */
/* TI assembler doesn't shift its encoding, and is thus incompatible */
HOWTO (R_PARTMS9,7,1,9,FALSE,0,complain_overflow_dont,
tic54x_relocation,"MS9",FALSE,0x01FF,0x01FF,FALSE),
HOWTO (R_PARTMS9,7,2,9,false,0,complain_overflow_dont,
tic54x_relocation,"MS9",false,0x01FF,0x01FF,false),
/* 23-bit relocation */
HOWTO (R_EXTWORD,0,2,23,FALSE,0,complain_overflow_dont,
tic54x_relocation,"RELEXT",FALSE,0x7FFFFF,0x7FFFFF,FALSE),
HOWTO (R_EXTWORD,0,4,23,false,0,complain_overflow_dont,
tic54x_relocation,"RELEXT",false,0x7FFFFF,0x7FFFFF,false),
/* 16 bits of 23-bit extended address */
HOWTO (R_EXTWORD16,0,1,16,FALSE,0,complain_overflow_dont,
tic54x_relocation,"RELEXT16",FALSE,0x7FFFFF,0x7FFFFF,FALSE),
HOWTO (R_EXTWORD16,0,2,16,false,0,complain_overflow_dont,
tic54x_relocation,"RELEXT16",false,0x7FFFFF,0x7FFFFF,false),
/* upper 7 bits of 23-bit extended address */
HOWTO (R_EXTWORDMS7,16,1,7,FALSE,0,complain_overflow_dont,
tic54x_relocation,"RELEXTMS7",FALSE,0x7F,0x7F,FALSE),
HOWTO (R_EXTWORDMS7,16,2,7,false,0,complain_overflow_dont,
tic54x_relocation,"RELEXTMS7",false,0x7F,0x7F,false),
/* ABSOLUTE BANK */
/* 16-bit direct reference to symbol's address, absolute */
HOWTO (R_RELWORD,0,1,16,FALSE,0,complain_overflow_dont,
tic54x_relocation,"AREL16",FALSE,0xFFFF,0xFFFF,FALSE),
HOWTO (R_RELWORD,0,2,16,false,0,complain_overflow_dont,
tic54x_relocation,"AREL16",false,0xFFFF,0xFFFF,false),
/* 7 LSBs of an address, absolute */
HOWTO (R_PARTLS7,0,1,7,FALSE,0,complain_overflow_dont,
tic54x_relocation,"ALS7",FALSE,0x007F,0x007F,FALSE),
HOWTO (R_PARTLS7,0,2,7,false,0,complain_overflow_dont,
tic54x_relocation,"ALS7",false,0x007F,0x007F,false),
/* 9 MSBs of an address, absolute */
/* TI assembler doesn't shift its encoding, and is thus incompatible */
HOWTO (R_PARTMS9,7,1,9,FALSE,0,complain_overflow_dont,
tic54x_relocation,"AMS9",FALSE,0x01FF,0x01FF,FALSE),
HOWTO (R_PARTMS9,7,2,9,false,0,complain_overflow_dont,
tic54x_relocation,"AMS9",false,0x01FF,0x01FF,false),
/* 23-bit direct reference, absolute */
HOWTO (R_EXTWORD,0,2,23,FALSE,0,complain_overflow_dont,
tic54x_relocation,"ARELEXT",FALSE,0x7FFFFF,0x7FFFFF,FALSE),
HOWTO (R_EXTWORD,0,4,23,false,0,complain_overflow_dont,
tic54x_relocation,"ARELEXT",false,0x7FFFFF,0x7FFFFF,false),
/* 16 bits of 23-bit extended address, absolute */
HOWTO (R_EXTWORD16,0,1,16,FALSE,0,complain_overflow_dont,
tic54x_relocation,"ARELEXT16",FALSE,0x7FFFFF,0x7FFFFF,FALSE),
HOWTO (R_EXTWORD16,0,2,16,false,0,complain_overflow_dont,
tic54x_relocation,"ARELEXT16",false,0x7FFFFF,0x7FFFFF,false),
/* upper 7 bits of 23-bit extended address, absolute */
HOWTO (R_EXTWORDMS7,16,1,7,FALSE,0,complain_overflow_dont,
tic54x_relocation,"ARELEXTMS7",FALSE,0x7F,0x7F,FALSE),
HOWTO (R_EXTWORDMS7,16,2,7,false,0,complain_overflow_dont,
tic54x_relocation,"ARELEXTMS7",false,0x7F,0x7F,false),
/* 32-bit relocation exclusively for stabs */
HOWTO (R_RELLONG,0,2,32,FALSE,0,complain_overflow_dont,
tic54x_relocation,"STAB",FALSE,0xFFFFFFFF,0xFFFFFFFF,FALSE),
HOWTO (R_RELLONG,0,4,32,false,0,complain_overflow_dont,
tic54x_relocation,"STAB",false,0xFFFFFFFF,0xFFFFFFFF,false),
};
#define coff_bfd_reloc_type_lookup tic54x_coff_reloc_type_lookup
@@ -278,7 +278,7 @@ tic54x_lookup_howto (bfd *abfd,
_bfd_error_handler (_("%pB: unsupported relocation type %#x"),
abfd, (unsigned int) dst->r_type);
abort ();
internal->howto = NULL;
}
#define RELOC_PROCESSING(RELENT,RELOC,SYMS,ABFD,SECT)\
@@ -312,13 +312,13 @@ coff_tic54x_rtype_to_howto (bfd *abfd,
/* Replace the stock _bfd_coff_is_local_label_name to recognize TI COFF local
labels. */
static bfd_boolean
static bool
ticoff_bfd_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED,
const char *name)
{
if (TICOFF_LOCAL_LABEL_P(name))
return TRUE;
return FALSE;
return true;
return false;
}
#define coff_bfd_is_local_label_name ticoff_bfd_is_local_label_name
@@ -335,7 +335,7 @@ ticoff_bfd_is_local_label_name (bfd *abfd ATTRIBUTE_UNUSED,
#include "coffcode.h"
static bfd_boolean
static bool
tic54x_set_section_contents (bfd *abfd,
sec_ptr section,
const void * location,
@@ -415,6 +415,7 @@ const bfd_target tic54x_coff0_vec =
'/', /* ar_pad_char */
15, /* ar_max_namelen */
0, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
@@ -472,6 +473,11 @@ const bfd_target tic54x_coff0_beh_vec =
'/', /* ar_pad_char */
15, /* ar_max_namelen */
0, /* match priority. */
#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
true, /* keep unused section symbols. */
#else
false, /* keep unused section symbols. */
#endif
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
@@ -530,6 +536,11 @@ const bfd_target tic54x_coff1_vec =
'/', /* ar_pad_char */
15, /* ar_max_namelen */
0, /* match priority. */
#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
true, /* keep unused section symbols. */
#else
false, /* keep unused section symbols. */
#endif
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
@@ -588,6 +599,11 @@ const bfd_target tic54x_coff1_beh_vec =
'/', /* ar_pad_char */
15, /* ar_max_namelen */
0, /* match priority. */
#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
true, /* keep unused section symbols. */
#else
false, /* keep unused section symbols. */
#endif
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
@@ -646,6 +662,11 @@ const bfd_target tic54x_coff2_vec =
'/', /* ar_pad_char */
15, /* ar_max_namelen */
0, /* match priority. */
#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
true, /* keep unused section symbols. */
#else
false, /* keep unused section symbols. */
#endif
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
@@ -704,6 +725,11 @@ const bfd_target tic54x_coff2_beh_vec =
'/', /* ar_pad_char */
15, /* ar_max_namelen */
0, /* match priority. */
#ifdef TARGET_KEEP_UNUSED_SECTION_SYMBOLS
true, /* keep unused section symbols. */
#else
false, /* keep unused section symbols. */
#endif
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
tic54x_getl32, tic54x_getl_signed_32, tic54x_putl32,
bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* data */
-711
View File
@@ -1,711 +0,0 @@
/* BFD back-end for Texas Instruments TMS320C80 Multimedia Video Processor (MVP).
Copyright (C) 1996-2018 Free Software Foundation, Inc.
Written by Fred Fish (fnf@cygnus.com)
There is nothing new under the sun. This file draws a lot on other
coff files.
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 3 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, 51 Franklin Street - Fifth Floor,
Boston, MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "bfdlink.h"
#include "libbfd.h"
#ifdef _CONST
/* Newlib-based hosts define _CONST as a STDC-safe alias for const,
but to the tic80 toolchain it means something altogether different.
Since sysdep.h will have pulled in stdio.h and hence _ansi.h which
contains this definition, we must undef it before including the
tic80-specific definition. */
#undef _CONST
#endif /* _CONST */
#include "coff/tic80.h"
#include "coff/internal.h"
#include "libcoff.h"
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (2)
#define COFF_ALIGN_IN_SECTION_HEADER 1
#define COFF_ALIGN_IN_SFLAGS 1
#define COFF_ENCODE_ALIGNMENT(S,X) ((S).s_flags |= (((unsigned)(X) & 0xf) << 8))
#define COFF_DECODE_ALIGNMENT(X) (((X) >> 8) & 0xf)
#define GET_SCNHDR_FLAGS H_GET_16
#define PUT_SCNHDR_FLAGS H_PUT_16
static bfd_reloc_status_type ppbase_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type glob15_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type glob16_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static bfd_reloc_status_type local16_reloc
(bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
static reloc_howto_type tic80_howto_table[] =
{
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 */
NULL, /* special_function */
"RELLONG", /* name */
TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_MPPCR, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
TRUE, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
NULL, /* special_function */
"MPPCR", /* name */
TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
TRUE), /* pcrel_offset */
HOWTO (R_ABS, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
NULL, /* special_function */
"ABS", /* name */
TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPBASE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppbase_reloc, /* special_function */
"PPBASE", /* name */
TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPLBASE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
ppbase_reloc, /* special_function */
"PPLBASE", /* name */
TRUE, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PP15, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob15_reloc, /* special_function */
"PP15", /* name */
TRUE, /* partial_inplace */
0x1ffc0, /* src_mask */
0x1ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PP15W, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob15_reloc, /* special_function */
"PP15W", /* name */
TRUE, /* partial_inplace */
0x1ffc0, /* src_mask */
0x1ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PP15H, /* type */
1, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob15_reloc, /* special_function */
"PP15H", /* name */
TRUE, /* partial_inplace */
0x1ffc0, /* src_mask */
0x1ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PP16B, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob16_reloc, /* special_function */
"PP16B", /* name */
TRUE, /* partial_inplace */
0x3ffc0, /* src_mask */
0x3ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPL15, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"PPL15", /* name */
TRUE, /* partial_inplace */
0x7fff, /* src_mask */
0x7fff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPL15W, /* type */
2, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"PPL15W", /* name */
TRUE, /* partial_inplace */
0x7fff, /* src_mask */
0x7fff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPL15H, /* type */
1, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"PPL15H", /* name */
TRUE, /* partial_inplace */
0x7fff, /* src_mask */
0x7fff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPL16B, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
local16_reloc, /* special_function */
"PPL16B", /* name */
TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPN15, /* type */
0, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob15_reloc, /* special_function */
"PPN15", /* name */
TRUE, /* partial_inplace */
0x1ffc0, /* src_mask */
0x1ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPN15W, /* type */
2, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob15_reloc, /* special_function */
"PPN15W", /* name */
TRUE, /* partial_inplace */
0x1ffc0, /* src_mask */
0x1ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPN15H, /* type */
1, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob15_reloc, /* special_function */
"PPN15H", /* name */
TRUE, /* partial_inplace */
0x1ffc0, /* src_mask */
0x1ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPN16B, /* type */
0, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
16, /* bitsize */
FALSE, /* pc_relative */
6, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
glob16_reloc, /* special_function */
"PPN16B", /* name */
TRUE, /* partial_inplace */
0x3ffc0, /* src_mask */
0x3ffc0, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPLN15, /* type */
0, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"PPLN15", /* name */
TRUE, /* partial_inplace */
0x7fff, /* src_mask */
0x7fff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPLN15W, /* type */
2, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"PPLN15W", /* name */
TRUE, /* partial_inplace */
0x7fff, /* src_mask */
0x7fff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPLN15H, /* type */
1, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
NULL, /* special_function */
"PPLN15H", /* name */
TRUE, /* partial_inplace */
0x7fff, /* src_mask */
0x7fff, /* dst_mask */
FALSE), /* pcrel_offset */
HOWTO (R_PPLN16B, /* type */
0, /* rightshift */
-2, /* size (0 = byte, 1 = short, 2 = long) */
15, /* bitsize */
FALSE, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
local16_reloc, /* special_function */
"PPLN16B", /* name */
TRUE, /* partial_inplace */
0xffff, /* src_mask */
0xffff, /* dst_mask */
FALSE) /* pcrel_offset */
};
/* Special relocation functions, used when the output file is not
itself a COFF TIc80 file. */
/* This special function is used for the base address type
relocations. */
static bfd_reloc_status_type
ppbase_reloc (bfd *abfd ATTRIBUTE_UNUSED,
arelent *reloc_entry ATTRIBUTE_UNUSED,
asymbol *symbol_in ATTRIBUTE_UNUSED,
void * data ATTRIBUTE_UNUSED,
asection *input_section ATTRIBUTE_UNUSED,
bfd *output_bfd ATTRIBUTE_UNUSED,
char **error_message ATTRIBUTE_UNUSED)
{
/* FIXME. */
abort ();
}
/* This special function is used for the global 15 bit relocations. */
static bfd_reloc_status_type
glob15_reloc (bfd *abfd ATTRIBUTE_UNUSED,
arelent *reloc_entry ATTRIBUTE_UNUSED,
asymbol *symbol_in ATTRIBUTE_UNUSED,
void * data ATTRIBUTE_UNUSED,
asection *input_section ATTRIBUTE_UNUSED,
bfd *output_bfd ATTRIBUTE_UNUSED,
char **error_message ATTRIBUTE_UNUSED)
{
/* FIXME. */
abort ();
}
/* This special function is used for the global 16 bit relocations. */
static bfd_reloc_status_type
glob16_reloc (bfd *abfd ATTRIBUTE_UNUSED,
arelent *reloc_entry ATTRIBUTE_UNUSED,
asymbol *symbol_in ATTRIBUTE_UNUSED,
void * data ATTRIBUTE_UNUSED,
asection *input_section ATTRIBUTE_UNUSED,
bfd *output_bfd ATTRIBUTE_UNUSED,
char **error_message ATTRIBUTE_UNUSED)
{
/* FIXME. */
abort ();
}
/* This special function is used for the local 16 bit relocations. */
static bfd_reloc_status_type
local16_reloc (bfd *abfd ATTRIBUTE_UNUSED,
arelent *reloc_entry ATTRIBUTE_UNUSED,
asymbol *symbol_in ATTRIBUTE_UNUSED,
void * data ATTRIBUTE_UNUSED,
asection *input_section ATTRIBUTE_UNUSED,
bfd *output_bfd ATTRIBUTE_UNUSED,
char **error_message ATTRIBUTE_UNUSED)
{
/* FIXME. */
abort ();
}
/* Code to turn an external r_type into a pointer to an entry in the howto_table.
If passed an r_type we don't recognize the abort rather than silently failing
to generate an output file. */
static void
rtype2howto (arelent *cache_ptr, struct internal_reloc *dst)
{
unsigned int i;
for (i = 0; i < sizeof tic80_howto_table / sizeof tic80_howto_table[0]; i++)
{
if (tic80_howto_table[i].type == dst->r_type)
{
cache_ptr->howto = tic80_howto_table + i;
return;
}
}
_bfd_error_handler (_("unsupported relocation type %#x"),
(unsigned int) dst->r_type);
cache_ptr->howto = tic80_howto_table + 0;
}
#define RTYPE2HOWTO(cache_ptr, dst) rtype2howto (cache_ptr, dst)
#define coff_rtype_to_howto coff_tic80_rtype_to_howto
static reloc_howto_type *
coff_tic80_rtype_to_howto (bfd *abfd ATTRIBUTE_UNUSED,
asection *sec,
struct internal_reloc *rel,
struct coff_link_hash_entry *h ATTRIBUTE_UNUSED,
struct internal_syment *sym ATTRIBUTE_UNUSED,
bfd_vma *addendp)
{
arelent genrel;
if (rel -> r_symndx == -1 && addendp != NULL)
{
/* This is a TI "internal relocation", which means that the relocation
amount is the amount by which the current section is being relocated
in the output section. */
*addendp = (sec -> output_section -> vma + sec -> output_offset) - sec -> vma;
}
RTYPE2HOWTO (&genrel, rel);
return genrel.howto;
}
#ifndef BADMAG
#define BADMAG(x) TIC80BADMAG(x)
#endif
#define coff_relocate_section coff_tic80_relocate_section
/* We need a special relocation routine to handle the PP relocs. Most
of this is a copy of _bfd_coff_generic_relocate_section. */
static bfd_boolean
coff_tic80_relocate_section (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)
{
struct internal_reloc *rel;
struct internal_reloc *relend;
rel = relocs;
relend = rel + input_section->reloc_count;
for (; rel < relend; rel++)
{
long symndx;
struct coff_link_hash_entry *h;
struct internal_syment *sym;
bfd_vma addend;
bfd_vma val;
reloc_howto_type *howto;
bfd_reloc_status_type rstat;
bfd_vma addr;
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;
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 (output_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 (! bfd_link_relocatable (info))
(*info->callbacks->undefined_symbol)
(info, h->root.root.string, input_bfd, input_section,
rel->r_vaddr - input_section->vma, TRUE);
}
addr = rel->r_vaddr - input_section->vma;
/* FIXME: This code assumes little endian, but the PP can
apparently be bi-endian. I don't know if the bi-endianness
applies to the instruction set or just to the data. */
switch (howto->type)
{
default:
case R_ABS:
case R_RELLONGX:
case R_PPL15:
case R_PPL15W:
case R_PPL15H:
case R_PPLN15:
case R_PPLN15W:
case R_PPLN15H:
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, addr, val, addend);
break;
case R_PP15:
case R_PP15W:
case R_PP15H:
case R_PPN15:
case R_PPN15W:
case R_PPN15H:
/* Offset the address so that we can use 4 byte relocations. */
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents + 2, addr, val, addend);
break;
case R_PP16B:
case R_PPN16B:
{
/* The most significant bit is stored in bit 6. */
bfd_byte hold;
hold = contents[addr + 4];
contents[addr + 4] &=~ 0x20;
contents[addr + 4] |= (contents[addr] >> 1) & 0x20;
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents + 2, addr,
val, addend);
contents[addr] &=~ 0x40;
contents[addr] |= (contents[addr + 4] << 1) & 0x40;
contents[addr + 4] &=~ 0x20;
contents[addr + 4] |= hold & 0x20;
break;
}
case R_PPL16B:
case R_PPLN16B:
{
/* The most significant bit is stored in bit 28. */
bfd_byte hold;
hold = contents[addr + 1];
contents[addr + 1] &=~ 0x80;
contents[addr + 1] |= (contents[addr + 3] << 3) & 0x80;
rstat = _bfd_final_link_relocate (howto, input_bfd, input_section,
contents, addr,
val, addend);
contents[addr + 3] &= ~0x10;
contents[addr + 3] |= (contents[addr + 1] >> 3) & 0x10;
contents[addr + 1] &=~ 0x80;
contents[addr + 1] |= hold & 0x80;
break;
}
case R_PPBASE:
/* Parameter RAM is from 0x1000000 to 0x1000800. */
contents[addr] &=~ 0x3;
if (val >= 0x1000000 && val < 0x1000800)
contents[addr] |= 0x3;
else
contents[addr] |= 0x2;
rstat = bfd_reloc_ok;
break;
case R_PPLBASE:
/* Parameter RAM is from 0x1000000 to 0x1000800. */
contents[addr + 2] &= ~0xc0;
if (val >= 0x1000000 && val < 0x1000800)
contents[addr + 2] |= 0xc0;
else
contents[addr + 2] |= 0x80;
rstat = bfd_reloc_ok;
break;
}
switch (rstat)
{
default:
abort ();
case bfd_reloc_ok:
break;
case bfd_reloc_outofrange:
_bfd_error_handler
/* xgettext: c-format */
(_("%pB: bad reloc address %#" PRIx64 " in section `%pA'"),
input_bfd, (uint64_t) rel->r_vaddr, input_section);
return FALSE;
case bfd_reloc_overflow:
{
const char *name;
char buf[SYMNMLEN + 1];
if (symndx == -1)
name = "*ABS*";
else if (h != NULL)
name = NULL;
else
{
name = _bfd_coff_internal_syment_name (input_bfd, sym, buf);
if (name == NULL)
return FALSE;
}
(*info->callbacks->reloc_overflow)
(info, (h ? &h->root : NULL), name, howto->name,
(bfd_vma) 0, input_bfd, input_section,
rel->r_vaddr - input_section->vma);
}
}
}
return TRUE;
}
#define TIC80COFF 1 /* Customize coffcode.h */
#undef C_AUTOARG /* Clashes with TIc80's C_UEXT */
#undef C_LASTENT /* Clashes with TIc80's C_STATLAB */
#ifndef bfd_pe_print_pdata
#define bfd_pe_print_pdata NULL
#endif
#include "coffcode.h"
CREATE_LITTLE_COFF_TARGET_VEC (tic80_coff_vec, "coff-tic80", D_PAGED, 0, '_', NULL, COFF_SWAP_TABLE)
+306 -119
View File
@@ -1,5 +1,5 @@
/* BFD back-end for AMD 64 COFF files.
Copyright (C) 2006-2018 Free Software Foundation, Inc.
Copyright (C) 2006-2022 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -20,10 +20,6 @@
Written by Kai Tietz, OneVision Software GmbH&CoKg. */
#ifndef COFF_WITH_pex64
#define COFF_WITH_pex64
#endif
/* Note we have to make sure not to include headers twice.
Not all headers are wrapped in #ifdef guards, so we define
PEI_HEADERS to prevent double including here. */
@@ -33,7 +29,6 @@
#include "libbfd.h"
#include "coff/x86_64.h"
#include "coff/internal.h"
#include "coff/pe.h"
#include "libcoff.h"
#include "libiberty.h"
#endif
@@ -52,6 +47,9 @@
#define COFF_PAGE_SIZE 0x1000
/* All users of this file have bfd_octets_per_byte (abfd, sec) == 1. */
#define OCTETS_PER_BYTE(ABFD, SEC) 1
/* For some reason when using AMD 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. */
@@ -72,14 +70,14 @@ coff_amd64_reloc (bfd *abfd,
{
symvalue diff;
#if !defined(COFF_WITH_PE)
#if !defined (COFF_WITH_PE)
if (output_bfd == NULL)
return bfd_reloc_continue;
#endif
if (bfd_is_com_section (symbol->section))
{
#if !defined(COFF_WITH_PE)
#if !defined (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
@@ -103,21 +101,10 @@ coff_amd64_reloc (bfd *abfd,
ignores the addend for a COFF target when producing
relocatable output. This seems to be always wrong for 386
COFF, so we handle the addend here instead. */
#if defined(COFF_WITH_PE)
#if defined (COFF_WITH_PE)
if (output_bfd == NULL)
{
reloc_howto_type *howto = reloc_entry->howto;
/* Although PC relative relocations are very similar between
PE and non-PE formats, but they are off by 1 << howto->size
bytes. For the external relocation, PE is very different
from others. See md_apply_fix3 () in gas/config/tc-amd64.c.
When we link PE and non-PE object files together to
generate a non-PE executable, we have to compensate it
here. */
if(howto->pc_relative && howto->pcrel_offset)
diff = -(1 << howto->size);
else if(symbol->flags & BSF_WEAK)
if (symbol->flags & BSF_WEAK)
diff = reloc_entry->addend - symbol->value;
else
diff = -reloc_entry->addend;
@@ -127,12 +114,50 @@ coff_amd64_reloc (bfd *abfd,
diff = reloc_entry->addend;
}
#if defined(COFF_WITH_PE)
/* FIXME: How should this case be handled? */
#if defined (COFF_WITH_PE)
if (output_bfd == NULL)
{
/* PC relative relocations are off by their size. */
if (reloc_entry->howto->pc_relative)
diff -= bfd_get_reloc_size (reloc_entry->howto);
if (reloc_entry->howto->type >= R_AMD64_PCRLONG_1
&& reloc_entry->howto->type <= R_AMD64_PCRLONG_5)
diff -= reloc_entry->howto->type - R_AMD64_PCRLONG;
}
if (reloc_entry->howto->type == R_AMD64_IMAGEBASE
&& output_bfd != NULL
&& bfd_get_flavour (output_bfd) == bfd_target_coff_flavour)
diff -= pe_data (output_bfd)->pe_opthdr.ImageBase;
&& output_bfd == NULL)
{
bfd *obfd = input_section->output_section->owner;
struct bfd_link_info *link_info;
struct bfd_link_hash_entry *h;
switch (bfd_get_flavour (obfd))
{
case bfd_target_coff_flavour:
diff -= pe_data (obfd)->pe_opthdr.ImageBase;
break;
case bfd_target_elf_flavour:
/* Subtract __ImageBase. */
link_info = _bfd_get_link_info (obfd);
if (link_info == NULL)
return bfd_reloc_dangerous;
h = bfd_link_hash_lookup (link_info->hash, "__ImageBase",
false, false, false);
if (h == NULL)
return bfd_reloc_dangerous;
while (h->type == bfd_link_hash_indirect)
h = h->u.i.link;
/* ELF symbols in relocatable files are section relative,
but in nonrelocatable files they are virtual addresses. */
diff -= (h->u.def.value
+ h->u.def.section->output_offset
+ h->u.def.section->output_section->vma);
break;
default:
break;
}
}
#endif
#define DOIT(x) \
@@ -141,16 +166,16 @@ coff_amd64_reloc (bfd *abfd,
if (diff != 0)
{
reloc_howto_type *howto = reloc_entry->howto;
unsigned char *addr = (unsigned char *) data + reloc_entry->address;
bfd_size_type octets = (reloc_entry->address
* OCTETS_PER_BYTE (abfd, input_section));
unsigned char *addr = (unsigned char *) data + octets;
if (! bfd_reloc_offset_in_range (howto, abfd, input_section,
reloc_entry->address
* bfd_octets_per_byte (abfd)))
if (!bfd_reloc_offset_in_range (howto, abfd, input_section, octets))
return bfd_reloc_outofrange;
switch (howto->size)
switch (bfd_get_reloc_size (howto))
{
case 0:
case 1:
{
char x = bfd_get_8 (abfd, addr);
DOIT (x);
@@ -158,7 +183,7 @@ coff_amd64_reloc (bfd *abfd,
}
break;
case 1:
case 2:
{
short x = bfd_get_16 (abfd, addr);
DOIT (x);
@@ -166,7 +191,7 @@ coff_amd64_reloc (bfd *abfd,
}
break;
case 2:
case 4:
{
long x = bfd_get_32 (abfd, addr);
DOIT (x);
@@ -174,9 +199,9 @@ coff_amd64_reloc (bfd *abfd,
}
break;
case 4:
case 8:
{
bfd_uint64_t x = bfd_get_64 (abfd, addr);
uint64_t x = bfd_get_64 (abfd, addr);
DOIT (x);
bfd_put_64 (abfd, x, addr);
}
@@ -196,16 +221,18 @@ coff_amd64_reloc (bfd *abfd,
/* Return TRUE if this relocation should appear in the output .reloc
section. */
static bfd_boolean
static bool
in_reloc_p (bfd *abfd ATTRIBUTE_UNUSED, reloc_howto_type *howto)
{
return ! howto->pc_relative && howto->type != R_AMD64_IMAGEBASE
&& howto->type != R_AMD64_SECREL;
return ! howto->pc_relative
&& howto->type != R_AMD64_IMAGEBASE
&& howto->type != R_AMD64_SECREL
&& howto->type != R_AMD64_SECTION;
}
#endif /* COFF_WITH_PE */
#ifndef PCRELOFFSET
#define PCRELOFFSET TRUE
#define PCRELOFFSET true
#endif
static reloc_howto_type howto_table[] =
@@ -213,141 +240,155 @@ static reloc_howto_type howto_table[] =
EMPTY_HOWTO (0),
HOWTO (R_AMD64_DIR64, /* type 1*/
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long, 4 = long long) */
8, /* size */
64, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"R_X86_64_64", /* name */
TRUE, /* partial_inplace */
"IMAGE_REL_AMD64_ADDR64", /* name */
true, /* partial_inplace */
0xffffffffffffffffll, /* src_mask */
0xffffffffffffffffll, /* dst_mask */
TRUE), /* pcrel_offset */
true), /* pcrel_offset */
HOWTO (R_AMD64_DIR32, /* type 2 */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"R_X86_64_32", /* name */
TRUE, /* partial_inplace */
"IMAGE_REL_AMD64_ADDR32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
TRUE), /* pcrel_offset */
true), /* pcrel_offset */
/* PE IMAGE_REL_AMD64_ADDR32NB relocation (3). */
HOWTO (R_AMD64_IMAGEBASE, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"rva32", /* name */
TRUE, /* partial_inplace */
"IMAGE_REL_AMD64_ADDR32NB", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
FALSE), /* pcrel_offset */
false), /* pcrel_offset */
/* 32-bit longword PC relative relocation (4). */
HOWTO (R_AMD64_PCRLONG, /* type 4 */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"R_X86_64_PC32", /* name */
TRUE, /* partial_inplace */
"IMAGE_REL_AMD64_REL32", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
HOWTO (R_AMD64_PCRLONG_1, /* type 5 */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"DISP32+1", /* name */
TRUE, /* partial_inplace */
"IMAGE_REL_AMD64_REL32_1", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
HOWTO (R_AMD64_PCRLONG_2, /* type 6 */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"DISP32+2", /* name */
TRUE, /* partial_inplace */
"IMAGE_REL_AMD64_REL32_2", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
HOWTO (R_AMD64_PCRLONG_3, /* type 7 */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"DISP32+3", /* name */
TRUE, /* partial_inplace */
"IMAGE_REL_AMD64_REL32_3", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
HOWTO (R_AMD64_PCRLONG_4, /* type 8 */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"DISP32+4", /* name */
TRUE, /* partial_inplace */
"IMAGE_REL_AMD64_REL32_4", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
HOWTO (R_AMD64_PCRLONG_5, /* type 9 */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"DISP32+5", /* name */
TRUE, /* partial_inplace */
"IMAGE_REL_AMD64_REL32_5", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
EMPTY_HOWTO (10), /* R_AMD64_SECTION 10 */
#if defined(COFF_WITH_PE)
/* 32-bit longword section relative relocation (11). */
HOWTO (R_AMD64_SECREL, /* type */
/* 16-bit word section relocation (10). */
HOWTO (R_AMD64_SECTION, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
32, /* bitsize */
FALSE, /* pc_relative */
2, /* size */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"secrel32", /* name */
TRUE, /* partial_inplace */
"IMAGE_REL_AMD64_SECTION", /* name */
true, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
true),
/* 32-bit longword section relative relocation (11). */
HOWTO (R_AMD64_SECREL, /* type */
0, /* rightshift */
4, /* size */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"IMAGE_REL_AMD64_SECREL", /* name */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
TRUE), /* pcrel_offset */
true), /* pcrel_offset */
#else
EMPTY_HOWTO (10),
EMPTY_HOWTO (11),
#endif
EMPTY_HOWTO (12),
@@ -355,14 +396,14 @@ static reloc_howto_type howto_table[] =
#ifndef DONT_EXTEND_AMD64
HOWTO (R_AMD64_PCRQUAD,
0, /* rightshift */
4, /* size (0 = byte, 1 = short, 2 = long) */
8, /* size */
64, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"R_X86_64_PC64", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffffffffffffffffll, /* src_mask */
0xffffffffffffffffll, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
@@ -372,84 +413,84 @@ static reloc_howto_type howto_table[] =
/* Byte relocation (15). */
HOWTO (R_RELBYTE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
1, /* size */
8, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"R_X86_64_8", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
/* 16-bit word relocation (16). */
HOWTO (R_RELWORD, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
2, /* size */
16, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"R_X86_64_16", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
/* 32-bit longword relocation (17). */
HOWTO (R_RELLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
FALSE, /* pc_relative */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"R_X86_64_32S", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
/* Byte PC relative relocation (18). */
HOWTO (R_PCRBYTE, /* type */
0, /* rightshift */
0, /* size (0 = byte, 1 = short, 2 = long) */
1, /* size */
8, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"R_X86_64_PC8", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
/* 16-bit word PC relative relocation (19). */
HOWTO (R_PCRWORD, /* type */
0, /* rightshift */
1, /* size (0 = byte, 1 = short, 2 = long) */
2, /* size */
16, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"R_X86_64_PC16", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
PCRELOFFSET), /* pcrel_offset */
/* 32-bit longword PC relative relocation (20). */
HOWTO (R_PCRLONG, /* type */
0, /* rightshift */
2, /* size (0 = byte, 1 = short, 2 = long) */
4, /* size */
32, /* bitsize */
TRUE, /* pc_relative */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
coff_amd64_reloc, /* special_function */
"R_X86_64_PC32", /* name */
TRUE, /* partial_inplace */
true, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
PCRELOFFSET) /* pcrel_offset */
@@ -520,11 +561,11 @@ static reloc_howto_type howto_table[] =
#else /* COFF_WITH_PE */
/* The PE relocate section routine. The only difference between this
and the regular routine is that we don't want to do anything for a
relocatable link. */
/* The PE relocate section routine. We handle secidx relocations here,
as well as making sure that we don't do anything for a relocatable
link. */
static bfd_boolean
static bool
coff_pe_amd64_relocate_section (bfd *output_bfd,
struct bfd_link_info *info,
bfd *input_bfd,
@@ -534,8 +575,77 @@ coff_pe_amd64_relocate_section (bfd *output_bfd,
struct internal_syment *syms,
asection **sections)
{
struct internal_reloc *rel;
struct internal_reloc *relend;
if (bfd_link_relocatable (info))
return TRUE;
return true;
rel = relocs;
relend = rel + input_section->reloc_count;
for (; rel < relend; rel++)
{
long symndx;
struct coff_link_hash_entry *h;
asection *sec, *s;
uint16_t idx = 0, i = 1;
if (rel->r_type != R_SECTION)
continue;
/* Make sure that _bfd_coff_generic_relocate_section won't parse
this reloc after us. */
rel->r_type = 0;
symndx = rel->r_symndx;
if (symndx < 0
|| (unsigned long) symndx >= obj_raw_syment_count (input_bfd))
continue;
h = obj_coff_sym_hashes (input_bfd)[symndx];
if (h == NULL)
sec = sections[symndx];
else
{
if (h->root.type == bfd_link_hash_defined
|| h->root.type == bfd_link_hash_defweak)
{
/* Defined weak symbols are a GNU extension. */
sec = h->root.u.def.section;
}
else
{
sec = NULL;
}
}
if (!sec)
continue;
if (bfd_is_abs_section (sec))
continue;
if (discarded_section (sec))
continue;
s = output_bfd->sections;
while (s)
{
if (s == sec->output_section)
{
idx = i;
break;
}
i++;
s = s->next;
}
bfd_putl16 (idx, contents + rel->r_vaddr - input_section->vma);
}
return _bfd_coff_generic_relocate_section (output_bfd, info, input_bfd,input_section, contents,relocs, syms, sections);
}
@@ -691,6 +801,8 @@ coff_amd64_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, bfd_reloc_code_real_ty
#if defined(COFF_WITH_PE)
case BFD_RELOC_32_SECREL:
return howto_table + R_AMD64_SECREL;
case BFD_RELOC_16_SECIDX:
return howto_table + R_AMD64_SECTION;
#endif
default:
BFD_FAIL ();
@@ -720,11 +832,11 @@ coff_amd64_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
a leading dot for local labels, so if TARGET_UNDERSCORE is defined
we treat all symbols starting with L as local. */
static bfd_boolean
static bool
coff_amd64_is_local_label_name (bfd *abfd, const char *name)
{
if (name[0] == 'L')
return TRUE;
return true;
return _bfd_coff_is_local_label_name (abfd, name);
}
@@ -779,6 +891,7 @@ const bfd_target
'/', /* Ar_pad_char. */
15, /* Ar_max_namelen. */
0, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
bfd_getl64, bfd_getl_signed_64, bfd_putl64,
bfd_getl32, bfd_getl_signed_32, bfd_putl32,
@@ -792,19 +905,19 @@ const bfd_target
_bfd_dummy_target,
amd64coff_object_p,
bfd_generic_archive_p,
amd64coff_object_p
amd64coff_object_p
},
{ /* bfd_set_format. */
_bfd_bool_bfd_false_error,
coff_mkobject,
_bfd_generic_mkarchive,
_bfd_bool_bfd_false_error
_bfd_bool_bfd_false_error
},
{ /* bfd_write_contents. */
_bfd_bool_bfd_false_error,
coff_write_object_contents,
_bfd_write_archive_contents,
_bfd_bool_bfd_false_error
_bfd_bool_bfd_false_error
},
BFD_JUMP_TABLE_GENERIC (coff),
@@ -821,3 +934,77 @@ const bfd_target
COFF_SWAP_TABLE
};
/* Entry for big object files. */
#ifdef COFF_WITH_PE_BIGOBJ
const bfd_target
TARGET_SYM_BIG =
{
TARGET_NAME_BIG,
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 | BFD_COMPRESS | BFD_DECOMPRESS),
(SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC /* Section flags. */
#if defined(COFF_WITH_PE)
| SEC_LINK_ONCE | SEC_LINK_DUPLICATES | SEC_READONLY | SEC_DEBUGGING
#endif
| SEC_CODE | SEC_DATA | SEC_EXCLUDE ),
#ifdef TARGET_UNDERSCORE
TARGET_UNDERSCORE, /* Leading underscore. */
#else
0, /* Leading underscore. */
#endif
'/', /* Ar_pad_char. */
15, /* Ar_max_namelen. */
0, /* match priority. */
TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
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_check_format. */
_bfd_dummy_target,
amd64coff_object_p,
bfd_generic_archive_p,
amd64coff_object_p
},
{ /* bfd_set_format. */
_bfd_bool_bfd_false_error,
coff_mkobject,
_bfd_generic_mkarchive,
_bfd_bool_bfd_false_error
},
{ /* bfd_write_contents. */
_bfd_bool_bfd_false_error,
coff_write_object_contents,
_bfd_write_archive_contents,
_bfd_bool_bfd_false_error
},
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,
&bigobj_swap_table
};
#endif
+302 -95
View File
@@ -1,5 +1,5 @@
/* BFD back-end for Zilog Z80 COFF binaries.
Copyright (C) 2005-2018 Free Software Foundation, Inc.
Copyright (C) 2005-2022 Free Software Foundation, Inc.
Contributed by Arnold Metselaar <arnold_m@operamail.com>
This file is part of BFD, the Binary File Descriptor library.
@@ -26,39 +26,219 @@
#include "coff/z80.h"
#include "coff/internal.h"
#include "libcoff.h"
#include "libiberty.h"
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER 0
static reloc_howto_type r_imm32 =
HOWTO (R_IMM32, 0, 2, 32, FALSE, 0,
complain_overflow_dont, 0, "r_imm32", TRUE, 0xffffffff, 0xffffffff,
FALSE);
typedef const struct {
bfd_reloc_code_real_type r_type;
reloc_howto_type howto;
} bfd_howto_type;
static reloc_howto_type r_imm24 =
HOWTO (R_IMM24, 0, 1, 24, FALSE, 0,
complain_overflow_dont, 0, "r_imm24", TRUE, 0x00ffffff, 0x00ffffff,
FALSE);
#define BFD_EMPTY_HOWTO(rt,x) {rt, EMPTY_HOWTO(x)}
#define BFD_HOWTO(rt,a,b,c,d,e,f,g,h,i,j,k,l,m) {rt, HOWTO(a,b,c,d,e,f,g,h,i,j,k,l,m)}
static reloc_howto_type r_imm16 =
HOWTO (R_IMM16, 0, 1, 16, FALSE, 0,
complain_overflow_dont, 0, "r_imm16", TRUE, 0x0000ffff, 0x0000ffff,
FALSE);
static bfd_howto_type howto_table[] =
{
BFD_EMPTY_HOWTO (BFD_RELOC_NONE, 0),
static reloc_howto_type r_imm8 =
HOWTO (R_IMM8, 0, 0, 8, FALSE, 0,
complain_overflow_bitfield, 0, "r_imm8", TRUE, 0x000000ff, 0x000000ff,
FALSE);
BFD_HOWTO (BFD_RELOC_32,
R_IMM32, /* type */
0, /* rightshift */
4, /* size */
32, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"r_imm32", /* name */
false, /* partial_inplace */
0xffffffff, /* src_mask */
0xffffffff, /* dst_mask */
false), /* pcrel_offset */
static reloc_howto_type r_jr =
HOWTO (R_JR, 0, 0, 8, TRUE, 0,
complain_overflow_signed, 0, "r_jr", FALSE, 0, 0xFF,
FALSE);
BFD_HOWTO (BFD_RELOC_24,
R_IMM24, /* type */
0, /* rightshift */
3, /* size */
24, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"r_imm24", /* name */
false, /* partial_inplace */
0x00ffffff, /* src_mask */
0x00ffffff, /* dst_mask */
false), /* pcrel_offset */
static reloc_howto_type r_off8 =
HOWTO (R_OFF8, 0, 0, 8, FALSE, 0,
complain_overflow_signed, 0,"r_off8", FALSE, 0, 0xff,
FALSE);
BFD_HOWTO (BFD_RELOC_16,
R_IMM16, /* type */
0, /* rightshift */
2, /* size */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"r_imm16", /* name */
false, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_8,
R_IMM8, /* type */
0, /* rightshift */
1, /* size */
8, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"r_imm8", /* name */
false, /* partial_inplace */
0x000000ff, /* src_mask */
0x000000ff, /* dst_mask */
false), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_8_PCREL,
R_JR, /* type */
0, /* rightshift */
1, /* size */
8, /* bitsize */
true, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"r_jr", /* name */
false, /* partial_inplace */
0, /* src_mask */
0xFF, /* dst_mask */
true), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_DISP8,
R_OFF8, /* type */
0, /* rightshift */
1, /* size */
8, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_signed, /* complain_on_overflow */
0, /* special_function */
"r_off8", /* name */
false, /* partial_inplace */
0, /* src_mask */
0xff, /* dst_mask */
false), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_BYTE0,
R_BYTE0, /* type */
0, /* rightshift */
1, /* size */
8, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"r_byte0", /* name */
false, /* partial_inplace */
0, /* src_mask */
0xff, /* dst_mask */
false), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_BYTE1,
R_BYTE1, /* type */
8, /* rightshift */
1, /* size */
8, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"r_byte1", /* name */
false, /* partial_inplace */
0, /* src_mask */
0xff, /* dst_mask */
false), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_BYTE2,
R_BYTE2, /* type */
16, /* rightshift */
1, /* size */
8, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"r_byte2", /* name */
false, /* partial_inplace */
0, /* src_mask */
0xff, /* dst_mask */
false), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_BYTE3,
R_BYTE3, /* type */
24, /* rightshift */
1, /* size */
8, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"r_byte3", /* name */
false, /* partial_inplace */
0, /* src_mask */
0xff, /* dst_mask */
false), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_WORD0,
R_WORD0, /* type */
0, /* rightshift */
2, /* size */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"r_word0", /* name */
false, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
false), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_WORD1,
R_WORD1, /* type */
16, /* rightshift */
2, /* size */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_dont, /* complain_on_overflow */
0, /* special_function */
"r_word1", /* name */
false, /* partial_inplace */
0, /* src_mask */
0xffff, /* dst_mask */
false), /* pcrel_offset */
BFD_HOWTO (BFD_RELOC_Z80_16_BE,
R_IMM16BE, /* type */
0, /* rightshift */
2, /* size */
16, /* bitsize */
false, /* pc_relative */
0, /* bitpos */
complain_overflow_bitfield, /* complain_on_overflow */
0, /* special_function */
"r_imm16be", /* name */
false, /* partial_inplace */
0x0000ffff, /* src_mask */
0x0000ffff, /* dst_mask */
false), /* pcrel_offset */
};
#define NUM_HOWTOS ARRAY_SIZE (howto_table)
#define BADMAG(x) Z80BADMAG(x)
#define Z80 1 /* Customize coffcode.h. */
@@ -74,34 +254,19 @@ HOWTO (R_OFF8, 0, 0, 8, FALSE, 0,
dst->r_stuff[1] = 'C';
/* Code to turn a r_type into a howto ptr, uses the above howto table. */
static void
rtype2howto (arelent *internal, struct internal_reloc *dst)
{
switch (dst->r_type)
unsigned i;
for (i = 0; i < NUM_HOWTOS; i++)
{
default:
internal->howto = NULL;
break;
case R_IMM8:
internal->howto = &r_imm8;
break;
case R_IMM16:
internal->howto = &r_imm16;
break;
case R_IMM24:
internal->howto = &r_imm24;
break;
case R_IMM32:
internal->howto = &r_imm32;
break;
case R_JR:
internal->howto = &r_jr;
break;
case R_OFF8:
internal->howto = &r_off8;
break;
if (howto_table[i].howto.type == dst->r_type)
{
internal->howto = &howto_table[i].howto;
return;
}
}
internal->howto = NULL;
}
#define RTYPE2HOWTO(internal, relocentry) rtype2howto (internal, relocentry)
@@ -110,35 +275,23 @@ static reloc_howto_type *
coff_z80_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
bfd_reloc_code_real_type code)
{
switch (code)
{
case BFD_RELOC_8: return & r_imm8;
case BFD_RELOC_16: return & r_imm16;
case BFD_RELOC_24: return & r_imm24;
case BFD_RELOC_32: return & r_imm32;
case BFD_RELOC_8_PCREL: return & r_jr;
case BFD_RELOC_Z80_DISP8: return & r_off8;
default: BFD_FAIL ();
return NULL;
}
unsigned i;
for (i = 0; i < NUM_HOWTOS; i++)
if (howto_table[i].r_type == code)
return &howto_table[i].howto;
BFD_FAIL ();
return NULL;
}
static reloc_howto_type *
coff_z80_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED,
const char *r_name)
{
if (strcasecmp (r_imm8.name, r_name) == 0)
return &r_imm8;
if (strcasecmp (r_imm16.name, r_name) == 0)
return &r_imm16;
if (strcasecmp (r_imm24.name, r_name) == 0)
return &r_imm24;
if (strcasecmp (r_imm32.name, r_name) == 0)
return &r_imm32;
if (strcasecmp (r_jr.name, r_name) == 0)
return &r_jr;
if (strcasecmp (r_off8.name, r_name) == 0)
return &r_off8;
unsigned i;
for (i = 0; i < NUM_HOWTOS; i++)
if (strcasecmp(howto_table[i].howto.name, r_name) == 0)
return &howto_table[i].howto;
return NULL;
}
@@ -161,11 +314,18 @@ reloc_processing (arelent *relent,
relent->address = reloc->r_vaddr;
rtype2howto (relent, reloc);
if (reloc->r_symndx > 0)
if (reloc->r_symndx == -1)
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
else if (reloc->r_symndx >= 0 && reloc->r_symndx < obj_conv_table_size (abfd))
relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
else
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
{
_bfd_error_handler
/* xgettext:c-format */
(_("%pB: warning: illegal symbol index %ld in relocs"),
abfd, reloc->r_symndx);
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
}
relent->addend = reloc->r_offset;
relent->address -= section->vma;
}
@@ -180,14 +340,15 @@ extra_case (bfd *in_abfd,
unsigned int *dst_ptr)
{
asection * input_section = link_order->u.indirect.section;
int val;
int val = bfd_coff_reloc16_get_value (reloc, link_info, input_section);
switch (reloc->howto->type)
{
case R_OFF8:
val = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
if (val>127 || val<-128) /* Test for overflow. */
if (reloc->howto->partial_inplace)
val += (signed char)(bfd_get_8 ( in_abfd, data+*src_ptr)
& reloc->howto->src_mask);
if (val>127 || val<-128) /* Test for overflow. */
(*link_info->callbacks->reloc_overflow)
(link_info, NULL, bfd_asymbol_name (*reloc->sym_ptr_ptr),
reloc->howto->name, reloc->addend, input_section->owner,
@@ -198,35 +359,62 @@ extra_case (bfd *in_abfd,
(*src_ptr) += 1;
break;
case R_BYTE3:
bfd_put_8 (in_abfd, val >> 24, data + *dst_ptr);
(*dst_ptr) += 1;
(*src_ptr) += 1;
break;
case R_BYTE2:
bfd_put_8 (in_abfd, val >> 16, data + *dst_ptr);
(*dst_ptr) += 1;
(*src_ptr) += 1;
break;
case R_BYTE1:
bfd_put_8 (in_abfd, val >> 8, data + *dst_ptr);
(*dst_ptr) += 1;
(*src_ptr) += 1;
break;
case R_IMM8:
val = bfd_get_8 ( in_abfd, data+*src_ptr)
+ bfd_coff_reloc16_get_value (reloc, link_info, input_section);
if (reloc->howto->partial_inplace)
val += bfd_get_8 ( in_abfd, data+*src_ptr) & reloc->howto->src_mask;
/* Fall through. */
case R_BYTE0:
bfd_put_8 (in_abfd, val, data + *dst_ptr);
(*dst_ptr) += 1;
(*src_ptr) += 1;
break;
case R_WORD1:
bfd_put_16 (in_abfd, val >> 16, data + *dst_ptr);
(*dst_ptr) += 2;
(*src_ptr) += 2;
break;
case R_IMM16:
val = bfd_get_16 ( in_abfd, data+*src_ptr)
+ bfd_coff_reloc16_get_value (reloc, link_info, input_section);
if (reloc->howto->partial_inplace)
val += bfd_get_16 ( in_abfd, data+*src_ptr) & reloc->howto->src_mask;
/* Fall through. */
case R_WORD0:
bfd_put_16 (in_abfd, val, data + *dst_ptr);
(*dst_ptr) += 2;
(*src_ptr) += 2;
break;
case R_IMM24:
val = bfd_get_16 ( in_abfd, data+*src_ptr)
+ (bfd_get_8 ( in_abfd, data+*src_ptr+2) << 16)
+ bfd_coff_reloc16_get_value (reloc, link_info, input_section);
bfd_put_16 (in_abfd, val, data + *dst_ptr);
bfd_put_8 (in_abfd, val >> 16, data + *dst_ptr+2);
if (reloc->howto->partial_inplace)
val += (bfd_get_24 (in_abfd, data + *src_ptr)
& reloc->howto->src_mask);
bfd_put_24 (in_abfd, val, data + *dst_ptr);
(*dst_ptr) += 3;
(*src_ptr) += 3;
break;
case R_IMM32:
val = bfd_get_32 ( in_abfd, data+*src_ptr)
+ bfd_coff_reloc16_get_value (reloc, link_info, input_section);
if (reloc->howto->partial_inplace)
val += bfd_get_32 ( in_abfd, data+*src_ptr) & reloc->howto->src_mask;
bfd_put_32 (in_abfd, val, data + *dst_ptr);
(*dst_ptr) += 4;
(*src_ptr) += 4;
@@ -234,15 +422,13 @@ extra_case (bfd *in_abfd,
case R_JR:
{
bfd_vma dst = bfd_coff_reloc16_get_value (reloc, link_info,
input_section);
if (reloc->howto->partial_inplace)
val += (signed char)(bfd_get_8 ( in_abfd, data+*src_ptr)
& reloc->howto->src_mask);
bfd_vma dot = (*dst_ptr
+ input_section->output_offset
+ input_section->output_section->vma);
int gap = dst - dot - 1; /* -1, Since the offset is relative
to the value of PC after reading
the offset. */
int gap = val - dot;
if (gap >= 128 || gap < -128)
(*link_info->callbacks->reloc_overflow)
(link_info, NULL, bfd_asymbol_name (*reloc->sym_ptr_ptr),
@@ -255,11 +441,32 @@ extra_case (bfd *in_abfd,
break;
}
case R_IMM16BE:
if (reloc->howto->partial_inplace)
val += (bfd_get_8 ( in_abfd, data+*src_ptr+0) * 0x100 +
bfd_get_8 ( in_abfd, data+*src_ptr+1)) & reloc->howto->src_mask;
bfd_put_8 (in_abfd, val >> 8, data + *dst_ptr+0);
bfd_put_8 (in_abfd, val, data + *dst_ptr+1);
(*dst_ptr) += 2;
(*src_ptr) += 2;
break;
default:
abort ();
}
}
static bool
z80_is_local_label_name (bfd * abfd ATTRIBUTE_UNUSED,
const char * name)
{
return (name[0] == '.' && name[1] == 'L') ||
_bfd_coff_is_local_label_name (abfd, name);
}
#define coff_bfd_is_local_label_name z80_is_local_label_name
#define coff_reloc16_extra_cases extra_case
#define coff_bfd_reloc_type_lookup coff_z80_reloc_type_lookup
#define coff_bfd_reloc_name_lookup coff_z80_reloc_name_lookup
+31 -24
View File
@@ -1,5 +1,5 @@
/* BFD back-end for Zilog Z800n COFF binaries.
Copyright (C) 1992-2018 Free Software Foundation, Inc.
Copyright (C) 1992-2022 Free Software Foundation, Inc.
Contributed by Cygnus Support.
Written by Steve Chamberlain, <sac@cygnus.com>.
@@ -31,40 +31,40 @@
#define COFF_DEFAULT_SECTION_ALIGNMENT_POWER (1)
static reloc_howto_type r_imm32 =
HOWTO (R_IMM32, 0, 2, 32, FALSE, 0,
complain_overflow_bitfield, 0, "r_imm32", TRUE, 0xffffffff,
0xffffffff, FALSE);
HOWTO (R_IMM32, 0, 4, 32, false, 0,
complain_overflow_bitfield, 0, "r_imm32", true, 0xffffffff,
0xffffffff, false);
static reloc_howto_type r_imm4l =
HOWTO (R_IMM4L, 0, 0, 4, FALSE, 0,
complain_overflow_bitfield, 0, "r_imm4l", TRUE, 0xf, 0xf, FALSE);
HOWTO (R_IMM4L, 0, 1, 4, false, 0,
complain_overflow_bitfield, 0, "r_imm4l", true, 0xf, 0xf, false);
static reloc_howto_type r_da =
HOWTO (R_IMM16, 0, 1, 16, FALSE, 0,
complain_overflow_bitfield, 0, "r_da", TRUE, 0x0000ffff, 0x0000ffff,
FALSE);
HOWTO (R_IMM16, 0, 2, 16, false, 0,
complain_overflow_bitfield, 0, "r_da", true, 0x0000ffff, 0x0000ffff,
false);
static reloc_howto_type r_imm8 =
HOWTO (R_IMM8, 0, 0, 8, FALSE, 0,
complain_overflow_bitfield, 0, "r_imm8", TRUE, 0x000000ff, 0x000000ff,
FALSE);
HOWTO (R_IMM8, 0, 1, 8, false, 0,
complain_overflow_bitfield, 0, "r_imm8", true, 0x000000ff, 0x000000ff,
false);
static reloc_howto_type r_rel16 =
HOWTO (R_REL16, 0, 1, 16, FALSE, 0,
complain_overflow_bitfield, 0, "r_rel16", TRUE, 0x0000ffff, 0x0000ffff,
TRUE);
HOWTO (R_REL16, 0, 2, 16, false, 0,
complain_overflow_bitfield, 0, "r_rel16", true, 0x0000ffff, 0x0000ffff,
true);
static reloc_howto_type r_jr =
HOWTO (R_JR, 1, 0, 8, TRUE, 0, complain_overflow_signed, 0,
"r_jr", TRUE, 0xff, 0xff, TRUE);
HOWTO (R_JR, 1, 1, 8, true, 0, complain_overflow_signed, 0,
"r_jr", true, 0xff, 0xff, true);
static reloc_howto_type r_disp7 =
HOWTO (R_DISP7, 0, 0, 7, TRUE, 0, complain_overflow_bitfield, 0,
"r_disp7", TRUE, 0x7f, 0x7f, TRUE);
HOWTO (R_DISP7, 0, 1, 7, true, 0, complain_overflow_bitfield, 0,
"r_disp7", true, 0x7f, 0x7f, true);
static reloc_howto_type r_callr =
HOWTO (R_CALLR, 1, 1, 12, TRUE, 0, complain_overflow_signed, 0,
"r_callr", TRUE, 0xfff, 0xfff, TRUE);
HOWTO (R_CALLR, 1, 2, 12, true, 0, complain_overflow_signed, 0,
"r_callr", true, 0xfff, 0xfff, true);
#define BADMAG(x) Z8KBADMAG(x)
#define Z8K 1 /* Customize coffcode.h. */
@@ -177,11 +177,18 @@ reloc_processing (arelent *relent,
relent->address = reloc->r_vaddr;
rtype2howto (relent, reloc);
if (reloc->r_symndx > 0)
if (reloc->r_symndx == -1)
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
else if (reloc->r_symndx >= 0 && reloc->r_symndx < obj_conv_table_size (abfd))
relent->sym_ptr_ptr = symbols + obj_convert (abfd)[reloc->r_symndx];
else
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
{
_bfd_error_handler
/* xgettext:c-format */
(_("%pB: warning: illegal symbol index %ld in relocs"),
abfd, reloc->r_symndx);
relent->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
}
relent->addend = reloc->r_offset;
relent->address -= section->vma;
}
+1048 -1121
View File
File diff suppressed because it is too large Load Diff
+621 -466
View File
File diff suppressed because it is too large Load Diff
+462 -424
View File
File diff suppressed because it is too large Load Diff
+287 -312
View File
File diff suppressed because it is too large Load Diff
+47 -17
View File
@@ -1,5 +1,5 @@
/* Generic COFF swapping routines, for BFD.
Copyright (C) 1990-2018 Free Software Foundation, Inc.
Copyright (C) 1990-2022 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -246,6 +246,33 @@ coff_swap_reloc_out (bfd * abfd, void * src, void * dst)
return bfd_coff_relsz (abfd);
}
#ifdef TICOFF
static void
coff_swap_reloc_v0_in (bfd *abfd, void *src, void *dst)
{
struct external_reloc_v0 *reloc_src = (struct external_reloc_v0 *) src;
struct internal_reloc *reloc_dst = (struct internal_reloc *) dst;
reloc_dst->r_vaddr = GET_RELOC_VADDR (abfd, reloc_src->r_vaddr);
reloc_dst->r_symndx = H_GET_16 (abfd, reloc_src->r_symndx);
reloc_dst->r_type = H_GET_16 (abfd, reloc_src->r_type);
}
static unsigned int
coff_swap_reloc_v0_out (bfd *abfd, void *src, void *dst)
{
struct internal_reloc *reloc_src = (struct internal_reloc *) src;
struct external_reloc_v0 *reloc_dst = (struct external_reloc_v0 *) dst;
PUT_RELOC_VADDR (abfd, reloc_src->r_vaddr, reloc_dst->r_vaddr);
H_PUT_16 (abfd, reloc_src->r_symndx, reloc_dst->r_symndx);
H_PUT_16 (abfd, reloc_src->r_type, reloc_dst->r_type);
SWAP_OUT_RELOC_EXTRA (abfd, reloc_src, reloc_dst);
return bfd_coff_relsz (abfd);
}
#endif
#endif /* NO_COFF_RELOCS */
static void
@@ -264,9 +291,6 @@ coff_swap_filehdr_in (bfd * abfd, void * src, void * dst)
filehdr_dst->f_nsyms = H_GET_32 (abfd, filehdr_src->f_nsyms);
filehdr_dst->f_opthdr = H_GET_16 (abfd, filehdr_src->f_opthdr);
filehdr_dst->f_flags = H_GET_16 (abfd, filehdr_src->f_flags);
#ifdef TIC80_TARGET_ID
filehdr_dst->f_target_id = H_GET_16 (abfd, filehdr_src->f_target_id);
#endif
#ifdef COFF_ADJUST_FILEHDR_IN_POST
COFF_ADJUST_FILEHDR_IN_POST (abfd, src, dst);
@@ -289,9 +313,6 @@ coff_swap_filehdr_out (bfd *abfd, void * in, void * out)
H_PUT_32 (abfd, filehdr_in->f_nsyms, filehdr_out->f_nsyms);
H_PUT_16 (abfd, filehdr_in->f_opthdr, filehdr_out->f_opthdr);
H_PUT_16 (abfd, filehdr_in->f_flags, filehdr_out->f_flags);
#ifdef TIC80_TARGET_ID
H_PUT_16 (abfd, filehdr_in->f_target_id, filehdr_out->f_target_id);
#endif
#ifdef COFF_ADJUST_FILEHDR_OUT_POST
COFF_ADJUST_FILEHDR_OUT_POST (abfd, in, out);
@@ -397,22 +418,22 @@ coff_swap_aux_in (bfd *abfd,
case C_FILE:
if (ext->x_file.x_fname[0] == 0)
{
in->x_file.x_n.x_zeroes = 0;
in->x_file.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
in->x_file.x_n.x_n.x_zeroes = 0;
in->x_file.x_n.x_n.x_offset = H_GET_32 (abfd, ext->x_file.x_n.x_offset);
}
else
{
#if FILNMLEN != E_FILNMLEN
#error we need to cope with truncating or extending FILNMLEN
#else
if (numaux > 1)
if (numaux > 1 && coff_data (abfd)->pe)
{
if (indx == 0)
memcpy (in->x_file.x_fname, ext->x_file.x_fname,
memcpy (in->x_file.x_n.x_fname, ext->x_file.x_fname,
numaux * sizeof (AUXENT));
}
else
memcpy (in->x_file.x_fname, ext->x_file.x_fname, FILNMLEN);
memcpy (in->x_file.x_n.x_fname, ext->x_file.x_fname, FILNMLEN);
#endif
}
goto end;
@@ -501,17 +522,17 @@ coff_swap_aux_out (bfd * abfd,
switch (in_class)
{
case C_FILE:
if (in->x_file.x_fname[0] == 0)
if (in->x_file.x_n.x_fname[0] == 0)
{
H_PUT_32 (abfd, 0, ext->x_file.x_n.x_zeroes);
H_PUT_32 (abfd, in->x_file.x_n.x_offset, ext->x_file.x_n.x_offset);
H_PUT_32 (abfd, in->x_file.x_n.x_n.x_offset, ext->x_file.x_n.x_offset);
}
else
{
#if FILNMLEN != E_FILNMLEN
#error we need to cope with truncating or extending FILNMLEN
#else
memcpy (ext->x_file.x_fname, in->x_file.x_fname, FILNMLEN);
memcpy (ext->x_file.x_fname, in->x_file.x_n.x_fname, FILNMLEN);
#endif
}
goto end;
@@ -701,9 +722,16 @@ coff_swap_aouthdr_out (bfd * abfd, void * in, void * out)
H_PUT_32 (abfd, aouthdr_in->o_maxstack, aouthdr_out->o_maxstack);
H_PUT_32 (abfd, aouthdr_in->o_maxdata, aouthdr_out->o_maxdata);
#endif
memset (aouthdr_out->o_resv2, 0, sizeof aouthdr_out->o_resv2);
/* TODO: set o_*psize dynamically */
H_PUT_8 (abfd, 0, aouthdr_out->o_textpsize);
H_PUT_8 (abfd, 0, aouthdr_out->o_datapsize);
H_PUT_8 (abfd, 0, aouthdr_out->o_stackpsize);
H_PUT_8 (abfd, aouthdr_in->o_flags, aouthdr_out->o_flags);
H_PUT_16 (abfd, aouthdr_in->o_sntdata, aouthdr_out->o_sntdata);
H_PUT_16 (abfd, aouthdr_in->o_sntbss, aouthdr_out->o_sntbss);
H_PUT_32 (abfd, 0, aouthdr_out->o_debugger);
#ifdef XCOFF64
memset (aouthdr_out->o_debugger, 0, sizeof aouthdr_out->o_debugger);
H_PUT_16 (abfd, aouthdr_in->o_x64flags, aouthdr_out->o_x64flags);
memset (aouthdr_out->o_resv3, 0, sizeof aouthdr_out->o_resv3);
#endif
#endif
@@ -731,6 +759,7 @@ coff_swap_aouthdr_out (bfd * abfd, void * in, void * out)
return AOUTSZ;
}
ATTRIBUTE_UNUSED
static void
coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in)
{
@@ -757,6 +786,7 @@ coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in)
#endif
}
ATTRIBUTE_UNUSED
static unsigned int
coff_swap_scnhdr_out (bfd * abfd, void * in, void * out)
{
+108 -55
View File
@@ -1,5 +1,5 @@
/* Compressed section support (intended for debug sections).
Copyright (C) 2008-2018 Free Software Foundation, Inc.
Copyright (C) 2008-2022 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -26,7 +26,7 @@
#define MAX_COMPRESSION_HEADER_SIZE 24
static bfd_boolean
static bool
decompress_contents (bfd_byte *compressed_buffer,
bfd_size_type compressed_size,
bfd_byte *uncompressed_buffer,
@@ -46,6 +46,11 @@ decompress_contents (bfd_byte *compressed_buffer,
strm.avail_in = compressed_size;
strm.next_in = (Bytef*) compressed_buffer;
strm.avail_out = uncompressed_size;
/* FIXME: strm.avail_in and strm.avail_out are typically unsigned
int. Supporting sizes that don't fit in an unsigned int is
possible but will require some rewriting of this function. */
if (strm.avail_in != compressed_size || strm.avail_out != uncompressed_size)
return false;
BFD_ASSERT (Z_OK == 0);
rc = inflateInit (&strm);
@@ -60,8 +65,7 @@ decompress_contents (bfd_byte *compressed_buffer,
break;
rc = inflateReset (&strm);
}
rc |= inflateEnd (&strm);
return rc == Z_OK && strm.avail_out == 0;
return inflateEnd (&strm) == Z_OK && rc == Z_OK && strm.avail_out == 0;
}
/* Compress data of the size specified in @var{uncompressed_size}
@@ -80,15 +84,17 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec,
uLong compressed_size;
bfd_byte *buffer;
bfd_size_type buffer_size;
bfd_boolean decompress;
bool decompress;
int zlib_size = 0;
int orig_compression_header_size;
bfd_size_type orig_uncompressed_size;
unsigned int orig_uncompressed_alignment_pow;
int header_size = bfd_get_compression_header_size (abfd, NULL);
bfd_boolean compressed
bool compressed
= bfd_is_section_compressed_with_header (abfd, sec,
&orig_compression_header_size,
&orig_uncompressed_size);
&orig_uncompressed_size,
&orig_uncompressed_alignment_pow);
/* Either ELF compression header or the 12-byte, "ZLIB" + 8-byte size,
overhead in .zdebug* section. */
@@ -127,12 +133,12 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec,
/* Uncompress if it leads to smaller size. */
if (compressed && compressed_size > orig_uncompressed_size)
{
decompress = TRUE;
decompress = true;
buffer_size = orig_uncompressed_size;
}
else
{
decompress = FALSE;
decompress = false;
buffer_size = compressed_size;
}
buffer = (bfd_byte *) bfd_alloc (abfd, buffer_size);
@@ -153,6 +159,8 @@ bfd_compress_section_contents (bfd *abfd, sec_ptr sec,
return 0;
}
free (uncompressed_buffer);
bfd_set_section_alignment (sec, orig_uncompressed_alignment_pow);
sec->contents = buffer;
sec->compress_status = COMPRESS_SECTION_DONE;
return orig_uncompressed_size;
@@ -206,7 +214,7 @@ FUNCTION
bfd_get_full_section_contents
SYNOPSIS
bfd_boolean bfd_get_full_section_contents
bool bfd_get_full_section_contents
(bfd *abfd, asection *section, bfd_byte **ptr);
DESCRIPTION
@@ -219,12 +227,12 @@ DESCRIPTION
returns @code{TRUE} but @var{*ptr} is set to NULL.
*/
bfd_boolean
bool
bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
{
bfd_size_type sz;
bfd_byte *p = *ptr;
bfd_boolean ret;
bool ret;
bfd_size_type save_size;
bfd_size_type save_rawsize;
bfd_byte *compressed_buffer;
@@ -237,7 +245,7 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
if (sz == 0)
{
*ptr = NULL;
return TRUE;
return true;
}
switch (sec->compress_status)
@@ -245,6 +253,29 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
case COMPRESS_SECTION_NONE:
if (p == NULL)
{
ufile_ptr filesize = bfd_get_file_size (abfd);
if (filesize > 0
&& filesize < sz
/* PR 24753: Linker created sections can be larger than
the file size, eg if they are being used to hold stubs. */
&& (bfd_section_flags (sec) & SEC_LINKER_CREATED) == 0
/* PR 24753: Sections which have no content should also be
excluded as they contain no size on disk. */
&& (bfd_section_flags (sec) & SEC_HAS_CONTENTS) != 0
/* The MMO file format supports its own special compression
technique, but it uses COMPRESS_SECTION_NONE when loading
a section's contents. */
&& bfd_get_flavour (abfd) != bfd_target_mmo_flavour)
{
/* PR 24708: Avoid attempts to allocate a ridiculous amount
of memory. */
bfd_set_error (bfd_error_file_truncated);
_bfd_error_handler
/* xgettext:c-format */
(_("error: %pB(%pA) section size (%#" PRIx64 " bytes) is larger than file size (%#" PRIx64 " bytes)"),
abfd, sec, (uint64_t) sz, (uint64_t) filesize);
return false;
}
p = (bfd_byte *) bfd_malloc (sz);
if (p == NULL)
{
@@ -254,7 +285,7 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
/* xgettext:c-format */
(_("error: %pB(%pA) is too large (%#" PRIx64 " bytes)"),
abfd, sec, (uint64_t) sz);
return FALSE;
return false;
}
}
@@ -262,16 +293,16 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
{
if (*ptr != p)
free (p);
return FALSE;
return false;
}
*ptr = p;
return TRUE;
return true;
case DECOMPRESS_SECTION_SIZED:
/* Read in the full compressed section contents. */
compressed_buffer = (bfd_byte *) bfd_malloc (sec->compressed_size);
if (compressed_buffer == NULL)
return FALSE;
return false;
save_rawsize = sec->rawsize;
save_size = sec->size;
/* Clear rawsize, set size to compressed size and set compress_status
@@ -307,27 +338,27 @@ bfd_get_full_section_contents (bfd *abfd, sec_ptr sec, bfd_byte **ptr)
free (p);
fail_compressed:
free (compressed_buffer);
return FALSE;
return false;
}
free (compressed_buffer);
*ptr = p;
return TRUE;
return true;
case COMPRESS_SECTION_DONE:
if (sec->contents == NULL)
return FALSE;
return false;
if (p == NULL)
{
p = (bfd_byte *) bfd_malloc (sz);
if (p == NULL)
return FALSE;
return false;
*ptr = p;
}
/* PR 17512; file: 5bc29788. */
if (p != sec->contents)
memcpy (p, sec->contents, sz);
return TRUE;
return true;
default:
abort ();
@@ -361,29 +392,35 @@ FUNCTION
bfd_is_section_compressed_with_header
SYNOPSIS
bfd_boolean bfd_is_section_compressed_with_header
bool bfd_is_section_compressed_with_header
(bfd *abfd, asection *section,
int *compression_header_size_p,
bfd_size_type *uncompressed_size_p);
bfd_size_type *uncompressed_size_p,
unsigned int *uncompressed_alignment_power_p);
DESCRIPTION
Return @code{TRUE} if @var{section} is compressed. Compression
header size is returned in @var{compression_header_size_p} and
uncompressed size is returned in @var{uncompressed_size_p}. If
compression is unsupported, compression header size is returned
with -1 and uncompressed size is returned with 0.
header size is returned in @var{compression_header_size_p},
uncompressed size is returned in @var{uncompressed_size_p}
and the uncompressed data alignement power is returned in
@var{uncompressed_align_pow_p}. If compression is
unsupported, compression header size is returned with -1
and uncompressed size is returned with 0.
*/
bfd_boolean
bool
bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec,
int *compression_header_size_p,
bfd_size_type *uncompressed_size_p)
bfd_size_type *uncompressed_size_p,
unsigned int *uncompressed_align_pow_p)
{
bfd_byte header[MAX_COMPRESSION_HEADER_SIZE];
int compression_header_size;
int header_size;
unsigned int saved = sec->compress_status;
bfd_boolean compressed;
bool compressed;
*uncompressed_align_pow_p = 0;
compression_header_size = bfd_get_compression_header_size (abfd, sec);
if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE)
@@ -399,12 +436,12 @@ bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec,
if (compression_header_size == 0)
/* In this case, it should be "ZLIB" followed by the uncompressed
section size, 8 bytes in big-endian order. */
compressed = CONST_STRNEQ ((char*) header , "ZLIB");
compressed = startswith ((char*) header , "ZLIB");
else
compressed = TRUE;
compressed = true;
}
else
compressed = FALSE;
compressed = false;
*uncompressed_size_p = sec->size;
if (compressed)
@@ -412,7 +449,8 @@ bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec,
if (compression_header_size != 0)
{
if (!bfd_check_compression_header (abfd, header, sec,
uncompressed_size_p))
uncompressed_size_p,
uncompressed_align_pow_p))
compression_header_size = -1;
}
/* Check for the pathalogical case of a debug string section that
@@ -421,7 +459,7 @@ bfd_is_section_compressed_with_header (bfd *abfd, sec_ptr sec,
have the first byte of its (big-endian) size be non-zero. */
else if (strcmp (sec->name, ".debug_str") == 0
&& ISPRINT (header[4]))
compressed = FALSE;
compressed = false;
else
*uncompressed_size_p = bfd_getb64 (header + 4);
}
@@ -437,21 +475,23 @@ FUNCTION
bfd_is_section_compressed
SYNOPSIS
bfd_boolean bfd_is_section_compressed
bool bfd_is_section_compressed
(bfd *abfd, asection *section);
DESCRIPTION
Return @code{TRUE} if @var{section} is compressed.
*/
bfd_boolean
bool
bfd_is_section_compressed (bfd *abfd, sec_ptr sec)
{
int compression_header_size;
bfd_size_type uncompressed_size;
unsigned int uncompressed_align_power;
return (bfd_is_section_compressed_with_header (abfd, sec,
&compression_header_size,
&uncompressed_size)
&uncompressed_size,
&uncompressed_align_power)
&& compression_header_size >= 0
&& uncompressed_size > 0);
}
@@ -461,7 +501,7 @@ FUNCTION
bfd_init_section_decompress_status
SYNOPSIS
bfd_boolean bfd_init_section_decompress_status
bool bfd_init_section_decompress_status
(bfd *abfd, asection *section);
DESCRIPTION
@@ -473,13 +513,15 @@ DESCRIPTION
section. Otherwise, return @code{TRUE}.
*/
bfd_boolean
bool
bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec)
{
bfd_byte header[MAX_COMPRESSION_HEADER_SIZE];
int compression_header_size;
int header_size;
bfd_size_type uncompressed_size;
unsigned int uncompressed_alignment_power = 0;
z_stream strm;
compression_header_size = bfd_get_compression_header_size (abfd, sec);
if (compression_header_size > MAX_COMPRESSION_HEADER_SIZE)
@@ -493,32 +535,43 @@ bfd_init_section_decompress_status (bfd *abfd, sec_ptr sec)
|| !bfd_get_section_contents (abfd, sec, header, 0, header_size))
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
return false;
}
if (compression_header_size == 0)
{
/* In this case, it should be "ZLIB" followed by the uncompressed
section size, 8 bytes in big-endian order. */
if (! CONST_STRNEQ ((char*) header, "ZLIB"))
if (! startswith ((char*) header, "ZLIB"))
{
bfd_set_error (bfd_error_wrong_format);
return FALSE;
return false;
}
uncompressed_size = bfd_getb64 (header + 4);
}
else if (!bfd_check_compression_header (abfd, header, sec,
&uncompressed_size))
&uncompressed_size,
&uncompressed_alignment_power))
{
bfd_set_error (bfd_error_wrong_format);
return FALSE;
return false;
}
/* PR28530, reject sizes unsupported by decompress_contents. */
strm.avail_in = sec->size;
strm.avail_out = uncompressed_size;
if (strm.avail_in != sec->size || strm.avail_out != uncompressed_size)
{
bfd_set_error (bfd_error_nonrepresentable_section);
return false;
}
sec->compressed_size = sec->size;
sec->size = uncompressed_size;
bfd_set_section_alignment (sec, uncompressed_alignment_power);
sec->compress_status = DECOMPRESS_SECTION_SIZED;
return TRUE;
return true;
}
/*
@@ -526,7 +579,7 @@ FUNCTION
bfd_init_section_compress_status
SYNOPSIS
bfd_boolean bfd_init_section_compress_status
bool bfd_init_section_compress_status
(bfd *abfd, asection *section);
DESCRIPTION
@@ -537,7 +590,7 @@ DESCRIPTION
section. Otherwise, return @code{TRUE}.
*/
bfd_boolean
bool
bfd_init_section_compress_status (bfd *abfd, sec_ptr sec)
{
bfd_size_type uncompressed_size;
@@ -551,7 +604,7 @@ bfd_init_section_compress_status (bfd *abfd, sec_ptr sec)
|| sec->compress_status != COMPRESS_SECTION_NONE)
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
return false;
}
/* Read in the full section contents and compress it. */
@@ -559,11 +612,11 @@ bfd_init_section_compress_status (bfd *abfd, sec_ptr sec)
uncompressed_buffer = (bfd_byte *) bfd_malloc (uncompressed_size);
/* PR 21431 */
if (uncompressed_buffer == NULL)
return FALSE;
return false;
if (!bfd_get_section_contents (abfd, sec, uncompressed_buffer,
0, uncompressed_size))
return FALSE;
return false;
uncompressed_size = bfd_compress_section_contents (abfd, sec,
uncompressed_buffer,
@@ -576,7 +629,7 @@ FUNCTION
bfd_compress_section
SYNOPSIS
bfd_boolean bfd_compress_section
bool bfd_compress_section
(bfd *abfd, asection *section, bfd_byte *uncompressed_buffer);
DESCRIPTION
@@ -587,7 +640,7 @@ DESCRIPTION
@code{TRUE}.
*/
bfd_boolean
bool
bfd_compress_section (bfd *abfd, sec_ptr sec, bfd_byte *uncompressed_buffer)
{
bfd_size_type uncompressed_size = sec->size;
@@ -601,7 +654,7 @@ bfd_compress_section (bfd *abfd, sec_ptr sec, bfd_byte *uncompressed_buffer)
|| sec->compress_status != COMPRESS_SECTION_NONE)
{
bfd_set_error (bfd_error_invalid_operation);
return FALSE;
return false;
}
/* Compress it. */
+179 -134
View File
@@ -1,6 +1,6 @@
# config.bfd
#
# Copyright (C) 2012-2018 Free Software Foundation, Inc.
# Copyright (C) 2012-2022 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -48,12 +48,6 @@ targ_underscore=no
# Catch obsolete configurations.
case $targ in
openrisc-*-* | or32-*-*)
echo "*** Configuration $targ is obsolete." >&2
echo "*** Use or1k-*-elf or or1k-*-linux as the target instead" >&2
exit 1
;;
powerpc-*-lynxos* | powerpc-*-windiss* | \
null)
if test "x$enable_obsolete" != xyes; then
echo "*** Configuration $targ is obsolete." >&2
@@ -64,8 +58,22 @@ case $targ in
fi;;
esac
# Warn on changed defaulting
case $targ in
*-*-netbsdelf* | *-*-netbsdaout* | *-*-netbsdpe*)
# Explicit, no defaulting
;;
ns32k-*-netbsd*)
# The obsolete warning below is enough, and ns32k does not have ELF support
;;
*-*-netbsd* )
targ_migrated=`echo "$targ" | sed 's/netbsd/netbsdaout/'`
echo "*** WARNING: $targ is now defaults to meaning ELF not a.out." >&2
echo "*** Use $targ_migrated instead to explicitly specify a.out." >&2
;;
esac
case $targ in
*-*-netbsdelf* | i[3-7]86-*-netbsd*-gnu* | i[3-7]86-*-knetbsd*-gnu | \
mips*-*-irix5* | mips*-*-irix6*)
# Not obsolete
;;
@@ -74,17 +82,21 @@ case $targ in
*-sony-* | \
*-tandem-* | \
*-*-ieee* | \
*-*-netbsdpe* | \
*-*-netware* | \
*-*-rtemsaout* | \
*-*-rtemscoff* | \
a29k-* | \
arm*-*-aout | \
arm-*-coff | \
arm-*-netbsd* | \
arm*-*-netbsdaout* | \
arm-*-openbsd* | \
arm-*-oabi | \
arm-*-riscix* | \
arm*-*-symbianelf* | \
arm-epoc-pe* | \
c30-*-*aout* | tic30-*-*aout* | \
cr16c-*-* | \
h8300*-*-coff | \
h8500*-*-coff | \
hppa*-*-rtems* | \
@@ -98,7 +110,7 @@ case $targ in
i[3-7]86-*-aix* | \
i[3-7]86-sequent-bsd* | \
i[3-7]86-*-freebsdaout* | i[3-7]86-*-freebsd[12].* | i[3-7]86-*-freebsd[12] | \
i[3-7]86-*-netbsdaout* | i[3-7]86-*-netbsd* | \
i[3-7]86-*-netbsdaout* | \
i[3-7]86-*-openbsd[0-2].* | i[3-7]86-*-openbsd3.[0-3] | \
i[3-7]86-*-linux*aout* | \
i[3-7]86-*-mach* | i[3-7]86-*-osf1mk* | \
@@ -108,12 +120,13 @@ case $targ in
i370-* | \
i860-*-* | \
i960-*-* | \
m68*-*-*bsd* | \
m68*-*-bsd* | \
m68*-*-aout* | \
m68*-*-coff* | \
m68*-*-hpux* | \
m68*-*-linux*aout* | \
m68*-*-lynxos* | \
m68*-*-openbsd* | \
m68*-*-os68k* | \
m68*-*-psos* | \
m68*-*-sunos* | \
@@ -139,6 +152,13 @@ case $targ in
mips*-dec-* | \
mips*-sgi-* | \
mips*el-*-rtems* | \
m32c-*-rtems* | \
ns32k-*-netbsd* | \
openrisc-*-* | \
or32-*-* | \
powerpc-*-lynxos* | powerpc-*-windiss* | \
powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin* | \
sh*-*-netbsdaout* | \
sh*-*-symbianelf* | sh5*-*-* | sh64*-*-* | \
sparc*-*-*aout* | \
sparc*-*-chorus* | \
@@ -149,9 +169,10 @@ case $targ in
vax-*-bsd* | vax-*-ultrix* | vax-*-vms* | \
w65-*-* | \
we32k-*-* | \
xc16x-*-* | \
null)
echo "*** Configuration $targ is obsolete." >&2
echo "*** Support has been REMOVED." >&2
echo "*** Configuration $targ is now obsolete" >&2
echo "*** and so support for it has been REMOVED." >&2
exit 1
;;
esac
@@ -163,6 +184,7 @@ alpha*) targ_archs=bfd_alpha_arch ;;
am33_2.0*) targ_archs=bfd_mn10300_arch ;;
arc*) targ_archs=bfd_arc_arch ;;
arm*) targ_archs=bfd_arm_arch ;;
amdgcn*) targ_archs=bfd_amdgcn_arch ;;
bfin*) targ_archs=bfd_bfin_arch ;;
c30*) targ_archs=bfd_tic30_arch ;;
c4x*) targ_archs=bfd_tic4x_arch ;;
@@ -170,20 +192,19 @@ c54x*) targ_archs=bfd_tic54x_arch ;;
cr16*) targ_archs=bfd_cr16_arch ;;
crisv32) targ_archs=bfd_cris_arch ;;
crx*) targ_archs=bfd_crx_arch ;;
csky*) targ_archs=bfd_csky_arch ;;
dlx*) targ_archs=bfd_dlx_arch ;;
fido*) targ_archs=bfd_m68k_arch ;;
hppa*) targ_archs=bfd_hppa_arch ;;
i[3-7]86) targ_archs=bfd_i386_arch ;;
ia16) targ_archs=bfd_i386_arch ;;
lm32) targ_archs=bfd_lm32_arch ;;
loongarch*) targ_archs=bfd_loongarch_arch ;;
m6811*|m68hc11*) targ_archs="bfd_m68hc11_arch bfd_m68hc12_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;;
m6812*|m68hc12*) targ_archs="bfd_m68hc12_arch bfd_m68hc11_arch bfd_m9s12x_arch bfd_m9s12xg_arch" ;;
m68*) targ_archs=bfd_m68k_arch ;;
s12z*) targ_archs=bfd_s12z_arch ;;
microblaze*) targ_archs=bfd_microblaze_arch ;;
mips*) targ_archs=bfd_mips_arch ;;
nds32*) targ_archs=bfd_nds32_arch ;;
nfp) targ_archs=bfd_nfp_arch ;;
nios2*) targ_archs=bfd_nios2_arch ;;
or1k*|or1knd*) targ_archs=bfd_or1k_arch ;;
pdp11*) targ_archs=bfd_pdp11_arch ;;
@@ -192,6 +213,7 @@ powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
pru*) targ_archs=bfd_pru_arch ;;
riscv*) targ_archs=bfd_riscv_arch ;;
rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
s12z*) targ_archs=bfd_s12z_arch ;;
s390*) targ_archs=bfd_s390_arch ;;
sh*) targ_archs=bfd_sh_arch ;;
sparc*) targ_archs=bfd_sparc_arch ;;
@@ -200,11 +222,9 @@ tilegx*) targ_archs=bfd_tilegx_arch ;;
tilepro*) targ_archs=bfd_tilepro_arch ;;
v850*) targ_archs="bfd_v850_arch bfd_v850_rh850_arch" ;;
visium*) targ_archs=bfd_visium_arch ;;
wasm32) targ_archs=bfd_wasm32_arch ;;
x86_64*) targ_archs=bfd_i386_arch ;;
xtensa*) targ_archs=bfd_xtensa_arch ;;
xgate) targ_archs=bfd_xgate_arch ;;
z80|r800) targ_archs=bfd_z80_arch ;;
z80*|r800|z180|gbz80|ez80*) targ_archs=bfd_z80_arch ;;
z8k*) targ_archs=bfd_z8k_arch ;;
*) targ_archs=bfd_${targ_cpu}_arch ;;
esac
@@ -216,11 +236,6 @@ esac
# convention, else the table becomes a real mess to understand and maintain.
case "${targ}" in
plugin)
targ_defvec=plugin_vec
targ_selvecs="plugin_vec"
;;
# START OF targmatch.h
#ifdef BFD64
aarch64-*-darwin*)
@@ -229,9 +244,9 @@ case "${targ}" in
targ_archs="$targ_archs bfd_i386_arch bfd_powerpc_arch bfd_rs6000_arch"
want64=true
;;
aarch64-*-elf | aarch64-*-rtems*)
aarch64-*-elf | aarch64-*-rtems* | aarch64-*-genode*)
targ_defvec=aarch64_elf64_le_vec
targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec"
targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec aarch64_pei_vec"
want64=true
;;
aarch64_be-*-elf)
@@ -254,12 +269,17 @@ case "${targ}" in
targ_selvecs=aarch64_elf64_be_cloudabi_vec
want64=true
;;
aarch64-*-linux*)
aarch64-*-haiku*)
targ_defvec=aarch64_elf64_le_vec
targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec"
want64=true
;;
aarch64_be-*-linux*)
aarch64-*-linux* | aarch64-*-netbsd*)
targ_defvec=aarch64_elf64_le_vec
targ_selvecs="aarch64_elf64_be_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_le_vec arm_elf32_be_vec aarch64_pei_vec"
want64=true
;;
aarch64_be-*-linux* | aarch64_be-*-netbsd*)
targ_defvec=aarch64_elf64_be_vec
targ_selvecs="aarch64_elf64_le_vec aarch64_elf32_le_vec aarch64_elf32_be_vec arm_elf32_be_vec arm_elf32_le_vec"
want64=true
@@ -298,6 +318,10 @@ case "${targ}" in
targ_defvec=alpha_ecoff_le_vec
want64=true
;;
amdgcn-*-*)
targ_defvec=amdgcn_elf64_le_vec
want64=true
;;
ia64*-*-freebsd* | ia64*-*-netbsd* | ia64*-*-linux-* | ia64*-*-elf* | ia64*-*-kfreebsd*-gnu)
targ_defvec=ia64_elf64_le_vec
targ_selvecs="ia64_elf64_be_vec ia64_pei_vec"
@@ -338,23 +362,23 @@ case "${targ}" in
targ_defvec=arm_elf32_le_vec
targ_selvecs="arm_elf32_be_vec"
;;
arm*-*-haiku*)
targ_defvec=arm_elf32_le_vec
targ_selvecs="arm_elf32_fdpic_le_vec arm_elf32_be_vec arm_elf32_fdpic_be_vec arm_pe_le_vec arm_pe_be_vec arm_pei_le_vec arm_pei_be_vec"
;;
arm-*-nacl*)
targ_defvec=arm_elf32_nacl_le_vec
targ_selvecs="arm_elf32_nacl_be_vec i386_elf32_nacl_vec"
targ64_selvecs="x86_64_elf32_nacl_vec x86_64_elf64_nacl_vec"
targ_archs="$targ_archs bfd_i386_arch"
targ_selvecs="arm_elf32_nacl_be_vec"
;;
armeb-*-nacl*)
targ_defvec=arm_elf32_nacl_be_vec
targ_selvecs="arm_elf32_nacl_le_vec i386_elf32_nacl_vec"
targ64_selvecs="x86_64_elf32_nacl_vec x86_64_elf64_nacl_vec"
targ_archs="$targ_archs bfd_i386_arch"
targ_selvecs="arm_elf32_nacl_le_vec"
;;
armeb-*-netbsdelf*)
armeb-*-netbsd*)
targ_defvec=arm_elf32_be_vec
targ_selvecs="arm_elf32_le_vec"
;;
arm-*-netbsdelf*)
arm-*-netbsd*)
targ_defvec=arm_elf32_le_vec
targ_selvecs="arm_elf32_be_vec"
;;
@@ -396,10 +420,6 @@ case "${targ}" in
targ_defvec=arm_elf32_vxworks_le_vec
targ_selvecs=arm_elf32_vxworks_be_vec
;;
arm*-*-symbianelf*)
targ_defvec=arm_elf32_symbian_le_vec
targ_selvecs=arm_elf32_symbian_be_vec
;;
arm9e-*-elf)
targ_defvec=arm_elf32_le_vec
targ_selvecs=arm_elf32_be_vec
@@ -415,9 +435,6 @@ case "${targ}" in
targ_underscore=yes
;;
c30-*-*aout* | tic30-*-*aout*)
targ_defvec=tic30_aout_vec
;;
c30-*-*coff* | tic30-*-*coff*)
targ_defvec=tic30_coff_vec
;;
@@ -439,12 +456,6 @@ case "${targ}" in
targ_underscore=yes
;;
cr16c-*-elf*)
targ_defvec=cr16c_elf32_vec
targ_underscore=yes
;;
#ifdef BFD64
cris-*-* | crisv32-*-*)
targ_defvec=cris_aout_vec
targ_selvecs="cris_elf32_us_vec cris_elf32_vec"
@@ -454,13 +465,17 @@ case "${targ}" in
esac
want64=true
;;
#endif
crx-*-elf*)
targ_defvec=crx_elf32_vec
targ_underscore=yes
;;
csky-*-elf* | csky-*-linux* )
targ_defvec=csky_elf32_le_vec
targ_selvecs="csky_elf32_be_vec csky_elf32_le_vec"
;;
d10v-*-*)
targ_defvec=d10v_elf32_vec
;;
@@ -474,6 +489,14 @@ case "${targ}" in
targ_defvec=d30v_elf32_vec
;;
#ifdef BFD64
bpf-*-none)
targ_defvec=bpf_elf64_le_vec
targ_selvecs=bpf_elf64_be_vec
targ_underscore=yes
;;
#endif
epiphany-*-*)
targ_defvec=epiphany_elf32_vec
targ_underscore=yes
@@ -554,27 +577,23 @@ case "${targ}" in
targ_selvecs=hppa_elf32_vec
;;
i[3-7]86-*-elf* | i[3-7]86-*-rtems*)
i[3-7]86-*-elf* | i[3-7]86-*-rtems* | i[3-7]86-*-genode*)
targ_defvec=i386_elf32_vec
targ_selvecs="iamcu_elf32_vec i386_coff_vec"
;;
i[3-7]86-*-solaris2*)
targ_defvec=i386_elf32_sol2_vec
targ_selvecs="iamcu_elf32_vec i386_coff_vec i386_pei_vec"
targ64_selvecs="x86_64_elf64_sol2_vec l1om_elf64_vec k1om_elf64_vec x86_64_pei_vec"
targ64_selvecs="x86_64_elf64_sol2_vec x86_64_pe_vec x86_64_pei_vec"
want64=true
;;
#ifdef BFD64
x86_64-*-solaris2*)
targ_defvec=i386_elf32_sol2_vec
targ_selvecs="x86_64_elf64_sol2_vec l1om_elf64_vec k1om_elf64_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pei_vec"
targ_selvecs="x86_64_elf64_sol2_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pe_vec x86_64_pei_vec"
want64=true
;;
#endif
i[3-7]86-*-kaos*)
targ_defvec=i386_elf32_vec
targ_selvecs=i386_elf32_vec
;;
i[3-7]86-*-nto*)
targ_defvec=i386_elf32_vec
targ_selvecs="iamcu_elf32_vec i386_coff_vec"
@@ -586,7 +605,7 @@ case "${targ}" in
i[3-7]86-*-dicos*)
targ_defvec=i386_elf32_vec
targ_selvecs=iamcu_elf32_vec
targ64_selvecs="x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec"
targ64_selvecs="x86_64_elf64_vec"
;;
*-*-msdosdjgpp* | *-*-go32* )
targ_defvec=i386_coff_go32_vec
@@ -605,26 +624,22 @@ case "${targ}" in
i[3-7]86-*-dragonfly*)
targ_defvec=i386_elf32_vec
targ_selvecs=iamcu_elf32_vec
targ64_selvecs="x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec"
targ64_selvecs="x86_64_elf64_vec"
;;
i[3-7]86-*-freebsd* | i[3-7]86-*-kfreebsd*-gnu)
targ_defvec=i386_elf32_fbsd_vec
targ_selvecs="i386_elf32_vec iamcu_elf32_vec i386_pei_vec i386_coff_vec"
targ64_selvecs="x86_64_elf64_fbsd_vec x86_64_elf64_vec x86_64_pei_vec l1om_elf64_vec l1om_elf64_fbsd_vec k1om_elf64_vec k1om_elf64_fbsd_vec"
targ64_selvecs="x86_64_elf64_fbsd_vec x86_64_elf64_vec x86_64_pe_vec x86_64_pei_vec"
# FreeBSD <= 4.0 supports only the old nonstandard way of ABI labelling.
case "${targ}" in
i[3-7]86-*-freebsd3* | i[3-7]86-*-freebsd4 | i[3-7]86-*-freebsd4.0*)
targ_cflags=-DOLD_FREEBSD_ABI_LABEL ;;
esac
;;
i[3-7]86-*-netbsdelf* | i[3-7]86-*-netbsd*-gnu* | i[3-7]86-*-knetbsd*-gnu)
i[3-7]86-*-netbsd* | i[3-7]86-*-knetbsd*-gnu)
targ_defvec=i386_elf32_vec
targ_selvecs="iamcu_elf32_vec"
targ64_selvecs="x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec"
;;
i[3-7]86-*-netbsdpe*)
targ_defvec=i386_pe_vec
targ_selvecs="i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec"
targ64_selvecs="x86_64_elf64_vec"
;;
i[3-7]86-*-openbsd*)
targ_defvec=i386_elf32_vec
@@ -633,13 +648,7 @@ case "${targ}" in
i[3-7]86-*-linux-*)
targ_defvec=i386_elf32_vec
targ_selvecs="iamcu_elf32_vec i386_pei_vec"
targ64_selvecs="x86_64_elf64_vec x86_64_elf32_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec"
;;
i[3-7]86-*-nacl*)
targ_defvec=i386_elf32_nacl_vec
targ_selvecs="arm_elf32_nacl_be_vec arm_elf32_nacl_le_vec"
targ64_selvecs="x86_64_elf64_nacl_vec x86_64_elf32_nacl_vec"
targ_archs="$targ_archs bfd_arm_arch"
targ64_selvecs="x86_64_elf64_vec x86_64_elf32_vec x86_64_pe_vec x86_64_pei_vec"
;;
i[3-7]86-*-redox*)
targ_defvec=i386_elf32_vec
@@ -659,47 +668,46 @@ case "${targ}" in
;;
x86_64-*-dicos*)
targ_defvec=x86_64_elf64_vec
targ_selvecs="i386_elf32_vec iamcu_elf32_vec l1om_elf64_vec k1om_elf64_vec"
targ_selvecs="i386_elf32_vec iamcu_elf32_vec"
want64=true
;;
x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia)
x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia | x86_64-*-genode*)
targ_defvec=x86_64_elf64_vec
targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec l1om_elf64_vec k1om_elf64_vec"
targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec"
case "${targ}" in
x86_64-*-rtems*)
targ_selvecs="${targ_selvecs} x86_64_pei_vec"
targ_selvecs="${targ_selvecs} x86_64_pe_vec x86_64_pei_vec"
esac
want64=true
;;
x86_64-*-dragonfly*)
targ_defvec=x86_64_elf64_vec
targ_selvecs="i386_elf32_vec iamcu_elf32_vec l1om_elf64_vec k1om_elf64_vec"
targ_selvecs="i386_elf32_vec iamcu_elf32_vec"
want64=true
;;
x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
targ_defvec=x86_64_elf64_fbsd_vec
targ_selvecs="i386_elf32_fbsd_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pei_vec i386_elf32_vec x86_64_elf64_vec l1om_elf64_vec l1om_elf64_fbsd_vec k1om_elf64_vec k1om_elf64_fbsd_vec"
targ_selvecs="i386_elf32_fbsd_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pe_vec x86_64_pei_vec i386_elf32_vec x86_64_elf64_vec"
want64=true
;;
x86_64-*-haiku*)
targ_defvec=x86_64_elf64_vec
targ_selvecs="i386_elf32_vec"
want64=true
;;
x86_64-*-netbsd* | x86_64-*-openbsd*)
targ_defvec=x86_64_elf64_vec
targ_selvecs="i386_elf32_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec"
targ_selvecs="i386_elf32_vec iamcu_elf32_vec i386_coff_vec i386_pei_vec x86_64_pe_vec x86_64_pei_vec"
want64=true
;;
x86_64-*-linux-*)
targ_defvec=x86_64_elf64_vec
targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec i386_pei_vec x86_64_pei_vec l1om_elf64_vec k1om_elf64_vec"
want64=true
;;
x86_64-*-nacl*)
targ_defvec=x86_64_elf32_nacl_vec
targ_selvecs="i386_elf32_nacl_vec x86_64_elf64_nacl_vec arm_elf32_nacl_be_vec arm_elf32_nacl_le_vec"
targ_archs="$targ_archs bfd_arm_arch"
targ_selvecs="i386_elf32_vec iamcu_elf32_vec x86_64_elf32_vec i386_pei_vec x86_64_pe_vec x86_64_pei_vec"
want64=true
;;
x86_64-*-mingw* | x86_64-*-pe | x86_64-*-pep | x86_64-*-cygwin)
targ_defvec=x86_64_pe_vec
targ_selvecs="x86_64_pe_vec x86_64_pei_vec x86_64_pe_be_vec x86_64_elf64_vec l1om_elf64_vec k1om_elf64_vec i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec"
targ_selvecs="x86_64_pe_vec x86_64_pei_vec x86_64_pe_big_vec x86_64_elf64_vec i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec"
want64=true
targ_underscore=no
;;
@@ -737,6 +745,10 @@ case "${targ}" in
targ_defvec=i386_elf32_vec
targ_selvecs="iamcu_elf32_vec i386_pe_vec i386_pei_vec"
;;
i[3-7]86-*-haiku*)
targ_defvec=i386_elf32_vec
targ_selvecs="i386_pei_vec"
;;
i[3-7]86-*-interix*)
targ_defvec=i386_pei_vec
targ_selvecs="i386_pe_vec"
@@ -749,17 +761,13 @@ case "${targ}" in
;;
i[3-7]86-*-mingw32* | i[3-7]86-*-cygwin* | i[3-7]86-*-winnt | i[3-7]86-*-pe)
targ_defvec=i386_pe_vec
targ_selvecs="i386_pe_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec"
targ_selvecs="i386_pe_vec i386_pe_big_vec i386_pei_vec i386_elf32_vec iamcu_elf32_vec"
targ_underscore=yes
;;
i[3-7]86-*-vxworks*)
targ_defvec=i386_elf32_vxworks_vec
targ_underscore=yes
;;
i[3-7]86-*-chaos)
targ_defvec=i386_elf32_vec
targ_selfvecs="iamcu_elf32_vec i386chaos_vec"
;;
ia16-*-elf)
targ_defvec=i386_elf32_vec
@@ -785,7 +793,7 @@ case "${targ}" in
targ_selvecs=lm32_elf32_vec
;;
m32c-*-elf | m32c-*-rtems*)
m32c-*-elf)
targ_defvec=m32c_elf32_vec
targ_underscore=yes
;;
@@ -806,6 +814,9 @@ case "${targ}" in
targ_defvec=m32r_elf32_vec
;;
m68*-*-haiku*)
targ_defvec=m68k_elf32_vec
;;
m68hc11-*-* | m6811-*-*)
targ_defvec=m68hc11_elf32_vec
targ_selvecs="m68hc11_elf32_vec m68hc12_elf32_vec"
@@ -860,6 +871,10 @@ case "${targ}" in
targ_defvec=mips_elf32_trad_be_vec
targ_selvecs="mips_elf32_trad_le_vec mips_elf64_trad_be_vec mips_elf64_trad_le_vec mips_ecoff_be_vec mips_ecoff_le_vec"
;;
mips*el-*-haiku*)
targ_defvec=mips_elf32_le_vec
targ_selvecs="mips_elf32_be_vec mips_elf64_be_vec mips_elf64_le_vec mips_ecoff_le_vec mips_ecoff_be_vec"
;;
mips*-*-irix6*)
targ_defvec=mips_elf32_n_be_vec
targ_selvecs="mips_elf32_n_le_vec mips_elf32_be_vec mips_elf32_le_vec mips_elf64_be_vec mips_elf64_le_vec"
@@ -1011,7 +1026,7 @@ case "${targ}" in
targ_defvec=ns32k_aout_pc532mach_vec
targ_underscore=yes
;;
ns32k-*-netbsd* | ns32k-*-lites* | ns32k-*-openbsd*)
ns32k-*-lites* | ns32k-*-*bsd*)
targ_defvec=ns32k_aout_pc532nbsd_vec
targ_underscore=yes
;;
@@ -1059,8 +1074,13 @@ case "${targ}" in
targ_selvecs="rs6000_xcoff64_aix_vec"
want64=true
;;
powerpc-*-haiku*)
targ_defvec=powerpc_elf32_vec
targ_selvecs="rs6000_xcoff_vec powerpc_elf32_le_vec pef_vec pef_xlib_vec powerpc_xcoff_vec powerpc_boot_vec"
targ_cflags=-D__HAIKU_TARGET__
;;
#ifdef BFD64
powerpc64-*-aix5.[01] | rs6000-*-aix5.[01])
powerpc64-*-aix5.[01])
targ_defvec=rs6000_xcoff64_aix_vec
targ_selvecs="rs6000_xcoff_vec"
want64=true
@@ -1073,7 +1093,7 @@ case "${targ}" in
want64=true
;;
#ifdef BFD64
powerpc64-*-aix[5-9]* | rs6000-*-aix[5-9]*)
powerpc64-*-aix[5-9]*)
targ_cflags=-DAIX_WEAK_SUPPORT
targ_defvec=rs6000_xcoff64_aix_vec
targ_selvecs="rs6000_xcoff_vec"
@@ -1102,6 +1122,11 @@ case "${targ}" in
targ_selvecs="powerpc_elf64_vec powerpc_elf32_vec powerpc_elf32_fbsd_vec powerpc_elf32_le_vec rs6000_xcoff_vec rs6000_xcoff64_vec rs6000_xcoff64_aix_vec"
want64=true
;;
powerpc64le-*-freebsd*)
targ_defvec=powerpc_elf64_fbsd_le_vec
targ_selvecs="powerpc_elf64_vec powerpc_elf32_vec powerpc_elf32_fbsd_vec powerpc_elf32_le_vec rs6000_xcoff_vec rs6000_xcoff64_vec rs6000_xcoff64_aix_vec"
want64=true
;;
powerpc64-*-elf* | powerpc-*-elf64* | powerpc64-*-linux* | \
powerpc64-*-*bsd*)
targ_defvec=powerpc_elf64_vec
@@ -1164,24 +1189,30 @@ case "${targ}" in
targ_selvecs="rs6000_xcoff_vec powerpc_elf32_vec powerpc_boot_vec"
targ64_selvecs="powerpc_elf64_vec powerpc_elf64_le_vec"
;;
powerpcle-*-pe | powerpcle-*-winnt* | powerpcle-*-cygwin*)
targ_defvec=powerpc_pe_le_vec
targ_selvecs="powerpc_pei_le_vec powerpc_pei_vec powerpc_pe_le_vec powerpc_pe_vec"
;;
pru-*-*)
targ_defvec=pru_elf32_vec
;;
#ifdef BFD64
riscvbe-*-* | riscv32be*-*-*)
targ_defvec=riscv_elf32_be_vec
targ_selvecs="riscv_elf32_vec riscv_elf64_vec riscv_elf32_be_vec riscv_elf64_be_vec"
want64=true
;;
riscv-*-* | riscv32*-*-*)
targ_defvec=riscv_elf32_vec
targ_selvecs="riscv_elf32_vec riscv_elf64_vec"
targ_selvecs="riscv_elf32_vec riscv_elf64_vec riscv_elf32_be_vec riscv_elf64_be_vec"
want64=true
;;
riscv64be*-*-*)
targ_defvec=riscv_elf64_be_vec
targ_selvecs="riscv_elf32_vec riscv_elf64_vec riscv_elf32_be_vec riscv_elf64_be_vec"
want64=true
;;
riscv64*-*-*)
targ_defvec=riscv_elf64_vec
targ_selvecs="riscv_elf32_vec riscv_elf64_vec"
targ_selvecs="riscv_elf32_vec riscv_elf64_vec riscv_elf32_be_vec riscv_elf64_be_vec"
want64=true
;;
#endif
@@ -1196,6 +1227,10 @@ case "${targ}" in
targ_selvecs="rx_elf32_be_vec rx_elf32_le_vec rx_elf32_be_ns_vec"
targ_underscore=yes
;;
rx-*-linux*)
targ_defvec=rx_elf32_linux_le_vec
targ_selvecs="rx_elf32_linux_le_vec"
;;
s390-*-linux*)
targ_defvec=s390_elf32_vec
@@ -1235,11 +1270,11 @@ case "${targ}" in
targ_selvecs="sh_elf32_le_vec sh_elf32_linux_be_vec sh_elf32_linux_vec sh_elf32_fdpic_le_vec sh_elf32_fdpic_be_vec"
;;
sh*l*-*-netbsdelf*)
sh*l*-*-netbsd*)
targ_defvec=sh_elf32_nbsd_le_vec
targ_selvecs="sh_elf32_nbsd_vec sh_coff_vec sh_coff_le_vec"
;;
sh*-*-netbsdelf*)
sh*-*-netbsd*)
targ_defvec=sh_elf32_nbsd_vec
targ_selvecs="sh_elf32_nbsd_le_vec sh_coff_vec sh_coff_le_vec"
;;
@@ -1286,14 +1321,21 @@ case "${targ}" in
;;
sparc-*-solaris2.[0-6] | sparc-*-solaris2.[0-6].*)
# PR 27666: Do not include sparc_elf32_vec here.
targ_defvec=sparc_elf32_sol2_vec
;;
#ifdef BFD64
sparc-*-solaris2* | sparcv9-*-solaris2* | sparc64-*-solaris2*)
# PR 27666: Do not include sparc_elf32_vec or sparc_elf64_vec here.
targ_defvec=sparc_elf32_sol2_vec
targ_selvecs="sparc_elf64_sol2_vec"
want64=true
;;
sparc64-*-haiku*)
targ_defvec=sparc_elf64_vec
targ_selvecs="sparc_elf64_vec sparc_elf32_vec"
want64=true
;;
sparc64-*-freebsd* | sparc64-*-kfreebsd*-gnu)
targ_defvec=sparc_elf64_fbsd_vec
targ_selvecs="sparc_elf64_vec sparc_elf32_vec"
@@ -1331,11 +1373,6 @@ case "${targ}" in
targ_selvecs="tic6x_elf32_linux_be_vec tic6x_elf32_le_vec tic6x_elf32_be_vec"
;;
tic80*-*-*)
targ_defvec=tic80_coff_vec
targ_underscore=yes
;;
#ifdef BFD64
tilegx-*-*)
targ_defvec=tilegx_elf64_le_vec
@@ -1361,17 +1398,17 @@ case "${targ}" in
targ_underscore=yes
;;
vax-*-netbsdelf*)
targ_defvec=vax_elf32_vec
targ_selvecs="vax_aout_nbsd_vec vax_aout_1knbsd_vec"
;;
vax-*-netbsdaout* | vax-*-netbsd*)
vax-*-netbsdaout*)
targ_defvec=vax_aout_nbsd_vec
targ_selvecs="vax_elf32_vec vax_aout_1knbsd_vec"
targ_underscore=yes
;;
vax-*-netbsd*)
targ_defvec=vax_elf32_vec
targ_selvecs="vax_aout_nbsd_vec vax_aout_1knbsd_vec"
;;
vax-*-openbsd*)
targ_defvec=vax_aout_nbsd_vec
targ_underscore=yes
@@ -1403,12 +1440,14 @@ case "${targ}" in
targ_defvec=xtensa_elf32_le_vec
targ_selvecs=xtensa_elf32_be_vec
;;
xc16x-*-elf)
targ_defvec=xc16x_elf32_vec
z80-*-coff)
targ_defvec=z80_coff_vec
targ_underscore=no
;;
z80-*-*)
targ_defvec=z80_coff_vec
z80-*-elf)
targ_defvec=z80_elf32_vec
targ_underscore=no
;;
@@ -1417,7 +1456,27 @@ case "${targ}" in
targ_underscore=yes
;;
#ifdef BFD64
loongarch32-*)
targ_defvec=loongarch_elf32_vec
targ_selvecs="loongarch_elf32_vec"
want64=true
;;
loongarch64-*)
targ_defvec=loongarch_elf64_vec
targ_selvecs="loongarch_elf32_vec loongarch_elf64_vec"
want64=true
;;
#endif
# END OF targmatch.h
bpf-*-*)
echo "*** Configuration $targ is not fully supported." >&2
echo "*** Use bpf or bpf-*-none as the target instead." >&2
exit 1
;;
*)
echo 1>&2 "*** BFD does not support target ${targ}."
echo 1>&2 "*** Look in bfd/config.bfd for supported targets."
@@ -1457,17 +1516,3 @@ case "${targ_defvec} ${targ_selvecs}" in
targ_archs="$targ_archs bfd_iamcu_arch"
;;
esac
# If we support Intel L1OM target, then add support for bfd_l1om_arch.
case "${targ_defvec} ${targ_selvecs}" in
*l1om_elf64*)
targ_archs="$targ_archs bfd_l1om_arch"
;;
esac
# If we support Intel K1OM target, then add support for bfd_k1om_arch.
case "${targ_defvec} ${targ_selvecs}" in
*k1om_elf64*)
targ_archs="$targ_archs bfd_k1om_arch"
;;
esac
+12 -84
View File
@@ -14,13 +14,13 @@
default. */
#undef DEFAULT_LD_Z_SEPARATE_CODE
/* Define if you want run-time sanity checks. */
#undef ENABLE_CHECKING
/* Define to 1 if translation of program messages to the user's native
language is requested. */
#undef ENABLE_NLS
/* Define to 1 if you have the <alloca.h> header file. */
#undef HAVE_ALLOCA_H
/* Define to 1 if you have the declaration of `asprintf', and to 0 if you
don't. */
#undef HAVE_DECL_ASPRINTF
@@ -32,9 +32,9 @@
/* Define to 1 if you have the declaration of `ffs', and to 0 if you don't. */
#undef HAVE_DECL_FFS
/* Define to 1 if you have the declaration of `free', and to 0 if you don't.
*/
#undef HAVE_DECL_FREE
/* Define to 1 if you have the declaration of `fopen64', and to 0 if you
don't. */
#undef HAVE_DECL_FOPEN64
/* Define to 1 if you have the declaration of `fseeko', and to 0 if you don't.
*/
@@ -52,22 +52,6 @@
don't. */
#undef HAVE_DECL_FTELLO64
/* Define to 1 if you have the declaration of `getenv', and to 0 if you don't.
*/
#undef HAVE_DECL_GETENV
/* Define to 1 if you have the declaration of `malloc', and to 0 if you don't.
*/
#undef HAVE_DECL_MALLOC
/* Define to 1 if you have the declaration of `realloc', and to 0 if you
don't. */
#undef HAVE_DECL_REALLOC
/* Define to 1 if you have the declaration of `snprintf', and to 0 if you
don't. */
#undef HAVE_DECL_SNPRINTF
/* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't.
*/
#undef HAVE_DECL_STPCPY
@@ -76,22 +60,10 @@
don't. */
#undef HAVE_DECL_STRNLEN
/* Define to 1 if you have the declaration of `strstr', and to 0 if you don't.
*/
#undef HAVE_DECL_STRSTR
/* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
don't. */
#undef HAVE_DECL_VASPRINTF
/* Define to 1 if you have the declaration of `vsnprintf', and to 0 if you
don't. */
#undef HAVE_DECL_VSNPRINTF
/* Define to 1 if you have the <dirent.h> header file, and it defines `DIR'.
*/
#undef HAVE_DIRENT_H
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
@@ -107,6 +79,9 @@
/* Define to 1 if you have the `fileno' function. */
#undef HAVE_FILENO
/* Define to 1 if you have the `fls' function. */
#undef HAVE_FLS
/* Define to 1 if you have the `fopen64' function. */
#undef HAVE_FOPEN64
@@ -140,12 +115,6 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* Define to 1 if the system has the type `long double'. */
#undef HAVE_LONG_DOUBLE
/* Define to 1 if the system has the type `long long'. */
#undef HAVE_LONG_LONG
/* Define if <sys/procfs.h> has lwpstatus_t. */
#undef HAVE_LWPSTATUS_T
@@ -173,9 +142,6 @@
/* Define to 1 if you have the `mprotect' function. */
#undef HAVE_MPROTECT
/* Define to 1 if you have the <ndir.h> header file, and it defines `DIR'. */
#undef HAVE_NDIR_H
/* Define if <sys/procfs.h> has prpsinfo32_t. */
#undef HAVE_PRPSINFO32_T
@@ -221,12 +187,6 @@
/* Define if <sys/procfs.h> has pxstatus_t. */
#undef HAVE_PXSTATUS_T
/* Define to 1 if you have the `setitimer' function. */
#undef HAVE_SETITIMER
/* Define to 1 if you have the <stddef.h> header file. */
#undef HAVE_STDDEF_H
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
@@ -239,26 +199,15 @@
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the `strtoull' function. */
#undef HAVE_STRTOULL
/* Define if struct core_dumpx has member c_impl */
#undef HAVE_ST_C_IMPL
/* Define to 1 if you have the `sysconf' function. */
#undef HAVE_SYSCONF
/* Define to 1 if you have the <sys/dir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_DIR_H
/* Define to 1 if you have the <sys/file.h> header file. */
#undef HAVE_SYS_FILE_H
/* Define to 1 if you have the <sys/ndir.h> header file, and it defines `DIR'.
*/
#undef HAVE_SYS_NDIR_H
/* Define to 1 if you have the <sys/param.h> header file. */
#undef HAVE_SYS_PARAM_H
@@ -271,24 +220,12 @@
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/time.h> header file. */
#undef HAVE_SYS_TIME_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* Define to 1 if you have the <time.h> header file. */
#undef HAVE_TIME_H
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* Define to 1 if you have the <wchar.h> header file. */
#undef HAVE_WCHAR_H
/* Define to 1 if you have the <wctype.h> header file. */
#undef HAVE_WCTYPE_H
/* Define if <sys/procfs.h> has win32_pstatus_t. */
#undef HAVE_WIN32_PSTATUS_T
@@ -320,9 +257,6 @@
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* The size of `char', as computed by sizeof. */
#undef SIZEOF_CHAR
/* The size of `int', as computed by sizeof. */
#undef SIZEOF_INT
@@ -335,21 +269,12 @@
/* The size of `off_t', as computed by sizeof. */
#undef SIZEOF_OFF_T
/* The size of `short', as computed by sizeof. */
#undef SIZEOF_SHORT
/* The size of `void *', as computed by sizeof. */
#undef SIZEOF_VOID_P
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if you can safely include both <string.h> and <strings.h>. */
#undef STRING_WITH_STRINGS
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
/* Name of host specific header file to include in trad-core.c. */
#undef TRAD_HEADER
@@ -413,3 +338,6 @@
/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE
/* Use structured /proc on Solaris. */
#undef _STRUCTURED_PROC
+1408 -3052
View File
File diff suppressed because it is too large Load Diff
+116 -130
View File
@@ -1,6 +1,6 @@
dnl Process this file with autoconf to produce a configure script.
dnl
dnl Copyright (C) 2012-2018 Free Software Foundation, Inc.
dnl Copyright (C) 2012-2022 Free Software Foundation, Inc.
dnl
dnl This file is free software; you can redistribute it and/or modify
dnl it under the terms of the GNU General Public License as published by
@@ -22,9 +22,9 @@ AC_INIT([bfd], BFD_VERSION)
AC_CONFIG_SRCDIR([libbfd.c])
AC_CANONICAL_TARGET
AC_ISC_POSIX
AM_INIT_AUTOMAKE
AM_SILENT_RULES([yes])
dnl These must be called before LT_INIT, because it may want
dnl to call AC_CHECK_PROG.
@@ -44,19 +44,50 @@ LT_INIT([dlopen])
# AC_PLUGINS setting $plugins is called by ACX_LARGEFILE.
ACX_LARGEFILE
changequote(,)dnl
case "${target}" in
hppa*64*-*-*) ;;
*-*-*aout*| i[3-7]86-*-msdos* | ns32k-*-* | pdp11-*-*)
changequote([,])dnl
if test "$plugins" = "yes"; then
if test "${enable_plugins+set}" = set; then
AC_MSG_WARN(Enabling plugins for AOUT is experimental)
else
plugins=no
fi
fi ;;
hppa*-*-hpux* | *-*-*vms* | \
powerpc*-*-aix* | powerpc-*-beos* | powerpc-*-macos* | rs6000-*-*)
if test "$plugins" = "yes"; then
if test "${enable_plugins+set}" = set; then
AC_MSG_WARN(Enabling plugins may result in ar creating non-standard archives for ${target})
else
plugins=no
fi
fi ;;
esac
AM_CONDITIONAL(PLUGINS, test "$plugins" = "yes")
if test "$plugins" = "yes"; then
enable_targets="$enable_targets plugin"
ac_checking=
. ${srcdir}/development.sh
test "$development" = true && ac_checking=yes
AC_ARG_ENABLE(checking,
[ --enable-checking enable run-time checks],
[case "${enableval}" in
no|none) ac_checking= ;;
*) ac_checking=yes ;;
esac])dnl
if test x$ac_checking != x ; then
AC_DEFINE(ENABLE_CHECKING, 1, [Define if you want run-time sanity checks.])
fi
AC_ARG_ENABLE(64-bit-bfd,
[ --enable-64-bit-bfd 64-bit support (on hosts with narrower word sizes)],
[case "${enableval}" in
yes) want64=true ;;
no) want64=false ;;
*) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
esac],[want64=false])dnl
BFD_64_BIT
if test $enable_64_bit_bfd = yes ; then
want64=true
else
want64=false
fi
AC_ARG_ENABLE(targets,
[ --enable-targets alternative target configurations],
@@ -138,7 +169,7 @@ AC_ARG_WITH(separate-debug-dir,
AC_SUBST(DEBUGDIR)
ACX_PKGVERSION([GNU Binutils])
ACX_BUGURL([http://www.sourceware.org/bugzilla/])
ACX_BUGURL([https://sourceware.org/bugzilla/])
AM_BINUTILS_WARNINGS
@@ -178,81 +209,27 @@ AM_PO_SUBDIRS
AC_SUBST(HDEFINES)
AC_PROG_INSTALL
BFD_HOST_64BIT_LONG=0
BFD_HOST_64BIT_LONG_LONG=0
BFD_HOST_64_BIT_DEFINED=0
BFD_HOST_64_BIT=
BFD_HOST_U_64_BIT=
BFD_HOSTPTR_T="unsigned long"
AC_TYPE_LONG_DOUBLE
AC_CHECK_TYPES([long long], [AC_CHECK_SIZEOF(long long)])
AC_CHECK_SIZEOF(long long)
AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(long)
AC_CHECK_SIZEOF(int)
if test "x${ac_cv_sizeof_void_p}" = "x8"; then
host64=true
fi
if test "x${ac_cv_sizeof_long}" = "x8"; then
BFD_HOST_64BIT_LONG=1
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long"
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long"
elif test "x${ac_cv_sizeof_long_long}" = "x8"; then
BFD_HOST_64BIT_LONG_LONG=1
test -n "${HOST_64BIT_TYPE}" || HOST_64BIT_TYPE="long long"
test -n "${HOST_U_64BIT_TYPE}" || HOST_U_64BIT_TYPE="unsigned long long"
if test "x${ac_cv_sizeof_void_p}" = "x8"; then
BFD_HOSTPTR_T="unsigned long long"
fi
fi
if test -n "${HOST_64BIT_TYPE}" -a -n "${HOST_U_64BIT_TYPE}"; then
BFD_HOST_64_BIT_DEFINED=1
BFD_HOST_64_BIT="${HOST_64BIT_TYPE}"
BFD_HOST_U_64_BIT="${HOST_U_64BIT_TYPE}"
fi
AC_SUBST(BFD_HOST_64BIT_LONG)
AC_SUBST(BFD_HOST_64BIT_LONG_LONG)
AC_SUBST(BFD_HOST_64_BIT_DEFINED)
AC_SUBST(BFD_HOST_64_BIT)
AC_SUBST(BFD_HOST_U_64_BIT)
AC_SUBST(BFD_HOSTPTR_T)
BFD_CC_FOR_BUILD
AC_CHECK_HEADERS(alloca.h stddef.h string.h strings.h stdlib.h time.h unistd.h wchar.h wctype.h)
AC_CHECK_HEADERS(fcntl.h sys/file.h sys/time.h sys/stat.h sys/resource.h)
GCC_HEADER_STDINT(bfd_stdint.h)
AC_HEADER_TIME
AC_HEADER_DIRENT
AC_CHECK_HEADERS(fcntl.h sys/file.h sys/resource.h sys/stat.h sys/types.h \
unistd.h)
ACX_HEADER_STRING
AC_CHECK_FUNCS(fcntl getpagesize setitimer sysconf fdopen getuid getgid fileno)
AC_CHECK_FUNCS(strtoull getrlimit)
AC_CHECK_FUNCS(fcntl fdopen fileno fls getgid getpagesize getrlimit getuid \
sysconf)
AC_CHECK_DECLS(basename)
AC_CHECK_DECLS(ftello)
AC_CHECK_DECLS(ftello64)
AC_CHECK_DECLS(fseeko)
AC_CHECK_DECLS(fseeko64)
AC_CHECK_DECLS([basename, ffs, stpcpy, asprintf, vasprintf, strnlen])
BFD_BINARY_FOPEN
AC_CHECK_DECLS(ffs)
AC_CHECK_DECLS(free)
AC_CHECK_DECLS(getenv)
AC_CHECK_DECLS(malloc)
AC_CHECK_DECLS(realloc)
AC_CHECK_DECLS(stpcpy)
AC_CHECK_DECLS(strstr)
AC_CHECK_DECLS(asprintf)
AC_CHECK_DECLS(vasprintf)
AC_CHECK_DECLS(snprintf)
AC_CHECK_DECLS(vsnprintf)
AC_CHECK_DECLS(strnlen)
# Link in zlib if we can. This allows us to read compressed debug sections.
# This is used only by compress.c.
AM_ZLIB
@@ -271,6 +248,18 @@ if test $bfd_cv_hidden = yes; then
[Define if your compiler supports hidden visibility.])
fi
AC_CACHE_CHECK([printf int64_t format], [bfd_cv_int64_fmt],
for style in I64 ll l; do
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
#define __STDC_FORMAT_MACROS 1
#include <stdio.h>
#include <inttypes.h>
extern char PRId64_probe[sizeof PRId64 == sizeof "${style}d" ? 1 : -1];
]])], [bfd_cv_int64_fmt=${style}], [])]
done)
BFD_INT64_FMT=\"$bfd_cv_int64_fmt\"
AC_SUBST(BFD_INT64_FMT)
# Check if linker supports --as-needed and --no-as-needed options
AC_CACHE_CHECK(linker --as-needed support, bfd_cv_ld_as_needed,
[bfd_cv_ld_as_needed=no
@@ -295,17 +284,16 @@ changequote([,])dnl
if test -n "$x"; then
SHARED_LIBADD="-L`pwd`/../libiberty/pic -liberty"
fi
fi
# More hacks to build DLLs on Windows.
SHARED_LIBADD="$SHARED_LIBADD $LIBINTL"
if test "$enable_shared" = "yes"; then
case "${host}" in
# More hacks to build DLLs on Windows.
*-*-cygwin*)
SHARED_LDFLAGS="-no-undefined"
SHARED_LIBADD="-L`pwd`/../libiberty -liberty -L`pwd`/../intl -lintl -lcygwin -lkernel32"
;;
# Hack to build or1k-src on OSX
or1k*-*-darwin*)
SHARED_LIBADD="-L`pwd`/../libiberty/pic -L`pwd`/../intl -liberty -lintl"
SHARED_LIBADD="-L`pwd`/../libiberty -liberty $SHARED_LIBADD -lcygwin -lkernel32"
;;
esac
@@ -348,12 +336,12 @@ selarchs=
TDEFINES=
for targ in $target $canon_targets
do
if test "x$targ" = "xall"; then
if test $targ = all; then
all_targets=true
assocvecs="$assocvecs $targ_defvec $targ_selvecs"
else
elif test $targ != plugin; then
. $srcdir/config.bfd
if test "x$targ" = "x$target"; then
if test $targ = $target; then
defvec=$targ_defvec
fi
selvecs="$selvecs $targ_defvec $targ_selvecs"
@@ -405,13 +393,14 @@ selarchs="$f"
# Target backend .o files.
tb=
elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-properties.lo
elf-eh-frame.lo dwarf1.lo dwarf2.lo"
elf="elf.lo elflink.lo elf-attrs.lo elf-strtab.lo elf-eh-frame.lo
dwarf1.lo dwarf2.lo"
coffgen="coffgen.lo dwarf2.lo"
coff="cofflink.lo $coffgen"
ecoff="ecofflink.lo $coffgen"
xcoff="xcofflink.lo $coffgen"
elfxx_x86="elfxx-x86.lo elf-ifunc.lo elf-vxworks.lo"
for vec in $selvecs
do
target_size=32
@@ -426,12 +415,14 @@ do
aarch64_elf64_le_vec) tb="$tb elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
aarch64_elf64_le_cloudabi_vec) tb="$tb elf64-aarch64.lo elfxx-aarch64.lo elf-ifunc.lo elf64.lo $elf"; target_size=64 ;;
aarch64_mach_o_vec) tb="$tb mach-o-aarch64.lo"; target_size=64 ;;
aarch64_pei_vec) tb="$tb pei-aarch64.lo pe-aarch64igen.lo $coff"; target_size=64 ;;
alpha_ecoff_le_vec) tb="$tb coff-alpha.lo ecoff.lo $ecoff"; target_size=64 ;;
alpha_elf64_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
alpha_elf64_fbsd_vec) tb="$tb elf64-alpha.lo elf64.lo $elf"; target_size=64 ;;
alpha_vms_vec) tb="$tb vms-alpha.lo vms-misc.lo vms-lib.lo"; target_size=64 ;;
alpha_vms_lib_txt_vec) tb="$tb vms-lib.lo vms-misc.lo" ;;
am33_elf32_linux_vec) tb="$tb elf32-am33lin.lo elf32.lo $elf" ;;
amdgcn_elf64_le_vec) tb="$tb elf64-amdgcn.lo elf64.lo $elf"; target_size=64 ;;
aout0_be_vec) tb="$tb aout0.lo aout32.lo" ;;
aout64_vec) tb="$tb demo64.lo aout64.lo"; target_size=64 ;;
aout_vec) tb="$tb host-aout.lo aout32.lo" ;;
@@ -443,8 +434,6 @@ do
arm_elf32_fdpic_le_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
arm_elf32_nacl_be_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
arm_elf32_nacl_le_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
arm_elf32_symbian_be_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
arm_elf32_symbian_le_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
arm_elf32_vxworks_be_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
arm_elf32_vxworks_le_vec) tb="$tb elf32-arm.lo elf32.lo elf-nacl.lo elf-vxworks.lo $elf" ;;
arm_pe_be_vec) tb="$tb pe-arm.lo peigen.lo $coff" ;;
@@ -460,11 +449,12 @@ do
bfin_elf32_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;;
bfin_elf32_fdpic_vec) tb="$tb elf32-bfin.lo elf32.lo $elf" ;;
cr16_elf32_vec) tb="$tb elf32-cr16.lo elf32.lo $elf" ;;
cr16c_elf32_vec) tb="$tb elf32-cr16c.lo elf32.lo $elf" ;;
cris_aout_vec) tb="$tb aout-cris.lo" ;;
cris_elf32_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
cris_elf32_us_vec) tb="$tb elf32-cris.lo elf32.lo $elf" ;;
crx_elf32_vec) tb="$tb elf32-crx.lo elf32.lo $elf" ;;
csky_elf32_be_vec) tb="$tb elf32-csky.lo elf32.lo $elf" ;;
csky_elf32_le_vec) tb="$tb elf32-csky.lo elf32.lo $elf" ;;
d10v_elf32_vec) tb="$tb elf32-d10v.lo elf32.lo $elf" ;;
d30v_elf32_vec) tb="$tb elf32-d30v.lo elf32.lo $elf" ;;
dlx_elf32_be_vec) tb="$tb elf32-dlx.lo elf32.lo $elf" ;;
@@ -472,6 +462,8 @@ do
elf32_le_vec) tb="$tb elf32-gen.lo elf32.lo $elf" ;;
elf64_be_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
elf64_le_vec) tb="$tb elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
bpf_elf64_le_vec) tb="$tb elf64-bpf.lo elf64.lo $elf"; target_size=64;;
bpf_elf64_be_vec) tb="$tb elf64-bpf.lo elf64.lo $elf"; target_size=64 ;;
epiphany_elf32_vec) tb="$tb elf32-epiphany.lo elf32.lo $elf" ;;
fr30_elf32_vec) tb="$tb elf32-fr30.lo elf32.lo $elf" ;;
frv_elf32_vec) tb="$tb elf32-frv.lo elf32.lo $elf" ;;
@@ -491,16 +483,16 @@ do
i386_coff_go32_vec) tb="$tb coff-go32.lo $coff" ;;
i386_coff_go32stubbed_vec) tb="$tb coff-stgo32.lo $coff" ;;
i386_coff_lynx_vec) tb="$tb cf-i386lynx.lo lynx-core.lo $coff" ;;
i386_elf32_vec) tb="$tb elf32-i386.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
i386_elf32_fbsd_vec) tb="$tb elf32-i386.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
i386_elf32_nacl_vec) tb="$tb elf32-i386.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
i386_elf32_sol2_vec) tb="$tb elf32-i386.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
i386_elf32_vxworks_vec) tb="$tb elf32-i386.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
i386_elf32_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
i386_elf32_fbsd_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
i386_elf32_sol2_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
i386_elf32_vxworks_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
i386_mach_o_vec) tb="$tb mach-o-i386.lo" ;;
i386_msdos_vec) tb="$tb i386msdos.lo" ;;
i386_pe_vec) tb="$tb pe-i386.lo peigen.lo $coff" ;;
i386_pe_big_vec) tb="$tb pe-i386.lo peigen.lo $coff" ;;
i386_pei_vec) tb="$tb pei-i386.lo peigen.lo $coff" ;;
iamcu_elf32_vec) tb="$tb elf32-i386.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf-vxworks.lo elf32.lo $elf" ;;
iamcu_elf32_vec) tb="$tb elf32-i386.lo $elfxx_x86 elf32.lo $elf" ;;
ia64_elf32_be_vec) tb="$tb elf32-ia64.lo elfxx-ia64.lo elf32.lo $elf" ;;
ia64_elf32_hpux_be_vec) tb="$tb elf32-ia64.lo elfxx-ia64.lo elf32.lo $elf" ;;
ia64_elf64_be_vec) tb="$tb elf64-ia64.lo elfxx-ia64.lo elf64.lo $elf"; target_size=64 ;;
@@ -510,12 +502,10 @@ do
ia64_pei_vec) tb="$tb pei-ia64.lo pepigen.lo $coff"; target_size=64 ;;
ip2k_elf32_vec) tb="$tb elf32-ip2k.lo elf32.lo $elf" ;;
iq2000_elf32_vec) tb="$tb elf32-iq2000.lo elf32.lo $elf" ;;
k1om_elf64_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
k1om_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
l1om_elf64_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
l1om_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
lm32_elf32_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;;
lm32_elf32_fdpic_vec) tb="$tb elf32-lm32.lo elf32.lo $elf" ;;
loongarch_elf32_vec) tb="$tb elf32-loongarch.lo elfxx-loongarch.lo elf32.lo elf-ifunc.lo $elf" ;;
loongarch_elf64_vec) tb="$tb elf64-loongarch.lo elf64.lo elfxx-loongarch.lo elf32.lo elf-ifunc.lo $elf"; target_size=64 ;;
m32c_elf32_vec) tb="$tb elf32-m32c.lo elf32.lo $elf" ;;
m32r_elf32_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
m32r_elf32_le_vec) tb="$tb elf32-m32r.lo elf32.lo $elf" ;;
@@ -586,7 +576,6 @@ do
pef_xlib_vec) tb="$tb pef.lo" ;;
pj_elf32_vec) tb="$tb elf32-pj.lo elf32.lo $elf" ;;
pj_elf32_le_vec) tb="$tb elf32-pj.lo elf32.lo $elf" ;;
plugin_vec) tb="$tb plugin.lo" ;;
powerpc_boot_vec) tb="$tb ppcboot.lo" ;;
powerpc_elf32_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
powerpc_elf32_le_vec) tb="$tb elf32-ppc.lo elf-vxworks.lo elf32.lo $elf" ;;
@@ -595,14 +584,13 @@ do
powerpc_elf64_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf"; target_size=64 ;;
powerpc_elf64_le_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;;
powerpc_elf64_fbsd_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;;
powerpc_pe_vec) tb="$tb pe-ppc.lo peigen.lo $coff" ;;
powerpc_pe_le_vec) tb="$tb pe-ppc.lo peigen.lo $coff" ;;
powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo $coff" ;;
powerpc_pei_le_vec) tb="$tb pei-ppc.lo peigen.lo $coff" ;;
powerpc_elf64_fbsd_le_vec) tb="$tb elf64-ppc.lo elf64-gen.lo elf64.lo $elf" target_size=64 ;;
powerpc_xcoff_vec) tb="$tb coff-rs6000.lo $xcoff" ;;
pru_elf32_vec) tb="$tb elf32-pru.lo elf32.lo $elf" ;;
riscv_elf32_vec) tb="$tb elf32-riscv.lo elfxx-riscv.lo elf32.lo $elf" ;;
riscv_elf64_vec) tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.lo elf32.lo $elf"; target_size=64 ;;
riscv_elf32_vec) tb="$tb elf32-riscv.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf" ;;
riscv_elf64_vec) tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf"; target_size=64 ;;
riscv_elf32_be_vec) tb="$tb elf32-riscv.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf" ;;
riscv_elf64_be_vec) tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf"; target_size=64 ;;
rl78_elf32_vec) tb="$tb elf32-rl78.lo elf32.lo $elf" ;;
rs6000_xcoff64_vec) tb="$tb coff64-rs6000.lo aix5ppc-core.lo $xcoff"; target_size=64 ;;
rs6000_xcoff64_aix_vec) tb="$tb coff64-rs6000.lo aix5ppc-core.lo $xcoff"; target_size=64 ;;
@@ -610,10 +598,11 @@ do
rx_elf32_be_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
rx_elf32_be_ns_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
rx_elf32_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
rx_elf32_linux_le_vec) tb="$tb elf32-rx.lo elf32.lo $elf" ;;
s390_elf32_vec) tb="$tb elf32-s390.lo elf32.lo $elf" ;;
s390_elf64_vec) tb="$tb elf64-s390.lo elf64.lo $elf"; target_size=64 ;;
score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo $elf"; want64=true; target_size=64 ;;
score_elf32_be_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
score_elf32_le_vec) tb="$tb elf32-score.lo elf32-score7.lo elf32.lo elf64.lo $elf"; want64=true; target_size=64 ;;
sh_coff_vec) tb="$tb coff-sh.lo $coff" ;;
sh_coff_le_vec) tb="$tb coff-sh.lo $coff" ;;
sh_coff_small_vec) tb="$tb coff-sh.lo $coff" ;;
@@ -638,7 +627,6 @@ do
sparc_elf64_sol2_vec) tb="$tb elf64-sparc.lo elfxx-sparc.lo elf-vxworks.lo elf64.lo $elf"; target_size=64 ;;
spu_elf32_vec) tb="$tb elf32-spu.lo elf32.lo $elf" ;;
sym_vec) tb="$tb xsym.lo" ;;
tic30_aout_vec) tb="$tb aout-tic30.lo" ;;
tic30_coff_vec) tb="$tb coff-tic30.lo $coffgen" ;;
tic4x_coff0_vec) tb="$tb coff-tic4x.lo $coffgen" ;;
tic4x_coff0_beh_vec) tb="$tb coff-tic4x.lo $coffgen" ;;
@@ -658,7 +646,6 @@ do
tic6x_elf32_c6000_le_vec) tb="$tb elf32-tic6x.lo elf32.lo $elf" ;;
tic6x_elf32_linux_be_vec) tb="$tb elf32-tic6x.lo elf32.lo $elf" ;;
tic6x_elf32_linux_le_vec) tb="$tb elf32-tic6x.lo elf32.lo $elf" ;;
tic80_coff_vec) tb="$tb coff-tic80.lo $coff" ;;
tilegx_elf32_be_vec) tb="$tb elf32-tilegx.lo elfxx-tilegx.lo elf32.lo $elf" ; target_size=32 ;;
tilegx_elf32_le_vec) tb="$tb elf32-tilegx.lo elfxx-tilegx.lo elf32.lo $elf" ; target_size=32 ;;
tilegx_elf64_be_vec) tb="$tb elf64-tilegx.lo elfxx-tilegx.lo elf64.lo $elf" ; target_size=64 ;;
@@ -674,23 +661,21 @@ do
wasm_vec) tb="$tb wasm-module.lo" ;;
wasm32_elf32_vec) tb="$tb elf32-wasm32.lo elf32.lo $elf" ;;
x86_64_coff_vec) tb="$tb coff-x86_64.lo $coff"; target_size=64 ;;
x86_64_elf32_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo elf32.lo $elf"; target_size=64 ;;
x86_64_elf32_nacl_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo elf32.lo $elf"; target_size=64 ;;
x86_64_elf64_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_cloudabi_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_nacl_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_sol2_vec) tb="$tb elf64-x86-64.lo elfxx-x86.lo elf-ifunc.lo elf-nacl.lo elf64.lo $elf"; target_size=64 ;;
x86_64_elf32_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo elf32.lo $elf"; target_size=64 ;;
x86_64_elf64_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_cloudabi_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_fbsd_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
x86_64_elf64_sol2_vec) tb="$tb elf64-x86-64.lo $elfxx_x86 elf64.lo $elf"; target_size=64 ;;
x86_64_mach_o_vec) tb="$tb mach-o-x86-64.lo" ;;
x86_64_pe_vec) tb="$tb pe-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
x86_64_pe_be_vec) tb="$tb pe-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
x86_64_pe_big_vec) tb="$tb pe-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
x86_64_pei_vec) tb="$tb pei-x86_64.lo pex64igen.lo $coff"; target_size=64 ;;
xc16x_elf32_vec) tb="$tb elf32-xc16x.lo elf32.lo $elf" ;;
xgate_elf32_vec) tb="$tb elf32-xgate.lo elf32.lo $elf" ;;
xstormy16_elf32_vec) tb="$tb elf32-xstormy16.lo elf32.lo $elf" ;;
xtensa_elf32_be_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
xtensa_elf32_le_vec) tb="$tb xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
z80_coff_vec) tb="$tb coff-z80.lo reloc16.lo $coffgen" ;;
z80_elf32_vec) tb="$tb elf32-z80.lo elf32.lo $elf" ;;
z8k_coff_vec) tb="$tb coff-z8k.lo reloc16.lo $coff" ;;
# These appear out of order in targets.c
@@ -712,6 +697,10 @@ do
fi
done
if test "$plugins" = "yes"; then
tb="$tb plugin.lo"
fi
# Target architecture .o files.
# A couple of CPUs use shorter file names to avoid problems on DOS
# filesystems.
@@ -771,10 +760,6 @@ case ${host64}-${target64}-${want64} in
wordsize=64
bfd64_libs='$(BFD64_LIBS)'
all_backends='$(BFD64_BACKENDS) $(BFD32_BACKENDS)'
if test $BFD_HOST_64_BIT_DEFINED = 0; then
AC_MSG_WARN([You have requested a 64 bit BFD configuration, but])
AC_MSG_WARN([your compiler may not have a 64 bit integral type])
fi
if test -n "$GCC" ; then
bad_64bit_gcc=no;
AC_MSG_CHECKING([for gcc version with buggy 64-bit support])
@@ -831,7 +816,7 @@ if test "${target}" = "${host}"; then
;;
arm-*-freebsd* | arm-*-kfreebsd*-gnu)
COREFILE='' ;;
arm-*-netbsd* | arm-*-openbsd*)
arm*-*-netbsd* | arm-*-openbsd*)
COREFILE=netbsd-core.lo
;;
arm-*-riscix) COREFILE=trad-core.lo ;;
@@ -916,7 +901,7 @@ changequote(,)dnl
i[3-7]86-*-isc*) COREFILE=trad-core.lo ;;
i[3-7]86-*-aix*) COREFILE=aix386-core.lo ;;
changequote([,])dnl
mips-*-netbsd* | mips*-*-openbsd*)
mips*-*-netbsd* | mips*-*-openbsd*)
COREFILE=netbsd-core.lo
;;
mips-sgi-irix4*) COREFILE=irix-core.lo ;;
@@ -1017,7 +1002,7 @@ changequote([,])dnl
# ELF corefile support has several flavors, but all of
# them use something called <sys/procfs.h>
AC_CHECK_HEADERS(sys/procfs.h)
BFD_SYS_PROCFS_H
if test "$ac_cv_header_sys_procfs_h" = yes; then
BFD_HAVE_SYS_PROCFS_TYPE(prstatus_t)
BFD_HAVE_SYS_PROCFS_TYPE(prstatus32_t)
@@ -1067,6 +1052,7 @@ AC_SUBST(lt_cv_dlopen_libs)
# Hopefully a reasonable assumption since fseeko et.al. should be
# upward compatible.
AC_CHECK_FUNCS(ftello ftello64 fseeko fseeko64 fopen64)
AC_CHECK_DECLS([ftello, ftello64, fseeko, fseeko64, fopen64])
if test x"$ac_cv_func_ftello" = xyes -a x"$ac_cv_func_fseeko" = xyes; then
AC_CHECK_SIZEOF(off_t)
fi
@@ -1075,22 +1061,20 @@ bfd_file_ptr="long"
bfd_ufile_ptr="unsigned long"
if test x"$ac_cv_func_ftello64" = xyes -a x"$ac_cv_func_fseeko64" = xyes \
-o x"${ac_cv_sizeof_off_t}" = x8; then
bfd_file_ptr=BFD_HOST_64_BIT
bfd_ufile_ptr=BFD_HOST_U_64_BIT
bfd_file_ptr=int64_t
bfd_ufile_ptr=uint64_t
fi
AC_MSG_RESULT($bfd_file_ptr)
AC_SUBST(bfd_file_ptr)
AC_SUBST(bfd_ufile_ptr)
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, 1, [Use mmap if it's available?]) ;;
esac
rm -f doc/config.status
AC_CONFIG_FILES([Makefile doc/Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in])
AC_CONFIG_FILES([Makefile bfd-in3.h:bfd-in2.h po/Makefile.in:po/Make-in])
dnl We need this duplication, even though we use AM_PO_SUBDIRS, because of
dnl our two separate POTFILES. Yuck.
@@ -1121,3 +1105,5 @@ AC_SUBST(htmldir)
AC_SUBST(pdfdir)
AC_OUTPUT
GNU_MAKE_JOBSERVER
+31 -70
View File
@@ -7,7 +7,7 @@ $!
$! Written by Klaus K"ampf (kkaempf@rmi.de)
$! Rewritten by Tristan Gingold (gingold@adacore.com)
$!
$! Copyright (C) 2012-2018 Free Software Foundation, Inc.
$! Copyright (C) 2012-2022 Free Software Foundation, Inc.
$!
$! This file is free software; you can redistribute it and/or modify
$! it under the terms of the GNU General Public License as published by
@@ -60,47 +60,11 @@ $DECK
ERASE(match_pos);
COPY_TEXT('64');
ENDIF;
match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang);
match_pos := SEARCH_QUIETLY('@BFD_INT64_FMT@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('0');
ENDIF;
match_pos := SEARCH_QUIETLY('@BFD_HOST_LONG_LONG@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('1');
ENDIF;
match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG_LONG@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('1');
ENDIF;
match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('1');
ENDIF;
match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('__int64');
ENDIF;
match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('unsigned __int64');
ENDIF;
match_pos := SEARCH_QUIETLY('@BFD_HOSTPTR_T@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('unsigned __int64');
COPY_TEXT('"l"');
ENDIF;
match_pos := SEARCH_QUIETLY('@bfd_file_ptr@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
@@ -108,11 +72,11 @@ $DECK
ERASE(match_pos);
COPY_TEXT('bfd_signed_vma');
ENDIF;
match_pos := SEARCH_QUIETLY('unsigned @bfd_file_ptr@ ufile_ptr', FORWARD, EXACT, rang);
match_pos := SEARCH_QUIETLY('@bfd_ufile_ptr@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('bfd_vma ufile_ptr');
COPY_TEXT('bfd_vma');
ENDIF;
match_pos := SEARCH_QUIETLY('@supports_plugins@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
@@ -150,32 +114,36 @@ $DECK
ERASE(match_pos);
COPY_TEXT('32');
ENDIF;
match_pos := SEARCH_QUIETLY('@BFD_HOST_64BIT_LONG@', FORWARD, EXACT, rang);
match_pos := SEARCH_QUIETLY('@bfd_default_target_size@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('32');
ENDIF;
match_pos := SEARCH_QUIETLY('@BFD_INT64_FMT@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('"ll"');
ENDIF;
match_pos := SEARCH_QUIETLY('@bfd_file_ptr@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('bfd_signed_vma');
ENDIF;
match_pos := SEARCH_QUIETLY('@bfd_ufile_ptr@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('bfd_vma');
ENDIF;
match_pos := SEARCH_QUIETLY('@supports_plugins@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('0');
ENDIF;
match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT_DEFINED@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('__DECC');
SPLIT_LINE;
COPY_TEXT('#include <ints.h>');
ENDIF;
match_pos := SEARCH_QUIETLY('@BFD_HOST_64_BIT@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('int64');
ENDIF;
match_pos := SEARCH_QUIETLY('@BFD_HOST_U_64_BIT@', FORWARD, EXACT, rang);
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('uint64');
ENDIF;
WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
QUIT
$ EOD
@@ -232,20 +200,13 @@ $DECK
IF match_pos <> 0 THEN;
POSITION(BEGINNING_OF(match_pos));
ERASE(match_pos);
COPY_TEXT('"<http://www.sourceware.org/bugzilla/>"');
COPY_TEXT('"<https://www.sourceware.org/bugzilla/>"');
ENDIF;
WRITE_FILE(file, GET_INFO(COMMAND_LINE, "output_file"));
QUIT
$ EOD
$!
$!
$! create bfd_stdint.h
$!
$ write sys$output "Generate `bfd_stdint.h'"
$ create []bfd_stdint.h
#include <inttypes.h>
$!
$!
$! create targmatch.h
$!
$ write sys$output "Generate `targmatch.h'"
+1 -1
View File
@@ -1,5 +1,5 @@
#
# Copyright (C) 2012-2018 Free Software Foundation, Inc.
# Copyright (C) 2012-2022 Free Software Foundation, Inc.
#
# This file is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
+13 -13
View File
@@ -1,5 +1,5 @@
/* Core file generic interface routines for BFD.
Copyright (C) 1990-2018 Free Software Foundation, Inc.
Copyright (C) 1990-2022 Free Software Foundation, Inc.
Written by Cygnus Support.
This file is part of BFD, the Binary File Descriptor library.
@@ -111,7 +111,7 @@ FUNCTION
core_file_matches_executable_p
SYNOPSIS
bfd_boolean core_file_matches_executable_p
bool core_file_matches_executable_p
(bfd *core_bfd, bfd *exec_bfd);
DESCRIPTION
@@ -120,13 +120,13 @@ DESCRIPTION
@var{exec_bfd}, <<FALSE>> otherwise.
*/
bfd_boolean
bool
core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
{
if (core_bfd->format != bfd_core || exec_bfd->format != bfd_object)
{
bfd_set_error (bfd_error_wrong_format);
return FALSE;
return false;
}
return BFD_SEND (core_bfd, _core_file_matches_executable_p,
@@ -138,7 +138,7 @@ FUNCTION
generic_core_file_matches_executable_p
SYNOPSIS
bfd_boolean generic_core_file_matches_executable_p
bool generic_core_file_matches_executable_p
(bfd *core_bfd, bfd *exec_bfd);
DESCRIPTION
@@ -154,28 +154,28 @@ DESCRIPTION
where we really don't know whether they match or not.
*/
bfd_boolean
bool
generic_core_file_matches_executable_p (bfd *core_bfd, bfd *exec_bfd)
{
char *exec;
char *core;
char *last_slash;
const char *exec;
const char *core;
const char *last_slash;
if (exec_bfd == NULL || core_bfd == NULL)
return TRUE;
return true;
/* The cast below is to avoid a compiler warning due to the assignment
of the const char * returned by bfd_core_file_failing_command to a
non-const char *. In this case, the assignement does not lead to
breaking the const, as we're only reading the string. */
core = (char *) bfd_core_file_failing_command (core_bfd);
core = bfd_core_file_failing_command (core_bfd);
if (core == NULL)
return TRUE;
return true;
exec = bfd_get_filename (exec_bfd);
if (exec == NULL)
return TRUE;
return true;
last_slash = strrchr (core, '/');
if (last_slash != NULL)
+21 -15
View File
@@ -1,5 +1,5 @@
/* BFD support for AArch64.
Copyright (C) 2009-2018 Free Software Foundation, Inc.
Copyright (C) 2009-2022 Free Software Foundation, Inc.
Contributed by ARM Ltd.
This file is part of BFD, the Binary File Descriptor library.
@@ -22,6 +22,7 @@
#include "bfd.h"
#include "libbfd.h"
#include "libiberty.h"
#include "cpu-aarch64.h"
/* This routine is provided two arch_infos and works out which Aarch64
machine which would be compatible with both and returns a pointer
@@ -68,20 +69,21 @@ static struct
}
processors[] =
{
/* These two are example CPUs supported in GCC, once we have real
CPUs they will be removed. */
{ bfd_mach_aarch64, "example-1" },
{ bfd_mach_aarch64, "example-2" }
{ bfd_mach_aarch64, "cortex-a34" },
{ bfd_mach_aarch64, "cortex-a65" },
{ bfd_mach_aarch64, "cortex-a65ae" },
{ bfd_mach_aarch64, "cortex-a76ae" },
{ bfd_mach_aarch64, "cortex-a77" }
};
static bfd_boolean
static bool
scan (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;
return true;
/* Next check for a processor name instead of an Architecture name. */
for (i = sizeof (processors) / sizeof (processors[0]); i--;)
@@ -91,37 +93,41 @@ scan (const struct bfd_arch_info *info, const char *string)
}
if (i != -1 && info->mach == processors[i].mach)
return TRUE;
return true;
/* Finally check for the default architecture. */
if (strcasecmp (string, "aarch64") == 0)
return info->the_default;
return FALSE;
return false;
}
#define N(NUMBER, PRINT, WORDSIZE, DEFAULT, NEXT) \
{ WORDSIZE, WORDSIZE, 8, bfd_arch_aarch64, NUMBER, \
"aarch64", PRINT, 4, DEFAULT, compatible, scan, \
bfd_arch_default_fill, NEXT }
bfd_arch_default_fill, NEXT, 0 }
static const bfd_arch_info_type bfd_aarch64_arch_v8_r =
N (bfd_mach_aarch64_8R, "aarch64:armv8-r", 64, false, NULL);
static const bfd_arch_info_type bfd_aarch64_arch_ilp32 =
N (bfd_mach_aarch64_ilp32, "aarch64:ilp32", 32, FALSE, NULL);
N (bfd_mach_aarch64_ilp32, "aarch64:ilp32", 32, false,
&bfd_aarch64_arch_v8_r);
const bfd_arch_info_type bfd_aarch64_arch =
N (0, "aarch64", 64, TRUE, &bfd_aarch64_arch_ilp32);
N (0, "aarch64", 64, true, &bfd_aarch64_arch_ilp32);
bfd_boolean
bool
bfd_is_aarch64_special_symbol_name (const char *name, int type)
{
if (!name || name[0] != '$')
return FALSE;
return false;
if (name[1] == 'x' || name[1] == 'd')
type &= BFD_AARCH64_SPECIAL_SYM_TYPE_MAP;
else if (name[1] == 'm' || name[1] == 'f' || name[1] == 'p')
type &= BFD_AARCH64_SPECIAL_SYM_TYPE_TAG;
else
return FALSE;
return false;
return (type != 0 && (name[2] == 0 || name[2] == '.'));
}
+25
View File
@@ -0,0 +1,25 @@
/* ELF AArch64 mapping symbol support
Copyright (C) 2019-2022 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 3 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; see the file COPYING3. If not,
see <http://www.gnu.org/licenses/>. */
#define BFD_AARCH64_SPECIAL_SYM_TYPE_MAP (1 << 0)
#define BFD_AARCH64_SPECIAL_SYM_TYPE_TAG (1 << 1)
#define BFD_AARCH64_SPECIAL_SYM_TYPE_OTHER (1 << 2)
#define BFD_AARCH64_SPECIAL_SYM_TYPE_ANY (~0)
extern bool bfd_is_aarch64_special_symbol_name
(const char * name, int type);
+10 -9
View File
@@ -1,5 +1,5 @@
/* BFD support for the Alpha architecture.
Copyright (C) 1992-2018 Free Software Foundation, Inc.
Copyright (C) 1992-2022 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -24,19 +24,20 @@
#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 */ \
BITS_WORD, /* Bits in a word. */ \
BITS_ADDR, /* Bits in an address. */ \
8, /* Bits in a byte. */ \
bfd_arch_alpha, \
NUMBER, \
"alpha", \
PRINT, \
3, \
3, /* Section alignment power. */ \
DEFAULT, \
bfd_default_compatible, \
bfd_default_scan, \
bfd_arch_default_fill, \
NEXT, \
0 /* Maximum offset of a reloc from the start of an insn. */ \
}
#define NN(index) (&arch_info_struct[index])
@@ -44,10 +45,10 @@
/* These exist only so that we can reasonably 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),
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 =
N (64, 64, 0, "alpha", TRUE, NN(0));
N (64, 64, 0, "alpha", true, NN(0));
+59
View File
@@ -0,0 +1,59 @@
/* BFD support for the AMDGCN GPU architecture.
Copyright (C) 2019-2022 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 3 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, see <http://www.gnu.org/licenses/>. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
#define N(MACHINE, PRINTABLE_NAME, DEFAULT, NEXT) \
{ \
32, /* 32 bits in a word */ \
64, /* 64 bits in an address */ \
8, /* 8 bits in a byte */ \
bfd_arch_amdgcn, \
MACHINE, \
"amdgcn", \
PRINTABLE_NAME, \
3, /* section align power */ \
DEFAULT, \
bfd_default_compatible, \
bfd_default_scan, \
bfd_arch_default_fill, \
NEXT, \
0 \
}
#define NN(index) (&arch_info_struct[index])
static const bfd_arch_info_type arch_info_struct[] =
{
N (bfd_mach_amdgcn_gfx904, "amdgcn:gfx904", false, NN (1)),
N (bfd_mach_amdgcn_gfx906, "amdgcn:gfx906", false, NN (2)),
N (bfd_mach_amdgcn_gfx908, "amdgcn:gfx908", false, NN (3)),
N (bfd_mach_amdgcn_gfx90a, "amdgcn:gfx90a", false, NN (4)),
N (bfd_mach_amdgcn_gfx1010, "amdgcn:gfx1010", false, NN (5)),
N (bfd_mach_amdgcn_gfx1011, "amdgcn:gfx1011", false, NN (6)),
N (bfd_mach_amdgcn_gfx1012, "amdgcn:gfx1012", false, NN (7)),
N (bfd_mach_amdgcn_gfx1030, "amdgcn:gfx1030", false, NN (8)),
N (bfd_mach_amdgcn_gfx1031, "amdgcn:gfx1031", false, NN (9)),
N (bfd_mach_amdgcn_gfx1032, "amdgcn:gfx1032", false, NULL)
};
const bfd_arch_info_type bfd_amdgcn_arch =
N (bfd_mach_amdgcn_gfx900, "amdgcn:gfx900", true, NN (0));
+15 -14
View File
@@ -1,5 +1,5 @@
/* BFD support for the ARC processor
Copyright (C) 1994-2018 Free Software Foundation, Inc.
Copyright (C) 1994-2022 Free Software Foundation, Inc.
Contributed by Doug Evans (dje@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -27,35 +27,36 @@ static const bfd_arch_info_type *
arc_compatible (const bfd_arch_info_type *a, const bfd_arch_info_type *b);
#define ARC(mach, print_name, default_p, next) \
{ \
32, /* 32 bits in a word */ \
32, /* 32 bits in an address */ \
8, /* 8 bits in a byte */ \
{ \
32, /* Bits in a word. */ \
32, /* Bits in an address. */ \
8, /* Bits in a byte. */ \
bfd_arch_arc, \
mach, \
"arc", \
print_name, \
4, /* section alignment power */ \
4, /* Section alignment power. */ \
default_p, \
arc_compatible, \
bfd_default_scan, \
bfd_arch_default_fill, \
next, \
0 /* Maximum offset of a reloc from the start of an insn. */ \
}
static const bfd_arch_info_type arch_info_struct[] =
{
ARC (bfd_mach_arc_arc600, "A6" , FALSE, &arch_info_struct[1]),
ARC (bfd_mach_arc_arc601, "ARC601", FALSE, &arch_info_struct[2]),
ARC (bfd_mach_arc_arc700, "ARC700", FALSE, &arch_info_struct[3]),
ARC (bfd_mach_arc_arc700, "A7", FALSE, &arch_info_struct[4]),
ARC (bfd_mach_arc_arcv2, "ARCv2", FALSE, &arch_info_struct[5]),
ARC (bfd_mach_arc_arcv2, "EM", FALSE, &arch_info_struct[6]),
ARC (bfd_mach_arc_arcv2, "HS", FALSE, NULL),
ARC (bfd_mach_arc_arc600, "A6" , false, &arch_info_struct[1]),
ARC (bfd_mach_arc_arc601, "ARC601", false, &arch_info_struct[2]),
ARC (bfd_mach_arc_arc700, "ARC700", false, &arch_info_struct[3]),
ARC (bfd_mach_arc_arc700, "A7", false, &arch_info_struct[4]),
ARC (bfd_mach_arc_arcv2, "ARCv2", false, &arch_info_struct[5]),
ARC (bfd_mach_arc_arcv2, "EM", false, &arch_info_struct[6]),
ARC (bfd_mach_arc_arcv2, "HS", false, NULL),
};
const bfd_arch_info_type bfd_arc_arch =
ARC (bfd_mach_arc_arc600, "ARC600", TRUE, &arch_info_struct[0]);
ARC (bfd_mach_arc_arc600, "ARC600", true, &arch_info_struct[0]);
/* ARC-specific "compatible" function. The general rule is that if A and B are
compatible, then this function should return architecture that is more
+200 -79
View File
@@ -1,5 +1,5 @@
/* BFD support for the ARM processor
Copyright (C) 1994-2018 Free Software Foundation, Inc.
Copyright (C) 1994-2022 Free Software Foundation, Inc.
Contributed by Richard Earnshaw (rwe@pegasus.esprit.ec.org)
This file is part of BFD, the Binary File Descriptor library.
@@ -23,6 +23,7 @@
#include "bfd.h"
#include "libbfd.h"
#include "libiberty.h"
#include "cpu-arm.h"
/* This routine is provided two arch_infos and works out which ARM
machine which would be compatible with both and returns a pointer
@@ -65,46 +66,148 @@ static struct
}
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" },
{ bfd_mach_arm_XScale, "xscale" },
{ bfd_mach_arm_ep9312, "ep9312" },
{ bfd_mach_arm_iWMMXt, "iwmmxt" },
{ bfd_mach_arm_iWMMXt2, "iwmmxt2" },
{ bfd_mach_arm_unknown, "arm_any" }
{ 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, "arm620" },
{ bfd_mach_arm_3, "arm7" },
{ bfd_mach_arm_3, "arm70" },
{ bfd_mach_arm_3, "arm700" },
{ bfd_mach_arm_3, "arm700i" },
{ bfd_mach_arm_3, "arm710" },
{ bfd_mach_arm_3, "arm7100" },
{ bfd_mach_arm_3, "arm710c" },
{ bfd_mach_arm_4T, "arm710t" },
{ bfd_mach_arm_3, "arm720" },
{ bfd_mach_arm_4T, "arm720t" },
{ bfd_mach_arm_4T, "arm740t" },
{ bfd_mach_arm_3, "arm7500" },
{ bfd_mach_arm_3, "arm7500fe" },
{ bfd_mach_arm_3, "arm7d" },
{ bfd_mach_arm_3, "arm7di" },
{ bfd_mach_arm_3M, "arm7dm" },
{ bfd_mach_arm_3M, "arm7dmi" },
{ bfd_mach_arm_4T, "arm7t" },
{ bfd_mach_arm_4T, "arm7tdmi" },
{ bfd_mach_arm_4T, "arm7tdmi-s" },
{ bfd_mach_arm_3M, "arm7m" },
{ bfd_mach_arm_4, "arm8" },
{ bfd_mach_arm_4, "arm810" },
{ bfd_mach_arm_4, "arm9" },
{ bfd_mach_arm_4T, "arm920" },
{ bfd_mach_arm_4T, "arm920t" },
{ bfd_mach_arm_4T, "arm922t" },
{ bfd_mach_arm_5TEJ, "arm926ej" },
{ bfd_mach_arm_5TEJ, "arm926ejs" },
{ bfd_mach_arm_5TEJ, "arm926ej-s" },
{ bfd_mach_arm_4T, "arm940t" },
{ bfd_mach_arm_5TE, "arm946e" },
{ bfd_mach_arm_5TE, "arm946e-r0" },
{ bfd_mach_arm_5TE, "arm946e-s" },
{ bfd_mach_arm_5TE, "arm966e" },
{ bfd_mach_arm_5TE, "arm966e-r0" },
{ bfd_mach_arm_5TE, "arm966e-s" },
{ bfd_mach_arm_5TE, "arm968e-s" },
{ bfd_mach_arm_5TE, "arm9e" },
{ bfd_mach_arm_5TE, "arm9e-r0" },
{ bfd_mach_arm_4T, "arm9tdmi" },
{ bfd_mach_arm_5TE, "arm1020" },
{ bfd_mach_arm_5T, "arm1020t" },
{ bfd_mach_arm_5TE, "arm1020e" },
{ bfd_mach_arm_5TE, "arm1022e" },
{ bfd_mach_arm_5TEJ, "arm1026ejs" },
{ bfd_mach_arm_5TEJ, "arm1026ej-s" },
{ bfd_mach_arm_5TE, "arm10e" },
{ bfd_mach_arm_5T, "arm10t" },
{ bfd_mach_arm_5T, "arm10tdmi" },
{ bfd_mach_arm_6, "arm1136j-s" },
{ bfd_mach_arm_6, "arm1136js" },
{ bfd_mach_arm_6, "arm1136jf-s" },
{ bfd_mach_arm_6, "arm1136jfs" },
{ bfd_mach_arm_6KZ, "arm1176jz-s" },
{ bfd_mach_arm_6KZ, "arm1176jzf-s" },
{ bfd_mach_arm_6T2, "arm1156t2-s" },
{ bfd_mach_arm_6T2, "arm1156t2f-s" },
{ bfd_mach_arm_7, "cortex-a5" },
{ bfd_mach_arm_7, "cortex-a7" },
{ bfd_mach_arm_7, "cortex-a8" },
{ bfd_mach_arm_7, "cortex-a9" },
{ bfd_mach_arm_7, "cortex-a12" },
{ bfd_mach_arm_7, "cortex-a15" },
{ bfd_mach_arm_7, "cortex-a17" },
{ bfd_mach_arm_8, "cortex-a32" },
{ bfd_mach_arm_8, "cortex-a35" },
{ bfd_mach_arm_8, "cortex-a53" },
{ bfd_mach_arm_8, "cortex-a55" },
{ bfd_mach_arm_8, "cortex-a57" },
{ bfd_mach_arm_8, "cortex-a72" },
{ bfd_mach_arm_8, "cortex-a73" },
{ bfd_mach_arm_8, "cortex-a75" },
{ bfd_mach_arm_8, "cortex-a76" },
{ bfd_mach_arm_8, "cortex-a76ae" },
{ bfd_mach_arm_8, "cortex-a77" },
{ bfd_mach_arm_8, "cortex-a78" },
{ bfd_mach_arm_8, "cortex-a78ae" },
{ bfd_mach_arm_8, "cortex-a78c" },
{ bfd_mach_arm_6SM, "cortex-m0" },
{ bfd_mach_arm_6SM, "cortex-m0plus" },
{ bfd_mach_arm_6SM, "cortex-m1" },
{ bfd_mach_arm_8M_BASE, "cortex-m23" },
{ bfd_mach_arm_7, "cortex-m3" },
{ bfd_mach_arm_8M_MAIN, "cortex-m33" },
{ bfd_mach_arm_8M_MAIN, "cortex-m35p" },
{ bfd_mach_arm_7EM, "cortex-m4" },
{ bfd_mach_arm_7EM, "cortex-m7" },
{ bfd_mach_arm_7, "cortex-r4" },
{ bfd_mach_arm_7, "cortex-r4f" },
{ bfd_mach_arm_7, "cortex-r5" },
{ bfd_mach_arm_8R, "cortex-r52" },
{ bfd_mach_arm_8R, "cortex-r52plus" },
{ bfd_mach_arm_7, "cortex-r7" },
{ bfd_mach_arm_7, "cortex-r8" },
{ bfd_mach_arm_8, "cortex-x1" },
{ bfd_mach_arm_4T, "ep9312" },
{ bfd_mach_arm_8, "exynos-m1" },
{ bfd_mach_arm_4, "fa526" },
{ bfd_mach_arm_5TE, "fa606te" },
{ bfd_mach_arm_5TE, "fa616te" },
{ bfd_mach_arm_4, "fa626" },
{ bfd_mach_arm_5TE, "fa626te" },
{ bfd_mach_arm_5TE, "fa726te" },
{ bfd_mach_arm_5TE, "fmp626" },
{ bfd_mach_arm_XScale, "i80200" },
{ bfd_mach_arm_7, "marvell-pj4" },
{ bfd_mach_arm_7, "marvell-whitney" },
{ bfd_mach_arm_6K, "mpcore" },
{ bfd_mach_arm_6K, "mpcorenovfp" },
{ bfd_mach_arm_4, "sa1" },
{ bfd_mach_arm_4, "strongarm" },
{ bfd_mach_arm_4, "strongarm1" },
{ bfd_mach_arm_4, "strongarm110" },
{ bfd_mach_arm_4, "strongarm1100" },
{ bfd_mach_arm_4, "strongarm1110" },
{ bfd_mach_arm_XScale, "xscale" },
{ bfd_mach_arm_8, "xgene1" },
{ bfd_mach_arm_8, "xgene2" },
{ bfd_mach_arm_9, "cortex-a710" },
{ bfd_mach_arm_ep9312, "ep9312" },
{ bfd_mach_arm_iWMMXt, "iwmmxt" },
{ bfd_mach_arm_iWMMXt2, "iwmmxt2" },
{ bfd_mach_arm_unknown, "arm_any" }
};
static bfd_boolean
static bool
scan (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;
return true;
/* Next check for a processor name instead of an Architecture name. */
for (i = sizeof (processors) / sizeof (processors[0]); i--;)
@@ -114,39 +217,54 @@ scan (const struct bfd_arch_info *info, const char *string)
}
if (i != -1 && info->mach == processors [i].mach)
return TRUE;
return true;
/* Finally check for the default architecture. */
if (strcasecmp (string, "arm") == 0)
return info->the_default;
return FALSE;
return false;
}
#define N(number, print, default, next) \
{ 32, 32, 8, bfd_arch_arm, number, "arm", print, 4, default, compatible, \
scan, bfd_arch_default_fill, next }
scan, bfd_arch_default_fill, next, 0 }
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, & arch_info_struct[8]),
N (bfd_mach_arm_5TE, "armv5te", FALSE, & arch_info_struct[9]),
N (bfd_mach_arm_XScale, "xscale", FALSE, & arch_info_struct[10]),
N (bfd_mach_arm_ep9312, "ep9312", FALSE, & arch_info_struct[11]),
N (bfd_mach_arm_iWMMXt, "iwmmxt", FALSE, & arch_info_struct[12]),
N (bfd_mach_arm_iWMMXt2, "iwmmxt2", FALSE, & arch_info_struct[13]),
N (bfd_mach_arm_unknown, "arm_any", FALSE, NULL)
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, & arch_info_struct[8]),
N (bfd_mach_arm_5TE, "armv5te", false, & arch_info_struct[9]),
N (bfd_mach_arm_XScale, "xscale", false, & arch_info_struct[10]),
N (bfd_mach_arm_ep9312, "ep9312", false, & arch_info_struct[11]),
N (bfd_mach_arm_iWMMXt, "iwmmxt", false, & arch_info_struct[12]),
N (bfd_mach_arm_iWMMXt2, "iwmmxt2", false, & arch_info_struct[13]),
N (bfd_mach_arm_5TEJ, "armv5tej", false, & arch_info_struct[14]),
N (bfd_mach_arm_6, "armv6", false, & arch_info_struct[15]),
N (bfd_mach_arm_6KZ, "armv6kz", false, & arch_info_struct[16]),
N (bfd_mach_arm_6T2, "armv6t2", false, & arch_info_struct[17]),
N (bfd_mach_arm_6K, "armv6k", false, & arch_info_struct[18]),
N (bfd_mach_arm_7, "armv7", false, & arch_info_struct[19]),
N (bfd_mach_arm_6M, "armv6-m", false, & arch_info_struct[20]),
N (bfd_mach_arm_6SM, "armv6s-m", false, & arch_info_struct[21]),
N (bfd_mach_arm_7EM, "armv7e-m", false, & arch_info_struct[22]),
N (bfd_mach_arm_8, "armv8-a", false, & arch_info_struct[23]),
N (bfd_mach_arm_8R, "armv8-r", false, & arch_info_struct[24]),
N (bfd_mach_arm_8M_BASE, "armv8-m.base", false, & arch_info_struct[25]),
N (bfd_mach_arm_8M_MAIN, "armv8-m.main", false, & arch_info_struct[26]),
N (bfd_mach_arm_8_1M_MAIN, "armv8.1-m.main", false, & arch_info_struct[27]),
N (bfd_mach_arm_9, "armv9-a", false, & arch_info_struct[28]),
N (bfd_mach_arm_unknown, "arm_any", false, NULL)
};
const bfd_arch_info_type bfd_arm_arch =
N (0, "arm", TRUE, & arch_info_struct[0]);
N (0, "arm", true, & arch_info_struct[0]);
/* Support functions used by both the COFF and ELF versions of the ARM port. */
@@ -155,7 +273,7 @@ const bfd_arch_info_type bfd_arm_arch =
different possible ARM architecture variants.
Returns TRUE if they were merged successfully or FALSE otherwise. */
bfd_boolean
bool
bfd_arm_merge_machines (bfd *ibfd, bfd *obfd)
{
unsigned int in = bfd_get_mach (ibfd);
@@ -189,11 +307,11 @@ bfd_arm_merge_machines (bfd *ibfd, bfd *obfd)
|| out == bfd_mach_arm_iWMMXt2))
{
/* xgettext: c-format */
_bfd_error_handler (_("\
error: %pB is compiled for the EP9312, whereas %pB is compiled for XScale"),
_bfd_error_handler (_("error: %pB is compiled for the EP9312, "
"whereas %pB is compiled for XScale"),
ibfd, obfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;
return false;
}
else if (out == bfd_mach_arm_ep9312
&& (in == bfd_mach_arm_XScale
@@ -201,18 +319,18 @@ error: %pB is compiled for the EP9312, whereas %pB is compiled for XScale"),
|| in == bfd_mach_arm_iWMMXt2))
{
/* xgettext: c-format */
_bfd_error_handler (_("\
error: %pB is compiled for the EP9312, whereas %pB is compiled for XScale"),
_bfd_error_handler (_("error: %pB is compiled for the EP9312, "
"whereas %pB is compiled for XScale"),
obfd, ibfd);
bfd_set_error (bfd_error_wrong_format);
return FALSE;
return false;
}
else if (in > out)
bfd_set_arch_mach (obfd, bfd_arch_arm, in);
/* else
Nothing to do. */
return TRUE;
return true;
}
typedef struct
@@ -223,7 +341,7 @@ typedef struct
char name[1]; /* Start of the name+desc data. */
} arm_Note;
static bfd_boolean
static bool
arm_check_note (bfd *abfd,
bfd_byte *buffer,
bfd_size_type buffer_size,
@@ -236,7 +354,7 @@ arm_check_note (bfd *abfd,
char * descr;
if (buffer_size < offsetof (arm_Note, name))
return FALSE;
return false;
/* We have to extract the values this way to allow for a
host whose endian-ness is different from the target. */
@@ -247,20 +365,20 @@ arm_check_note (bfd *abfd,
/* Check for buffer overflow. */
if (namesz + descsz + offsetof (arm_Note, name) > buffer_size)
return FALSE;
return false;
if (expected_name == NULL)
{
if (namesz != 0)
return FALSE;
return false;
}
else
{
if (namesz != ((strlen (expected_name) + 1 + 3) & ~3))
return FALSE;
return false;
if (strcmp (descr, expected_name) != 0)
return FALSE;
return false;
descr += (namesz + 3) & ~3;
}
@@ -271,12 +389,12 @@ arm_check_note (bfd *abfd,
if (description_return != NULL)
* description_return = descr;
return TRUE;
return true;
}
#define NOTE_ARCH_STRING "arch: "
bfd_boolean
bool
bfd_arm_update_notes (bfd *abfd, const char *note_section)
{
asection * arm_arch_section;
@@ -291,11 +409,11 @@ bfd_arm_update_notes (bfd *abfd, const char *note_section)
arm_arch_section = bfd_get_section_by_name (abfd, note_section);
if (arm_arch_section == NULL)
return TRUE;
return true;
buffer_size = arm_arch_section->size;
if (buffer_size == 0)
return FALSE;
return false;
if (!bfd_malloc_and_get_section (abfd, arm_arch_section, &buffer))
goto FAIL;
@@ -304,7 +422,9 @@ bfd_arm_update_notes (bfd *abfd, const char *note_section)
if (! arm_check_note (abfd, buffer, buffer_size, NOTE_ARCH_STRING, & arch_string))
goto FAIL;
/* Check the architecture in the note against the architecture of the bfd. */
/* Check the architecture in the note against the architecture of the bfd.
Newer architectures versions should not be added here as build attribute
are a better mechanism to convey ISA used. */
switch (bfd_get_mach (abfd))
{
default:
@@ -342,12 +462,11 @@ bfd_arm_update_notes (bfd *abfd, const char *note_section)
}
free (buffer);
return TRUE;
return true;
FAIL:
if (buffer != NULL)
free (buffer);
return FALSE;
free (buffer);
return false;
}
@@ -356,6 +475,9 @@ static struct
const char * string;
unsigned int mach;
}
/* Newer architectures versions should not be added here as build attribute are
a better mechanism to convey ISA used. */
architectures[] =
{
{ "armv2", bfd_mach_arm_2 },
@@ -412,19 +534,18 @@ bfd_arm_get_mach_from_notes (bfd *abfd, const char *note_section)
}
FAIL:
if (buffer != NULL)
free (buffer);
free (buffer);
return bfd_mach_arm_unknown;
}
bfd_boolean
bool
bfd_is_arm_special_symbol_name (const char * name, int type)
{
/* The ARM compiler outputs several obsolete forms. Recognize them
in addition to the standard $a, $t and $d. We are somewhat loose
in what we accept here, since the full set is not documented. */
if (!name || name[0] != '$')
return FALSE;
return false;
if (name[1] == 'a' || name[1] == 't' || name[1] == 'd')
type &= BFD_ARM_SPECIAL_SYM_TYPE_MAP;
else if (name[1] == 'm' || name[1] == 'f' || name[1] == 'p')
@@ -432,7 +553,7 @@ bfd_is_arm_special_symbol_name (const char * name, int type)
else if (name[1] >= 'a' && name[1] <= 'z')
type &= BFD_ARM_SPECIAL_SYM_TYPE_OTHER;
else
return FALSE;
return false;
return (type != 0 && (name[2] == 0 || name[2] == '.'));
}
+39
View File
@@ -0,0 +1,39 @@
/* BFD support for the ARM processor
Copyright (C) 2019-2022 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
/* ARM Note section processing. */
extern bool bfd_arm_merge_machines
(bfd *, bfd *);
extern bool bfd_arm_update_notes
(bfd *, const char *);
extern unsigned int bfd_arm_get_mach_from_notes
(bfd *, const char *);
/* ELF ARM mapping symbol support. */
#define BFD_ARM_SPECIAL_SYM_TYPE_MAP (1 << 0)
#define BFD_ARM_SPECIAL_SYM_TYPE_TAG (1 << 1)
#define BFD_ARM_SPECIAL_SYM_TYPE_OTHER (1 << 2)
#define BFD_ARM_SPECIAL_SYM_TYPE_ANY (~0)
extern bool bfd_is_arm_special_symbol_name
(const char *, int);
+25 -24
View File
@@ -1,5 +1,5 @@
/* BFD library support routines for the AVR architecture.
Copyright (C) 1999-2018 Free Software Foundation, Inc.
Copyright (C) 1999-2022 Free Software Foundation, Inc.
Contributed by Denis Chertykov <denisc@overta.ru>
This file is part of BFD, the Binary File Descriptor library.
@@ -82,9 +82,9 @@ compatible (const bfd_arch_info_type * a,
#define N(addr_bits, machine, print, default, next) \
{ \
8, /* 8 bits in a word. */ \
addr_bits, /* bits in an address. */ \
8, /* 8 bits in a byte. */ \
8, /* Bits in a word. */ \
addr_bits, /* Bits in an address. */ \
8, /* Bits in a byte. */ \
bfd_arch_avr, \
machine, /* Machine number. */ \
"avr", /* Architecture name. */ \
@@ -94,70 +94,71 @@ compatible (const bfd_arch_info_type * a,
compatible, \
bfd_default_scan, \
bfd_arch_default_fill, \
next \
next, \
0 /* Maximum offset of a reloc from the start of an insn. */ \
}
static const bfd_arch_info_type arch_info_struct[] =
{
/* Assembler only. */
N (16, bfd_mach_avr1, "avr:1", FALSE, & arch_info_struct[1]),
N (16, bfd_mach_avr1, "avr:1", false, & arch_info_struct[1]),
/* Classic, <= 8K. */
N (16, bfd_mach_avr2, "avr:2", FALSE, & arch_info_struct[2]),
N (16, bfd_mach_avr2, "avr:2", false, & arch_info_struct[2]),
/* Classic + MOVW, <= 8K. */
N (16, bfd_mach_avr25, "avr:25", FALSE, & arch_info_struct[3]),
N (16, bfd_mach_avr25, "avr:25", false, & arch_info_struct[3]),
/* Classic, > 8K, <= 64K. */
/* TODO: addr_bits should be 16, but set to 22 for some following
version of GCC (from 4.3) for backward compatibility. */
N (22, bfd_mach_avr3, "avr:3", FALSE, & arch_info_struct[4]),
N (22, bfd_mach_avr3, "avr:3", false, & arch_info_struct[4]),
/* Classic, == 128K. */
N (22, bfd_mach_avr31, "avr:31", FALSE, & arch_info_struct[5]),
N (22, bfd_mach_avr31, "avr:31", false, & arch_info_struct[5]),
/* Classic + MOVW + JMP/CALL, > 8K, <= 64K. */
N (16, bfd_mach_avr35, "avr:35", FALSE, & arch_info_struct[6]),
N (16, bfd_mach_avr35, "avr:35", false, & arch_info_struct[6]),
/* Enhanced, <= 8K. */
N (16, bfd_mach_avr4, "avr:4", FALSE, & arch_info_struct[7]),
N (16, bfd_mach_avr4, "avr:4", false, & arch_info_struct[7]),
/* Enhanced, > 8K, <= 64K. */
/* TODO: addr_bits should be 16, but set to 22 for some following
version of GCC (from 4.3) for backward compatibility. */
N (22, bfd_mach_avr5, "avr:5", FALSE, & arch_info_struct[8]),
N (22, bfd_mach_avr5, "avr:5", false, & arch_info_struct[8]),
/* Enhanced, == 128K. */
N (22, bfd_mach_avr51, "avr:51", FALSE, & arch_info_struct[9]),
N (22, bfd_mach_avr51, "avr:51", false, & arch_info_struct[9]),
/* 3-Byte PC. */
N (22, bfd_mach_avr6, "avr:6", FALSE, & arch_info_struct[10]),
N (22, bfd_mach_avr6, "avr:6", false, & arch_info_struct[10]),
/* Tiny core (AVR Tiny). */
N (16, bfd_mach_avrtiny, "avr:100", FALSE, & arch_info_struct[11]),
N (16, bfd_mach_avrtiny, "avr:100", false, & arch_info_struct[11]),
/* Xmega 1. */
N (24, bfd_mach_avrxmega1, "avr:101", FALSE, & arch_info_struct[12]),
N (24, bfd_mach_avrxmega1, "avr:101", false, & arch_info_struct[12]),
/* Xmega 2. */
N (24, bfd_mach_avrxmega2, "avr:102", FALSE, & arch_info_struct[13]),
N (24, bfd_mach_avrxmega2, "avr:102", false, & arch_info_struct[13]),
/* Xmega 3. */
N (24, bfd_mach_avrxmega3, "avr:103", FALSE, & arch_info_struct[14]),
N (24, bfd_mach_avrxmega3, "avr:103", false, & arch_info_struct[14]),
/* Xmega 4. */
N (24, bfd_mach_avrxmega4, "avr:104", FALSE, & arch_info_struct[15]),
N (24, bfd_mach_avrxmega4, "avr:104", false, & arch_info_struct[15]),
/* Xmega 5. */
N (24, bfd_mach_avrxmega5, "avr:105", FALSE, & arch_info_struct[16]),
N (24, bfd_mach_avrxmega5, "avr:105", false, & arch_info_struct[16]),
/* Xmega 6. */
N (24, bfd_mach_avrxmega6, "avr:106", FALSE, & arch_info_struct[17]),
N (24, bfd_mach_avrxmega6, "avr:106", false, & arch_info_struct[17]),
/* Xmega 7. */
N (24, bfd_mach_avrxmega7, "avr:107", FALSE, NULL)
N (24, bfd_mach_avrxmega7, "avr:107", false, NULL)
};
const bfd_arch_info_type bfd_avr_arch =
N (16, bfd_mach_avr2, "avr", TRUE, & arch_info_struct[0]);
N (16, bfd_mach_avr2, "avr", true, & arch_info_struct[0]);
+4 -3
View File
@@ -1,6 +1,6 @@
/* BFD Support for the ADI Blackfin processor.
Copyright (C) 2005-2018 Free Software Foundation, Inc.
Copyright (C) 2005-2022 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -33,9 +33,10 @@ const bfd_arch_info_type bfd_bfin_arch =
"bfin", /* Arch name. */
"bfin", /* Arch printable name. */
4, /* Section align power. */
TRUE, /* The one and only. */
true, /* The one and only. */
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
0,
NULL,
0 /* Maximum offset of a reloc from the start of an insn. */
};
+62
View File
@@ -0,0 +1,62 @@
/* BFD support for the BPF processor.
Copyright (C) 2019-2022 Free Software Foundation, Inc.
Contributed by Oracle 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
static const bfd_arch_info_type bfd_xbpf_arch =
{
64, /* Bits per word. */
64, /* Bits per address. */
8, /* Bits per byte. */
bfd_arch_bpf, /* Architecture. */
bfd_mach_xbpf, /* Machine. */
"bpf", /* Architecture name. */
"xbpf", /* Machine name. */
3, /* Section align power. */
false, /* The default ? */
bfd_default_compatible, /* Architecture comparison fn. */
bfd_default_scan, /* String to architecture convert fn. */
bfd_arch_default_fill, /* Default fill. */
NULL, /* Next in list. */
0 /* Maximum offset of a reloc from the start of an insn. */
};
const bfd_arch_info_type bfd_bpf_arch =
{
64, /* Bits per word. */
64, /* Bits per address. */
8, /* Bits per byte. */
bfd_arch_bpf, /* Architecture. */
bfd_mach_bpf, /* Machine. */
"bpf", /* Architecture name. */
"bpf", /* Machine name. */
3, /* Section align power. */
true, /* The default ? */
bfd_default_compatible, /* Architecture comparison fn. */
bfd_default_scan, /* String to architecture convert fn. */
bfd_arch_default_fill, /* Default fill. */
&bfd_xbpf_arch, /* Next in list. */
0 /* Maximum offset of a reloc from the start of an insn. */
};
+17 -16
View File
@@ -1,5 +1,5 @@
/* BFD support for the CR16 processor.
Copyright (C) 2007-2018 Free Software Foundation, Inc.
Copyright (C) 2007-2022 Free Software Foundation, Inc.
Written by M R Swami Reddy
This file is part of BFD, the Binary File Descriptor library.
@@ -24,18 +24,19 @@
const bfd_arch_info_type bfd_cr16_arch =
{
16, /* 16 bits in a word. */
32, /* 32 bits in an address. */
8, /* 8 bits in a byte. */
bfd_arch_cr16, /* enum bfd_architecture arch. */
bfd_mach_cr16,
"cr16", /* Arch name. */
"cr16", /* Printable name. */
1, /* Unsigned int section alignment power. */
TRUE, /* The one and only. */
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
0,
};
{
16, /* Bits in a word. */
32, /* Bits in an address. */
8, /* Bits in a byte. */
bfd_arch_cr16, /* Architecture number. */
bfd_mach_cr16,
"cr16", /* Arch name. */
"cr16", /* Printable name. */
1, /* Section alignment power. */
true, /* The one and only. */
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
NULL,
0 /* Maximum offset of a reloc from the start of an insn. */
};
-40
View File
@@ -1,40 +0,0 @@
/* BFD support for the CR16C processor.
Copyright (C) 2004-2018 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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
const bfd_arch_info_type bfd_cr16c_arch =
{
16, /* 16 bits in a word. */
32, /* 32 bits in an address. */
8, /* 8 bits in a byte. */
bfd_arch_cr16c,
bfd_mach_cr16c,
"cr16c",
"cr16c",
1,
TRUE, /* The one and only. */
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
0,
};
+6 -5
View File
@@ -1,5 +1,5 @@
/* BFD support for the Axis CRIS architecture.
Copyright (C) 2000-2018 Free Software Foundation, Inc.
Copyright (C) 2000-2022 Free Software Foundation, Inc.
Contributed by Axis Communications AB.
Written by Hans-Peter Nilsson.
@@ -66,8 +66,8 @@ get_compatible (const bfd_arch_info_type *a,
}
#define N(NUMBER, PRINT, NEXT) \
{ 32, 32, 8, bfd_arch_cris, NUMBER, "cris", PRINT, 1, FALSE, \
get_compatible, bfd_default_scan, bfd_arch_default_fill, NEXT }
{ 32, 32, 8, bfd_arch_cris, NUMBER, "cris", PRINT, 1, false, \
get_compatible, bfd_default_scan, bfd_arch_default_fill, NEXT, 0 }
static const bfd_arch_info_type bfd_cris_arch_compat_v10_v32 =
N (bfd_mach_cris_v10_v32, "cris:common_v10_v32", NULL);
@@ -90,15 +90,16 @@ const bfd_arch_info_type bfd_cris_arch =
"cris", /* The printable name is the same. */
1, /* Section alignment power; each section
is aligned to (only) 2^1 bytes. */
TRUE, /* This is the default "machine". */
true, /* This is the default "machine". */
get_compatible, /* A function for testing
"machine" compatibility of two
bfd_arch_info_type. */
bfd_default_scan, /* Check if a bfd_arch_info_type is a
match. */
bfd_arch_default_fill, /* Default fill. */
&bfd_cris_arch_v32 /* Pointer to next bfd_arch_info_type in
&bfd_cris_arch_v32, /* Pointer to next bfd_arch_info_type in
the same family. */
0 /* Maximum offset of a reloc from the start of an insn. */
};
/*
+17 -16
View File
@@ -1,5 +1,5 @@
/* BFD support for the CRX processor.
Copyright (C) 2004-2018 Free Software Foundation, Inc.
Copyright (C) 2004-2022 Free Software Foundation, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -24,18 +24,19 @@
const bfd_arch_info_type bfd_crx_arch =
{
16, /* 16 bits in a word. */
32, /* 32 bits in an address. */
8, /* 8 bits in a byte. */
bfd_arch_crx, /* enum bfd_architecture arch. */
bfd_mach_crx,
"crx", /* Arch name. */
"crx", /* Printable name. */
1, /* Unsigned int section alignment power. */
TRUE, /* The one and only. */
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
0,
};
{
16, /* Bits in a word. */
32, /* Bits in an address. */
8, /* Bits in a byte. */
bfd_arch_crx, /* Architecture number. */
bfd_mach_crx,
"crx", /* Arch name. */
"crx", /* Printable name. */
1, /* Section alignment power. */
true, /* The one and only. */
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
NULL,
0 /* Maximum offset of a reloc from the start of an insn. */
};
+61
View File
@@ -0,0 +1,61 @@
/* BFD support for C-SKY processors.
Copyright (C) 1994-2022 Free Software Foundation, Inc.
Contributed by C-SKY Microsystems and Mentor Graphics.
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 3 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., 51 Franklin Street - Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "sysdep.h"
#include "bfd.h"
#include "libbfd.h"
#define N(NUMBER, PRINT, ISDEFAULT, NEXT) \
{ \
32, /* Bits in a word. */ \
32, /* Bits in an address. */ \
8, /* Bits in a byte. */ \
bfd_arch_csky, /* Architecture. */ \
NUMBER, /* Machine number. */ \
"csky", /* Architecture name. */ \
PRINT, /* Printable name. */ \
3, /* Section align power. */ \
ISDEFAULT, /* Is this the default architecture ? */ \
bfd_default_compatible, /* Architecture comparison function. */ \
bfd_default_scan, /* String to architecture conversion. */ \
bfd_arch_default_fill, \
NEXT, /* Next in list. */ \
0 /* Maximum offset of a reloc from the start of an insn. */ \
}
static const bfd_arch_info_type arch_info_struct[] =
{
/* ABI v1 processors. */
N (bfd_mach_ck510, "csky:ck510", false, & arch_info_struct[1]),
N (bfd_mach_ck610, "csky:ck610", false, & arch_info_struct[2]),
/* ABI v2 processors. */
N (bfd_mach_ck801, "csky:ck801", false, & arch_info_struct[3]),
N (bfd_mach_ck802, "csky:ck802", false, & arch_info_struct[4]),
N (bfd_mach_ck803, "csky:ck803", false, & arch_info_struct[5]),
N (bfd_mach_ck807, "csky:ck807", false, & arch_info_struct[6]),
N (bfd_mach_ck810, "csky:ck810", false, & arch_info_struct[7]),
N (bfd_mach_ck860, "csky:ck860", false, & arch_info_struct[8]),
N (bfd_mach_ck_unknown, "csky:any", false, NULL)
};
const bfd_arch_info_type bfd_csky_arch =
N (0, "csky", true, & arch_info_struct[0]);
+22 -46
View File
@@ -1,5 +1,5 @@
/* BFD support for the D10V processor
Copyright (C) 1996-2018 Free Software Foundation, Inc.
Copyright (C) 1996-2022 Free Software Foundation, Inc.
Contributed by Martin Hunt (hunt@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -23,53 +23,29 @@
#include "bfd.h"
#include "libbfd.h"
#define N(NUMBER, PRINT, DEFAULT, NEXT) \
{ \
16, /* Bits in a word. */ \
18, /* Bits in an address. */ \
8, /* Bits in a byte. */ \
bfd_arch_d10v, \
NUMBER, \
"d10v", \
PRINT, \
4, /* Section alignment power. */ \
DEFAULT, \
bfd_default_compatible, \
bfd_default_scan, \
bfd_arch_default_fill, \
NEXT, \
0 /* Maximum offset of a reloc from the start of an insn. */ \
}
static const bfd_arch_info_type d10v_ts3_info =
{
16, /* 16 bits in a word. */
18, /* really 16 bits in an address, but code has 18 bit range. */
8, /* 8 bits in a byte. */
bfd_arch_d10v,
bfd_mach_d10v_ts3,
"d10v",
"d10v:ts3",
4, /* Section alignment power. */
FALSE,
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
0,
};
N (bfd_mach_d10v_ts3, "d10v:ts3", false, NULL);
static const bfd_arch_info_type d10v_ts2_info =
{
16,
18,
8,
bfd_arch_d10v,
bfd_mach_d10v_ts2,
"d10v",
"d10v:ts2",
4,
FALSE,
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
& d10v_ts3_info,
};
N (bfd_mach_d10v_ts2, "d10v:ts2", false, & d10v_ts3_info);
const bfd_arch_info_type bfd_d10v_arch =
{
16,
18,
8,
bfd_arch_d10v,
bfd_mach_d10v,
"d10v",
"d10v",
4,
TRUE,
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
& d10v_ts2_info,
};
N (bfd_mach_d10v, "d10v", true, & d10v_ts2_info);
+15 -14
View File
@@ -1,5 +1,5 @@
/* BFD support for the Mitsubishi D30V processor
Copyright (C) 1997-2018 Free Software Foundation, Inc.
Copyright (C) 1997-2022 Free Software Foundation, Inc.
Contributed by Martin Hunt (hunt@cygnus.com).
This file is part of BFD, the Binary File Descriptor library.
@@ -25,17 +25,18 @@
const bfd_arch_info_type bfd_d30v_arch =
{
32, /* Bits in a word. */
32, /* Bits in an address. */
8, /* Bits in a byte. */
bfd_arch_d30v,
0,
"d30v",
"d30v",
4, /* Section alignment power. */
TRUE,
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
0,
32, /* Bits in a word. */
32, /* Bits in an address. */
8, /* Bits in a byte. */
bfd_arch_d30v,
0,
"d30v",
"d30v",
4, /* Section alignment power. */
true,
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
NULL,
0 /* Maximum offset of a reloc from the start of an insn. */
};
+16 -15
View File
@@ -1,5 +1,5 @@
/* BFD support for the DLX Microprocessor architecture.
Copyright (C) 2002-2018 Free Software Foundation, Inc.
Copyright (C) 2002-2022 Free Software Foundation, Inc.
Hacked by Kuang Hwa Lin <kuang@sbcglobal.net>
This file is part of BFD, the Binary File Descriptor library.
@@ -24,18 +24,19 @@
#include "libbfd.h"
const bfd_arch_info_type bfd_dlx_arch =
{
32, /* 32 bits in a word. */
32, /* 32 bits in an address. */
8, /* 8 bits in a byte. */
bfd_arch_dlx,
0, /* Only 1 machine. */
"dlx",
"dlx",
4,
TRUE, /* The one and only. */
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
0,
{
32, /* Bits in a word. */
32, /* Bits in an address. */
8, /* Bits in a byte. */
bfd_arch_dlx,
0, /* Machine number. */
"dlx",
"dlx",
4,
true, /* The one and only. */
bfd_default_compatible,
bfd_default_scan,
bfd_arch_default_fill,
NULL,
0 /* Maximum offset of a reloc from the start of an insn. */
};
+21 -31
View File
@@ -1,5 +1,5 @@
/* BFD support for the Adapteva EPIPHANY processor.
Copyright (C) 2009-2018 Free Software Foundation, Inc.
Copyright (C) 2009-2022 Free Software Foundation, Inc.
Contributed by Embecosm on behalf of Adapteva, Inc.
This file is part of BFD, the Binary File Descriptor library.
@@ -23,36 +23,26 @@
#include "bfd.h"
#include "libbfd.h"
#define N(NUMBER, PRINT, ALIGN, DEFAULT, NEXT) \
{ \
32, /* Bits in a word. */ \
32, /* Bits in an address. */ \
8, /* Bits in a byte. */ \
bfd_arch_epiphany, \
NUMBER, \
"epiphany", \
PRINT, \
ALIGN, /* Section alignment power. */ \
DEFAULT, \
bfd_default_compatible, \
bfd_default_scan, \
bfd_arch_default_fill, \
NEXT, \
0 /* Maximum offset of a reloc from the start of an insn. */ \
}
const bfd_arch_info_type bfd_epiphany16_arch =
{
32, /* Bits per word */
32, /* Bits per address. */
8, /* Bits per byte. */
bfd_arch_epiphany, /* Architecture. */
bfd_mach_epiphany16, /* Machine. */
"epiphany", /* Architecture name. */
"epiphany16", /* Machine name. */
1, /* Section align power. */
FALSE, /* The default ? */
bfd_default_compatible, /* Architecture comparison fn. */
bfd_default_scan, /* String to architecture convert fn. */
bfd_arch_default_fill, /* Default fill. */
NULL /* Next in list. */
};
N (bfd_mach_epiphany16, "epiphany16", 1, false, NULL);
const bfd_arch_info_type bfd_epiphany_arch =
{
32, /* Bits per word - not really true. */
32, /* Bits per address. */
8, /* Bits per byte. */
bfd_arch_epiphany, /* Architecture. */
bfd_mach_epiphany32, /* Machine. */
"epiphany", /* Architecture name. */
"epiphany32", /* Machine name. */
2, /* Section align power. */
TRUE, /* The default ? */
bfd_default_compatible, /* Architecture comparison fn. */
bfd_default_scan, /* String to architecture convert fn. */
bfd_arch_default_fill, /* Default fill. */
& bfd_epiphany16_arch /* Next in list. */
};
N (bfd_mach_epiphany32, "epiphany32", 2, true, &bfd_epiphany16_arch);

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