summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWaldemar Brodkorb <wbx@openadk.org>2025-03-22 10:37:58 +0100
committerWaldemar Brodkorb <wbx@openadk.org>2025-03-22 10:38:16 +0100
commitd2537267bbf29e1acae833b5da7831f628b5146c (patch)
tree27d96370530a2e996a80273f0a1cf01b0a5ae0bc
parent1b6d7d509536f6ef12ee221c2dfea98c35f13905 (diff)
bfin: use binutils 2.26 for FDPIC
-rw-r--r--target/config/Config.in.binutils6
-rw-r--r--toolchain/binutils/Makefile.inc7
-rw-r--r--toolchain/binutils/patches/2.26/0001-Relax-assertion-in-BFIN-linker-to-allow-for-discard-.patch38
3 files changed, 51 insertions, 0 deletions
diff --git a/target/config/Config.in.binutils b/target/config/Config.in.binutils
index cf11a76c9..3e141d4d6 100644
--- a/target/config/Config.in.binutils
+++ b/target/config/Config.in.binutils
@@ -8,6 +8,7 @@ default ADK_TOOLCHAIN_BINUTILS_ARC if ADK_TARGET_CPU_ARC_ARC64
default ADK_TOOLCHAIN_BINUTILS_AVR32 if ADK_TARGET_ARCH_AVR32
default ADK_TOOLCHAIN_BINUTILS_KVX if ADK_TARGET_ARCH_KVX
default ADK_TOOLCHAIN_BINUTILS_NDS32 if ADK_TARGET_ARCH_NDS32
+default ADK_TOOLCHAIN_BINUTILS_2_26 if ADK_TARGET_ARCH_BFIN && ADK_TARGET_BINFMT_FDPIC
default ADK_TOOLCHAIN_BINUTILS_2_43_1 if ADK_TARGET_ARCH_NIOS2
default ADK_TOOLCHAIN_BINUTILS_2_43_1 if ADK_TARGET_ARCH_X86_64
default ADK_TOOLCHAIN_BINUTILS_2_44
@@ -54,6 +55,11 @@ config ADK_TOOLCHAIN_BINUTILS_2_37
depends on !ADK_TARGET_ARCH_AVR32
depends on !ADK_TARGET_ARCH_KVX
+config ADK_TOOLCHAIN_BINUTILS_2_26
+ bool "2.26"
+ depends on !ADK_TARGET_ARCH_AVR32
+ depends on !ADK_TARGET_ARCH_KVX
+
config ADK_TOOLCHAIN_BINUTILS_ARC
bool "arc-2023.09"
depends on ADK_TARGET_ARCH_ARC
diff --git a/toolchain/binutils/Makefile.inc b/toolchain/binutils/Makefile.inc
index 9e9e9a4c4..1fcab41a2 100644
--- a/toolchain/binutils/Makefile.inc
+++ b/toolchain/binutils/Makefile.inc
@@ -58,6 +58,13 @@ PKG_HASH:= c44968b97cd86499efbc4b4ab7d98471f673e5414c554ef54afa930062dbbfcb
PKG_SITES:= ${MASTER_SITE_GNU:=binutils/}
DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz
endif
+ifeq ($(ADK_TOOLCHAIN_BINUTILS_2_26),y)
+PKG_VERSION:= 2.26
+PKG_RELEASE:= 1
+PKG_HASH:= 9615feddaeedc214d1a1ecd77b6697449c952eab69d79ab2125ea050e944bcc1
+PKG_SITES:= ${MASTER_SITE_GNU:=binutils/}
+DISTFILES:= ${PKG_NAME}-${PKG_VERSION}.tar.gz
+endif
ifeq ($(ADK_TOOLCHAIN_BINUTILS_KVX),y)
PKG_VERSION:= 782547a4e2bdf1308728032853678ca69bb154ea
PKG_GIT:= hash
diff --git a/toolchain/binutils/patches/2.26/0001-Relax-assertion-in-BFIN-linker-to-allow-for-discard-.patch b/toolchain/binutils/patches/2.26/0001-Relax-assertion-in-BFIN-linker-to-allow-for-discard-.patch
new file mode 100644
index 000000000..074317a24
--- /dev/null
+++ b/toolchain/binutils/patches/2.26/0001-Relax-assertion-in-BFIN-linker-to-allow-for-discard-.patch
@@ -0,0 +1,38 @@
+From ed3056ebdb9795446157af03d3e08fbb93c1b01d Mon Sep 17 00:00:00 2001
+From: Nick Clifton <nickc@redhat.com>
+Date: Tue, 29 Mar 2016 10:24:16 +0100
+Subject: [PATCH] Relax assertion in BFIN linker to allow for discard GOT
+ relocs.
+
+ PR 17334
+ * elf32-bfin.c (elf32_bfinfdpic_finish_dynamic_sections): Relax
+ assertion on the size of the got section to allow it to be bigger
+ than the number of relocs.
+
+Signed-off-by: Waldemar Brodkorb <wbx@openadk.org>
+---
+ bfd/elf32-bfin.c | 8 +++++++-
+ 2 files changed, 14 insertions(+), 1 deletion(-)
+
+diff --git a/bfd/elf32-bfin.c b/bfd/elf32-bfin.c
+index 7cc8b6d851e..b2fcf38b470 100644
+--- a/bfd/elf32-bfin.c
++++ b/bfd/elf32-bfin.c
+@@ -4457,7 +4457,13 @@ elf32_bfinfdpic_finish_dynamic_sections (bfd *output_bfd,
+ if (bfinfdpic_got_section (info))
+ {
+ BFD_ASSERT (bfinfdpic_gotrel_section (info)->size
+- == (bfinfdpic_gotrel_section (info)->reloc_count
++ /* PR 17334: It appears that the GOT section can end up
++ being bigger than the number of relocs. Presumably
++ because some relocs have been deleted. A test case has
++ yet to be generated for verify this, but in the meantime
++ the test below has been changed from == to >= so that
++ applications can continue to be built. */
++ >= (bfinfdpic_gotrel_section (info)->reloc_count
+ * sizeof (Elf32_External_Rel)));
+
+ if (bfinfdpic_gotfixup_section (info))
+--
+2.39.5
+