SpinalHDL / SpinalHDL/NaxSoftware

Not compile when using app.mk

Open
#4 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
13
Forks
9
Avg merge
2d 6h
Merged PRs (30d)
3

Description

Can not compile a project using app.mk (e.g. zknAes). The linker output the following error:

/usr/lib/gcc/riscv64-elf/15.2.0/../../../../riscv64-elf/bin/ld: warning: build/zknAes.elf has a LOAD segment with RWX permissions
/usr/lib/gcc/riscv64-elf/15.2.0/../../../../riscv64-elf/lib/libc.a(libc_a-puts.o): in function `_puts_r':
/build/riscv64-elf-newlib/src/build-newlib/riscv64-elf/newlib/../../../newlib-4.6.0.20260123/newlib/libc/stdio/puts.c:73:(.text._puts_r+0x12): relocation truncated to fit: R_RISCV_HI20 against `.LC0'
/usr/lib/gcc/riscv64-elf/15.2.0/../../../../riscv64-elf/lib/libc.a(libc_a-init.o): in function `__libc_init_array':
/build/riscv64-elf-newlib/src/build-newlib/riscv64-elf/newlib/../../../newlib-4.6.0.20260123/newlib/libc/misc/init.c:36:(.text.__libc_init_array+0x6): relocation truncated to fit: R_RISCV_HI20 against symbol `__preinit_array_start' defined in .text section in build/zknAes.elf
/usr/lib/gcc/riscv64-elf/15.2.0/../../../../riscv64-elf/lib/libc.a(libc_a-findfp.o): in function `stdio_exit_handler':
/build/riscv64-elf-newlib/src/build-newlib/riscv64-elf/newlib/../../../newlib-4.6.0.20260123/newlib/libc/stdio/findfp.c:155:(.text.stdio_exit_handler+0x0): relocation truncated to fit: R_RISCV_HI20 against symbol `__sglue' defined in .data.__sglue section in /usr/lib/gcc/riscv64-elf/15.2.0/../../../../riscv64-elf/lib/libc.a(libc_a-findfp.o)
/build/riscv64-elf-newlib/src/build-newlib/riscv64-elf/newlib/../../../newlib-4.6.0.20260123/newlib/libc/stdio/findfp.c:155:(.text.cleanup_stdio+0x4): relocation truncated to fit: R_RISCV_HI20 against symbol `__sf' defined in .bss.__sf section in /usr/lib/gcc/riscv64-elf/15.2.0/../../../../riscv64-elf/lib/libc.a(libc_a-findfp.o)
/usr/lib/gcc/riscv64-elf/15.2.0/../../../../riscv64-elf/lib/libc.a(libc_a-findfp.o): in function `__fp_unlock':
/build/riscv64-elf-newlib/src/build-newlib/riscv64-elf/newlib/../../../newlib-4.6.0.20260123/newlib/libc/stdio/findfp.c:296:(.text.global_stdio_init.part.0+0x2): relocation truncated to fit: R_RISCV_HI20 against `stdio_exit_handler'
/usr/lib/gcc/riscv64-elf/15.2.0/../../../../riscv64-elf/lib/libc.a(libc_a-findfp.o): in function `__sfp_lock_acquire':
/build/riscv64-elf-newlib/src/build-newlib/riscv64-elf/newlib/../../../newlib-4.6.0.20260123/newlib/libc/stdio/findfp.c:87:(.text.__sfp+0x1a): relocation truncated to fit: R_RISCV_HI20 against symbol `__sglue' defined in .data.__sglue section in /usr/lib/gcc/riscv64-elf/15.2.0/../../../../riscv64-elf/lib/libc.a(libc_a-findfp.o)
/build/riscv64-elf-newlib/src/build-newlib/riscv64-elf/newlib/../../../newlib-4.6.0.20260123/newlib/libc/stdio/findfp.c:275:(.text.__sinit+0x16): relocation truncated to fit: R_RISCV_HI20 against `cleanup_stdio'
/usr/lib/gcc/riscv64-elf/15.2.0/../../../../riscv64-elf/lib/libc.a(libc_a-findfp.o): in function `__sfp_lock_release':
/build/riscv64-elf-newlib/src/build-newlib/riscv64-elf/newlib/../../../newlib-4.6.0.20260123/newlib/libc/stdio/findfp.c:275:(.text.__fp_lock_all+0xe): relocation truncated to fit: R_RISCV_HI20 against symbol `__sglue' defined in .data.__sglue section in /usr/lib/gcc/riscv64-elf/15.2.0/../../../../riscv64-elf/lib/libc.a(libc_a-findfp.o)
/usr/lib/gcc/riscv64-elf/15.2.0/../../../../riscv64-elf/lib/libc.a(libc_a-findfp.o): in function `__fp_lock_all':
/build/riscv64-elf-newlib/src/build-newlib/riscv64-elf/newlib/../../../newlib-4.6.0.20260123/newlib/libc/stdio/findfp.c:302:(.text.__fp_unlock_all+0x0): relocation truncated to fit: R_RISCV_HI20 against symbol `__sglue' defined in .data.__sglue section in /usr/lib/gcc/riscv64-elf/15.2.0/../../../../riscv64-elf/lib/libc.a(libc_a-findfp.o)
/usr/lib/gcc/riscv64-elf/15.2.0/../../../../riscv64-elf/lib/libc.a(libc_a-memchr.o): in function `memchr':
/build/riscv64-elf-newlib/src/build-newlib/riscv64-elf/newlib/../../../newlib-4.6.0.20260123/newlib/libc/machine/riscv/memchr.c:61:(.text.memchr+0x1a): relocation truncated to fit: R_RISCV_HI20 against `.L6'
/usr/lib/gcc/riscv64-elf/15.2.0/../../../../riscv64-elf/lib/libc.a(libc_a-freer.o): in function `_malloc_trim_r':
/build/riscv64-elf-newlib/src/build-newlib/riscv64-elf/newlib/../../../newlib-4.6.0.20260123/newlib/libc/stdlib/_mallocr.c:3340:(.text._malloc_trim_r+0x4): additional relocation overflows omitted from the output

This can be solved by removing MEMORY section in the link script. But I am not sure what happens to this.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with app.mk and the link script used for the zknAes build, then reproduce the relocation errors shown in the issue. Compare the build with and without the MEMORY section and determine whether removing it preserves the intended memory layout. Done means the project compiles without relocation overflows and the resulting layout is understood.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.