Hi,
I am working with gcc 4.4.2.
I installed the same on my machine using the following command lines.
1)To extract in a new directory,i used,
mkdir gcc1
cd gcc1
tar -xvf gcc-4.4.2.tar.gz
set srcdir = "/home/swati/gcc1/gcc-4.4.2"
set objdir = "/home/swati/gcc1/gcc-bin"
set insdir = "/home/swati/gcc1//usr/local"
mkdir -p srcdir
mkdir -p objdir
mkdir -p insdir
2)Then i configured it in objdir directory using,
/home/swati/gcc1/gcc-4.4.2/configure --prefix=$insdir
make bootstrap -j3
make install (in root)
3)Then compiled using,
export PATH=$insdir/bin/:$PATH
gcc helloworld.c -v
and finally compiled a helloworld.c file using this version and it worked fine.
Now, i wish to modify the source code of gcc.
So am working on the c-parser.c file to introduce an exception
generation on detection of 'if' statement.
For it ,i used folowing code
static jmp_buf buf;
void exception_handler()
{
FILE *fp1;
fp1=fopen("/home/swati/t.txt","w");
fprintf(fp1,"'if' detected\n");
longjmp(buf,1);
}
static void
c_parser_if_statement (c_parser *parser)
{
FILE *fp;
if (!setjmp(buf) )
{
exception_handler();
}
else
{
fp=fopen("/home/swati/t.txt","a");
fprintf(fp,"\t\t\t\tBack to if block");
}
}
Now , i recompiled the gcc using following commands,
1)Changed to path to build directory,
cd /home/swati/newgcc/objdir/build-i686-pc-linux-gnu/gcc/build/
2) Configured with --disable-bootstrap modification.
/home/swati/newgcc/gcc-4.4.2/configure --disable-bootstrap--prefix=$insdir
make all-gcc
3)Selected newly configured gcc and tried to compile helloworld.c file.
export
PATH=$insdir/bin/:$PATH
gcc helloworld.c -v
However, the changes (t.txt creation and statements insertion within it) were
not reflected and i got an error:
"source is more recent than the executable"
Am i working with the correct file and were the installation and compilation
steps correct. Also was i correct in attempt to modify the source code
Please help.
Swati
Get your preferred Email name!
Now you can @ymail.com and @rocketmail.com.
http://mail.promotions.yahoo.com/newdomains/aa/