This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] gas/arc: Allow --with-cpu configure option to change default cpu
- From: Andrew Burgess <andrew dot burgess at embecosm dot com>
- To: Nick Clifton <nickc at redhat dot com>
- Cc: binutils at sourceware dot org, Claudiu dot Zissulescu at synopsys dot com
- Date: Wed, 29 Jun 2016 12:20:51 +0100
- Subject: Re: [PATCH] gas/arc: Allow --with-cpu configure option to change default cpu
- Authentication-results: sourceware.org; auth=none
- References: <1465319268-8131-1-git-send-email-andrew dot burgess at embecosm dot com> <ba497073-2aa9-db20-e764-5d184138d171 at redhat dot com> <20160627184732 dot GA8823 at embecosm dot com> <966bd275-64bd-3e34-76d4-681a5bf79266 at redhat dot com>
* Nick Clifton <nickc@redhat.com> [2016-06-28 12:49:16 +0100]:
> Hi Andrew,
>
> > I see your concern here, however...
> >
> > If I move the option checking into ARC specific code, but still use
> > AC_ARG_WITH to check for the argument then the help text will always
> > show up for all targets. Due to our use of AC_DISABLE_OPTION_CHECKING
> > all --with-XXX type options will be accepted by our configure script,
> > and as you point out, when this does not work this might confuse
> > users.
>
> OK, fair point.
>
> > What if I changed the current patch to simply remove the help text for
> > the --with-cpu option?
>
> Well the problem with that is that we now have a silent configuration
> option which only those in the know (or who have actually read the source
> code) will be able to use.
>
> Instead - how about a compromise: We go with your original version of
> the patch, but in the help text for the option we specifically mention
> which targets support this option. (Ie just ARC for now, but extendable
> later on to other targets if they want it).
Hi Nick,
Thanks for your feedback.
I've attached a new revision, this includes NEWS entry, and the help
text that makes it clear the option is only supported on ARC.
Thanks,
Andrew
--
gas/arc: Allow --with-cpu configure option to change default cpu
Add a new configure time option --with-cpu=CPU that can be used to
change the default cpu selection. Currently this is only supported on
ARC.
If the user specifies --with-cpu=FOO at configure time then the constant
TARGET_WITH_CPU will be defined to "FOO" in config.h, the
TARGET_WITH_CPU constant can then be used in the config/tc-*.c code as a
default string to select an appropriate cpu if the user does not
explicitly select a cpu at gas run-time.
gas/ChangeLog:
* config.in (TARGET_WITH_CPU): Undefine.
* configure.ac: Add --with-cpu support, and define in config.h.
* configure: Regenerate.
* config/tc-arc.c: Use TARGET_WITH_CPU to select default CPU.
* NEWS: Mention new configure option.
---
gas/ChangeLog | 8 ++++++++
gas/NEWS | 3 +++
gas/config.in | 3 +++
gas/config/tc-arc.c | 6 +++++-
gas/configure | 18 ++++++++++++++++--
gas/configure.ac | 10 ++++++++++
6 files changed, 45 insertions(+), 3 deletions(-)
diff --git a/gas/NEWS b/gas/NEWS
index 08807f1..d48b097 100644
--- a/gas/NEWS
+++ b/gas/NEWS
@@ -32,6 +32,9 @@
* Add assembly-time relaxation option for ARC cpus.
+* Add --with-cpu=TYPE configure option for ARC gas. This allows the default
+ cpu type to be adjusted at configure time.
+
Changes in 2.26:
* Add a configure option --enable-compressed-debug-sections={all,gas} to
diff --git a/gas/config.in b/gas/config.in
index e06f160..5129c28 100644
--- a/gas/config.in
+++ b/gas/config.in
@@ -318,6 +318,9 @@
/* Target vendor. */
#undef TARGET_VENDOR
+/* Target specific CPU. */
+#undef TARGET_WITH_CPU
+
/* Use b modifier when opening binary files? */
#undef USE_BINARY_FOPEN
diff --git a/gas/config/tc-arc.c b/gas/config/tc-arc.c
index 155d991..d46f593 100644
--- a/gas/config/tc-arc.c
+++ b/gas/config/tc-arc.c
@@ -51,6 +51,10 @@
/* Equal to MAX_PRECISION in atof-ieee.c. */
#define MAX_LITTLENUMS 6
+#ifndef TARGET_WITH_CPU
+#define TARGET_WITH_CPU "arc700"
+#endif /* TARGET_WITH_CPU */
+
/* Enum used to enumerate the relaxable ins operands. */
enum rlx_operand_type
{
@@ -2466,7 +2470,7 @@ md_begin (void)
const struct arc_opcode *opcode = arc_opcodes;
if (!mach_type_specified_p)
- arc_select_cpu ("arc700");
+ arc_select_cpu (TARGET_WITH_CPU);
/* The endianness can be chosen "at the factory". */
target_big_endian = byte_order == BIG_ENDIAN;
diff --git a/gas/configure b/gas/configure
index b6298b5..00256bf 100755
--- a/gas/configure
+++ b/gas/configure
@@ -771,6 +771,7 @@ enable_x86_relax_relocations
enable_elf_stt_common
enable_werror
enable_build_warnings
+with_cpu
enable_nls
enable_maintainer_mode
with_system_zlib
@@ -1435,6 +1436,7 @@ Optional Packages:
--with-pic try to use only PIC/non-PIC objects [default=use
both]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
+ --with-cpu=CPU default cpu variant is CPU (only supported on ARC)
--with-system-zlib use installed libz
Some influential environment variables:
@@ -10982,7 +10984,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 10985 "configure"
+#line 10987 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11088,7 +11090,7 @@ else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
cat > conftest.$ac_ext <<_LT_EOF
-#line 11091 "configure"
+#line 11093 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -11828,6 +11830,13 @@ fi
ac_config_headers="$ac_config_headers config.h:config.in"
+
+# Check whether --with-cpu was given.
+if test "${with_cpu+set}" = set; then :
+ withval=$with_cpu;
+fi
+
+
# PR 14072
@@ -12870,6 +12879,11 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+cat >>confdefs.h <<_ACEOF
+#define TARGET_WITH_CPU "${with_cpu}"
+_ACEOF
+
+
for ac_prog in 'bison -y' byacc
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
diff --git a/gas/configure.ac b/gas/configure.ac
index 8f71825..7825fc3 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -106,6 +106,15 @@ AM_BINUTILS_WARNINGS
# Generate a header file
AC_CONFIG_HEADERS(config.h:config.in)
+dnl Option --with-cpu=TYPE allows configure type control of the default
+dnl cpu type within the assembler. Not all targets support this option
+dnl yet, which is why there is no help string, check the code to see if
+dnl your target supports this option.
+AC_ARG_WITH(cpu,
+ AS_HELP_STRING([--with-cpu=CPU],
+ [default cpu variant is CPU (only supported on ARC)]),
+ [],[])
+
# PR 14072
AH_VERBATIM([00_CONFIG_H_CHECK],
[/* Check that config.h is #included before system headers
@@ -780,6 +789,7 @@ AC_DEFINE_UNQUOTED(TARGET_CANONICAL, "${target}", [Canonical target.])
AC_DEFINE_UNQUOTED(TARGET_CPU, "${target_cpu}", [Target CPU.])
AC_DEFINE_UNQUOTED(TARGET_VENDOR, "${target_vendor}", [Target vendor.])
AC_DEFINE_UNQUOTED(TARGET_OS, "${target_os}", [Target OS.])
+AC_DEFINE_UNQUOTED(TARGET_WITH_CPU, "${with_cpu}", [Target specific CPU.])
AC_PROG_YACC
AM_PROG_LEX
--
2.5.1