$ cat gprel.cc
class __attribute__ ((visibility("default"))) Type
{
private:
static long _staticTypeCount;
public:
Type() { _staticTypeCount++; }
~Type();
};
long Type::_staticTypeCount = 0;
Type::~Type()
{
_staticTypeCount--;
}
$ gcc -fPIC -fvisibility=hidden -S gprel.cc
$ grep _staticTypeCount gprel.s
.global _ZN4Type16_staticTypeCountE#
.type _ZN4Type16_staticTypeCountE#, @object
.size _ZN4Type16_staticTypeCountE#, 8
_ZN4Type16_staticTypeCountE:
addl r14 = @gprel(_ZN4Type16_staticTypeCountE#), gp
addl r14 = @gprel(_ZN4Type16_staticTypeCountE#), gp
addl r14 = @gprel(_ZN4Type16_staticTypeCountE#), gp
addl r14 = @gprel(_ZN4Type16_staticTypeCountE#), gp
--
Summary: Invalid gprel relocation in PIC
Product: gcc
Version: 4.0.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: schwab at suse dot de
CC: gcc-bugs at gcc dot gnu dot org
GCC target triplet: ia64-*-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18925