mirror of
https://github.com/apache/nuttx-apps.git
synced 2026-08-01 20:29:00 +00:00
testing/ostest: build the perf test only where it can link
perf_gettime() and perf_getfreq() are kernel functions, defined in sched/clock/clock_perf.c. Neither appears in syscall.csv, and libc supplies only perf_gettime(), under CONFIG_ARCH_HAVE_PERF_EVENTS_USER_ACCESS. So a protected or kernel build cannot resolve either of them from user space: ostest/perf_gettime.c:91: undefined reference to `perf_gettime' ostest/perf_gettime.c:184: undefined reference to `perf_getfreq' make[1]: *** [nuttx_user.elf] Error 1 The call in user_main() is guarded by CONFIG_ARCH_PERF_EVENTS && !CONFIG_ARCH_PERF_EVENTS_USER_ACCESS -- which is exactly the case where the symbols are kernel-only -- so every such configuration fails to link. mps3-an547:knsh is one: it sets CONFIG_SCHED_IRQMONITOR, which makes ARCH_PERF_EVENTS default y. mps2-an521:knsh escapes only because it sets neither monitor, leaving ARCH_PERF_EVENTS off, so the call compiles out and the archive member is never pulled in. Require CONFIG_BUILD_FLAT, where ostest links against the kernel's own copy. No configuration that runs the test today stops running it. Signed-off-by: Marco Casaroli <marco.casaroli@gmail.com> Assisted-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
2492317f15
commit
e5b414a6e9
4 changed files with 12 additions and 3 deletions
|
|
@ -161,7 +161,10 @@ if(CONFIG_TESTING_OSTEST)
|
|||
list(APPEND SRCS nxevent.c)
|
||||
endif()
|
||||
|
||||
if(CONFIG_ARCH_HAVE_PERF_EVENTS)
|
||||
# perf_gettime() and perf_getfreq() live in the kernel and are not system
|
||||
# calls, so only a flat build can reach them from here.
|
||||
|
||||
if(CONFIG_ARCH_HAVE_PERF_EVENTS AND CONFIG_BUILD_FLAT)
|
||||
list(APPEND SRCS perf_gettime.c)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -164,9 +164,14 @@ CSRCS += nxevent.c
|
|||
endif
|
||||
endif
|
||||
|
||||
# perf_gettime() and perf_getfreq() live in the kernel and are not system
|
||||
# calls, so only a flat build can reach them from here.
|
||||
|
||||
ifeq ($(CONFIG_ARCH_HAVE_PERF_EVENTS),y)
|
||||
ifeq ($(CONFIG_BUILD_FLAT),y)
|
||||
CSRCS += perf_gettime.c
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_BUILD_FLAT),y)
|
||||
CSRCS += wdog.c spinlock.c
|
||||
|
|
|
|||
|
|
@ -304,7 +304,7 @@ void spinlock_test(void);
|
|||
|
||||
/* perf_gettime.c ***********************************************************/
|
||||
|
||||
#ifdef CONFIG_ARCH_HAVE_PERF_EVENTS
|
||||
#if defined(CONFIG_ARCH_HAVE_PERF_EVENTS) && defined(CONFIG_BUILD_FLAT)
|
||||
void perf_gettime_test(void);
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -656,7 +656,8 @@ static int user_main(int argc, char *argv[])
|
|||
check_test_memory_usage();
|
||||
#endif
|
||||
|
||||
#if defined(CONFIG_ARCH_PERF_EVENTS) && !defined(CONFIG_ARCH_PERF_EVENTS_USER_ACCESS)
|
||||
#if defined(CONFIG_ARCH_PERF_EVENTS) && \
|
||||
!defined(CONFIG_ARCH_PERF_EVENTS_USER_ACCESS) && defined(CONFIG_BUILD_FLAT)
|
||||
/* Verify performance event time counter */
|
||||
|
||||
printf("\nuser_main: performance event time counter test\n");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue