[riot-commits] [RIOT-OS/RIOT] 628c19: riscv_common: explicitly mark handle_trap as used

benpicco noreply at github.com
Wed May 5 16:01:04 CEST 2021


  Branch: refs/heads/master
  Home:   https://github.com/RIOT-OS/RIOT
  Commit: 628c199f51abbcd0572d93756302706368be5405
      https://github.com/RIOT-OS/RIOT/commit/628c199f51abbcd0572d93756302706368be5405
  Author: Sören Tempel <soeren+git at soeren-tempel.net>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M cpu/riscv_common/irq_arch.c

  Log Message:
  -----------
  riscv_common: explicitly mark handle_trap as used

The handle_trap function is used internally by the trap_entry
implementation from the same file. However, the trap_entry
implementation calls handle_trap from inline assembly. This makes it
difficult for the compiler to infer that the handle_trap function is
used at all. This causes issues when LTO is enabled.

Without this patch compiling any RISC-V RIOT code with `LTO=1` causes
the following linker error:

	/home/soeren/src/RIOT/cpu/riscv_common/irq_arch.c:134: undefined reference to `handle_trap'
	/tmp/hello-world.elf.Nngidp.ltrans0.ltrans.o:cpu/riscv_common/irq_arch.c:134:(.text.trap_entry+0x34):
	  relocation truncated to fit: R_RISCV_GPREL_I against undefined symbol `handle_trap'

This commit fixes LTO support for RISC-V.

While at it, also mark the function as static as it is only used by the
trap_entry function from the same compilation unit.


  Commit: 6e4434a76049356d5c24be606084cd38abc6d432
      https://github.com/RIOT-OS/RIOT/commit/6e4434a76049356d5c24be606084cd38abc6d432
  Author: benpicco <benjamin.valentin at ml-pa.com>
  Date:   2021-05-05 (Wed, 05 May 2021)

  Changed paths:
    M cpu/riscv_common/irq_arch.c

  Log Message:
  -----------
  Merge pull request #16449 from nmeum/pr/riscv-lto

riscv_common: mark handle_trap as used (fixes LTO on RISC-V)


Compare: https://github.com/RIOT-OS/RIOT/compare/77864c660d9a...6e4434a76049


More information about the commits mailing list