vtbl pointer wrong on lm32 target

Daniel Anselmi danselmi@gmx.ch
Mon Sep 7 07:44:46 GMT 2020

Hello everyone,
I'am using binutils 2.35.0 and gcc 10.2.0 for the lm32 target.

The vtable pointers are pointing to the wrong location. It points two words before the vtable in the data section. gdb 9.2:
(gdb) info vtbl d1
vtable for 'D1' @ 0xfec (subobject @ 0x10f4):
[0]: 0x0 <_reset_handler>
(gdb) info symbol *0xfec
_reset_handler in section .boot
(gdb) info symbol *0xff0
typeinfo for D1 in section .rodata
(gdb) info symbol *0xff4
D1::doIt() in section .text
If LTO is enabled dring compiling and linking, the generated code and data is ok:
(gdb) info vtbl d1
vtable for 'D1' @ 0x5b8 (subobject @ 0x5fc):
[0]: 0x270 <D1::doIt()>
I have no idea what I am doing wrong. I believe it is a bug in the toolchain, either in g++ or ld but I am not sure.
What can i do/check?
Any ideas?
Any help is welcome.
Regards danselmi

More information about the Gcc-help mailing list