[arm-gnu] undefined reference to _init

Brad Badke BBadke at hemispheregps.com
Thu Oct 18 03:46:13 UTC 2012


Apparently I needed to also link in crti.o.  Which I got from

CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/lib/gcc/arm-none-eabi/4.6.3/crti.o

Not sure if that is the correct crti.o

I think what I maybe really need is a bit of help re-implementing my own __cs3_start_asm, __cs3_start_c, and _init.

From: Brad Badke
Sent: Wednesday, October 17, 2012 7:10 PM
To: 'arm-gnu at codesourcery.com'
Subject: undefined reference to _init

Ok, let's try this one more time. I am developing code for a GNSS receiver manufacturer. We currently develop using ARM RVDS 4.1. I have ported my entire application over to the free version of CodeSourcery. In the ARM compiler I used __rt_entry to jump to my main and initialize various things (I use C and C++). So it seems I need to use __cs3_start_asm and __cs3_start_c to do the equivalent of ARM __rt_entry. When I try to do that I get the following linker errors:

undefined reference to `__cs3_start_asm'

In function `__libc_init_array':
init.c:(.text+0x40): undefined reference to `_init'

I am starting out using the following linker script:

CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/arm-none-eabi/lib/generic-vfp.ld

And my own makefile which I derived from something I started with from TI. If I skip the c library init stuff I can get my code to run on my Sitrara Cortea-A8 processor a bit before it runs into the problems caused by not running __cs3_start_c.

So, can I get any help on this? Will I get any help if I buy the $99 version? If this works satisfactorily we would eventually buy the professional floating license for 3 developers.

Thanks, Brad

From: Brad Badke
Sent: Tuesday, October 16, 2012 12:16 PM
To: 'arm-gnu at codesourcery.com'
Subject: undefined reference to _init

I am converting my ARM code to over to CodeSourcery. I am using both C and C++. In my ARM code I called __rt_entry to initialize the C run time library and jump to my main().  In my startup.S file for CodeSourcery I have done the following:

@Invoke all static constructors
   ldr r12,=__libc_init_array
@    ldr r12,= __cs3_start_c
    mov lr,pc @set the return address
    BX r12 @the target code can be ARM or THUMB
   ldr r12,=main @Enter the C/C++ code
    mov lr,pc @set the return address
    bx r12 @the target code can be ARM or THUMB
@@@    BL       __rt_entry   @@This is what we did for ARM compiler

This results in the following linker error:
In function `__libc_init_array': init.c:(.text+0x40): undefined reference to `_init'

Any ideas on what I need to re-implement or link in?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://sourcerytools.com/pipermail/arm-gnu/attachments/20121018/45b387ae/attachment.html>


More information about the arm-gnu mailing list