From 868446278822747f3e2468289a5128f43f4cb505 Mon Sep 17 00:00:00 2001 From: maya Date: Mon, 15 Apr 2019 18:49:07 +0000 Subject: [PATCH] Re-do previous: emulate the addition of NETBSD_SUBTARGET_EXTRA_SPECS usually done by SUBTARGET_EXTRA_SPECS (not used in risc-v) with EXTRA_SPECS. Go back to using %(netbsd_link_spec) in our link spec, now that it's a valid string. Try to mimic other riscv OSes in our LINK_SPEC. they all start with "-melf" XLEN_SPEC "lriscv" LD_EMUL_SUFFIX and a definition of LD_EMUL_SUFFIX, let's copy the LD_EMUL_SUFFIX linux uses. Now we can link executables. --- .../gpl3/gcc/dist/gcc/config/riscv/netbsd.h | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/external/gpl3/gcc/dist/gcc/config/riscv/netbsd.h b/external/gpl3/gcc/dist/gcc/config/riscv/netbsd.h index d5b06374a633..3328acb69baf 100644 --- a/external/gpl3/gcc/dist/gcc/config/riscv/netbsd.h +++ b/external/gpl3/gcc/dist/gcc/config/riscv/netbsd.h @@ -48,17 +48,20 @@ Boston, MA 02111-1307, USA. */ #undef LIB_SPEC #define LIB_SPEC NETBSD_LIB_SPEC -#undef LINK_SPEC -#define LINK_SPEC NETBSD_LINK_SPEC_ELF -/* Provide a LINK_SPEC appropriate for a NetBSD/mips target. - This is a copy of LINK_SPEC from tweaked for - the MIPS target. */ +#define EXTRA_SPECS NETBSD_SUBTARGET_EXTRA_SPECS + +#define LD_EMUL_SUFFIX \ + "%{mabi=lp64d:}" \ + "%{mabi=lp64f:_lp64f}" \ + "%{mabi=lp64:_lp64}" \ + "%{mabi=ilp32d:}" \ + "%{mabi=ilp32f:_ilp32f}" \ + "%{mabi=ilp32:_ilp32}" #undef LINK_SPEC -#define LINK_SPEC \ - "%{m64:-m elf64lriscv} \ - %{m32:-m elf32lriscv}" \ - NETBSD_LINK_SPEC_ELF +#define LINK_SPEC "\ +-melf" XLEN_SPEC "lriscv" LD_EMUL_SUFFIX " \ +%(netbsd_link_spec)" #undef NETBSD_ENTRY_POINT #define NETBSD_ENTRY_POINT "_start"