Re: Question on generating object files with/without -fpic

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jan 18, 2010 at 3:41 PM, Richard Guenther
<richard.guenther@xxxxxxxxx> wrote:
> 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).

Btw, if you just want to save compile time simply use the PIC
objects in the static archive.

Richard.


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux