Possible to use -fPIC and -fwhole-program together?

Kevin P. Fleming kpfleming@digium.com
Tue Sep 1 12:31:00 GMT 2009


Ian Lance Taylor wrote:
> "Kevin P. Fleming" <kpfleming@digium.com> writes:
> 
>> Is there some inherent reason why -fPIC and -fwhole-program are
>> incompatible for C++ code?
> 
> No.  This sounds like a bug.
> 
>> If not, I'll try to produce a test case.

Success.

Compiling with:

$ g++ -c -o foo.o foo.cpp -fPIC

produces

RELOCATION RECORDS FOR [.text]:
OFFSET           TYPE              VALUE
0000000000000010 R_X86_64_PLT32    func2-0x0000000000000004

Compiling with:

$ g++ -c -o foo.o foo.cpp -fPIC -fwhole-program

produces

RELOCATION RECORDS FOR [.text]:
OFFSET           TYPE              VALUE
0000000000000010 R_X86_64_PC32     func2-0x0000000000000004

-- 
Kevin P. Fleming
Digium, Inc. | Director of Software Technologies
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
skype: kpfleming | jabber: kpfleming@digium.com
Check us out at www.digium.com & www.asterisk.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: foo.cpp
Type: text/x-c++src
Size: 158 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-help/attachments/20090901/60edd90c/attachment-0001.bin>


More information about the Gcc-help mailing list