Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

arm-elf-gcc: how to get rid of crt0.o (or how to get it)?

5,426 views
Skip to first unread message

Boris Dušek

unread,
Oct 22, 2007, 5:04:38 AM10/22/07
to
Hi,

I compiled gcc for target arm-elf. I can't use a standard C library
(and an OS as well), since the target machine is only a User-mode ARM
emulator.

I get trouble with arm-elf-gcc requiring crt0.o:

arm-elf-gcc -g0 -O1 -march=armv5 -mno-thumb -ffreestanding -o prec
prec.c
/usr/local/lib/gcc/arm-elf/4.2.2/../../../../arm-elf/bin/ld: crt0.o:
No such file: No such file or directory
collect2: ld returned 1 exit status

prec.c is a simple program not requiring any C library routine. It is
performing just computations, without doing explicit input/output (the
emulator passes arguments manually in registers and gets result from
registers as well), and without doing anything requiring standard C
library.

How to get rid of the "crt0.o" requirement? Or how to get the crt0.o
for an environment without a C library and OS? In other words, how to
compile prec.c successfully?

OS: Mac OS X 10.4
arm-elf-gcc: 4.2 SVN branch
arm-elf-binutils: 2.18

Thanks for any idea,
Boris Dušek

Paul Pluzhnikov

unread,
Oct 22, 2007, 10:20:22 AM10/22/07
to
=?utf-8?B?Qm9yaXMgRHXFoWVr?= <boris...@gmail.com> writes:

> How to get rid of the "crt0.o" requirement?

Use '-nostdlib'

> Or how to get the crt0.o for an environment without a C library and OS?

echo "static int unused;" | arm-elf-gcc -march=armv5 -mno-thumb -o crt0.o -xc -

Cheers,
--
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.

Boris Dušek

unread,
Oct 22, 2007, 2:36:37 PM10/22/07
to
On Oct 22, 4:20 pm, Paul Pluzhnikov <ppluzhnikov-...@charter.net>
wrote:

> =?utf-8?B?Qm9yaXMgRHXFoWVr?= <boris.du...@gmail.com> writes:
> > How to get rid of the "crt0.o" requirement?
>
> Use '-nostdlib'

Thanks, this got me started, to make it really work I needed 2
additional steps:
1. link libgcc.a, since software division routines present there are
used, but libgcc.a is apparently excluded when "-nostdlib" is
specified
2. tell linker that the entry point is not "_start", but
"main" ("_start" is apparently in the crt0.o or similar stdlib object
file)

So the final command-line looked the following way:
arm-elf-gcc -march=armv5 -g0 -mno-thumb -O1 -ffreestanding -nostdlib -
o prec prec.c -Wl,--entry=main `arm-elf-gcc -print-libgcc-file-name`

Thanks once again,
Boris

42Bastian Schick

unread,
Oct 24, 2007, 1:43:34 AM10/24/07
to
On Mon, 22 Oct 2007 09:04:38 -0000, =?utf-8?B?Qm9yaXMgRHXFoWVr?=
<boris...@gmail.com> wrote:

>Hi,
>
>I compiled gcc for target arm-elf. I can't use a standard C library
>(and an OS as well), since the target machine is only a User-mode ARM
>emulator.
>
>I get trouble with arm-elf-gcc requiring crt0.o:


Use -nostartfiles rather than -nostdlib.
Anyway you should write your own startup to clear BSS.
--
42Bastian
Do not email to bast...@yahoo.com, it's a spam-only account :-)
Use <same-name>@monlynx.de instead !

abhishek kole

unread,
Apr 20, 2023, 10:29:07 PM4/20/23
to
Hello ,
I facing Below error .Please help me with it

d:/nxp/s32ds.3.4/s32ds/build_tools/gcc_v6.3/gcc-6.3-arm32-eabi/bin/../lib/gcc/arm-none-eabi/6.3.1/../../../../arm-none-eabi/bin/real-ld.exe: cannot find crt0.o: No such file or directory

what should I do?

.I am using S32K144 MCU .and I am using GNU compiler for it .

abhishek kole

unread,
Apr 20, 2023, 10:29:28 PM4/20/23
to
0 new messages