Skip to content

Commit

Permalink
[riscv-gnu-toolchain] Apply patch to riscv-binutils
Browse files Browse the repository at this point in the history
  • Loading branch information
suehtamacv committed Mar 9, 2021
1 parent 86edfa2 commit 832a365
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 3 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,15 @@ endif
all: toolchain riscv-isa-sim

# Toolchain
toolchain: tc-riscv-gcc tc-llvm

tc-riscv-gcc:
toolchain:
mkdir -p $(GCC_INSTALL_DIR)
# Apply patch on riscv-binutils
cd $(CURDIR)/toolchain/riscv-gnu-toolchain/riscv-binutils && git reset --hard && git apply $(CURDIR)/patches/0001-riscv-binutils-patch
cd $(CURDIR)/toolchain/riscv-gnu-toolchain && rm -rf build && mkdir -p build && cd build && \
../configure --prefix=$(GCC_INSTALL_DIR) --with-arch=rv32gcv --with-cmodel=medlow --enable-multilib && \
$(MAKE) MAKEINFO=true -j4

# Spike
riscv-isa-sim:
cd toolchain/riscv-isa-sim && mkdir -p build && cd build; \
[ -d dtc ] || git clone git://git.kernel.org/pub/scm/utils/dtc/dtc.git && cd dtc; \
Expand Down
25 changes: 25 additions & 0 deletions patches/0001-riscv-binutils-patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index 5be7410544..0e3d17cfb7 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1401,7 +1401,8 @@ static bfd_boolean
riscv_multi_letter_ext_valid_p (const char *ext,
const char *const *known_exts)
{
- for (size_t i = 0; known_exts[i]; ++i)
+ size_t i;
+ for (i = 0; known_exts[i]; ++i)
{
if (!strcmp (ext, known_exts[i]))
return TRUE;
@@ -1489,8 +1490,8 @@ riscv_parse_subset (riscv_parse_subset_t *rps,
return FALSE;

/* Parse the different classes of extensions in the specified order. */
-
- for (size_t i = 0; i < ARRAY_SIZE (parse_config); ++i) {
+ size_t i;
+ for (i = 0; i < ARRAY_SIZE (parse_config); ++i) {
p = riscv_parse_prefixed_ext (rps, arch, p, &parse_config[i]);

if (p == NULL)

0 comments on commit 832a365

Please sign in to comment.