Why does a noreturn func push LR?
Asked by
Gary Fuehrer
My entry point function:
void __attribute_
main();
L0: goto L0;
}
compiled (also -O2):
arm-none-eabi-gcc -c -std=gnu11 -mcpu=cortex-m4 -mthumb -Os startup.c
emits:
00000204 <Reset_Handler>:
204: b508 push {r3, lr}
206: f000 f817 bl 238 <main>
20a: e7fe b.n 20a <Reset_Handler+0x6>
If I remove the goto, I get the compiler warning about returning from noreturn, of course, but now it emits what I would expect:
00000204 <Reset_Handler>:
204: f000 b816 b.w 234 <main>
Explanation?
Thank you,
-Gary
Question information
- Language:
- English Edit question
- Status:
- Answered
- Assignee:
- No assignee Edit question
- Last query:
- Last reply:
Can you help with this problem?
Provide an answer of your own, or ask Gary Fuehrer for more information if necessary.
To post a message you must log in.