Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#4947 closed defect (fixed)

Testsuite libtest tests not built with optimise or debug flags

Reported by: Chris Johns Owned by: Sebastian Huber <sebastian.huber@…>
Priority: normal Milestone: 6.1
Component: build Version: 6
Severity: blocker Keywords:
Cc: Blocked By:
Blocking:

Description

The tests are being built with the optimsize or debug options for:

  • aarch64/xilinx_zynqmp_lp64_qemu
  • arm/xilinx_zynq_a9_qemu

The build is:

09:44:14 runner ' /opt/work/rtems/6/bin/arm-rtems6-gcc 
 -MMD -Wall -Wmissing-prototypes -Wimplicit-function-declaration
 -Wstrict-prototypes -Wnested-externs -march=armv7-a -mthumb
 -mfpu=neon -mfloat-abi=hard -mtune=cortex-a9 -DHAVE_CONFIG_H=1
 -Icpukit/include -I../../../cpukit/include -Icpukit/score/cpu/arm/include
 -I../../../cpukit/score/cpu/arm/include -Ibsps/include
 -I../../../bsps/include -Ibsps/arm/include -I../../../bsps/arm/include 
 -Ibsps/arm/xilinx-zynq/include -I../../../bsps/arm/xilinx-zynq/include 
 -Itestsuites/support/include -I../../../testsuites/support/include 
 -Itestsuites/libtests/dl09 -I../../../testsuites/libtests/dl09 
 -c /opt/work/chris/rtems/kernel/rtems.git/testsuites/libtests/dl09/dl-load.c 
 -o testsuites/libtests/dl09/dl-load.o '                                                                                                                                                                                                                                                                                                                                                                                                                                                                      

while a cpukit file is:

09:45:00 runner ['/opt/work/rtems/6/bin/arm-rtems6-gcc', 
 '-MMD', '-Wall', '-Wmissing-prototypes', '-Wimplicit-function-declaration',
 '-Wstrict-prototypes', '-Wnested-externs', '-march=armv7-a',
 '-mthumb', '-mfpu=neon', '-mfloat-abi=hard', '-mtune=cortex-a9',
 '-O2', '-g', '-fdata-sections', '-ffunction-sections',
 '-Icpukit/include', '-I../../../cpukit/include',
 '-Icpukit/score/cpu/arm/include',
 '-I../../../cpukit/score/cpu/arm/include',
 '../../../cpukit/libdl/rtl-elf.c',
 '-c', '-o/opt/work/chris/rtems/kernel/rtems.git/build/arm/xilinx_zynq_a9_qemu/cpukit/libdl/rtl-elf.c.59.o',
 '-DHAVE_CONFIG_H=1']

Change History (5)

comment:1 Changed on 08/24/23 at 23:48:52 by Chris Johns

The tests use the TEST_OPTIMIZATION_FLAGS which is defined in the BSP and based on OPTIMIZATION_FLAGS. This does not seem to be working.

comment:2 Changed on 08/24/23 at 23:49:26 by Chris Johns

Severity: normalblocker

comment:3 Changed on 08/25/23 at 23:28:06 by Chris Johns

The issue is the tests are not being linked with the right or complete set of flags.

The optimization flags contain -g and given -g does not change the generated code it is questionable if this option should be here or a debug flags settings or even forced on as an invariant default.

The simplest solution at this point in time is to add ${TEST_OPTIMIZATION_FLAGS} to the ldflags in the grp.yml for the testsuite.

Adding TEST_OPTIMIZATION_FLAGS to the linker flags has the benefit of linking with -fdata-sections and -ffunction-sections and given we are building all the code with those options the tests are not truly testing the build a user sees.

There is a fragility around having the separate sections flags in optimization flag set. If someone adjusts the -O level they need to carry the other flags over. Is the separate sections important enough now that it needs its own setting to avoid simple mistakes?

comment:4 Changed on 08/25/23 at 23:49:15 by Chris Johns

The test dl09 does not build dl-load.o with the TEST_OPTIMIZATION_FLAGS flags. Updating the dl09.yml spec's cflags to have TEST_OPTIMIZATION_FLAGS works but adding that same to the ldflags breaks the build because the substitution does not happen.

It seems cflags does not pick up the top level grp.yml setting while ldflags does. I have no idea why it is like this.

comment:5 Changed on 09/12/23 at 07:27:42 by Sebastian Huber <sebastian.huber@…>

Owner: set to Sebastian Huber <sebastian.huber@…>
Resolution: fixed
Status: newclosed

In [changeset:"d2d1fa18a93d39b79421ed205755fd6623b2153b/rtems" d2d1fa18/rtems]:

build: Use build context for custom commands

Revert duplicated listing of TEST_OPTIMIZATION_FLAGS.

Close #4947.

Note: See TracTickets for help on using tickets.