* libstdc++ 10.2.0 issue
@ 2021-03-22 10:25 WK
2021-03-22 12:13 ` Jonathan Wakely
0 siblings, 1 reply; 4+ messages in thread
From: WK @ 2021-03-22 10:25 UTC (permalink / raw)
To: libstdc++
Hello,
I'm trying to build cross-arch and cross-OS 10.2.0 toolchain: FreeBSD8.4
for ARM. I successfully built it but I have problems with C++ programs.
Even simple hello world using cout is crashing with segmentation fault,
but when I compile C hello world with printf() everything works ok.
When I load core file to GDB it shows following:
Reading symbols from a.out...
[New LWP 100065]
Core was generated by `a.out'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 0x000559f4 in std::ostream::sentry::sentry (this=0xbfffecb8, __os=...)
at
/home/witkow/comp/arm-freebsd8-cross-toolchain/work/gcc-10.2.0/objdir/arm-unknown-freebsd8/libstdc++-v3/include/bits/ostream.tcc:51
51
(gdb) bt
#0 0x000559f4 in std::ostream::sentry::sentry (this=0xbfffecb8, __os=...)
at
/home/witkow/comp/arm-freebsd8-cross-toolchain/work/gcc-10.2.0/objdir/arm-unknown-freebsd8/libstdc++-v3/include/bits/ostream.tcc:51
#1 0x00056124 in std::__ostream_insert<char, std::char_traits<char> >
(__out=..., __s=0xbfffecfc "Hello c++ world", __n=15)
at
/home/witkow/comp/arm-freebsd8-cross-toolchain/work/gcc-10.2.0/objdir/arm-unknown-freebsd8/libstdc++-v3/include/bits/ostream_insert.h:82
#2 0x00011180 in main (argc=1, argv=0xbfffed44) at 2.cpp:14
(gdb) frame 0
#0 0x000559f4 in std::ostream::sentry::sentry (this=0xbfffecb8, __os=...)
at
/home/witkow/comp/arm-freebsd8-cross-toolchain/work/gcc-10.2.0/objdir/arm-unknown-freebsd8/libstdc++-v3/include/bits/ostream.tcc:51
51
(gdb) info args
this = 0xbfffecb8
__os = @0xde628: {<std::basic_ios<char, std::char_traits<char> >> =
<invalid address>, _vptr.basic_ostream = 0x0}
(gdb)
(gdb) disassemble
Dump of assembler code for function _ZNSo6sentryC2ERSo:
0x000559ec <+0>: ldr r3, [r1]
0x000559f0 <+4>: push {r4, r5, r6, lr}
=> 0x000559f4 <+8>: ldr r3, [r3, #-12]
0x000559f8 <+12>: mov r4, r0
0x000559fc <+16>: add r0, r1, r3
0x00055a00 <+20>: ldr r3, [r0, #112] ; 0x70
0x00055a04 <+24>: mov r2, #0
0x00055a08 <+28>: cmp r3, r2
0x00055a0c <+32>: mov r5, r1
0x00055a10 <+36>: str r1, [r4, #4]
0x00055a14 <+40>: strb r2, [r4]
0x00055a18 <+44>: ldr r1, [r0, #20]
0x00055a1c <+48>: beq 0x55a50 <_ZNSo6sentryC2ERSo+100>
0x00055a20 <+52>: cmp r1, r2
0x00055a24 <+56>: beq 0x55a38 <_ZNSo6sentryC2ERSo+76>
0x00055a28 <+60>: orr r1, r1, #4
0x00055a2c <+64>: bl 0x3cb14
<_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate>
0x00055a30 <+68>: mov r0, r4
0x00055a34 <+72>: pop {r4, r5, r6, pc}
0x00055a38 <+76>: mov r0, r3
0x00055a3c <+80>: bl 0x55324 <_ZNSo5flushEv>
0x00055a40 <+84>: ldr r3, [r5]
0x00055a44 <+88>: ldr r0, [r3, #-12]
0x00055a48 <+92>: add r0, r5, r0
0x00055a4c <+96>: ldr r1, [r0, #20]
0x00055a50 <+100>: cmp r1, #0
0x00055a54 <+104>: bne 0x55a28 <_ZNSo6sentryC2ERSo+60>
0x00055a58 <+108>: mov r3, #1
0x00055a5c <+112>: mov r0, r4
0x00055a60 <+116>: strb r3, [r4]
0x00055a64 <+120>: pop {r4, r5, r6, pc}
End of assembler dump.
(gdb) info registers
r0 0xbfffecb8 3221220536
r1 0xde628 910888
r2 0xf 15
r3 0x0 0
r4 0xde628 910888
r5 0x0 0
r6 0xf 15
r7 0x0 0
r8 0xbfffecfc 3221220604
r9 0x0 0
r10 0xbfffecb8 3221220536
r11 0xbfffed14 3221220628
r12 0x64 100
sp 0xbfffeca0 0xbfffeca0
lr 0x56124 352548
pc 0x559f4 0x559f4
<std::ostream::sentry::sentry(std::ostream&)+8>
cpsr 0x20000010 536870928
and seems like the problem occurs in 0x000559f4 address because there is
null-pointer dereference because R3 register is 0.
I'm wondering how can I investigate and fix the problem? Any ideas what
could I do to fix it?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libstdc++ 10.2.0 issue
2021-03-22 10:25 libstdc++ 10.2.0 issue WK
@ 2021-03-22 12:13 ` Jonathan Wakely
2021-03-22 14:33 ` sdrb
0 siblings, 1 reply; 4+ messages in thread
From: Jonathan Wakely @ 2021-03-22 12:13 UTC (permalink / raw)
To: WK; +Cc: libstdc++
On Mon, 22 Mar 2021 at 10:27, WK via Libstdc++ <libstdc++@gcc.gnu.org> wrote:
>
> Hello,
>
> I'm trying to build cross-arch and cross-OS 10.2.0 toolchain: FreeBSD8.4
> for ARM. I successfully built it but I have problems with C++ programs.
>
> Even simple hello world using cout is crashing with segmentation fault,
> but when I compile C hello world with printf() everything works ok.
>
> When I load core file to GDB it shows following:
>
> Reading symbols from a.out...
> [New LWP 100065]
> Core was generated by `a.out'.
> Program terminated with signal SIGSEGV, Segmentation fault.
> #0 0x000559f4 in std::ostream::sentry::sentry (this=0xbfffecb8, __os=...)
> at
> /home/witkow/comp/arm-freebsd8-cross-toolchain/work/gcc-10.2.0/objdir/arm-unknown-freebsd8/libstdc++-v3/include/bits/ostream.tcc:51
> 51
> (gdb) bt
> #0 0x000559f4 in std::ostream::sentry::sentry (this=0xbfffecb8, __os=...)
> at
> /home/witkow/comp/arm-freebsd8-cross-toolchain/work/gcc-10.2.0/objdir/arm-unknown-freebsd8/libstdc++-v3/include/bits/ostream.tcc:51
> #1 0x00056124 in std::__ostream_insert<char, std::char_traits<char> >
> (__out=..., __s=0xbfffecfc "Hello c++ world", __n=15)
> at
> /home/witkow/comp/arm-freebsd8-cross-toolchain/work/gcc-10.2.0/objdir/arm-unknown-freebsd8/libstdc++-v3/include/bits/ostream_insert.h:82
> #2 0x00011180 in main (argc=1, argv=0xbfffed44) at 2.cpp:14
>
>
>
>
> (gdb) frame 0
> #0 0x000559f4 in std::ostream::sentry::sentry (this=0xbfffecb8, __os=...)
> at
> /home/witkow/comp/arm-freebsd8-cross-toolchain/work/gcc-10.2.0/objdir/arm-unknown-freebsd8/libstdc++-v3/include/bits/ostream.tcc:51
> 51
> (gdb) info args
> this = 0xbfffecb8
> __os = @0xde628: {<std::basic_ios<char, std::char_traits<char> >> =
> <invalid address>, _vptr.basic_ostream = 0x0}
> (gdb)
>
>
>
>
> (gdb) disassemble
> Dump of assembler code for function _ZNSo6sentryC2ERSo:
> 0x000559ec <+0>: ldr r3, [r1]
> 0x000559f0 <+4>: push {r4, r5, r6, lr}
> => 0x000559f4 <+8>: ldr r3, [r3, #-12]
> 0x000559f8 <+12>: mov r4, r0
> 0x000559fc <+16>: add r0, r1, r3
> 0x00055a00 <+20>: ldr r3, [r0, #112] ; 0x70
> 0x00055a04 <+24>: mov r2, #0
> 0x00055a08 <+28>: cmp r3, r2
> 0x00055a0c <+32>: mov r5, r1
> 0x00055a10 <+36>: str r1, [r4, #4]
> 0x00055a14 <+40>: strb r2, [r4]
> 0x00055a18 <+44>: ldr r1, [r0, #20]
> 0x00055a1c <+48>: beq 0x55a50 <_ZNSo6sentryC2ERSo+100>
> 0x00055a20 <+52>: cmp r1, r2
> 0x00055a24 <+56>: beq 0x55a38 <_ZNSo6sentryC2ERSo+76>
> 0x00055a28 <+60>: orr r1, r1, #4
> 0x00055a2c <+64>: bl 0x3cb14
> <_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate>
> 0x00055a30 <+68>: mov r0, r4
> 0x00055a34 <+72>: pop {r4, r5, r6, pc}
> 0x00055a38 <+76>: mov r0, r3
> 0x00055a3c <+80>: bl 0x55324 <_ZNSo5flushEv>
> 0x00055a40 <+84>: ldr r3, [r5]
> 0x00055a44 <+88>: ldr r0, [r3, #-12]
> 0x00055a48 <+92>: add r0, r5, r0
> 0x00055a4c <+96>: ldr r1, [r0, #20]
> 0x00055a50 <+100>: cmp r1, #0
> 0x00055a54 <+104>: bne 0x55a28 <_ZNSo6sentryC2ERSo+60>
> 0x00055a58 <+108>: mov r3, #1
> 0x00055a5c <+112>: mov r0, r4
> 0x00055a60 <+116>: strb r3, [r4]
> 0x00055a64 <+120>: pop {r4, r5, r6, pc}
> End of assembler dump.
>
>
>
>
> (gdb) info registers
> r0 0xbfffecb8 3221220536
> r1 0xde628 910888
> r2 0xf 15
> r3 0x0 0
> r4 0xde628 910888
> r5 0x0 0
> r6 0xf 15
> r7 0x0 0
> r8 0xbfffecfc 3221220604
> r9 0x0 0
> r10 0xbfffecb8 3221220536
> r11 0xbfffed14 3221220628
> r12 0x64 100
> sp 0xbfffeca0 0xbfffeca0
> lr 0x56124 352548
> pc 0x559f4 0x559f4
> <std::ostream::sentry::sentry(std::ostream&)+8>
> cpsr 0x20000010 536870928
>
>
>
> and seems like the problem occurs in 0x000559f4 address because there is
> null-pointer dereference because R3 register is 0.
>
> I'm wondering how can I investigate and fix the problem? Any ideas what
> could I do to fix it?
It looks like the global constructors that initialize the cout, cin,
etc streams haven't run.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libstdc++ 10.2.0 issue
2021-03-22 12:13 ` Jonathan Wakely
@ 2021-03-22 14:33 ` sdrb
2021-03-24 17:35 ` Jonathan Wakely
0 siblings, 1 reply; 4+ messages in thread
From: sdrb @ 2021-03-22 14:33 UTC (permalink / raw)
To: Jonathan Wakely; +Cc: libstdc++
On 22.03.2021 13:13, Jonathan Wakely wrote:
> On Mon, 22 Mar 2021 at 10:27, WK via Libstdc++ <libstdc++@gcc.gnu.org> wrote:
>>
>> Hello,
>>
>> I'm trying to build cross-arch and cross-OS 10.2.0 toolchain: FreeBSD8.4
>> for ARM. I successfully built it but I have problems with C++ programs.
>>
>> Even simple hello world using cout is crashing with segmentation fault,
>> but when I compile C hello world with printf() everything works ok.
>>
>> When I load core file to GDB it shows following:
>>
>> Reading symbols from a.out...
>> [New LWP 100065]
>> Core was generated by `a.out'.
>> Program terminated with signal SIGSEGV, Segmentation fault.
>> #0 0x000559f4 in std::ostream::sentry::sentry (this=0xbfffecb8, __os=...)
>> at
>> /home/witkow/comp/arm-freebsd8-cross-toolchain/work/gcc-10.2.0/objdir/arm-unknown-freebsd8/libstdc++-v3/include/bits/ostream.tcc:51
>> 51
>> (gdb) bt
>> #0 0x000559f4 in std::ostream::sentry::sentry (this=0xbfffecb8, __os=...)
>> at
>> /home/witkow/comp/arm-freebsd8-cross-toolchain/work/gcc-10.2.0/objdir/arm-unknown-freebsd8/libstdc++-v3/include/bits/ostream.tcc:51
>> #1 0x00056124 in std::__ostream_insert<char, std::char_traits<char> >
>> (__out=..., __s=0xbfffecfc "Hello c++ world", __n=15)
>> at
>> /home/witkow/comp/arm-freebsd8-cross-toolchain/work/gcc-10.2.0/objdir/arm-unknown-freebsd8/libstdc++-v3/include/bits/ostream_insert.h:82
>> #2 0x00011180 in main (argc=1, argv=0xbfffed44) at 2.cpp:14
>>
>>
>>
>>
>> (gdb) frame 0
>> #0 0x000559f4 in std::ostream::sentry::sentry (this=0xbfffecb8, __os=...)
>> at
>> /home/witkow/comp/arm-freebsd8-cross-toolchain/work/gcc-10.2.0/objdir/arm-unknown-freebsd8/libstdc++-v3/include/bits/ostream.tcc:51
>> 51
>> (gdb) info args
>> this = 0xbfffecb8
>> __os = @0xde628: {<std::basic_ios<char, std::char_traits<char> >> =
>> <invalid address>, _vptr.basic_ostream = 0x0}
>> (gdb)
>>
>>
>>
>>
>> (gdb) disassemble
>> Dump of assembler code for function _ZNSo6sentryC2ERSo:
>> 0x000559ec <+0>: ldr r3, [r1]
>> 0x000559f0 <+4>: push {r4, r5, r6, lr}
>> => 0x000559f4 <+8>: ldr r3, [r3, #-12]
>> 0x000559f8 <+12>: mov r4, r0
>> 0x000559fc <+16>: add r0, r1, r3
>> 0x00055a00 <+20>: ldr r3, [r0, #112] ; 0x70
>> 0x00055a04 <+24>: mov r2, #0
>> 0x00055a08 <+28>: cmp r3, r2
>> 0x00055a0c <+32>: mov r5, r1
>> 0x00055a10 <+36>: str r1, [r4, #4]
>> 0x00055a14 <+40>: strb r2, [r4]
>> 0x00055a18 <+44>: ldr r1, [r0, #20]
>> 0x00055a1c <+48>: beq 0x55a50 <_ZNSo6sentryC2ERSo+100>
>> 0x00055a20 <+52>: cmp r1, r2
>> 0x00055a24 <+56>: beq 0x55a38 <_ZNSo6sentryC2ERSo+76>
>> 0x00055a28 <+60>: orr r1, r1, #4
>> 0x00055a2c <+64>: bl 0x3cb14
>> <_ZNSt9basic_iosIcSt11char_traitsIcEE5clearESt12_Ios_Iostate>
>> 0x00055a30 <+68>: mov r0, r4
>> 0x00055a34 <+72>: pop {r4, r5, r6, pc}
>> 0x00055a38 <+76>: mov r0, r3
>> 0x00055a3c <+80>: bl 0x55324 <_ZNSo5flushEv>
>> 0x00055a40 <+84>: ldr r3, [r5]
>> 0x00055a44 <+88>: ldr r0, [r3, #-12]
>> 0x00055a48 <+92>: add r0, r5, r0
>> 0x00055a4c <+96>: ldr r1, [r0, #20]
>> 0x00055a50 <+100>: cmp r1, #0
>> 0x00055a54 <+104>: bne 0x55a28 <_ZNSo6sentryC2ERSo+60>
>> 0x00055a58 <+108>: mov r3, #1
>> 0x00055a5c <+112>: mov r0, r4
>> 0x00055a60 <+116>: strb r3, [r4]
>> 0x00055a64 <+120>: pop {r4, r5, r6, pc}
>> End of assembler dump.
>>
>>
>>
>>
>> (gdb) info registers
>> r0 0xbfffecb8 3221220536
>> r1 0xde628 910888
>> r2 0xf 15
>> r3 0x0 0
>> r4 0xde628 910888
>> r5 0x0 0
>> r6 0xf 15
>> r7 0x0 0
>> r8 0xbfffecfc 3221220604
>> r9 0x0 0
>> r10 0xbfffecb8 3221220536
>> r11 0xbfffed14 3221220628
>> r12 0x64 100
>> sp 0xbfffeca0 0xbfffeca0
>> lr 0x56124 352548
>> pc 0x559f4 0x559f4
>> <std::ostream::sentry::sentry(std::ostream&)+8>
>> cpsr 0x20000010 536870928
>>
>>
>>
>> and seems like the problem occurs in 0x000559f4 address because there is
>> null-pointer dereference because R3 register is 0.
>>
>> I'm wondering how can I investigate and fix the problem? Any ideas what
>> could I do to fix it?
>
> It looks like the global constructors that initialize the cout, cin,
> etc streams haven't run.
>
Ok, so what can I do with this issue? Are there any fixes for it?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: libstdc++ 10.2.0 issue
2021-03-22 14:33 ` sdrb
@ 2021-03-24 17:35 ` Jonathan Wakely
0 siblings, 0 replies; 4+ messages in thread
From: Jonathan Wakely @ 2021-03-24 17:35 UTC (permalink / raw)
To: sdrb; +Cc: Jonathan Wakely, libstdc++
On 22/03/21 15:33 +0100, sdrb via Libstdc++ wrote:
>Ok, so what can I do with this issue? Are there any fixes for it?
First you'd have to figure out why they haven't run. I don't know how
to fix it because it doesn't happen for me.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-03-24 17:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-22 10:25 libstdc++ 10.2.0 issue WK
2021-03-22 12:13 ` Jonathan Wakely
2021-03-22 14:33 ` sdrb
2021-03-24 17:35 ` Jonathan Wakely
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).