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

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

 



Ian Lance Taylor wrote:
> "Kevin P. Fleming" <kpfleming@xxxxxxxxxx> 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@xxxxxxxxxx
Check us out at www.digium.com & www.asterisk.org
extern "C" {

int __attribute__((externally_visible)) func2(void)
{
	return 5;
}

int __attribute__((externally_visible)) func1(void)
{
	return func2();
}

}

[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