#3883 closed defect (fixed)

Trace linker is broken on small-data area targets

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 6.1
Component: tool Version: 5
Severity: normal Keywords:
Cc: Blocked By:
Blocking:

Description

The trace linker generates some data, e.g. __rtld_trace_names. The arrays are not declared in a header file as arrays of unspecified size. So, in rtems-trace-buffer-vars.c the compiler assumes that the size one weakly defined defaults reside in the small-data area. This leads to linker errors with the strong definitions:

Waf: Entering directory `/scratch/git-rtems-examples/build/powerpc-rtems5-qoriq_e6500_32'
[22/29] Processing rtrace: build/powerpc-rtems5-qoriq_e6500_32/filesystem/fat_ramdisk/init.c.6.o build/powerpc-rtems5-qoriq_e6500_32/filesystem/fat_ramdisk/fs-root-tar.c.6.o -> build/powerpc-rtems5-qoriq_e6500_32/filesystem/fat_ramdisk/fat_ramdisk.texe
/opt/rtems/5/bin/powerpc-rtems5-gcc: /opt/rtems/5/lib64/gcc/powerpc-rtems5/7.5.0/../../../../powerpc-rtems5/bin/ld: /opt/rtems/5/powerpc-rtems5/qoriq_e6500_32/lib/librtemscpu.a(rtems-trace-buffer-vars.o): the target (__rtld_trace_names) of a R_PPC_SDAREL16 relocation is in the wrong output section (.data)
/opt/rtems/5/bin/powerpc-rtems5-gcc: /opt/rtems/5/powerpc-rtems5/qoriq_e6500_32/lib/librtemscpu.a(rtems-trace-buffer-vars.o): in function `rtems_trace_names':
/opt/rtems/5/bin/powerpc-rtems5-gcc: /home/EB/sebastian_h/git-rtems-5/c/src/../../cpukit/libmisc/capture/rtems-trace-buffer-vars.c:51:(.text.rtems_trace_names+0x2): relocation truncated to fit: R_PPC_SDAREL16 against symbol `__rtld_trace_names' defined in .data.__rtld_trace_names section in /tmp/ccu6uaaa.o
/opt/rtems/5/bin/powerpc-rtems5-gcc: /opt/rtems/5/lib64/gcc/powerpc-rtems5/7.5.0/../../../../powerpc-rtems5/bin/ld: /opt/rtems/5/powerpc-rtems5/qoriq_e6500_32/lib/librtemscpu.a(rtems-trace-buffer-vars.o): the target (__rtld_trace_signatures) of a R_PPC_SDAREL16 relocation is in the wrong output section (.rodata)
/opt/rtems/5/bin/powerpc-rtems5-gcc: /opt/rtems/5/powerpc-rtems5/qoriq_e6500_32/lib/librtemscpu.a(rtems-trace-buffer-vars.o): in function `rtems_trace_signatures':
/opt/rtems/5/bin/powerpc-rtems5-gcc: /home/EB/sebastian_h/git-rtems-5/c/src/../../cpukit/libmisc/capture/rtems-trace-buffer-vars.c:81:(.text.rtems_trace_signatures+0x2): relocation truncated to fit: R_PPC_SDAREL16 against symbol `__rtld_trace_signatures' defined in .rodata.__rtld_trace_signatures section in /tmp/ccu6uaaa.o

Change History (2)

comment:1 Changed on 09/20/20 at 15:16:15 by Sebastian Huber

Milestone: Indefinite6.1
Owner: changed from Needs Funding to Sebastian Huber
Status: assignedaccepted

comment:2 Changed on 09/20/20 at 15:32:28 by Sebastian Huber <sebastian.huber@…>

Resolution: fixed
Status: acceptedclosed

In 9f2a207/rtems:

capture: Move default trace data

Provide the default trace data in a separate file to avoid issues on targets
with a small-data area.

Close #3883.

Note: See TracTickets for help on using tickets.