Compiler Validation Test Tool

Thomas Ronayne <trona@ameritech.net>
31 Jan 2004 00:52:59 -0500

          From comp.compilers

Related articles
Compiler Validation Test Tool trona@ameritech.net (Thomas Ronayne) (2004-01-31)
Re: Compiler Validation Test Tool ppluzhnikov@charter.net (Paul Pluzhnikov) (2004-02-01)
Re: Compiler Validation Test Tool dietz@dls.net (Paul F. Dietz) (2004-02-01)
| List of all articles for this month |
From: Thomas Ronayne <trona@ameritech.net>
Newsgroups: comp.compilers
Date: 31 Jan 2004 00:52:59 -0500
Organization: Compilers Central
References: <200401231020.i0NAK52P028735@mx1-clevoh.clevoh.ameritech.net >
Keywords: testing, C
Posted-Date: 31 Jan 2004 00:52:59 EST

After doing an OS upgrade (from Solaris 7 -> Solaris 8), it appears
that some code that used to compile ok, no longer compiles correctly.
Sometimes, the code compiles but core dumps when it is executed. Is
there a tool out there that automates checking the compilers and its
libraries to make sure they are working correctly (something like the
configure scripts)? If this isn't the correct forum for this question,
which should I ask? Any advice would be greatly appreciated.


Thanks,
Q


Going from Solaris 7 to Solaris 8 is essentially going from a 32-bit
to a 64-bit system, and you probably need to recompile not only your
applications but also any "local" libraries you have. You didn't
mention what compiler you're using, but if you're using Sun C, try
recompiling with


CFLAGS = -xarch=native64 -xO3 -xautopar -xbuiltin=%all


(you can leave off the -xbuiltin argument if you want). You'll find
out real quick if you've got some library that's not 64-bit because
the linker will yammer at you about "wrong ELF class." You can also
use the "file" command; e.g. if "hello world" is compiled with


cc -o hello hello.c


(without the -xarch=native64 argument) file hello will produce


hello: ELF 32-bit MSB executable SPARC Version 1, dynamically linked, not stripped


That ain't good -- if you try to link a file compiled in this way with a mix of libraries, you'll get


ld: warning: file whatever.o: wrong ELF class: ELFCLASS64


If you're using GCC, you do not want to link objects compiled with Sun
C (generally) and vice versa.You need to use one or the other but not
mix both (generally) -- when GCC is installed it builds its own set of
system libraries and they don't mix well with Sun's.


Note that you can run 32-bit executables from Solaris 7 in Solaris 8,
however, when dynamic libraries are loaded you may have the problem
you describe and you're better off recompiling everything from scratch
and dealing with any errors that are reported (been there, did that,
got the T-shirt and everything) -- your own stuff, not the system
libraries.


After all that, if you've got SUNWspro, there is always lint. Try


lint -Ncheck -Nlevel=4 -m -u -x file.c


and see what it tells you (and correct what it yammers about).


Good luck,


Thomas



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.