* 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.