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

ソリューションへジャンプ
642件の閲覧回数
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 解決策
609件の閲覧回数
johnbanks
Contributor II

-O2 instead of -Os fixed it.

元の投稿で解決策を見る

0 件の賞賛
返信
1 返信
610件の閲覧回数
johnbanks
Contributor II

-O2 instead of -Os fixed it.

0 件の賞賛
返信