#2802 closed defect (fixed)

Test "libdl (RTL) 5" fails on SPARC targets

Reported by: Sebastian Huber Owned by: Chris Johns
Priority: normal Milestone: 5.1
Component: lib/dl Version: 5
Severity: normal Keywords:
Cc: Blocked By:


On GR740 I get:

rtl: RELOC_32 0x60ae8 @ 0x86edc in /dl-o5.o
rtl: relocation: .rela.eh_frame, syms:.symtab
rtl: rela: sym:__gxx_personality_v0(20)=00001dec type:3  off:00000013 addend:0

CPU 0:  IU in error mode (tt = 0x07, mem address not aligned)
        0x0001fa9c: c4040000  ld  [%l0], %g2  <rtems_rtl_elf_relocate_rela+204>
CPU 1:  Power down mode
CPU 2:  Power down mode
CPU 3:  Power down mode

On GR712RC I get:

rtl: WDISP_30 0x7ffe2ccd @ 0x40087108 in /dl-o5.o
rtl: relocation: .rela.gcc_except_table.exception_dl, syms:.symtab
rtl: rela: sym:_ZTISt9exception(32)=40060ae8 type:3  off:00000034 addend:0
rtl: RELOC_32 0x40060ae8 @ 0x400871b4 in /dl-o5.o
rtl: relocation: .rela.eh_frame, syms:.symtab
rtl: rela: sym:__gxx_personality_v0(20)=40001dec type:3  off:00000013 addend:0

Target resets now.

Attachments (1)

libdl-sparc-R_SPARC_32-missaligned.patch (1.2 KB) - added by Chris Johns on 11/11/16 at 06:09:35.
Miss-aligned R_SPARC_32 offset work around.

Download all attachments as: .zip

Change History (12)

comment:1 Changed on 11/10/16 at 05:39:59 by Chris Johns

This is due to the following relocation record:

Relocation section '.rela.eh_frame' at offset 0x5fe8 contains 3 entries:
 Offset     Info    Type            Sym.Value  Sym. Name + Addend
00000013  00001403 R_SPARC_32        00000000   __gxx_personality_v0 + 0

The type is R_SPARC_32 is declared as being aligned however the offset is 0x13 and this causes a misaligned access.

Last edited on 11/10/16 at 05:40:35 by Chris Johns (previous) (diff)

comment:2 Changed on 11/10/16 at 07:32:09 by Sebastian Huber

Is this a bug in the tool chain or the libdl?

comment:3 Changed on 11/10/16 at 07:46:01 by Chris Johns

I am investigating. At this stage it looks like a bug in gas. Binutils contain code that checks the lower bits of the address and selects either R_SPARC_32 or UA32. I am looking to make a suitable test case so I can see what is happening.

Changed on 11/11/16 at 06:09:35 by Chris Johns

Miss-aligned R_SPARC_32 offset work around.

comment:5 Changed on 11/11/16 at 06:10:48 by Chris Johns

I have attached a work-around which allows dl05 to run and fail in the expected manner.

We can review the status of this patch once we get some feedback from the binutil's community.

comment:6 Changed on 11/14/16 at 14:24:08 by Jiri Gaisler <jiri@…>

In 316da9356ad7b612f6df6ed1e47b62268450438e/rtems:

rtl-mdreloc-sparc.c: Do not print unaligned pointer and cause unaligned access.

updates #2802.

comment:7 Changed on 11/22/16 at 06:41:39 by Sebastian Huber

Now the test terminates with

rtl: UA_32 0x8c6d8 @ 0x8c755 in /dl-o5.o
rtl: alloc: del: SYMBOL addr=0x8c780
rtl: alloc: new: OBJECT addr=0x8c7e8 size=132
rtl: linkmap_add
rtl: unresolv: global resolve

exception_base called
exception_dl: throwing
terminate called after throwing an instance of 'std::runtime_error'
  what():  exception_dl throw

comment:8 Changed on 11/22/16 at 21:26:11 by Chris Johns

This error is the expected result of the test. It does not pass. See #2767 for the original issue that raised the problem.

Last edited on 11/22/16 at 21:26:59 by Chris Johns (previous) (diff)

comment:9 Changed on 11/23/16 at 06:04:02 by Sebastian Huber

Resolution: fixed
Status: newclosed

comment:10 Changed on 05/11/17 at 07:31:02 by Sebastian Huber


comment:11 Changed on 11/09/17 at 06:27:14 by Sebastian Huber


Milestone renamed

Note: See TracTickets for help on using tickets.