This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: where is the source code generate crtbegin.o (i386)?
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: zet <feqin1023 at gmail dot com>
- Cc: gcc at gcc dot gnu dot org
- Date: Sun, 23 Oct 2016 20:58:14 +0200
- Subject: Re: where is the source code generate crtbegin.o (i386)?
- Authentication-results: sourceware.org; auth=none
- References: <CAOfAq_r4ECowgDfDzOLftWkWJ0erhYXWSZ8-CZaEvFUcr6Rkwg@mail.gmail.com>
* zet:
> Hello, all
>
> where is the source code which generate crtbegin.o (i386)?
>
> gcc-6.2.0-source/libgcc/config/i386 only have ctr1.S/crtn.S, where is
> the others(crtbegin/crtend/crt1, etc)?
See libgcc/Makefile.in:
ifeq ($(CUSTOM_CRTSTUFF),)
# Compile two additional files that are linked with every program
# linked using GCC on systems using COFF or ELF, for the sake of C++
# constructors.
crtbegin$(objext): $(srcdir)/crtstuff.c
$(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_BEGIN
crtend$(objext): $(srcdir)/crtstuff.c
$(crt_compile) $(CRTSTUFF_T_CFLAGS) -c $< -DCRT_END
And so on. libgcc/crtstuff.c is compiled multiple times to yield
different object files.