I am working with a small sample project that targets Cortex-M4 using the gcc arm-none-eabi toolchain. The makefile invokes arm-none-eabi-ld directly to link the executable:
LD=arm-none-eabi-ld.exe $(LD) main.o retarget.o exceptions.o test_main.o common.o init_main.o -T link.ld --print-memory-usage -o $(TARGET)
$ arm-none-eabi-gcc -v CMakeFiles/wdt_interrupt_gnu.dir/main.c.obj CMakeFiles/wdt_interrupt_gnu.dir/retarget.c.obj CMakeFiles/wdt_interrupt_gnu.dir/exceptions.c.obj CMakeFiles/wdt_interrupt_gnu.dir/test_main.c.obj CMakeFiles/wdt_interrupt_gnu.dir/common.c.obj CMakeFiles/wdt_interrupt_gnu.dir/init_main.c.obj -T ../link_cmake.ld -o cm4.axf <snip> /home/asic/lib/ARM/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld: /home/asic/lib/ARM/gcc-arm-none-eabi-10.3-2021.10/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/lib/libc.a(lib_a-exit.o): in function `exit': exit.c:(.text.exit+0x2c): undefined reference to `_exit' collect2: error: ld returned 1 exit status
Do I need to pass arm-none-eabi-ld explicitly as a parameter to arm-none-eabi-gcc?
The command might be missing a specs file.
I've gotten the error about undefined "_exit"; I usually just create an _exit() function (which hopefully is never called, anyway.)
I'm not sure why running ld instead of gcc as the linker would cause it to work - probably you're somehow getting a different libc/libgcc/whatever. Is the path that it's picking up (/home/asic/lib/ARM/gcc-arm-none-eabi-10.3-2021.10/bin/) the same one where it is picking up arm-none-eabi-ld.exe ? Does your makefile set an environment variables? (what happens if you you put "LD=arm-none-eabi-gcc.exe" in the Makefile? (wait! Is this on two completely different computers?? (one windows and one linux?)