mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2025-12-17 18:43:50 +01:00
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.