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

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

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

跳至解决方案
1,662 次查看
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 项奖励
回复
1 解答
1,629 次查看
johnbanks
Contributor II

-O2 instead of -Os fixed it.

在原帖中查看解决方案

0 项奖励
回复
1 回复
1,630 次查看
johnbanks
Contributor II

-O2 instead of -Os fixed it.

0 项奖励
回复