ppc32: Building tiny executable
Segher Boessenkool
segher@kernel.crashing.org
Fri May 4 12:16:00 GMT 2018
On Fri, May 04, 2018 at 01:45:35PM +0200, Mathieu Malaterre wrote:
> $ gcc -static -ffreestanding -nostartfiles -s -o tiny tiny.c
> $ ./tiny
> Segmentation fault
>
> What do I need to pay attention to on ppc to build tiny executable
> using the _start function ?
You need to set up r13. This is powerpc64? (32-bit works fine for me,
but you may be using a different ABI, you didn't tell. I'm on Linux).
You also should align r1 and set up a terminating stack frame, and set
LR to 0. Look what glibc does :-)
Segher
More information about the Gcc-help
mailing list