Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

STL compilation error

Altera_Forum
Honored Contributor II
2,152 Views

Anyone ever seen this one? 

 

`__static_initialization_and_destruction_0(int, int)': 

locale-inst.o(.text+0xa0): global pointer relative address out of range 

 

Adding an std::string causes this error, it doesn't occur in smaller projects.
0 Kudos
7 Replies
Altera_Forum
Honored Contributor II
740 Views

Hello morten_tor, 

 

Yep, I tried this and got the exact same error (I don't normally use libstdc++ due to the amount of "baggage" it links in!). It looks like a problem in the libstdc++ port - I think something in locale-inst is trying to access its .text section using global pointer relative addressing; but as the linker scripts usually group all of the .text sections in low memory and all of the gp relative sections (sdata and sbss) higher up, the .text sections are too far away to be accessed by the (signed 16-bit) gp. Sounds like one for the Altera compiler people (I have an idea for a workaround, but it's ugly)... 

 

Steve.
0 Kudos
Altera_Forum
Honored Contributor II
740 Views

I know that some of the Altera guys are monitoring this forum, so hopefully something will be done to fix this error. I guess there's a workaround where I juggle the segments myself, but I'd rather that they fixed the issue. 

 

The coders in here that use uLinux - are they using the same compiler as we are? If they are, then they should have the same problem (I guess)
0 Kudos
Altera_Forum
Honored Contributor II
740 Views

This is fixed in the Nios II 1.01 release. You can get it from you FAE (now), or through the web (soon). Sorry for the late reply.

0 Kudos
Altera_Forum
Honored Contributor II
740 Views

What is FAE? (ohh... well... Field Application Engineer .. got it http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/wink.gif )

0 Kudos
Altera_Forum
Honored Contributor II
740 Views

how soon is soon?

0 Kudos
Altera_Forum
Honored Contributor II
740 Views

Hmmm ... this is a recurring theme ... on several threads. So, I&#39;ll 

ask here too: does the -G0 compiler option resolve the problem? 

 

The option does indeed work as advertised (no small data) ... but 

I&#39;m not currently using STL ... if it resolves your problem it would be a 

simple work around ... at least temporarily. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
740 Views

yes -G0 does solve the problem, http://forum.niosforum.com/work2/style_emoticons/<#EMO_DIR#>/laugh.gif  

I did try combinations of command line options for linking. but never thought of declearing -G0 on compiler command line.  

 

Once again your advice works, you should be admin here. 

 

thanks for the advice.
0 Kudos
Reply