@@ -1158,21 +1158,41 @@ case "${targ}" in
;;
#ifdef BFD64
+ riscvbe-*-freebsd* | riscv32be*-*-freebsd*)
+ targ_defvec=riscv_elf32_fbsd_be_vec
+ targ_selvecs="riscv_elf32_vec riscv_elf32_be_vec riscv_elf64_vec riscv_elf64_be_vec riscv_elf32_fbsd_vec riscv_elf32_fbsd_be_vec riscv_elf64_fbsd_vec riscv_elf64_fbsd_be_vec"
+ want64=true
+ ;;
riscvbe-*-* | riscv32be*-*-*)
targ_defvec=riscv_elf32_be_vec
targ_selvecs="riscv_elf32_vec riscv_elf64_vec riscv_elf32_be_vec riscv_elf64_be_vec"
want64=true
;;
+ riscv-*-freebsd* | riscv32*-*-freebsd*)
+ targ_defvec=riscv_elf32_fbsd_vec
+ targ_selvecs="riscv_elf32_vec riscv_elf32_be_vec riscv_elf64_vec riscv_elf64_be_vec riscv_elf32_fbsd_vec riscv_elf32_fbsd_be_vec riscv_elf64_fbsd_vec riscv_elf64_fbsd_be_vec"
+ want64=true
+ ;;
riscv-*-* | riscv32*-*-*)
targ_defvec=riscv_elf32_vec
targ_selvecs="riscv_elf32_vec riscv_elf64_vec riscv_elf32_be_vec riscv_elf64_be_vec"
want64=true
;;
+ riscv64be*-*-freebsd*)
+ targ_defvec=riscv_elf64_fbsd_be_vec
+ targ_selvecs="riscv_elf32_vec riscv_elf32_be_vec riscv_elf64_vec riscv_elf64_be_vec riscv_elf32_fbsd_vec riscv_elf32_fbsd_be_vec riscv_elf64_fbsd_vec riscv_elf64_fbsd_be_vec"
+ want64=true
+ ;;
riscv64be*-*-*)
targ_defvec=riscv_elf64_be_vec
targ_selvecs="riscv_elf32_vec riscv_elf64_vec riscv_elf32_be_vec riscv_elf64_be_vec"
want64=true
;;
+ riscv64*-*-freebsd*)
+ targ_defvec=riscv_elf64_fbsd_vec
+ targ_selvecs="riscv_elf32_vec riscv_elf32_be_vec riscv_elf64_vec riscv_elf64_be_vec riscv_elf32_fbsd_vec riscv_elf32_fbsd_be_vec riscv_elf64_fbsd_vec riscv_elf64_fbsd_be_vec"
+ want64=true
+ ;;
riscv64*-*-*)
targ_defvec=riscv_elf64_vec
targ_selvecs="riscv_elf32_vec riscv_elf64_vec riscv_elf32_be_vec riscv_elf64_be_vec"
@@ -14942,6 +14942,10 @@ do
riscv_elf64_vec) tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf"; target_size=64 ;;
riscv_elf32_be_vec) tb="$tb elf32-riscv.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf" ;;
riscv_elf64_be_vec) tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf"; target_size=64 ;;
+ riscv_elf32_fbsd_vec) tb="$tb elf32-riscv.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf" ;;
+ riscv_elf64_fbsd_vec) tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf"; target_size=64 ;;
+ riscv_elf32_fbsd_be_vec) tb="$tb elf32-riscv.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf" ;;
+ riscv_elf64_fbsd_be_vec) tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf"; target_size=64 ;;
rl78_elf32_vec) tb="$tb elf32-rl78.lo elf32.lo $elf" ;;
rs6000_xcoff64_vec) tb="$tb coff64-rs6000.lo aix5ppc-core.lo $xcoff"; target_size=64 ;;
rs6000_xcoff64_aix_vec) tb="$tb coff64-rs6000.lo aix5ppc-core.lo $xcoff"; target_size=64 ;;
@@ -627,6 +627,10 @@ do
riscv_elf64_vec) tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf"; target_size=64 ;;
riscv_elf32_be_vec) tb="$tb elf32-riscv.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf" ;;
riscv_elf64_be_vec) tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf"; target_size=64 ;;
+ riscv_elf32_fbsd_vec) tb="$tb elf32-riscv.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf" ;;
+ riscv_elf64_fbsd_vec) tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf"; target_size=64 ;;
+ riscv_elf32_fbsd_be_vec) tb="$tb elf32-riscv.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf" ;;
+ riscv_elf64_fbsd_be_vec) tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.lo elf-ifunc.lo elf32.lo $elf"; target_size=64 ;;
rl78_elf32_vec) tb="$tb elf32-rl78.lo elf32.lo $elf" ;;
rs6000_xcoff64_vec) tb="$tb coff64-rs6000.lo aix5ppc-core.lo $xcoff"; target_size=64 ;;
rs6000_xcoff64_aix_vec) tb="$tb coff64-rs6000.lo aix5ppc-core.lo $xcoff"; target_size=64 ;;
@@ -3786,15 +3786,6 @@ _bfd_riscv_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
if (!is_riscv_elf (ibfd) || !is_riscv_elf (obfd))
return TRUE;
- if (strcmp (bfd_get_target (ibfd), bfd_get_target (obfd)) != 0)
- {
- (*_bfd_error_handler)
- (_("%pB: ABI is incompatible with that of the selected emulation:\n"
- " target emulation `%s' does not match `%s'"),
- ibfd, bfd_get_target (ibfd), bfd_get_target (obfd));
- return FALSE;
- }
-
if (!_bfd_elf_merge_object_attributes (ibfd, info))
return FALSE;
@@ -3811,6 +3802,18 @@ _bfd_riscv_elf_merge_private_bfd_data (bfd *ibfd, struct bfd_link_info *info)
return TRUE;
}
+ if (elf_elfheader (ibfd)->e_ident[EI_CLASS]
+ != elf_elfheader (obfd)->e_ident[EI_CLASS]
+ || elf_elfheader (ibfd)->e_ident[EI_DATA]
+ != elf_elfheader (obfd)->e_ident[EI_DATA])
+ {
+ (*_bfd_error_handler)
+ (_("%pB: ABI is incompatible with that of the selected emulation:\n"
+ " target emulation `%s' does not match `%s'"),
+ ibfd, bfd_get_target (ibfd), bfd_get_target (obfd));
+ return FALSE;
+ }
+
/* Check to see if the input BFD actually contains any sections. If not,
its flags may not have been initialized either, but it cannot actually
cause any incompatibility. Do not short-circuit dynamic objects; their
@@ -5028,3 +5031,23 @@ riscv_elf_obj_attrs_arg_type (int tag)
#define elf_backend_obj_attrs_section ".riscv.attributes"
#include "elfNN-target.h"
+
+#undef TARGET_LITTLE_SYM
+#define TARGET_LITTLE_SYM riscv_elfNN_fbsd_vec
+#undef TARGET_LITTLE_NAME
+#define TARGET_LITTLE_NAME "elfNN-littleriscv-freebsd"
+
+#undef TARGET_BIG_SYM
+#define TARGET_BIG_SYM riscv_elfNN_fbsd_be_vec
+#undef TARGET_BIG_NAME
+#define TARGET_BIG_NAME "elfNN-bigriscv-freebsd"
+
+#undef ELF_OSABI
+#define ELF_OSABI ELFOSABI_FREEBSD
+
+#undef elf32_bed
+#define elf32_bed elf32_fbsd_bed
+#undef elf64_bed
+#define elf64_bed elf64_fbsd_bed
+
+#include "elfNN-target.h"
@@ -859,6 +859,10 @@ extern const bfd_target riscv_elf32_vec;
extern const bfd_target riscv_elf64_vec;
extern const bfd_target riscv_elf32_be_vec;
extern const bfd_target riscv_elf64_be_vec;
+extern const bfd_target riscv_elf32_fbsd_vec;
+extern const bfd_target riscv_elf64_fbsd_vec;
+extern const bfd_target riscv_elf32_fbsd_be_vec;
+extern const bfd_target riscv_elf64_fbsd_be_vec;
extern const bfd_target rl78_elf32_vec;
extern const bfd_target rs6000_xcoff64_vec;
extern const bfd_target rs6000_xcoff64_aix_vec;
@@ -1255,6 +1259,10 @@ static const bfd_target * const _bfd_target_vector[] =
&riscv_elf64_vec,
&riscv_elf32_be_vec,
&riscv_elf64_be_vec,
+ &riscv_elf32_fbsd_vec,
+ &riscv_elf64_fbsd_vec,
+ &riscv_elf32_fbsd_be_vec,
+ &riscv_elf64_fbsd_be_vec,
#endif
&rl78_elf32_vec,
@@ -266,9 +266,11 @@ ALL_EMULATION_SOURCES = \
eelf32lriscv.c \
eelf32lriscv_ilp32f.c \
eelf32lriscv_ilp32.c \
+ eelf32lriscv_fbsd.c \
eelf32briscv.c \
eelf32briscv_ilp32f.c \
eelf32briscv_ilp32.c \
+ eelf32briscv_fbsd.c \
eelf32rl78.c \
eelf32rx.c \
eelf32rx_linux.c \
@@ -438,9 +440,11 @@ ALL_64_EMULATION_SOURCES = \
eelf64lriscv.c \
eelf64lriscv_lp64f.c \
eelf64lriscv_lp64.c \
+ eelf64lriscv_fbsd.c \
eelf64briscv.c \
eelf64briscv_lp64f.c \
eelf64briscv_lp64.c \
+ eelf64briscv_fbsd.c \
eelf64ltsmip.c \
eelf64ltsmip_fbsd.c \
eelf64mmix.c \
@@ -760,6 +764,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32briscv.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32briscv_ilp32f.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32briscv_ilp32.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32briscv_fbsd.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32rl78.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32rx.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32rx_linux.Pc@am__quote@
@@ -925,9 +930,11 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64f.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_fbsd.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64briscv.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64briscv_lp64f.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64briscv_lp64.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64briscv_fbsd.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip_fbsd.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64mmix.Pc@am__quote@
@@ -756,9 +756,11 @@ ALL_EMULATION_SOURCES = \
eelf32lriscv.c \
eelf32lriscv_ilp32f.c \
eelf32lriscv_ilp32.c \
+ eelf32lriscv_fbsd.c \
eelf32briscv.c \
eelf32briscv_ilp32f.c \
eelf32briscv_ilp32.c \
+ eelf32briscv_fbsd.c \
eelf32rl78.c \
eelf32rx.c \
eelf32rx_linux.c \
@@ -927,9 +929,11 @@ ALL_64_EMULATION_SOURCES = \
eelf64lriscv.c \
eelf64lriscv_lp64f.c \
eelf64lriscv_lp64.c \
+ eelf64lriscv_fbsd.c \
eelf64briscv.c \
eelf64briscv_lp64f.c \
eelf64briscv_lp64.c \
+ eelf64briscv_fbsd.c \
eelf64ltsmip.c \
eelf64ltsmip_fbsd.c \
eelf64mmix.c \
@@ -1424,6 +1428,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64f.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_fbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip_fbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64mmix.Po@am__quote@
@@ -2419,6 +2424,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32briscv.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32briscv_ilp32f.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32briscv_ilp32.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32briscv_fbsd.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32rl78.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32rx.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32rx_linux.Pc@am__quote@
@@ -2584,9 +2590,11 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64f.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_lp64.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv_fbsd.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64briscv.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64briscv_lp64f.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64briscv_lp64.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64briscv_fbsd.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64ltsmip_fbsd.Pc@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64mmix.Pc@am__quote@
@@ -742,8 +742,17 @@ riscv32be*-*-linux*) targ_emul=elf32briscv
targ_extra_emuls="elf32briscv_ilp32f elf32briscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64"
targ_extra_libpath=$targ_extra_emuls
;;
+riscv32be*-*-freebsd*) targ_emul=elf32briscv_fbsd
+ targ_extra_emuls="elf32lriscv elf32briscv elf64lriscv elf64briscv elf32lriscv_fbsd elf32briscv_fbsd elf64lriscv_fbsd elf64briscv_fbsd"
+ targ_extra_libpath=$targ_extra_emuls
+ ;;
riscv32*-*-linux*) targ_emul=elf32lriscv
targ_extra_emuls="elf32lriscv_ilp32f elf32lriscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64"
+ targ_extra_emuls="elf64lriscv elf32briscv elf64briscv"
+ targ_extra_libpath=$targ_extra_emuls
+ ;;
+riscv32*-*-freebsd*) targ_emul=elf32lriscv_fbsd
+ targ_extra_emuls="elf32lriscv elf32briscv elf64lriscv elf64briscv elf32lriscv_fbsd elf32briscv_fbsd elf64lriscv_fbsd elf64briscv_fbsd"
targ_extra_libpath=$targ_extra_emuls
;;
riscvbe-*-* | riscv32be*-*-*)
@@ -760,10 +769,18 @@ riscv64be*-*-linux*) targ_emul=elf64briscv
targ_extra_emuls="elf64briscv_lp64f elf64briscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32 elf64lriscv elf64lriscv_lp64f elf64lriscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32"
targ_extra_libpath=$targ_extra_emuls
;;
+riscv64be*-*-freebsd*) targ_emul=elf64briscv_fbsd
+ targ_extra_emuls="elf32lriscv elf32briscv elf64lriscv elf64briscv elf32lriscv_fbsd elf32briscv_fbsd elf64lriscv_fbsd elf64briscv_fbsd"
+ targ_extra_libpath=$targ_extra_emuls
+ ;;
riscv64*-*-linux*) targ_emul=elf64lriscv
targ_extra_emuls="elf64lriscv_lp64f elf64lriscv_lp64 elf32lriscv elf32lriscv_ilp32f elf32lriscv_ilp32 elf64briscv elf64briscv_lp64f elf64briscv_lp64 elf32briscv elf32briscv_ilp32f elf32briscv_ilp32"
targ_extra_libpath=$targ_extra_emuls
;;
+riscv64*-*-freebsd*) targ_emul=elf64lriscv_fbsd
+ targ_extra_emuls="elf32lriscv elf32briscv elf64lriscv elf64briscv elf32lriscv_fbsd elf32briscv_fbsd elf64lriscv_fbsd elf64briscv_fbsd"
+ targ_extra_libpath=$targ_extra_emuls
+ ;;
riscv64be*-*-*) targ_emul=elf64briscv
targ_extra_emuls="elf32briscv elf64lriscv elf32lriscv"
targ_extra_libpath=$targ_extra_emuls
new file mode 100644
@@ -0,0 +1,4 @@
+source_sh ${srcdir}/emulparams/elf32briscv.sh
+source_sh ${srcdir}/emulparams/elf_fbsd.sh
+
+OUTPUT_FORMAT="elf32-bigriscv-freebsd"
new file mode 100644
@@ -0,0 +1,4 @@
+source_sh ${srcdir}/emulparams/elf32lriscv.sh
+source_sh ${srcdir}/emulparams/elf_fbsd.sh
+
+OUTPUT_FORMAT="elf32-littleriscv-freebsd"
new file mode 100644
@@ -0,0 +1,4 @@
+source_sh ${srcdir}/emulparams/elf64briscv.sh
+source_sh ${srcdir}/emulparams/elf_fbsd.sh
+
+OUTPUT_FORMAT="elf64-bigriscv-freebsd"
new file mode 100644
@@ -0,0 +1,4 @@
+source_sh ${srcdir}/emulparams/elf64lriscv.sh
+source_sh ${srcdir}/emulparams/elf_fbsd.sh
+
+OUTPUT_FORMAT="elf64-littleriscv-freebsd"
@@ -91,6 +91,7 @@ eelf32bmipn32.c
eelf32briscv.c
eelf32briscv_ilp32.c
eelf32briscv_ilp32f.c
+eelf32briscv_fbsd.c
eelf32bsmip.c
eelf32btsmip.c
eelf32btsmip_fbsd.c
@@ -124,6 +125,7 @@ eelf32lr5900n32.c
eelf32lriscv.c
eelf32lriscv_ilp32.c
eelf32lriscv_ilp32f.c
+eelf32lriscv_fbsd.c
eelf32lsmip.c
eelf32ltsmip.c
eelf32ltsmip_fbsd.c
@@ -179,6 +181,7 @@ eelf64bpf.c
eelf64briscv.c
eelf64briscv_lp64.c
eelf64briscv_lp64f.c
+eelf64briscv_fbsd.c
eelf64btsmip.c
eelf64btsmip_fbsd.c
eelf64hppa.c
@@ -187,6 +190,7 @@ eelf64lppc_fbsd.c
eelf64lriscv.c
eelf64lriscv_lp64.c
eelf64lriscv_lp64f.c
+eelf64lriscv_fbsd.c
eelf64ltsmip.c
eelf64ltsmip_fbsd.c
eelf64mmix.c