devkitPPC uses g++ to link?

Add your suggestions for toolchain improvements here.
Post Reply
TurkeyMan
Posts: 6
Joined: Mon Mar 04, 2013 12:57 am

devkitPPC uses g++ to link?

Post by TurkeyMan » Sat Nov 09, 2013 1:37 am

Hi, I'm wrangling my own build system, and I noticed from the devkitppc makefiles that it uses g++ to link instead of ld.
As far as I can tell, this has something to do with wanting to pass the MACHDEP options to the linker aswell... and since some of them are compiler options, I guess g++ will invoke the linker, and forward only the relevant options (while not complaining that compile options were given to ld)?
Something like that?

Anyway, what I'm wondering is, which options are required for each step?
The options given to both the compiler and linker (ie, g++ used to link) are:
-g -DGEKKO -mrvl -mcpu=750 -meabi -mhard-float

I presume -DGEKKO -mcpu=750 -meabi -mhard-float are only needed while compiling, surely they don't need to be supplied while linking?

That leaves me wondering about -g -mrvl, which of these are needed by the compile step, and by the link step?

Obviously I need -g while compiling, do I also need it when linking? And what is -mrvl? I can't find any information about it... I'm suspecting that's the magic option that is wanted by the link step... is it needed during the compile step?

TL;DR: of those options, can you separate into options that should be given while compiling, and which should be given while linking?

WinterMute
Site Admin
Posts: 1367
Joined: Tue Aug 09, 2005 3:21 am
Location: UK
Contact:

Re: devkitPPC uses g++ to link?

Post by WinterMute » Mon Nov 18, 2013 11:19 am

TurkeyMan wrote:Hi, I'm wrangling my own build system, and I noticed from the devkitppc makefiles that it uses g++ to link instead of ld.
The semi automatic makefiles check for compiling .cpp files & then use g++ to link otherwise gcc is used to link. It's done this way because there are various options passed to ld which are determined at compile time for the toolchain. IIRC gcc/g++ also have code for detecting the paths the tools are being run from and adjusting if necessary.
I presume -DGEKKO -mcpu=750 -meabi -mhard-float are only needed while compiling, surely they don't need to be supplied while linking?
That depends on whether or not the toolchain has libraries specifically optimised for those options and possibly some link time optimisations
That leaves me wondering about -g -mrvl, which of these are needed by the compile step, and by the link step?
both - -mrvl changes parts of the headers used to compile and also changes the path of the libraries used to link. The g option is supplied at both compile and link stages to get full debug information in the final elf.

It's a bit more complicated than it appears at first sight, sorry.
Help keep devkitPro toolchains free, Donate today

devkitPro IRC support
Personal Blog

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest