diff options
Diffstat (limited to 'toolchain/binutils')
-rw-r--r-- | toolchain/binutils/Makefile | 27 | ||||
-rw-r--r-- | toolchain/binutils/Makefile.inc | 96 | ||||
-rw-r--r-- | toolchain/binutils/patches/2.20.1/newer-gcc.patch | 24 | ||||
-rw-r--r-- | toolchain/binutils/patches/2.24/nds32.patch | 409257 | ||||
-rw-r--r-- | toolchain/binutils/patches/2.26/0001-Relax-assertion-in-BFIN-linker-to-allow-for-discard-.patch | 38 | ||||
-rw-r--r-- | toolchain/binutils/patches/2.28/lm32.patch | 24 | ||||
-rw-r--r-- | toolchain/binutils/patches/2.37/0001-i386-Allow-GOT32-relocations-against-ABS-symbols.patch | 47 | ||||
-rw-r--r-- | toolchain/binutils/patches/2.37/nds32-uclibc.patch | 15 | ||||
-rw-r--r-- | toolchain/binutils/patches/2.38/0001-binutils-2.38-vs.-ppc32-linux-kernel.patch | 55 | ||||
-rw-r--r-- | toolchain/binutils/patches/2.38/nds32-uclibc.patch | 15 | ||||
-rw-r--r-- | toolchain/binutils/patches/2.41/lm32.patch | 24 | ||||
-rw-r--r-- | toolchain/binutils/patches/2.42/j2.patch | 584 | ||||
-rw-r--r-- | toolchain/binutils/patches/2.42/kvx.patch | 29 | ||||
-rw-r--r-- | toolchain/binutils/patches/2.44/lm32.patch | 24 |
14 files changed, 410223 insertions, 36 deletions
diff --git a/toolchain/binutils/Makefile b/toolchain/binutils/Makefile index 7136cf66e..fdedaeaff 100644 --- a/toolchain/binutils/Makefile +++ b/toolchain/binutils/Makefile @@ -18,14 +18,8 @@ else CONFOPTS+= --disable-lto --disable-plugins endif -ifeq ($(ADK_TOOLCHAIN_WITH_GOLD),y) -ifeq ($(ADK_TARGET_USE_GOLD),y) -CONFOPTS+= --enable-gold=default -else -CONFOPTS+= --enable-gold -endif -else -CONFOPTS+= --disable-gold +ifeq ($(ADK_TARGET_ARCH_ARC),y) +CONFOPTS+= --enable-lto --enable-plugins endif ifeq ($(ADK_TARGET_ARCH_X86_64)$(ADK_TARGET_CPU_CF),) @@ -40,11 +34,15 @@ endif $(WRKBUILD)/.configured: ifeq ($(ADK_TARGET_ARCH_XTENSA),y) +ifeq ($(ADK_TARGET_ABI),) tar xf $(ADK_TOPDIR)/target/xtensa/overlay/xtensa_$(ADK_TARGET_CPU_TYPE).tar \ --strip-components=1 -C $(WRKSRC) binutils +else + tar xf $(ADK_TOPDIR)/target/xtensa/overlay/xtensa_$(ADK_TARGET_CPU_TYPE)_$(ADK_TARGET_ABI).tar \ + --strip-components=1 -C $(WRKSRC) binutils +endif endif (cd $(WRKBUILD); PATH='$(HOST_PATH)' \ - LDFLAGS=-ldl \ MAKEINFO=true \ M4='${STAGING_HOST_DIR}/usr/bin/m4' \ $(WRKBUILD)/configure \ @@ -58,6 +56,8 @@ endif --disable-gdb \ --enable-obsolete \ --disable-werror \ + --disable-gprof \ + --enable-gprofng=no \ --disable-install-libiberty \ ${CONFOPTS} \ ); @@ -65,24 +65,19 @@ endif touch $@ $(WRKBUILD)/.compiled: $(WRKBUILD)/.configured - PATH='$(HOST_PATH)' $(MAKE) ${BINUTILS_MAKEOPTS} MAKEINFO=true -C $(WRKBUILD) all + PATH='$(HOST_PATH)' V=1 $(MAKE) ${BINUTILS_MAKEOPTS} LDFLAGS='$(HOST_STATIC_LDFLAGS)' MAKEINFO=true -C $(WRKBUILD) all touch $@ $(WRKBUILD)/.installed: $(WRKBUILD)/.compiled PATH='$(HOST_PATH)' $(MAKE) MAKEINFO=true -C $(WRKBUILD) install -ifeq ($(ADK_TARGET_ARCH_H8300)$(ADK_TARGET_ARCH_NDS32)$(ADK_TARGET_ARCH_SH),y) +ifeq ($(ADK_TARGET_ARCH_KVX)$(ADK_TARGET_ARCH_H8300)$(ADK_TARGET_ARCH_NDS32)$(ADK_TARGET_ARCH_SH),y) $(INSTALL_DIR) $(STAGING_TARGET_DIR)/usr/lib/ldscripts $(CP) $(WRKBUILD)/ld/ldscripts/* $(STAGING_TARGET_DIR)/usr/lib/ldscripts/ endif -ifeq ($(ADK_TARGET_USE_GOLD),y) - (cd $(TOOLCHAIN_DIR)/usr/bin && \ - ln -sf $(GNU_TARGET_NAME)-ld.gold $(GNU_TARGET_NAME)-ld) -else ifeq (ADK_TOOLCHAIN_BINUTILS_AVR32),) (cd $(TOOLCHAIN_DIR)/usr/bin && \ ln -sf $(GNU_TARGET_NAME)-ld.bfd $(GNU_TARGET_NAME)-ld) endif -endif touch $@ include ${ADK_TOPDIR}/mk/toolchain.mk diff --git a/toolchain/binutils/Makefile.inc b/toolchain/binutils/Makefile.inc index ac252de32..af6479f15 100644 --- a/toolchain/binutils/Makefile.inc +++ b/toolchain/binutils/Makefile.inc @@ -2,40 +2,82 @@ # material, please see the LICENCE file in the top-level directory. PKG_NAME:= binutils +ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_44),y) +PKG_VERSION:= 2.44 +PKG_RELEASE:= 1 +PKG_HASH:= 0cdd76777a0dfd3dd3a63f215f030208ddb91c2361d2bcc02acec0f1c16b6a2e +PKG_SITES:= ${MASTER_SITE_GNU:=binutils/} +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz +endif +ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_43_1),y) +PKG_VERSION:= 2.43.1 +PKG_RELEASE:= 1 +PKG_HASH:= e4c38b893f590853fbe276a6b8a1268101e35e61849a07f6ee97b5ecc97fbff8 +PKG_SITES:= ${MASTER_SITE_GNU:=binutils/} +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz +endif +ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_42),y) +PKG_VERSION:= 2.42 +PKG_RELEASE:= 1 +PKG_HASH:= 5d2a6c1d49686a557869caae08b6c2e83699775efd27505e01b2f4db1a024ffc +PKG_SITES:= ${MASTER_SITE_GNU:=binutils/} +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz +endif +ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_41),y) +PKG_VERSION:= 2.41 +PKG_RELEASE:= 1 +PKG_HASH:= 48d00a8dc73aa7d2394a7dc069b96191d95e8de8f0da6dc91da5cce655c20e45 +PKG_SITES:= ${MASTER_SITE_GNU:=binutils/} +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz +endif +ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_40),y) +PKG_VERSION:= 2.40 +PKG_RELEASE:= 1 +PKG_HASH:= d7f82c4047decf43a6f769ac32456a92ddb6932409a585c633cdd4e9df23d956 +PKG_SITES:= ${MASTER_SITE_GNU:=binutils/} +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz +endif +ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_39),y) +PKG_VERSION:= 2.39 +PKG_RELEASE:= 1 +PKG_HASH:= d12ea6f239f1ffe3533ea11ad6e224ffcb89eb5d01bbea589e9158780fa11f10 +PKG_SITES:= ${MASTER_SITE_GNU:=binutils/} +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz +endif +ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_38),y) +PKG_VERSION:= 2.38 +PKG_RELEASE:= 1 +PKG_HASH:= b3f1dc5b17e75328f19bd88250bee2ef9f91fc8cbb7bd48bdb31390338636052 +PKG_SITES:= ${MASTER_SITE_GNU:=binutils/} +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz +endif ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_37),y) PKG_VERSION:= 2.37 PKG_RELEASE:= 1 -PKG_HASH:= 820d9724f020a3e69cb337893a0b63c2db161dadcb0e06fc11dc29eb1e84a32c +PKG_HASH:= c44968b97cd86499efbc4b4ab7d98471f673e5414c554ef54afa930062dbbfcb PKG_SITES:= ${MASTER_SITE_GNU:=binutils/} -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.xz +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz endif -ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_28),y) -PKG_VERSION:= 2.28 +ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_26),y) +PKG_VERSION:= 2.26 PKG_RELEASE:= 1 -PKG_HASH:= cd717966fc761d840d451dbd58d44e1e5b92949d2073d75b73fccb476d772fcf +PKG_HASH:= 9615feddaeedc214d1a1ecd77b6697449c952eab69d79ab2125ea050e944bcc1 PKG_SITES:= ${MASTER_SITE_GNU:=binutils/} DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz endif -ifeq ($(ADK_TOOLCHAIN_BINUTILS_ARC),y) -PKG_VERSION:= arc-2020.09 -PKG_GIT:= tag -PKG_RELEASE:= 1 -PKG_SITES:= https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb.git -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.xz -endif ifeq ($(ADK_TOOLCHAIN_BINUTILS_KVX),y) -PKG_VERSION:= c5e8437af055869c8666a1c1e5a391d9af5be0c0 +PKG_VERSION:= 782547a4e2bdf1308728032853678ca69bb154ea PKG_GIT:= hash PKG_RELEASE:= 1 PKG_SITES:= https://github.com/kalray/gdb-binutils.git -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.xz +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz endif -ifeq ($(ADK_TOOLCHAIN_BINUTILS_NDS32),y) -PKG_VERSION:= nds32-binutils-2.30-branch-open -PKG_GIT:= branch +ifeq ($(ADK_TOOLCHAIN_BINUTILS_ARC),y) +PKG_VERSION:= arc-2024.12 +PKG_GIT:= tag PKG_RELEASE:= 1 -PKG_SITES:= https://github.com/andestech/binutils.git -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.xz +PKG_SITES:= https://github.com/foss-for-synopsys-dwc-arc-processors/binutils-gdb.git +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz endif ifeq ($(ADK_TOOLCHAIN_BINUTILS_AVR32),y) PKG_VERSION:= 2.20.1 @@ -44,9 +86,23 @@ 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.4 +PKG_GIT:= tag +PKG_RELEASE:= 1 +PKG_SITES:= https://github.com/jcmvbkbc/binutils-gdb-xtensa.git +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz +endif ifeq ($(ADK_TOOLCHAIN_BINUTILS_GIT),y) PKG_VERSION:= git PKG_RELEASE:= 1 PKG_SITES:= git://sourceware.org/git/binutils-gdb.git -DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.xz +DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz endif diff --git a/toolchain/binutils/patches/2.20.1/newer-gcc.patch b/toolchain/binutils/patches/2.20.1/newer-gcc.patch new file mode 100644 index 000000000..b7f42e447 --- /dev/null +++ b/toolchain/binutils/patches/2.20.1/newer-gcc.patch @@ -0,0 +1,24 @@ +diff -Nur binutils-2.20.1.orig/binutils/readelf.c binutils-2.20.1/binutils/readelf.c +--- binutils-2.20.1.orig/binutils/readelf.c 2023-02-03 11:04:53.722082738 +0100 ++++ binutils-2.20.1/binutils/readelf.c 2023-02-03 11:05:27.049296372 +0100 +@@ -150,7 +150,7 @@ + #include "filenames.h" + + char * program_name = "readelf"; +-int do_wide; ++extern int do_wide; + static long archive_file_offset; + static unsigned long archive_file_size; + static unsigned long dynamic_addr; +diff -Nur binutils-2.20.1.orig/gas/config/tc-avr32.c binutils-2.20.1/gas/config/tc-avr32.c +--- binutils-2.20.1.orig/gas/config/tc-avr32.c 2023-02-03 11:04:53.726082644 +0100 ++++ binutils-2.20.1/gas/config/tc-avr32.c 2023-02-03 11:06:12.164234434 +0100 +@@ -47,7 +47,7 @@ + + /* Flags given on the command line */ + static int avr32_pic = FALSE; +-int linkrelax = FALSE; ++//extern int linkrelax = FALSE; + int avr32_iarcompat = FALSE; + + /* This array holds the chars that always start a comment. */ 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_ |