Existent enumerators have been updated a little to prevent a trailing comma.
Signed-off-by: Biswapriyo Nath <nathbappai@gmail.com>
Signed-off-by: LIU Hao <lh_mouse@126.com>
This commit reveals names in three categories:
1) Names that start with an underscore and a letter in uppercase are reserved
for implementations. These can be revealed even with strict standard
conformance.
2) Names that start with an underscore and a letter in lowercase are reserved
for implementations in file scopes (i.e. they are not eligible for macros).
These can be revealed even with strict standard conformance.
3) Some names reference POSIX functions. These are revealed when a POSIX, GNU
or BSD feature test macro is defined.
Signed-off-by: LIU Hao <lh_mouse@126.com>
This fixes build errors with GCC, after
e5ac8c5509cd729b97065733cf4b0df0ec732797; GCC doesn't accept
__asm__(), expanded from __MINGW_ASM_CALL(), after
__attribute__((deprecated())), while Clang accepts both orders.
By default, __MINGW_ATTRIB_DEPRECATED_SEC_WARN doesn't expand
to anything, but if built with defines that makes this expand to
a deprecation attribute, the build would fail with GCC.
Signed-off-by: Martin Storsjö <martin@martin.st>
Add once-guard to ensure that the file is processed only once.
Add arch-guard to ensure that DEF_<ARCH> is always defined to prevent an
issue that symbols defined via F32() macro completely disappeared and which
was fixed in previous change.
This change applied before the previous change cause compile errors.
Signed-off-by: Martin Storsjö <martin@martin.st>
Having -DDEF_<ARCH> is required by func.def.in which is used either
directly or indirectly by crt-aliases.def.in in all CRT def.in files.
Some symbols in crt-aliases.def.in are defined via F* macros and these
symbols are currently missing in versioned non-os msvcrt import libraries.
This change is fixing missing symbols in all CRT import libraries.
Signed-off-by: Martin Storsjö <martin@martin.st>
Currently __MINGW_IMP_SYMBOL symbols for aliased functions are defined as
a new plain global variable, just like for an original function.
GCC supports declaring global variable as an alias to other global
variable.
Change all aliases of import __MINGW_IMP_SYMBOL symbols via alias
attribute. This reduce memory usage as original symbol and aliased symbol
will share same global variable. Also it makes it clear that the aliased
import symbol is an alias to another import symbol.
Note that aliased symbol has to be declared with "extern" keyword even it
is not extern and gcc will emit this symbol (as described in documentation).
So for example:
int var_non_alias = 1;
int var_target = 2;
extern int __attribute__ ((alias ("var_target"))) var_alias;
Emits symbols:
SYMBOL TABLE:
[ 0](sec -2)(fl 0x00)(ty 0)(scl 103) (nx 1) 0x00000000 test.c
File
[ 2](sec 1)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .text
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 4](sec 2)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .data
AUX scnlen 0x8 nreloc 0 nlnno 0
[ 6](sec 3)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .bss
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 8](sec 4)(fl 0x00)(ty 0)(scl 3) (nx 1) 0x00000000 .rdata$zzz
AUX scnlen 0x1e nreloc 0 nlnno 0
[ 10](sec 2)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000000 _var_non_alias
[ 11](sec 2)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000004 _var_target
[ 12](sec 2)(fl 0x00)(ty 0)(scl 2) (nx 0) 0x00000004 _var_alias
Contents of section .data:
0000 01000000 02000000 ........
Signed-off-by: Martin Storsjö <martin@martin.st>
WinMain() entry point provided by the application is called by mingw-w64
startup code, more precisely by function main() from crtexewin.c file.
mingw-w64 startup code in file crtexewin.c calls _ismbblead() function.
Function _ismbblead() is not available in some versions of crtdll.dll
and is completely missing in msvcrt10.dll library.
Version of crtdll.dll library stored in its PE resource directory is not
meaningful as two different libraries, one with _ismbblead symbol and one
without _ismbblead symbol has same version.
Seems that there are MBCS aware crtdll.dll versions with _ismbblead symbol
and versions which are not MBCS aware without _ismbblead symbol.
All checked msvcrt10.dll files do not have _ismbblead symbols, so
msvcrt10.dll is not MBCS awre.
For msvcrt10.dll import library provides simple dummy _ismbblead() function
which always returns false to satisfy mingw-w64 startup file crtexewin.c.
For crtdll.dll import library provides _ismbblead() wrapper function and
disable the real function in the def file to prevent symbol conflicts. The
wrapper function via GetProcAddress() checks if the real crtdll.dll
provides _ismbblead() function. If real function exists then it is called.
If not then wrapper function returns false like the msvcrt10.dll one.
This fixes linking WinMain() entry point with msvcrt10.dll.
ld: /usr/local/lib/libmingw32.a(lib32_libmingw32_a-crtexewin.o): in function `main':
mingw-w64/mingw-w64-crt/crt/crtexewin.c:43: undefined reference to `_ismbblead'
collect2: error: ld returned 1 exit status
And fixes runtime error about missing _ismbblead symbol with some versions of crtdll.dll.
Entry Point Not Found
The procedure entry point _ismbblead could not be located in the
dynamic link library CRTDLL.dll.
Signed-off-by: Martin Storsjö <martin@martin.st>
API for __getmainargs() and __wgetmainargs() functions in msvcrt20.dll is
slightly different than in new msvcrt versions. In msvcrt20.dll these
functions return void and take new_mode parameter instead of the pointer to
the _startupinfo structure.
So for compatibility with mingw-w64 startup code, in msvcrt20 import
library rename exported __getmainargs/__wgetmainargs symbols to
__msvcrt20_getmainargs/__msvcrt20_wgetmainargs and provide mingw-w64
compatible wrappers named __getmainargs/__wgetmainargs around the
renamed symbols __msvcrt20_getmainargs/__msvcrt20_wgetmainargs.
See wine implementation for details:
https://gitlab.winehq.org/wine/wine/-/blob/wine-9.8/dlls/msvcrt20/msvcrt20.c7f1e74a97a
Signed-off-by: Martin Storsjö <martin@martin.st>
API for __getmainargs() function in msvcrt10.dll is same as __GetMainArgs()
function in crtdll.dll. It is slightly different than in any other msvcrt
versions. It returns void and does not the pointer to the _startupinfo
structure as a last argument.
So for compatibility with mingw-w64 startup code, in msvcrt10 import
library rename the real __getmainargs symbol to __GetMainArgs and use
mingw-w64 crtdll.dll's wrapper __getmainargs around the __GetMainArgs for
providing the compatible __getmainargs() function.
Signed-off-by: Martin Storsjö <martin@martin.st>
For 32-bit time_t (detected by _USE_32BIT_TIME_T), functions _fstat32(),
_fstat() and fstat() are same. So fstat() can be defined as simple alias
in def file.
Same applies for functions _fstat64i32(), _fstat() and fstat() when time_t
is 64-bit.
Simplify fstat() function, remove it from mingw-w64-crt/stdio/_fstat.c file
and provide it via aliases in api-ms-win-crt-filesystem-l1-1-0.def.in and
crt-aliases.def.in for all CRT import libraries.
This fixes FIXME issue described in the fstat.c.
This change also ensures that fstat and _fstat symbols would results in the
same function calls.
Signed-off-by: Martin Storsjö <martin@martin.st>
All CRT import libraries provides UCRT-compatible *stat* symbols since
commit b463875615.
So define all stat* macros consistently with definitions of aliases in def
files based on UCRT. There is no need to have ifdef for non-UCRT version
anymore.
Signed-off-by: Martin Storsjö <martin@martin.st>
msvcrtd.dll is debug version of the Visual C++ 4.2, 5.x and 6.x msvcrt.dll
library and provides additional debugging functions.
Signed-off-by: Martin Storsjö <martin@martin.st>
msvcr40d.dll is debug version of the msvcrt40.dll and provides additional
debugging functions.
msvcr40d.def.in def file was generated by gendef from the original
msvcr40d.dll library version and modified with same changes (mostly
documentation) which were done to the msvcrt40.def.in def file.
Signed-off-by: Martin Storsjö <martin@martin.st>
getopt* functions receive also argv[0] argument. So use it for printing
program name instead of the global __argv[0] variable.
This avoids using and importing of the __argv[] DATA symbol from the linked
CRT library, as it is not needed.
Signed-off-by: Martin Storsjö <martin@martin.st>
Both symbols refers to global variable, not the function. So mark them with
DATA for all platforms. gendef detects that _mbcasemap is DATA for all I386
versions of msvcrt.dll (Visual C++ 5.0, 6.0, Win9x, 2000, XP, ... up to 10).
But gendef since Windows XP version of msvcrt.dll cannot autodetect that
_ctype is DATA symbol.
Signed-off-by: Martin Storsjö <martin@martin.st>
This file contains definitions of symbol aliases for any CRT library. It is
already used by msvcrt, crtdll and ucrt. So rename msvcrt-common.def.in to
crt-aliases.def.in as new name better match the purpose of the file.
Signed-off-by: Martin Storsjö <martin@martin.st>
Deduplicate aliases from msvcrt.def.in and ucrtbase.def.in to
def-include/msvcrt-common.def.in.
Note that powl alias was defined only in ucrtbase.def.in, so do not define
it for non-UCRT builds.
Signed-off-by: Martin Storsjö <martin@martin.st>
crtdll.dll library has some DATA symbols with _dll suffix.
Fix generating aliases for these symbols.
With this change also document why those symbols are not for UCRTBASE.
Signed-off-by: Martin Storsjö <martin@martin.st>