On Mär 08 2022, Richard Sandiford via Gcc-patches wrote: >> + >> + .section .init,"ax",@progbits >> + .globl _init >> + .type _init,@function >> +_init: >> + addi.d $r3,$r3,-16 >> + st.d $r1,$r3,8 >> + addi.d $r3,$r3,16 >> + jirl $r0,$r1,0 >> + >> + .section .fini,"ax",@progbits >> + .globl _fini >> + .type _fini,@function >> +_fini: >> + addi.d $r3,$r3,-16 >> + st.d $r1,$r3,8 >> + addi.d $r3,$r3,16 >> + jirl $r0,$r1,0 > > Are you sure this is right? It looks like it pushes LR and then > immediately pops it and returns, which would have the effect of > bypassing the rest of the .init and .fini code. > > The idea instead is that .init starts with the code in crti.S, > then contains any .init code linked in from .o files, then ends > with the .init code in crtn.S. Same for .fini.
New architectures should not use .init/.fini at all. -- Andreas Schwab, sch...@linux-m68k.org GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1 "And now for something completely different."