![]() |
gcc function order
Is there a way to make sure a function is the first one to be compiled and first one written to the executable/object?
Since I'm not using any libraries passing -nostdlib to gcc will require _start instead of main. This works fine except if _start is not the first function the whole thing messes up. What happens is... Compile->Link->copy code to raw binary I did try a hack where I put a function at the beginning of the source file which called _start but after adding a few more functions that broke too. My goal is the smallest possible binary size, which is why I'm working directly with hardware instead of using a high level library... Code:
#include <gba_base.h> Here is my cheap makefile... Code:
CC=arm-elf-gcc |
Re: gcc function order
not sure if a custom link script (like that one in Metamod-p) will work, but I have never done this so I don't know further.
|
Re: gcc function order
ouch, w/o any libc you will be very much on you own, no one does this for long :)
Prehaps give dietclib a try, it's commonly used in embedded and mirco linux systems (4 mb ram+). --OK |
Re: gcc function order
Actually, the only ram I have to work with is 256kb - and even that is cut down since in my case it is shared with the program itself.
http://en.wikipedia.org/wiki/Gba I just want to see if I can code a simple game in less than 256 bytes. I know it has been done for x86 but I wanted to see if it's possible with C since all of the ones I looked at were done in assembly. But it's not going anywhere since gcc seems to put _start wherever it wants which results in some other function getting called and the system not being initialized. I'm going to try a few more things later tonight and see what happens. |
Re: gcc function order
well, then good luck :)
|
Re: gcc function order
You should ask the guys at the demo scene (start at www.pouet.net if they have a forum there). They know how to do heaps of things in 256 bytes.
|
Re: gcc function order
Bah.
Got too frustrated with it so I decided to port sdl sopwith to the nintendo ds. Its working very well on real hardware so once I get the input and sound finished I can release it into the wild. :) |
All times are GMT +2. The time now is 19:27. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.