This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Exception-Catching with gcc 4.x does not work on SunOS SPARC


El dÃa Tuesday, October 06, 2015 a las 03:47:30PM +0200, Marc Glisse escribiÃ:

> Last time I heard about similar problems on Solaris, it was because some 
> exception-related symbols appear in both libc and libgcc_s but are not 
> compatible, so it is important that libgcc_s be loaded first. IIRC a 
> libtool update made the problem much more rare.

After studying the man page of gcc we found a flag '-shared-libgcc' and
if you do not apply or apply it, it changes the order of fetching the
libc.so.1 and libgcc_s.so.1, as you can see in the output of ldd(1)
command for each case:

without -shared-libgcc:

$ /usr/local/gcc-492/bin/gcc -o work work.C -L/usr/local/gcc-492/lib -lstdc++
$ ldd work
        libstdc++.so.6 =>        /usr/local/gcc-492/lib/libstdc++.so.6
        libc.so.1 =>     /lib/libc.so.1
        libm.so.2 =>     /lib/libm.so.2
        librt.so.1 =>    /lib/librt.so.1
        libgcc_s.so.1 =>         /usr/local/gcc-492/lib/libgcc_s.so.1
        libaio.so.1 =>   /lib/libaio.so.1
        libmd.so.1 =>    /lib/libmd.so.1
        /platform/SUNW,SPARC-Enterprise/lib/libc_psr.so.1
        /lib/libm/libm_hwcap1.so.2
work:Start
terminate called after throwing an instance of 'int'
Abort - core dumped

with -shared-libgcc:

$ /usr/local/gcc-492/bin/gcc -shared-libgcc -o work work.C -L/usr/local/gcc-492/lib -lstdc++
$ sh work.sh 
        libstdc++.so.6 =>        /usr/local/gcc-492/lib/libstdc++.so.6
        libgcc_s.so.1 =>         /usr/local/gcc-492/lib/libgcc_s.so.1
        libc.so.1 =>     /lib/libc.so.1
        libm.so.2 =>     /lib/libm.so.2
        librt.so.1 =>    /lib/librt.so.1
        libaio.so.1 =>   /lib/libaio.so.1
        libmd.so.1 =>    /lib/libmd.so.1
        /platform/SUNW,SPARC-Enterprise/lib/libc_psr.so.1
        /lib/libm/libm_hwcap1.so.2
work:Start
Caught exception int: 7
work:Ende

In the second case the generated 'work' works as excepted; which matches
what Marc Glisse said above. 

There is also a related bug issue:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788

I think, we can close this thread with this.

Thanks as well for all other hints and the pointer to the FAQ how to
configure gcc. If 'configure' should not be run as './configure ...',
but from outside of the source, maybe it should deny to work as
'./configure'.

Thanks

	matthias

-- 
Matthias Apitz, â guru@unixarea.de, ð http://www.unixarea.de/  â +49-176-38902045


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]