Help configuring g++ 3.3.6 for Sunos 4.1.4
Tue Jun 27 22:38:00 GMT 2006
Peter Dufault wrote:
> How are symbols that are needed and built into libiberty.a supposed to
> be resolved by collect2? Are they supposed to somehow wind up in
> "-lgcc"? I'd like a little help configuring this.
> I want a cross environment for Sunos4.1.4 for use while moving things
> to a Linux system (don't ask, just believe me). Using gcc3.3.6 and
> binutils 2.10.1 (the last versions that support this antique without
> too many problems) I've built a cross C that works fine and I've ALMOST
> built a cross g++.
> However, there are functions that aren't provided by the native C
> library needed by libstdc++.a.
> The configuration process detects these and places them in
> "libiberty.a". For example, "strtoul" winds up there.
> But g++ executables aren't linked to libiberty.a by default. This
> isn't too bad for things that don't have constructors-destructors and I
> just add "-liberty" to the link line, but for those with them the only
> way I can get things to work is editing the "g++ -v" command line and
> adding -liberty in a convenient place. For example, for a simple "cout
> << "Hello world" foo.o, I can do this:
> /home/dufault/opt/try2/lib/gcc-lib/sparc-sun-sunos4.1.4/3.3.6/ collect2
> -e start -dc -dp -o foo /home/dufault/opt/try2/lib/gcc-lib/
> sparc-sun-sunos4.1.4/3.3.6/../../../../sparc-sun-sunos4.1.4/lib/ crt0.o
> -L/home/dufault/opt/try2/lib/gcc-lib/sparc-sun- sunos4.1.4/3.3.6
> sunos4.1.4/3.3.6/../../../../sparc-sun-sunos4.1.4/lib foo.o -lstdc++ -
> lm -lgcc -lc -lgcc -liberty -lc
> Using this hack I can build executables and copy them over to the Sun
> and run them. Static and dynamic executables, static constructors, etc.
> all seem to work.
> But I can't for the life of me figure out how to do it without this
> step, and I'd like "sparc-sun-sunos4.1.4-g++ foo.cc" to create a
> working a.out.
> Can someone help? Here's my config line, I know "-fno-implicit-
> templates" isn't needed but it is there right now.
> --disable-threads --enable-obsolete
Edit the g++ linking spec string. You can test it by doing g++
-dumpspecs, and then editing the file to add -liberty after -lstdc++,
then load it back with g++ -specs=<file>.
Once you have it working, edit the GCC source to add this to the default
specs for your target, and rebuild everything.
It is left as an exercise to the reader to figure out which file to
change, but probably adding something like:
#define LIBSTDCXX "-lstdc++ -liberty"
to some file in gcc/config/sparc. Perhaps sunos4.h
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc