I would like to compile a single function (not main, without startup files), passing parameters in r3 and r4 with a return value in r3.
With GNU for another CPU family I do this (with a different exe):
powerpc-eabivle-gcc -std=c99 -Os -nostdlib -T test.ld test.c
test.ld:
SECTIONS
{
.text : {*(.text)}
}
When the output is disassembled there is extra stuff involving the stack at the beginning that I don't want:
e_stwu r1, back_chain(r1)
se_mflr r0
e_stmw r27, 0x20+var_14(r1)
se_stw r0, 0x20+sender_lr(r1)
At the end there is e_b _restgpr_27_x so I have to add -Wl,-r to get this to be ignored.
I would like to have a se_blr return instruction.
I think I'm missing an eabi or -mcall- option.
Solved! Go to Solution.
-O2 instead of -Os fixed it.