Page 1 of 1

Using std::list Linker Error

Posted: Tue Jun 10, 2008 10:41 pm
by 71M
Hi,
I'm relatively new to the Wii homebrew scene and was wondering if anyone could tell me what this linker error means?

Code: Select all

3>c:/devkitpro/devkitppc/bin/../lib/gcc/powerpc-gekko/4.2.3/../../../../powerpc-gekko/bin/ld.exe: ../../../../lib/wii\libcp.a(CRenderable.o): the target (__dso_handle) of a R_PPC_EMB_SDA21 relocation is in the wrong output section (.data)
I can fix the error by commenting out the std::list in the code but that's obviously not desirable! :)
One other thing I forgot to mention is that the std:list is defined in a custom library so I guess it's something to do with that maybe?

Cheers,
71M

Re: Using std::list Linker Error

Posted: Thu Jun 12, 2008 10:13 pm
by 71M
Ok, I finally got this to link by removing the flag -msdata=eabi from the makefile.
That'll teach me for copying makefile settings from other projects without fully understanding it!

Out of interest what does this flag do?

Cheers,
71M

Re: Using std::list Linker Error

Posted: Tue Jun 24, 2008 3:51 pm
by WinterMute
Hi Tim,

Good to see you here, been meaning to drop you a mail to say hello since I saw the comment on the main site, poke me if I don't - I'm terrible for not getting around to things.

To answer your question, the -msdata=eabi option places small initialised global const data in the sdata2 section, non const data in sdata which are then accessed using register relative adressing from r2/r13. It's supposed to produce smaller faster code.

Unfortunately I'm not quite sure what triggers this, some opinions are that it's broken behaviour in binutils and other sources say it's related to a wrong -G option when compiling. It's possible that the way I'm building gcc isn't quite right - it's yet another thing on the todo list but I can't seem to reproduce it consistently with a small enough testcase to work with.

If you have the time and the inclination to try and reproduce it with a relatively small project then do feel free to file a bug report and attach some code.

You'll find the powerpc specific switches at http://gcc.gnu.org/onlinedocs/gcc-4.2.4 ... PC-Options which goes into a little more detail on what the options do.