On Mon, Jan 18, 2010 at 3:33 PM, chandra reddy <creddym@xxxxxxxxx> wrote: > Hi Eljay, > > My requirement is not generate two executable outputs. I want do the > following under a new command line option to gcc (new option is needed > because it is unusual producing two object files in single compilation) > > I want to create libabc.a and libabc.so in the following way: > > $gcc <cflags> -c <new_option> -fpic a.c > $gcc <cflags> -c <new_option> -fpic b.c > $gcc <cflags> -c <new_option> -fpic c.c > > The output would be: a.o a.So b.o b.So c.o c.So > where a.o b.o c.o will be generated with -fpic disabled > a.So b.So c.So will be generated with -fpic enabled > Now, > > I will create libabc.a and libabc.so like this. > > $ ar cq libabc a.o b.o c.o > $ld -o libabc.so a.So b.So c.So > > I want this feature only to create object files not for executables. We have > to create thousands of static and dynamic libraries with and without -fpic > option. > It helps us if the above feature can be achieved in the gcc compiler. > > I can see that until reaching the function call "expand_gimple_basic_block" > in gcc compiler, the code flow is same with/without -fpic. After this > function call tree would differ. It already differs before (see targetm.binds_local). Richard. > Thanks > -Chandra > > > > > > On Mon, Jan 18, 2010 at 7:31 PM, John (Eljay) Love-Jensen <eljay@xxxxxxxxx> > wrote: >> >> Hi Chandra (and Richard), >> >> > Would it be possible to the compiler to generate two object >> > files:.<file>.o (general obj file) and <file>.So (obj file with -fpic) in >> > single compilation? >> >> No. >> >> Consider, for example: >> >> int main() >> { >> #ifdef TWENTY >> return 10; >> #else >> return 20; >> #endif >> } >> >> It is not possible to have two executable outputs. Something like... >> >> gcc -o ten.exe -DTWENTY -o twenty.exe test.cpp >> >> I could write a gcc-bash front end, which would parse the parameters and >> run gcc twice for me... >> >> gcc -o ten.exe >> gcc -DTWENTY -o twenty.exe test.cpp >> >> ...but that does not reduce any time for building anything. >> >> Even if GCC had the capability to do what I envision my gcc-bash front >> end, I cannot see how that convenience would reduce any build time, since >> none of the effort of the compilation process would be reusable for the >> subsequent passes. >> >> Sincerely, >> --Eljay > > > > -- > Thanks, > cr(); > -------------------------------------------------------------------------------------------------------------------------- > "Remote debugging a buggy debugger with a cross buggy debugger is a funny > thing" > -------------------------------------------------------------------------------------------------------------------------- > >