[Mingw-users] Sources of crt*.o

Back to archive index
Keith Marshall keith****@users*****
Sat Dec 22 03:16:48 JST 2018


On 21/12/18 16:13, Eli Zaretskii wrote:
> MinGW GCC comes with several object files that are used when linking a
> MinGW program: crt1.o, crt2.o, crtbegin.o, and crtend.o.  However, in
> the MinGW source distribution I find only the source of one of them:
> crt1.c.  Can someone tell me where are the sources of the rest?

Only the first two of these are provided directly by us; from their
respective dependency listings:

  $ head -1 mingwrt/crt[12].d
  ==> mingwrt/crt1.d <==
  crt1.o: ../../mingwrt/crt1.c ...

  ==> mingwrt/crt2.d <==
  crt2.o: ../../mingwrt/crt1.c ...

The other two are provided by the upstream GCC Project folks; you'll
find their sources in the GCC source tarball:

  $ head -1 mingw32/libgcc/crt*.dep
  ==> mingw32/libgcc/crtbegin.dep <==
  crtbegin.o: .../gcc-8.2.0/libgcc/config/i386/cygming-crtbegin.c \

  ==> mingw32/libgcc/crtend.dep <==
  crtend.o: .../gcc-8.2.0/libgcc/config/i386/cygming-crtend.c \

  ==> mingw32/libgcc/crtfastmath.dep <==
  crtfastmath.o: .../gcc-8.2.0/libgcc/config/i386/crtfastmath.c \


> I'm asking because about every MinGW program I compile has 2
> unresolved symbols: ___register_frame_info and
> ___deregister_frame_info, and those seem to come from crtbegin.o, so
> I'd like to look at the source of that to better understand what are
> those symbols and why they stay unresolved.

Both seem to be defined, as weak symbols, in crtbegin.o:

  $ nm gcc/crtbegin.o
           U _atexit
  00000000 b .bss
  00000000 d .data
  00000000 d _deregister_frame_fn
           w ___deregister_frame_info
  00000000 i .drectve
  00000000 r .eh_frame
  00000000 R ___EH_FRAME_BEGIN__
           U _FreeLibrary at 4
  000000b0 T ___gcc_deregister_frame
  00000000 T ___gcc_register_frame
           U _GetModuleHandleA at 4
           U _GetProcAddress at 8
  00000004 C _hmod_libgcc
           U _LoadLibraryA at 4
  00000000 b _obj
  00000000 r .rdata
  00000000 r .rdata$zzz
           w ___register_frame_info
  00000000 t .text
  00000000 A .weak.___deregister_frame_info.___EH_FRAME_BEGIN__
  00000000 A .weak.___register_frame_info.___EH_FRAME_BEGIN__

-- 
Regards,
Keith.

Public key available from keys.gnupg.net
Key fingerprint: C19E C018 1547 DE50 E1D4 8F53 C0AD 36C6 347E 5A3F

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <https://lists.osdn.me/mailman/archives/mingw-users/attachments/20181221/8c5b5c66/attachment.sig>


More information about the MinGW-Users mailing list
Back to archive index