Compiling a single function (VLE, embedded ABI) - tidying up the preamble and exit

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Compiling a single function (VLE, embedded ABI) - tidying up the preamble and exit

Jump to solution
644 Views
johnbanks
Contributor II

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.

 

 

 

 

0 Kudos
Reply
1 Solution
611 Views
johnbanks
Contributor II

-O2 instead of -Os fixed it.

View solution in original post

0 Kudos
Reply
1 Reply
612 Views
johnbanks
Contributor II

-O2 instead of -Os fixed it.

0 Kudos
Reply