From 346ab6a178bf312f141b4021b557b6ab78788bfa Mon Sep 17 00:00:00 2001
From: Stepan Usatiuk <stepan@usatiuk.com>
Date: Fri, 22 Nov 2024 22:52:03 +0100
Subject: [PATCH] binutils diff

---
 .../binutils-x86_64-ficus/binutils-2.41/bfd/config.bfd       | 5 +++++
 .../binutils-x86_64-ficus/binutils-2.41/config.sub           | 2 +-
 .../binutils-x86_64-ficus/binutils-2.41/gas/configure.tgt    | 1 +
 .../binutils-x86_64-ficus/binutils-2.41/ld/Makefile.am       | 4 ++++
 .../binutils-x86_64-ficus/binutils-2.41/ld/configure.tgt     | 4 ++++
 .../binutils-2.41/ld/emulparams/elf_i386_ficus.sh            | 2 ++
 .../binutils-2.41/ld/emulparams/elf_x86_64_ficus.sh          | 1 +
 7 files changed, 18 insertions(+), 1 deletion(-)
 create mode 100644 ficus-toolchain/binutils-x86_64-ficus/binutils-2.41/ld/emulparams/elf_i386_ficus.sh
 create mode 100644 ficus-toolchain/binutils-x86_64-ficus/binutils-2.41/ld/emulparams/elf_x86_64_ficus.sh

diff --git a/bfd/config.bfd b/bfd/config.bfd
index bdee53957..93dc6146f 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -236,6 +236,11 @@ esac
 case "${targ}" in
 # START OF targmatch.h
 #ifdef BFD64
+  x86_64-*-ficus*)
+    targ_defvec=x86_64_elf64_vec
+    targ_selvecs=i386_elf32_vec
+    want64=true
+    ;;
   aarch64-*-darwin*)
     targ_defvec=aarch64_mach_o_vec
     targ_selvecs="arm_mach_o_vec mach_o_le_vec mach_o_be_vec mach_o_fat_vec"
diff --git a/config.sub b/config.sub
index f6ede1d0d..87f3b00bf 100755
--- a/config.sub
+++ b/config.sub
@@ -1758,7 +1758,7 @@ case $os in
 	     | onefs* | tirtos* | phoenix* | fuchsia* | redox* | bme* \
 	     | midnightbsd* | amdhsa* | unleashed* | emscripten* | wasi* \
 	     | nsk* | powerunix* | genode* | zvmoe* | qnx* | emx* | zephyr* \
-	     | fiwix* | mlibc* )
+	     | fiwix* | mlibc* | ficus* )
 		;;
 	# This one is extra strict with allowed versions
 	sco3.2v2 | sco3.2v[4-9]* | sco5v6*)
diff --git a/gas/configure.tgt b/gas/configure.tgt
index 3429f850d..6bf5093cc 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -228,6 +228,7 @@ case ${generic_target} in
   i386-*-elfiamcu)			fmt=elf arch=iamcu ;;
   i386-*-elf*)				fmt=elf ;;
   i386-*-fuchsia*)			fmt=elf ;;
+  i386-*-ficus*)			fmt=elf em=gnu ;;
   i386-*-haiku*)			fmt=elf em=haiku ;;
   i386-*-genode*)			fmt=elf ;;
   i386-*-bsd*)				fmt=aout em=386bsd ;;
diff --git a/ld/Makefile.am b/ld/Makefile.am
index c3adbb0cc..e354a228d 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -280,6 +280,7 @@ ALL_EMULATION_SOURCES = \
 	eelf_i386_haiku.c \
 	eelf_i386_ldso.c \
 	eelf_i386_sol2.c \
+	eelf_i386_ficus.c \
 	eelf_i386_vxworks.c \
 	eelf_iamcu.c \
 	eelf_s390.c \
@@ -459,6 +460,7 @@ ALL_64_EMULATION_SOURCES = \
 	eelf_x86_64_cloudabi.c \
 	eelf_x86_64_fbsd.c \
 	eelf_x86_64_haiku.c \
+	eelf_x86_64_ficus.c \
 	eelf_x86_64_sol2.c \
 	ehppa64linux.c \
 	ei386pep.c \
@@ -776,6 +778,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_be.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_fbsd.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_haiku.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_ficus.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_ldso.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_sol2.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_vxworks.Pc@am__quote@
@@ -954,6 +957,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_cloudabi.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_fbsd.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_haiku.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_ficus.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64_sol2.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ehppa64linux.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ei386pep.Pc@am__quote@
diff --git a/ld/configure.tgt b/ld/configure.tgt
index c62b9581d..47b66df03 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -1033,6 +1033,10 @@ x86_64-*-elf* | x86_64-*-rtems* | x86_64-*-fuchsia* | x86_64-*-genode*)
 x86_64-*-dragonfly*)	targ_emul=elf_x86_64
 			targ_extra_emuls="elf_i386 elf_iamcu"
 			;;
+x86_64-*-ficus*)
+			targ_emul=elf_x86_64_ficus
+			targ_extra_emuls="elf_i386_ficus elf_x86_64 elf_i386"
+			;;
 x86_64-*-freebsd* | x86_64-*-kfreebsd*-gnu)
 			targ_emul=elf_x86_64_fbsd
 			targ_extra_emuls="elf_i386_fbsd elf_x86_64 elf_i386 elf_iamcu"
diff --git a/ld/emulparams/elf_i386_ficus.sh b/ld/emulparams/elf_i386_ficus.sh
new file mode 100644
index 000000000..06482257c
--- /dev/null
+++ b/ld/emulparams/elf_i386_ficus.sh
@@ -0,0 +1,2 @@
+source_sh ${srcdir}/emulparams/elf_i386.sh
+TEXT_START_ADDR=0x08000000
diff --git a/ld/emulparams/elf_x86_64_ficus.sh b/ld/emulparams/elf_x86_64_ficus.sh
new file mode 100644
index 000000000..59e7df71a
--- /dev/null
+++ b/ld/emulparams/elf_x86_64_ficus.sh
@@ -0,0 +1 @@
+source_sh ${srcdir}/emulparams/elf_x86_64.sh
-- 
2.39.5 (Apple Git-154)

