casaroli opened a new pull request, #21010: URL: https://github.com/apache/nuttx/pull/21010
## Summary Since #20412 (commit dbc9a233f14), an arm64 kernel build (`CONFIG_BUILD_KERNEL=y`) with `CONFIG_DEV_SIMPLE_ADDRENV=y` compiles `arch/arm64/src/common/arm64_physpgaddr.c` for `up_addrenv_va_to_pa()`, and `drivers/misc/addrenv.c` no longer defines `up_addrenv_va_to_pa()` in a kernel build. But all the code of `arm64_physpgaddr.c` is still inside `#ifndef CONFIG_DEV_SIMPLE_ADDRENV`, so no file defines the function and the link fails on master: ``` aarch64-none-elf-ld: staging/libfs.a(virtio_9p.o): in function `virtio_9p_split': fs/v9fs/virtio_9p.c:129:(.text.virtio_9p_split+0x58): undefined reference to `up_addrenv_va_to_pa' aarch64-none-elf-ld: staging/libopenamp.a(io.o): in function `metal_io_offset_to_phys_': openamp/libmetal/lib/system/nuttx/io.c:107:(.text.metal_io_offset_to_phys_+0x8): undefined reference to `up_addrenv_va_to_pa' ``` This PR keeps only `up_addrenv_pa_to_va()` under `#ifndef CONFIG_DEV_SIMPLE_ADDRENV`, because `drivers/misc/addrenv.c` still defines it. `Make.defs` and `CMakeLists.txt` already select the file for this case, so they do not change. ## Impact arm64 kernel builds with `CONFIG_DEV_SIMPLE_ADDRENV` link again and translate addresses with the MMU, as #20412 intends. No in-tree defconfig has this combination, so CI did not see the failure. No change for other builds: without `CONFIG_DEV_SIMPLE_ADDRENV` the compiled code is the same, and a flat build with `CONFIG_DEV_SIMPLE_ADDRENV` does not compile the file. ## Testing `qemu-armv8a:knsh` with `ARCH_CHIP_QEMU_WITH_HV`, `DRIVERS_VIRTIO_MMIO`, `FS_V9FS`, `V9FS_VIRTIO_9P` and `DEV_SIMPLE_ADDRENV`, under QEMU with HVF. `/system` is mounted over virtio 9p, so every program that the kernel loads is read through `up_addrenv_va_to_pa()`. | Tree | Make | CMake | ostest | |---|---|---|---| | 37931997ee3 (before #20412) | links | not built | not run | | master 3196e0e090c | undefined reference | undefined reference | - | | this PR | links | links | exits with status 0 | `qemu-armv8a:nsh` (flat) with the same options: links, ostest exits with status 0. With this PR, `arm64_physpgaddr.c` defines only `up_addrenv_va_to_pa()` and `drivers/misc/addrenv.c` defines only `up_addrenv_pa_to_va()` in this build (`nm` of both objects). `tools/checkpatch.sh -c -u -m -g` passes. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
