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

Re: [MiNT] Should Setting Stack be added to Binutils?



Hi Vincent, List,

Any reason this should feature should not be added into Binutils? It is basically necessary to build newer GCC natively, and I am guessing even with a Coldfire CPU (which will definitely need the newer dev tools) this will be needed.

So, any possible problems seen with this?

The only other possible addition I see is maybe making it so strip does not remove the stack setting, or saves/restores it.

Keith



On Sun, 15 Mar 2009, Keith Scroggins wrote:

Hello Vincent, List,

I tried the patch this weekend with a bootstrap build of GCC4 (Just the C Compiler) and this fixed the problems caused by reusing th non stack adjusteds files from the previous stage.

More to come in a few minutes (hopefully).

Keith

On Mon, 9 Mar 2009, Vincent Rivière wrote:

Keith Scroggins wrote:
What I was wondering was if we could/should add stack functionality to
Binutils so you could pass a linking flag of something like --stack=512k
to have it set?  Any input?

Here is a quick and dirty patch for enabling the --stack option in the linker. It must be applied to binutils 2.19 already patched for MiNT.

This is just a test for verifying if the concept is good. When we agree to what is good or not, I will take the time to clean it ant to merge it to my "official" binutils patch.

Current limitations are :
- The "ld" produced with this patch seems to be good, but I'm pretty sure that the "strip" would reset the stack settings. So use only the "ld" produced by this patch and keep your old "strip". - The stack value is a number of bytes, the suffixes "K", etc. are not yet supported. - When the --stack option is not used, the value "0" is put into the executable, which means "mysterious default stack size" (actually 64K if I remember well). The MiNTLib has been recently patched for setting an explicit stack value, this linker breaks that behavior.

Usage :
See ld --target-help for the new option :-)

Typical usage is by using the "gcc" command.
Beware, if you want to replace only the "ld" executable for test purposes. On my cross-environment, gcc uses the linker located at this location :
/usr/local/cross-mint/m68k-atari-mint/bin/ld
The "normal" linker command /usr/local/m68k-atari-mint-ld is not used.
Is is probably the same for a native compiler.

So the typical usage is :
gcc hello.c -o hello -Wl,--stack,512000
It just works.

When compiling a GNU package, you can use :
configure ... LDFLAGS=-Wl,--stack,512000
So the stack size will be written in all the makefiles :-)

Another option is so specify the LDFLAGS on the make command line.
make LDFLAGS=-Wl,--stack,512000

If this behavior seems good for you, and it it works as expected, I will clean the patch and get rid of the current limitations.

--
Vincent Rivière