summaryrefslogtreecommitdiff
path: root/toolchain/binutils
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2024-05-17 18:37:22 +0200
committerWaldemar Brodkorb <wbx@openadk.org>2024-05-18 04:51:20 +0200
commitf5c67bc4f3f14de3a4261f21565cb4658a9ef3bd (patch)
tree1f18bf997eaa72769f73fb4eb812f88477527cd1 /toolchain/binutils
parent6d77c8668e4e557924f8883fa5d6ab6e5af58f2e (diff)
nds32: add back support for old toolchain and Linux, working on ag101p with latest uClibc-ng
fix
Diffstat (limited to 'toolchain/binutils')
-rw-r--r--toolchain/binutils/Makefile.inc7
-rw-r--r--toolchain/binutils/patches/2.24/nds32.patch409257
2 files changed, 409264 insertions, 0 deletions
diff --git a/toolchain/binutils/Makefile.inc b/toolchain/binutils/Makefile.inc
index e58f739cf..add9768bd 100644
--- a/toolchain/binutils/Makefile.inc
+++ b/toolchain/binutils/Makefile.inc
@@ -65,6 +65,13 @@ PKG_HASH:= 71d37c96451333c5c0b84b170169fdcb138bbb27397dc06281905d9717c8ed64
PKG_SITES:= ${MASTER_SITE_GNU:=binutils/}
DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2
endif
+ifeq ($(ADK_TOOLCHAIN_BINUTILS_NDS32),y)
+PKG_VERSION:= 2.24
+PKG_RELEASE:= 1
+PKG_HASH:= e5e8c5be9664e7f7f96e0d09919110ab5ad597794f5b1809871177a0f0f14137
+PKG_SITES:= ${MASTER_SITE_GNU:=binutils/}
+DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.bz2
+endif
ifeq ($(ADK_TOOLCHAIN_BINUTILS_XTENSA),y)
PKG_VERSION:= xtensa-fdpic-abi-spec-1.2
PKG_GIT:= tag
diff --git a/toolchain/binutils/patches/2.24/nds32.patch b/toolchain/binutils/patches/2.24/nds32.patch
new file mode 100644
index 000000000..b9fbfbde5
--- /dev/null
+++ b/toolchain/binutils/patches/2.24/nds32.patch
@@ -0,0 +1,409257 @@
+diff -Nur binutils-2.24.orig/bfd/archures.c binutils-2.24/bfd/archures.c
+--- binutils-2.24.orig/bfd/archures.c 2013-11-08 11:02:26.000000000 +0100
++++ binutils-2.24/bfd/archures.c 2024-05-17 16:15:38.911343345 +0200
+@@ -316,6 +316,12 @@
+ .#define bfd_mach_arm_ep9312 11
+ .#define bfd_mach_arm_iWMMXt 12
+ .#define bfd_mach_arm_iWMMXt2 13
++. bfd_arch_nds32, {* Andes NDS32 *}
++.#define bfd_mach_n1 1
++.#define bfd_mach_n1h 2
++.#define bfd_mach_n1h_v2 3
++.#define bfd_mach_n1h_v3 4
++.#define bfd_mach_n1h_v3m 5
+ . bfd_arch_ns32k, {* National Semiconductors ns32000 *}
+ . bfd_arch_w65, {* WDC 65816 *}
+ . bfd_arch_tic30, {* Texas Instruments TMS320C30 *}
+@@ -574,6 +580,7 @@
+ extern const bfd_arch_info_type bfd_moxie_arch;
+ extern const bfd_arch_info_type bfd_msp430_arch;
+ extern const bfd_arch_info_type bfd_mt_arch;
++extern const bfd_arch_info_type bfd_nds32_arch;
+ extern const bfd_arch_info_type bfd_nios2_arch;
+ extern const bfd_arch_info_type bfd_ns32k_arch;
+ extern const bfd_arch_info_type bfd_openrisc_arch;
+@@ -663,6 +670,7 @@
+ &bfd_moxie_arch,
+ &bfd_msp430_arch,
+ &bfd_mt_arch,
++ &bfd_nds32_arch,
+ &bfd_nios2_arch,
+ &bfd_ns32k_arch,
+ &bfd_openrisc_arch,
+diff -Nur binutils-2.24.orig/bfd/bfd.c binutils-2.24/bfd/bfd.c
+--- binutils-2.24.orig/bfd/bfd.c 2013-11-04 16:33:37.000000000 +0100
++++ binutils-2.24/bfd/bfd.c 2024-05-17 16:15:38.923343593 +0200
+@@ -311,6 +311,14 @@
+ . unsigned int selective_search : 1;
+ .};
+ .
++.{* See note beside bfd_set_section_userdata. *}
++.static inline bfd_boolean
++.bfd_set_cacheable (bfd * abfd, bfd_boolean val)
++.{
++. abfd->cacheable = val;
++. return TRUE;
++.}
++.
+ */
+
+ #include "sysdep.h"
+diff -Nur binutils-2.24.orig/bfd/bfd-in2.h binutils-2.24/bfd/bfd-in2.h
+--- binutils-2.24.orig/bfd/bfd-in2.h 2013-11-18 09:40:15.000000000 +0100
++++ binutils-2.24/bfd/bfd-in2.h 2024-05-17 16:15:38.919343510 +0200
+@@ -299,9 +299,6 @@
+
+ #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
+
+-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
+-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
+-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
+ /* Find the address one past the end of SEC. */
+ #define bfd_get_section_limit(bfd, sec) \
+ (((bfd)->direction != write_direction && (sec)->rawsize != 0 \
+@@ -524,8 +521,6 @@
+
+ #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
+
+-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
+-
+ extern bfd_boolean bfd_cache_close
+ (bfd *abfd);
+ /* NB: This declaration should match the autogenerated one in libbfd.h. */
+@@ -1594,6 +1589,32 @@
+ int size;
+ };
+
++/* Note: the following are provided as inline functions rather than macros
++ because not all callers use the return value. A macro implementation
++ would use a comma expression, eg: "((ptr)->foo = val, TRUE)" and some
++ compilers will complain about comma expressions that have no effect. */
++static inline bfd_boolean
++bfd_set_section_userdata (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, void * val)
++{
++ ptr->userdata = val;
++ return TRUE;
++}
++
++static inline bfd_boolean
++bfd_set_section_vma (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, bfd_vma val)
++{
++ ptr->vma = ptr->lma = val;
++ ptr->user_set_vma = TRUE;
++ return TRUE;
++}
++
++static inline bfd_boolean
++bfd_set_section_alignment (bfd * abfd ATTRIBUTE_UNUSED, asection * ptr, unsigned int val)
++{
++ ptr->alignment_power = val;
++ return TRUE;
++}
++
+ /* These sections are global, and are managed by BFD. The application
+ and target back end are not permitted to change the values in
+ these sections. */
+@@ -2071,6 +2092,12 @@
+ #define bfd_mach_arm_ep9312 11
+ #define bfd_mach_arm_iWMMXt 12
+ #define bfd_mach_arm_iWMMXt2 13
++ bfd_arch_nds32, /* Andes NDS32 */
++#define bfd_mach_n1 1
++#define bfd_mach_n1h 2
++#define bfd_mach_n1h_v2 3
++#define bfd_mach_n1h_v3 4
++#define bfd_mach_n1h_v3m 5
+ bfd_arch_ns32k, /* National Semiconductors ns32000 */
+ bfd_arch_w65, /* WDC 65816 */
+ bfd_arch_tic30, /* Texas Instruments TMS320C30 */
+@@ -3794,6 +3821,229 @@
+ BFD_RELOC_M32R_GOTPC_HI_SLO,
+ BFD_RELOC_M32R_GOTPC_LO,
+
++/* NDS32 relocs.
++This is a 20 bit absolute address. */
++ BFD_RELOC_NDS32_20,
++
++/* This is a 9-bit pc-relative reloc with the right 1 bit assumed to be 0. */
++ BFD_RELOC_NDS32_9_PCREL,
++
++/* This is a 9-bit pc-relative reloc with the right 1 bit assumed to be 0. */
++ BFD_RELOC_NDS32_WORD_9_PCREL,
++
++/* This is an 15-bit reloc with the right 1 bit assumed to be 0. */
++ BFD_RELOC_NDS32_15_PCREL,
++
++/* This is an 17-bit reloc with the right 1 bit assumed to be 0. */
++ BFD_RELOC_NDS32_17_PCREL,
++
++/* This is a 25-bit reloc with the right 1 bit assumed to be 0. */
++ BFD_RELOC_NDS32_25_PCREL,
++
++/* This is a 20-bit reloc containing the high 20 bits of an address
++used with the lower 12 bits */
++ BFD_RELOC_NDS32_HI20,
++
++/* This is a 12-bit reloc containing the lower 12 bits of an address
++then shift right by 3. This is used with ldi,sdi... */
++ BFD_RELOC_NDS32_LO12S3,
++
++/* This is a 12-bit reloc containing the lower 12 bits of an address
++then shift left by 2. This is used with lwi,swi... */
++ BFD_RELOC_NDS32_LO12S2,
++
++/* This is a 12-bit reloc containing the lower 12 bits of an address
++then shift left by 1. This is used with lhi,shi... */
++ BFD_RELOC_NDS32_LO12S1,
++
++/* This is a 12-bit reloc containing the lower 12 bits of an address
++then shift left by 0. This is used with lbisbi... */
++ BFD_RELOC_NDS32_LO12S0,
++
++/* This is a 12-bit reloc containing the lower 12 bits of an address
++then shift left by 0. This is only used with branch relaxations */
++ BFD_RELOC_NDS32_LO12S0_ORI,
++
++/* This is a 15-bit reloc containing the small data area 18-bit signed offset
++and shift left by 3 for use in ldi, sdi... */
++ BFD_RELOC_NDS32_SDA15S3,
++
++/* This is a 15-bit reloc containing the small data area 17-bit signed offset
++and shift left by 2 for use in lwi, swi... */
++ BFD_RELOC_NDS32_SDA15S2,
++
++/* This is a 15-bit reloc containing the small data area 16-bit signed offset
++and shift left by 1 for use in lhi, shi... */
++ BFD_RELOC_NDS32_SDA15S1,
++
++/* This is a 15-bit reloc containing the small data area 15-bit signed offset
++and shift left by 0 for use in lbi, sbi... */
++ BFD_RELOC_NDS32_SDA15S0,
++
++/* This is a 16-bit reloc containing the small data area 16-bit signed offset
++and shift left by 3 */
++ BFD_RELOC_NDS32_SDA16S3,
++
++/* This is a 17-bit reloc containing the small data area 17-bit signed offset
++and shift left by 2 for use in lwi.gp, swi.gp... */
++ BFD_RELOC_NDS32_SDA17S2,
++
++/* This is a 18-bit reloc containing the small data area 18-bit signed offset
++and shift left by 1 for use in lhi.gp, shi.gp... */
++ BFD_RELOC_NDS32_SDA18S1,
++
++/* This is a 19-bit reloc containing the small data area 19-bit signed offset
++and shift left by 0 for use in lbi.gp, sbi.gp... */
++ BFD_RELOC_NDS32_SDA19S0,
++
++/* This is a 24-bit reloc for security check sum. */
++ BFD_RELOC_NDS32_SECURITY_16,
++
++/* for PIC */
++ BFD_RELOC_NDS32_GOT20,
++ BFD_RELOC_NDS32_9_PLTREL,
++ BFD_RELOC_NDS32_25_PLTREL,
++ BFD_RELOC_NDS32_COPY,
++ BFD_RELOC_NDS32_GLOB_DAT,
++ BFD_RELOC_NDS32_JMP_SLOT,
++ BFD_RELOC_NDS32_RELATIVE,
++ BFD_RELOC_NDS32_GOTOFF,
++ BFD_RELOC_NDS32_GOTOFF_HI20,
++ BFD_RELOC_NDS32_GOTOFF_LO12,
++ BFD_RELOC_NDS32_GOTPC20,
++ BFD_RELOC_NDS32_GOT_HI20,
++ BFD_RELOC_NDS32_GOT_LO12,
++ BFD_RELOC_NDS32_GOTPC_HI20,
++ BFD_RELOC_NDS32_GOTPC_LO12,
++
++/* for relax */
++ BFD_RELOC_NDS32_INSN16,
++ BFD_RELOC_NDS32_LABEL,
++ BFD_RELOC_NDS32_LONGCALL1,
++ BFD_RELOC_NDS32_LONGCALL2,
++ BFD_RELOC_NDS32_LONGCALL3,
++ BFD_RELOC_NDS32_LONGJUMP1,
++ BFD_RELOC_NDS32_LONGJUMP2,
++ BFD_RELOC_NDS32_LONGJUMP3,
++ BFD_RELOC_NDS32_LOADSTORE,
++ BFD_RELOC_NDS32_9_FIXED,
++ BFD_RELOC_NDS32_15_FIXED,
++ BFD_RELOC_NDS32_17_FIXED,
++ BFD_RELOC_NDS32_25_FIXED,
++ BFD_RELOC_NDS32_LONGCALL4,
++ BFD_RELOC_NDS32_LONGCALL5,
++ BFD_RELOC_NDS32_LONGCALL6,
++ BFD_RELOC_NDS32_LONGJUMP4,
++ BFD_RELOC_NDS32_LONGJUMP5,
++ BFD_RELOC_NDS32_LONGJUMP6,
++ BFD_RELOC_NDS32_LONGJUMP7,
++
++/* for PIC */
++ BFD_RELOC_NDS32_PLTREL_HI20,
++ BFD_RELOC_NDS32_PLTREL_LO12,
++ BFD_RELOC_NDS32_PLT_GOTREL_HI20,
++ BFD_RELOC_NDS32_PLT_GOTREL_LO12,
++
++/* for floating point */
++ BFD_RELOC_NDS32_SDA12S2_DP,
++ BFD_RELOC_NDS32_SDA12S2_SP,
++ BFD_RELOC_NDS32_LO12S2_DP,
++ BFD_RELOC_NDS32_LO12S2_SP,
++
++/* for dwarf2 debug_line. */
++ BFD_RELOC_NDS32_DWARF2_OP1,
++ BFD_RELOC_NDS32_DWARF2_OP2,
++ BFD_RELOC_NDS32_DWARF2_LEB,
++
++/* for eliminate 16-bit instructions */
++ BFD_RELOC_NDS32_UPDATE_TA,
++
++/* for PIC object relaxation */
++ BFD_RELOC_NDS32_PLT_GOTREL_LO20,
++ BFD_RELOC_NDS32_PLT_GOTREL_LO15,
++ BFD_RELOC_NDS32_PLT_GOTREL_LO19,
++ BFD_RELOC_NDS32_GOT_LO15,
++ BFD_RELOC_NDS32_GOT_LO19,
++ BFD_RELOC_NDS32_GOTOFF_LO15,
++ BFD_RELOC_NDS32_GOTOFF_LO19,
++ BFD_RELOC_NDS32_GOT15S2,
++ BFD_RELOC_NDS32_GOT17S2,
++
++/* NDS32 relocs.
++This is a 5 bit absolute address. */
++ BFD_RELOC_NDS32_5,
++
++/* This is a 10-bit unsigned pc-relative reloc with the right 1 bit assumed to be 0. */
++ BFD_RELOC_NDS32_10_UPCREL,
++
++/* If fp were omitted, fp can used as another gp. */
++ BFD_RELOC_NDS32_SDA_FP7U2_RELA,
++
++/* relaxation relative relocation types */
++ BFD_RELOC_NDS32_RELAX_ENTRY,
++ BFD_RELOC_NDS32_GOT_SUFF,
++ BFD_RELOC_NDS32_GOTOFF_SUFF,
++ BFD_RELOC_NDS32_PLT_GOT_SUFF,
++ BFD_RELOC_NDS32_MULCALL_SUFF,
++ BFD_RELOC_NDS32_PTR,
++ BFD_RELOC_NDS32_PTR_COUNT,
++ BFD_RELOC_NDS32_PTR_RESOLVED,
++ BFD_RELOC_NDS32_PLTBLOCK,
++ BFD_RELOC_NDS32_RELAX_REGION_BEGIN,
++ BFD_RELOC_NDS32_RELAX_REGION_END,
++ BFD_RELOC_NDS32_MINUEND,
++ BFD_RELOC_NDS32_SUBTRAHEND,
++ BFD_RELOC_NDS32_DIFF8,
++ BFD_RELOC_NDS32_DIFF16,
++ BFD_RELOC_NDS32_DIFF32,
++ BFD_RELOC_NDS32_DIFF_ULEB128,
++ BFD_RELOC_NDS32_EMPTY,
++
++/* This is a 25 bit absolute address. */
++ BFD_RELOC_NDS32_25_ABS,
++
++/* For ex9 and ifc using. */
++ BFD_RELOC_NDS32_DATA,
++ BFD_RELOC_NDS32_TRAN,
++ BFD_RELOC_NDS32_17IFC_PCREL,
++ BFD_RELOC_NDS32_10IFCU_PCREL,
++
++/* For TLS. */
++ BFD_RELOC_NDS32_TPOFF,
++ BFD_RELOC_NDS32_GOTTPOFF,
++ BFD_RELOC_NDS32_TLS_LE_HI20,
++ BFD_RELOC_NDS32_TLS_LE_LO12,
++ BFD_RELOC_NDS32_TLS_LE_20,
++ BFD_RELOC_NDS32_TLS_LE_15S0,
++ BFD_RELOC_NDS32_TLS_LE_15S1,
++ BFD_RELOC_NDS32_TLS_LE_15S2,
++ BFD_RELOC_NDS32_TLS_LE_ADD,
++ BFD_RELOC_NDS32_TLS_LE_LS,
++ BFD_RELOC_NDS32_TLS_IE_HI20,
++ BFD_RELOC_NDS32_TLS_IE_LO12,
++ BFD_RELOC_NDS32_TLS_IE_LO12S2,
++ BFD_RELOC_NDS32_TLS_IEGP_HI20,
++ BFD_RELOC_NDS32_TLS_IEGP_LO12,
++ BFD_RELOC_NDS32_TLS_IEGP_LO12S2,
++ BFD_RELOC_NDS32_TLS_IEGP_LW,
++ BFD_RELOC_NDS32_TLS_DESC,
++ BFD_RELOC_NDS32_TLS_DESC_HI20,
++ BFD_RELOC_NDS32_TLS_DESC_LO12,
++ BFD_RELOC_NDS32_TLS_DESC_20,
++ BFD_RELOC_NDS32_TLS_DESC_SDA17S2,
++ BFD_RELOC_NDS32_TLS_DESC_ADD,
++ BFD_RELOC_NDS32_TLS_DESC_FUNC,
++ BFD_RELOC_NDS32_TLS_DESC_CALL,
++ BFD_RELOC_NDS32_TLS_DESC_MEM,
++ BFD_RELOC_NDS32_REMOVE,
++ BFD_RELOC_NDS32_GROUP,
++
++/* Jump-patch table relative relocations. */
++ BFD_RELOC_NDS32_ICT,
++ BFD_RELOC_NDS32_ICT_HI20,
++ BFD_RELOC_NDS32_ICT_LO12,
++ BFD_RELOC_NDS32_ICT_25PC,
++
+ /* This is a 9-bit reloc */
+ BFD_RELOC_V850_9_PCREL,
+
+@@ -6235,6 +6485,14 @@
+ unsigned int selective_search : 1;
+ };
+
++/* See note beside bfd_set_section_userdata. */
++static inline bfd_boolean
++bfd_set_cacheable (bfd * abfd, bfd_boolean val)
++{
++ abfd->cacheable = val;
++ return TRUE;
++}
++
+ typedef enum bfd_error
+ {
+ bfd_error_no_error = 0,
+diff -Nur binutils-2.24.orig/bfd/bfd-in.h binutils-2.24/bfd/bfd-in.h
+--- binutils-2.24.orig/bfd/bfd-in.h 2013-11-04 16:33:37.000000000 +0100
++++ binutils-2.24/bfd/bfd-in.h 2024-05-17 16:15:38.915343427 +0200
+@@ -292,9 +292,6 @@
+
+ #define bfd_is_com_section(ptr) (((ptr)->flags & SEC_IS_COMMON) != 0)
+
+-#define bfd_set_section_vma(bfd, ptr, val) (((ptr)->vma = (ptr)->lma = (val)), ((ptr)->user_set_vma = TRUE), TRUE)
+-#define bfd_set_section_alignment(bfd, ptr, val) (((ptr)->alignment_power = (val)),TRUE)
+-#define bfd_set_section_userdata(bfd, ptr, val) (((ptr)->userdata = (val)),TRUE)
+ /* Find the address one past the end of SEC. */
+ #define bfd_get_section_limit(bfd, sec) \
+ (((bfd)->direction != write_direction && (sec)->rawsize != 0 \
+@@ -517,8 +514,6 @@
+
+ #define bfd_get_symbol_leading_char(abfd) ((abfd)->xvec->symbol_leading_char)
+
+-#define bfd_set_cacheable(abfd,bool) (((abfd)->cacheable = bool), TRUE)
+-
+ extern bfd_boolean bfd_cache_close
+ (bfd *abfd);
+ /* NB: This declaration should match the autogenerated one in libbfd.h. */
+diff -Nur binutils-2.24.orig/bfd/config.bfd binutils-2.24/bfd/config.bfd
+--- binutils-2.24.orig/bfd/config.bfd 2013-11-04 16:33:37.000000000 +0100
++++ binutils-2.24/bfd/config.bfd 2024-05-17 16:15:38.923343593 +0200
+@@ -6,12 +6,12 @@
+ # 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/>.
+@@ -109,6 +109,7 @@
+ m88*) targ_archs=bfd_m88k_arch ;;
+ microblaze*) targ_archs=bfd_microblaze_arch ;;
+ mips*) targ_archs=bfd_mips_arch ;;
++nds32*) targ_archs=bfd_nds32_arch ;;
+ nios2*) targ_archs=bfd_nios2_arch ;;
+ or32*) targ_archs=bfd_or32_arch ;;
+ pdp11*) targ_archs=bfd_pdp11_arch ;;
+@@ -1120,6 +1121,28 @@
+ targ_selvecs=bfd_elf32_msp430_ti_vec
+ ;;
+
++ nds32*le-*-linux*)
++ targ_defvec=bfd_elf32_nds32lelin_vec
++ targ_selvecs=bfd_elf32_nds32belin_vec
++ targ_cflags=-DNDS32_LINUX_TOOLCHAIN
++ ;;
++
++ nds32*be-*-linux*)
++ targ_defvec=bfd_elf32_nds32belin_vec
++ targ_selvecs=bfd_elf32_nds32lelin_vec
++ targ_cflags=-DNDS32_LINUX_TOOLCHAIN
++ ;;
++
++ nds32*le-*-*)
++ targ_defvec=bfd_elf32_nds32le_vec
++ targ_selvecs=bfd_elf32_nds32be_vec
++ ;;
++
++ nds32*be-*-*)
++ targ_defvec=bfd_elf32_nds32be_vec
++ targ_selvecs=bfd_elf32_nds32le_vec
++ ;;
++
+ ns32k-pc532-mach* | ns32k-pc532-ux*)
+ targ_defvec=pc532machaout_vec
+ targ_underscore=yes
+@@ -1640,12 +1663,12 @@
+ w65-*-*)
+ targ_defvec=w65_vec
+ ;;
+-
++
+ xgate-*-*)
+ targ_defvec=bfd_elf32_xgate_vec
+ targ_selvecs="bfd_elf32_xgate_vec"
+ ;;
+-
++
+ xstormy16-*-elf)
+ targ_defvec=bfd_elf32_xstormy16_vec
+ ;;
+diff -Nur binutils-2.24.orig/bfd/configure binutils-2.24/bfd/configure
+--- binutils-2.24.orig/bfd/configure 2013-12-02 10:30:30.000000000 +0100
++++ binutils-2.24/bfd/configure 2024-05-17 16:15:38.939343923 +0200
+@@ -15307,6 +15307,10 @@
+ tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf32_ntradlittlemips_vec | bfd_elf32_ntradlittlemips_freebsd_vec)
+ tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
++ bfd_elf32_nds32le_vec) tb="$tb elf32-nds32.lo elf32.lo $elf" ;;
++ bfd_elf32_nds32be_vec) tb="$tb elf32-nds32.lo elf32.lo $elf" ;;
++ bfd_elf32_nds32lelin_vec) tb="$tb elf32-nds32.lo elf32.lo $elf" ;;
++ bfd_elf32_nds32belin_vec) tb="$tb elf32-nds32.lo elf32.lo $elf" ;;
+ bfd_elf32_openrisc_vec) tb="$tb elf32-openrisc.lo elf32.lo $elf" ;;
+ bfd_elf32_or32_big_vec) tb="$tb elf32-or32.lo elf32.lo $elf" ;;
+ bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
+diff -Nur binutils-2.24.orig/bfd/configure.in binutils-2.24/bfd/configure.in
+--- binutils-2.24.orig/bfd/configure.in 2013-12-02 10:30:28.000000000 +0100
++++ binutils-2.24/bfd/configure.in 2024-05-17 16:15:38.939343923 +0200
+@@ -796,6 +796,10 @@
+ tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
+ bfd_elf32_ntradlittlemips_vec | bfd_elf32_ntradlittlemips_freebsd_vec)
+ tb="$tb elfn32-mips.lo elfxx-mips.lo elf-vxworks.lo elf32.lo $elf ecofflink.lo"; target_size=64 ;;
++ bfd_elf32_nds32be_vec) tb="$tb elf32-nds32.lo elf32.lo $elf" ;;
++ bfd_elf32_nds32le_vec) tb="$tb elf32-nds32.lo elf32.lo $elf" ;;
++ bfd_elf32_nds32belin_vec) tb="$tb elf32-nds32.lo elf32.lo $elf" ;;
++ bfd_elf32_nds32lelin_vec) tb="$tb elf32-nds32.lo elf32.lo $elf" ;;
+ bfd_elf32_openrisc_vec) tb="$tb elf32-openrisc.lo elf32.lo $elf" ;;
+ bfd_elf32_or32_big_vec) tb="$tb elf32-or32.lo elf32.lo $elf" ;;
+ bfd_elf32_pj_vec) tb="$tb elf32-pj.lo elf32.lo $elf";;
+diff -Nur binutils-2.24.orig/bfd/cpu-nds32.c binutils-2.24/bfd/cpu-nds32.c
+--- binutils-2.24.orig/bfd/cpu-nds32.c 1970-01-01 01:00:00.000000000 +0100
++++ binutils-2.24/bfd/cpu-nds32.c 2024-05-17 16:15:38.939343923 +0200
+@@ -0,0 +1,44 @@
++/* BFD support for the NDS32 processor
++ Copyright (C) 2012-2013 Free Software Foundation, Inc.
++ Contributed by Andes Technology Corporation.
++
++ 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"
++#include "elf-bfd.h"
++
++#define N(number, print, default, next) \
++ {32, 32, 8, bfd_arch_nds32, number, "nds32", print, 4, default, \
++ bfd_default_compatible, bfd_default_scan, bfd_arch_default_fill, next }
++
++#define NEXT &arch_info_struct[0]
++#define NDS32V2_NEXT &arch_info_struct[1]
++#define NDS32V3_NEXT &arch_info_struct[2]
++#define NDS32V3M_NEXT &arch_info_struct[3]
++
++static const bfd_arch_info_type arch_info_struct[] = {
++ N (bfd_mach_n1h, "n1h", FALSE, NDS32V2_NEXT),
++ N (bfd_mach_n1h_v2, "n1h_v2", FALSE, NDS32V3_NEXT),
++ N (bfd_mach_n1h_v3, "n1h_v3", FALSE, NDS32V3M_NEXT),
++ N (bfd_mach_n1h_v3m, "n1h_v3m", FALSE, NULL),
++};
++
++const bfd_arch_info_type bfd_nds32_arch =
++ N (bfd_mach_n1, "n1h", TRUE, NEXT);
+diff -Nur binutils-2.24.orig/bfd/doc/aoutx.texi binutils-2.24/bfd/doc/aoutx.texi
+--- binutils-2.24.orig/bfd/doc/aoutx.texi 2013-11-18 09:49:27.000000000 +0100
++++ binutils-2.24/bfd/doc/aoutx.texi 1970-01-01 01:00:00.000000000 +0100
+@@ -1,213 +0,0 @@
+-@section a.out backends
+-
+-
+-@strong{Description}@*
+-BFD supports a number of different flavours of a.out format,
+-though the major differences are only the sizes of the
+-structures on disk, and the shape of the relocation
+-information.
+-
+-The support is split into a basic support file @file{aoutx.h}
+-and other files which derive functions from the base. One
+-derivation file is @file{aoutf1.h} (for a.out flavour 1), and
+-adds to the basic a.out functions support for sun3, sun4, 386
+-and 29k a.out files, to create a target jump vector for a
+-specific target.
+-
+-This information is further split out into more specific files
+-for each machine, including @file{sunos.c} for sun3 and sun4,
+-@file{newsos3.c} for the Sony NEWS, and @file{demo64.c} for a
+-demonstration of a 64 bit a.out format.
+-
+-The base file @file{aoutx.h} defines general mechanisms for
+-reading and writing records to and from disk and various
+-other methods which BFD requires. It is included by
+-@file{aout32.c} and @file{aout64.c} to form the names
+-@code{aout_32_swap_exec_header_in}, @code{aout_64_swap_exec_header_in}, etc.
+-
+-As an example, this is what goes on to make the back end for a
+-sun4, from @file{aout32.c}:
+-
+-@example
+- #define ARCH_SIZE 32
+- #include "aoutx.h"
+-@end example
+-
+-Which exports names:
+-
+-@example
+- ...
+- aout_32_canonicalize_reloc
+- aout_32_find_nearest_line
+- aout_32_get_lineno
+- aout_32_get_reloc_upper_bound
+- ...
+-@end example
+-
+-from @file{sunos.c}:
+-
+-@example
+- #define TARGET_NAME "a.out-sunos-big"
+- #define VECNAME sunos_big_vec
+- #include "aoutf1.h"
+-@end example
+-
+-requires all the names from @file{aout32.c}, and produces the jump vector
+-
+-@example
+- sunos_big_vec
+-@end example
+-
+-The file @file{host-aout.c} is a special case. It is for a large set
+-of hosts that use ``more or less standard'' a.out files, and
+-for which cross-debugging is not interesting. It uses the
+-standard 32-bit a.out support routines, but determines the
+-file offsets and addresses of the text, data, and BSS
+-sections, the machine architecture and machine type, and the
+-entry point address, in a host-dependent manner. Once these
+-values have been determined, generic code is used to handle
+-the object file.
+-
+-When porting it to run on a new system, you must supply:
+-
+-@example
+- HOST_PAGE_SIZE
+- HOST_SEGMENT_SIZE
+- HOST_MACHINE_ARCH (optional)
+- HOST_MACHINE_MACHINE (optional)
+- HOST_TEXT_START_ADDR
+- HOST_STACK_END_ADDR
+-@end example
+-
+-in the file @file{../include/sys/h-@var{XXX}.h} (for your host). These
+-values, plus the structures and macros defined in @file{a.out.h} on
+-your host system, will produce a BFD target that will access
+-ordinary a.out files on your host. To configure a new machine
+-to use @file{host-aout.c}, specify:
+-
+-@example
+- TDEFAULTS = -DDEFAULT_VECTOR=host_aout_big_vec
+- TDEPFILES= host-aout.o trad-core.o
+-@end example
+-
+-in the @file{config/@var{XXX}.mt} file, and modify @file{configure.in}
+-to use the
+-@file{@var{XXX}.mt} file (by setting "@code{bfd_target=XXX}") when your
+-configuration is selected.
+-
+-@subsection Relocations
+-
+-
+-@strong{Description}@*
+-The file @file{aoutx.h} provides for both the @emph{standard}
+-and @emph{extended} forms of a.out relocation records.
+-
+-The standard records contain only an
+-address, a symbol index, and a type field. The extended records
+-(used on 29ks and sparcs) also have a full integer for an
+-addend.
+-
+-@subsection Internal entry points
+-
+-
+-@strong{Description}@*
+-@file{aoutx.h} exports several routines for accessing the
+-contents of an a.out file, which are gathered and exported in
+-turn by various format specific files (eg sunos.c).
+-
+-@findex aout_@var{size}_swap_exec_header_in
+-@subsubsection @code{aout_@var{size}_swap_exec_header_in}
+-@strong{Synopsis}
+-@example
+-void aout_@var{size}_swap_exec_header_in,
+- (bfd *abfd,
+- struct external_exec *bytes,
+- struct internal_exec *execp);
+-@end example
+-@strong{Description}@*
+-Swap the information in an executable header @var{raw_bytes} taken
+-from a raw byte stream memory image into the internal exec header
+-structure @var{execp}.
+-
+-@findex aout_@var{size}_swap_exec_header_out
+-@subsubsection @code{aout_@var{size}_swap_exec_header_out}
+-@strong{Synopsis}
+-@example
+-void aout_@var{size}_swap_exec_header_out
+- (bfd *abfd,
+- struct internal_exec *execp,
+- struct external_exec *raw_bytes);
+-@end example
+-@strong{Description}@*
+-Swap the information in an internal exec header structure
+-@var{execp} into the buffer @var{raw_bytes} ready for writing to disk.
+-
+-@findex aout_@var{size}_some_aout_object_p
+-@subsubsection @code{aout_@var{size}_some_aout_object_p}
+-@strong{Synopsis}
+-@example
+-const bfd_target *aout_@var{size}_some_aout_object_p
+- (bfd *abfd,
+- struct internal_exec *execp,
+- const bfd_target *(*callback_to_real_object_p) (bfd *));
+-@end example
+-@strong{Description}@*
+-Some a.out variant thinks that the file open in @var{abfd}
+-checking is an a.out file. Do some more checking, and set up
+-for access if it really is. Call back to the calling
+-environment's "finish up" function just before returning, to
+-handle any last-minute setup.
+-
+-@findex aout_@var{size}_mkobject
+-@subsubsection @code{aout_@var{size}_mkobject}
+-@strong{Synopsis}
+-@example
+-bfd_boolean aout_@var{size}_mkobject, (bfd *abfd);
+-@end example
+-@strong{Description}@*
+-Initialize BFD @var{abfd} for use with a.out files.
+-
+-@findex aout_@var{size}_machine_type
+-@subsubsection @code{aout_@var{size}_machine_type}
+-@strong{Synopsis}
+-@example
+-enum machine_type aout_@var{size}_machine_type
+- (enum bfd_architecture arch,
+- unsigned long machine,
+- bfd_boolean *unknown);
+-@end example
+-@strong{Description}@*
+-Keep track of machine architecture and machine type for
+-a.out's. Return the @code{machine_type} for a particular
+-architecture and machine, or @code{M_UNKNOWN} if that exact architecture
+-and machine can't be represented in a.out format.
+-
+-If the architecture is understood, machine type 0 (default)
+-is always understood.
+-
+-@findex aout_@var{size}_set_arch_mach
+-@subsubsection @code{aout_@var{size}_set_arch_mach}
+-@strong{Synopsis}
+-@example
+-bfd_boolean aout_@var{size}_set_arch_mach,
+- (bfd *,
+- enum bfd_architecture arch,
+- unsigned long machine);
+-@end example
+-@strong{Description}@*
+-Set the architecture and the machine of the BFD @var{abfd} to the
+-values @var{arch} and @var{machine}. Verify that @var{abfd}'s format
+-can support the architecture required.
+-
+-@findex aout_@var{size}_new_section_hook
+-@subsubsection @code{aout_@var{size}_new_section_hook}
+-@strong{Synopsis}
+-@example
+-bfd_boolean aout_@var{size}_new_section_hook,
+- (bfd *abfd,
+- asection *newsect);
+-@end example
+-@strong{Description}@*
+-Called by the BFD in response to a @code{bfd_make_section}
+-request.
+-
+diff -Nur binutils-2.24.orig/bfd/doc/archive.texi binutils-2.24/bfd/doc/archive.texi
+--- binutils-2.24.orig/bfd/doc/archive.texi 2013-11-18 09:49:27.000000000 +0100
++++ binutils-2.24/bfd/doc/archive.texi 1970-01-01 01:00:00.000000000 +0100
+@@ -1,105 +0,0 @@
+-@section Archives
+-
+-
+-@strong{Description}@*
+-An archive (or library) is just another BFD. It has a symbol
+-table, although there's not much a user program will do with it.
+-
+-The big difference between an archive BFD and an ordinary BFD
+-is that the archive doesn't have sections. Instead it has a
+-chain of BFDs that are considered its contents. These BFDs can
+-be manipulated like any other. The BFDs contained in an
+-archive opened for reading will all be opened for reading. You
+-may put either input or output BFDs into an archive opened for
+-output; they will be handled correctly when the archive is closed.
+-
+-Use @code{bfd_openr_next_archived_file} to step through
+-the contents of an archive opened for input. You don't
+-have to read the entire archive if you don't want
+-to! Read it until you find what you want.
+-
+-A BFD returned by @code{bfd_openr_next_archived_file} can be
+-closed manually with @code{bfd_close}. If you do not close it,
+-then a second iteration through the members of an archive may
+-return the same BFD. If you close the archive BFD, then all
+-the member BFDs will automatically be closed as well.
+-
+-Archive contents of output BFDs are chained through the
+-@code{archive_next} pointer in a BFD. The first one is findable
+-through the @code{archive_head} slot of the archive. Set it with
+-@code{bfd_set_archive_head} (q.v.). A given BFD may be in only
+-one open output archive at a time.
+-
+-As expected, the BFD archive code is more general than the
+-archive code of any given environment. BFD archives may
+-contain files of different formats (e.g., a.out and coff) and
+-even different architectures. You may even place archives
+-recursively into archives!
+-
+-This can cause unexpected confusion, since some archive
+-formats are more expressive than others. For instance, Intel
+-COFF archives can preserve long filenames; SunOS a.out archives
+-cannot. If you move a file from the first to the second
+-format and back again, the filename may be truncated.
+-Likewise, different a.out environments have different
+-conventions as to how they truncate filenames, whether they
+-preserve directory names in filenames, etc. When
+-interoperating with native tools, be sure your files are
+-homogeneous.
+-
+-Beware: most of these formats do not react well to the
+-presence of spaces in filenames. We do the best we can, but
+-can't always handle this case due to restrictions in the format of
+-archives. Many Unix utilities are braindead in regards to
+-spaces and such in filenames anyway, so this shouldn't be much
+-of a restriction.
+-
+-Archives are supported in BFD in @code{archive.c}.
+-
+-@subsection Archive functions
+-
+-
+-@findex bfd_get_next_mapent
+-@subsubsection @code{bfd_get_next_mapent}
+-@strong{Synopsis}
+-@example
+-symindex bfd_get_next_mapent
+- (bfd *abfd, symindex previous, carsym **sym);
+-@end example
+-@strong{Description}@*
+-Step through archive @var{abfd}'s symbol table (if it
+-has one). Successively update @var{sym} with the next symbol's
+-information, returning that symbol's (internal) index into the
+-symbol table.
+-
+-Supply @code{BFD_NO_MORE_SYMBOLS} as the @var{previous} entry to get
+-the first one; returns @code{BFD_NO_MORE_SYMBOLS} when you've already
+-got the last one.
+-
+-A @code{carsym} is a canonical archive symbol. The only
+-user-visible element is its name, a null-terminated string.
+-
+-@findex bfd_set_archive_head
+-@subsubsection @code{bfd_set_archive_head}
+-@strong{Synopsis}
+-@example
+-bfd_boolean bfd_set_archive_head (bfd *output, bfd *new_head);
+-@end example
+-@strong{Description}@*
+-Set the head of the chain of
+-BFDs contained in the archive @var{output} to @var{new_head}.
+-
+-@findex bfd_openr_next_archived_file
+-@subsubsection @code{bfd_openr_next_archived_file}
+-@strong{Synopsis}
+-@example
+-bfd *bfd_openr_next_archived_file (bfd *archive, bfd *previous);
+-@end example
+-@strong{Description}@*
+-Provided a BFD, @var{archive}, containing an archive and NULL, open
+-an input BFD on the first contained element and returns that.
+-Subsequent calls should pass
+-the archive and the previous return value to return a created
+-BFD to the next contained element. NULL is returned when there
+-are no more.
+-
+diff -Nur binutils-2.24.orig/bfd/doc/archures.texi binutils-2.24/bfd/doc/archures.texi
+--- binutils-2.24.orig/bfd/doc/archures.texi 2013-11-18 09:49:27.000000000 +0100
++++ binutils-2.24/bfd/doc/archures.texi 1970-01-01 01:00:00.000000000 +0100
+@@ -1,706 +0,0 @@
+-@section Architectures
+-BFD keeps one atom in a BFD describing the
+-architecture of the data attached to the BFD: a pointer to a
+-@code{bfd_arch_info_type}.
+-
+-Pointers to structures can be requested independently of a BFD
+-so that an architecture's information can be interrogated
+-without access to an open BFD.
+-
+-The architecture information is provided by each architecture package.
+-The set of default architectures is selected by the macro
+-@code{SELECT_ARCHITECTURES}. This is normally set up in the
+-@file{config/@var{target}.mt} file of your choice. If the name is not
+-defined, then all the architectures supported are included.
+-
+-When BFD starts up, all the architectures are called with an
+-initialize method. It is up to the architecture back end to
+-insert as many items into the list of architectures as it wants to;
+-generally this would be one for each machine and one for the
+-default case (an item with a machine field of 0).
+-
+-BFD's idea of an architecture is implemented in @file{archures.c}.
+-
+-@subsection bfd_architecture
+-
+-
+-@strong{Description}@*
+-This enum gives the object file's CPU architecture, in a
+-global sense---i.e., what processor family does it belong to?
+-Another field indicates which processor within
+-the family is in use. The machine gives a number which
+-distinguishes different versions of the architecture,
+-containing, for example, 2 and 3 for Intel i960 KA and i960 KB,
+-and 68020 and 68030 for Motorola 68020 and 68030.
+-@example
+-enum bfd_architecture
+-@{
+- bfd_arch_unknown, /* File arch not known. */
+- bfd_arch_obscure, /* Arch known, not one of these. */
+- bfd_arch_m68k, /* Motorola 68xxx */
+-#define bfd_mach_m68000 1
+-#define bfd_mach_m68008 2
+-#define bfd_mach_m68010 3
+-#define bfd_mach_m68020 4
+-#define bfd_mach_m68030 5
+-#define bfd_mach_m68040 6
+-#define bfd_mach_m68060 7
+-#define bfd_mach_cpu32 8
+-#define bfd_mach_fido 9
+-#define bfd_mach_mcf_isa_a_nodiv 10
+-#define bfd_mach_mcf_isa_a 11
+-#define bfd_mach_mcf_isa_a_mac 12
+-#define bfd_mach_mcf_isa_a_emac 13
+-#define bfd_mach_mcf_isa_aplus 14
+-#define bfd_mach_mcf_isa_aplus_mac 15
+-#define bfd_mach_mcf_isa_aplus_emac 16
+-#define bfd_mach_mcf_isa_b_nousp 17
+-#define bfd_mach_mcf_isa_b_nousp_mac 18
+-#define bfd_mach_mcf_isa_b_nousp_emac 19
+-#define bfd_mach_mcf_isa_b 20
+-#define bfd_mach_mcf_isa_b_mac 21
+-#define bfd_mach_mcf_isa_b_emac 22
+-#define bfd_mach_mcf_isa_b_float 23
+-#define bfd_mach_mcf_isa_b_float_mac 24
+-#define bfd_mach_mcf_isa_b_float_emac 25
+-#define bfd_mach_mcf_isa_c 26
+-#define bfd_mach_mcf_isa_c_mac 27
+-#define bfd_mach_mcf_isa_c_emac 28
+-#define bfd_mach_mcf_isa_c_nodiv 29
+-#define bfd_mach_mcf_isa_c_nodiv_mac 30
+-#define bfd_mach_mcf_isa_c_nodiv_emac 31
+- bfd_arch_vax, /* DEC Vax */
+- bfd_arch_i960, /* Intel 960 */
+- /* The order of the following is important.
+- lower number indicates a machine type that
+- only accepts a subset of the instructions
+- available to machines with higher numbers.
+- The exception is the "ca", which is
+- incompatible with all other machines except
+- "core". */
+-
+-#define bfd_mach_i960_core 1
+-#define bfd_mach_i960_ka_sa 2
+-#define bfd_mach_i960_kb_sb 3
+-#define bfd_mach_i960_mc 4
+-#define bfd_mach_i960_xa 5
+-#define bfd_mach_i960_ca 6
+-#define bfd_mach_i960_jx 7
+-#define bfd_mach_i960_hx 8
+-
+- bfd_arch_or32, /* OpenRISC 32 */
+-
+- bfd_arch_sparc, /* SPARC */
+-#define bfd_mach_sparc 1
+-/* The difference between v8plus and v9 is that v9 is a true 64 bit env. */
+-#define bfd_mach_sparc_sparclet 2
+-#define bfd_mach_sparc_sparclite 3
+-#define bfd_mach_sparc_v8plus 4
+-#define bfd_mach_sparc_v8plusa 5 /* with ultrasparc add'ns. */