ARM crt.. files

Philip Blundell philb@gnu.org
Sun Jun 28 10:50:00 GMT 1998


A few weeks ago I sent a patch to Ulrich to add sysdeps/arm/crt{i,n}.S files 
and change the csu makefile to avoid autogenerating these files if a specific 
implementation exists in a sysdep directory.  He didn't like the patch much 
and I can understand this.

Unfortunately I haven't managed to find any way to avoid this.  Does anybody 
have any ideas?

I've appended here a copy of the assembler output that is generated on ARM 
systems for initfini.c.  The problem is that in order to load the address of 
`__gmon_start__' to compare it with zero, we need to load some constants which 
have been put in the constant pool.  GCC emits this pool at the end of the 
function and so it ends up in the epilogue although it's actually used in the 
prologue, and this causes errors during assembly.

I'd rather not have to modify the compiler purely so this one case works, 
since it's a somewhat unusual situation.

p.

/*@_init_PROLOG_BEGINS*/
        .section .init
        .align  0
        .global _init
_init:
        @ args = 0, pretend = 0, frame = 0
        @ frame_needed = 1, current_function_anonymous_args = 0
        mov     ip, sp
        stmfd   sp!, {sl, fp, ip, lr, pc}
        sub     fp, ip, #4
        ldr     sl, L40
        add     sl, pc, sl
L39:
        ldr     r3, L40+4
        ldr     r3, [sl, r3]
        cmp     r3, #0
        movne   lr, pc
        movne   pc, r3
L38:
        ALIGN
        END_INIT

/*@_init_PROLOG_ENDS*/

/*@_init_EPILOG_BEGINS*/
        .section .init
        ldmea   fp, {sl, fp, sp, pc}^
L41:
        .align  0
L40:
        .word   _GLOBAL_OFFSET_TABLE_ - (L39+4)
        .word   __gmon_start__(GOT)
        END_INIT






More information about the Libc-hacker mailing list