Skip to content

TOOLCHAIN_LD_FLAGS setting of -mabi/-march aren't propagated to linker invocation on RISC-V #28456

@galak

Description

@galak

The setting of TOOLCHAIN_LD_FLAGS in cmake/compiler/gcc/target_riscv.cmake has -mabi and -march set. These flags don't show up in the link invocation.

For example for building hello_world on qemu_riscv64 we have: -mabi=lp64 -march=rv64imac

and the link looks like:

riscv64-zephyr-elf/bin/riscv64-zephyr-elf-gcc CMakeFiles/zephyr_final.dir/misc/empty_file.c.obj CMakeFiles/zephyr_final.dir/isr_tables.c.obj  -o zephyr.elf  -Wl,-T linker_pass_final.cmd -Wl,-Map=/home/galak/git/zephyr/samples/hello_world/build/zephyr/zephyr_final.map -Wl,--whole-archive ../app/libapp.a libzephyr.a arch/common/libarch__common.a arch/arch/riscv/core/libarch__riscv__core.a lib/libc/minimal/liblib__libc__minimal.a lib/posix/liblib__posix.a drivers/gpio/libdrivers__gpio.a drivers/serial/libdrivers__serial.a -Wl,--no-whole-archive kernel/libkernel.a CMakeFiles/offsets.dir/arch/riscv/core/offsets/offsets.c.obj -L"riscv64-zephyr-elf/bin/../lib/gcc/riscv64-zephyr-elf/10.2.0/rv64imac/lp64/medany" -L/home/galak/git/zephyr/samples/hello_world/build/zephyr -lgcc arch/common/libisr_tables.a -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -no-pie -Wl,-X -Wl,-N -Wl,--orphan-handling=warn 

Metadata

Metadata

Assignees

Labels

area: RISCVRISCV Architecture (32-bit & 64-bit)bugThe issue is a bug, or the PR is fixing a bugpriority: lowLow impact/importance bug

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions