From a0ee49ec60f8a2a54e9991ef37501f62cfb07bdd Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Thu, 11 Jan 2018 20:56:34 +0100 Subject: [PATCH] crt: Use onexit table functions for atexit implementation. Signed-off-by: Jacek Caban --- mingw-w64-crt/Makefile.am | 2 +- mingw-w64-crt/Makefile.in | 98 +++++------------------------------- mingw-w64-crt/crt/atonexit.c | 60 ---------------------- mingw-w64-crt/crt/crtdll.c | 29 +++-------- mingw-w64-crt/crt/crtexe.c | 9 ++-- 5 files changed, 27 insertions(+), 171 deletions(-) delete mode 100644 mingw-w64-crt/crt/atonexit.c diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am index a9600196e..62ac1dbc3 100644 --- a/mingw-w64-crt/Makefile.am +++ b/mingw-w64-crt/Makefile.am @@ -111,7 +111,7 @@ src_libportabledeviceguids=libsrc/portabledeviceguids.c src_libtaskschd=libsrc/taskschd.c src_libmingw32=include/oscalls.h include/internal.h include/sect_attribs.h \ - crt/atonexit.c crt/crt0_c.c crt/dll_argv.c crt/gccmain.c crt/natstart.c crt/pseudo-reloc-list.c crt/wildcard.c \ + crt/crt0_c.c crt/dll_argv.c crt/gccmain.c crt/natstart.c crt/pseudo-reloc-list.c crt/wildcard.c \ crt/charmax.c crt/crt0_w.c crt/dllargv.c crt/gs_support.c crt/_newmode.c crt/tlssup.c crt/xncommod.c \ crt/cinitexe.c crt/crt0_w.c crt/merr.c crt/pesect.c crt/udllargc.c crt/xthdloc.c crt/CRT_fp10.c \ crt/mingw_custom.c crt/mingw_helpers.c \ diff --git a/mingw-w64-crt/Makefile.in b/mingw-w64-crt/Makefile.in index 17c9eca4f..feda6e4bc 100644 --- a/mingw-w64-crt/Makefile.in +++ b/mingw-w64-crt/Makefile.in @@ -570,8 +570,8 @@ lib32_libmfuuid_a_OBJECTS = $(am_lib32_libmfuuid_a_OBJECTS) lib32_libmingw32_a_AR = $(AR) $(ARFLAGS) lib32_libmingw32_a_LIBADD = am__lib32_libmingw32_a_SOURCES_DIST = include/oscalls.h \ - include/internal.h include/sect_attribs.h crt/atonexit.c \ - crt/crt0_c.c crt/dll_argv.c crt/gccmain.c crt/natstart.c \ + include/internal.h include/sect_attribs.h crt/crt0_c.c \ + crt/dll_argv.c crt/gccmain.c crt/natstart.c \ crt/pseudo-reloc-list.c crt/wildcard.c crt/charmax.c \ crt/crt0_w.c crt/dllargv.c crt/gs_support.c crt/_newmode.c \ crt/tlssup.c crt/xncommod.c crt/cinitexe.c crt/merr.c \ @@ -579,8 +579,7 @@ am__lib32_libmingw32_a_SOURCES_DIST = include/oscalls.h \ crt/mingw_custom.c crt/mingw_helpers.c crt/pseudo-reloc.c \ crt/udll_argv.c crt/xtxtmode.c crt/crt_handler.c crt/tlsthrd.c \ crt/tlsmthread.c crt/tlsmcrt.c -am__objects_18 = crt/lib32_libmingw32_a-atonexit.$(OBJEXT) \ - crt/lib32_libmingw32_a-crt0_c.$(OBJEXT) \ +am__objects_18 = crt/lib32_libmingw32_a-crt0_c.$(OBJEXT) \ crt/lib32_libmingw32_a-dll_argv.$(OBJEXT) \ crt/lib32_libmingw32_a-gccmain.$(OBJEXT) \ crt/lib32_libmingw32_a-natstart.$(OBJEXT) \ @@ -1846,8 +1845,8 @@ lib64_libmfuuid_a_OBJECTS = $(am_lib64_libmfuuid_a_OBJECTS) lib64_libmingw32_a_AR = $(AR) $(ARFLAGS) lib64_libmingw32_a_LIBADD = am__lib64_libmingw32_a_SOURCES_DIST = include/oscalls.h \ - include/internal.h include/sect_attribs.h crt/atonexit.c \ - crt/crt0_c.c crt/dll_argv.c crt/gccmain.c crt/natstart.c \ + include/internal.h include/sect_attribs.h crt/crt0_c.c \ + crt/dll_argv.c crt/gccmain.c crt/natstart.c \ crt/pseudo-reloc-list.c crt/wildcard.c crt/charmax.c \ crt/crt0_w.c crt/dllargv.c crt/gs_support.c crt/_newmode.c \ crt/tlssup.c crt/xncommod.c crt/cinitexe.c crt/merr.c \ @@ -1855,8 +1854,7 @@ am__lib64_libmingw32_a_SOURCES_DIST = include/oscalls.h \ crt/mingw_custom.c crt/mingw_helpers.c crt/pseudo-reloc.c \ crt/udll_argv.c crt/xtxtmode.c crt/crt_handler.c crt/tlsthrd.c \ crt/tlsmthread.c crt/tlsmcrt.c -am__objects_67 = crt/lib64_libmingw32_a-atonexit.$(OBJEXT) \ - crt/lib64_libmingw32_a-crt0_c.$(OBJEXT) \ +am__objects_67 = crt/lib64_libmingw32_a-crt0_c.$(OBJEXT) \ crt/lib64_libmingw32_a-dll_argv.$(OBJEXT) \ crt/lib64_libmingw32_a-gccmain.$(OBJEXT) \ crt/lib64_libmingw32_a-natstart.$(OBJEXT) \ @@ -3054,8 +3052,8 @@ libarm32_libmfuuid_a_OBJECTS = $(am_libarm32_libmfuuid_a_OBJECTS) libarm32_libmingw32_a_AR = $(AR) $(ARFLAGS) libarm32_libmingw32_a_LIBADD = am__libarm32_libmingw32_a_SOURCES_DIST = include/oscalls.h \ - include/internal.h include/sect_attribs.h crt/atonexit.c \ - crt/crt0_c.c crt/dll_argv.c crt/gccmain.c crt/natstart.c \ + include/internal.h include/sect_attribs.h crt/crt0_c.c \ + crt/dll_argv.c crt/gccmain.c crt/natstart.c \ crt/pseudo-reloc-list.c crt/wildcard.c crt/charmax.c \ crt/crt0_w.c crt/dllargv.c crt/gs_support.c crt/_newmode.c \ crt/tlssup.c crt/xncommod.c crt/cinitexe.c crt/merr.c \ @@ -3063,8 +3061,7 @@ am__libarm32_libmingw32_a_SOURCES_DIST = include/oscalls.h \ crt/mingw_custom.c crt/mingw_helpers.c crt/pseudo-reloc.c \ crt/udll_argv.c crt/xtxtmode.c crt/crt_handler.c crt/tlsthrd.c \ crt/tlsmthread.c crt/tlsmcrt.c -am__objects_113 = crt/libarm32_libmingw32_a-atonexit.$(OBJEXT) \ - crt/libarm32_libmingw32_a-crt0_c.$(OBJEXT) \ +am__objects_113 = crt/libarm32_libmingw32_a-crt0_c.$(OBJEXT) \ crt/libarm32_libmingw32_a-dll_argv.$(OBJEXT) \ crt/libarm32_libmingw32_a-gccmain.$(OBJEXT) \ crt/libarm32_libmingw32_a-natstart.$(OBJEXT) \ @@ -4220,8 +4217,8 @@ libarm64_libmfuuid_a_OBJECTS = $(am_libarm64_libmfuuid_a_OBJECTS) libarm64_libmingw32_a_AR = $(AR) $(ARFLAGS) libarm64_libmingw32_a_LIBADD = am__libarm64_libmingw32_a_SOURCES_DIST = include/oscalls.h \ - include/internal.h include/sect_attribs.h crt/atonexit.c \ - crt/crt0_c.c crt/dll_argv.c crt/gccmain.c crt/natstart.c \ + include/internal.h include/sect_attribs.h crt/crt0_c.c \ + crt/dll_argv.c crt/gccmain.c crt/natstart.c \ crt/pseudo-reloc-list.c crt/wildcard.c crt/charmax.c \ crt/crt0_w.c crt/dllargv.c crt/gs_support.c crt/_newmode.c \ crt/tlssup.c crt/xncommod.c crt/cinitexe.c crt/merr.c \ @@ -4229,8 +4226,7 @@ am__libarm64_libmingw32_a_SOURCES_DIST = include/oscalls.h \ crt/mingw_custom.c crt/mingw_helpers.c crt/pseudo-reloc.c \ crt/udll_argv.c crt/xtxtmode.c crt/crt_handler.c crt/tlsthrd.c \ crt/tlsmthread.c crt/tlsmcrt.c -am__objects_151 = crt/libarm64_libmingw32_a-atonexit.$(OBJEXT) \ - crt/libarm64_libmingw32_a-crt0_c.$(OBJEXT) \ +am__objects_151 = crt/libarm64_libmingw32_a-crt0_c.$(OBJEXT) \ crt/libarm64_libmingw32_a-dll_argv.$(OBJEXT) \ crt/libarm64_libmingw32_a-gccmain.$(OBJEXT) \ crt/libarm64_libmingw32_a-natstart.$(OBJEXT) \ @@ -6643,7 +6639,7 @@ src_libsensorsapi = libsrc/sensorsapi.c src_libportabledeviceguids = libsrc/portabledeviceguids.c src_libtaskschd = libsrc/taskschd.c src_libmingw32 = include/oscalls.h include/internal.h include/sect_attribs.h \ - crt/atonexit.c crt/crt0_c.c crt/dll_argv.c crt/gccmain.c crt/natstart.c crt/pseudo-reloc-list.c crt/wildcard.c \ + crt/crt0_c.c crt/dll_argv.c crt/gccmain.c crt/natstart.c crt/pseudo-reloc-list.c crt/wildcard.c \ crt/charmax.c crt/crt0_w.c crt/dllargv.c crt/gs_support.c crt/_newmode.c crt/tlssup.c crt/xncommod.c \ crt/cinitexe.c crt/crt0_w.c crt/merr.c crt/pesect.c crt/udllargc.c crt/xthdloc.c crt/CRT_fp10.c \ crt/mingw_custom.c crt/mingw_helpers.c \ @@ -9696,8 +9692,6 @@ crt/$(am__dirstamp): crt/$(DEPDIR)/$(am__dirstamp): @$(MKDIR_P) crt/$(DEPDIR) @: > crt/$(DEPDIR)/$(am__dirstamp) -crt/lib32_libmingw32_a-atonexit.$(OBJEXT): crt/$(am__dirstamp) \ - crt/$(DEPDIR)/$(am__dirstamp) crt/lib32_libmingw32_a-crt0_c.$(OBJEXT): crt/$(am__dirstamp) \ crt/$(DEPDIR)/$(am__dirstamp) crt/lib32_libmingw32_a-dll_argv.$(OBJEXT): crt/$(am__dirstamp) \ @@ -11510,8 +11504,6 @@ lib64/libmfuuid.a: $(lib64_libmfuuid_a_OBJECTS) $(lib64_libmfuuid_a_DEPENDENCIES $(AM_V_at)-rm -f lib64/libmfuuid.a $(AM_V_AR)$(lib64_libmfuuid_a_AR) lib64/libmfuuid.a $(lib64_libmfuuid_a_OBJECTS) $(lib64_libmfuuid_a_LIBADD) $(AM_V_at)$(RANLIB) lib64/libmfuuid.a -crt/lib64_libmingw32_a-atonexit.$(OBJEXT): crt/$(am__dirstamp) \ - crt/$(DEPDIR)/$(am__dirstamp) crt/lib64_libmingw32_a-crt0_c.$(OBJEXT): crt/$(am__dirstamp) \ crt/$(DEPDIR)/$(am__dirstamp) crt/lib64_libmingw32_a-dll_argv.$(OBJEXT): crt/$(am__dirstamp) \ @@ -13178,8 +13170,6 @@ libarm32/libmfuuid.a: $(libarm32_libmfuuid_a_OBJECTS) $(libarm32_libmfuuid_a_DEP $(AM_V_at)-rm -f libarm32/libmfuuid.a $(AM_V_AR)$(libarm32_libmfuuid_a_AR) libarm32/libmfuuid.a $(libarm32_libmfuuid_a_OBJECTS) $(libarm32_libmfuuid_a_LIBADD) $(AM_V_at)$(RANLIB) libarm32/libmfuuid.a -crt/libarm32_libmingw32_a-atonexit.$(OBJEXT): crt/$(am__dirstamp) \ - crt/$(DEPDIR)/$(am__dirstamp) crt/libarm32_libmingw32_a-crt0_c.$(OBJEXT): crt/$(am__dirstamp) \ crt/$(DEPDIR)/$(am__dirstamp) crt/libarm32_libmingw32_a-dll_argv.$(OBJEXT): crt/$(am__dirstamp) \ @@ -14864,8 +14854,6 @@ libarm64/libmfuuid.a: $(libarm64_libmfuuid_a_OBJECTS) $(libarm64_libmfuuid_a_DEP $(AM_V_at)-rm -f libarm64/libmfuuid.a $(AM_V_AR)$(libarm64_libmfuuid_a_AR) libarm64/libmfuuid.a $(libarm64_libmfuuid_a_OBJECTS) $(libarm64_libmfuuid_a_LIBADD) $(AM_V_at)$(RANLIB) libarm64/libmfuuid.a -crt/libarm64_libmingw32_a-atonexit.$(OBJEXT): crt/$(am__dirstamp) \ - crt/$(DEPDIR)/$(am__dirstamp) crt/libarm64_libmingw32_a-crt0_c.$(OBJEXT): crt/$(am__dirstamp) \ crt/$(DEPDIR)/$(am__dirstamp) crt/libarm64_libmingw32_a-dll_argv.$(OBJEXT): crt/$(am__dirstamp) \ @@ -17262,7 +17250,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@complex/$(DEPDIR)/libarm64_libmingwex_a-ctanl.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/lib32_libmingw32_a-CRT_fp10.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/lib32_libmingw32_a-_newmode.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/lib32_libmingw32_a-atonexit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/lib32_libmingw32_a-charmax.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/lib32_libmingw32_a-cinitexe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/lib32_libmingw32_a-crt0_c.Po@am__quote@ @@ -17294,7 +17281,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/lib32_libucrtbase_a-ucrtbase_compat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/lib64_libmingw32_a-CRT_fp10.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/lib64_libmingw32_a-_newmode.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/lib64_libmingw32_a-atonexit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/lib64_libmingw32_a-charmax.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/lib64_libmingw32_a-cinitexe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/lib64_libmingw32_a-crt0_c.Po@am__quote@ @@ -17326,7 +17312,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/lib64_libucrtbase_a-ucrtbase_compat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/libarm32_libmingw32_a-CRT_fp10.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/libarm32_libmingw32_a-_newmode.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/libarm32_libmingw32_a-atonexit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/libarm32_libmingw32_a-charmax.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/libarm32_libmingw32_a-cinitexe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/libarm32_libmingw32_a-crt0_c.Po@am__quote@ @@ -17358,7 +17343,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/libarm32_libucrtbase_a-ucrtbase_compat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/libarm64_libmingw32_a-CRT_fp10.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/libarm64_libmingw32_a-_newmode.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/libarm64_libmingw32_a-atonexit.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/libarm64_libmingw32_a-charmax.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/libarm64_libmingw32_a-cinitexe.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@crt/$(DEPDIR)/libarm64_libmingw32_a-crt0_c.Po@am__quote@ @@ -23461,20 +23445,6 @@ libsrc/lib32_libmfuuid_a-mfuuid.obj: libsrc/mfuuid.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib32_libmfuuid_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsrc/lib32_libmfuuid_a-mfuuid.obj `if test -f 'libsrc/mfuuid.c'; then $(CYGPATH_W) 'libsrc/mfuuid.c'; else $(CYGPATH_W) '$(srcdir)/libsrc/mfuuid.c'; fi` -crt/lib32_libmingw32_a-atonexit.o: crt/atonexit.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib32_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crt/lib32_libmingw32_a-atonexit.o -MD -MP -MF crt/$(DEPDIR)/lib32_libmingw32_a-atonexit.Tpo -c -o crt/lib32_libmingw32_a-atonexit.o `test -f 'crt/atonexit.c' || echo '$(srcdir)/'`crt/atonexit.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crt/$(DEPDIR)/lib32_libmingw32_a-atonexit.Tpo crt/$(DEPDIR)/lib32_libmingw32_a-atonexit.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crt/atonexit.c' object='crt/lib32_libmingw32_a-atonexit.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib32_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o crt/lib32_libmingw32_a-atonexit.o `test -f 'crt/atonexit.c' || echo '$(srcdir)/'`crt/atonexit.c - -crt/lib32_libmingw32_a-atonexit.obj: crt/atonexit.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib32_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crt/lib32_libmingw32_a-atonexit.obj -MD -MP -MF crt/$(DEPDIR)/lib32_libmingw32_a-atonexit.Tpo -c -o crt/lib32_libmingw32_a-atonexit.obj `if test -f 'crt/atonexit.c'; then $(CYGPATH_W) 'crt/atonexit.c'; else $(CYGPATH_W) '$(srcdir)/crt/atonexit.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crt/$(DEPDIR)/lib32_libmingw32_a-atonexit.Tpo crt/$(DEPDIR)/lib32_libmingw32_a-atonexit.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crt/atonexit.c' object='crt/lib32_libmingw32_a-atonexit.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib32_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o crt/lib32_libmingw32_a-atonexit.obj `if test -f 'crt/atonexit.c'; then $(CYGPATH_W) 'crt/atonexit.c'; else $(CYGPATH_W) '$(srcdir)/crt/atonexit.c'; fi` - crt/lib32_libmingw32_a-crt0_c.o: crt/crt0_c.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib32_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crt/lib32_libmingw32_a-crt0_c.o -MD -MP -MF crt/$(DEPDIR)/lib32_libmingw32_a-crt0_c.Tpo -c -o crt/lib32_libmingw32_a-crt0_c.o `test -f 'crt/crt0_c.c' || echo '$(srcdir)/'`crt/crt0_c.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crt/$(DEPDIR)/lib32_libmingw32_a-crt0_c.Tpo crt/$(DEPDIR)/lib32_libmingw32_a-crt0_c.Po @@ -33331,20 +33301,6 @@ libsrc/lib64_libmfuuid_a-mfuuid.obj: libsrc/mfuuid.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib64_libmfuuid_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsrc/lib64_libmfuuid_a-mfuuid.obj `if test -f 'libsrc/mfuuid.c'; then $(CYGPATH_W) 'libsrc/mfuuid.c'; else $(CYGPATH_W) '$(srcdir)/libsrc/mfuuid.c'; fi` -crt/lib64_libmingw32_a-atonexit.o: crt/atonexit.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib64_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crt/lib64_libmingw32_a-atonexit.o -MD -MP -MF crt/$(DEPDIR)/lib64_libmingw32_a-atonexit.Tpo -c -o crt/lib64_libmingw32_a-atonexit.o `test -f 'crt/atonexit.c' || echo '$(srcdir)/'`crt/atonexit.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crt/$(DEPDIR)/lib64_libmingw32_a-atonexit.Tpo crt/$(DEPDIR)/lib64_libmingw32_a-atonexit.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crt/atonexit.c' object='crt/lib64_libmingw32_a-atonexit.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib64_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o crt/lib64_libmingw32_a-atonexit.o `test -f 'crt/atonexit.c' || echo '$(srcdir)/'`crt/atonexit.c - -crt/lib64_libmingw32_a-atonexit.obj: crt/atonexit.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib64_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crt/lib64_libmingw32_a-atonexit.obj -MD -MP -MF crt/$(DEPDIR)/lib64_libmingw32_a-atonexit.Tpo -c -o crt/lib64_libmingw32_a-atonexit.obj `if test -f 'crt/atonexit.c'; then $(CYGPATH_W) 'crt/atonexit.c'; else $(CYGPATH_W) '$(srcdir)/crt/atonexit.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crt/$(DEPDIR)/lib64_libmingw32_a-atonexit.Tpo crt/$(DEPDIR)/lib64_libmingw32_a-atonexit.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crt/atonexit.c' object='crt/lib64_libmingw32_a-atonexit.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib64_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o crt/lib64_libmingw32_a-atonexit.obj `if test -f 'crt/atonexit.c'; then $(CYGPATH_W) 'crt/atonexit.c'; else $(CYGPATH_W) '$(srcdir)/crt/atonexit.c'; fi` - crt/lib64_libmingw32_a-crt0_c.o: crt/crt0_c.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(lib64_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crt/lib64_libmingw32_a-crt0_c.o -MD -MP -MF crt/$(DEPDIR)/lib64_libmingw32_a-crt0_c.Tpo -c -o crt/lib64_libmingw32_a-crt0_c.o `test -f 'crt/crt0_c.c' || echo '$(srcdir)/'`crt/crt0_c.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crt/$(DEPDIR)/lib64_libmingw32_a-crt0_c.Tpo crt/$(DEPDIR)/lib64_libmingw32_a-crt0_c.Po @@ -42669,20 +42625,6 @@ libsrc/libarm32_libmfuuid_a-mfuuid.obj: libsrc/mfuuid.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarm32_libmfuuid_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsrc/libarm32_libmfuuid_a-mfuuid.obj `if test -f 'libsrc/mfuuid.c'; then $(CYGPATH_W) 'libsrc/mfuuid.c'; else $(CYGPATH_W) '$(srcdir)/libsrc/mfuuid.c'; fi` -crt/libarm32_libmingw32_a-atonexit.o: crt/atonexit.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarm32_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crt/libarm32_libmingw32_a-atonexit.o -MD -MP -MF crt/$(DEPDIR)/libarm32_libmingw32_a-atonexit.Tpo -c -o crt/libarm32_libmingw32_a-atonexit.o `test -f 'crt/atonexit.c' || echo '$(srcdir)/'`crt/atonexit.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crt/$(DEPDIR)/libarm32_libmingw32_a-atonexit.Tpo crt/$(DEPDIR)/libarm32_libmingw32_a-atonexit.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crt/atonexit.c' object='crt/libarm32_libmingw32_a-atonexit.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarm32_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o crt/libarm32_libmingw32_a-atonexit.o `test -f 'crt/atonexit.c' || echo '$(srcdir)/'`crt/atonexit.c - -crt/libarm32_libmingw32_a-atonexit.obj: crt/atonexit.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarm32_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crt/libarm32_libmingw32_a-atonexit.obj -MD -MP -MF crt/$(DEPDIR)/libarm32_libmingw32_a-atonexit.Tpo -c -o crt/libarm32_libmingw32_a-atonexit.obj `if test -f 'crt/atonexit.c'; then $(CYGPATH_W) 'crt/atonexit.c'; else $(CYGPATH_W) '$(srcdir)/crt/atonexit.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crt/$(DEPDIR)/libarm32_libmingw32_a-atonexit.Tpo crt/$(DEPDIR)/libarm32_libmingw32_a-atonexit.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crt/atonexit.c' object='crt/libarm32_libmingw32_a-atonexit.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarm32_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o crt/libarm32_libmingw32_a-atonexit.obj `if test -f 'crt/atonexit.c'; then $(CYGPATH_W) 'crt/atonexit.c'; else $(CYGPATH_W) '$(srcdir)/crt/atonexit.c'; fi` - crt/libarm32_libmingw32_a-crt0_c.o: crt/crt0_c.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarm32_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crt/libarm32_libmingw32_a-crt0_c.o -MD -MP -MF crt/$(DEPDIR)/libarm32_libmingw32_a-crt0_c.Tpo -c -o crt/libarm32_libmingw32_a-crt0_c.o `test -f 'crt/crt0_c.c' || echo '$(srcdir)/'`crt/crt0_c.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crt/$(DEPDIR)/libarm32_libmingw32_a-crt0_c.Tpo crt/$(DEPDIR)/libarm32_libmingw32_a-crt0_c.Po @@ -52217,20 +52159,6 @@ libsrc/libarm64_libmfuuid_a-mfuuid.obj: libsrc/mfuuid.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarm64_libmfuuid_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsrc/libarm64_libmfuuid_a-mfuuid.obj `if test -f 'libsrc/mfuuid.c'; then $(CYGPATH_W) 'libsrc/mfuuid.c'; else $(CYGPATH_W) '$(srcdir)/libsrc/mfuuid.c'; fi` -crt/libarm64_libmingw32_a-atonexit.o: crt/atonexit.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarm64_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crt/libarm64_libmingw32_a-atonexit.o -MD -MP -MF crt/$(DEPDIR)/libarm64_libmingw32_a-atonexit.Tpo -c -o crt/libarm64_libmingw32_a-atonexit.o `test -f 'crt/atonexit.c' || echo '$(srcdir)/'`crt/atonexit.c -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crt/$(DEPDIR)/libarm64_libmingw32_a-atonexit.Tpo crt/$(DEPDIR)/libarm64_libmingw32_a-atonexit.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crt/atonexit.c' object='crt/libarm64_libmingw32_a-atonexit.o' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarm64_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o crt/libarm64_libmingw32_a-atonexit.o `test -f 'crt/atonexit.c' || echo '$(srcdir)/'`crt/atonexit.c - -crt/libarm64_libmingw32_a-atonexit.obj: crt/atonexit.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarm64_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crt/libarm64_libmingw32_a-atonexit.obj -MD -MP -MF crt/$(DEPDIR)/libarm64_libmingw32_a-atonexit.Tpo -c -o crt/libarm64_libmingw32_a-atonexit.obj `if test -f 'crt/atonexit.c'; then $(CYGPATH_W) 'crt/atonexit.c'; else $(CYGPATH_W) '$(srcdir)/crt/atonexit.c'; fi` -@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crt/$(DEPDIR)/libarm64_libmingw32_a-atonexit.Tpo crt/$(DEPDIR)/libarm64_libmingw32_a-atonexit.Po -@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='crt/atonexit.c' object='crt/libarm64_libmingw32_a-atonexit.obj' libtool=no @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarm64_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o crt/libarm64_libmingw32_a-atonexit.obj `if test -f 'crt/atonexit.c'; then $(CYGPATH_W) 'crt/atonexit.c'; else $(CYGPATH_W) '$(srcdir)/crt/atonexit.c'; fi` - crt/libarm64_libmingw32_a-crt0_c.o: crt/crt0_c.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libarm64_libmingw32_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT crt/libarm64_libmingw32_a-crt0_c.o -MD -MP -MF crt/$(DEPDIR)/libarm64_libmingw32_a-crt0_c.Tpo -c -o crt/libarm64_libmingw32_a-crt0_c.o `test -f 'crt/crt0_c.c' || echo '$(srcdir)/'`crt/crt0_c.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) crt/$(DEPDIR)/libarm64_libmingw32_a-crt0_c.Tpo crt/$(DEPDIR)/libarm64_libmingw32_a-crt0_c.Po diff --git a/mingw-w64-crt/crt/atonexit.c b/mingw-w64-crt/crt/atonexit.c deleted file mode 100644 index daf0cd064..000000000 --- a/mingw-w64-crt/crt/atonexit.c +++ /dev/null @@ -1,60 +0,0 @@ -/** - * This file has no copyright assigned and is placed in the Public Domain. - * This file is part of the mingw-w64 runtime package. - * No warranty is given; refer to the file DISCLAIMER.PD within this package. - */ - -#undef CRTDLL -#ifndef _DLL -#define _DLL -#endif - -#include -#include -#include -#include -#include -#include -#include - -#define _EXIT_LOCK1 8 - - void __cdecl _lock (int _File); - void __cdecl _unlock (int _File); - -_PVFV *__onexitbegin; -_PVFV *__onexitend; - -extern _CRTIMP _onexit_t __dllonexit (_onexit_t, _PVFV**, _PVFV**); -extern _onexit_t (__cdecl * __MINGW_IMP_SYMBOL(_onexit)) (_onexit_t func); - -/* Choose a different name to prevent name conflicts. The CRT one works fine. */ -_onexit_t __cdecl mingw_onexit(_onexit_t func); - -_onexit_t __cdecl mingw_onexit(_onexit_t func) -{ - _PVFV *onexitbegin; - _PVFV *onexitend; - _onexit_t retval; - - onexitbegin = (_PVFV *) _decode_pointer (__onexitbegin); - - if (onexitbegin == (_PVFV *) -1) - return (* __MINGW_IMP_SYMBOL(_onexit)) (func); - _lock (_EXIT_LOCK1); - onexitbegin = (_PVFV *) _decode_pointer (__onexitbegin); - onexitend = (_PVFV *) _decode_pointer (__onexitend); - - retval = __dllonexit (func, &onexitbegin, &onexitend); - - __onexitbegin = (_PVFV *) _encode_pointer (onexitbegin); - __onexitend = (_PVFV *) _encode_pointer (onexitend); - _unlock (_EXIT_LOCK1); - return retval; -} - -int __cdecl -atexit (_PVFV func) -{ - return (mingw_onexit((_onexit_t)func) == NULL) ? -1 : 0; -} diff --git a/mingw-w64-crt/crt/crtdll.c b/mingw-w64-crt/crt/crtdll.c index 77ebecc7e..50a9eb4fe 100644 --- a/mingw-w64-crt/crt/crtdll.c +++ b/mingw-w64-crt/crt/crtdll.c @@ -52,8 +52,7 @@ extern const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback; static int __proc_attached = 0; -extern _PVFV *__onexitbegin; -extern _PVFV *__onexitend; +static _onexit_table_t atexit_table; extern int mingw_app_type; @@ -68,15 +67,7 @@ _CRTALLOC(".CRT$XIAA") _PIFV pcinit = pre_c_init; static int pre_c_init (void) { - _PVFV *onexitbegin; - - onexitbegin = (_PVFV *) malloc (32 * sizeof (_PVFV)); - __onexitend = __onexitbegin = (_PVFV *) _encode_pointer (onexitbegin); - - if (onexitbegin == NULL) - return 1; - *onexitbegin = (_PVFV) NULL; - return 0; + return _initialize_onexit_table(&atexit_table); } WINBOOL WINAPI _CRT_INIT (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) @@ -142,16 +133,7 @@ WINBOOL WINAPI _CRT_INIT (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) } else { - _PVFV * onexitbegin = (_PVFV *) _decode_pointer (__onexitbegin); - if (onexitbegin) - { - _PVFV *onexitend = (_PVFV *) _decode_pointer (__onexitend); - while (--onexitend >= onexitbegin) - if (*onexitend != NULL) - (**onexitend) (); - free (onexitbegin); - __onexitbegin = __onexitend = (_PVFV *) NULL; - } + _execute_onexit_table(&atexit_table); __native_startup_state = __uninitialized; (void) InterlockedExchangePointer ((volatile PVOID *) &__native_startup_lock, 0); } @@ -223,3 +205,8 @@ __DllMainCRTStartup (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) return retcode ; } #endif + +int __cdecl atexit (_PVFV func) +{ + return _register_onexit_function(&atexit_table, (_onexit_t)func); +} diff --git a/mingw-w64-crt/crt/crtexe.c b/mingw-w64-crt/crt/crtexe.c index 3ee1f9888..4542bfe48 100644 --- a/mingw-w64-crt/crt/crtexe.c +++ b/mingw-w64-crt/crt/crtexe.c @@ -70,9 +70,6 @@ __attribute__ (( __section__ (".dtors.99999"), __used__ , aligned(sizeof(void *) /* TLS initialization hook. */ extern const PIMAGE_TLS_CALLBACK __dyn_tls_init_callback; -extern _PVFV *__onexitbegin; -extern _PVFV *__onexitend; - extern int mingw_app_type; HINSTANCE __mingw_winmain_hInstance; @@ -137,7 +134,6 @@ pre_c_init (void) __set_app_type(_GUI_APP); else __set_app_type (_CONSOLE_APP); - __onexitbegin = __onexitend = (_PVFV *) _encode_pointer ((_PVFV *)(-1)); * __p__fmode() = _fmode; * __MINGW_IMP_SYMBOL(_commode) = _commode; @@ -435,3 +431,8 @@ static void duplicate_ppstrings (int ac, char ***av) *av = n; } #endif + +int __cdecl atexit (_PVFV func) +{ + return _onexit((_onexit_t)func) ? 0 : -1; +}