tool_chain: use port mechanism

Fixes #2340
This commit is contained in:
Christian Prochaska
2017-03-17 13:10:55 +01:00
committed by Christian Helmuth
parent 6b3c79f674
commit 8903179537
38 changed files with 69 additions and 161 deletions

View File

@@ -1,633 +0,0 @@
diff --git a/bfd/Makefile.am b/bfd/Makefile.am
index 6f64f06..eb01c09 100644
--- a/bfd/Makefile.am
+++ b/bfd/Makefile.am
@@ -931,6 +931,18 @@ elf64-ia64.c : elfnn-ia64.c
sed -e s/NN/64/g < $(srcdir)/elfnn-ia64.c > elf64-ia64.new
mv -f elf64-ia64.new elf64-ia64.c
+elf32-riscv.c : elfnn-riscv.c
+ rm -f elf32-riscv.c
+ echo "#line 1 \"$(srcdir)/elfnn-riscv.c\"" > elf32-riscv.new
+ sed -e s/NN/32/g < $(srcdir)/elfnn-riscv.c >> elf32-riscv.new
+ mv -f elf32-riscv.new elf32-riscv.c
+
+elf64-riscv.c : elfnn-riscv.c
+ rm -f elf64-riscv.c
+ echo "#line 1 \"$(srcdir)/elfnn-riscv.c\"" > elf64-riscv.new
+ sed -e s/NN/64/g < $(srcdir)/elfnn-riscv.c >> elf64-riscv.new
+ mv -f elf64-riscv.new elf64-riscv.c
+
peigen.c : peXXigen.c
rm -f peigen.c
sed -e s/XX/pe/g < $(srcdir)/peXXigen.c > peigen.new
diff --git a/bfd/Makefile.in b/bfd/Makefile.in
index 2c385d5..abc26f7 100644
--- a/bfd/Makefile.in
+++ b/bfd/Makefile.in
@@ -442,6 +442,7 @@ ALL_MACHINES = \
cpu-pj.lo \
cpu-plugin.lo \
cpu-powerpc.lo \
+ cpu-riscv.lo \
cpu-rs6000.lo \
cpu-rl78.lo \
cpu-rx.lo \
@@ -526,6 +527,7 @@ ALL_MACHINES_CFILES = \
cpu-pj.c \
cpu-plugin.c \
cpu-powerpc.c \
+ cpu-riscv.c \
cpu-rs6000.c \
cpu-rl78.c \
cpu-rx.c \
@@ -2009,6 +2011,18 @@ elf64-ia64.c : elfnn-ia64.c
sed -e s/NN/64/g < $(srcdir)/elfnn-ia64.c > elf64-ia64.new
mv -f elf64-ia64.new elf64-ia64.c
+elf32-riscv.c : elfnn-riscv.c
+ rm -f elf32-riscv.c
+ echo "#line 1 \"$(srcdir)/elfnn-riscv.c\"" > elf32-riscv.new
+ sed -e s/NN/32/g < $(srcdir)/elfnn-riscv.c >> elf32-riscv.new
+ mv -f elf32-riscv.new elf32-riscv.c
+
+elf64-riscv.c : elfnn-riscv.c
+ rm -f elf64-riscv.c
+ echo "#line 1 \"$(srcdir)/elfnn-riscv.c\"" > elf64-riscv.new
+ sed -e s/NN/64/g < $(srcdir)/elfnn-riscv.c >> elf64-riscv.new
+ mv -f elf64-riscv.new elf64-riscv.c
+
peigen.c : peXXigen.c
rm -f peigen.c
sed -e s/XX/pe/g < $(srcdir)/peXXigen.c > peigen.new
diff --git a/bfd/archures.c b/bfd/archures.c
index c9fd6c8..8cbc157 100644
--- a/bfd/archures.c
+++ b/bfd/archures.c
@@ -597,6 +597,7 @@ extern const bfd_arch_info_type bfd_pj_arch;
extern const bfd_arch_info_type bfd_plugin_arch;
extern const bfd_arch_info_type bfd_powerpc_archs[];
#define bfd_powerpc_arch bfd_powerpc_archs[0]
+extern const bfd_arch_info_type bfd_riscv_arch;
extern const bfd_arch_info_type bfd_rs6000_arch;
extern const bfd_arch_info_type bfd_rl78_arch;
extern const bfd_arch_info_type bfd_rx_arch;
@@ -683,6 +684,7 @@ static const bfd_arch_info_type * const bfd_archures_list[] =
&bfd_or1k_arch,
&bfd_pdp11_arch,
&bfd_powerpc_arch,
+ &bfd_riscv_arch,
&bfd_rs6000_arch,
&bfd_rl78_arch,
&bfd_rx_arch,
diff --git a/bfd/bfd-in2.h b/bfd/bfd-in2.h
index c7a2bb5..9d79d14 100644
--- a/bfd/bfd-in2.h
+++ b/bfd/bfd-in2.h
@@ -2043,6 +2043,9 @@ enum bfd_architecture
#define bfd_mach_ppc_e6500 5007
#define bfd_mach_ppc_titan 83
#define bfd_mach_ppc_vle 84
+ bfd_arch_riscv, /* RISC-V */
+#define bfd_mach_riscv32 132
+#define bfd_mach_riscv64 164
bfd_arch_rs6000, /* IBM RS/6000 */
#define bfd_mach_rs6k 6000
#define bfd_mach_rs6k_rs1 6001
@@ -5531,6 +5534,43 @@ relative offset from _GLOBAL_OFFSET_TABLE_ */
value in a word. The relocation is relative offset from */
BFD_RELOC_MICROBLAZE_32_GOTOFF,
+/* RISC-V relocations. */
+ BFD_RELOC_RISCV_HI20,
+ BFD_RELOC_RISCV_PCREL_HI20,
+ BFD_RELOC_RISCV_PCREL_LO12_I,
+ BFD_RELOC_RISCV_PCREL_LO12_S,
+ BFD_RELOC_RISCV_LO12_I,
+ BFD_RELOC_RISCV_LO12_S,
+ BFD_RELOC_RISCV_GPREL12_I,
+ BFD_RELOC_RISCV_GPREL12_S,
+ BFD_RELOC_RISCV_TPREL_HI20,
+ BFD_RELOC_RISCV_TPREL_LO12_I,
+ BFD_RELOC_RISCV_TPREL_LO12_S,
+ BFD_RELOC_RISCV_TPREL_ADD,
+ BFD_RELOC_RISCV_CALL,
+ BFD_RELOC_RISCV_CALL_PLT,
+ BFD_RELOC_RISCV_ADD8,
+ BFD_RELOC_RISCV_ADD16,
+ BFD_RELOC_RISCV_ADD32,
+ BFD_RELOC_RISCV_ADD64,
+ BFD_RELOC_RISCV_SUB8,
+ BFD_RELOC_RISCV_SUB16,
+ BFD_RELOC_RISCV_SUB32,
+ BFD_RELOC_RISCV_SUB64,
+ BFD_RELOC_RISCV_GOT_HI20,
+ BFD_RELOC_RISCV_TLS_GOT_HI20,
+ BFD_RELOC_RISCV_TLS_GD_HI20,
+ BFD_RELOC_RISCV_JMP,
+ BFD_RELOC_RISCV_TLS_DTPMOD32,
+ BFD_RELOC_RISCV_TLS_DTPREL32,
+ BFD_RELOC_RISCV_TLS_DTPMOD64,
+ BFD_RELOC_RISCV_TLS_DTPREL64,
+ BFD_RELOC_RISCV_TLS_TPREL32,
+ BFD_RELOC_RISCV_TLS_TPREL64,
+ BFD_RELOC_RISCV_ALIGN,
+ BFD_RELOC_RISCV_RVC_BRANCH,
+ BFD_RELOC_RISCV_RVC_JUMP,
+
/* This is used to tell the dynamic linker to copy the value out of
the dynamic object into the runtime process image. */
BFD_RELOC_MICROBLAZE_COPY,
diff --git a/bfd/config.bfd b/bfd/config.bfd
index 7bcb92a..6f4b053 100644
--- a/bfd/config.bfd
+++ b/bfd/config.bfd
@@ -119,6 +119,7 @@ or1k*|or1knd*) targ_archs=bfd_or1k_arch ;;
pdp11*) targ_archs=bfd_pdp11_arch ;;
pj*) targ_archs="bfd_pj_arch bfd_i386_arch";;
powerpc*) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
+riscv*) targ_archs=bfd_riscv_arch ;;
rs6000) targ_archs="bfd_rs6000_arch bfd_powerpc_arch" ;;
s390*) targ_archs=bfd_s390_arch ;;
sh*) targ_archs=bfd_sh_arch ;;
@@ -1319,6 +1320,14 @@ case "${targ}" in
targ_defvec=rl78_elf32_vec
;;
+#ifdef BFD64
+ riscv*-*-*)
+ targ_defvec=riscv_elf64_vec
+ targ_selvecs="riscv_elf32_vec riscv_elf64_vec"
+ want64=true
+ ;;
+#endif
+
rx-*-elf)
targ_defvec=rx_elf32_le_vec
targ_selvecs="rx_elf32_be_vec rx_elf32_le_vec rx_elf32_be_ns_vec"
diff --git a/bfd/configure b/bfd/configure
index 7016194..aad4432 100755
--- a/bfd/configure
+++ b/bfd/configure
@@ -15506,6 +15506,8 @@ do
powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
powerpc_pei_le_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
powerpc_xcoff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
+ riscv_elf32_vec) tb="$tb elf32-riscv.lo elfxx-riscv.lo elf32.lo $elf" ;;
+ riscv_elf64_vec) tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.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 xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
rs6000_xcoff64_aix_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
diff --git a/bfd/configure.ac b/bfd/configure.ac
index ba98e39..93ad0d0 100644
--- a/bfd/configure.ac
+++ b/bfd/configure.ac
@@ -907,6 +907,8 @@ do
powerpc_pei_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
powerpc_pei_le_vec) tb="$tb pei-ppc.lo peigen.lo cofflink.lo" ;;
powerpc_xcoff_vec) tb="$tb coff-rs6000.lo xcofflink.lo" ;;
+ riscv_elf32_vec) tb="$tb elf32-riscv.lo elfxx-riscv.lo elf32.lo $elf" ;;
+ riscv_elf64_vec) tb="$tb elf64-riscv.lo elf64.lo elfxx-riscv.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 xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
rs6000_xcoff64_aix_vec) tb="$tb coff64-rs6000.lo xcofflink.lo aix5ppc-core.lo"; target_size=64 ;;
diff --git a/bfd/elf-bfd.h b/bfd/elf-bfd.h
index 72e7a66..dc488af 100644
--- a/bfd/elf-bfd.h
+++ b/bfd/elf-bfd.h
@@ -433,6 +433,7 @@ enum elf_target_id
XGATE_ELF_DATA,
TILEGX_ELF_DATA,
TILEPRO_ELF_DATA,
+ RISCV_ELF_DATA,
GENERIC_ELF_DATA
};
diff --git a/bfd/targets.c b/bfd/targets.c
index 8323e92..a28c0cf 100644
--- a/bfd/targets.c
+++ b/bfd/targets.c
@@ -784,6 +784,8 @@ extern const bfd_target powerpc_pe_le_vec;
extern const bfd_target powerpc_pei_vec;
extern const bfd_target powerpc_pei_le_vec;
extern const bfd_target powerpc_xcoff_vec;
+extern const bfd_target riscv_elf32_vec;
+extern const bfd_target riscv_elf64_vec;
extern const bfd_target rl78_elf32_vec;
extern const bfd_target rs6000_xcoff64_vec;
extern const bfd_target rs6000_xcoff64_aix_vec;
diff --git a/binutils/readelf.c b/binutils/readelf.c
index 0c00b2f..e3d7e5c 100644
--- a/binutils/readelf.c
+++ b/binutils/readelf.c
@@ -125,6 +125,7 @@
#include "elf/metag.h"
#include "elf/microblaze.h"
#include "elf/mips.h"
+#include "elf/riscv.h"
#include "elf/mmix.h"
#include "elf/mn10200.h"
#include "elf/mn10300.h"
@@ -720,6 +721,7 @@ guess_is_rela (unsigned int e_machine)
case EM_OR1K:
case EM_PPC64:
case EM_PPC:
+ case EM_RISCV:
case EM_RL78:
case EM_RX:
case EM_S390:
@@ -1252,6 +1254,10 @@ dump_relocations (FILE * file,
rtype = elf_mips_reloc_type (type);
break;
+ case EM_RISCV:
+ rtype = elf_riscv_reloc_type (type);
+ break;
+
case EM_ALPHA:
rtype = elf_alpha_reloc_type (type);
break;
@@ -2164,6 +2170,7 @@ get_machine_name (unsigned e_machine)
case EM_CR16:
case EM_MICROBLAZE:
case EM_MICROBLAZE_OLD: return "Xilinx MicroBlaze";
+ case EM_RISCV: return "RISC-V";
case EM_RL78: return "Renesas RL78";
case EM_RX: return "Renesas RX";
case EM_METAG: return "Imagination Technologies Meta processor architecture";
@@ -2951,6 +2958,16 @@ get_machine_flags (unsigned e_flags, unsigned e_machine)
decode_NDS32_machine_flags (e_flags, buf, sizeof buf);
break;
+ case EM_RISCV:
+ if (e_flags & EF_RISCV_RVC)
+ strcat (buf, ", RVC");
+
+ if (!EF_GET_RISCV_EXT (e_flags))
+ break;
+ strcat (buf, ", ");
+ strcat (buf, riscv_elf_flag_to_name (EF_GET_RISCV_EXT (e_flags)));
+ break;
+
case EM_SH:
switch ((e_flags & EF_SH_MACH_MASK))
{
@@ -10789,6 +10806,8 @@ is_32bit_abs_reloc (unsigned int reloc_type)
return reloc_type == 1; /* R_PPC64_ADDR32. */
case EM_PPC:
return reloc_type == 1; /* R_PPC_ADDR32. */
+ case EM_RISCV:
+ return reloc_type == 1; /* R_RISCV_32. */
case EM_RL78:
return reloc_type == 1; /* R_RL78_DIR32. */
case EM_RX:
@@ -10924,6 +10943,8 @@ is_64bit_abs_reloc (unsigned int reloc_type)
return reloc_type == 80; /* R_PARISC_DIR64. */
case EM_PPC64:
return reloc_type == 38; /* R_PPC64_ADDR64. */
+ case EM_RISCV:
+ return reloc_type == 2; /* R_RISCV_64. */
case EM_SPARC32PLUS:
case EM_SPARCV9:
case EM_SPARC:
@@ -11072,6 +11093,7 @@ is_none_reloc (unsigned int reloc_type)
case EM_ADAPTEVA_EPIPHANY:
case EM_PPC: /* R_PPC_NONE. */
case EM_PPC64: /* R_PPC64_NONE. */
+ case EM_RISCV: /* R_RISCV_NONE. */
case EM_ARM: /* R_ARM_NONE. */
case EM_IA_64: /* R_IA64_NONE. */
case EM_SH: /* R_SH_NONE. */
diff --git a/config.sub b/config.sub
index 88a0cb4..2d4be2f 100755
--- a/config.sub
+++ b/config.sub
@@ -335,6 +335,9 @@ case $basic_machine in
ms1)
basic_machine=mt-unknown
;;
+ riscv)
+ basic_machine=riscv-ucb
+ ;;
strongarm | thumb | xscale)
basic_machine=arm-unknown
diff --git a/gas/Makefile.am b/gas/Makefile.am
index 55c86b2..03684bd 100644
--- a/gas/Makefile.am
+++ b/gas/Makefile.am
@@ -171,6 +171,7 @@ TARGET_CPU_CFILES = \
config/tc-pdp11.c \
config/tc-pj.c \
config/tc-ppc.c \
+ config/tc-riscv.c \
config/tc-rl78.c \
config/tc-rx.c \
config/tc-s390.c \
@@ -242,6 +243,7 @@ TARGET_CPU_HFILES = \
config/tc-pdp11.h \
config/tc-pj.h \
config/tc-ppc.h \
+ config/tc-riscv.h \
config/tc-rl78.h \
config/tc-rx.h \
config/tc-s390.h \
diff --git a/gas/Makefile.in b/gas/Makefile.in
index 5dc250f..f53808b 100644
--- a/gas/Makefile.in
+++ b/gas/Makefile.in
@@ -440,6 +440,7 @@ TARGET_CPU_CFILES = \
config/tc-pdp11.c \
config/tc-pj.c \
config/tc-ppc.c \
+ config/tc-riscv.c \
config/tc-rl78.c \
config/tc-rx.c \
config/tc-s390.c \
@@ -511,6 +512,7 @@ TARGET_CPU_HFILES = \
config/tc-pdp11.h \
config/tc-pj.h \
config/tc-ppc.h \
+ config/tc-riscv.h \
config/tc-rl78.h \
config/tc-rx.h \
config/tc-s390.h \
@@ -866,6 +868,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-pdp11.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-pj.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-ppc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-riscv.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-rl78.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-rx.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tc-s390.Po@am__quote@
@@ -1571,6 +1574,20 @@ tc-ppc.obj: config/tc-ppc.c
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tc-ppc.obj `if test -f 'config/tc-ppc.c'; then $(CYGPATH_W) 'config/tc-ppc.c'; else $(CYGPATH_W) '$(srcdir)/config/tc-ppc.c'; fi`
+tc-riscv.o: config/tc-riscv.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tc-riscv.o -MD -MP -MF $(DEPDIR)/tc-riscv.Tpo -c -o tc-riscv.o `test -f 'config/tc-riscv.c' || echo '$(srcdir)/'`config/tc-riscv.c
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tc-riscv.Tpo $(DEPDIR)/tc-riscv.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config/tc-riscv.c' object='tc-riscv.o' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tc-riscv.o `test -f 'config/tc-riscv.c' || echo '$(srcdir)/'`config/tc-riscv.c
+
+tc-riscv.obj: config/tc-riscv.c
+@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tc-riscv.obj -MD -MP -MF $(DEPDIR)/tc-riscv.Tpo -c -o tc-riscv.obj `if test -f 'config/tc-riscv.c'; then $(CYGPATH_W) 'config/tc-riscv.c'; else $(CYGPATH_W) '$(srcdir)/config/tc-riscv.c'; fi`
+@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tc-riscv.Tpo $(DEPDIR)/tc-riscv.Po
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='config/tc-riscv.c' object='tc-riscv.obj' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tc-riscv.obj `if test -f 'config/tc-riscv.c'; then $(CYGPATH_W) 'config/tc-riscv.c'; else $(CYGPATH_W) '$(srcdir)/config/tc-riscv.c'; fi`
+
tc-rl78.o: config/tc-rl78.c
@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT tc-rl78.o -MD -MP -MF $(DEPDIR)/tc-rl78.Tpo -c -o tc-rl78.o `test -f 'config/tc-rl78.c' || echo '$(srcdir)/'`config/tc-rl78.c
@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/tc-rl78.Tpo $(DEPDIR)/tc-rl78.Po
diff --git a/gas/configure b/gas/configure
index 76b5f20..81e4ba1 100755
--- a/gas/configure
+++ b/gas/configure
@@ -12400,7 +12400,7 @@ $as_echo "#define NDS32_DEFAULT_AUDIO_EXT 1" >>confdefs.h
$as_echo "$enable_audio_ext" >&6; }
;;
- i386 | s390 | sparc)
+ i386 | riscv | s390 | sparc)
if test $this_target = $target ; then
cat >>confdefs.h <<_ACEOF
diff --git a/gas/configure.ac b/gas/configure.ac
index 371f7b3..357a21c 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -453,7 +453,7 @@ changequote([,])dnl
AC_MSG_RESULT($enable_audio_ext)
;;
- i386 | s390 | sparc)
+ i386 | riscv | s390 | sparc)
if test $this_target = $target ; then
AC_DEFINE_UNQUOTED(DEFAULT_ARCH, "${arch}", [Default architecture.])
fi
diff --git a/gas/configure.tgt b/gas/configure.tgt
index d07d445..6baa15f 100644
--- a/gas/configure.tgt
+++ b/gas/configure.tgt
@@ -86,6 +86,8 @@ case ${cpu} in
pj*) cpu_type=pj endian=big ;;
powerpc*le*) cpu_type=ppc endian=little ;;
powerpc*) cpu_type=ppc endian=big ;;
+ riscv32*) cpu_type=riscv endian=little arch=riscv32 ;;
+ riscv*) cpu_type=riscv endian=little arch=riscv64 ;;
rs6000*) cpu_type=ppc ;;
rl78*) cpu_type=rl78 ;;
rx) cpu_type=rx ;;
@@ -384,6 +386,8 @@ case ${generic_target} in
ppc-*-kaos*) fmt=elf ;;
ppc-*-lynxos*) fmt=elf em=lynx ;;
+ riscv*-*-*) fmt=elf endian=little em=linux ;;
+
s390-*-linux-*) fmt=elf em=linux ;;
s390-*-tpf*) fmt=elf ;;
@@ -478,7 +482,7 @@ case ${generic_target} in
esac
case ${cpu_type} in
- aarch64 | alpha | arm | i386 | ia64 | microblaze | mips | ns32k | or1k | or1knd | pdp11 | ppc | sparc | z80 | z8k)
+ aarch64 | alpha | arm | i386 | ia64 | microblaze | mips | ns32k | or1k | or1knd | pdp11 | ppc | riscv | sparc | z80 | z8k)
bfd_gas=yes
;;
esac
diff --git a/include/dis-asm.h b/include/dis-asm.h
index 1b653b5..d53b9b2 100644
--- a/include/dis-asm.h
+++ b/include/dis-asm.h
@@ -254,6 +254,7 @@ extern int print_insn_little_arm (bfd_vma, disassemble_info *);
extern int print_insn_little_mips (bfd_vma, disassemble_info *);
extern int print_insn_little_nios2 (bfd_vma, disassemble_info *);
extern int print_insn_little_powerpc (bfd_vma, disassemble_info *);
+extern int print_insn_riscv (bfd_vma, disassemble_info *);
extern int print_insn_little_score (bfd_vma, disassemble_info *);
extern int print_insn_lm32 (bfd_vma, disassemble_info *);
extern int print_insn_m32c (bfd_vma, disassemble_info *);
@@ -313,6 +314,7 @@ extern void print_aarch64_disassembler_options (FILE *);
extern void print_i386_disassembler_options (FILE *);
extern void print_mips_disassembler_options (FILE *);
extern void print_ppc_disassembler_options (FILE *);
+extern void print_riscv_disassembler_options (FILE *);
extern void print_arm_disassembler_options (FILE *);
extern void parse_arm_disassembler_option (char *);
extern void print_s390_disassembler_options (FILE *);
diff --git a/include/elf/common.h b/include/elf/common.h
index e8ae3ac..ad24500 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -301,6 +301,7 @@
#define EM_INTEL207 207 /* Reserved by Intel */
#define EM_INTEL208 208 /* Reserved by Intel */
#define EM_INTEL209 209 /* Reserved by Intel */
+#define EM_RISCV 243 /* RISC-V */
/* If it is necessary to assign new unofficial EM_* values, please pick large
random numbers (0x8523, 0xa7f2, etc.) to minimize the chances of collision
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 9575f1f..04664a0 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -258,6 +258,7 @@ ALL_EMULATION_SOURCES = \
eelf32ppcsim.c \
eelf32ppcvxworks.c \
eelf32ppcwindiss.c \
+ eelf32lriscv.c \
eelf32rl78.c \
eelf32rx.c \
eelf32tilegx.c \
@@ -464,6 +465,7 @@ ALL_64_EMULATION_SOURCES = \
eelf64btsmip_fbsd.c \
eelf64hppa.c \
eelf64lppc.c \
+ eelf64lriscv.c \
eelf64ltsmip.c \
eelf64ltsmip_fbsd.c \
eelf64mmix.c \
@@ -1104,6 +1106,11 @@ eelf32lppcsim.c: $(srcdir)/emulparams/elf32lppcsim.sh \
ldemul-list.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+eelf32lriscv.c: $(srcdir)/emulparams/elf32lriscv.sh \
+ $(srcdir)/emulparams/elf32lriscv-defs.sh $(ELF_DEPS) \
+ $(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
+ ${GEN_DEPENDS}
+
eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \
$(srcdir)/emulparams/elf32lmip.sh $(srcdir)/emulparams/elf32bmip.sh \
$(ELF_DEPS) $(srcdir)/emultempl/mipself.em $(srcdir)/scripttempl/elf.sc \
@@ -1861,6 +1868,12 @@ eelf64lppc.c: $(srcdir)/emulparams/elf64lppc.sh \
ldemul-list.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+eelf64lriscv.c: $(srcdir)/emulparams/elf64lriscv.sh \
+ $(srcdir)/emulparams/elf64lriscv-defs.sh \
+ $(srcdir)/emulparams/elf32lriscv-defs.sh $(ELF_DEPS) \
+ $(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
+ ${GEN_DEPENDS}
+
eelf64ltsmip.c: $(srcdir)/emulparams/elf64ltsmip.sh \
$(srcdir)/emulparams/elf64btsmip.sh $(srcdir)/emulparams/elf64bmip-defs.sh \
$(srcdir)/emulparams/elf32bmipn32-defs.sh $(ELF_DEPS) \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 9f56ca1..4307710 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -546,6 +546,7 @@ ALL_EMULATION_SOURCES = \
eelf32lppclinux.c \
eelf32lppcnto.c \
eelf32lppcsim.c \
+ eelf32lriscv.c \
eelf32m32c.c \
eelf32mb_linux.c \
eelf32mbel_linux.c \
@@ -771,6 +772,7 @@ ALL_64_EMULATION_SOURCES = \
eelf64btsmip_fbsd.c \
eelf64hppa.c \
eelf64lppc.c \
+ eelf64lriscv.c \
eelf64ltsmip.c \
eelf64ltsmip_fbsd.c \
eelf64mmix.c \
@@ -1157,6 +1159,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lppclinux.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lppcnto.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lppcsim.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lriscv.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lr5900.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lr5900n32.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32lsmip.Po@am__quote@
@@ -1211,6 +1214,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64btsmip_fbsd.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64hppa.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lppc.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf64lriscv.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@
@@ -2545,6 +2549,11 @@ eelf32lppcsim.c: $(srcdir)/emulparams/elf32lppcsim.sh \
ldemul-list.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+eelf32lriscv.c: $(srcdir)/emulparams/elf32lriscv.sh \
+ $(srcdir)/emulparams/elf32lriscv-defs.sh $(ELF_DEPS) \
+ $(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
+ ${GEN_DEPENDS}
+
eelf32lsmip.c: $(srcdir)/emulparams/elf32lsmip.sh \
$(srcdir)/emulparams/elf32lmip.sh $(srcdir)/emulparams/elf32bmip.sh \
$(ELF_DEPS) $(srcdir)/emultempl/mipself.em $(srcdir)/scripttempl/elf.sc \
@@ -3302,6 +3311,12 @@ eelf64lppc.c: $(srcdir)/emulparams/elf64lppc.sh \
ldemul-list.h \
$(ELF_DEPS) $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS}
+eelf64lriscv.c: $(srcdir)/emulparams/elf64lriscv.sh \
+ $(srcdir)/emulparams/elf64lriscv-defs.sh \
+ $(srcdir)/emulparams/elf32lriscv-defs.sh $(ELF_DEPS) \
+ $(srcdir)/emultempl/riscvelf.em $(srcdir)/scripttempl/elf.sc \
+ ${GEN_DEPENDS}
+
eelf64ltsmip.c: $(srcdir)/emulparams/elf64ltsmip.sh \
$(srcdir)/emulparams/elf64btsmip.sh $(srcdir)/emulparams/elf64bmip-defs.sh \
$(srcdir)/emulparams/elf32bmipn32-defs.sh $(ELF_DEPS) \
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 24e36d1..11353f3 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -604,6 +604,12 @@ powerpc-*-aix*) targ_emul=aixppc ;;
powerpc-*-beos*) targ_emul=aixppc ;;
powerpc-*-windiss*) targ_emul=elf32ppcwindiss ;;
powerpc-*-lynxos*) targ_emul=ppclynx ;;
+riscv32*-*-*) targ_emul=elf32lriscv
+ targ_extra_emuls="elf64lriscv"
+ targ_extra_libpath=$targ_extra_emuls ;;
+riscv*-*-*) targ_emul=elf64lriscv
+ targ_extra_emuls="elf32lriscv"
+ targ_extra_libpath=$targ_extra_emuls ;;
rs6000-*-aix[5-9]*) targ_emul=aix5rs6 ;;
rs6000-*-aix*) targ_emul=aixrs6
;;
diff --git a/opcodes/configure b/opcodes/configure
index 1361ef6..f8fca0c 100755
--- a/opcodes/configure
+++ b/opcodes/configure
@@ -12590,6 +12590,7 @@ if test x${all_targets} = xfalse ; then
bfd_powerpc_arch) ta="$ta ppc-dis.lo ppc-opc.lo" ;;
bfd_powerpc_64_arch) ta="$ta ppc-dis.lo ppc-opc.lo" ;;
bfd_pyramid_arch) ;;
+ bfd_riscv_arch) ta="$ta riscv-dis.lo riscv-opc.lo" ;;
bfd_romp_arch) ;;
bfd_rs6000_arch) ta="$ta ppc-dis.lo ppc-opc.lo" ;;
bfd_rl78_arch) ta="$ta rl78-dis.lo rl78-decode.lo";;
diff --git a/opcodes/disassemble.c b/opcodes/disassemble.c
index 0a0814e..1e83180 100644
--- a/opcodes/disassemble.c
+++ b/opcodes/disassemble.c
@@ -373,6 +373,11 @@ disassembler (abfd)
disassemble = print_insn_little_powerpc;
break;
#endif
+#ifdef ARCH_riscv
+ case bfd_arch_riscv:
+ disassemble = print_insn_riscv;
+ break;
+#endif
#ifdef ARCH_rs6000
case bfd_arch_rs6000:
if (bfd_get_mach (abfd) == bfd_mach_ppc_620)
@@ -545,6 +550,9 @@ disassembler_usage (stream)
#ifdef ARCH_powerpc
print_ppc_disassembler_options (stream);
#endif
+#ifdef ARCH_riscv
+ print_riscv_disassembler_options (stream);
+#endif
#ifdef ARCH_i386
print_i386_disassembler_options (stream);
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -1,2 +0,0 @@
riscv_files.patch
riscv.patch

View File

@@ -1,154 +0,0 @@
diff --git a/gcc/config.gcc b/gcc/config.gcc
index b7ebc07..5acf469 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -1060,7 +1060,7 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*)
case ${target} in
arm*-*-eabi*)
tm_file="$tm_file newlib-stdint.h"
- tmake_file="${tmake_file} arm/t-bpabi"
+ tmake_file="${tmake_file} arm/t-bpabi t-slibgcc"
use_gcc_stdint=wrap
;;
arm*-*-rtems*)
@@ -1969,7 +1969,7 @@ riscv*-*-linux*) # Linux RISC-V
;;
riscv*-*-elf*) # Linux RISC-V
tm_file="elfos.h newlib-stdint.h ${tm_file} riscv/elf.h"
- tmake_file="${tmake_file} riscv/t-elf"
+ tmake_file="${tmake_file} riscv/t-elf t-slibgcc"
gnu_ld=yes
gas=yes
gcc_cv_initfini_array=yes
@@ -2915,7 +2915,7 @@ i[34567]86-*-linux* | x86_64-*-linux*)
tmake_file="${tmake_file} i386/t-pmm_malloc i386/t-i386"
;;
i[34567]86-*-* | x86_64-*-*)
- tmake_file="${tmake_file} i386/t-gmm_malloc i386/t-i386"
+ tmake_file="${tmake_file} i386/t-gmm_malloc i386/t-i386 t-slibgcc"
;;
powerpc*-*-* | rs6000-*-*)
tm_file="${tm_file} rs6000/option-defaults.h"
diff --git a/gcc/config/arm/unknown-elf.h b/gcc/config/arm/unknown-elf.h
index ec6f9a4..579172d 100644
--- a/gcc/config/arm/unknown-elf.h
+++ b/gcc/config/arm/unknown-elf.h
@@ -94,3 +94,19 @@
which will depend on abort, which is defined in libc. */
#undef LINK_GCC_C_SEQUENCE_SPEC
#define LINK_GCC_C_SEQUENCE_SPEC "--start-group %G %L --end-group"
+
+/* genode.h */
+
+/*
+ * The 'LINK_SPEC' define comprises the rules of how the GCC frontend invokes
+ * the linker.
+ */
+
+#undef LINK_SPEC
+#define LINK_SPEC \
+ "%(shared:-shared) \
+ %{!static:--eh-frame-hdr}"
+
+/* Don't assume anything about the header files. */
+/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57699 */
+#define NO_IMPLICIT_EXTERN_C
diff --git a/gcc/config/i386/x86-64.h b/gcc/config/i386/x86-64.h
index 16fc685..85b07bb 100644
--- a/gcc/config/i386/x86-64.h
+++ b/gcc/config/i386/x86-64.h
@@ -106,3 +106,22 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#undef TARGET_SECTION_TYPE_FLAGS
#define TARGET_SECTION_TYPE_FLAGS x86_64_elf_section_type_flags
+
+/* genode64.h */
+
+/*
+ * The 'LINK_SPEC' macro expresses the policy of how the GCC
+ * frontend invokes 'ld' on multiarch platforms. I.e., on x86, we need to pass
+ * '-melf_i386' to 'ld' when building in '-m32' mode.
+ */
+
+#undef LINK_SPEC
+#define LINK_SPEC \
+ "%{!m32:-m elf_x86_64} \
+ %{m32:-m elf_i386} \
+ %{shared:-shared} \
+ %{!static:--eh-frame-hdr}"
+
+/* Don't assume anything about the header files. */
+/* https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57699 */
+#define NO_IMPLICIT_EXTERN_C
diff --git a/gcc/config/riscv/riscv.h b/gcc/config/riscv/riscv.h
index 4533cff..1f78497 100644
--- a/gcc/config/riscv/riscv.h
+++ b/gcc/config/riscv/riscv.h
@@ -171,14 +171,11 @@ along with GCC; see the file COPYING3. If not see
%(subtarget_asm_spec)"
/* Extra switches sometimes passed to the linker. */
-
-#ifndef LINK_SPEC
+#undef LINK_SPEC
#define LINK_SPEC "\
-%{!T:-dT riscv.ld} \
-%{m64:-melf64lriscv} \
-%{m32:-melf32lriscv} \
-%{shared}"
-#endif /* LINK_SPEC defined */
+-melf64lriscv \
+%{shared:-shared} \
+%{!static:--eh-frame-hdr}"
/* This macro defines names of additional specifications to put in the specs
that can be used in various specifications like CC1_SPEC. Its definition
diff --git a/libgcc/config.host b/libgcc/config.host
index 8a30368..83b5dba 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -300,7 +300,7 @@ case ${host} in
tmake_file=t-vxworks
;;
*-*-elf)
- extra_parts="crtbegin.o crtend.o"
+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
;;
esac
@@ -387,8 +387,12 @@ arm*-*-eabi* | arm*-*-symbianelf* | arm*-*-rtems*)
tm_file="$tm_file arm/bpabi-lib.h"
case ${host} in
arm*-*-eabi* | arm*-*-rtems*)
+ # The 't-slibgcc' tmake file is needed to have libgcc_eh.a built.
+ # The 't-eh-dw2-dip' tmake file is needed to let the tool chain use 'unwind-dw2-fde-dip.c',
+ # needed for the exception handling on Genode in the presence of shared libraries.
+ tmake_file="${tmake_file} t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
tmake_file="${tmake_file} arm/t-bpabi"
- extra_parts="crtbegin.o crtend.o crti.o crtn.o"
+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
;;
arm*-*-symbianelf*)
tmake_file="${tmake_file} arm/t-symbian t-slibgcc-nolc-override"
@@ -546,6 +550,10 @@ i[34567]86-*-elf*)
tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
;;
x86_64-*-elf*)
+ # The 't-slibgcc' tmake file is needed to have libgcc_eh.a built.
+ # The 't-eh-dw2-dip' tmake file is needed to let the tool chain use 'unwind-dw2-fde-dip.c',
+ # needed for the exception handling on Genode in the presence of shared libraries.
+ tmake_file="$tmake_file t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic"
;;
i[34567]86-*-freebsd*)
@@ -1014,8 +1022,8 @@ riscv*-*-linux*)
extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o"
;;
riscv*-*-*)
- tmake_file="${tmake_file} riscv/t-fpbit riscv/t-dpbit riscv/t-elf"
- extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o"
+ tmake_file="${tmake_file} riscv/t-fpbit riscv/t-dpbit riscv/t-elf t-crtstuff-pic t-libgcc-pic t-eh-dw2-dip t-slibgcc t-slibgcc-gld t-slibgcc-elf-ver"
+ extra_parts="crtbegin.o crtbeginS.o crtbeginT.o crtend.o crtendS.o"
;;
rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*)
md_unwind_header=rs6000/aix-unwind.h

View File

@@ -1,33 +0,0 @@
Required for building with newer gcc
See https://gcc.gnu.org/ml/gcc-patches/2015-08/msg00375.html
--
diff --git a/gcc/cp/cfns.gperf b/gcc/cp/cfns.gperf
index 68acd3d..953262f 100644
--- a/gcc/cp/cfns.gperf
+++ b/gcc/cp/cfns.gperf
@@ -22,6 +22,9 @@ __inline
static unsigned int hash (const char *, unsigned int);
#ifdef __GNUC__
__inline
+#ifdef __GNUC_STDC_INLINE__
+__attribute__ ((__gnu_inline__))
+#endif
#endif
const char * libc_name_p (const char *, unsigned int);
%}
diff --git a/gcc/cp/cfns.h b/gcc/cp/cfns.h
index 1c6665d..6d00c0e 100644
--- a/gcc/cp/cfns.h
+++ b/gcc/cp/cfns.h
@@ -53,6 +53,9 @@ __inline
static unsigned int hash (const char *, unsigned int);
#ifdef __GNUC__
__inline
+#ifdef __GNUC_STDC_INLINE__
+__attribute__ ((__gnu_inline__))
+#endif
#endif
const char * libc_name_p (const char *, unsigned int);
/* maximum key range = 391, duplicates = 0 */

View File

@@ -1,22 +0,0 @@
go_libbacktrace.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
Remove the dependency on libbacktrace, which needs a libc.
---
gcc/go/config-lang.in | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/go/config-lang.in b/gcc/go/config-lang.in
index c33e218..ca2b3b1 100644
--- a/gcc/go/config-lang.in
+++ b/gcc/go/config-lang.in
@@ -28,7 +28,7 @@ language="go"
compilers="go1\$(exeext)"
-target_libs="target-libgo target-libffi target-libbacktrace"
+target_libs="target-libgo target-libffi"
# The Go frontend is written in C++, so we need to build the C++
# compiler during stage 1.

View File

@@ -1,27 +0,0 @@
host_target_combination.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
Remove sanity check for host/target combination in configure script of
libstdc++. An alternative fix would be the addition of a new host or
the use of an existing one. However, adding a new host would require
us to maintain a larger patch to the GCC build system, and using an
existing host comes with all the (possibly unwanted) policies associated
with the respective host platform. We want to stick with the bare-bone
compiler as much as possible.
---
libstdc++-v3/crossconfig.m4 | 1 -
1 file changed, 1 deletion(-)
diff --git a/libstdc++-v3/crossconfig.m4 b/libstdc++-v3/crossconfig.m4
index 15d876e..e026e9a 100644
--- a/libstdc++-v3/crossconfig.m4
+++ b/libstdc++-v3/crossconfig.m4
@@ -278,7 +278,6 @@ case "${host}" in
AC_DEFINE(HAVE_TANHF)
;;
*)
- AC_MSG_ERROR([No support for this host/target combination.])
;;
esac
])

View File

@@ -1,33 +0,0 @@
libgcc_s.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
---
libgcc/Makefile.in | 6 +-----
1 file changed, 1 insertion(+), 5 deletions(-)
diff --git a/libgcc/Makefile.in b/libgcc/Makefile.in
index e86e98d..ca2275d 100644
--- a/libgcc/Makefile.in
+++ b/libgcc/Makefile.in
@@ -907,7 +907,7 @@ libgcc_s$(SHLIB_EXT): libunwind$(SHLIB_EXT)
endif
ifeq ($(enable_shared),yes)
-all: libgcc_eh.a libgcc_s$(SHLIB_EXT)
+all: libgcc_eh.a
ifneq ($(LIBUNWIND),)
all: libunwind$(SHLIB_EXT)
endif
@@ -1090,10 +1090,6 @@ install-shared:
chmod 644 $(DESTDIR)$(inst_libdir)/libgcc_eh.a
$(RANLIB) $(DESTDIR)$(inst_libdir)/libgcc_eh.a
- $(subst @multilib_dir@,$(MULTIDIR),$(subst \
- @shlib_base_name@,libgcc_s,$(subst \
- @shlib_slibdir_qual@,$(MULTIOSSUBDIR),$(SHLIB_INSTALL))))
-
install-leaf: $(install-shared) $(install-libunwind)
$(mkinstalldirs) $(DESTDIR)$(inst_libdir)

View File

@@ -1,44 +0,0 @@
stdcxx_without_libc.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
---
libstdc++-v3/configure.ac | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 3e8b9c5..1543c25 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -89,9 +89,9 @@ CXXFLAGS="$save_CXXFLAGS"
GLIBCXX_CONFIGURE
# Libtool setup.
-if test "x${with_newlib}" != "xyes"; then
- AC_LIBTOOL_DLOPEN
-fi
+#if test "x${with_newlib}" != "xyes"; then
+# AC_LIBTOOL_DLOPEN
+#fi
AM_PROG_LIBTOOL
ACX_LT_HOST_FLAGS
AC_SUBST(enable_shared)
@@ -205,7 +205,7 @@ AC_CHECK_HEADERS(fenv.h complex.h)
GLIBCXX_CHECK_C99_TR1
# For the EOF, SEEK_CUR, and SEEK_END integer constants.
-GLIBCXX_COMPUTE_STDIO_INTEGER_CONSTANTS
+#GLIBCXX_COMPUTE_STDIO_INTEGER_CONSTANTS
# For gettimeofday support.
GLIBCXX_CHECK_GETTIMEOFDAY
@@ -358,7 +358,7 @@ GCC_CHECK_UNWIND_GETIPINFO
GCC_LINUX_FUTEX([AC_DEFINE(HAVE_LINUX_FUTEX, 1, [Define if futex syscall is available.])])
-GCC_HEADER_STDINT(include/gstdint.h)
+#GCC_HEADER_STDINT(include/gstdint.h)
GLIBCXX_ENABLE_SYMVERS([yes])
AC_SUBST(libtool_VERSION)

View File

@@ -1,86 +0,0 @@
Enable '___cxa_demangle()' in libsupc++
From: Christian Prochaska <christian.prochaska@genode-labs.com>
---
include/libiberty.h | 4 ++++
libiberty/cp-demangle.c | 4 +++-
libstdc++-v3/libsupc++/Makefile.in | 10 +++++-----
3 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/include/libiberty.h b/include/libiberty.h
index 78c42eb..4fcf284 100644
--- a/include/libiberty.h
+++ b/include/libiberty.h
@@ -47,7 +47,11 @@ extern "C" {
/* Get a definition for va_list. */
#include <stdarg.h>
+#ifdef GENODE
+#define FILE void
+#else
#include <stdio.h>
+#endif
/* If the OS supports it, ensure that the supplied stream is setup to
avoid any multi-threaded locking. Otherwise leave the FILE pointer
diff --git a/libiberty/cp-demangle.c b/libiberty/cp-demangle.c
index 3d5d33e..e5f542f 100644
--- a/libiberty/cp-demangle.c
+++ b/libiberty/cp-demangle.c
@@ -103,7 +103,9 @@
#include "config.h"
#endif
+#ifndef GENODE
#include <stdio.h>
+#endif
#ifdef HAVE_STDLIB_H
#include <stdlib.h>
@@ -5875,7 +5877,7 @@ d_demangle (const char *mangled, int options, size_t *palc)
return dgs.buf;
}
-#if defined(IN_LIBGCC2) || defined(IN_GLIBCPP_V3)
+#if defined(IN_LIBGCC2) || defined(IN_GLIBCPP_V3) || defined(GENODE)
extern char *__cxa_demangle (const char *, char *, size_t *, int *);
diff --git a/libstdc++-v3/libsupc++/Makefile.in b/libstdc++-v3/libsupc++/Makefile.in
index 88b237e..f861d29 100644
--- a/libstdc++-v3/libsupc++/Makefile.in
+++ b/libstdc++-v3/libsupc++/Makefile.in
@@ -104,7 +104,7 @@ am__objects_1 = array_type_info.lo atexit_arm.lo atexit_thread.lo \
new_opv.lo new_opvnt.lo pbase_type_info.lo pmem_type_info.lo \
pointer_type_info.lo pure.lo si_class_type_info.lo tinfo.lo \
tinfo2.lo vec.lo vmi_class_type_info.lo vterminate.lo
-@GLIBCXX_HOSTED_TRUE@am__objects_2 = cp-demangle.lo
+am__objects_2 = cp-demangle.lo
@ENABLE_VTABLE_VERIFY_TRUE@am__objects_3 = vtv_stubs.lo
am_libsupc___la_OBJECTS = $(am__objects_1) $(am__objects_2) \
$(am__objects_3)
@@ -367,8 +367,8 @@ bits_HEADERS = \
exception_defines.h exception_ptr.h hash_bytes.h nested_exception.h
headers = $(std_HEADERS) $(bits_HEADERS)
-@GLIBCXX_HOSTED_TRUE@c_sources = \
-@GLIBCXX_HOSTED_TRUE@ cp-demangle.c
+c_sources = \
+ cp-demangle.c
sources = \
array_type_info.cc \
@@ -801,9 +801,9 @@ cp-demangle.c:
rm -f $@
$(LN_S) $(toplevel_srcdir)/libiberty/cp-demangle.c $@
cp-demangle.lo: cp-demangle.c
- $(LTCOMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
+ $(LTCOMPILE) -DGENODE -Wno-error -c $<
cp-demangle.o: cp-demangle.c
- $(C_COMPILE) -DIN_GLIBCPP_V3 -Wno-error -c $<
+ $(C_COMPILE) -DGENODE -Wno-error -c $<
# Use special rules for the C++11 sources so that the proper flags are passed.
bad_array_length.lo: bad_array_length.cc

View File

@@ -1,36 +0,0 @@
misc.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
Changes lacking documentation
---
libgcc/config/t-libunwind-elf | 2 +-
libgcc/config/t-slibgcc | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/libgcc/config/t-libunwind-elf b/libgcc/config/t-libunwind-elf
index beacf04..4556eb1 100644
--- a/libgcc/config/t-libunwind-elf
+++ b/libgcc/config/t-libunwind-elf
@@ -32,7 +32,7 @@ SHLIBUNWIND_SONAME = @shlib_base_name@.so.$(SHLIBUNWIND_SOVERSION)
SHLIBUNWIND_LINK = $(CC) $(LIBGCC2_CFLAGS) -shared \
-nodefaultlibs -Wl,-h,$(SHLIBUNWIND_SONAME) \
-Wl,-z,text -Wl,-z,defs -o $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME).tmp \
- @multilib_flags@ $(SHLIB_OBJS) -lc && \
+ @multilib_flags@ $(SHLIB_OBJS) && \
rm -f $(SHLIB_DIR)/$(SHLIB_SOLINK) && \
if [ -f $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME) ]; then \
mv -f $(SHLIB_DIR)/$(SHLIBUNWIND_SONAME) \
diff --git a/libgcc/config/t-slibgcc b/libgcc/config/t-slibgcc
index 1696fe8..0beb525 100644
--- a/libgcc/config/t-slibgcc
+++ b/libgcc/config/t-slibgcc
@@ -26,7 +26,7 @@ SHLIB_MAP = @shlib_map_file@
SHLIB_OBJS = @shlib_objs@
SHLIB_DIR = @multilib_dir@
SHLIB_SLIBDIR_QUAL = @shlib_slibdir_qual@
-SHLIB_LC = -lc
+SHLIB_LC =
SHLIB_MAKE_SOLINK = $(LN_S) $(SHLIB_SONAME) $(SHLIB_DIR)/$(SHLIB_SOLINK)
SHLIB_INSTALL_SOLINK = $(LN_S) $(SHLIB_SONAME) \
$(DESTDIR)$(slibdir)$(SHLIB_SLIBDIR_QUAL)/$(SHLIB_SOLINK)

View File

@@ -1,22 +0,0 @@
no_short_enums.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
Ensure -fno-short-enums as default.
---
gcc/config/arm/arm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index 439a4de..948a369 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -28348,7 +28348,7 @@ arm_promote_function_mode (const_tree type ATTRIBUTE_UNUSED,
static bool
arm_default_short_enums (void)
{
- return TARGET_AAPCS_BASED && arm_abi != ARM_ABI_AAPCS_LINUX;
+ return false;
}

View File

@@ -1,41 +0,0 @@
prefer_pic.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
Without this change, libsupc++ would be compiled w/o PIC flags, resulting
in text relocations. Because for base tool chains, no 'dynamic_linker'
is defined (see 'libtool.m4'), 'dynamic_linker' is set to 'no', which
results in 'can_build_shared = no', which, in turn , results
in 'enable_shared = no', which, in turn, sets 'glibcxx_lt_pic_flag' to
nothing rather than '-prefer-pic'.
---
libstdc++-v3/configure.ac | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 1de0f6c..3e8b9c5 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -115,16 +115,16 @@ fi
# Use glibcxx_compiler_pic_flag to designate a compile-time flags for
# creating position-independent objects. This varies with the target
# hardware and operating system, but is often: -DPIC -fPIC.
-if test "$enable_shared" = yes; then
+#if test "$enable_shared" = yes; then
glibcxx_lt_pic_flag="-prefer-pic"
glibcxx_compiler_pic_flag="$lt_prog_compiler_pic_CXX"
glibcxx_compiler_shared_flag="-D_GLIBCXX_SHARED"
-else
- glibcxx_lt_pic_flag=
- glibcxx_compiler_pic_flag=
- glibcxx_compiler_shared_flag=
-fi
+#else
+# glibcxx_lt_pic_flag=
+# glibcxx_compiler_pic_flag=
+# glibcxx_compiler_shared_flag=
+#fi
AC_SUBST(glibcxx_lt_pic_flag)
AC_SUBST(glibcxx_compiler_pic_flag)
AC_SUBST(glibcxx_compiler_shared_flag)

View File

@@ -1,463 +0,0 @@
diff --git a/config.sub b/config.sub
index 61cb4bc..d6e23cb 100755
--- a/config.sub
+++ b/config.sub
@@ -334,6 +334,9 @@ case $basic_machine in
ms1)
basic_machine=mt-unknown
;;
+ riscv)
+ basic_machine=riscv-ucb
+ ;;
strongarm | thumb | xscale)
basic_machine=arm-unknown
diff --git a/gcc/config.gcc b/gcc/config.gcc
index 9d3fa57..b7ebc07 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -447,6 +447,10 @@ powerpc*-*-*)
esac
extra_options="${extra_options} g.opt fused-madd.opt rs6000/rs6000-tables.opt"
;;
+riscv*)
+ cpu_type=riscv
+ need_64bit_hwint=yes
+ ;;
rs6000*-*-*)
need_64bit_hwint=yes
extra_options="${extra_options} g.opt fused-madd.opt rs6000/rs6000-tables.opt"
@@ -1949,6 +1953,27 @@ microblaze*-*-elf)
cxx_target_objs="${cxx_target_objs} microblaze-c.o"
tmake_file="${tmake_file} microblaze/t-microblaze"
;;
+riscv32*-*-linux*) # Linux RISC-V
+ tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h riscv/default-32.h ${tm_file} riscv/linux.h riscv/linux64.h"
+ tmake_file="${tmake_file} riscv/t-linux64"
+ gnu_ld=yes
+ gas=yes
+ gcc_cv_initfini_array=yes
+ ;;
+riscv*-*-linux*) # Linux RISC-V
+ tm_file="elfos.h gnu-user.h linux.h glibc-stdint.h ${tm_file} riscv/linux.h riscv/linux64.h"
+ tmake_file="${tmake_file} riscv/t-linux64"
+ gnu_ld=yes
+ gas=yes
+ gcc_cv_initfini_array=yes
+ ;;
+riscv*-*-elf*) # Linux RISC-V
+ tm_file="elfos.h newlib-stdint.h ${tm_file} riscv/elf.h"
+ tmake_file="${tmake_file} riscv/t-elf"
+ gnu_ld=yes
+ gas=yes
+ gcc_cv_initfini_array=yes
+ ;;
mips*-*-netbsd*) # NetBSD/mips, either endian.
target_cpu_default="MASK_ABICALLS"
tm_file="elfos.h ${tm_file} mips/elf.h netbsd.h netbsd-elf.h mips/netbsd.h"
@@ -3756,6 +3781,31 @@ case "${target}" in
done
;;
+ riscv*-*-*)
+ supported_defaults="abi arch arch_32 arch_64 float tune tune_32 tune_64"
+
+ case ${with_float} in
+ "" | soft | hard)
+ # OK
+ ;;
+ *)
+ echo "Unknown floating point type used in --with-float=$with_float" 1>&2
+ exit 1
+ ;;
+ esac
+
+ case ${with_abi} in
+ "" | 32 | 64)
+ # OK
+ ;;
+ *)
+ echo "Unknown ABI used in --with-abi=$with_abi" 1>&2
+ exit 1
+ ;;
+ esac
+
+ ;;
+
mips*-*-*)
supported_defaults="abi arch arch_32 arch_64 float fpu nan tune tune_32 tune_64 divide llsc mips-plt synci"
diff --git a/gcc/configure b/gcc/configure
index 291e463..dae2d8f 100755
--- a/gcc/configure
+++ b/gcc/configure
@@ -23515,6 +23515,25 @@ x3: .space 4
tls_first_minor=14
tls_as_opt="-a32 --fatal-warnings"
;;
+ riscv*-*-*)
+ conftest_s='
+ .section .tdata,"awT",@progbits
+x:
+ .word 2
+ .text
+ la.tls.gd a0,x
+ la.tls.ie a1,x
+ lui a0,%tls_ie_pcrel_hi(x)
+ lw a0,%pcrel_lo(x)(a0)
+ add a0,a0,tp
+ lw a0,0(a0)
+ lui a0,%tprel_hi(x)
+ add a0,a0,tp,%tprel_add(x)
+ lw a0,%tprel_lo(x)(a0)'
+ tls_first_major=2
+ tls_first_minor=21
+ tls_as_opt='-m32 --fatal-warnings'
+ ;;
s390-*-*)
conftest_s='
.section ".tdata","awT",@progbits
diff --git a/gcc/configure.ac b/gcc/configure.ac
index b9a3799..c39db9a 100644
--- a/gcc/configure.ac
+++ b/gcc/configure.ac
@@ -3178,6 +3178,25 @@ x3: .space 4
tls_first_minor=14
tls_as_opt="-a32 --fatal-warnings"
;;
+ riscv*-*-*)
+ conftest_s='
+ .section .tdata,"awT",@progbits
+x:
+ .word 2
+ .text
+ la.tls.gd a0,x
+ la.tls.ie a1,x
+ lui a0,%tls_ie_pcrel_hi(x)
+ lw a0,%pcrel_lo(x)(a0)
+ add a0,a0,tp
+ lw a0,0(a0)
+ lui a0,%tprel_hi(x)
+ add a0,a0,tp,%tprel_add(x)
+ lw a0,%tprel_lo(x)(a0)'
+ tls_first_major=2
+ tls_first_minor=21
+ tls_as_opt='-m32 --fatal-warnings'
+ ;;
s390-*-*)
conftest_s='
.section ".tdata","awT",@progbits
diff --git a/gcc/testsuite/gcc.c-torture/execute/20101011-1.c b/gcc/testsuite/gcc.c-torture/execute/20101011-1.c
index 1952dbd..7015082 100644
--- a/gcc/testsuite/gcc.c-torture/execute/20101011-1.c
+++ b/gcc/testsuite/gcc.c-torture/execute/20101011-1.c
@@ -6,6 +6,9 @@
#elif defined (__powerpc__) || defined (__PPC__) || defined (__ppc__) || defined (__POWERPC__) || defined (__ppc)
/* On PPC division by zero does not trap. */
# define DO_TEST 0
+#elif defined (__riscv__)
+ /* On RISC-V division by zero does not trap. */
+# define DO_TEST 0
#elif defined (__SPU__)
/* On SPU division by zero does not trap. */
# define DO_TEST 0
diff --git a/gcc/testsuite/gcc.dg/20020312-2.c b/gcc/testsuite/gcc.dg/20020312-2.c
index 63fbfcc..b346eba 100644
--- a/gcc/testsuite/gcc.dg/20020312-2.c
+++ b/gcc/testsuite/gcc.dg/20020312-2.c
@@ -66,6 +66,8 @@ extern void abort (void);
# else
# define PIC_REG "30"
# endif
+#elif defined(__riscv__)
+/* No pic register. */
#elif defined(__RX__)
/* No pic register. */
#elif defined(__s390__)
diff --git a/gcc/testsuite/gcc.dg/20040813-1.c b/gcc/testsuite/gcc.dg/20040813-1.c
index 8be831d..bc74ec8 100644
--- a/gcc/testsuite/gcc.dg/20040813-1.c
+++ b/gcc/testsuite/gcc.dg/20040813-1.c
@@ -2,7 +2,7 @@
/* Contributed by Devang Patel <dpatel@apple.com> */
/* { dg-do compile } */
-/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* tile*-*-* nios2-*-* *-*-vxworks* } { "*" } { "" } } */
+/* { dg-skip-if "No stabs" { aarch64*-*-* mmix-*-* *-*-aix* alpha*-*-* hppa*64*-*-* ia64-*-* riscv*-*-* tile*-*-* nios2-*-* *-*-vxworks* } { "*" } { "" } } */
/* { dg-options "-gstabs" } */
int
diff --git a/gcc/testsuite/gcc.dg/stack-usage-1.c b/gcc/testsuite/gcc.dg/stack-usage-1.c
index 05e3df7..4afc483 100644
--- a/gcc/testsuite/gcc.dg/stack-usage-1.c
+++ b/gcc/testsuite/gcc.dg/stack-usage-1.c
@@ -61,6 +61,8 @@
# else
# define SIZE 240
# endif
+#elif defined (__riscv__)
+# define SIZE 240
#elif defined (__AVR__)
# define SIZE 254
#elif defined (__s390x__)
diff --git a/libatomic/cas_n.c b/libatomic/cas_n.c
index 801262d..a885afa 100644
--- a/libatomic/cas_n.c
+++ b/libatomic/cas_n.c
@@ -70,7 +70,7 @@ SIZE(libat_compare_exchange) (UTYPE *mptr, UTYPE *eptr, UTYPE newval,
mask = -1;
}
- weval = *eptr << shift;
+ weval = (UWORD)*eptr << shift;
wnewval = (UWORD)newval << shift;
woldval = __atomic_load_n (wptr, __ATOMIC_RELAXED);
do
diff --git a/libatomic/configure.tgt b/libatomic/configure.tgt
index a3757ef..516348d 100644
--- a/libatomic/configure.tgt
+++ b/libatomic/configure.tgt
@@ -29,6 +29,7 @@
case "${target_cpu}" in
alpha*) ARCH=alpha ;;
rs6000 | powerpc*) ARCH=powerpc ;;
+ riscv*) ARCH=riscv ;;
sh*) ARCH=sh ;;
arm*)
diff --git a/libatomic/fop_n.c b/libatomic/fop_n.c
index 4a18da9..854d648 100644
--- a/libatomic/fop_n.c
+++ b/libatomic/fop_n.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 2012-2014 Free Software Foundation, Inc.
+/* Copyright (C) 2012-2015 Free Software Foundation, Inc.
Contributed by Richard Henderson <rth@redhat.com>.
This file is part of the GNU Atomic Library (libatomic).
@@ -112,9 +112,9 @@ SIZE(C2(libat_fetch_,NAME)) (UTYPE *mptr, UTYPE opval, int smodel)
pre_barrier (smodel);
- wptr = (UWORD *)mptr;
- shift = 0;
- mask = -1;
+ wptr = (UWORD *)((uintptr_t)mptr & -WORDSIZE);
+ shift = (((uintptr_t)mptr % WORDSIZE) * CHAR_BIT) ^ SIZE(INVERT_MASK);
+ mask = SIZE(MASK) << shift;
wopval = (UWORD)opval << shift;
woldval = __atomic_load_n (wptr, __ATOMIC_RELAXED);
@@ -136,9 +136,9 @@ SIZE(C3(libat_,NAME,_fetch)) (UTYPE *mptr, UTYPE opval, int smodel)
pre_barrier (smodel);
- wptr = (UWORD *)mptr;
- shift = 0;
- mask = -1;
+ wptr = (UWORD *)((uintptr_t)mptr & -WORDSIZE);
+ shift = (((uintptr_t)mptr % WORDSIZE) * CHAR_BIT) ^ SIZE(INVERT_MASK);
+ mask = SIZE(MASK) << shift;
wopval = (UWORD)opval << shift;
woldval = __atomic_load_n (wptr, __ATOMIC_RELAXED);
diff --git a/libcpp/configure b/libcpp/configure
index b421e48..1270509 100755
--- a/libcpp/configure
+++ b/libcpp/configure
@@ -7163,6 +7163,7 @@ case $target in
mips*-*-* | \
mmix-*-* | \
powerpc*-*-* | \
+ riscv*-*-* | \
rs6000*-*-* | \
s390*-*-* | \
sparc*-*-* | \
diff --git a/libcpp/configure.ac b/libcpp/configure.ac
index 8515abf..89df04d 100644
--- a/libcpp/configure.ac
+++ b/libcpp/configure.ac
@@ -192,6 +192,7 @@ case $target in
mips*-*-* | \
mmix-*-* | \
powerpc*-*-* | \
+ riscv*-*-* | \
rs6000*-*-* | \
s390*-*-* | \
sparc*-*-* | \
diff --git a/libgcc/config.host b/libgcc/config.host
index f4a7428..e1f49c8 100644
--- a/libgcc/config.host
+++ b/libgcc/config.host
@@ -167,6 +167,9 @@ powerpc*-*-*)
;;
rs6000*-*-*)
;;
+riscv*)
+ cpu_type=riscv
+ ;;
score*-*-*)
cpu_type=score
;;
@@ -1002,6 +1005,18 @@ powerpcle-*-eabi*)
tmake_file="${tmake_file} rs6000/t-ppccomm rs6000/t-crtstuff t-crtstuff-pic t-fdpbit"
extra_parts="$extra_parts crtbegin.o crtend.o crtbeginS.o crtendS.o crtbeginT.o ecrti.o ecrtn.o ncrti.o ncrtn.o"
;;
+riscv32*-*-linux*)
+ tmake_file="${tmake_file} riscv/t-fpbit riscv/t-dpbit riscv/t-tpbit riscv/t-elf riscv/t-elf32"
+ extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o"
+ ;;
+riscv*-*-linux*)
+ tmake_file="${tmake_file} riscv/t-fpbit riscv/t-dpbit riscv/t-tpbit riscv/t-elf"
+ extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o crtendS.o crtbeginT.o"
+ ;;
+riscv*-*-*)
+ tmake_file="${tmake_file} riscv/t-fpbit riscv/t-dpbit riscv/t-elf"
+ extra_parts="$extra_parts crtbegin.o crtend.o crti.o crtn.o"
+ ;;
rs6000-ibm-aix4.[3456789]* | powerpc-ibm-aix4.[3456789]*)
md_unwind_header=rs6000/aix-unwind.h
tmake_file="t-fdpbit rs6000/t-ppc64-fp rs6000/t-slibgcc-aix rs6000/t-ibm-ldouble"
diff --git a/libsanitizer/asan/asan_linux.cc b/libsanitizer/asan/asan_linux.cc
index 0692eb1..2a7b656 100644
--- a/libsanitizer/asan/asan_linux.cc
+++ b/libsanitizer/asan/asan_linux.cc
@@ -98,6 +98,11 @@ void GetPcSpBp(void *context, uptr *pc, uptr *sp, uptr *bp) {
*pc = ucontext->uc_mcontext.gregs[31];
*bp = ucontext->uc_mcontext.gregs[30];
*sp = ucontext->uc_mcontext.gregs[29];
+# elif defined(__riscv__)
+ ucontext_t *ucontext = (ucontext_t*)context;
+ *pc = ucontext->uc_mcontext.gregs[REG_PC];
+ *bp = ucontext->uc_mcontext.gregs[REG_S0];
+ *sp = ucontext->uc_mcontext.gregs[REG_SP];
#else
# error "Unsupported arch"
#endif
diff --git a/libsanitizer/sanitizer_common/sanitizer_linux.cc b/libsanitizer/sanitizer_common/sanitizer_linux.cc
index 69c9c10..2419ae6 100644
--- a/libsanitizer/sanitizer_common/sanitizer_linux.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_linux.cc
@@ -93,11 +93,11 @@ uptr internal_close(fd_t fd) {
}
uptr internal_open(const char *filename, int flags) {
- return internal_syscall(__NR_open, (uptr)filename, flags);
+ return internal_syscall(__NR_openat, AT_FDCWD, (uptr)filename, flags);
}
uptr internal_open(const char *filename, int flags, u32 mode) {
- return internal_syscall(__NR_open, (uptr)filename, flags, mode);
+ return internal_syscall(__NR_openat, AT_FDCWD, (uptr)filename, flags, mode);
}
uptr OpenFile(const char *filename, bool write) {
@@ -139,7 +139,7 @@ static void stat64_to_stat(struct stat64 *in, struct stat *out) {
uptr internal_stat(const char *path, void *buf) {
#if SANITIZER_LINUX_USES_64BIT_SYSCALLS
- return internal_syscall(__NR_stat, (uptr)path, (uptr)buf);
+ return internal_syscall(__NR_newfstatat, AT_FDCWD, (uptr)path, (uptr)buf, 0);
#else
struct stat64 buf64;
int res = internal_syscall(__NR_stat64, path, &buf64);
@@ -150,7 +150,7 @@ uptr internal_stat(const char *path, void *buf) {
uptr internal_lstat(const char *path, void *buf) {
#if SANITIZER_LINUX_USES_64BIT_SYSCALLS
- return internal_syscall(__NR_lstat, (uptr)path, (uptr)buf);
+ return internal_syscall(__NR_newfstatat, AT_FDCWD, (uptr)path, (uptr)buf, AT_SYMLINK_NOFOLLOW);
#else
struct stat64 buf64;
int res = internal_syscall(__NR_lstat64, path, &buf64);
@@ -178,15 +178,15 @@ uptr internal_filesize(fd_t fd) {
}
uptr internal_dup2(int oldfd, int newfd) {
- return internal_syscall(__NR_dup2, oldfd, newfd);
+ return internal_syscall(__NR_dup3, oldfd, newfd, 0);
}
uptr internal_readlink(const char *path, char *buf, uptr bufsize) {
- return internal_syscall(__NR_readlink, (uptr)path, (uptr)buf, bufsize);
+ return internal_syscall(__NR_readlinkat, AT_FDCWD, (uptr)path, (uptr)buf, bufsize);
}
uptr internal_unlink(const char *path) {
- return internal_syscall(__NR_unlink, (uptr)path);
+ return internal_syscall(__NR_unlinkat, AT_FDCWD, (uptr)path);
}
uptr internal_sched_yield() {
@@ -588,7 +588,7 @@ uptr internal_getppid() {
}
uptr internal_getdents(fd_t fd, struct linux_dirent *dirp, unsigned int count) {
- return internal_syscall(__NR_getdents, fd, (uptr)dirp, count);
+ return internal_syscall(__NR_getdents64, fd, (uptr)dirp, count);
}
uptr internal_lseek(fd_t fd, OFF_T offset, int whence) {
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc b/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
index ac56f33..8e1ec46 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_linux.cc
@@ -63,7 +63,7 @@ namespace __sanitizer {
unsigned struct_statfs64_sz = sizeof(struct statfs64);
} // namespace __sanitizer
-#if !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__sparc__)
+#if !defined(__powerpc64__) && !defined(__x86_64__) && !defined(__sparc__) && !defined(__riscv__)
COMPILER_CHECK(struct___old_kernel_stat_sz == sizeof(struct __old_kernel_stat));
#endif
diff --git a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
index aec9504..c063107 100644
--- a/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
+++ b/libsanitizer/sanitizer_common/sanitizer_platform_limits_posix.h
@@ -67,6 +67,10 @@ namespace __sanitizer {
const unsigned struct___old_kernel_stat_sz = 0;
const unsigned struct_kernel_stat_sz = 144;
const unsigned struct_kernel_stat64_sz = 104;
+#elif defined(__riscv__)
+ const unsigned struct___old_kernel_stat_sz = 0;
+ const unsigned struct_kernel_stat_sz = 128;
+ const unsigned struct_kernel_stat64_sz = 128;
#elif defined(__sparc__) && defined(__arch64__)
const unsigned struct___old_kernel_stat_sz = 0;
const unsigned struct_kernel_stat_sz = 104;
@@ -367,7 +371,7 @@ namespace __sanitizer {
typedef long __sanitizer___kernel_off_t;
#endif
-#if defined(__powerpc__)
+#if defined(__powerpc__) || defined(__riscv__)
typedef unsigned int __sanitizer___kernel_old_uid_t;
typedef unsigned int __sanitizer___kernel_old_gid_t;
#else
diff --git a/libstdc++-v3/configure b/libstdc++-v3/configure
index 16e09f0..acd62fc 100755
--- a/libstdc++-v3/configure
+++ b/libstdc++-v3/configure
@@ -16550,7 +16550,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# Long term, -std=c++0x could be even better, could manage to explicitly
# request C99 facilities to the underlying C headers.
ac_save_CXXFLAGS="$CXXFLAGS"
- CXXFLAGS="$CXXFLAGS -std=c++98"
+ CXXFLAGS="$CXXFLAGS -std=gnu++98"
ac_save_LIBS="$LIBS"
ac_save_gcc_no_link="$gcc_no_link"
@@ -17170,9 +17170,11 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
$as_echo "$glibcxx_cv_c99_wchar" >&6; }
fi
+ # For newlib, don't check complex since missing c99 functions, but
+ # rest of c99 stuff is there so don't loose it
# Option parsed, now set things appropriately.
if test x"$glibcxx_cv_c99_math" = x"no" ||
- test x"$glibcxx_cv_c99_complex" = x"no" ||
+ # test x"$glibcxx_cv_c99_complex" = x"no" ||
test x"$glibcxx_cv_c99_stdio" = x"no" ||
test x"$glibcxx_cv_c99_stdlib" = x"no" ||
test x"$glibcxx_cv_c99_wchar" = x"no"; then

File diff suppressed because it is too large Load Diff

View File

@@ -1,13 +0,0 @@
riscv_files.patch
riscv.patch
config.patch
misc.patch
no_short_enums.patch
host_target_combination.patch
prefer_pic.patch
libstdcxx_without_libc.patch
libsupcxx_demangle.patch
libgcc_s.patch
go_libbacktrace.patch
target_libbacktrace.patch
gnu_inline_mismatch.patch

View File

@@ -1,21 +0,0 @@
target_libbacktrace.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
Don't build libbacktrace, which needs a libc.
---
configure.ac | 1 -
1 file changed, 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 27ee905..8174460 100644
--- a/configure.ac
+++ b/configure.ac
@@ -152,7 +152,6 @@ libgcj="target-libffi \
# the host libraries and the host tools (which may be a cross compiler)
# Note that libiberty is not a target library.
target_libraries="target-libgcc \
- target-libbacktrace \
target-libgloss \
target-newlib \
target-libgomp \

View File

@@ -1,22 +0,0 @@
arm_single_step.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
Enable software single-stepping on ARM.
---
gdb/arm-tdep.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index 155208e..91537d6 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -8467,6 +8467,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep = xcalloc (1, sizeof (struct gdbarch_tdep));
gdbarch = gdbarch_alloc (&info, tdep);
+ set_gdbarch_software_single_step(gdbarch, arm_software_single_step);
+
set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_ilp32_fetch_link_map_offsets);
/* Record additional information about the architecture we are defining.

View File

@@ -1,3 +0,0 @@
shared_library.patch
arm_single_step.patch
x86_64.patch

View File

@@ -1,101 +0,0 @@
shared_library.patch
From: Christian Prochaska <christian.prochaska@genode-labs.com>
Enable shared library support.
---
gdb/amd64-tdep.c | 4 ++++
gdb/arm-tdep.c | 4 ++++
gdb/configure.tgt | 5 ++++-
gdb/i386-tdep.c | 4 ++++
4 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index 9b5d5bb..db3821a 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -45,6 +45,8 @@
#include "features/i386/amd64.c"
#include "features/i386/amd64-avx.c"
+#include "solib-svr4.h"
+
/* Note that the AMD64 architecture was previously known as x86-64.
The latter is (forever) engraved into the canonical system name as
returned by config.guess, and used as the name for the AMD64 port
@@ -2465,6 +2467,8 @@ amd64_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
const struct target_desc *tdesc = info.target_desc;
+ set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_lp64_fetch_link_map_offsets);
+
/* AMD64 generally uses `fxsave' instead of `fsave' for saving its
floating-point registers. */
tdep->sizeof_fpregset = I387_SIZEOF_FXSAVE;
diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
index bb52ad4..155208e 100644
--- a/gdb/arm-tdep.c
+++ b/gdb/arm-tdep.c
@@ -57,6 +57,8 @@
#include "features/arm-with-m.c"
+#include "solib-svr4.h"
+
static int arm_debug;
/* Macros for setting and testing a bit in a minimal symbol that marks
@@ -8465,6 +8467,8 @@ arm_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep = xcalloc (1, sizeof (struct gdbarch_tdep));
gdbarch = gdbarch_alloc (&info, tdep);
+ set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_ilp32_fetch_link_map_offsets);
+
/* Record additional information about the architecture we are defining.
These are gdbarch discriminators, like the OSABI. */
tdep->arm_abi = arm_abi;
diff --git a/gdb/configure.tgt b/gdb/configure.tgt
index 5ab1554..ae57017 100644
--- a/gdb/configure.tgt
+++ b/gdb/configure.tgt
@@ -96,7 +96,7 @@ arm*-*-symbianelf*)
;;
arm*-*-* | thumb*-*-* | strongarm*-*-* | xscale-*-*)
# Target: ARM embedded system
- gdb_target_obs="arm-tdep.o"
+ gdb_target_obs="arm-tdep.o solib.o solib-svr4.o"
gdb_sim=../sim/arm/libsim.a
;;
@@ -623,6 +623,9 @@ x86_64-*-openbsd*)
i387-tdep.o i386bsd-tdep.o i386obsd-tdep.o \
bsd-uthread.o corelow.o solib.o solib-svr4.o"
;;
+x86_64-*-*)
+ gdb_target_obs="amd64-tdep.o i386-tdep.o i387-tdep.o solib.o solib-svr4.o"
+ ;;
xtensa*-*-linux*) gdb_target=linux
# Target: GNU/Linux Xtensa
gdb_target_obs="xtensa-tdep.o xtensa-config.o xtensa-linux-tdep.o \
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 5f4089b..3c13bea 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -60,6 +60,8 @@
#include "features/i386/i386-avx.c"
#include "features/i386/i386-mmx.c"
+#include "solib-svr4.h"
+
/* Register names. */
static const char *i386_register_names[] =
@@ -7051,6 +7053,8 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
tdep = XCALLOC (1, struct gdbarch_tdep);
gdbarch = gdbarch_alloc (&info, tdep);
+ set_solib_svr4_fetch_link_map_offsets(gdbarch, svr4_ilp32_fetch_link_map_offsets);
+
/* General-purpose registers. */
tdep->gregset = NULL;
tdep->gregset_reg_offset = NULL;

View File

@@ -1,80 +0,0 @@
gdb_x86_64.diff
From: Christian Prochaska <christian.prochaska@genode-labs.com>
---
gdb/amd64-tdep.c | 5 +++++
gdb/defs.h | 1 +
gdb/i386-tdep.c | 5 +++++
gdb/osabi.c | 6 ++++++
4 files changed, 17 insertions(+)
diff --git a/gdb/amd64-tdep.c b/gdb/amd64-tdep.c
index db3821a..5f5e165 100644
--- a/gdb/amd64-tdep.c
+++ b/gdb/amd64-tdep.c
@@ -2581,6 +2581,11 @@ void _initialize_amd64_tdep (void);
void
_initialize_amd64_tdep (void)
{
+ /* Genode */
+ gdbarch_register_osabi(bfd_arch_i386, bfd_mach_x86_64,
+ GDB_OSABI_GENODE, amd64_init_abi);
+ /* /Genode */
+
initialize_tdesc_amd64 ();
initialize_tdesc_amd64_avx ();
}
diff --git a/gdb/defs.h b/gdb/defs.h
index 9531c5a..7c7258f 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -996,6 +996,7 @@ enum gdb_osabi
GDB_OSABI_DICOS,
GDB_OSABI_DARWIN,
GDB_OSABI_SYMBIAN,
+ GDB_OSABI_GENODE,
GDB_OSABI_INVALID /* keep this last */
};
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index 3c13bea..3aaeec5 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -7367,6 +7367,11 @@ is \"default\"."),
gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_GO32,
i386_go32_init_abi);
+ /* Genode */
+ gdbarch_register_osabi(bfd_arch_i386, 0, GDB_OSABI_GENODE,
+ i386_elf_init_abi);
+ /* /Genode */
+
/* Initialize the i386-specific register groups. */
i386_init_reggroups ();
diff --git a/gdb/osabi.c b/gdb/osabi.c
index a264924..c5e1775 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -73,6 +73,7 @@ static const char * const gdb_osabi_names[] =
"DICOS",
"Darwin",
"Symbian",
+ "Genode",
"<invalid>"
};
@@ -522,6 +523,11 @@ generic_elf_osabi_sniffer (bfd *abfd)
bfd_map_over_sections (abfd,
generic_elf_osabi_sniff_abi_tag_sections,
&osabi);
+/* Genode */
+ if (osabi == GDB_OSABI_UNKNOWN)
+ osabi = GDB_OSABI_GENODE;
+/* /Genode */
+
break;
case ELFOSABI_FREEBSD:

View File

@@ -43,40 +43,13 @@ MAKE_OPT ?= -j4
GENODE_DIR ?= $(realpath $(dir $(firstword $(MAKEFILE_LIST)))/..)
#
# Download locations
#
DOWNLOAD_MIRROR ?= ftp://ftp.fu-berlin.de
GCC_DOWNLOAD_URL = $(DOWNLOAD_MIRROR)/gnu/gcc
BINUTILS_DOWNLOAD_URL = $(DOWNLOAD_MIRROR)/gnu/binutils
GDB_DOWNLOAD_URL = $(DOWNLOAD_MIRROR)/gnu/gdb
GMP_DOWNLOAD_URL = $(DOWNLOAD_MIRROR)/gnu/gmp
MPFR_DOWNLOAD_URL = $(DOWNLOAD_MIRROR)/gnu/mpfr
MPC_DOWNLOAD_URL ?= http://www.multiprecision.org/mpc/download
#
# Tool versions and install location
#
GCC_VERSION = 4.9.2
BINUTILS_VERSION = 2.25
GDB_VERSION = 7.3.1
GMP_VERSION = 5.0.2
MPFR_VERSION = 3.1.0
MPC_VERSION = 0.9
INSTALL_LOCATION = /usr/local/genode-gcc
DOWNLOAD_DIR = download
CONTRIB_DIR = contrib
SIGVERIFIER = $(GENODE_DIR)/tool/download_sigver
BINUTILS_DOWNLOAD_TBZ2 = binutils-$(BINUTILS_VERSION).tar.bz2
# download file name differs from dir name found within the archive
ifeq ($(BINUTILS_VERSION),2.21.1)
BINUTILS_DOWNLOAD_TBZ2 = binutils-$(BINUTILS_VERSION)a.tar.bz2
endif
#
# Utilities
@@ -293,71 +266,40 @@ endif
build_all: $(GCC_INSTALLED_BINARIES) $(GDB_INSTALLED_BINARIES)
$(DOWNLOAD_DIR):
$(VERBOSE)mkdir -p $@
GMP_CONTRIB_DIR = $(shell $(GENODE_DIR)/tool/ports/current gmp)/src/lib/gmp
$(DOWNLOAD_DIR)/$(BINUTILS_DOWNLOAD_TBZ2): $(DOWNLOAD_DIR)
$(ECHO) "$(BRIGHT_COL)downloading binutils...$(DEFAULT_COL)"
$(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(BINUTILS_DOWNLOAD_URL)/$(BINUTILS_DOWNLOAD_TBZ2) && touch $@
$(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(BINUTILS_DOWNLOAD_URL)/$(BINUTILS_DOWNLOAD_TBZ2).sig && touch $@
$(VERBOSE)$(SIGVERIFIER) $(DOWNLOAD_DIR)/$(BINUTILS_DOWNLOAD_TBZ2) $(DOWNLOAD_DIR)/$(BINUTILS_DOWNLOAD_TBZ2).sig GNU
$(GMP_CONTRIB_DIR)/configure:
$(ECHO) "$(BRIGHT_COL)preparing gmp...$(DEFAULT_COL)"
$(VERBOSE)$(GENODE_DIR)/tool/ports/prepare_port gmp
$(DOWNLOAD_DIR)/gcc-$(GCC_VERSION).tar.bz2: $(DOWNLOAD_DIR)
$(ECHO) "$(BRIGHT_COL)downloading gcc...$(DEFAULT_COL)"
$(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(GCC_DOWNLOAD_URL)/gcc-$(GCC_VERSION)/gcc-$(GCC_VERSION).tar.bz2 && touch $@
$(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(GCC_DOWNLOAD_URL)/gcc-$(GCC_VERSION)/gcc-$(GCC_VERSION).tar.bz2.sig && touch $@
$(VERBOSE)$(SIGVERIFIER) $(DOWNLOAD_DIR)/gcc-$(GCC_VERSION).tar.bz2 $(DOWNLOAD_DIR)/gcc-$(GCC_VERSION).tar.bz2.sig GNU
MPFR_CONTRIB_DIR = $(shell $(GENODE_DIR)/tool/ports/current mpfr)/src/lib/mpfr
$(DOWNLOAD_DIR)/gmp-$(GMP_VERSION).tar.bz2: $(DOWNLOAD_DIR)
$(ECHO) "$(BRIGHT_COL)downloading gmp...$(DEFAULT_COL)"
$(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(GMP_DOWNLOAD_URL)/gmp-$(GMP_VERSION).tar.bz2 && touch $@
$(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(GMP_DOWNLOAD_URL)/gmp-$(GMP_VERSION).tar.bz2.sig && touch $@
$(VERBOSE)$(SIGVERIFIER) $(DOWNLOAD_DIR)/gmp-$(GMP_VERSION).tar.bz2 $(DOWNLOAD_DIR)/gmp-$(GMP_VERSION).tar.bz2.sig GNU
$(MPFR_CONTRIB_DIR)/configure:
$(ECHO) "$(BRIGHT_COL)preparing mpfr...$(DEFAULT_COL)"
$(VERBOSE)$(GENODE_DIR)/tool/ports/prepare_port mpfr
$(DOWNLOAD_DIR)/mpfr-$(MPFR_VERSION).tar.bz2: $(DOWNLOAD_DIR)
$(ECHO) "$(BRIGHT_COL)downloading mpfr...$(DEFAULT_COL)"
$(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(MPFR_DOWNLOAD_URL)/mpfr-$(MPFR_VERSION).tar.bz2 && touch $@
$(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(MPFR_DOWNLOAD_URL)/mpfr-$(MPFR_VERSION).tar.bz2.sig && touch $@
$(VERBOSE)$(SIGVERIFIER) $(DOWNLOAD_DIR)/mpfr-$(MPFR_VERSION).tar.bz2 $(DOWNLOAD_DIR)/mpfr-$(MPFR_VERSION).tar.bz2.sig
MPC_CONTRIB_DIR = $(shell $(GENODE_DIR)/tool/ports/current mpc)/src/lib/mpc
$(DOWNLOAD_DIR)/mpc-$(MPC_VERSION).tar.gz: $(DOWNLOAD_DIR)
$(ECHO) "$(BRIGHT_COL)downloading mpc...$(DEFAULT_COL)"
$(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(MPC_DOWNLOAD_URL)/mpc-$(MPC_VERSION).tar.gz && touch $@
$(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(MPC_DOWNLOAD_URL)/mpc-$(MPC_VERSION).tar.gz.asc && touch $@
# GPG key from http://www.multiprecision.org/index.php?prog=mpc&page=download
$(VERBOSE)$(SIGVERIFIER) $(DOWNLOAD_DIR)/mpc-$(MPC_VERSION).tar.gz $(DOWNLOAD_DIR)/mpc-$(MPC_VERSION).tar.gz.asc AD17A21EF8AED8F1CC02DBD9F7D5C9BF765C61E3
$(MPC_CONTRIB_DIR)/configure:
$(ECHO) "$(BRIGHT_COL)preparing mpc...$(DEFAULT_COL)"
$(VERBOSE)$(GENODE_DIR)/tool/ports/prepare_port mpc
$(CONTRIB_DIR)/gmp-$(GMP_VERSION)/configure: $(DOWNLOAD_DIR)/gmp-$(GMP_VERSION).tar.bz2
$(ECHO) "$(BRIGHT_COL)unpacking gmp...$(DEFAULT_COL)"
$(VERBOSE)tar xfj $< -C $(CONTRIB_DIR)
GCC_CONTRIB_DIR = $(shell $(GENODE_DIR)/tool/ports/current gcc)/src/noux-pkg/gcc
$(CONTRIB_DIR)/mpfr-$(MPFR_VERSION)/configure: $(DOWNLOAD_DIR)/mpfr-$(MPFR_VERSION).tar.bz2
$(ECHO) "$(BRIGHT_COL)unpacking mpfr...$(DEFAULT_COL)"
$(VERBOSE)tar xfj $< -C $(CONTRIB_DIR)
$(GCC_CONTRIB_DIR)/configure:
$(ECHO) "$(BRIGHT_COL)preparing gcc...$(DEFAULT_COL)"
$(VERBOSE)$(GENODE_DIR)/tool/ports/prepare_port gcc
$(CONTRIB_DIR)/mpc-$(MPC_VERSION)/configure: $(DOWNLOAD_DIR)/mpc-$(MPC_VERSION).tar.gz
$(ECHO) "$(BRIGHT_COL)unpacking mpc...$(DEFAULT_COL)"
$(VERBOSE)tar xfz $< -C $(CONTRIB_DIR)
BINUTILS_CONTRIB_DIR = $(shell $(GENODE_DIR)/tool/ports/current binutils)/src/noux-pkg/binutils
$(CONTRIB_DIR)/gcc-$(GCC_VERSION): $(addprefix $(DOWNLOAD_DIR)/,gcc-$(GCC_VERSION).tar.bz2)
$(ECHO) "$(BRIGHT_COL)unpacking gcc...$(DEFAULT_COL)"
$(VERBOSE)mkdir -p $(CONTRIB_DIR)
$(VERBOSE)for i in $^ ; do tar xfj $$i -C $(CONTRIB_DIR) ;done
$(VERBOSE)touch $@
$(BINUTILS_CONTRIB_DIR)/configure:
$(ECHO) "$(BRIGHT_COL)preparing binutils...$(DEFAULT_COL)"
$(VERBOSE)$(GENODE_DIR)/tool/ports/prepare_port binutils
include $(GENODE_DIR)/tool/tool_chain_gcc_patches.inc
$(CONTRIB_DIR)/binutils-$(BINUTILS_VERSION): $(addprefix $(DOWNLOAD_DIR)/,$(BINUTILS_DOWNLOAD_TBZ2))
$(ECHO) "$(BRIGHT_COL)unpacking binutils...$(DEFAULT_COL)"
$(VERBOSE)mkdir -p $(CONTRIB_DIR)
$(VERBOSE)tar xfj $^ -C $(CONTRIB_DIR) && touch $@
include $(GENODE_DIR)/tool/tool_chain_binutils_patches.inc
build/$(PLATFORM)/binutils/Makefile: $(CONTRIB_DIR)/binutils-$(BINUTILS_VERSION)/configure
build/$(PLATFORM)/binutils/Makefile: $(BINUTILS_CONTRIB_DIR)/configure
$(ECHO) "$(BRIGHT_COL)configuring binutils...$(DEFAULT_COL)"
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)cd $(dir $@); $(shell pwd)/$(CONTRIB_DIR)/binutils-$(BINUTILS_VERSION)/configure $(BINUTILS_CONFIG)
$(VERBOSE)cd $(dir $@); $(BINUTILS_CONTRIB_DIR)/configure $(BINUTILS_CONFIG)
$(BINUTILS_BINARIES): build/$(PLATFORM)/binutils/Makefile
$(ECHO) "$(BRIGHT_COL)builing binutils...$(DEFAULT_COL)"
@@ -386,24 +328,24 @@ $(LOCAL_LIB_INSTALL_LOCATION)/lib/lib%.a:
$(ECHO) "$(BRIGHT_COL)building lib$*...$(DEFAULT_COL)"
$(VERBOSE)make -C build/$* all install
build/gmp/Makefile: $(CONTRIB_DIR)/gmp-$(GMP_VERSION)/configure
build/gmp/Makefile: $(GMP_CONTRIB_DIR)/configure
build/gmp/Makefile:
$(ECHO) "$(BRIGHT_COL)configuring libgmp...$(DEFAULT_COL)"
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)cd $(dir $@); \
$(shell pwd)/$(CONTRIB_DIR)/gmp-$(GMP_VERSION)/configure $(GMP_CONFIG)
$(GMP_CONTRIB_DIR)/configure $(GMP_CONFIG)
build/mpfr/Makefile: $(CONTRIB_DIR)/mpfr-$(MPFR_VERSION)/configure \
build/mpfr/Makefile: $(MPFR_CONTRIB_DIR)/configure \
$(LOCAL_LIB_INSTALL_LOCATION)/lib/libgmp.a
build/mpfr/Makefile:
$(ECHO) "$(BRIGHT_COL)configuring libmpfr...$(DEFAULT_COL)"
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)cd $(dir $@); \
$(shell pwd)/$(CONTRIB_DIR)/mpfr-$(MPFR_VERSION)/configure $(MPFR_CONFIG)
$(MPFR_CONTRIB_DIR)/configure $(MPFR_CONFIG)
build/mpc/Makefile: $(CONTRIB_DIR)/mpc-$(MPC_VERSION)/configure \
build/mpc/Makefile: $(MPC_CONTRIB_DIR)/configure \
$(LOCAL_LIB_INSTALL_LOCATION)/lib/libgmp.a \
$(LOCAL_LIB_INSTALL_LOCATION)/lib/libmpfr.a
@@ -411,9 +353,9 @@ build/mpc/Makefile:
$(ECHO) "$(BRIGHT_COL)configuring libmpc...$(DEFAULT_COL)"
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)cd $(dir $@); \
$(shell pwd)/$(CONTRIB_DIR)/mpc-$(MPC_VERSION)/configure $(MPC_CONFIG)
$(MPC_CONTRIB_DIR)/configure $(MPC_CONFIG)
build/$(PLATFORM)/gcc/Makefile: $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure \
build/$(PLATFORM)/gcc/Makefile: $(GCC_CONTRIB_DIR)/configure \
$(BINUTILS_INSTALLED_BINARIES) \
$(LOCAL_LIB_INSTALL_LOCATION)/lib/libgmp.a \
$(LOCAL_LIB_INSTALL_LOCATION)/lib/libmpfr.a \
@@ -425,7 +367,7 @@ build/$(PLATFORM)/gcc/Makefile:
$(VERBOSE)cd $(dir $@); \
host_configargs="$(HOST_CONFIG_ARGS)" \
target_configargs="$(TARGET_CONFIG_ARGS)" \
$(shell pwd)/$(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure $(GCC_CONFIG)
$(GCC_CONTRIB_DIR)/configure $(GCC_CONFIG)
$(GCC_BINARIES): build/$(PLATFORM)/gcc/Makefile \
$(LIBC)
@@ -438,24 +380,17 @@ $(GCC_INSTALLED_BINARIES): $(GCC_BINARIES)
$(ECHO) "$(BRIGHT_COL)installing gcc...$(DEFAULT_COL)"
$(VERBOSE)$(MAKE) -C build/$(PLATFORM)/gcc $(GCC_INSTALL_RULE)
$(DOWNLOAD_DIR)/gdb-$(GDB_VERSION).tar.bz2: $(DOWNLOAD_DIR)
$(ECHO) "$(BRIGHT_COL)downloading gdb...$(DEFAULT_COL)"
$(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(GDB_DOWNLOAD_URL)/gdb-$(GDB_VERSION).tar.bz2 && touch $@
$(VERBOSE)wget -c -P $(DOWNLOAD_DIR) $(GDB_DOWNLOAD_URL)/gdb-$(GDB_VERSION).tar.bz2.sig && touch $@
$(VERBOSE)$(SIGVERIFIER) $(DOWNLOAD_DIR)/gdb-$(GDB_VERSION).tar.bz2 $(DOWNLOAD_DIR)/gdb-$(GDB_VERSION).tar.bz2.sig GNU
GDB_CONTRIB_DIR = $(shell $(GENODE_DIR)/tool/ports/current gdb)/src/noux-pkg/gdb
$(CONTRIB_DIR)/gdb-$(GDB_VERSION): $(DOWNLOAD_DIR)/gdb-$(GDB_VERSION).tar.bz2
$(ECHO) "$(BRIGHT_COL)unpacking gdb...$(DEFAULT_COL)"
$(VERBOSE)mkdir -p $(CONTRIB_DIR)
$(VERBOSE)tar xfj $^ -C $(CONTRIB_DIR) && touch $@
$(GDB_CONTRIB_DIR)/configure:
$(ECHO) "$(BRIGHT_COL)preparing gdb...$(DEFAULT_COL)"
$(VERBOSE)$(GENODE_DIR)/tool/ports/prepare_port gdb
include $(GENODE_DIR)/tool/tool_chain_gdb_patches.inc
build/$(PLATFORM)/gdb/Makefile: $(CONTRIB_DIR)/gdb-$(GDB_VERSION)/configure
build/$(PLATFORM)/gdb/Makefile: $(GDB_CONTRIB_DIR)/configure
$(ECHO) "$(BRIGHT_COL)configuring gdb...$(DEFAULT_COL)"
$(VERBOSE)mkdir -p $(dir $@)
$(VERBOSE)cd $(dir $@); \
$(shell pwd)/$(CONTRIB_DIR)/gdb-$(GDB_VERSION)/configure $(GDB_CONFIG)
$(GDB_CONTRIB_DIR)/configure $(GDB_CONFIG)
$(GDB_BINARIES): build/$(PLATFORM)/gdb/Makefile
$(ECHO) "$(BRIGHT_COL)builing gdb...$(DEFAULT_COL)"
@@ -470,12 +405,9 @@ $(GDB_INSTALLED_BINARIES): $(GDB_BINARIES)
#
clean:
rm -rf $(addprefix $(CONTRIB_DIR)/,binutils-$(BINUTILS_VERSION) gcc-$(GCC_VERSION))
rm -rf build
cleanall: clean
rm -rf $(DOWNLOAD_DIR)/$(BINUTILS_DOWNLOAD_TBZ2)
rm -rf $(DOWNLOAD_DIR)/gcc-$(GCC_VERSION).tar.bz2
#
# Install rules

View File

@@ -1,12 +0,0 @@
BINUTILS_PATCHES_DIR = $(GENODE_DIR)/tool/patches/binutils-$(BINUTILS_VERSION)
BINUTILS_PATCHES = $(shell cat $(BINUTILS_PATCHES_DIR)/series)
$(CONTRIB_DIR)/binutils-$(BINUTILS_VERSION)/configure:: $(CONTRIB_DIR)/binutils-$(BINUTILS_VERSION)
$(ECHO) "$(BRIGHT_COL)patching binutils build system...$(DEFAULT_COL)"
$(VERBOSE)for p in $(BINUTILS_PATCHES); do \
patch -d $(CONTRIB_DIR)/binutils-$(BINUTILS_VERSION) -p1 -i $(BINUTILS_PATCHES_DIR)/$$p; done;
@#
@# Re-generate configure scripts
@#
$(VERBOSE)cd $(CONTRIB_DIR)/binutils-$(BINUTILS_VERSION)/bfd; $(AUTOCONF)
$(VERBOSE)touch $@

View File

@@ -1,16 +0,0 @@
GCC_PATCHES_DIR = $(GENODE_DIR)/tool/patches/gcc-$(GCC_VERSION)
GCC_PATCHES = $(shell cat $(GCC_PATCHES_DIR)/series)
$(CONTRIB_DIR)/gcc-$(GCC_VERSION)/configure:: $(CONTRIB_DIR)/gcc-$(GCC_VERSION)
$(ECHO) "$(BRIGHT_COL)patching gcc build system...$(DEFAULT_COL)"
$(VERBOSE)for p in $(GCC_PATCHES); do \
patch -d $(CONTRIB_DIR)/gcc-$(GCC_VERSION) -p1 -i $(GCC_PATCHES_DIR)/$$p; done;
@#
@# Re-generate configure scripts
@#
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION); autogen Makefile.def
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libgcc; $(AUTOCONF)
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/libstdc++-v3; $(AUTOCONF)
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION)/gcc; $(AUTOCONF)
$(VERBOSE)cd $(CONTRIB_DIR)/gcc-$(GCC_VERSION); $(AUTOCONF)
$(VERBOSE)touch $@

View File

@@ -1,8 +0,0 @@
GDB_PATCHES_DIR = $(GENODE_DIR)/tool/patches/gdb-$(GDB_VERSION)
GDB_PATCHES = $(shell cat $(GDB_PATCHES_DIR)/series)
$(CONTRIB_DIR)/gdb-$(GDB_VERSION)/configure:: $(CONTRIB_DIR)/gdb-$(GDB_VERSION)
$(ECHO) "$(BRIGHT_COL)patching gdb...$(DEFAULT_COL)"
$(VERBOSE)for p in $(GDB_PATCHES); do \
patch -d $(CONTRIB_DIR)/gdb-$(GDB_VERSION) -p1 -i $(GDB_PATCHES_DIR)/$$p; done;
$(VERBOSE)touch $@