[Mingw-w64-public] [PATCH 1/3] crt: Fix the strtold/wcstold exports in libucrt.a
The macros like F_ARM_ANY() require making the .def file a .def.in which is preprorcessed, and including func.def.in. Signed-off-by: Martin Storsjö --- ...-convert-l1-1-0.def => api-ms-win-crt-convert-l1-1-0.def.in} | 2 ++ 1 file changed, 2 insertions(+) rename mingw-w64-crt/lib-common/{api-ms-win-crt-convert-l1-1-0.def => api-ms-win-crt-convert-l1-1-0.def.in} (98%) diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-convert-l1-1-0.def b/mingw-w64-crt/lib-common/api-ms-win-crt-convert-l1-1-0.def.in similarity index 98% rename from mingw-w64-crt/lib-common/api-ms-win-crt-convert-l1-1-0.def rename to mingw-w64-crt/lib-common/api-ms-win-crt-convert-l1-1-0.def.in index b59b1c0eb..c172b0969 100644 --- a/mingw-w64-crt/lib-common/api-ms-win-crt-convert-l1-1-0.def +++ b/mingw-w64-crt/lib-common/api-ms-win-crt-convert-l1-1-0.def.in @@ -2,6 +2,8 @@ LIBRARY api-ms-win-crt-convert-l1-1-0 EXPORTS +#include "func.def.in" + __toascii toascii == __toascii _atodbl -- 2.25.1 ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
[Mingw-w64-public] [PATCH 2/3] crt: Remove duplicate strlwr/wcslwr aliases from ucrtbase.def.in
These same are also added implicitly from msvcrt-common.def.in. Signed-off-by: Martin Storsjö --- mingw-w64-crt/lib-common/ucrtbase.def.in | 2 -- 1 file changed, 2 deletions(-) diff --git a/mingw-w64-crt/lib-common/ucrtbase.def.in b/mingw-w64-crt/lib-common/ucrtbase.def.in index 7d35e4209..04db7f08a 100644 --- a/mingw-w64-crt/lib-common/ucrtbase.def.in +++ b/mingw-w64-crt/lib-common/ucrtbase.def.in @@ -1957,7 +1957,6 @@ _stricmp_l _stricoll _stricoll_l _strlwr -strlwr == _strlwr _strlwr_l _strlwr_s _strlwr_s_l @@ -2050,7 +2049,6 @@ _wcsicmp_l _wcsicoll _wcsicoll_l _wcslwr -wcslwr == _wcslwr _wcslwr_l _wcslwr_s _wcslwr_s_l -- 2.25.1 ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
[Mingw-w64-public] [PATCH 3/3] crt: Remove a stray 'k' from api-ms-win-crt-math-l1-1-0.def.in
This is most probably a random mistyped character. This caused one extra symbol 'k' to be exported from this import library. Signed-off-by: Martin Storsjö --- With these three patches in place, the list of symbols exported by libucrt.a and libucrtbase.a is identical, modulo a bunch of private symbols (of the form "_o_") that actually differ between api-ms-win-crt-*.dll and ucrtbase.dll. --- mingw-w64-crt/lib-common/api-ms-win-crt-math-l1-1-0.def.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-math-l1-1-0.def.in b/mingw-w64-crt/lib-common/api-ms-win-crt-math-l1-1-0.def.in index ce2073e96..226a37a72 100644 --- a/mingw-w64-crt/lib-common/api-ms-win-crt-math-l1-1-0.def.in +++ b/mingw-w64-crt/lib-common/api-ms-win-crt-math-l1-1-0.def.in @@ -282,7 +282,7 @@ fmaxf fmaxl F_X86_ANY(DATA) fmin fminf -fminl F_X86_ANY(DATA)k +fminl F_X86_ANY(DATA) fmod F_X86_ANY(DATA) F_NON_I386(fmodf F_X86_ANY(DATA)) F_ARM_ANY(fmodl == fmod) -- 2.25.1 ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] RFC: crt: Use intermediate libraries to build object files shared across all libmsvcr*.a and libucrt*.a
On Sun, 18 Jul 2021, LIU Hao wrote: 在 2021-07-14 19:45, Martin Storsjö 写道: On Wed, 14 Jul 2021, Martin Storsjö wrote: This avoids compiling the object files that go into libmsvcrt*.a 10 times, and object files that go into libucrt*.a twice. This reduces the number of built object files for a build for i686 from 885 to 747, and shrinks the generate Makefile.in from 9.8 MB to 8.9 MB, by emitting per-object rules for fewer object files. ( ... ... ) +lib64/lib%_def.a: lib64/%.def + $(DTDEF32) $< FWIW this is a typo here, it should be DTDEF64, in case someone wants to try out the patch. That' awesome! This patch looks good to me. Thanks for the work. Pushed this now, after some more testing and a couple minor fixes. // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Fix a typo in the ucrt __imp_vfscanf assignment
On Thu, 5 Aug 2021, JonY via Mingw-w64-public wrote: On 8/5/21 8:10 AM, Martin Storsjö wrote: The wrong function was assigned; this was a bug present since 0dd9563a3ad71ad75cab1699ba5cfef2dd0bf9d8 (April 2021). Signed-off-by: Martin Storsjö --- mingw-w64-crt/stdio/ucrt_vfscanf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw-w64-crt/stdio/ucrt_vfscanf.c b/mingw-w64-crt/stdio/ucrt_vfscanf.c index fe44cdf71..8d1a76a8b 100644 --- a/mingw-w64-crt/stdio/ucrt_vfscanf.c +++ b/mingw-w64-crt/stdio/ucrt_vfscanf.c @@ -11,4 +11,4 @@ int __cdecl vfscanf (FILE *__stream, const char *__format, __builtin_va_list __local_argv) { return __stdio_common_vfscanf(0, __stream, __format, NULL, __local_argv); } -int __cdecl (*__MINGW_IMP_SYMBOL(vfscanf))(FILE *, const char *, __builtin_va_list) = vsscanf; +int __cdecl (*__MINGW_IMP_SYMBOL(vfscanf))(FILE *, const char *, __builtin_va_list) = vfscanf; Wow that was hard to spot, patch looks good to me. Thanks, pushed this one now. // Martin ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
Re: [Mingw-w64-public] [PATCH] crt: Fix a typo in the ucrt __imp_vfscanf assignment
On 8/5/21 8:10 AM, Martin Storsjö wrote: The wrong function was assigned; this was a bug present since 0dd9563a3ad71ad75cab1699ba5cfef2dd0bf9d8 (April 2021). Signed-off-by: Martin Storsjö --- mingw-w64-crt/stdio/ucrt_vfscanf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw-w64-crt/stdio/ucrt_vfscanf.c b/mingw-w64-crt/stdio/ucrt_vfscanf.c index fe44cdf71..8d1a76a8b 100644 --- a/mingw-w64-crt/stdio/ucrt_vfscanf.c +++ b/mingw-w64-crt/stdio/ucrt_vfscanf.c @@ -11,4 +11,4 @@ int __cdecl vfscanf (FILE *__stream, const char *__format, __builtin_va_list __local_argv) { return __stdio_common_vfscanf(0, __stream, __format, NULL, __local_argv); } -int __cdecl (*__MINGW_IMP_SYMBOL(vfscanf))(FILE *, const char *, __builtin_va_list) = vsscanf; +int __cdecl (*__MINGW_IMP_SYMBOL(vfscanf))(FILE *, const char *, __builtin_va_list) = vfscanf; Wow that was hard to spot, patch looks good to me. OpenPGP_signature Description: OpenPGP digital signature ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
[Mingw-w64-public] [PATCH] crt: Fix a typo in the ucrt __imp_vfscanf assignment
The wrong function was assigned; this was a bug present since 0dd9563a3ad71ad75cab1699ba5cfef2dd0bf9d8 (April 2021). Signed-off-by: Martin Storsjö --- mingw-w64-crt/stdio/ucrt_vfscanf.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mingw-w64-crt/stdio/ucrt_vfscanf.c b/mingw-w64-crt/stdio/ucrt_vfscanf.c index fe44cdf71..8d1a76a8b 100644 --- a/mingw-w64-crt/stdio/ucrt_vfscanf.c +++ b/mingw-w64-crt/stdio/ucrt_vfscanf.c @@ -11,4 +11,4 @@ int __cdecl vfscanf (FILE *__stream, const char *__format, __builtin_va_list __local_argv) { return __stdio_common_vfscanf(0, __stream, __format, NULL, __local_argv); } -int __cdecl (*__MINGW_IMP_SYMBOL(vfscanf))(FILE *, const char *, __builtin_va_list) = vsscanf; +int __cdecl (*__MINGW_IMP_SYMBOL(vfscanf))(FILE *, const char *, __builtin_va_list) = vfscanf; -- 2.25.1 ___ Mingw-w64-public mailing list Mingw-w64-public@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
[Mingw-w64-public] [PATCH] genpeimg: add option to change image subsystem.
This can be done either by number, or by name. Most names are from the documentation for LINK.EXE's /SUBSYSTEM option, but a few were made up based on the constants and documentation on MS's PE Format document. --- I wasn't sure about using strcasecmp, but I grepped and gendef uses it without a configure check, so it must be relatively safe... mingw-w64-tools/genpeimg/src/genpeimg.c | 69 + mingw-w64-tools/genpeimg/src/img.h | 1 + mingw-w64-tools/genpeimg/src/img_pe.c | 7 +++ 3 files changed, 77 insertions(+) diff --git a/mingw-w64-tools/genpeimg/src/genpeimg.c b/mingw-w64-tools/genpeimg/src/genpeimg.c index c18d9ab9f..af17129fa 100644 --- a/mingw-w64-tools/genpeimg/src/genpeimg.c +++ b/mingw-w64-tools/genpeimg/src/genpeimg.c @@ -21,16 +21,41 @@ #include "img.h" +static const struct SUBSYSTEM_MAPPING { + const char * const name; + const unsigned short value; +} SUBSYSTEMS[] = { + { "BOOT_APPLICATION", 16 }, + { "CONSOLE", 3 }, + { "EFI_APPLICATION", 10 }, + { "EFI_BOOT_SERVICE_DRIVER", 11}, + { "EFI_ROM", 13 }, + { "EFI_RUNTIME_DRIVER", 12}, + { "NATIVE", 1 }, + { "POSIX", 7 }, + { "WINDOWS", 2 }, + /* not listed on MS doc page for /SUBSYSTEM option to LINK */ + { "OS2", 5 }, + { "NATIVE_WINDOWS9X", 8 }, + { "WINDOWS_CE", 9 }, + { "XBOX", 14 }, + { "UNKNOWN", 0 }, + { NULL, 0 } +}; + unsigned short set_pe_hdr_chara = 0; unsigned short mask_pe_hdr_chara = 0x; unsigned short set_pe_opt_hdr_dll_chara = 0; unsigned short mask_pe_opt_hdr_dll_chara = 0x; +unsigned short set_subsystem = 0x; int dump_information = 0; static char *file_name = NULL; static void __attribute__((noreturn)) show_usage (void) { + const struct SUBSYSTEM_MAPPING *p; + fprintf (stderr, "genpeimg [options] files...\n"); fprintf (stderr, "\nOptions:\n" " -p Takes as addition argument one or more of the following\n" @@ -58,6 +83,12 @@ show_usage (void) "w: WDM-driver\n" "c: control-flow-guard\n" "t: terminal-server-aware\n"); + fprintf (stderr, +" -s Sets the image subsystem to the specified value\n"); + for (p = [0]; p->name; ++p) +fprintf (stderr, "%s\n", p->name); + fprintf (stderr, +"or an integer value\n"); fprintf (stderr, " -h: Show this page.\n" " -x: Dump image information to stdout\n"); @@ -71,6 +102,7 @@ pass_args (int argc, char **argv) int has_error = 0; while (argc-- > 0) { + const struct SUBSYSTEM_MAPPING *p; int is_pos = 1; char *h = *argv++; if (h[0] != '-') @@ -204,6 +236,41 @@ pass_args (int argc, char **argv) ++h; } break; + case 's': + if (h[2] != 0) + goto error_point; + if (argc == 0) + { + fprintf (stderr, "Missing argument for -s\n"); + show_usage (); + } + h = *argv++; argc--; + + for (p = [0]; p->name; ++p) + { + if (0 == strcasecmp (h, p->name)) + { + set_subsystem = p->value; + break; + } + } + if (p->name == NULL) + { + unsigned long ulparam = strtoul (h, , 0); + /* TODO: support ",major.minor" suffix? */ + if (*h != 0) + { + fprintf (stderr, "Unknown subsystem '%s' for -s\n", *(argv-1)); + has_error = 1; + } + if (ulparam >= 0x) + { + fprintf (stderr, "Subsystem '%s' out of range for -s\n", *(argv-1)); + has_error = 1; + } + set_subsystem = (unsigned short)ulparam; + } + break; case 'x': if (h[2] == 0) { @@ -250,6 +317,8 @@ int main (int argc, char **argv) /* First we need to do actions which aren't modifying image's size. */ peimg_set_hdr_characeristics (pe, set_pe_hdr_chara, mask_pe_hdr_chara); peimg_set_hdr_opt_dll_characteristics (pe, set_pe_opt_hdr_dll_chara, mask_pe_opt_hdr_dll_chara); + if (set_subsystem != 0x) +peimg_set_hdr_opt_subsystem (pe, set_subsystem); if (pe->pimg->is_modified) pe->pimg->want_save = 1; peimg_free (pe); diff --git a/mingw-w64-tools/genpeimg/src/img.h b/mingw-w64-tools/genpeimg/src/img.h index dc4944150..4a927c860 100644 --- a/mingw-w64-tools/genpeimg/src/img.h +++ b/mingw-w64-tools/genpeimg/src/img.h @@ -78,6 +78,7 @@ void peimg_show (pe_image *ppeimg, FILE *outfp); void peimg_set_hdr_characeristics (pe_image *pe, unsigned short set, unsigned short mask); void peimg_set_hdr_opt_dll_characteristics (pe_image *pe, unsigned short set, unsigned short mask); +void peimg_set_hdr_opt_subsystem (pe_image *pe, unsigned short subsystem); #define PEIMG_GET_UCHAR(PEIMG, POS) fimg_get_uchar_at ((PEIMG)->pimg, ((PEIMG)->start_pe + (POS))) #define PEIMG_GET_USHORT(PEIMG, POS) fimg_get_ushort_at