@@ -662,7 +662,8 @@ OPTIONAL_BACKENDS_CFILES = \
CONFIG_STATUS_DEPENDENCIES = \
$(srcdir)/config.bfd \
$(srcdir)/configure.host \
- $(srcdir)/development.sh
+ $(srcdir)/development.sh \
+ $(srcdir)/configure.tgt
# These are defined by configure:
WORDSIZE = @wordsize@
@@ -1032,6 +1032,15 @@ case ${want_mmap}+${ac_cv_func_mmap_fixed_mapped} in
true+yes ) AC_DEFINE(USE_MMAP, 1, [Use mmap if it's available?]) ;;
esac
+targ=${target}
+. ${srcdir}/configure.tgt
+
+case ${cpu_type} in
+ aarch64*) AC_DEFINE(TC_AARCH64, 1, [Compile for AArch64 targets]) ;;
+ sparc*) AC_DEFINE(TC_SPARC, 1, [Compile for Sparc targets]) ;;
+ mips*) AC_DEFINE(TC_MIPS, 1, [Compile for MIPS targets]) ;;
+esac
+
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
new file mode 100644
@@ -0,0 +1,42 @@
+# bfd target specific configuration file. This is a -*- sh -*- file.
+#
+# Copyright (C) 2024 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
+# 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/>.
+#
+
+# This is invoked by configure. Putting it in a separate shell file
+# lets us skip running autoconf when modifying target specific
+# information.
+
+# Input shell variables:
+# targ a configuration target name, such as i686-pc-linux-gnu.
+
+# Output shell variables:
+# cpu_type canonical gas cpu type; identifies the gas/config/tc-* files
+
+cpu_type=
+
+eval $(echo ${targ} | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/')
+
+# Check for architecture variants. Set cpu_type and, optionally,
+# endian and arch.
+# Note: This table is alpha-sorted, please try to keep it that way.
+case ${cpu} in
+ aarch64*) cpu_type=aarch64 ;;
+ mips*) cpu_type=mips ;;
+ sparc*) cpu_type=sparc ;;
+ *) cpu_type=${cpu} ;;
+esac
@@ -546,9 +546,17 @@ fi
AC_DEFINE_UNQUOTED(TARGET_PREPENDS_UNDERSCORE, $UNDERSCORE,
[Define to 1 if user symbol names have a leading underscore, 0 if not.])
-# Emulation
-targ=$target
+targ=${target}
. ${srcdir}/configure.tgt
+
+# Target-specific definitions
+case ${cpu_type} in
+ aarch64*) AC_DEFINE(TC_AARCH64, 1, [Compile for AArch64 targets]) ;;
+ sparc*) AC_DEFINE(TC_SPARC, 1, [Compile for Sparc targets]) ;;
+ mips*) AC_DEFINE(TC_MIPS, 1, [Compile for MIPS targets]) ;;
+esac
+
+# Emulation
EMULATION=$targ_emul
EMULATION_VECTOR=$targ_emul_vector
@@ -19,8 +19,11 @@
# along with this program; see the file COPYING3. If not see
# <http://www.gnu.org/licenses/>.
-# This file switches on the shell variable ${targ}, and sets the
-# following shell variables:
+# Input shell variables:
+# targ a configuration target name, such as i686-pc-linux-gnu.
+
+# Output shell variables:
+# cpu_type canonical gas cpu type; identifies the gas/config/tc-* files
# targ_emul name of emulation to use
# targ_emul_vector name of vector to use
@@ -40,3 +43,17 @@ case "${targ}" in
targ_emul_vector=bin_vanilla_emulation
;;
esac
+
+cpu_type=
+
+eval $(echo ${targ} | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/')
+
+# Check for architecture variants. Set cpu_type and, optionally,
+# endian and arch.
+# Note: This table is alpha-sorted, please try to keep it that way.
+case ${cpu} in
+ aarch64*) cpu_type=aarch64 ;;
+ mips*) cpu_type=mips ;;
+ sparc*) cpu_type=sparc ;;
+ *) cpu_type=${cpu} ;;
+esac
@@ -82,7 +82,9 @@ development.exp: $(BFDDIR)/development.sh
| $(AWK) -F= '{ print "set " $$1 " " $$2 }' > $@
# development.sh is used to determine -Werror default.
-CONFIG_STATUS_DEPENDENCIES = $(BFDDIR)/development.sh
+CONFIG_STATUS_DEPENDENCIES = \
+ $(BFDDIR)/configure.tgt \
+ $(BFDDIR)/development.sh
EXTRA_DEJAGNU_SITE_CONFIG = development.exp
@@ -259,6 +259,15 @@ AC_SUBST(CLOCK_GETTIME_LINK)
AC_SUBST(BUILD_SUBDIRS)
+targ=${target}
+. ${srcdir}/configure.tgt
+
+case ${cpu_type} in
+ aarch64*) AC_DEFINE(TC_AARCH64, 1, [Compile for AArch64 targets]) ;;
+ sparc*) AC_DEFINE(TC_SPARC, 1, [Compile for Sparc targets]) ;;
+ mips*) AC_DEFINE(TC_MIPS, 1, [Compile for MIPS targets]) ;;
+esac
+
AC_CONFIG_FILES([Makefile src/Makefile gp-display-html/Makefile doc/Makefile])
AC_CONFIG_HEADERS([config.h:common/config.h.in])
new file mode 100644
@@ -0,0 +1,42 @@
+# bfd target specific configuration file. This is a -*- sh -*- file.
+#
+# Copyright (C) 2024 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
+# 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/>.
+#
+
+# This is invoked by configure. Putting it in a separate shell file
+# lets us skip running autoconf when modifying target specific
+# information.
+
+# Input shell variables:
+# targ a configuration target name, such as i686-pc-linux-gnu.
+
+# Output shell variables:
+# cpu_type canonical gas cpu type; identifies the gas/config/tc-* files
+
+cpu_type=
+
+eval $(echo ${targ} | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/')
+
+# Check for architecture variants. Set cpu_type and, optionally,
+# endian and arch.
+# Note: This table is alpha-sorted, please try to keep it that way.
+case ${cpu} in
+ aarch64*) cpu_type=aarch64 ;;
+ mips*) cpu_type=mips ;;
+ sparc*) cpu_type=sparc ;;
+ *) cpu_type=${cpu} ;;
+esac
@@ -664,3 +664,6 @@ xztest.lo: config.h backtrace.h backtrace-supported.h internal.h testlib.h
ztest.lo: config.h backtrace.h backtrace-supported.h internal.h testlib.h
include $(top_srcdir)/../multilib.am
+
+# Reconfigure if configure.tgt changes.
+CONFIG_STATUS_DEPENDENCIES = $(srcdir)/configure.tgt
\ No newline at end of file
@@ -576,6 +576,16 @@ else
multilib_arg=
fi
+targ=${target}
+. ${srcdir}/configure.tgt
+
+# Target-specific definitions
+case ${cpu_type} in
+ aarch64*) AC_DEFINE(TC_AARCH64, 1, [Compile for AArch64 targets]) ;;
+ sparc*) AC_DEFINE(TC_SPARC, 1, [Compile for Sparc targets]) ;;
+ mips*) AC_DEFINE(TC_MIPS, 1, [Compile for MIPS targets]) ;;
+esac
+
AC_CONFIG_FILES(Makefile backtrace-supported.h)
AC_CONFIG_FILES(install-debuginfo-for-buildid.sh, chmod +x install-debuginfo-for-buildid.sh)
new file mode 100644
@@ -0,0 +1,42 @@
+# bfd target specific configuration file. This is a -*- sh -*- file.
+#
+# Copyright (C) 2024 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
+# 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/>.
+#
+
+# This is invoked by configure. Putting it in a separate shell file
+# lets us skip running autoconf when modifying target specific
+# information.
+
+# Input shell variables:
+# targ a configuration target name, such as i686-pc-linux-gnu.
+
+# Output shell variables:
+# cpu_type canonical gas cpu type; identifies the gas/config/tc-* files
+
+cpu_type=
+
+eval $(echo ${targ} | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/')
+
+# Check for architecture variants. Set cpu_type and, optionally,
+# endian and arch.
+# Note: This table is alpha-sorted, please try to keep it that way.
+case ${cpu} in
+ aarch64*) cpu_type=aarch64 ;;
+ mips*) cpu_type=mips ;;
+ sparc*) cpu_type=sparc ;;
+ *) cpu_type=${cpu} ;;
+esac
@@ -500,6 +500,9 @@ stamp-h: $(srcdir)/config.in config.status Makefile
config.status: $(srcdir)/configure
$(SHELL) ./config.status --recheck
+CONFIG_STATUS_DEPENDENCIES = \
+ $(srcdir)/configure.tgt
+
AUTOCONF = autoconf
ACLOCAL = aclocal
ACLOCAL_AMFLAGS = -I ../config -I ..
@@ -812,6 +812,16 @@ AC_SUBST(datarootdir)
AC_SUBST(docdir)
AC_SUBST(htmldir)
+targ=${target}
+. ${srcdir}/configure.tgt
+
+# Target-specific definitions
+case ${cpu_type} in
+ aarch64*) AC_DEFINE(TC_AARCH64, 1, [Compile for AArch64 targets]) ;;
+ sparc*) AC_DEFINE(TC_SPARC, 1, [Compile for Sparc targets]) ;;
+ mips*) AC_DEFINE(TC_MIPS, 1, [Compile for MIPS targets]) ;;
+esac
+
# We need multilib support, but only if configuring for the target.
AC_CONFIG_FILES([Makefile testsuite/Makefile])
AC_CONFIG_COMMANDS([default],
new file mode 100644
@@ -0,0 +1,42 @@
+# bfd target specific configuration file. This is a -*- sh -*- file.
+#
+# Copyright (C) 2024 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
+# 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/>.
+#
+
+# This is invoked by configure. Putting it in a separate shell file
+# lets us skip running autoconf when modifying target specific
+# information.
+
+# Input shell variables:
+# targ a configuration target name, such as i686-pc-linux-gnu.
+
+# Output shell variables:
+# cpu_type canonical gas cpu type; identifies the gas/config/tc-* files
+
+cpu_type=
+
+eval $(echo ${targ} | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/cpu=\1 vendor=\2 os=\3/')
+
+# Check for architecture variants. Set cpu_type and, optionally,
+# endian and arch.
+# Note: This table is alpha-sorted, please try to keep it that way.
+case ${cpu} in
+ aarch64*) cpu_type=aarch64 ;;
+ mips*) cpu_type=mips ;;
+ sparc*) cpu_type=sparc ;;
+ *) cpu_type=${cpu} ;;
+esac