Article View: aus.computers.linux
Article #59352Re: More GCC trouble..
From: David Khoury
Date: Wed, 31 Jan 1996 00:00
Date: Wed, 31 Jan 1996 00:00
105 lines
4409 bytes
4409 bytes
Bill LaGrue wrote:
>
> Hi,
> I got the problem in my previous message worked out, (wrong version of
> binutils), but no xmkmf doesnt work. It aborts with "Cant find file
> /lib/cpp". I am also still having other trouble with GCC, it almost
> completely compiles a kernaql, then stops with screens full of
> "undefined reference to blahblah". Anyone got any ideas?
> I noticed in a previous post that you went through the process of upgrading
your GCC version. The /lib/cpp file is usually a symbolic link to /usr/lib/gcc-
lib/i486-linux/{gcc-version}/cpp. Since you upgraded your gcc, this link is now
pointing to the wrong version, or to nothing at all if you've deleted the
previous verson (and the error message indicates that). Fix is pretty obvious
.. redefine the link!!
Oh, if you want to compile the 1.2.x series kernels, you may need to force gcc
to compile it as aout. Have a look at the patches section in the ELF-HOWTO ..
it'll explain how to do it.
If you're compiling with gcc 2.7.2, you also need to be aware of a bug in the
optimisation routines enabled by the -O2 flag. I'll include a program below
that tests your version of gcc to see if it has this bug...
--------------------------------------#------------------------------------
David Khoury | "Where's the KABOOM ??
Technical Manager & User Support | There was supposed to be an
dave@flex.com.au | earth shattering KABOOM!!"
http://www.flex.com.au/~dave | Marvin Martin
--------------------------------------#------------------------------------
----------------------------------------------------------------------------
/* sr_bug.c
*
* This program tests for a gcc bug.
* To compile this test program: gcc -O2 sr_bug.c
*
* Sometimes gcc for Intel CPUs generates bad code at optimization
* level 2. The bad code is 'almost right' and stay hidden inside
* a program that seems to work - including the Linux kernel.
* The bug is very old and has been reported. As of 19-Dec-95,
* the bug has not been fixed.
*
* If you change this code you should test it, because even a
* tiny change will hide this elusive bug. If you think you
* fixed the bug, please run the original test just to make
* sure. You can find the original test below, after the #if 0.
* I wrote this version of the test to be user-friendly, and
* it may not be as solid as the original.
*
* Some people who know more than I do:
* davis@space.mit.edu (John E. Davis)
* anlauf@crunch.ikp.physik.th-darmstadt.de (Harald Anlauf)
* craigs@iii2.iii.net (Craig Shrimpton)
*
* User-friendly version by Albert Cahalan
*
*/
#include <stdio.h>
int gcc_sr_bug(void){
static int Array[3]; /* must be static (or global) */
unsigned int B = 3; /* must be unsigned 32-bit */
int i;
for(i=0; i<B; i++) Array[i] = i - 3;
for(i=0; i<B; i++) printf(" %d,%d", i, Array[i]);
return !Array[1];
}
int main(){
printf("Testing for gcc bug...");
if(gcc_sr_bug()){
printf("\n\nBad code! Your compiler generates bad output.\n\n");
printf("Add -fno-strength-reduce to your gcc command line\n");
printf("or put it into your gcc config file, such as in\n");
printf("/usr/lib/gcc-lib/i486-linux/2.7.0/specs.\n");
exit(1);
}else{
printf("\nOK, no problem.\n");
exit(0);
}
}
#if 0
/********* original code + whitespace ***********/
#include <stdio.h>
int A[3];
unsigned int B = 3;
void printit(void){
int i;
for(i = 0; i < B; i++) fprintf(stdout, "A[%d] = %d\n", i, A[i]);
}
int main(){
int i;
for(i = 0; i < B; i++) A[i] = i - 3;
printit();
return 0;
}
#endif
----------------------------------------------------------------------------
Technical Details
Message-ID:
<310EB9CB.3B92@flex.com.au>Path:
arc1-ca.pugleaf.net!unknown!not-for-mailReferences:
<4ei89r$qm7@news.mel.aone.net.au>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 102983,6f91b91757d8e6b7 X-Google-Attributes: gid102983,public From: David Khoury <dave@flex.com.au> Subject: Re: More GCC trouble.. Date: 1996/01/31 Message-ID: <310EB9CB.3B92@flex.com.au> X-Deja-AN: 137467290 references: <4ei89r$qm7@news.mel.aone.net.au> to: Bill LaGrue <locutus@m150.aone.net.au> content-type: text/plain; charset=us-ascii organization: Flex Information Technology mime-version: 1.0 newsgroups: aus.computers.linux x-mailer: Mozilla 2.0b6a (WinNT; I)