Skip to contentSkip to conversation

libstdc++ bus errors

DISCUSSION Sean Callanan 3 participants 5 messages Nov 13, 2001 – Nov 14, 2001

lore
Share & tools
lore
#0 lore raw

(Sorry if you've already seen this; I'm having SMTP server problems)

Dear mailing list:

I am currently rebuilding my system from scratch (using the instructions at www.linuxfromscratch.org) with GCC 3.0.2 and glibc 2.2.4.
I have simply compiled GCC 3.0.2 for sparc-linux (32-bit) with dynamic linking against the new libc. However, even a test program:
--
#include <iostream.h>

void main()

{
	cout << "Hello C++!\n";
	exit(0);
}

--
has a bus error. Are there known issues with sparc and libstdc++ 3.0.2? (Incidentally, I try to run the library itself, and get a segmentation fault, but I suspect that isn't such a big issue since the c++ library on my original SuSE install does the exact same thing.

Incidentally, I have the C++ library for 32-bit in /usr/lib, and the C++ library for 64-bit in /usr/lib64. There should be no issues with libs conflicting.

Sincerely,
Sean Callanan

#1 lore raw
Quoted 12 lines · Sean Callanan

I am currently rebuilding my system from scratch (using the instructions at www.linuxfromscratch.org) with GCC 3.0.2 and glibc 2.2.4.
I have simply compiled GCC 3.0.2 for sparc-linux (32-bit) with dynamic linking against the new libc. However, even a test program:
--
#include <iostream.h>

void main()

{
	cout << "Hello C++!\n";
	exit(0);
}
Quoted 5 lines

--
has a bus error. Are there known issues with sparc and libstdc++ 3.0.2? (Incidentally, I try to run the library itself, and get a segmentation fault, but I suspect that isn't such a big issue since the c++ library on my original SuSE install does the exact same thing.

I've seen this too, using slackware-current on sparc. The cause is
twofold: GNU ld incorrectly generates a R_SPARC_32 reloc for an unaligned word, which ld.so cannot fix because unaligned stores cause a trap on sparc.

Upgrading binutils to 2.11.2 doesn't solve the problem, because ld.so doesn't understand R_SPARC_UA32 relocations:

./a.out: error while loading shared libraries: /home/jsturm/junk.so:
unexpected reloc type 0x17

Before I tackle it, anyone know if there is a fixed libc for sparc-linux?

(Meanwhile, configuring gcc with --enable-sjlj-exceptions might be an effective workaround.)

Jeff

#2 lore raw
In reply to Sean Callanan

From: Jeff Sturm <[email protected]>
Date: Tue, 13 Nov 2001 01:29:09 -0500 (EST)

Upgrading binutils to 2.11.2 doesn't solve the problem, because ld.so doesn't understand R_SPARC_UA32 relocations:

./a.out: error while loading shared libraries: /home/jsturm/junk.so:
unexpected reloc type 0x17

Upgrade glibc, then binutils :-) Current glibc understands the UA32 relocs properly.

Franks a lot,
David S. Miller
[email protected]

#4 lore raw
In reply to Sean Callanan
Quoted 4 lines
Quoted 2 lines

Upgrading binutils to 2.11.2 doesn't solve the problem, because ld.so doesn't understand R_SPARC_UA32 relocations...

Upgrade glibc, then binutils :-) Current glibc understands the UA32 relocs properly.

I don't think this is the sole cause of the problem. I have glibc 2.2.4, which (according to my hand-checking) includes the fix for R_SPARC_UA32 mentioned in an earlier message:

Quoted 2 lines

Ah yes, I found the requisite patch... thanks.
http://sources.redhat.com/ml/libc-alpha/2001-07/msg00021.html

...but still C++ programs have bus errors.

Perhaps a related issue could be that I overrode the default behavior of the 32->64 cross compiler to copy all the system headers into $PREFIX/sparc64-linux/sys-includes
and instead symlinked that directory to
$PREFIX/include
I don't know what else the problem might be. Must I upgrade to a CVS version of binutils? (I have 2.11)

Would it help if I build gdb and tried to figure out the source of the error more precisely, or is this well-known?

Sincerely,
Sean Callanan