public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [RFC 3/5] xtensa: support dynconfig on windows
  2017-05-22 21:12 [RFC 0/5] xtensa: support dynamic configuration Max Filippov
  2017-05-22 21:12 ` [RFC 2/5] xtensa: make configuration dynamic Max Filippov
  2017-05-22 21:12 ` [RFC 1/5] xtensa: don't expect XCHAL_* macros to be constant Max Filippov
@ 2017-05-22 21:12 ` Max Filippov
  2017-06-12 15:45   ` Nick Clifton
  2017-05-22 21:13 ` [RFC 4/5] xtensa: make xtensa_modules dynamic Max Filippov
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Max Filippov @ 2017-05-22 21:12 UTC (permalink / raw)
  To: binutils, gdb-patches
  Cc: Sterling Augustine, David Weatherford, Maxim Grigoriev,
	Woody LaRue, Max Filippov

2017-05-22  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
	* xtensa-config.c (windows.h): New #include'd header.
	(RTLD_LAZY): New macro definition.
	(dlopen, dlsym, dlclose, dlerror): New functions.
---
 bfd/xtensa-config.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/bfd/xtensa-config.c b/bfd/xtensa-config.c
index fdbcca4..3e12e26 100644
--- a/bfd/xtensa-config.c
+++ b/bfd/xtensa-config.c
@@ -3,6 +3,8 @@
 
 #if defined (HAVE_DLFCN_H)
 #include <dlfcn.h>
+#elif defined (HAVE_WINDOWS_H)
+#include <windows.h>
 #endif
 #include <stdio.h>
 #include <stdlib.h>
@@ -12,6 +14,37 @@
 
 static struct xtensa_config xtensa_defconfig = XTENSA_CONFIG_INITIALIZER;
 
+#if !defined (HAVE_DLFCN_H) && defined (HAVE_WINDOWS_H)
+
+#define RTLD_LAZY 0      /* Dummy value.  */
+
+static void *
+dlopen (const char *file, int mode ATTRIBUTE_UNUSED)
+{
+  return LoadLibrary (file);
+}
+
+static void *
+dlsym (void *handle, const char *name)
+{
+  return GetProcAddress (handle, name);
+}
+
+static int ATTRIBUTE_UNUSED
+dlclose (void *handle)
+{
+  FreeLibrary (handle);
+  return 0;
+}
+
+static const char *
+dlerror (void)
+{
+  return "Unable to load DLL.";
+}
+
+#endif /* !defined (HAVE_DLFCN_H) && defined (HAVE_WINDOWS_H)  */
+
 void *xtensa_load_config (const char *name ATTRIBUTE_UNUSED, void *def)
 {
   static int init;
-- 
2.1.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [RFC 1/5] xtensa: don't expect XCHAL_* macros to be constant
  2017-05-22 21:12 [RFC 0/5] xtensa: support dynamic configuration Max Filippov
  2017-05-22 21:12 ` [RFC 2/5] xtensa: make configuration dynamic Max Filippov
@ 2017-05-22 21:12 ` Max Filippov
  2017-05-26 17:36   ` augustine.sterling
  2017-05-22 21:12 ` [RFC 3/5] xtensa: support dynconfig on windows Max Filippov
                   ` (3 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Max Filippov @ 2017-05-22 21:12 UTC (permalink / raw)
  To: binutils, gdb-patches
  Cc: Sterling Augustine, David Weatherford, Maxim Grigoriev,
	Woody LaRue, Max Filippov

Get rid of the assumption that XCHAL_* macros are preprocessor
constants: don't use them in preprocessor conditionals or in static
variable initializers.

2017-05-22  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
	* elf32-xtensa.c (elf_xtensa_be_plt_entry,
	elf_xtensa_le_plt_entry): Add dimension for the ABI to arrays,
	keep both windowed and call0 ABI PLT definitions.
	(elf_xtensa_create_plt_entry): Use selected ABI to choose upper
	elf_xtensa_*_plt_entry endex.
	(ELF_MAXPAGESIZE): Fix at minimal supported MMU page size.

gas/
	* config/tc-xtensa.c (density_supported, xtensa_fetch_width,
	absolute_literals_supported): Leave definitions uninitialized.
	(directive_state): Leave entries for directive_density and
	directive_absolute_literals initialized to false.
	(xg_init_global_config, xtensa_init): New functions.
	* config/tc-xtensa.h (TARGET_BYTES_BIG_ENDIAN): Define as 0.
	(HOST_SPECIAL_INIT): New definition.
	(xtensa_init): New declaration.
---
 bfd/elf32-xtensa.c     | 60 +++++++++++++++++++++++++++++---------------------
 gas/config/tc-xtensa.c | 32 ++++++++++++++++++---------
 gas/config/tc-xtensa.h |  9 +++++++-
 3 files changed, 64 insertions(+), 37 deletions(-)

diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 80f50e3..078918f 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -519,28 +519,42 @@ elf_xtensa_info_to_howto_rela (bfd *abfd ATTRIBUTE_UNUSED,
    invoked.  Note: the 32-byte frame size used here cannot be changed
    without a corresponding change in the runtime linker.  */
 
-static const bfd_byte elf_xtensa_be_plt_entry[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_xtensa_be_plt_entry[][PLT_ENTRY_SIZE] =
 {
-#if XSHAL_ABI == XTHAL_ABI_WINDOWED
-  0x6c, 0x10, 0x04,	/* entry sp, 32 */
-#endif
-  0x18, 0x00, 0x00,	/* l32r  a8, [got entry for rtld's resolver] */
-  0x1a, 0x00, 0x00,	/* l32r  a10, [got entry for rtld's link map] */
-  0x1b, 0x00, 0x00,	/* l32r  a11, [literal for reloc index] */
-  0x0a, 0x80, 0x00,	/* jx    a8 */
-  0			/* unused */
+    {
+      0x6c, 0x10, 0x04,	/* entry sp, 32 */
+      0x18, 0x00, 0x00,	/* l32r  a8, [got entry for rtld's resolver] */
+      0x1a, 0x00, 0x00,	/* l32r  a10, [got entry for rtld's link map] */
+      0x1b, 0x00, 0x00,	/* l32r  a11, [literal for reloc index] */
+      0x0a, 0x80, 0x00,	/* jx    a8 */
+      0			/* unused */
+    },
+    {
+      0x18, 0x00, 0x00,	/* l32r  a8, [got entry for rtld's resolver] */
+      0x1a, 0x00, 0x00,	/* l32r  a10, [got entry for rtld's link map] */
+      0x1b, 0x00, 0x00,	/* l32r  a11, [literal for reloc index] */
+      0x0a, 0x80, 0x00,	/* jx    a8 */
+      0			/* unused */
+    }
 };
 
-static const bfd_byte elf_xtensa_le_plt_entry[PLT_ENTRY_SIZE] =
+static const bfd_byte elf_xtensa_le_plt_entry[][PLT_ENTRY_SIZE] =
 {
-#if XSHAL_ABI == XTHAL_ABI_WINDOWED
-  0x36, 0x41, 0x00,	/* entry sp, 32 */
-#endif
-  0x81, 0x00, 0x00,	/* l32r  a8, [got entry for rtld's resolver] */
-  0xa1, 0x00, 0x00,	/* l32r  a10, [got entry for rtld's link map] */
-  0xb1, 0x00, 0x00,	/* l32r  a11, [literal for reloc index] */
-  0xa0, 0x08, 0x00,	/* jx    a8 */
-  0			/* unused */
+    {
+      0x36, 0x41, 0x00,	/* entry sp, 32 */
+      0x81, 0x00, 0x00,	/* l32r  a8, [got entry for rtld's resolver] */
+      0xa1, 0x00, 0x00,	/* l32r  a10, [got entry for rtld's link map] */
+      0xb1, 0x00, 0x00,	/* l32r  a11, [literal for reloc index] */
+      0xa0, 0x08, 0x00,	/* jx    a8 */
+      0			/* unused */
+    },
+    {
+      0x81, 0x00, 0x00,	/* l32r  a8, [got entry for rtld's resolver] */
+      0xa1, 0x00, 0x00,	/* l32r  a10, [got entry for rtld's link map] */
+      0xb1, 0x00, 0x00,	/* l32r  a11, [literal for reloc index] */
+      0xa0, 0x08, 0x00,	/* jx    a8 */
+      0			/* unused */
+    }
 };
 
 /* The size of the thread control block.  */
@@ -2336,8 +2350,8 @@ elf_xtensa_create_plt_entry (struct bfd_link_info *info,
   /* Fill in the entry in the procedure linkage table.  */
   memcpy (splt->contents + code_offset,
 	  (bfd_big_endian (output_bfd)
-	   ? elf_xtensa_be_plt_entry
-	   : elf_xtensa_le_plt_entry),
+	   ? elf_xtensa_be_plt_entry[XSHAL_ABI != XTHAL_ABI_WINDOWED]
+	   : elf_xtensa_le_plt_entry[XSHAL_ABI != XTHAL_ABI_WINDOWED]),
 	  PLT_ENTRY_SIZE);
   abi_offset = XSHAL_ABI == XTHAL_ABI_WINDOWED ? 3 : 0;
   bfd_put_16 (output_bfd, l32r_offset (got_base + 0,
@@ -11317,11 +11331,7 @@ static const struct bfd_elf_special_section elf_xtensa_special_sections[] =
 #define ELF_MACHINE_CODE		EM_XTENSA
 #define ELF_MACHINE_ALT1		EM_XTENSA_OLD
 
-#if XCHAL_HAVE_MMU
-#define ELF_MAXPAGESIZE			(1 << XCHAL_MMU_MIN_PTE_PAGE_SIZE)
-#else /* !XCHAL_HAVE_MMU */
-#define ELF_MAXPAGESIZE			1
-#endif /* !XCHAL_HAVE_MMU */
+#define ELF_MAXPAGESIZE			0x1000
 #endif /* ELF_ARCH */
 
 #define elf_backend_can_gc_sections	1
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index bac7946..ed7ba0a 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -72,13 +72,13 @@ const char FLT_CHARS[] = "rRsSfFdDxXpP";
 /* Flags to indicate whether the hardware supports the density and
    absolute literals options.  */
 
-bfd_boolean density_supported = XCHAL_HAVE_DENSITY;
-bfd_boolean absolute_literals_supported = XSHAL_USE_ABSOLUTE_LITERALS;
+bfd_boolean density_supported;
+bfd_boolean absolute_literals_supported;
 
 static vliw_insn cur_vinsn;
 
 unsigned xtensa_num_pipe_stages;
-unsigned xtensa_fetch_width = XCHAL_INST_FETCH_WIDTH;
+unsigned xtensa_fetch_width;
 
 static enum debug_info_type xt_saved_debug_type = DEBUG_NONE;
 
@@ -419,21 +419,13 @@ bfd_boolean directive_state[] =
 {
   FALSE,			/* none */
   FALSE,			/* literal */
-#if !XCHAL_HAVE_DENSITY
   FALSE,			/* density */
-#else
-  TRUE,				/* density */
-#endif
   TRUE,				/* transform */
   FALSE,			/* freeregs */
   FALSE,			/* longcalls */
   FALSE,			/* literal_prefix */
   FALSE,			/* schedule */
-#if XSHAL_USE_ABSOLUTE_LITERALS
-  TRUE				/* absolute_literals */
-#else
   FALSE				/* absolute_literals */
-#endif
 };
 
 /* A circular list of all potential and actual literal pool locations
@@ -5216,6 +5208,24 @@ md_number_to_chars (char *buf, valueT val, int n)
     number_to_chars_littleendian (buf, val, n);
 }
 
+static void
+xg_init_global_config (void)
+{
+  target_big_endian = XCHAL_HAVE_BE;
+
+  density_supported = XCHAL_HAVE_DENSITY;
+  absolute_literals_supported = XSHAL_USE_ABSOLUTE_LITERALS;
+  xtensa_fetch_width = XCHAL_INST_FETCH_WIDTH;
+
+  directive_state[directive_density] = XCHAL_HAVE_DENSITY;
+  directive_state[directive_absolute_literals] = XSHAL_USE_ABSOLUTE_LITERALS;
+}
+
+void
+xtensa_init (int argc ATTRIBUTE_UNUSED, char **argv ATTRIBUTE_UNUSED)
+{
+  xg_init_global_config ();
+}
 
 /* This function is called once, at assembler startup time.  It should
    set up all the tables, etc. that the MD part of the assembler will
diff --git a/gas/config/tc-xtensa.h b/gas/config/tc-xtensa.h
index 50e4640..69a5c8a 100644
--- a/gas/config/tc-xtensa.h
+++ b/gas/config/tc-xtensa.h
@@ -30,7 +30,7 @@ struct fix;
 #include "xtensa-isa.h"
 #include "xtensa-config.h"
 
-#define TARGET_BYTES_BIG_ENDIAN XCHAL_HAVE_BE
+#define TARGET_BYTES_BIG_ENDIAN 0
 
 
 /* Maximum number of opcode slots in a VLIW instruction.  */
@@ -335,6 +335,13 @@ extern bfd_boolean xtensa_check_inside_bundle (void);
 extern void xtensa_handle_align (fragS *);
 extern char *xtensa_section_rename (const char *);
 
+/* We need to set the target endianness in xtensa_init and not in md_begin.
+   This is because xtensa_target_format is called before md_begin, and we
+   want to have all non-statically initialized fields initialized.  */
+
+#define HOST_SPECIAL_INIT xtensa_init
+extern void xtensa_init (int, char **);
+
 #define TARGET_FORMAT			xtensa_target_format ()
 #define TARGET_ARCH			bfd_arch_xtensa
 #define TC_SEGMENT_INFO_TYPE		xtensa_segment_info
-- 
2.1.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [RFC 0/5] xtensa: support dynamic configuration
@ 2017-05-22 21:12 Max Filippov
  2017-05-22 21:12 ` [RFC 2/5] xtensa: make configuration dynamic Max Filippov
                   ` (5 more replies)
  0 siblings, 6 replies; 15+ messages in thread
From: Max Filippov @ 2017-05-22 21:12 UTC (permalink / raw)
  To: binutils, gdb-patches
  Cc: Sterling Augustine, David Weatherford, Maxim Grigoriev,
	Woody LaRue, Max Filippov

Hello,

this is an RFC series that makes xtensa binutils dynamically configurable,
i.e. on a platform with shared library support single toolchain binary
becomes capable of building code for arbitrary xtensa configuration.
At the same time it fully preserves the traditional way of configuring
using xtensa configuration overlay.

Currently xtensa toolchain needs to be patched and rebuilt for every
new xtensa processor configuration. This has a number of downsides:
- toolchain builders need to change the toolchain source code, and
  because xtensa configuration overlay is not a patch, this change is
  special, embedding it into the toolchain build process gets
  backpressure.
- toolchain built for one configuration is usually not usable for any
  other configuration. It's not possible for a distribution to provide
  reusable prebuilt xtensa toolchain.

This series allows building the toolchain (including target libraries)
without its source code modification. Built toolchain takes configuration
parameters from the shared object specified in the environment variable.
That shared object may be built by the following project:

  https://github.com/jcmvbkbc/xtensa-dynconfig

The same shared object is used for gcc, all binutils and for gdb.
Xtensa core specific information needed to build that shared object is
taken from the configuration overlay.

Both gcc and binutils-gdb get new shared header file
include/xtensa-dynconfig.h that provides definition of configuration
data structure, initialization macros, redefines XCHAL_* macros to
access this structure and declares function for loading configuration
dynamically.

Max Filippov (5):
  xtensa: don't expect XCHAL_* macros to be constant
  xtensa: make configuration dynamic
  xtensa: support dynconfig on windows
  xtensa: make xtensa_modules dynamic
  gdb: xtensa: make tdep and linux-nat dynamically configurable

 bfd/Makefile.am            |   2 +
 bfd/Makefile.in            |   3 +
 bfd/configure              |   4 +-
 bfd/configure.ac           |   4 +-
 bfd/elf32-xtensa.c         |  62 ++++----
 bfd/xtensa-config.c        | 117 ++++++++++++++
 bfd/xtensa-isa.c           |  13 +-
 gas/config/tc-xtensa.c     |  34 +++--
 gas/config/tc-xtensa.h     |  11 +-
 gas/config/xtensa-relax.c  |   2 +-
 gdb/xtensa-linux-nat.c     |  18 ++-
 gdb/xtensa-tdep.c          |  13 +-
 include/xtensa-dynconfig.h | 373 +++++++++++++++++++++++++++++++++++++++++++++
 ld/Makefile.am             |   1 +
 ld/Makefile.in             |   1 +
 ld/emultempl/xtensaelf.em  |   2 +-
 16 files changed, 608 insertions(+), 52 deletions(-)
 create mode 100644 bfd/xtensa-config.c
 create mode 100644 include/xtensa-dynconfig.h

-- 
2.1.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [RFC 2/5] xtensa: make configuration dynamic
  2017-05-22 21:12 [RFC 0/5] xtensa: support dynamic configuration Max Filippov
@ 2017-05-22 21:12 ` Max Filippov
  2017-05-26 18:10   ` augustine.sterling
  2017-05-22 21:12 ` [RFC 1/5] xtensa: don't expect XCHAL_* macros to be constant Max Filippov
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 15+ messages in thread
From: Max Filippov @ 2017-05-22 21:12 UTC (permalink / raw)
  To: binutils, gdb-patches
  Cc: Sterling Augustine, David Weatherford, Maxim Grigoriev,
	Woody LaRue, Max Filippov

Now that XCHAL_* macros don't have to be preprocessor constants add
include/xtensa-dynconfig.h that defines them as fields of a structure
returned from the xtensa_get_config function.
Define that structure and fill it with default parameter values
specified in the include/xtensa-config.h.
Define reusable function xtensa_load_config that tries to load
configuration and return an address of an exported object from it.
Define the function xtensa_get_config that uses xtensa_load_config to
get structure xtensa_config, either dynamically configured or the
default.

2017-05-22  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
	* Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Append
	xtensa-config.c.
	* Makefile.in: Regenerate.
	* configure: Regenerate.
	* configure.ac (xtensa_elf32_be_vec, xtensa_elf32_le_vec): Add
	xtensa-config.lo to the tb.
	* elf32-xtensa.c (xtensa-config.h): Replace #include with
	xtensa-dynconfig.h.
	* xtensa-config.c: New file.

gas/
	* config/tc-xtensa.c (xtensa-config.h): Replace #include with
	xtensa-dynconfig.h.
	* config/tc-xtensa.h: Likewise.
	* config/xtensa-relax.c: Likewise.

include/
	* xtensa-dynconfig.h: New file.

ld/
	* Makefile.am (eelf32xtensa.c): Add $(INCDIR)/xtensa-dynconfig.h
	to the list of dependencies.
	* Makefile.in: Regenerate.
	* emultempl/xtensaelf.em (xtensa-config.h): Replace #include
	with xtensa-dynconfig.h.
---
 bfd/Makefile.am            |   2 +
 bfd/Makefile.in            |   3 +
 bfd/configure              |   4 +-
 bfd/configure.ac           |   4 +-
 bfd/elf32-xtensa.c         |   2 +-
 bfd/xtensa-config.c        |  84 ++++++++++
 gas/config/tc-xtensa.c     |   2 +-
 gas/config/tc-xtensa.h     |   2 +-
 gas/config/xtensa-relax.c  |   2 +-
 include/xtensa-dynconfig.h | 373 +++++++++++++++++++++++++++++++++++++++++++++
 ld/Makefile.am             |   1 +
 ld/Makefile.in             |   1 +
 ld/emultempl/xtensaelf.em  |   2 +-
 13 files changed, 473 insertions(+), 9 deletions(-)
 create mode 100644 bfd/xtensa-config.c
 create mode 100644 include/xtensa-dynconfig.h

diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 55e6aaf..f6daff4 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -455,6 +455,7 @@ BFD32_BACKENDS = \
 	vms-misc.lo \
 	xcofflink.lo \
 	xsym.lo \
+	xtensa-config.lo \
 	xtensa-isa.lo \
 	xtensa-modules.lo
 
@@ -646,6 +647,7 @@ BFD32_BACKENDS_CFILES = \
 	vms-misc.c \
 	xcofflink.c \
 	xsym.c \
+	xtensa-config.c \
 	xtensa-isa.c \
 	xtensa-modules.c
 
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 43d8b62..4f6d593 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -789,6 +789,7 @@ BFD32_BACKENDS = \
 	vms-misc.lo \
 	xcofflink.lo \
 	xsym.lo \
+	xtensa-config.lo \
 	xtensa-isa.lo \
 	xtensa-modules.lo
 
@@ -980,6 +981,7 @@ BFD32_BACKENDS_CFILES = \
 	vms-misc.c \
 	xcofflink.c \
 	xsym.c \
+	xtensa-config.c \
 	xtensa-isa.c \
 	xtensa-modules.c
 
@@ -1661,6 +1663,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/vms-misc.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xcofflink.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xsym.Plo@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xtensa-config.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xtensa-isa.Plo@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/xtensa-modules.Plo@am__quote@
 
diff --git a/bfd/configure b/bfd/configure
index 9769387..e8fd5a9 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -14584,8 +14584,8 @@ do
     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" ;;
+    xtensa_elf32_be_vec)	 tb="$tb xtensa-config.lo xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
+    xtensa_elf32_le_vec)	 tb="$tb xtensa-config.lo xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
     z80_coff_vec)		 tb="$tb coff-z80.lo reloc16.lo $coffgen" ;;
     z8k_coff_vec)		 tb="$tb coff-z8k.lo reloc16.lo $coff" ;;
 
diff --git a/bfd/configure.ac b/bfd/configure.ac
index 9a183c1..ebf6a0e 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -715,8 +715,8 @@ do
     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" ;;
+    xtensa_elf32_be_vec)	 tb="$tb xtensa-config.lo xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
+    xtensa_elf32_le_vec)	 tb="$tb xtensa-config.lo xtensa-isa.lo xtensa-modules.lo elf32-xtensa.lo elf32.lo $elf" ;;
     z80_coff_vec)		 tb="$tb coff-z80.lo reloc16.lo $coffgen" ;;
     z8k_coff_vec)		 tb="$tb coff-z8k.lo reloc16.lo $coff" ;;
 
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index 078918f..c67e340 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -30,7 +30,7 @@
 #include "elf/xtensa.h"
 #include "splay-tree.h"
 #include "xtensa-isa.h"
-#include "xtensa-config.h"
+#include "xtensa-dynconfig.h"
 
 #define XTENSA_NO_NOP_REMOVAL 0
 
diff --git a/bfd/xtensa-config.c b/bfd/xtensa-config.c
new file mode 100644
index 0000000..fdbcca4
--- /dev/null
+++ b/bfd/xtensa-config.c
@@ -0,0 +1,84 @@
+#include "sysdep.h"
+#include "bfd.h"
+
+#if defined (HAVE_DLFCN_H)
+#include <dlfcn.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#define XTENSA_CONFIG_DEFINITION
+#include "xtensa-config.h"
+#include "xtensa-dynconfig.h"
+
+static struct xtensa_config xtensa_defconfig = XTENSA_CONFIG_INITIALIZER;
+
+void *xtensa_load_config (const char *name ATTRIBUTE_UNUSED, void *def)
+{
+  static int init;
+#if BFD_SUPPORTS_PLUGINS
+  static void *handle;
+  void *p;
+
+  if (!init)
+    {
+      char *path = getenv ("XTENSA_GNU_CONFIG");
+
+      init = 1;
+      if (!path)
+	return def;
+      handle = dlopen (path, RTLD_LAZY);
+      if (!handle)
+	{
+	  fprintf (stderr,
+		   "XTENSA_GNU_CONFIG is defined but could not be loaded: %s\n",
+		   dlerror ());
+	  abort ();
+	}
+    }
+  else if (!handle)
+    {
+      return def;
+    }
+
+  p = dlsym (handle, name);
+  if (!p)
+    {
+      fprintf (stderr,
+	       "XTENSA_GNU_CONFIG is loaded but symbol \"%s\" is not found: %s\n",
+	       name, dlerror ());
+      abort ();
+    }
+  return p;
+#else
+  if (!init)
+    {
+      char *path = getenv ("XTENSA_GNU_CONFIG");
+
+      init = 1;
+      if (path)
+	{
+	  fprintf (stderr,
+		   "XTENSA_GNU_CONFIG is defined but plugin support is disabled\n");
+	  abort ();
+	}
+    }
+  return def;
+#endif
+}
+
+struct xtensa_config *xtensa_get_config (void)
+{
+  static struct xtensa_config *config;
+
+  if (!config)
+    config = xtensa_load_config ("xtensa_config", &xtensa_defconfig);
+
+  if (config->config_size < sizeof(struct xtensa_config))
+    {
+      fprintf (stderr,
+	       "old or incompatible configuration is loaded: config_size = %ld, expected: %ld\n",
+	       config->config_size, sizeof (struct xtensa_config));
+      abort ();
+    }
+  return config;
+}
diff --git a/gas/config/tc-xtensa.c b/gas/config/tc-xtensa.c
index ed7ba0a..0a491c3 100644
--- a/gas/config/tc-xtensa.c
+++ b/gas/config/tc-xtensa.c
@@ -28,7 +28,7 @@
 #include "dwarf2dbg.h"
 #include "xtensa-istack.h"
 #include "struc-symbol.h"
-#include "xtensa-config.h"
+#include "xtensa-dynconfig.h"
 #include "elf/xtensa.h"
 
 /* Provide default values for new configuration settings.  */
diff --git a/gas/config/tc-xtensa.h b/gas/config/tc-xtensa.h
index 69a5c8a..7dd225d 100644
--- a/gas/config/tc-xtensa.h
+++ b/gas/config/tc-xtensa.h
@@ -28,7 +28,7 @@ struct fix;
 #endif
 
 #include "xtensa-isa.h"
-#include "xtensa-config.h"
+#include "xtensa-dynconfig.h"
 
 #define TARGET_BYTES_BIG_ENDIAN 0
 
diff --git a/gas/config/xtensa-relax.c b/gas/config/xtensa-relax.c
index f54cf79..2914857 100644
--- a/gas/config/xtensa-relax.c
+++ b/gas/config/xtensa-relax.c
@@ -99,7 +99,7 @@
 #include "xtensa-isa.h"
 #include "xtensa-relax.h"
 #include <stddef.h>
-#include "xtensa-config.h"
+#include "xtensa-dynconfig.h"
 
 #ifndef XCHAL_HAVE_WIDE_BRANCHES
 #define XCHAL_HAVE_WIDE_BRANCHES 0
diff --git a/include/xtensa-dynconfig.h b/include/xtensa-dynconfig.h
new file mode 100644
index 0000000..12181be
--- /dev/null
+++ b/include/xtensa-dynconfig.h
@@ -0,0 +1,373 @@
+/* Xtensa configuration settings.
+   Copyright (C) 2017 Free Software Foundation, Inc.
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, 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.  */
+
+#ifndef XTENSA_DYNAMIC_CONFIG_H
+#define XTENSA_DYNAMIC_CONFIG_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct xtensa_config {
+    unsigned long config_size;
+    unsigned int xchal_have_be;
+    unsigned int xchal_have_density;
+    unsigned int xchal_have_const16;
+    unsigned int xchal_have_abs;
+    unsigned int xchal_have_addx;
+    unsigned int xchal_have_l32r;
+    unsigned int xshal_use_absolute_literals;
+    unsigned int xshal_have_text_section_literals;
+    unsigned int xchal_have_mac16;
+    unsigned int xchal_have_mul16;
+    unsigned int xchal_have_mul32;
+    unsigned int xchal_have_mul32_high;
+    unsigned int xchal_have_div32;
+    unsigned int xchal_have_nsa;
+    unsigned int xchal_have_minmax;
+    unsigned int xchal_have_sext;
+    unsigned int xchal_have_loops;
+    unsigned int xchal_have_threadptr;
+    unsigned int xchal_have_release_sync;
+    unsigned int xchal_have_s32c1i;
+    unsigned int xchal_have_booleans;
+    unsigned int xchal_have_fp;
+    unsigned int xchal_have_fp_div;
+    unsigned int xchal_have_fp_recip;
+    unsigned int xchal_have_fp_sqrt;
+    unsigned int xchal_have_fp_rsqrt;
+    unsigned int xchal_have_fp_postinc;
+    unsigned int xchal_have_dfp;
+    unsigned int xchal_have_dfp_div;
+    unsigned int xchal_have_dfp_recip;
+    unsigned int xchal_have_dfp_sqrt;
+    unsigned int xchal_have_dfp_rsqrt;
+    unsigned int xchal_have_windowed;
+    unsigned int xchal_num_aregs;
+    unsigned int xchal_have_wide_branches;
+    unsigned int xchal_have_predicted_branches;
+    unsigned int xchal_icache_size;
+    unsigned int xchal_dcache_size;
+    unsigned int xchal_icache_linesize;
+    unsigned int xchal_dcache_linesize;
+    unsigned int xchal_icache_linewidth;
+    unsigned int xchal_dcache_linewidth;
+    unsigned int xchal_dcache_is_writeback;
+    unsigned int xchal_have_mmu;
+    unsigned int xchal_mmu_min_pte_page_size;
+    unsigned int xchal_have_debug;
+    unsigned int xchal_num_ibreak;
+    unsigned int xchal_num_dbreak;
+    unsigned int xchal_debuglevel;
+    unsigned int xchal_max_instruction_size;
+    unsigned int xchal_inst_fetch_width;
+    unsigned int xshal_abi;
+    unsigned int xthal_abi_windowed;
+    unsigned int xthal_abi_call0;
+};
+
+typedef struct xtensa_isa_internal_struct xtensa_isa_internal;
+
+extern void *xtensa_load_config (const char *name, void *def);
+extern struct xtensa_config *xtensa_get_config (void);
+
+#ifdef XTENSA_CONFIG_DEFINITION
+
+#ifndef XCHAL_HAVE_MUL32_HIGH
+#define XCHAL_HAVE_MUL32_HIGH 0
+#endif
+
+#ifndef XCHAL_HAVE_RELEASE_SYNC
+#define XCHAL_HAVE_RELEASE_SYNC 0
+#endif
+
+#ifndef XCHAL_HAVE_S32C1I
+#define XCHAL_HAVE_S32C1I 0
+#endif
+
+#ifndef XCHAL_HAVE_THREADPTR
+#define XCHAL_HAVE_THREADPTR 0
+#endif
+
+#ifndef XCHAL_HAVE_FP_POSTINC
+#define XCHAL_HAVE_FP_POSTINC 0
+#endif
+
+#ifndef XCHAL_HAVE_DFP
+#define XCHAL_HAVE_DFP 0
+#endif
+
+#ifndef XCHAL_HAVE_DFP_DIV
+#define XCHAL_HAVE_DFP_DIV 0
+#endif
+
+#ifndef XCHAL_HAVE_DFP_RECIP
+#define XCHAL_HAVE_DFP_RECIP 0
+#endif
+
+#ifndef XCHAL_HAVE_DFP_SQRT
+#define XCHAL_HAVE_DFP_SQRT 0
+#endif
+
+#ifndef XCHAL_HAVE_DFP_RSQRT
+#define XCHAL_HAVE_DFP_RSQRT 0
+#endif
+
+#ifndef XSHAL_HAVE_TEXT_SECTION_LITERALS
+#define XSHAL_HAVE_TEXT_SECTION_LITERALS 0
+#endif
+
+#ifndef XCHAL_MMU_MIN_PTE_PAGE_SIZE
+#define XCHAL_MMU_MIN_PTE_PAGE_SIZE 1
+#endif
+
+#define XTENSA_CONFIG_ENTRY(a) a
+
+#define XTENSA_CONFIG_ENTRY_LIST \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_BE), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_DENSITY), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_CONST16), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_ABS), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_ADDX), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_L32R), \
+    XTENSA_CONFIG_ENTRY(XSHAL_USE_ABSOLUTE_LITERALS), \
+    XTENSA_CONFIG_ENTRY(XSHAL_HAVE_TEXT_SECTION_LITERALS), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_MAC16), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_MUL16), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_MUL32), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_MUL32_HIGH), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_DIV32), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_NSA), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_MINMAX), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_SEXT), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_LOOPS), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_THREADPTR), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_RELEASE_SYNC), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_S32C1I), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_BOOLEANS), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_FP), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_FP_DIV), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_FP_RECIP), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_FP_SQRT), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_FP_RSQRT), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_FP_POSTINC), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_DFP), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_DFP_DIV), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_DFP_RECIP), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_DFP_SQRT), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_DFP_RSQRT), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_WINDOWED), \
+    XTENSA_CONFIG_ENTRY(XCHAL_NUM_AREGS), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_WIDE_BRANCHES), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_PREDICTED_BRANCHES), \
+    XTENSA_CONFIG_ENTRY(XCHAL_ICACHE_SIZE), \
+    XTENSA_CONFIG_ENTRY(XCHAL_DCACHE_SIZE), \
+    XTENSA_CONFIG_ENTRY(XCHAL_ICACHE_LINESIZE), \
+    XTENSA_CONFIG_ENTRY(XCHAL_DCACHE_LINESIZE), \
+    XTENSA_CONFIG_ENTRY(XCHAL_ICACHE_LINEWIDTH), \
+    XTENSA_CONFIG_ENTRY(XCHAL_DCACHE_LINEWIDTH), \
+    XTENSA_CONFIG_ENTRY(XCHAL_DCACHE_IS_WRITEBACK), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_MMU), \
+    XTENSA_CONFIG_ENTRY(XCHAL_MMU_MIN_PTE_PAGE_SIZE), \
+    XTENSA_CONFIG_ENTRY(XCHAL_HAVE_DEBUG), \
+    XTENSA_CONFIG_ENTRY(XCHAL_NUM_IBREAK), \
+    XTENSA_CONFIG_ENTRY(XCHAL_NUM_DBREAK), \
+    XTENSA_CONFIG_ENTRY(XCHAL_DEBUGLEVEL), \
+    XTENSA_CONFIG_ENTRY(XCHAL_MAX_INSTRUCTION_SIZE), \
+    XTENSA_CONFIG_ENTRY(XCHAL_INST_FETCH_WIDTH), \
+    XTENSA_CONFIG_ENTRY(XSHAL_ABI), \
+    XTENSA_CONFIG_ENTRY(XTHAL_ABI_WINDOWED), \
+    XTENSA_CONFIG_ENTRY(XTHAL_ABI_CALL0)
+
+#define XTENSA_CONFIG_INITIALIZER { \
+    sizeof (struct xtensa_config), \
+    XTENSA_CONFIG_ENTRY_LIST, \
+}
+
+#else /* XTENSA_CONFIG_DEFINITION */
+
+#undef XCHAL_HAVE_BE
+#define XCHAL_HAVE_BE			(xtensa_get_config ()->xchal_have_be)
+
+#undef XCHAL_HAVE_DENSITY
+#define XCHAL_HAVE_DENSITY		(xtensa_get_config ()->xchal_have_density)
+
+#undef XCHAL_HAVE_CONST16
+#define XCHAL_HAVE_CONST16		(xtensa_get_config ()->xchal_have_const16)
+
+#undef XCHAL_HAVE_ABS
+#define XCHAL_HAVE_ABS			(xtensa_get_config ()->xchal_have_abs)
+
+#undef XCHAL_HAVE_ADDX
+#define XCHAL_HAVE_ADDX			(xtensa_get_config ()->xchal_have_addx)
+
+#undef XCHAL_HAVE_L32R
+#define XCHAL_HAVE_L32R			(xtensa_get_config ()->xchal_have_l32r)
+
+#undef XSHAL_USE_ABSOLUTE_LITERALS
+#define XSHAL_USE_ABSOLUTE_LITERALS	(xtensa_get_config ()->xshal_use_absolute_literals)
+
+#undef XSHAL_HAVE_TEXT_SECTION_LITERALS
+#define XSHAL_HAVE_TEXT_SECTION_LITERALS (xtensa_get_config ()->xshal_have_text_section_literals)
+
+#undef XCHAL_HAVE_MAC16
+#define XCHAL_HAVE_MAC16		(xtensa_get_config ()->xchal_have_mac16)
+
+#undef XCHAL_HAVE_MUL16
+#define XCHAL_HAVE_MUL16		(xtensa_get_config ()->xchal_have_mul16)
+
+#undef XCHAL_HAVE_MUL32
+#define XCHAL_HAVE_MUL32		(xtensa_get_config ()->xchal_have_mul32)
+
+#undef XCHAL_HAVE_MUL32_HIGH
+#define XCHAL_HAVE_MUL32_HIGH		(xtensa_get_config ()->xchal_have_mul32_high)
+
+#undef XCHAL_HAVE_DIV32
+#define XCHAL_HAVE_DIV32		(xtensa_get_config ()->xchal_have_div32)
+
+#undef XCHAL_HAVE_NSA
+#define XCHAL_HAVE_NSA			(xtensa_get_config ()->xchal_have_nsa)
+
+#undef XCHAL_HAVE_MINMAX
+#define XCHAL_HAVE_MINMAX		(xtensa_get_config ()->xchal_have_minmax)
+
+#undef XCHAL_HAVE_SEXT
+#define XCHAL_HAVE_SEXT			(xtensa_get_config ()->xchal_have_sext)
+
+#undef XCHAL_HAVE_LOOPS
+#define XCHAL_HAVE_LOOPS		(xtensa_get_config ()->xchal_have_loops)
+
+#undef XCHAL_HAVE_THREADPTR
+#define XCHAL_HAVE_THREADPTR		(xtensa_get_config ()->xchal_have_threadptr)
+
+#undef XCHAL_HAVE_RELEASE_SYNC
+#define XCHAL_HAVE_RELEASE_SYNC		(xtensa_get_config ()->xchal_have_release_sync)
+
+#undef XCHAL_HAVE_S32C1I
+#define XCHAL_HAVE_S32C1I		(xtensa_get_config ()->xchal_have_s32c1i)
+
+#undef XCHAL_HAVE_BOOLEANS
+#define XCHAL_HAVE_BOOLEANS		(xtensa_get_config ()->xchal_have_booleans)
+
+#undef XCHAL_HAVE_FP
+#define XCHAL_HAVE_FP			(xtensa_get_config ()->xchal_have_fp)
+
+#undef XCHAL_HAVE_FP_DIV
+#define XCHAL_HAVE_FP_DIV		(xtensa_get_config ()->xchal_have_fp_div)
+
+#undef XCHAL_HAVE_FP_RECIP
+#define XCHAL_HAVE_FP_RECIP		(xtensa_get_config ()->xchal_have_fp_recip)
+
+#undef XCHAL_HAVE_FP_SQRT
+#define XCHAL_HAVE_FP_SQRT		(xtensa_get_config ()->xchal_have_fp_sqrt)
+
+#undef XCHAL_HAVE_FP_RSQRT
+#define XCHAL_HAVE_FP_RSQRT		(xtensa_get_config ()->xchal_have_fp_rsqrt)
+
+#undef XCHAL_HAVE_FP_POSTINC
+#define XCHAL_HAVE_FP_POSTINC		(xtensa_get_config ()->xchal_have_fp_postinc)
+
+#undef XCHAL_HAVE_DFP
+#define XCHAL_HAVE_DFP			(xtensa_get_config ()->xchal_have_dfp)
+
+#undef XCHAL_HAVE_DFP_DIV
+#define XCHAL_HAVE_DFP_DIV		(xtensa_get_config ()->xchal_have_dfp_div)
+
+#undef XCHAL_HAVE_DFP_RECIP
+#define XCHAL_HAVE_DFP_RECIP		(xtensa_get_config ()->xchal_have_dfp_recip)
+
+#undef XCHAL_HAVE_DFP_SQRT
+#define XCHAL_HAVE_DFP_SQRT		(xtensa_get_config ()->xchal_have_dfp_sqrt)
+
+#undef XCHAL_HAVE_DFP_RSQRT
+#define XCHAL_HAVE_DFP_RSQRT		(xtensa_get_config ()->xchal_have_dfp_rsqrt)
+
+#undef XCHAL_HAVE_WINDOWED
+#define XCHAL_HAVE_WINDOWED		(xtensa_get_config ()->xchal_have_windowed)
+
+#undef XCHAL_NUM_AREGS
+#define XCHAL_NUM_AREGS			(xtensa_get_config ()->xchal_num_aregs)
+
+#undef XCHAL_HAVE_WIDE_BRANCHES
+#define XCHAL_HAVE_WIDE_BRANCHES	(xtensa_get_config ()->xchal_have_wide_branches)
+
+#undef XCHAL_HAVE_PREDICTED_BRANCHES
+#define XCHAL_HAVE_PREDICTED_BRANCHES	(xtensa_get_config ()->xchal_have_predicted_branches)
+
+
+#undef XCHAL_ICACHE_SIZE
+#define XCHAL_ICACHE_SIZE		(xtensa_get_config ()->xchal_icache_size)
+
+#undef XCHAL_DCACHE_SIZE
+#define XCHAL_DCACHE_SIZE		(xtensa_get_config ()->xchal_dcache_size)
+
+#undef XCHAL_ICACHE_LINESIZE
+#define XCHAL_ICACHE_LINESIZE		(xtensa_get_config ()->xchal_icache_linesize)
+
+#undef XCHAL_DCACHE_LINESIZE
+#define XCHAL_DCACHE_LINESIZE		(xtensa_get_config ()->xchal_dcache_linesize)
+
+#undef XCHAL_ICACHE_LINEWIDTH
+#define XCHAL_ICACHE_LINEWIDTH		(xtensa_get_config ()->xchal_icache_linewidth)
+
+#undef XCHAL_DCACHE_LINEWIDTH
+#define XCHAL_DCACHE_LINEWIDTH		(xtensa_get_config ()->xchal_dcache_linewidth)
+
+#undef XCHAL_DCACHE_IS_WRITEBACK
+#define XCHAL_DCACHE_IS_WRITEBACK	(xtensa_get_config ()->xchal_dcache_is_writeback)
+
+
+#undef XCHAL_HAVE_MMU
+#define XCHAL_HAVE_MMU			(xtensa_get_config ()->xchal_have_mmu)
+
+#undef XCHAL_MMU_MIN_PTE_PAGE_SIZE
+#define XCHAL_MMU_MIN_PTE_PAGE_SIZE	(xtensa_get_config ()->xchal_mmu_min_pte_page_size)
+
+
+#undef XCHAL_HAVE_DEBUG
+#define XCHAL_HAVE_DEBUG		(xtensa_get_config ()->xchal_have_debug)
+
+#undef XCHAL_NUM_IBREAK
+#define XCHAL_NUM_IBREAK		(xtensa_get_config ()->xchal_num_ibreak)
+
+#undef XCHAL_NUM_DBREAK
+#define XCHAL_NUM_DBREAK		(xtensa_get_config ()->xchal_num_dbreak)
+
+#undef XCHAL_DEBUGLEVEL
+#define XCHAL_DEBUGLEVEL		(xtensa_get_config ()->xchal_debuglevel)
+
+
+#undef XCHAL_MAX_INSTRUCTION_SIZE
+#define XCHAL_MAX_INSTRUCTION_SIZE	(xtensa_get_config ()->xchal_max_instruction_size)
+
+#undef XCHAL_INST_FETCH_WIDTH
+#define XCHAL_INST_FETCH_WIDTH		(xtensa_get_config ()->xchal_inst_fetch_width)
+
+
+#undef XSHAL_ABI
+#undef XTHAL_ABI_WINDOWED
+#undef XTHAL_ABI_CALL0
+#define XSHAL_ABI			(xtensa_get_config ()->xshal_abi)
+#define XTHAL_ABI_WINDOWED		(xtensa_get_config ()->xthal_abi_windowed)
+#define XTHAL_ABI_CALL0			(xtensa_get_config ()->xthal_abi_call0)
+
+#endif /* XTENSA_CONFIG_DEFINITION */
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* !XTENSA_DYNAMIC_CONFIG_H */
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 15beaa7..40ebcae 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -1327,6 +1327,7 @@ eelf32xstormy16.c: $(srcdir)/emulparams/elf32xstormy16.sh \
 
 eelf32xtensa.c: $(srcdir)/emulparams/elf32xtensa.sh $(ELF_DEPS) \
   $(srcdir)/emultempl/xtensaelf.em $(INCDIR)/xtensa-config.h \
+  $(INCDIR)/xtensa-dynconfig.h \
   $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/xtensa.h \
   $(srcdir)/scripttempl/elfxtensa.sc ${GEN_DEPENDS}
 
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 042b690..726f14d 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -2920,6 +2920,7 @@ eelf32xstormy16.c: $(srcdir)/emulparams/elf32xstormy16.sh \
 
 eelf32xtensa.c: $(srcdir)/emulparams/elf32xtensa.sh $(ELF_DEPS) \
   $(srcdir)/emultempl/xtensaelf.em $(INCDIR)/xtensa-config.h \
+  $(INCDIR)/xtensa-dynconfig.h \
   $(BFDDIR)/elf-bfd.h $(INCDIR)/elf/xtensa.h \
   $(srcdir)/scripttempl/elfxtensa.sc ${GEN_DEPENDS}
 
diff --git a/ld/emultempl/xtensaelf.em b/ld/emultempl/xtensaelf.em
index 080b66d..1199399 100644
--- a/ld/emultempl/xtensaelf.em
+++ b/ld/emultempl/xtensaelf.em
@@ -24,7 +24,7 @@
 #
 fragment <<EOF
 
-#include <xtensa-config.h>
+#include <xtensa-dynconfig.h>
 #include "../bfd/elf-bfd.h"
 #include "elf/xtensa.h"
 #include "bfd.h"
-- 
2.1.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [RFC 4/5] xtensa: make xtensa_modules dynamic
  2017-05-22 21:12 [RFC 0/5] xtensa: support dynamic configuration Max Filippov
                   ` (2 preceding siblings ...)
  2017-05-22 21:12 ` [RFC 3/5] xtensa: support dynconfig on windows Max Filippov
@ 2017-05-22 21:13 ` Max Filippov
  2017-06-12 15:49   ` Nick Clifton
  2017-05-22 21:13 ` [RFC 5/5] gdb: xtensa: make tdep and linux-nat dynamically configurable Max Filippov
  2017-06-06 12:41 ` [RFC 0/5] xtensa: support dynamic configuration Nick Clifton
  5 siblings, 1 reply; 15+ messages in thread
From: Max Filippov @ 2017-05-22 21:13 UTC (permalink / raw)
  To: binutils, gdb-patches
  Cc: Sterling Augustine, David Weatherford, Maxim Grigoriev,
	Woody LaRue, Max Filippov

2017-05-22  Max Filippov  <jcmvbkbc@gmail.com>
bfd/
	* xtensa-isa.c (xtensa-dynconfig.h): New #include'd header.
	(xtensa_get_modules): New function.
	(xtensa_isa_init): Call xtensa_get_modules instead of taking
	address of global xtensa_modules.
---
 bfd/xtensa-isa.c | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/bfd/xtensa-isa.c b/bfd/xtensa-isa.c
index 8da75be..79fb76b 100644
--- a/bfd/xtensa-isa.c
+++ b/bfd/xtensa-isa.c
@@ -23,6 +23,7 @@
 #include "libbfd.h"
 #include "xtensa-isa.h"
 #include "xtensa-isa-internal.h"
+#include "xtensa-dynconfig.h"
 
 xtensa_isa_status xtisa_errno;
 char xtisa_error_msg[1024];
@@ -233,10 +234,20 @@ xtensa_insnbuf_from_chars (xtensa_isa isa,
 
 extern xtensa_isa_internal xtensa_modules;
 
+static xtensa_isa_internal *xtensa_get_modules (void)
+{
+  static xtensa_isa_internal *modules;
+
+  if (!modules)
+    modules = xtensa_load_config ("xtensa_modules", &xtensa_modules);
+
+  return modules;
+}
+
 xtensa_isa
 xtensa_isa_init (xtensa_isa_status *errno_p, char **error_msg_p)
 {
-  xtensa_isa_internal *isa = &xtensa_modules;
+  xtensa_isa_internal *isa = xtensa_get_modules ();
   int n, is_user;
 
   /* Set up the opcode name lookup table.  */
-- 
2.1.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [RFC 5/5] gdb: xtensa: make tdep and linux-nat dynamically configurable
  2017-05-22 21:12 [RFC 0/5] xtensa: support dynamic configuration Max Filippov
                   ` (3 preceding siblings ...)
  2017-05-22 21:13 ` [RFC 4/5] xtensa: make xtensa_modules dynamic Max Filippov
@ 2017-05-22 21:13 ` Max Filippov
  2017-06-06 12:41 ` [RFC 0/5] xtensa: support dynamic configuration Nick Clifton
  5 siblings, 0 replies; 15+ messages in thread
From: Max Filippov @ 2017-05-22 21:13 UTC (permalink / raw)
  To: binutils, gdb-patches
  Cc: Sterling Augustine, David Weatherford, Maxim Grigoriev,
	Woody LaRue, Max Filippov

Don't use xtensa_tdep directly, use function xtensa_config_get_tdep that
potentially loads dynamic configuration and returns xtensa tdep pointer
from there.

Don't use xtensa_regmap_table directly, use function
xtensa_config_get_regmap_table that potentially loads dynamic
configuration and returns regmap table from there.

gdb/
2017-05-22  Max Filippov  <jcmvbkbc@gmail.com>

	* xtensa-linux-nat.c (xtensa-dynconfig.h): New #include'd
	header.
	(xtensa_config_get_regmap_table): New function.
	(fetch_xtregs, store_xtregs, _initialize_xtensa_linux_nat): Call
	xtensa_config_get_regmap_table instead of taking address of
	xtensa_regmap_table.
	* xtensa-tdep.c (xtensa-dynconfig.h): New #include'd header.
	(xtensa_config_get_tdep): New function.
	(xtensa_gdbarch_init): Call xtensa_config_get_tdep instead of
	taking address of xtensa_tdep.
---
 gdb/xtensa-linux-nat.c | 18 +++++++++++++++---
 gdb/xtensa-tdep.c      | 13 +++++++++++--
 2 files changed, 26 insertions(+), 5 deletions(-)

diff --git a/gdb/xtensa-linux-nat.c b/gdb/xtensa-linux-nat.c
index 836d3f8..7190e37 100644
--- a/gdb/xtensa-linux-nat.c
+++ b/gdb/xtensa-linux-nat.c
@@ -44,6 +44,18 @@
    Keeping these definitions separately allows to introduce
    hardware-specific overlays.  */
 #include "xtensa-xtregs.c"
+#include "xtensa-dynconfig.h"
+
+static xtensa_regtable_t *xtensa_config_get_regmap_table (void)
+{
+  static xtensa_regtable_t *regtable;
+
+  if (!regtable)
+    regtable = (xtensa_regtable_t *) xtensa_load_config
+      ("xtensa_regmap_table", &xtensa_regmap_table);
+
+  return regtable;
+}
 
 void
 fill_gregset (const struct regcache *regcache,
@@ -228,7 +240,7 @@ fetch_xtregs (struct regcache *regcache, int regnum)
   if (ptrace (PTRACE_GETXTREGS, tid, 0, (long)&xtregs) < 0)
     perror_with_name (_("Couldn't get extended registers"));
 
-  for (ptr = xtensa_regmap_table; ptr->name; ptr++)
+  for (ptr = xtensa_config_get_regmap_table (); ptr->name; ptr++)
     if (regnum == ptr->gdb_regnum || regnum == -1)
       regcache_raw_supply (regcache, ptr->gdb_regnum,
 			   xtregs + ptr->ptrace_offset);
@@ -244,7 +256,7 @@ store_xtregs (struct regcache *regcache, int regnum)
   if (ptrace (PTRACE_GETXTREGS, tid, 0, (long)&xtregs) < 0)
     perror_with_name (_("Couldn't get extended registers"));
 
-  for (ptr = xtensa_regmap_table; ptr->name; ptr++)
+  for (ptr = xtensa_config_get_regmap_table (); ptr->name; ptr++)
     if (regnum == ptr->gdb_regnum || regnum == -1)
       regcache_raw_collect (regcache, ptr->gdb_regnum,
 			    xtregs + ptr->ptrace_offset);
@@ -313,7 +325,7 @@ _initialize_xtensa_linux_nat (void)
   /* Calculate the number range for extended registers.  */
   xtreg_lo = 1000000000;
   xtreg_high = -1;
-  for (ptr = xtensa_regmap_table; ptr->name; ptr++)
+  for (ptr = xtensa_config_get_regmap_table (); ptr->name; ptr++)
     {
       if (ptr->gdb_regnum < xtreg_lo)
 	xtreg_lo = ptr->gdb_regnum;
diff --git a/gdb/xtensa-tdep.c b/gdb/xtensa-tdep.c
index e47c90a..f99ed90 100644
--- a/gdb/xtensa-tdep.c
+++ b/gdb/xtensa-tdep.c
@@ -51,7 +51,7 @@
 
 #include "xtensa-isa.h"
 #include "xtensa-tdep.h"
-#include "xtensa-config.h"
+#include "xtensa-dynconfig.h"
 #include <algorithm>
 
 
@@ -3184,6 +3184,15 @@ xtensa_derive_tdep (struct gdbarch_tdep *tdep)
 /* Module "constructor" function.  */
 
 extern struct gdbarch_tdep xtensa_tdep;
+static struct gdbarch_tdep *xtensa_config_get_tdep (void)
+{
+  static struct gdbarch_tdep *tdep;
+
+  if (!tdep)
+    tdep = (struct gdbarch_tdep *) xtensa_load_config ("xtensa_tdep",
+						       &xtensa_tdep);
+  return tdep;
+}
 
 static struct gdbarch *
 xtensa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
@@ -3196,7 +3205,7 @@ xtensa_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   /* We have to set the byte order before we call gdbarch_alloc.  */
   info.byte_order = XCHAL_HAVE_BE ? BFD_ENDIAN_BIG : BFD_ENDIAN_LITTLE;
 
-  tdep = &xtensa_tdep;
+  tdep = xtensa_config_get_tdep ();
   gdbarch = gdbarch_alloc (&info, tdep);
   xtensa_derive_tdep (tdep);
 
-- 
2.1.4

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC 1/5] xtensa: don't expect XCHAL_* macros to be constant
  2017-05-22 21:12 ` [RFC 1/5] xtensa: don't expect XCHAL_* macros to be constant Max Filippov
@ 2017-05-26 17:36   ` augustine.sterling
  0 siblings, 0 replies; 15+ messages in thread
From: augustine.sterling @ 2017-05-26 17:36 UTC (permalink / raw)
  To: Max Filippov
  Cc: binutils, gdb-patches, David Weatherford, Maxim Grigoriev, Woody LaRue

On Mon, May 22, 2017 at 2:12 PM, Max Filippov <jcmvbkbc@gmail.com> wrote:
> Get rid of the assumption that XCHAL_* macros are preprocessor
> constants: don't use them in preprocessor conditionals or in static
> variable initializers.
>
> 2017-05-22  Max Filippov  <jcmvbkbc@gmail.com>
> bfd/
>         * elf32-xtensa.c (elf_xtensa_be_plt_entry,
>         elf_xtensa_le_plt_entry): Add dimension for the ABI to arrays,
>         keep both windowed and call0 ABI PLT definitions.
>         (elf_xtensa_create_plt_entry): Use selected ABI to choose upper
>         elf_xtensa_*_plt_entry endex.
>         (ELF_MAXPAGESIZE): Fix at minimal supported MMU page size.
>
> gas/
>         * config/tc-xtensa.c (density_supported, xtensa_fetch_width,
>         absolute_literals_supported): Leave definitions uninitialized.
>         (directive_state): Leave entries for directive_density and
>         directive_absolute_literals initialized to false.
>         (xg_init_global_config, xtensa_init): New functions.
>         * config/tc-xtensa.h (TARGET_BYTES_BIG_ENDIAN): Define as 0.
>         (HOST_SPECIAL_INIT): New definition.
>         (xtensa_init): New declaration.

This is ok.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC 2/5] xtensa: make configuration dynamic
  2017-05-22 21:12 ` [RFC 2/5] xtensa: make configuration dynamic Max Filippov
@ 2017-05-26 18:10   ` augustine.sterling
  2017-05-26 18:15     ` augustine.sterling
  0 siblings, 1 reply; 15+ messages in thread
From: augustine.sterling @ 2017-05-26 18:10 UTC (permalink / raw)
  To: Max Filippov
  Cc: binutils, gdb-patches, David Weatherford, Maxim Grigoriev, Woody LaRue

On Mon, May 22, 2017 at 2:12 PM, Max Filippov <jcmvbkbc@gmail.com> wrote:
> Now that XCHAL_* macros don't have to be preprocessor constants add
> include/xtensa-dynconfig.h that defines them as fields of a structure
> returned from the xtensa_get_config function.
> Define that structure and fill it with default parameter values
> specified in the include/xtensa-config.h.
> Define reusable function xtensa_load_config that tries to load
> configuration and return an address of an exported object from it.
> Define the function xtensa_get_config that uses xtensa_load_config to
> get structure xtensa_config, either dynamically configured or the
> default.
>
> 2017-05-22  Max Filippov  <jcmvbkbc@gmail.com>
> bfd/
>         * Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Append
>         xtensa-config.c.
>         * Makefile.in: Regenerate.
>         * configure: Regenerate.
>         * configure.ac (xtensa_elf32_be_vec, xtensa_elf32_le_vec): Add
>         xtensa-config.lo to the tb.
>         * elf32-xtensa.c (xtensa-config.h): Replace #include with
>         xtensa-dynconfig.h.
>         * xtensa-config.c: New file.
>
> gas/
>         * config/tc-xtensa.c (xtensa-config.h): Replace #include with
>         xtensa-dynconfig.h.
>         * config/tc-xtensa.h: Likewise.
>         * config/xtensa-relax.c: Likewise.
>
> include/
>         * xtensa-dynconfig.h: New file.
>
> ld/
>         * Makefile.am (eelf32xtensa.c): Add $(INCDIR)/xtensa-dynconfig.h
>         to the list of dependencies.
>         * Makefile.in: Regenerate.
>         * emultempl/xtensaelf.em (xtensa-config.h): Replace #include
>         with xtensa-dynconfig.h.

This is ok.

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC 2/5] xtensa: make configuration dynamic
  2017-05-26 18:10   ` augustine.sterling
@ 2017-05-26 18:15     ` augustine.sterling
  2017-06-06 12:53       ` Nick Clifton
  0 siblings, 1 reply; 15+ messages in thread
From: augustine.sterling @ 2017-05-26 18:15 UTC (permalink / raw)
  To: Max Filippov
  Cc: binutils, gdb-patches, David Weatherford, Maxim Grigoriev, Woody LaRue

On Fri, May 26, 2017 at 11:10 AM, augustine.sterling@gmail.com
<augustine.sterling@gmail.com> wrote:
> On Mon, May 22, 2017 at 2:12 PM, Max Filippov <jcmvbkbc@gmail.com> wrote:
>> Now that XCHAL_* macros don't have to be preprocessor constants add
>> include/xtensa-dynconfig.h that defines them as fields of a structure
>> returned from the xtensa_get_config function.
>> Define that structure and fill it with default parameter values
>> specified in the include/xtensa-config.h.
>> Define reusable function xtensa_load_config that tries to load
>> configuration and return an address of an exported object from it.
>> Define the function xtensa_get_config that uses xtensa_load_config to
>> get structure xtensa_config, either dynamically configured or the
>> default.
>>
>> 2017-05-22  Max Filippov  <jcmvbkbc@gmail.com>
>> bfd/
>>         * Makefile.am (BFD32_BACKENDS, BFD32_BACKENDS_CFILES): Append
>>         xtensa-config.c.
>>         * Makefile.in: Regenerate.
>>         * configure: Regenerate.
>>         * configure.ac (xtensa_elf32_be_vec, xtensa_elf32_le_vec): Add
>>         xtensa-config.lo to the tb.
>>         * elf32-xtensa.c (xtensa-config.h): Replace #include with
>>         xtensa-dynconfig.h.
>>         * xtensa-config.c: New file.
>>
>> gas/
>>         * config/tc-xtensa.c (xtensa-config.h): Replace #include with
>>         xtensa-dynconfig.h.
>>         * config/tc-xtensa.h: Likewise.
>>         * config/xtensa-relax.c: Likewise.
>>
>> include/
>>         * xtensa-dynconfig.h: New file.
>>
>> ld/
>>         * Makefile.am (eelf32xtensa.c): Add $(INCDIR)/xtensa-dynconfig.h
>>         to the list of dependencies.
>>         * Makefile.in: Regenerate.
>>         * emultempl/xtensaelf.em (xtensa-config.h): Replace #include
>>         with xtensa-dynconfig.h.
>
> This is ok.

Actually, check that. I missed that this does both the refactoring
necessary to add a plugin mechanism and actually adds the plugin
mechanism.

So: This introduces a plugin mechanism to gdb and binutils. That needs
a higher-level discussion regarding licensing and plugin mechanisms
generally, but from the general maintainers of both binutils and gdb.

Would one of the general maintainers review this please?

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC 0/5] xtensa: support dynamic configuration
  2017-05-22 21:12 [RFC 0/5] xtensa: support dynamic configuration Max Filippov
                   ` (4 preceding siblings ...)
  2017-05-22 21:13 ` [RFC 5/5] gdb: xtensa: make tdep and linux-nat dynamically configurable Max Filippov
@ 2017-06-06 12:41 ` Nick Clifton
  2017-06-07 19:23   ` Max Filippov
  5 siblings, 1 reply; 15+ messages in thread
From: Nick Clifton @ 2017-06-06 12:41 UTC (permalink / raw)
  To: Max Filippov, binutils, gdb-patches
  Cc: Sterling Augustine, David Weatherford, Maxim Grigoriev, Woody LaRue

Hi Max,

> Built toolchain takes configuration
> parameters from the shared object specified in the environment variable.

Using environment variables to pass configuration information is a bad idea.

The problem is that it can be very hard to debug problems when environment
variables are involved.  Often they are not included in bug reports, which
makes reproducing the problem tricky.

At the very least you should also provide a command line option which 
specifies the path to a file containing the configuration information.  If
specified this option should override the environment variable.

There is also the issue of versioning to consider.  Does the configuration
information contain a version number ?  What happens if the configuration
information is out of date with respect to the compiler/linker or if the 
tools are older than the configuration information ?

Cheers
  Nick


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC 2/5] xtensa: make configuration dynamic
  2017-05-26 18:15     ` augustine.sterling
@ 2017-06-06 12:53       ` Nick Clifton
  2017-06-07 19:13         ` Max Filippov
  0 siblings, 1 reply; 15+ messages in thread
From: Nick Clifton @ 2017-06-06 12:53 UTC (permalink / raw)
  To: augustine.sterling, Max Filippov
  Cc: binutils, gdb-patches, David Weatherford, Maxim Grigoriev, Woody LaRue

Hi Augustine, Hi Max,

> Actually, check that. I missed that this does both the refactoring
> necessary to add a plugin mechanism and actually adds the plugin
> mechanism.
> 
> So: This introduces a plugin mechanism to gdb and binutils. That needs
> a higher-level discussion regarding licensing and plugin mechanisms
> generally, but from the general maintainers of both binutils and gdb.
> 
> Would one of the general maintainers review this please?

Well the binutils already has a plugin support, so this patch is just
adding the ability for a different type of plugin to be used.  I am OK
with that, providing that the plugin itself is also licensed under the
GPL v3.

Cheers
  Nick

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC 2/5] xtensa: make configuration dynamic
  2017-06-06 12:53       ` Nick Clifton
@ 2017-06-07 19:13         ` Max Filippov
  0 siblings, 0 replies; 15+ messages in thread
From: Max Filippov @ 2017-06-07 19:13 UTC (permalink / raw)
  To: Nick Clifton
  Cc: augustine.sterling, binutils, gdb-patches, David Weatherford,
	Maxim Grigoriev, Woody LaRue

Hi Nick,

On Tue, Jun 6, 2017 at 5:53 AM, Nick Clifton <nickc@redhat.com> wrote:
> Well the binutils already has a plugin support, so this patch is just
> adding the ability for a different type of plugin to be used.  I am OK
> with that, providing that the plugin itself is also licensed under the
> GPL v3.

Yes, that's the intention. I've also got a suggestion on the gcc list to add
a mechanism that makes the plugin license requirement more apparent,
I'll do it in the next iteration of this series.

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC 0/5] xtensa: support dynamic configuration
  2017-06-06 12:41 ` [RFC 0/5] xtensa: support dynamic configuration Nick Clifton
@ 2017-06-07 19:23   ` Max Filippov
  0 siblings, 0 replies; 15+ messages in thread
From: Max Filippov @ 2017-06-07 19:23 UTC (permalink / raw)
  To: Nick Clifton
  Cc: binutils, gdb-patches, Sterling Augustine, David Weatherford,
	Maxim Grigoriev, Woody LaRue

Hi Nick,

On Tue, Jun 6, 2017 at 5:41 AM, Nick Clifton <nickc@redhat.com> wrote:
>> Built toolchain takes configuration
>> parameters from the shared object specified in the environment variable.
>
> Using environment variables to pass configuration information is a bad idea.
>
> The problem is that it can be very hard to debug problems when environment
> variables are involved.  Often they are not included in bug reports, which
> makes reproducing the problem tricky.
>
> At the very least you should also provide a command line option which
> specifies the path to a file containing the configuration information.  If
> specified this option should override the environment variable.

Ok, let me look at it.

> There is also the issue of versioning to consider.  Does the configuration
> information contain a version number ?  What happens if the configuration
> information is out of date with respect to the compiler/linker or if the
> tools are older than the configuration information ?

My intention was to keep versioning of each entity contained in the plugin
private to that entity users, because some users may already have some
versioning scheme. Regarding the configuration information: its structure
size is used as its version, and the structure may only be extended at its
end. Newer tools will reject using older configuration, older tools will accept
newer configuration.

-- 
Thanks.
-- Max

^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC 3/5] xtensa: support dynconfig on windows
  2017-05-22 21:12 ` [RFC 3/5] xtensa: support dynconfig on windows Max Filippov
@ 2017-06-12 15:45   ` Nick Clifton
  0 siblings, 0 replies; 15+ messages in thread
From: Nick Clifton @ 2017-06-12 15:45 UTC (permalink / raw)
  To: Max Filippov, binutils, gdb-patches
  Cc: Sterling Augustine, David Weatherford, Maxim Grigoriev, Woody LaRue

Hi Max,

> 2017-05-22  Max Filippov  <jcmvbkbc@gmail.com>
> bfd/
> 	* xtensa-config.c (windows.h): New #include'd header.
> 	(RTLD_LAZY): New macro definition.
> 	(dlopen, dlsym, dlclose, dlerror): New functions.

Approved - please apply.

Cheers
  Nick


^ permalink raw reply	[flat|nested] 15+ messages in thread

* Re: [RFC 4/5] xtensa: make xtensa_modules dynamic
  2017-05-22 21:13 ` [RFC 4/5] xtensa: make xtensa_modules dynamic Max Filippov
@ 2017-06-12 15:49   ` Nick Clifton
  0 siblings, 0 replies; 15+ messages in thread
From: Nick Clifton @ 2017-06-12 15:49 UTC (permalink / raw)
  To: Max Filippov, binutils, gdb-patches
  Cc: Sterling Augustine, David Weatherford, Maxim Grigoriev, Woody LaRue

Hi Max,

> 2017-05-22  Max Filippov  <jcmvbkbc@gmail.com>
> bfd/
> 	* xtensa-isa.c (xtensa-dynconfig.h): New #include'd header.
> 	(xtensa_get_modules): New function.
> 	(xtensa_isa_init): Call xtensa_get_modules instead of taking
> 	address of global xtensa_modules.
 
Approved - please apply.

Cheers
  Nick

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2017-06-12 15:49 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-22 21:12 [RFC 0/5] xtensa: support dynamic configuration Max Filippov
2017-05-22 21:12 ` [RFC 2/5] xtensa: make configuration dynamic Max Filippov
2017-05-26 18:10   ` augustine.sterling
2017-05-26 18:15     ` augustine.sterling
2017-06-06 12:53       ` Nick Clifton
2017-06-07 19:13         ` Max Filippov
2017-05-22 21:12 ` [RFC 1/5] xtensa: don't expect XCHAL_* macros to be constant Max Filippov
2017-05-26 17:36   ` augustine.sterling
2017-05-22 21:12 ` [RFC 3/5] xtensa: support dynconfig on windows Max Filippov
2017-06-12 15:45   ` Nick Clifton
2017-05-22 21:13 ` [RFC 4/5] xtensa: make xtensa_modules dynamic Max Filippov
2017-06-12 15:49   ` Nick Clifton
2017-05-22 21:13 ` [RFC 5/5] gdb: xtensa: make tdep and linux-nat dynamically configurable Max Filippov
2017-06-06 12:41 ` [RFC 0/5] xtensa: support dynamic configuration Nick Clifton
2017-06-07 19:23   ` Max Filippov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).