Project

General

Profile

Actions

Bug #7463

open

ld does not fill some tables on sparc

Added by Denis Kozadaev about 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
-
Start date:
2016-10-10
Due date:
% Done:

0%

Estimated time:
Difficulty:
Medium
Tags:
needs-triage
Gerrit CR:

Description

Let take a test program from #7354 and compile it using all compiles installed in a system:

bld10% ls -l /usr/gcc
total 4
drwxr-xr-x 6 root root 6 Oct 10 10:53 4.4
drwxr-xr-x 3 root root 3 Sep  1 18:58 4.7
drwxr-xr-x 6 root root 6 Sep  1 18:05 4.8
drwxr-xr-x 6 root root 6 Oct  9 18:44 4.9
drwxr-xr-x 6 root root 6 Oct  9 18:36 5

The command lines are:
bld10% /usr/gcc/4.4/bin/g++ -m64 -o tst.44 -ggdb3 -O0 main.cpp
bld10% /usr/gcc/4.8/bin/g++ -m64 -o tst.48 -ggdb3 -O0 main.cpp
bld10% /usr/gcc/4.9/bin/g++ -m64 -o tst.49 -ggdb3 -O0 main.cpp
bld10% /usr/gcc/5/bin/g++ -m64 -o tst.5 -ggdb3 -O0 main.cpp
bld10% ls -l tst.*
-rwxr-xr-x 1 denk staff 76944 Oct 10 11:33 tst.44
-rwxr-xr-x 1 denk staff 75072 Oct 10 11:33 tst.48
-rwxr-xr-x 1 denk staff 75296 Oct 10 11:33 tst.49
-rwxr-xr-x 1 denk staff 85040 Oct 10 11:33 tst.5
bld10% file tst.*
tst.44: ELF 64-bit MSB executable, SPARC V9, total store ordering, version 1 (Solaris), dynamically linked, interpreter /usr/lib/sparcv9/ld.so.1, not stripped
tst.48: ELF 64-bit MSB executable, SPARC V9, Sun UltraSPARC1 Extensions Required, total store ordering, version 1 (Solaris), dynamically linked, interpreter /usr/lib/sparcv9/ld.so.1, not stripped
tst.49: ELF 64-bit MSB executable, SPARC V9, total store ordering, version 1 (Solaris), dynamically linked, interpreter /usr/lib/sparcv9/ld.so.1, not stripped
tst.5:  ELF 64-bit MSB executable, SPARC V9, total store ordering, version 1 (Solaris), dynamically linked, interpreter /usr/lib/sparcv9/ld.so.1, not stripped

Now let run it all under gdb:
bld10% gdb tst.44
(gdb) r
Starting program: /ws/users/denk/tests/tst.44 
[Thread debugging using libthread_db enabled]
C
[Inferior 1 (process 89574    ) exited normally]
(gdb) quit
bld10% gdb tst.48
(gdb) r
Starting program: /ws/users/denk/tests/tst.48 
warning: File "/usr/gcc/4.8/lib/sparcv9/libstdc++.so.6.0.19-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
[Thread debugging using libthread_db enabled]
C
[Inferior 1 (process 20647    ) exited normally]
(gdb) b main
Breakpoint 1 at 0x1000013f0: file main.cpp, line 7.
(gdb) r
Starting program: /ws/users/denk/tests/tst.48 
warning: File "/usr/gcc/4.8/lib/sparcv9/libstdc++.so.6.0.19-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
[Thread debugging using libthread_db enabled]
[New Thread 1 (LWP 1)]
[Switching to Thread 1 (LWP 1)]
Thread 2 hit Breakpoint 1, main () at main.cpp:7
7               const std::locale &loc = std::locale::classic();
(gdb) n
9               std::cout<<loc.name()<<std::endl;
(gdb) s
std::locale::name (this=0xfffffffe54b4a728 <(anonymous namespace)::c_locale>)
    at /ws/jenkins/ws/du/components/gcc48/build/gcc-4.8.5/libstdc++-v3/src/c++98/locale.cc:124
124         string __ret;
(gdb) n
125         if (!_M_impl->_M_names[0])
(gdb) n
123       {
(gdb) 
124         string __ret;
(gdb) 
125         if (!_M_impl->_M_names[0])
(gdb) 
124         string __ret;
(gdb) 
125         if (!_M_impl->_M_names[0])
(gdb) 
127         else if (_M_impl->_M_check_same_name())
(gdb) 
128           __ret = _M_impl->_M_names[0];
(gdb) 
144       }
(gdb) s
std::operator<< <char, std::char_traits<char>, std::allocator<char> > (__os=..., __str=...)
    at /ws/jenkins/ws/du/components/gcc48/build/64/sparcv9-sun-solaris2.11/libstdc++-v3/include/bits/basic_string.h:2758
2758          return __ostream_insert(__os, __str.data(), __str.size());
(gdb) p __os
$2 = (std::basic_ostream<char, std::char_traits<char> > &) @0x100101e10: {<std::basic_ios<char, std::char_traits<char> >> = {<std::ios_base> = {_vptr.ios_base = 0xfffffffe54b32ef0 <vtable for std::ostream+64>, static boolalpha = std::_S_boolalpha, static dec = std::_S_dec, 
**skipped**
(gdb) quit
A debugging session is active.

        Inferior 1 [process 23946    ] will be killed.

Quit anyway? (y or n) y
bld10% gdb tst.49
(gdb) r
Starting program: /ws/users/denk/tests/tst.49 
warning: File "/usr/gcc/4.9/lib/sparcv9/libstdc++.so.6.0.20-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
[Thread debugging using libthread_db enabled]
[New Thread 1 (LWP 1)]

Thread 2 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1 (LWP 1)]
0xfffffffe5d1ccca4 in std::ostream::sentry::sentry (this=this@entry=0xffffffff7ffff930, __os=...)
    at /ws/jenkins/ws/du/components/gcc-4.9/build/gcc-4.9-4.9.4-0/build/sparcv9-sun-solaris2.11/libstdc++-v3/include/bits/ostream.tcc:51
51      /ws/jenkins/ws/du/components/gcc-4.9/build/gcc-4.9-4.9.4-0/build/sparcv9-sun-solaris2.11/libstdc++-v3/include/bits/ostream.tcc: No such file or directory.
(gdb) p __os
$1 = (std::basic_ostream<char, std::char_traits<char> > &) @0x100101d50: {<std::basic_ios<char, std::char_traits<char> >> = <invalid address>, _vptr.basic_ostream = 0x0}
(gdb) quit
A debugging session is active.

        Inferior 1 [process 90017    ] will be killed.

Quit anyway? (y or n) y
bld10% gdb tst.5 
(gdb) r
Starting program: /ws/users/denk/tests/tst.5 
[Thread debugging using libthread_db enabled]
[New Thread 1 (LWP 1)]

Thread 2 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1 (LWP 1)]
0xfffffffe5dd6a18c in std::ostream::sentry::sentry (this=this@entry=0xffffffff7ffff9b0, __os=...)
    at /ws/users/denk/dilos-userland-git/components/gcc-5/build/gcc-5-5.4.1-1/build/sparcv9-sun-solaris2.11/libstdc++-v3/include/bits/ostream.tcc:51
51            if (__os.tie() && __os.good())
(gdb) p __os
$1 = (std::basic_ostream<char, std::char_traits<char> > &) @0x100101ba0: {<std::basic_ios<char, std::char_traits<char> >> = <invalid address>, _vptr.basic_ostream = 0x0}
(gdb) quit
A debugging session is active.

        Inferior 1 [process 90418    ] will be killed.

Quit anyway? (y or n) y
bld10% gdb tst.5 
(gdb) r
Starting program: /ws/users/denk/tests/tst.5 
warning: File "/usr/gcc/5/lib/sparcv9/libstdc++.so.6.0.21-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
[Thread debugging using libthread_db enabled]
[New Thread 1 (LWP 1)]

Thread 2 received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1 (LWP 1)]
0xfffffffe49c6a18c in std::ostream::sentry::sentry (this=this@entry=0xffffffff7ffff9e0, __os=...)
    at /ws/users/denk/dilos-userland-git/components/gcc-5/build/gcc-5-5.4.1-1/build/sparcv9-sun-solaris2.11/libstdc++-v3/include/bits/ostream.tcc:51
51            if (__os.tie() && __os.good())
(gdb) p __os
$1 = (std::basic_ostream<char, std::char_traits<char> > &) @0x100101ba0: {<std::basic_ios<char, std::char_traits<char> >> = <invalid address>, _vptr.basic_ostream = 0x0}

As you can see, v_ptr is NULL in the two last compilers.
Let see now at gcc 4.4 deeply:
bld10% gdb tst.44
(gdb) b main
Breakpoint 1 at 0x100001158: file main.cpp, line 7.
(gdb) r
Starting program: /ws/users/denk/tests/tst.44 
[Thread debugging using libthread_db enabled]
[New Thread 1 (LWP 1)]
[Switching to Thread 1 (LWP 1)]
Thread 2 hit Breakpoint 1, main () at main.cpp:7
7               const std::locale &loc = std::locale::classic();
(gdb) n
9               std::cout<<loc.name()<<std::endl;
(gdb) b std::ostream::sentry::sentry
Breakpoint 2 at 0xfffffffe49614fc8 (3 locations)
(gdb) c
Continuing.

Thread 2 hit Breakpoint 2, std::basic_ostream<char, std::char_traits<char> >::sentry::sentry (this=0xffffffff7ffff958, __os=...)
    at /ws/jenkins/ws/du/components/gcc44/build/32/sparc-sun-solaris2.11/sparcv9/libstdc++-v3/include/bits/ostream.tcc:48
48      /ws/jenkins/ws/du/components/gcc44/build/32/sparc-sun-solaris2.11/sparcv9/libstdc++-v3/include/bits/ostream.tcc: No such file or directory.
(gdb) p __os
$2 = (std::basic_ostream<char, std::char_traits<char> > &) @0x100101b30: {<std::basic_ios<char, std::char_traits<char> >> = {<std::ios_base> = {_vptr.ios_base = 0xfffffffe497b7ea8 <vtable for std::ostream+64>, static boolalpha = std::_S_boolalpha, static dec = std::_S_dec, 
(gdb) quit
A debugging session is active.

        Inferior 1 [process 48493    ] will be killed.

Quit anyway? (y or n) y

As you can see in this example, _vptr is filled by a basic object.

No data to display

Actions

Also available in: Atom PDF