-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
RISCV64: add buildroot toolchain support
This is work in a progress, still got build issues defined by mlx_riscv64_defconfig Signed-off-by: Noam Camus <noamca@mellanox.com>
- Loading branch information
Noam Camus
committed
Jun 13, 2017
1 parent
5fa9693
commit d22f226
Showing
11 changed files
with
204 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
BR2_riscv64=y | ||
BR2_GLIBC_VERSION_2_23=y | ||
BR2_LINUX_KERNEL=y | ||
BR2_LINUX_KERNEL_CUSTOM_GIT=y | ||
BR2_LINUX_KERNEL_CUSTOM_REPO_URL="https://github.com/riscv/riscv-linux.git" | ||
BR2_LINUX_KERNEL_CUSTOM_REPO_VERSION="riscv-next" | ||
BR2_LINUX_KERNEL_PATCH="$(TOPDIR)/linux/riscv.patch" | ||
BR2_LINUX_KERNEL_DEFCONFIG="riscv64_spike" | ||
BR2_TARGET_ROOTFS_INITRAMFS=y | ||
# BR2_TARGET_ROOTFS_TAR is not set | ||
BR2_PACKAGE_HOST_MKE2IMG=y |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
diff -urN linux-headers.orig/arch/riscv/include/uapi/asm/setup.h linux-headers/arch/riscv/include/uapi/asm/setup.h | ||
--- linux-headers.orig/arch/riscv/include/uapi/asm/setup.h 1970-01-01 02:00:00.000000000 +0200 | ||
+++ linux-headers/arch/riscv/include/uapi/asm/setup.h 2017-06-13 08:46:15.567800383 +0300 | ||
@@ -0,0 +1,6 @@ | ||
+/* | ||
+ * setup.h is part of userspace header ABI so UAPI scripts have to generate it | ||
+ * even if there's nothing to export - causing empty <uapi/asm/setup.h> | ||
+ * However to prevent "patch" from discarding it we add this placeholder | ||
+ * comment | ||
+ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
133 changes: 133 additions & 0 deletions
133
package/binutils/riscv-next/0001-FIX-verlapping-FDEs-when-linking-libc.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,133 @@ | ||
diff -urN binutils.orig/bfd/bfd-in2.h binutils/bfd/bfd-in2.h | ||
--- binutils.orig/bfd/bfd-in2.h 2017-05-20 01:49:31.000000000 +0300 | ||
+++ binutils/bfd/bfd-in2.h 2017-06-13 15:52:19.961649468 +0300 | ||
@@ -4769,6 +4769,7 @@ | ||
BFD_RELOC_RISCV_SET8, | ||
BFD_RELOC_RISCV_SET16, | ||
BFD_RELOC_RISCV_SET32, | ||
+ BFD_RELOC_RISCV_64_PCREL, | ||
|
||
/* Renesas RL78 Relocations. */ | ||
BFD_RELOC_RL78_NEG8, | ||
diff -urN binutils.orig/bfd/elfnn-riscv.c binutils/bfd/elfnn-riscv.c | ||
--- binutils.orig/bfd/elfnn-riscv.c 2017-05-20 01:49:31.000000000 +0300 | ||
+++ binutils/bfd/elfnn-riscv.c 2017-06-13 15:53:06.036956405 +0300 | ||
@@ -1566,6 +1566,7 @@ | ||
case R_RISCV_SET8: | ||
case R_RISCV_SET16: | ||
case R_RISCV_SET32: | ||
+ case R_RISCV_64_PCREL: | ||
case R_RISCV_TLS_DTPREL32: | ||
case R_RISCV_TLS_DTPREL64: | ||
break; | ||
@@ -1853,6 +1854,7 @@ | ||
case R_RISCV_SET16: | ||
case R_RISCV_SET32: | ||
case R_RISCV_DELETE: | ||
+ case R_RISCV_64_PCREL: | ||
/* These require no special handling beyond perform_relocation. */ | ||
break; | ||
|
||
diff -urN binutils.orig/bfd/elfxx-riscv.c binutils/bfd/elfxx-riscv.c | ||
--- binutils.orig/bfd/elfxx-riscv.c 2017-05-20 01:49:31.000000000 +0300 | ||
+++ binutils/bfd/elfxx-riscv.c 2017-06-13 15:53:51.780243045 +0300 | ||
@@ -849,6 +849,22 @@ | ||
0, /* src_mask */ | ||
MINUS_ONE, /* dst_mask */ | ||
FALSE), /* pcrel_offset */ | ||
+ | ||
+ /* Deletes bytes after this address. The addend specifies the number of | ||
+ * bytes to delete, just like R_RISCV_ALIGN. */ | ||
+ HOWTO (R_RISCV_64_PCREL, /* type */ | ||
+ 0, /* rightshift */ | ||
+ 4, /* size */ | ||
+ 64, /* bitsize */ | ||
+ TRUE, /* pc_relative */ | ||
+ 0, /* bitpos */ | ||
+ complain_overflow_dont, /* complain_on_overflow */ | ||
+ bfd_elf_generic_reloc, /* special_function */ | ||
+ "R_RISCV_64_PCREL", /* name */ | ||
+ FALSE, /* partial_inplace */ | ||
+ 0, /* src_mask */ | ||
+ MINUS_ONE, /* dst_mask */ | ||
+ FALSE), /* pcrel_offset */ | ||
}; | ||
|
||
/* A mapping from BFD reloc types to RISC-V ELF reloc types. */ | ||
@@ -910,6 +926,7 @@ | ||
{ BFD_RELOC_RISCV_SET8, R_RISCV_SET8 }, | ||
{ BFD_RELOC_RISCV_SET16, R_RISCV_SET16 }, | ||
{ BFD_RELOC_RISCV_SET32, R_RISCV_SET32 }, | ||
+ { BFD_RELOC_RISCV_64_PCREL, R_RISCV_64_PCREL }, | ||
}; | ||
|
||
/* Given a BFD reloc type, return a howto structure. */ | ||
diff -urN binutils.orig/bfd/libbfd.h binutils/bfd/libbfd.h | ||
--- binutils.orig/bfd/libbfd.h 2017-05-20 01:49:31.000000000 +0300 | ||
+++ binutils/bfd/libbfd.h 2017-06-13 15:54:06.212014046 +0300 | ||
@@ -2212,6 +2212,7 @@ | ||
"BFD_RELOC_RISCV_SET8", | ||
"BFD_RELOC_RISCV_SET16", | ||
"BFD_RELOC_RISCV_SET32", | ||
+ "BFD_RELOC_RISCV_64_PCREL", | ||
"BFD_RELOC_RL78_NEG8", | ||
"BFD_RELOC_RL78_NEG16", | ||
"BFD_RELOC_RL78_NEG24", | ||
diff -urN binutils.orig/bfd/reloc.c binutils/bfd/reloc.c | ||
--- binutils.orig/bfd/reloc.c 2017-05-20 01:49:31.000000000 +0300 | ||
+++ binutils/bfd/reloc.c 2017-06-13 15:54:19.819796701 +0300 | ||
@@ -5155,6 +5155,8 @@ | ||
BFD_RELOC_RISCV_SET16 | ||
ENUMX | ||
BFD_RELOC_RISCV_SET32 | ||
+ENUMX | ||
+ BFD_RELOC_RISCV_64_PCREL | ||
ENUMDOC | ||
RISC-V relocations. | ||
|
||
diff -urN binutils.orig/gas/config/tc-riscv.c binutils/gas/config/tc-riscv.c | ||
--- binutils.orig/gas/config/tc-riscv.c 2017-05-20 01:49:31.000000000 +0300 | ||
+++ binutils/gas/config/tc-riscv.c 2017-06-13 15:55:11.218965592 +0300 | ||
@@ -1871,6 +1871,7 @@ | ||
bfd_byte *buf = (bfd_byte *) (fixP->fx_frag->fr_literal + fixP->fx_where); | ||
bfd_boolean relaxable = FALSE; | ||
offsetT loc; | ||
+ segT sub_segment; | ||
|
||
/* Remember value for tc_gen_reloc. */ | ||
fixP->fx_addnumber = *valP; | ||
@@ -1919,6 +1920,23 @@ | ||
break; | ||
|
||
case BFD_RELOC_64: | ||
+ /* Use pc-relative relocation for FDE initial location. | ||
+ The symbol address in .eh_frame may be adjusted in | ||
+ _bfd_elf_discard_section_eh_frame, and the content of | ||
+ .eh_frame will be adjusted in _bfd_elf_write_section_eh_frame. | ||
+ Therefore, we cannot insert a relocation whose addend symbol is | ||
+ in .eh_frame. Othrewise, the value may be adjusted twice.*/ | ||
+ if (fixP->fx_addsy && fixP->fx_subsy | ||
+ && (sub_segment = S_GET_SEGMENT (fixP->fx_subsy)) | ||
+ && strcmp (sub_segment->name, ".eh_frame") == 0 | ||
+ && S_GET_VALUE (fixP->fx_subsy) | ||
+ == fixP->fx_frag->fr_address + fixP->fx_where) | ||
+ { | ||
+ fixP->fx_r_type = BFD_RELOC_RISCV_64_PCREL; | ||
+ fixP->fx_subsy = NULL; | ||
+ break; | ||
+ } | ||
+ /* Fall through. */ | ||
case BFD_RELOC_32: | ||
case BFD_RELOC_16: | ||
case BFD_RELOC_8: | ||
diff -urN binutils.orig/include/elf/riscv.h binutils/include/elf/riscv.h | ||
--- binutils.orig/include/elf/riscv.h 2017-05-20 01:49:31.000000000 +0300 | ||
+++ binutils/include/elf/riscv.h 2017-06-13 15:55:36.962544552 +0300 | ||
@@ -87,6 +87,7 @@ | ||
RELOC_NUMBER (R_RISCV_SET8, 54) | ||
RELOC_NUMBER (R_RISCV_SET16, 55) | ||
RELOC_NUMBER (R_RISCV_SET32, 56) | ||
+ RELOC_NUMBER (R_RISCV_64_PCREL, 57) | ||
END_RELOC_NUMBERS (R_RISCV_max) | ||
|
||
/* Processor specific flags for the ELF header e_flags field. */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
package/gcc/riscv-next/0001-remove-failed-s-selftest-target.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
diff -urN gcc.orig/gcc/Makefile.in gcc/gcc/Makefile.in | ||
--- gcc.orig/gcc/Makefile.in 2017-05-30 05:47:35.000000000 +0300 | ||
+++ gcc/gcc/Makefile.in 2017-06-12 17:43:22.140479147 +0300 | ||
@@ -1908,7 +1908,7 @@ | ||
# Use "s-selftest" to ensure that we only run the selftests if the | ||
# driver, cc1, or selftest data change. | ||
.PHONY: selftest | ||
-selftest: s-selftest | ||
+selftest: # s-selftest | ||
s-selftest: $(GCC_PASSES) cc1$(exeext) stmp-int-hdrs \ | ||
$(srcdir)/testsuite/selftests | ||
$(GCC_FOR_TARGET) $(SELFTEST_FLAGS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters