ppc32: Building tiny executable
Segher Boessenkool
segher@kernel.crashing.org
Fri May 4 12:40:00 GMT 2018
On Fri, May 04, 2018 at 02:23:02PM +0200, Mathieu Malaterre wrote:
> On Fri, May 4, 2018 at 2:16 PM, Segher Boessenkool
> <segher@kernel.crashing.org> wrote:
> > 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).
>
> Nope, ppc32.
>
> $ objdump -f tiny
>
> tiny: file format elf32-powerpc
> architecture: powerpc:common, flags 0x00000102:
> EXEC_P, D_PAGED
> start address 0x10000120
>
> dmesg states:
>
> [ 1552.267961] tiny[2127]: unhandled signal 11 at ffff8fd0 nip
> 10000180 lr 10000150 code 1
So
$ gdb ./tiny
(gdb) run
(gdb) disas
and look what line the "=>" mark is on.
Segher
More information about the Gcc-help
mailing list