This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

How to use aarch64-elf-gcc to print hello world

1.
aarch64-elf-gcc need use glibc2.14 while our central version up to glibc-2.12 only
2.
I have downloaded glibc-2.14 in my local directory

3
I try to set LD_LIBRARY_PATH to my local glibc-2.14 directory then isuue following command:


>>>>>>>>>>>>>>>>>>>>>>>>> Command >>>>>>>>>>>>>>>>>>>>>>>>>>
aarch64-elf-gcc -o "gcc5.axf" ./src/gcc5.o

>>>>>>>>>>>>>>>>>>>>>>>> Result >>>>>>>>>>>>>>>>>>>>>>>>>>>
<local_path>/gcc-linaro-5.3-2016.02-x86_64_aarch64-elf/bin/../aarch64-elf/libc/usr/lib/crt0.o: In function `_start':
/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/aarch64-elf/snapshots/newlib.git~linaro_newlib-branch/libgloss/aarch64/crt0.S:148: undefined reference to `initialise_monitor_handles'
<local_path>/gcc-linaro-5.3-2016.02-x86_64_aarch64-elf/bin/../aarch64-elf/libc/usr/lib/libc.a(lib_a-exit.o): In function `exit':
/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/aarch64-elf/snapshots/newlib.git~linaro_newlib-branch/newlib/libc/stdlib/exit.c:70: undefined reference to `_exit'
<local_path>/gcc-linaro-5.3-2016.02-x86_64_aarch64-elf/bin/../aarch64-elf/libc/usr/lib/libc.a(lib_a-sbrkr.o): In function `_sbrk_r':
/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/aarch64-elf/snapshots/newlib.git~linaro_newlib-branch/newlib/libc/reent/sbrkr.c:58: undefined reference to `_sbrk'
<local_path>/gcc-linaro-5.3-2016.02-x86_64_aarch64-elf/bin/../aarch64-elf/libc/usr/lib/libc.a(lib_a-writer.o): In function `_write_r':
/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/aarch64-elf/snapshots/newlib.git~linaro_newlib-branch/newlib/libc/reent/writer.c:58: undefined reference to `_write'
<local_path>/gcc-linaro-5.3-2016.02-x86_64_aarch64-elf/bin/../aarch64-elf/libc/usr/lib/libc.a(lib_a-closer.o): In function `_close_r':
/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/aarch64-elf/snapshots/newlib.git~linaro_newlib-branch/newlib/libc/reent/closer.c:53: undefined reference to `_close'
<local_path>/gcc-linaro-5.3-2016.02-x86_64_aarch64-elf/bin/../aarch64-elf/libc/usr/lib/libc.a(lib_a-fstatr.o): In function `_fstat_r':
/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/aarch64-elf/snapshots/newlib.git~linaro_newlib-branch/newlib/libc/reent/fstatr.c:62: undefined reference to `_fstat'
<local_path>/gcc-linaro-5.3-2016.02-x86_64_aarch64-elf/bin/../aarch64-elf/libc/usr/lib/libc.a(lib_a-isattyr.o): In function `_isatty_r':
/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/aarch64-elf/snapshots/newlib.git~linaro_newlib-branch/newlib/libc/reent/isattyr.c:58: undefined reference to `_isatty'
<local_path>/gcc-linaro-5.3-2016.02-x86_64_aarch64-elf/bin/../aarch64-elf/libc/usr/lib/libc.a(lib_a-lseekr.o): In function `_lseek_r':
/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/aarch64-elf/snapshots/newlib.git~linaro_newlib-branch/newlib/libc/reent/lseekr.c:58: undefined reference to `_lseek'
<local_path>/gcc-linaro-5.3-2016.02-x86_64_aarch64-elf/bin/../aarch64-elf/libc/usr/lib/libc.a(lib_a-readr.o): In function `_read_r':
/home/tcwg-buildslave/workspace/tcwg-make-release/label/tcwg-x86_64-ex40/target/aarch64-elf/snapshots/newlib.git~linaro_newlib-branch/newlib/libc/reent/readr.c:58: undefined reference to `_read'
collect2: error: ld returned 1 exit status
make: *** [makefile:32: gcc5.axf] Error 1

  • Hi YL Shen

    You need to add a "specs" file to suit the purpose of the application.

    For example:
    aarch64-elf-gcc hello.c -specs=aem-ve.specs
    or
    aarch64-elf-gcc hello.c -specs=rdimon.specs

    A variety of different specs files are provided with gcc to suit different applications.

    For example:
    aprofile-ve.specs / aem-ve.specs : provides C libs, exception handlers and semihosting libs. Used for helloworld.c apps.
    rdimon.specs : provides C libs & semihosting libs. Used for applications that have their own startup code and exception handlers, but uses semihosting.
    nosys.specs : provides C libs only. Used for embedded systems with their own startup code, exception handlers, retargeted I/O (no semihosting).