diff options
| author | Andrew Kelley <andrew@ziglang.org> | 2019-07-10 17:28:22 -0400 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2019-07-10 17:41:34 -0400 |
| commit | 2bb93784c6d4a629e6b671c7b02e74be0d624111 (patch) | |
| tree | e2df23bfef32fd988bbe945850934d51faf580cf /src/link.cpp | |
| parent | 67f3bc9101957a414550ea192918da6174a2fcd2 (diff) | |
| download | zig-2bb93784c6d4a629e6b671c7b02e74be0d624111.tar.gz zig-2bb93784c6d4a629e6b671c7b02e74be0d624111.zip | |
mingw: build and link mingwex.lib
zig can now cross compile hello.c targeting windows
Diffstat (limited to 'src/link.cpp')
| -rw-r--r-- | src/link.cpp | 659 |
1 files changed, 591 insertions, 68 deletions
diff --git a/src/link.cpp b/src/link.cpp index 526f9e07f1..59d6b56ada 100644 --- a/src/link.cpp +++ b/src/link.cpp @@ -13,6 +13,543 @@ #include "install_files.h" #include "glibc.hpp" +static const char *msvcrt_common_src[] = { + "misc" OS_SEP "onexit_table.c", + "misc" OS_SEP "register_tls_atexit.c", + "stdio" OS_SEP "acrt_iob_func.c", + "misc" OS_SEP "_configthreadlocale.c", + "misc" OS_SEP "_get_current_locale.c", + "misc" OS_SEP "invalid_parameter_handler.c", + "misc" OS_SEP "output_format.c", + "misc" OS_SEP "purecall.c", + "secapi" OS_SEP "_access_s.c", + "secapi" OS_SEP "_cgets_s.c", + "secapi" OS_SEP "_cgetws_s.c", + "secapi" OS_SEP "_chsize_s.c", + "secapi" OS_SEP "_controlfp_s.c", + "secapi" OS_SEP "_cprintf_s.c", + "secapi" OS_SEP "_cprintf_s_l.c", + "secapi" OS_SEP "_ctime32_s.c", + "secapi" OS_SEP "_ctime64_s.c", + "secapi" OS_SEP "_cwprintf_s.c", + "secapi" OS_SEP "_cwprintf_s_l.c", + "secapi" OS_SEP "_gmtime32_s.c", + "secapi" OS_SEP "_gmtime64_s.c", + "secapi" OS_SEP "_localtime32_s.c", + "secapi" OS_SEP "_localtime64_s.c", + "secapi" OS_SEP "_mktemp_s.c", + "secapi" OS_SEP "_sopen_s.c", + "secapi" OS_SEP "_strdate_s.c", + "secapi" OS_SEP "_strtime_s.c", + "secapi" OS_SEP "_umask_s.c", + "secapi" OS_SEP "_vcprintf_s.c", + "secapi" OS_SEP "_vcprintf_s_l.c", + "secapi" OS_SEP "_vcwprintf_s.c", + "secapi" OS_SEP "_vcwprintf_s_l.c", + "secapi" OS_SEP "_vscprintf_p.c", + "secapi" OS_SEP "_vscwprintf_p.c", + "secapi" OS_SEP "_vswprintf_p.c", + "secapi" OS_SEP "_waccess_s.c", + "secapi" OS_SEP "_wasctime_s.c", + "secapi" OS_SEP "_wctime32_s.c", + "secapi" OS_SEP "_wctime64_s.c", + "secapi" OS_SEP "_wstrtime_s.c", + "secapi" OS_SEP "_wmktemp_s.c", + "secapi" OS_SEP "_wstrdate_s.c", + "secapi" OS_SEP "asctime_s.c", + "secapi" OS_SEP "memcpy_s.c", + "secapi" OS_SEP "memmove_s.c", + "secapi" OS_SEP "rand_s.c", + "secapi" OS_SEP "sprintf_s.c", + "secapi" OS_SEP "strerror_s.c", + "secapi" OS_SEP "vsprintf_s.c", + "secapi" OS_SEP "wmemcpy_s.c", + "secapi" OS_SEP "wmemmove_s.c", + "stdio" OS_SEP "mingw_lock.c", +}; + +static const char *msvcrt_i386_src[] = { + "misc" OS_SEP "lc_locale_func.c", + +}; + +static const char *msvcrt_other_src[] = { + "misc" OS_SEP "__p___argv.c", + "misc" OS_SEP "__p__acmdln.c", + "misc" OS_SEP "__p__fmode.c", + "misc" OS_SEP "__p__wcmdln.c", +}; + +static const char *mingwex_generic_src[] = { + "complex" OS_SEP "_cabs.c", + "complex" OS_SEP "cabs.c", + "complex" OS_SEP "cabsf.c", + "complex" OS_SEP "cabsl.c", + "complex" OS_SEP "cacos.c", + "complex" OS_SEP "cacosf.c", + "complex" OS_SEP "cacosl.c", + "complex" OS_SEP "carg.c", + "complex" OS_SEP "cargf.c", + "complex" OS_SEP "cargl.c", + "complex" OS_SEP "casin.c", + "complex" OS_SEP "casinf.c", + "complex" OS_SEP "casinl.c", + "complex" OS_SEP "catan.c", + "complex" OS_SEP "catanf.c", + "complex" OS_SEP "catanl.c", + "complex" OS_SEP "ccos.c", + "complex" OS_SEP "ccosf.c", + "complex" OS_SEP "ccosl.c", + "complex" OS_SEP "cexp.c", + "complex" OS_SEP "cexpf.c", + "complex" OS_SEP "cexpl.c", + "complex" OS_SEP "cimag.c", + "complex" OS_SEP "cimagf.c", + "complex" OS_SEP "cimagl.c", + "complex" OS_SEP "clog.c", + "complex" OS_SEP "clog10.c", + "complex" OS_SEP "clog10f.c", + "complex" OS_SEP "clog10l.c", + "complex" OS_SEP "clogf.c", + "complex" OS_SEP "clogl.c", + "complex" OS_SEP "conj.c", + "complex" OS_SEP "conjf.c", + "complex" OS_SEP "conjl.c", + "complex" OS_SEP "cpow.c", + "complex" OS_SEP "cpowf.c", + "complex" OS_SEP "cpowl.c", + "complex" OS_SEP "cproj.c", + "complex" OS_SEP "cprojf.c", + "complex" OS_SEP "cprojl.c", + "complex" OS_SEP "creal.c", + "complex" OS_SEP "crealf.c", + "complex" OS_SEP "creall.c", + "complex" OS_SEP "csin.c", + "complex" OS_SEP "csinf.c", + "complex" OS_SEP "csinl.c", + "complex" OS_SEP "csqrt.c", + "complex" OS_SEP "csqrtf.c", + "complex" OS_SEP "csqrtl.c", + "complex" OS_SEP "ctan.c", + "complex" OS_SEP "ctanf.c", + "complex" OS_SEP "ctanl.c", + "crt" OS_SEP "dllentry.c", + "crt" OS_SEP "dllmain.c", + "gdtoa" OS_SEP "arithchk.c", + "gdtoa" OS_SEP "dmisc.c", + "gdtoa" OS_SEP "dtoa.c", + "gdtoa" OS_SEP "g__fmt.c", + "gdtoa" OS_SEP "g_dfmt.c", + "gdtoa" OS_SEP "g_ffmt.c", + "gdtoa" OS_SEP "g_xfmt.c", + "gdtoa" OS_SEP "gdtoa.c", + "gdtoa" OS_SEP "gethex.c", + "gdtoa" OS_SEP "gmisc.c", + "gdtoa" OS_SEP "hd_init.c", + "gdtoa" OS_SEP "hexnan.c", + "gdtoa" OS_SEP "misc.c", + "gdtoa" OS_SEP "qnan.c", + "gdtoa" OS_SEP "smisc.c", + "gdtoa" OS_SEP "strtodg.c", + "gdtoa" OS_SEP "strtodnrp.c", + "gdtoa" OS_SEP "strtof.c", + "gdtoa" OS_SEP "strtopx.c", + "gdtoa" OS_SEP "sum.c", + "gdtoa" OS_SEP "ulp.c", + "math" OS_SEP "abs64.c", + "math" OS_SEP "cbrt.c", + "math" OS_SEP "cbrtf.c", + "math" OS_SEP "cbrtl.c", + "math" OS_SEP "cephes_emath.c", + "math" OS_SEP "copysign.c", + "math" OS_SEP "copysignf.c", + "math" OS_SEP "coshf.c", + "math" OS_SEP "coshl.c", + "math" OS_SEP "erfl.c", + "math" OS_SEP "expf.c", + "math" OS_SEP "fabs.c", + "math" OS_SEP "fabsf.c", + "math" OS_SEP "fabsl.c", + "math" OS_SEP "fdim.c", + "math" OS_SEP "fdimf.c", + "math" OS_SEP "fdiml.c", + "math" OS_SEP "fma.c", + "math" OS_SEP "fmaf.c", + "math" OS_SEP "fmal.c", + "math" OS_SEP "fmax.c", + "math" OS_SEP "fmaxf.c", + "math" OS_SEP "fmaxl.c", + "math" OS_SEP "fmin.c", + "math" OS_SEP "fminf.c", + "math" OS_SEP "fminl.c", + "math" OS_SEP "fp_consts.c", + "math" OS_SEP "fp_constsf.c", + "math" OS_SEP "fp_constsl.c", + "math" OS_SEP "fpclassify.c", + "math" OS_SEP "fpclassifyf.c", + "math" OS_SEP "fpclassifyl.c", + "math" OS_SEP "frexpf.c", + "math" OS_SEP "hypot.c", + "math" OS_SEP "hypotf.c", + "math" OS_SEP "hypotl.c", + "math" OS_SEP "isnan.c", + "math" OS_SEP "isnanf.c", + "math" OS_SEP "isnanl.c", + "math" OS_SEP "ldexpf.c", + "math" OS_SEP "lgamma.c", + "math" OS_SEP "lgammaf.c", + "math" OS_SEP "lgammal.c", + "math" OS_SEP "llrint.c", + "math" OS_SEP "llrintf.c", + "math" OS_SEP "llrintl.c", + "math" OS_SEP "llround.c", + "math" OS_SEP "llroundf.c", + "math" OS_SEP "llroundl.c", + "math" OS_SEP "log10f.c", + "math" OS_SEP "logf.c", + "math" OS_SEP "lrint.c", + "math" OS_SEP "lrintf.c", + "math" OS_SEP "lrintl.c", + "math" OS_SEP "lround.c", + "math" OS_SEP "lroundf.c", + "math" OS_SEP "lroundl.c", + "math" OS_SEP "modf.c", + "math" OS_SEP "modff.c", + "math" OS_SEP "modfl.c", + "math" OS_SEP "nextafterf.c", + "math" OS_SEP "nextafterl.c", + "math" OS_SEP "nexttoward.c", + "math" OS_SEP "nexttowardf.c", + "math" OS_SEP "powf.c", + "math" OS_SEP "powi.c", + "math" OS_SEP "powif.c", + "math" OS_SEP "powil.c", + "math" OS_SEP "rint.c", + "math" OS_SEP "rintf.c", + "math" OS_SEP "rintl.c", + "math" OS_SEP "round.c", + "math" OS_SEP "roundf.c", + "math" OS_SEP "roundl.c", + "math" OS_SEP "s_erf.c", + "math" OS_SEP "sf_erf.c", + "math" OS_SEP "signbit.c", + "math" OS_SEP "signbitf.c", + "math" OS_SEP "signbitl.c", + "math" OS_SEP "signgam.c", + "math" OS_SEP "sinhf.c", + "math" OS_SEP "sinhl.c", + "math" OS_SEP "sqrt.c", + "math" OS_SEP "sqrtf.c", + "math" OS_SEP "sqrtl.c", + "math" OS_SEP "tanhf.c", + "math" OS_SEP "tanhl.c", + "math" OS_SEP "tgamma.c", + "math" OS_SEP "tgammaf.c", + "math" OS_SEP "tgammal.c", + "math" OS_SEP "truncl.c", + "misc" OS_SEP "alarm.c", + "misc" OS_SEP "assert.c", + "misc" OS_SEP "basename.c", + "misc" OS_SEP "btowc.c", + "misc" OS_SEP "delay-f.c", + "misc" OS_SEP "delay-n.c", + "misc" OS_SEP "delayimp.c", + "misc" OS_SEP "difftime.c", + "misc" OS_SEP "difftime32.c", + "misc" OS_SEP "difftime64.c", + "misc" OS_SEP "dirent.c", + "misc" OS_SEP "dirname.c", + "misc" OS_SEP "execv.c", + "misc" OS_SEP "execve.c", + "misc" OS_SEP "execvp.c", + "misc" OS_SEP "execvpe.c", + "misc" OS_SEP "feclearexcept.c", + "misc" OS_SEP "fegetenv.c", + "misc" OS_SEP "fegetexceptflag.c", + "misc" OS_SEP "fegetround.c", + "misc" OS_SEP "feholdexcept.c", + "misc" OS_SEP "feraiseexcept.c", + "misc" OS_SEP "fesetenv.c", + "misc" OS_SEP "fesetexceptflag.c", + "misc" OS_SEP "fesetround.c", + "misc" OS_SEP "fetestexcept.c", + "misc" OS_SEP "feupdateenv.c", + "misc" OS_SEP "ftruncate.c", + "misc" OS_SEP "ftw.c", + "misc" OS_SEP "ftw64.c", + "misc" OS_SEP "fwide.c", + "misc" OS_SEP "getlogin.c", + "misc" OS_SEP "getopt.c", + "misc" OS_SEP "gettimeofday.c", + "misc" OS_SEP "imaxabs.c", + "misc" OS_SEP "imaxdiv.c", + "misc" OS_SEP "isblank.c", + "misc" OS_SEP "iswblank.c", + "misc" OS_SEP "mbrtowc.c", + "misc" OS_SEP "mbsinit.c", + "misc" OS_SEP "mempcpy.c", + "misc" OS_SEP "mingw-aligned-malloc.c", + "misc" OS_SEP "mingw-fseek.c", + "misc" OS_SEP "mingw_getsp.S", + "misc" OS_SEP "mingw_matherr.c", + "misc" OS_SEP "mingw_mbwc_convert.c", + "misc" OS_SEP "mingw_usleep.c", + "misc" OS_SEP "mingw_wcstod.c", + "misc" OS_SEP "mingw_wcstof.c", + "misc" OS_SEP "mingw_wcstold.c", + "misc" OS_SEP "mkstemp.c", + "misc" OS_SEP "seterrno.c", + "misc" OS_SEP "sleep.c", + "misc" OS_SEP "spawnv.c", + "misc" OS_SEP "spawnve.c", + "misc" OS_SEP "spawnvp.c", + "misc" OS_SEP "spawnvpe.c", + "misc" OS_SEP "strnlen.c", + "misc" OS_SEP "strsafe.c", + "misc" OS_SEP "strtoimax.c", + "misc" OS_SEP "strtold.c", + "misc" OS_SEP "strtoumax.c", + "misc" OS_SEP "tdelete.c", + "misc" OS_SEP "tfind.c", + "misc" OS_SEP "tsearch.c", + "misc" OS_SEP "twalk.c", + "misc" OS_SEP "uchar_c16rtomb.c", + "misc" OS_SEP "uchar_c32rtomb.c", + "misc" OS_SEP "uchar_mbrtoc16.c", + "misc" OS_SEP "uchar_mbrtoc32.c", + "misc" OS_SEP "wassert.c", + "misc" OS_SEP "wcrtomb.c", + "misc" OS_SEP "wcsnlen.c", + "misc" OS_SEP "wcstof.c", + "misc" OS_SEP "wcstoimax.c", + "misc" OS_SEP "wcstold.c", + "misc" OS_SEP "wcstoumax.c", + "misc" OS_SEP "wctob.c", + "misc" OS_SEP "wctrans.c", + "misc" OS_SEP "wctype.c", + "misc" OS_SEP "wdirent.c", + "misc" OS_SEP "winbs_uint64.c", + "misc" OS_SEP "winbs_ulong.c", + "misc" OS_SEP "winbs_ushort.c", + "misc" OS_SEP "wmemchr.c", + "misc" OS_SEP "wmemcmp.c", + "misc" OS_SEP "wmemcpy.c", + "misc" OS_SEP "wmemmove.c", + "misc" OS_SEP "wmempcpy.c", + "misc" OS_SEP "wmemset.c", + "stdio" OS_SEP "_Exit.c", + "stdio" OS_SEP "_findfirst64i32.c", + "stdio" OS_SEP "_findnext64i32.c", + "stdio" OS_SEP "_fstat.c", + "stdio" OS_SEP "_fstat64i32.c", + "stdio" OS_SEP "_ftime.c", + "stdio" OS_SEP "_getc_nolock.c", + "stdio" OS_SEP "_getwc_nolock.c", + "stdio" OS_SEP "_putc_nolock.c", + "stdio" OS_SEP "_putwc_nolock.c", + "stdio" OS_SEP "_stat.c", + "stdio" OS_SEP "_stat64i32.c", + "stdio" OS_SEP "_wfindfirst64i32.c", + "stdio" OS_SEP "_wfindnext64i32.c", + "stdio" OS_SEP "_wstat.c", + "stdio" OS_SEP "_wstat64i32.c", + "stdio" OS_SEP "asprintf.c", + "stdio" OS_SEP "atoll.c", + "stdio" OS_SEP "fgetpos64.c", + "stdio" OS_SEP "fopen64.c", + "stdio" OS_SEP "fseeko32.c", + "stdio" OS_SEP "fseeko64.c", + "stdio" OS_SEP "fsetpos64.c", + "stdio" OS_SEP "ftello.c", + "stdio" OS_SEP "ftello64.c", + "stdio" OS_SEP "ftruncate64.c", + "stdio" OS_SEP "lltoa.c", + "stdio" OS_SEP "lltow.c", + "stdio" OS_SEP "lseek64.c", + "stdio" OS_SEP "mingw_asprintf.c", + "stdio" OS_SEP "mingw_fprintf.c", + "stdio" OS_SEP "mingw_fprintfw.c", + "stdio" OS_SEP "mingw_fscanf.c", + "stdio" OS_SEP "mingw_fwscanf.c", + "stdio" OS_SEP "mingw_pformat.c", + "stdio" OS_SEP "mingw_pformatw.c", + "stdio" OS_SEP "mingw_printf.c", + "stdio" OS_SEP "mingw_printfw.c", + "stdio" OS_SEP "mingw_scanf.c", + "stdio" OS_SEP "mingw_snprintf.c", + "stdio" OS_SEP "mingw_snprintfw.c", + "stdio" OS_SEP "mingw_sprintf.c", + "stdio" OS_SEP "mingw_sprintfw.c", + "stdio" OS_SEP "mingw_sscanf.c", + "stdio" OS_SEP "mingw_swscanf.c", + "stdio" OS_SEP "mingw_vasprintf.c", + "stdio" OS_SEP "mingw_vfprintf.c", + "stdio" OS_SEP "mingw_vfprintfw.c", + "stdio" OS_SEP "mingw_vfscanf.c", + "stdio" OS_SEP "mingw_vprintf.c", + "stdio" OS_SEP "mingw_vprintfw.c", + "stdio" OS_SEP "mingw_vsnprintf.c", + "stdio" OS_SEP "mingw_vsnprintfw.c", + "stdio" OS_SEP "mingw_vsprintf.c", + "stdio" OS_SEP "mingw_vsprintfw.c", + "stdio" OS_SEP "mingw_wscanf.c", + "stdio" OS_SEP "mingw_wvfscanf.c", + "stdio" OS_SEP "scanf.S", + "stdio" OS_SEP "snprintf.c", + "stdio" OS_SEP "snwprintf.c", + "stdio" OS_SEP "strtof.c", + "stdio" OS_SEP "strtok_r.c", + "stdio" OS_SEP "truncate.c", + "stdio" OS_SEP "ulltoa.c", + "stdio" OS_SEP "ulltow.c", + "stdio" OS_SEP "vasprintf.c", + "stdio" OS_SEP "vfscanf.c", + "stdio" OS_SEP "vfscanf2.S", + "stdio" OS_SEP "vfwscanf.c", + "stdio" OS_SEP "vfwscanf2.S", + "stdio" OS_SEP "vscanf.c", + "stdio" OS_SEP "vscanf2.S", + "stdio" OS_SEP "vsnprintf.c", + "stdio" OS_SEP "vsnwprintf.c", + "stdio" OS_SEP "vsscanf.c", + "stdio" OS_SEP "vsscanf2.S", + "stdio" OS_SEP "vswscanf.c", + "stdio" OS_SEP "vswscanf2.S", + "stdio" OS_SEP "vwscanf.c", + "stdio" OS_SEP "vwscanf2.S", + "stdio" OS_SEP "wtoll.c", +}; + +static const char *mingwex_x86_src[] = { + "math" OS_SEP "x86" OS_SEP "acosf.c", + "math" OS_SEP "x86" OS_SEP "acosh.c", + "math" OS_SEP "x86" OS_SEP "acoshf.c", + "math" OS_SEP "x86" OS_SEP "acoshl.c", + "math" OS_SEP "x86" OS_SEP "acosl.c", + "math" OS_SEP "x86" OS_SEP "asinf.c", + "math" OS_SEP "x86" OS_SEP "asinh.c", + "math" OS_SEP "x86" OS_SEP "asinhf.c", + "math" OS_SEP "x86" OS_SEP "asinhl.c", + "math" OS_SEP "x86" OS_SEP "asinl.c", + "math" OS_SEP "x86" OS_SEP "atan2.c", + "math" OS_SEP "x86" OS_SEP "atan2f.c", + "math" OS_SEP "x86" OS_SEP "atan2l.c", + "math" OS_SEP "x86" OS_SEP "atanf.c", + "math" OS_SEP "x86" OS_SEP "atanh.c", + "math" OS_SEP "x86" OS_SEP "atanhf.c", + "math" OS_SEP "x86" OS_SEP "atanhl.c", + "math" OS_SEP "x86" OS_SEP "atanl.c", + "math" OS_SEP "x86" OS_SEP "ceilf.S", + "math" OS_SEP "x86" OS_SEP "ceill.S", + "math" OS_SEP "x86" OS_SEP "ceil.S", + "math" OS_SEP "x86" OS_SEP "_chgsignl.S", + "math" OS_SEP "x86" OS_SEP "copysignl.S", + "math" OS_SEP "x86" OS_SEP "cos.c", + "math" OS_SEP "x86" OS_SEP "cosf.c", + "math" OS_SEP "x86" OS_SEP "cosl.c", + "math" OS_SEP "x86" OS_SEP "cosl_internal.S", + "math" OS_SEP "x86" OS_SEP "cossin.c", + "math" OS_SEP "x86" OS_SEP "exp2f.S", + "math" OS_SEP "x86" OS_SEP "exp2l.S", + "math" OS_SEP "x86" OS_SEP "exp2.S", + "math" OS_SEP "x86" OS_SEP "exp.c", + "math" OS_SEP "x86" OS_SEP "expl.c", + "math" OS_SEP "x86" OS_SEP "expm1.c", + "math" OS_SEP "x86" OS_SEP "expm1f.c", + "math" OS_SEP "x86" OS_SEP "expm1l.c", + "math" OS_SEP "x86" OS_SEP "floorf.S", + "math" OS_SEP "x86" OS_SEP "floorl.S", + "math" OS_SEP "x86" OS_SEP "floor.S", + "math" OS_SEP "x86" OS_SEP "fmod.c", + "math" OS_SEP "x86" OS_SEP "fmodf.c", + "math" OS_SEP "x86" OS_SEP "fmodl.c", + "math" OS_SEP "x86" OS_SEP "frexpl.S", + "math" OS_SEP "x86" OS_SEP "fucom.c", + "math" OS_SEP "x86" OS_SEP "ilogbf.S", + "math" OS_SEP "x86" OS_SEP "ilogbl.S", + "math" OS_SEP "x86" OS_SEP "ilogb.S", + "math" OS_SEP "x86" OS_SEP "internal_logl.S", + "math" OS_SEP "x86" OS_SEP "ldexp.c", + "math" OS_SEP "x86" OS_SEP "ldexpl.c", + "math" OS_SEP "x86" OS_SEP "log10l.S", + "math" OS_SEP "x86" OS_SEP "log1pf.S", + "math" OS_SEP "x86" OS_SEP "log1pl.S", + "math" OS_SEP "x86" OS_SEP "log1p.S", + "math" OS_SEP "x86" OS_SEP "log2f.S", + "math" OS_SEP "x86" OS_SEP "log2l.S", + "math" OS_SEP "x86" OS_SEP "log2.S", + "math" OS_SEP "x86" OS_SEP "logb.c", + "math" OS_SEP "x86" OS_SEP "logbf.c", + "math" OS_SEP "x86" OS_SEP "logbl.c", + "math" OS_SEP "x86" OS_SEP "log.c", + "math" OS_SEP "x86" OS_SEP "logl.c", + "math" OS_SEP "x86" OS_SEP "nearbyintf.S", + "math" OS_SEP "x86" OS_SEP "nearbyintl.S", + "math" OS_SEP "x86" OS_SEP "nearbyint.S", + "math" OS_SEP "x86" OS_SEP "pow.c", + "math" OS_SEP "x86" OS_SEP "powl.c", + "math" OS_SEP "x86" OS_SEP "remainderf.S", + "math" OS_SEP "x86" OS_SEP "remainderl.S", + "math" OS_SEP "x86" OS_SEP "remainder.S", + "math" OS_SEP "x86" OS_SEP "remquof.S", + "math" OS_SEP "x86" OS_SEP "remquol.S", + "math" OS_SEP "x86" OS_SEP "remquo.S", + "math" OS_SEP "x86" OS_SEP "scalbnf.S", + "math" OS_SEP "x86" OS_SEP "scalbnl.S", + "math" OS_SEP "x86" OS_SEP "scalbn.S", + "math" OS_SEP "x86" OS_SEP "sin.c", + "math" OS_SEP "x86" OS_SEP "sinf.c", + "math" OS_SEP "x86" OS_SEP "sinl.c", + "math" OS_SEP "x86" OS_SEP "sinl_internal.S", + "math" OS_SEP "x86" OS_SEP "tanf.c", + "math" OS_SEP "x86" OS_SEP "tanl.S", + "math" OS_SEP "x86" OS_SEP "truncf.S", + "math" OS_SEP "x86" OS_SEP "trunc.S", +}; + +static const char *mingwex_arm32_src[] = { + "math" OS_SEP "arm" OS_SEP "_chgsignl.S", + "math" OS_SEP "arm" OS_SEP "ceil.S", + "math" OS_SEP "arm" OS_SEP "ceilf.S", + "math" OS_SEP "arm" OS_SEP "ceill.S", + "math" OS_SEP "arm" OS_SEP "copysignl.c", + "math" OS_SEP "arm" OS_SEP "exp2.c", + "math" OS_SEP "arm" OS_SEP "floor.S", + "math" OS_SEP "arm" OS_SEP "floorf.S", + "math" OS_SEP "arm" OS_SEP "floorl.S", + "math" OS_SEP "arm" OS_SEP "ldexpl.c", + "math" OS_SEP "arm" OS_SEP "log2.c", + "math" OS_SEP "arm" OS_SEP "nearbyint.S", + "math" OS_SEP "arm" OS_SEP "nearbyintf.S", + "math" OS_SEP "arm" OS_SEP "nearbyintl.S", + "math" OS_SEP "arm" OS_SEP "scalbn.c", + "math" OS_SEP "arm" OS_SEP "sincos.c", + "math" OS_SEP "arm" OS_SEP "trunc.S", + "math" OS_SEP "arm" OS_SEP "truncf.S", +}; + +static const char *mingwex_arm64_src[] = { + "math" OS_SEP "arm64" OS_SEP "ceilf.S", + "math" OS_SEP "arm64" OS_SEP "ceill.S", + "math" OS_SEP "arm64" OS_SEP "ceil.S", + "math" OS_SEP "arm64" OS_SEP "_chgsignl.S", + "math" OS_SEP "arm64" OS_SEP "copysignl.c", + "math" OS_SEP "arm64" OS_SEP "exp2f.S", + "math" OS_SEP "arm64" OS_SEP "exp2.S", + "math" OS_SEP "arm64" OS_SEP "floorf.S", + "math" OS_SEP "arm64" OS_SEP "floorl.S", + "math" OS_SEP "arm64" OS_SEP "floor.S", + "math" OS_SEP "arm64" OS_SEP "ldexpl.c", + "math" OS_SEP "arm64" OS_SEP "log2.c", + "math" OS_SEP "arm64" OS_SEP "nearbyintf.S", + "math" OS_SEP "arm64" OS_SEP "nearbyintl.S", + "math" OS_SEP "arm64" OS_SEP "nearbyint.S", + "math" OS_SEP "arm64" OS_SEP "scalbn.c", + "math" OS_SEP "arm64" OS_SEP "sincos.c", + "math" OS_SEP "arm64" OS_SEP "truncf.S", + "math" OS_SEP "arm64" OS_SEP "trunc.S", +}; + struct LinkJob { CodeGen *codegen; ZigList<const char *> args; @@ -570,73 +1107,6 @@ static const char *build_musl(CodeGen *parent) { return buf_ptr(&child_gen->output_file_path); } -static const char *msvcrt_common_src[] = { - "misc" OS_SEP "onexit_table.c", - "misc" OS_SEP "register_tls_atexit.c", - "stdio" OS_SEP "acrt_iob_func.c", - "misc" OS_SEP "_configthreadlocale.c", - "misc" OS_SEP "_get_current_locale.c", - "misc" OS_SEP "invalid_parameter_handler.c", - "misc" OS_SEP "output_format.c", - "misc" OS_SEP "purecall.c", - "secapi" OS_SEP "_access_s.c", - "secapi" OS_SEP "_cgets_s.c", - "secapi" OS_SEP "_cgetws_s.c", - "secapi" OS_SEP "_chsize_s.c", - "secapi" OS_SEP "_controlfp_s.c", - "secapi" OS_SEP "_cprintf_s.c", - "secapi" OS_SEP "_cprintf_s_l.c", - "secapi" OS_SEP "_ctime32_s.c", - "secapi" OS_SEP "_ctime64_s.c", - "secapi" OS_SEP "_cwprintf_s.c", - "secapi" OS_SEP "_cwprintf_s_l.c", - "secapi" OS_SEP "_gmtime32_s.c", - "secapi" OS_SEP "_gmtime64_s.c", - "secapi" OS_SEP "_localtime32_s.c", - "secapi" OS_SEP "_localtime64_s.c", - "secapi" OS_SEP "_mktemp_s.c", - "secapi" OS_SEP "_sopen_s.c", - "secapi" OS_SEP "_strdate_s.c", - "secapi" OS_SEP "_strtime_s.c", - "secapi" OS_SEP "_umask_s.c", - "secapi" OS_SEP "_vcprintf_s.c", - "secapi" OS_SEP "_vcprintf_s_l.c", - "secapi" OS_SEP "_vcwprintf_s.c", - "secapi" OS_SEP "_vcwprintf_s_l.c", - "secapi" OS_SEP "_vscprintf_p.c", - "secapi" OS_SEP "_vscwprintf_p.c", - "secapi" OS_SEP "_vswprintf_p.c", - "secapi" OS_SEP "_waccess_s.c", - "secapi" OS_SEP "_wasctime_s.c", - "secapi" OS_SEP "_wctime32_s.c", - "secapi" OS_SEP "_wctime64_s.c", - "secapi" OS_SEP "_wstrtime_s.c", - "secapi" OS_SEP "_wmktemp_s.c", - "secapi" OS_SEP "_wstrdate_s.c", - "secapi" OS_SEP "asctime_s.c", - "secapi" OS_SEP "memcpy_s.c", - "secapi" OS_SEP "memmove_s.c", - "secapi" OS_SEP "rand_s.c", - "secapi" OS_SEP "sprintf_s.c", - "secapi" OS_SEP "strerror_s.c", - "secapi" OS_SEP "vsprintf_s.c", - "secapi" OS_SEP "wmemcpy_s.c", - "secapi" OS_SEP "wmemmove_s.c", - "stdio" OS_SEP "mingw_lock.c", -}; - -static const char *msvcrt_i386_src[] = { - "misc" OS_SEP "lc_locale_func.c", - -}; - -static const char *msvcrt_other_src[] = { - "misc" OS_SEP "__p___argv.c", - "misc" OS_SEP "__p__acmdln.c", - "misc" OS_SEP "__p__fmode.c", - "misc" OS_SEP "__p__wcmdln.c", -}; - static void add_msvcrt_os_dep(CodeGen *parent, CodeGen *child_gen, const char *src_path) { CFile *c_file = allocate<CFile>(1); c_file->source_path = buf_ptr(buf_sprintf("%s" OS_SEP "libc" OS_SEP "mingw" OS_SEP "%s", @@ -645,7 +1115,7 @@ static void add_msvcrt_os_dep(CodeGen *parent, CodeGen *child_gen, const char *s c_file->args.append("-D__LIBMSVCRT__"); c_file->args.append("-I"); - c_file->args.append(path_from_libc(parent, "mingw" OS_SEP "include" OS_SEP)); + c_file->args.append(path_from_libc(parent, "mingw" OS_SEP "include")); c_file->args.append("-std=gnu99"); c_file->args.append("-D_CRTBLD"); @@ -661,6 +1131,31 @@ static void add_msvcrt_os_dep(CodeGen *parent, CodeGen *child_gen, const char *s child_gen->c_source_files.append(c_file); } +static void add_mingwex_os_dep(CodeGen *parent, CodeGen *child_gen, const char *src_path) { + CFile *c_file = allocate<CFile>(1); + c_file->source_path = buf_ptr(buf_sprintf("%s" OS_SEP "libc" OS_SEP "mingw" OS_SEP "%s", + buf_ptr(parent->zig_lib_dir), src_path)); + c_file->args.append("-DHAVE_CONFIG_H"); + + c_file->args.append("-I"); + c_file->args.append(path_from_libc(parent, "mingw")); + + c_file->args.append("-I"); + c_file->args.append(path_from_libc(parent, "mingw" OS_SEP "include")); + + c_file->args.append("-std=gnu99"); + c_file->args.append("-D_CRTBLD"); + c_file->args.append("-D_WIN32_WINNT=0x0f00"); + c_file->args.append("-D__MSVCRT_VERSION__=0x700"); + c_file->args.append("-g"); + c_file->args.append("-O2"); + + c_file->args.append("-isystem"); + c_file->args.append(path_from_libc(parent, "include" OS_SEP "any-windows-any")); + + child_gen->c_source_files.append(c_file); +} + static const char *get_libc_crt_file(CodeGen *parent, const char *file) { if (parent->libc == nullptr && parent->zig_target->os == OsWindows) { if (strcmp(file, "crt2.obj") == 0) { @@ -759,6 +1254,32 @@ static const char *get_libc_crt_file(CodeGen *parent, const char *file) { } codegen_build_and_link(child_gen); return buf_ptr(&child_gen->output_file_path); + } else if (strcmp(file, "mingwex.lib") == 0) { + CodeGen *child_gen = create_child_codegen(parent, nullptr, OutTypeLib, nullptr); + codegen_set_out_name(child_gen, buf_create_from_str("mingwex")); + + for (size_t i = 0; i < array_length(mingwex_generic_src); i += 1) { + add_mingwex_os_dep(parent, child_gen, mingwex_generic_src[i]); + } + if (parent->zig_target->arch == ZigLLVM_x86 || parent->zig_target->arch == ZigLLVM_x86_64) { + for (size_t i = 0; i < array_length(mingwex_x86_src); i += 1) { + add_mingwex_os_dep(parent, child_gen, mingwex_x86_src[i]); + } + } else if (target_is_arm(parent->zig_target)) { + if (target_arch_pointer_bit_width(parent->zig_target->arch) == 32) { + for (size_t i = 0; i < array_length(mingwex_arm32_src); i += 1) { + add_mingwex_os_dep(parent, child_gen, mingwex_arm32_src[i]); + } + } else { + for (size_t i = 0; i < array_length(mingwex_arm64_src); i += 1) { + add_mingwex_os_dep(parent, child_gen, mingwex_arm64_src[i]); + } + } + } else { + zig_unreachable(); + } + codegen_build_and_link(child_gen); + return buf_ptr(&child_gen->output_file_path); } else { zig_unreachable(); } @@ -1555,6 +2076,7 @@ static void add_mingw_link_args(LinkJob *lj, bool is_library) { } lj->args.append(get_libc_crt_file(g, "mingw32.lib")); + lj->args.append(get_libc_crt_file(g, "mingwex.lib")); lj->args.append(get_libc_crt_file(g, "msvcrt-os.lib")); lj->args.append(get_def_lib(g, "msvcrt", "mingw" OS_SEP "lib-common" OS_SEP "msvcrt.def.in")); lj->args.append(get_def_lib(g, "kernel32", "mingw" OS_SEP "lib-common" OS_SEP "kernel32.def.in")); @@ -2089,3 +2611,4 @@ void codegen_link(CodeGen *g) { exit(1); } } + |
