RTEMS | libtests/dl12: Fix build error (!92)

Ranulfo Raphael (@ranulfo) gitlab at rtems.org
Tue Jun 25 13:23:19 UTC 2024




Ranulfo Raphael commented: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/92#note_108044


Thanks for the fix allowing additional ldflags to the `link_cc`. But in this case the `link_cc` has additional arguments that invalidates the object creation for the dl12 test case, such as `-Wl,-gc-sections` and some rtems library linkage, resulting the following test output for `arm/xilinx_zynq_a9_qemu`:
```
$ qemu-system-arm -no-reboot -nographic -net none -serial null -serial mon:stdio -M xilinx-zynq-a9 -m 256M -kernel build/arm/xilinx_zynq_a9_qemu/testsuites/libtests/dl12.exe
qemu-system-arm: warning: nic cadence_gem.0 has no peer
qemu-system-arm: warning: nic cadence_gem.1 has no peer


*** BEGIN OF TEST libdl (RTL) 12 ***
*** TEST VERSION: 6.0.0.514866cea5f930a9ccb4d9cdfd142299e19fd45d
*** TEST STATE: EXPECTED_PASS
*** TEST BUILD:
*** TEST TOOLS: 13.3.0 20240521 (RTEMS 6, RSB 4c6dfb7aef9811258457971aa9213d5aebb9ce8d, Newlib 1ed1516)
load: /dl12-inc.o
dlopen failed: no memory to load obj

[ RTEMS shutdown ]
RTEMS version: 6.0.0.514866cea5f930a9ccb4d9cdfd142299e19fd45d
RTEMS tools: 13.3.0 20240521 (RTEMS 6, RSB 4c6dfb7aef9811258457971aa9213d5aebb9ce8d, Newlib 1ed1516)
executing thread ID: 0x0a010001
executing thread name: UI1
```

This commit creates the `dl12-inc.o` object with the following commands:
```
#arm/tms570lc4357_hdk_sdram
/home/devel/rtems-6/bin/arm-rtems6-gcc -mbe32 -qnolinkcmds -T linkcmds.tms570lc4357_hdk_sdram /workdir/build/arm/tms570lc4357_hdk_sdram/testsuites/libtests/dl12/dl12-o1.o /workdir/build/arm/tms570lc4357_hdk_sdram/testsuites/libtests/dl12/dl12-o2.o -o/workdir/build/arm/tms570lc4357_hdk_sdram/testsuites/libtests/dl12/dl12-inc.o -L. -lrtemscpu -lrtemsbsp -lrtemstest -qrtems -march=armv7-r -mthumb -mbig-endian -mfpu=vfpv3-d16 -mfloat-abi=hard -Wl,--gc-sections -L/workdir/bsps/arm/shared/start -L/workdir/bsps/arm/tms570/start -Wl,--wrap=printf -Wl,--wrap=puts -Wl,--wrap=putchar -Wl,-r
#arm/xilinx_zynq_a9_qemu
/home/devel/rtems-6/bin/arm-rtems6-gcc /workdir/build/arm/xilinx_zynq_a9_qemu/testsuites/libtests/dl12/dl12-o1.o /workdir/build/arm/xilinx_zynq_a9_qemu/testsuites/libtests/dl12/dl12-o2.o -o/workdir/build/arm/xilinx_zynq_a9_qemu/testsuites/libtests/dl12/dl12-inc.o -L. -lrtemscpu -lrtemsbsp -lrtemstest -qrtems -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -mtune=cortex-a9 -Wl,--gc-sections -L/workdir/bsps/arm/shared/start -L/workdir/bsps/arm/xilinx-zynq/start -Wl,--wrap=printf -Wl,--wrap=puts -Wl,--wrap=putchar -Wl,-r
```
readelf:
```
$ arm-rtems6-readelf -s build/arm/xilinx_zynq_a9_qemu/testsuites/libtests/dl12/dl12-inc.o | head -n 30
readelf: Error: Section 21 has invalid sh_entsize of 0
readelf: Error: (Using the expected size of c for the rest of this dump)

Symbol table '.symtab' contains 571 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 00000000     0 SECTION LOCAL  DEFAULT    1 .start
     2: 00000000     0 SECTION LOCAL  DEFAULT    3 .xbarrier
     3: 00000000     0 SECTION LOCAL  DEFAULT    4 .text
     4: 00000000     0 SECTION LOCAL  DEFAULT    6 .init
     5: 00000000     0 SECTION LOCAL  DEFAULT    7 .fini
     6: 00000000     0 SECTION LOCAL  DEFAULT    8 .robarrier
     7: 00000000     0 SECTION LOCAL  DEFAULT    9 .rodata
     8: 00000000     0 SECTION LOCAL  DEFAULT   11 .ARM.exidx
     9: 00000000     0 SECTION LOCAL  DEFAULT   12 .eh_frame
    10: 00000000     0 SECTION LOCAL  DEFAULT   13 .tdata
    11: 00000000     0 SECTION LOCAL  DEFAULT   14 .tbss
    12: 00000000     0 SECTION LOCAL  DEFAULT   15 .preinit_array
    13: 00000000     0 SECTION LOCAL  DEFAULT   16 .init_array
    14: 00000000     0 SECTION LOCAL  DEFAULT   18 .fini_array
    15: 00000000     0 SECTION LOCAL  DEFAULT   20 .rel.dyn
    16: 00000000     0 SECTION LOCAL  DEFAULT   21 .rela.dyn
    17: 00000000     0 SECTION LOCAL  DEFAULT   22 .tm_clone_table
    18: 00000000     0 SECTION LOCAL  DEFAULT   23 .rtemsroset
    19: 00000000     0 SECTION LOCAL  DEFAULT   25 .rwbarrier
    20: 00000000     0 SECTION LOCAL  DEFAULT   26 .vector
    21: 00000000     0 SECTION LOCAL  DEFAULT   27 .fast_text
    22: 00000000     0 SECTION LOCAL  DEFAULT   28 .fast_data
    23: 00000000     0 SECTION LOCAL  DEFAULT   29 .data
    24: 00000000     0 SECTION LOCAL  DEFAULT   31 .rtemsrwset
    25: 00000000     0 SECTION LOCAL  DEFAULT   32 .bss
    26: 00000000     0 SECTION LOCAL  DEFAULT   33 .rtemsstack
```

I would expect something like this:
```
#arm/tms570lc4357_hdk_sdram
/home/devel/rtems-6/bin/arm-rtems6-gcc -march=armv7-r -mthumb -mbig-endian -mfpu=vfpv3-d16 -mfloat-abi=hard -r testsuites/libtests/dl12/dl12-o1.o testsuites/libtests/dl12/dl12-o2.o -o testsuites/libtests/dl12/dl12-inc.o
#arm/xilinx_zynq_a9_qemu
/home/devel/rtems-6/bin/arm-rtems6-gcc -march=armv7-a -mthumb -mfpu=neon -mfloat-abi=hard -mtune=cortex-a9 -r testsuites/libtests/dl12/dl12-o1.o testsuites/libtests/dl12/dl12-o2.o -o testsuites/libtests/dl12/dl12-inc.o
```
readelf:
```
$ arm-rtems6-readelf -s build/arm/xilinx_zynq_a9_qemu/testsuites/libtests/dl12/dl12-inc.o 

Symbol table '.symtab' contains 29 entries:
   Num:    Value  Size Type    Bind   Vis      Ndx Name
     0: 00000000     0 NOTYPE  LOCAL  DEFAULT  UND 
     1: 00000000     0 SECTION LOCAL  DEFAULT    1 .text
     2: 00000000     0 SECTION LOCAL  DEFAULT    2 .text.dl_o1_func
     3: 00000000     0 SECTION LOCAL  DEFAULT    4 .text.dl_o2_func
     4: 00000000     0 SECTION LOCAL  DEFAULT    6 .rodata.dl_o1_fu[...]
     5: 00000000     0 SECTION LOCAL  DEFAULT    7 .rodata.dl_o2_fu[...]
     6: 00000000     0 SECTION LOCAL  DEFAULT    8 .data
     7: 00000000     0 SECTION LOCAL  DEFAULT    9 .bss
     8: 00000000     0 SECTION LOCAL  DEFAULT   10 .comment
     9: 00000000     0 SECTION LOCAL  DEFAULT   11 .debug_aranges
    10: 00000000     0 SECTION LOCAL  DEFAULT   13 .debug_info
    11: 00000000     0 SECTION LOCAL  DEFAULT   15 .debug_abbrev
    12: 00000000     0 SECTION LOCAL  DEFAULT   16 .debug_line
    13: 00000000     0 SECTION LOCAL  DEFAULT   18 .debug_frame
    14: 00000000     0 SECTION LOCAL  DEFAULT   20 .debug_str
    15: 00000000     0 SECTION LOCAL  DEFAULT   21 .debug_rnglists
    16: 00000000     0 SECTION LOCAL  DEFAULT   23 .ARM.attributes
    17: 00000000     0 FILE    LOCAL  DEFAULT  ABS dl12-o1.c
    18: 00000000     0 NOTYPE  LOCAL  DEFAULT    6 $d
    19: 00000000     0 NOTYPE  LOCAL  DEFAULT    2 $t
    20: 00000000     0 NOTYPE  LOCAL  DEFAULT    6 .LC0
    21: 00000000     0 FILE    LOCAL  DEFAULT  ABS dl12-o2.c
    22: 00000000     0 NOTYPE  LOCAL  DEFAULT    7 $d
    23: 00000000     0 NOTYPE  LOCAL  DEFAULT    4 $t
    24: 00000000     0 NOTYPE  LOCAL  DEFAULT    7 .LC0
    25: 00000001    28 FUNC    GLOBAL DEFAULT    2 dl_o1_func
    26: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND rtems_printf
    27: 00000000     0 NOTYPE  GLOBAL DEFAULT  UND rtems_test_printer
    28: 00000001    28 FUNC    GLOBAL DEFAULT    4 dl_o2_func
```

-- 
View it on GitLab: https://gitlab.rtems.org/rtems/rtos/rtems/-/merge_requests/92#note_108044
You're receiving this email because of your account on gitlab.rtems.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/bugs/attachments/20240625/7b240bac/attachment-0001.htm>


More information about the bugs mailing list