aarch64 stat

Marcus Shawcroft marcus.shawcroft@gmail.com
Sun Jan 11 10:32:00 GMT 2015


Hi.


On 10 January 2015 at 23:08, K Jski <bielsk1@vt.edu> wrote:
> I am also working on using newlib for aarch64 and see that it gives a
> crt0.o file. From reading forums, I think this should be used as the
> startup files (vs using gcc's crt1.o and crti.o, crtn.o crtend.o)
>
> So my new script compiling a simple hello world for aarch64 is as follows:
>
> INPUT=$1
> aarch64-linux-gnu-gcc -c -o ${INPUT%.c}_ARMObj.o $1
> echo -e " ------------ x86 OBJECT FILE OBTAINED... \n\n\n\n"
>
> aarch64-linux-gnu-gcc -v -nostdlib -static -o rARM64 \
> /home/bielsk1/aarch64-toolchain/ARM_newlib/aarch64-unknown-linux-gnu/lib/crt0.o
> \
> /home/bielsk1/aarch64-toolchain/ARM_newlib/aarch64-unknown-linux-gnu/lib/libnosys.a
> \
> /home/bielsk1/aarch64-toolchain/ARM_newlib/aarch64-unknown-linux-gnu/lib/librdimon.a
> \
> ${INPUT%.c}_ARMObj.o \
> -I/home/bielsk1/aarch64-toolchain/ARM_newlib/aarch64-unknown-linux-gnu/include \
> -L/home/bielsk1/aarch64-toolchain/ARM_newlib/aarch64-unknown-linux-gnu/lib \
>  /home/bielsk1/aarch64-toolchain/ARM_newlib/aarch64-unknown-linux-gnu/lib/libc.a
> \
>  /home/bielsk1/aarch64-toolchain/ARM_newlib/aarch64-unknown-linux-gnu/lib/libg.a
> \
>  /home/bielsk1/aarch64-toolchain/ARM_newlib/aarch64-unknown-linux-gnu/lib/libm.a
> \
>  -lc -lm
>
>
> this now presents the following error:
>
> /home/bielsk1/aarch64-toolchain/ARM_newlib/aarch64-unknown-linux-gnu/lib/crt0.o:
> In function `_start':
> /home/bielsk1/aarch64-toolchain/libgloss_ARMbuild/aarch64/../../newlib-2.1.0/libgloss/aarch64/crt0.S:156:
> undefined reference to `_init'
> /home/bielsk1/aarch64-toolchain/ARM_newlib/aarch64-unknown-linux-gnu/lib/crt0.o:
> In function `_cpu_init_hook':
> /home/bielsk1/aarch64-toolchain/libgloss_ARMbuild/aarch64/../../newlib-2.1.0/libgloss/aarch64/crt0.S:228:
> undefined reference to `_fini'
> /home/bielsk1/aarch64-toolchain/ARM_newlib/aarch64-unknown-linux-gnu/lib/libc.a(lib_a-exit.o):
> In function `exit':
> exit.c:(.text+0x30): undefined reference to `_exit'
> /home/bielsk1/aarch64-toolchain/ARM_newlib/aarch64-unknown-linux-gnu/lib/libc.a(lib_a-fini.o):
> In function `__libc_fini_array':
> fini.c:(.text+0x38): undefined reference to `_fini'
> collect2: error: ld returned 1 exit status
>
> so what am I missing??? Do I have to write these functions myself for aarch64?
> Thank you for your time,


For a bare metal environment, configure gcc to target aarch64-none-elf
rather than aarch64-none-linux-gnu, then pass the -specs option with
something appropriate for the platform.  For ARM's AEM or foundation
model use:

$ aarch64-none-elf -specs=aem-ve.specs hello-world.c

For qemu:

$ aarch64-none-elf -specs=rdimon.specs hello-world.c

For another platform rdimon.specs is probably a good starting point.

Cheers
/Marcus



More information about the Newlib mailing list