top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration Why to Join

Facebook Login
Site Registration

How to access both the source and target programs in gcc at the same time

+1 vote

I need to access in-memory representation of both the source program(the program before compilation) and target program(the program after compilation) at the same time. If I add a plugin between two passes,say p1 and p2, I will be able to access the program produced by only p1 but I would neither be able to access the program which was before executing p1 nor the program after p2. I want to compare the programs before and after compilation. How to do that?

posted Jul 9, 2013 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button

Similar Questions
0 votes

I have ported the GCC (v4.5.3) to a new target (32-bit RISC processor). So far everything went fine. I wrote my own little C-Lib with basic input output and tested it worked. Until today I never actually tried optimization passes (maybe that was the mistake that lead to this)
During porting and building Newlib I ran into an error that I tracked down to the following code:

unsigned char hexdig[256];

static void htinit ( unsigned char *h , unsigned char *s , int inc)
 int i, j;
 for(i = 0; (j = s[i]) !=0; i++)
 h[j] = i + inc;

hexdig_init ()
 htinit(hexdig, (unsigned char *) "0123456789", 0x10);
 htinit(hexdig, (unsigned char *) "abcdef", 0x10 + 10);
 htinit(hexdig, (unsigned char *) "ABCDEF", 0x10 + 10);

Compiling this code without optimization works like a charm, however compiling it with -O2 leads to the following error:
test1.c: In function 'hexdig_init':
test1.c:11:1: internal compiler error: in gen_lowpart_general, at rtlhooks.c:59

Tried with:
eco32-gcc -O2 -S test1.c

My question in short is:
Could this be a targe- backend-error or just some configuration I have missed while building GCC?
Any pointers into the right direction are welcome.

0 votes

We are trying to build our code base for CentOS 7 machine with x86_64 architecture on CentOS6 with x86_64.

For that we are trying to build a centos7 Toolchain. All the gcc/ld/ar should be statically linked, so that we are ensuring that it will not uses any native centos6 stuff.

In this process, we are able to generate statically linked GCC/AR/LD. But problem was this GCC not generating a statically linked binaries and fails while checking flags during configure at "checking static
flag -static ". Due to this while running those binaries it refers to native libgcc and fails.

We are using the below command for configure.

../gcc../configure -prefix=/mnt/data0/toolchain-vm-temp2 --build=x86_64-CentOS7-linux-gnu-with sysroot=/mnt/data0/tools/gnutools/toolchain-vm --disable-nls --disable-multilib --enable-languages=c,c++ --disable-sim --enable-symvers=gnu --enable__cxa_atexit --enable-lto --with-gnu-ld --enable-static

Can Anyone provide solution or how to achieve this task.

+1 vote

I wanted to ask what is the GCC C++ equivalent implementation of Windows _ MyFirst and _MyLast vector pointers?

These give direct access to the vectors first and last element, but they are not present in the GCC implementation of the vector class.

Contact Us
+91 9880187415
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Karnataka INDIA.