This reverts commit 91459ac35276522b0e4405c76795d91822bb395a.

That commit was a workaround for older binutils or LLD versions,
that would otherwise autoexport symbols from the CRT libraries.

Since 9d9c67b06c1bf4c4550e3de0eb575c2bfbe96df9 in binutils (in 2017),
binutils does exclude "libmsvcrt", "libmsvcrt-os" and "libucrtbase"
from autoexport; likewise, LLD also learnt to exclude "libmsvcrt"
and "libucrtbase" in 6bde1667bac6d474c70cdcf3f2388d32726f76b7
in 2017. So by now, it should be more than safe to remove the
workaround. (And even with older linkers, the only issue is that
more symbols than wanted are autoexported.)

Therefore, revert this workaround, to stop providing __imp_ prefixed
symbols for symbols that aren't accessed with dllimport anywhere.

Not all symbols that were added in that commit are removed; ones
declared in public or internal headers as _CRTIMP are kept.

Also remove similar cases in new ucrt_*.c files that have been
added since. All such cases are removed except for _vscprintf,
as that function uses a declaration with _CRTIMP even for UCRT.
---
 mingw-w64-crt/misc/ucrt_tzset.c        | 3 ---
 mingw-w64-crt/stdio/ucrt__scprintf.c   | 1 -
 mingw-w64-crt/stdio/ucrt__snprintf.c   | 1 -
 mingw-w64-crt/stdio/ucrt__snscanf.c    | 1 -
 mingw-w64-crt/stdio/ucrt__snwprintf.c  | 2 --
 mingw-w64-crt/stdio/ucrt__vsnprintf.c  | 1 -
 mingw-w64-crt/stdio/ucrt__vsnwprintf.c | 1 -
 mingw-w64-crt/stdio/ucrt_fprintf.c     | 1 -
 mingw-w64-crt/stdio/ucrt_fscanf.c      | 1 -
 mingw-w64-crt/stdio/ucrt_fwprintf.c    | 2 --
 mingw-w64-crt/stdio/ucrt_ms_fprintf.c  | 1 -
 mingw-w64-crt/stdio/ucrt_ms_fwprintf.c | 1 -
 mingw-w64-crt/stdio/ucrt_printf.c      | 1 -
 mingw-w64-crt/stdio/ucrt_scanf.c       | 1 -
 mingw-w64-crt/stdio/ucrt_snprintf.c    | 1 -
 mingw-w64-crt/stdio/ucrt_sprintf.c     | 1 -
 mingw-w64-crt/stdio/ucrt_sscanf.c      | 2 --
 mingw-w64-crt/stdio/ucrt_vfprintf.c    | 1 -
 mingw-w64-crt/stdio/ucrt_vfscanf.c     | 1 -
 mingw-w64-crt/stdio/ucrt_vprintf.c     | 1 -
 mingw-w64-crt/stdio/ucrt_vscanf.c      | 1 -
 mingw-w64-crt/stdio/ucrt_vsnprintf.c   | 1 -
 mingw-w64-crt/stdio/ucrt_vsprintf.c    | 1 -
 mingw-w64-crt/stdio/ucrt_vsscanf.c     | 1 -
 24 files changed, 29 deletions(-)

diff --git a/mingw-w64-crt/misc/ucrt_tzset.c b/mingw-w64-crt/misc/ucrt_tzset.c
index fbb2cc830..7157ba226 100644
--- a/mingw-w64-crt/misc/ucrt_tzset.c
+++ b/mingw-w64-crt/misc/ucrt_tzset.c
@@ -40,6 +40,3 @@ void __cdecl tzset(void)
 {
   _tzset();
 }
-
-// Dummy/unused __imp_ wrappers, to make GNU ld not autoexport these symbols.
-void __cdecl (*__MINGW_IMP_SYMBOL(tzset))(void) = tzset;
diff --git a/mingw-w64-crt/stdio/ucrt__scprintf.c 
b/mingw-w64-crt/stdio/ucrt__scprintf.c
index 72e321615..0da8210fb 100644
--- a/mingw-w64-crt/stdio/ucrt__scprintf.c
+++ b/mingw-w64-crt/stdio/ucrt__scprintf.c
@@ -18,4 +18,3 @@ int __cdecl _scprintf(const char * __restrict__ _Format, ...)
   va_end(_ArgList);
   return ret;
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(_scprintf))(const char *__restrict__, ...) = 
_scprintf;
diff --git a/mingw-w64-crt/stdio/ucrt__snprintf.c 
b/mingw-w64-crt/stdio/ucrt__snprintf.c
index 7b8794c90..4f2dc80e5 100644
--- a/mingw-w64-crt/stdio/ucrt__snprintf.c
+++ b/mingw-w64-crt/stdio/ucrt__snprintf.c
@@ -18,4 +18,3 @@ int __cdecl _snprintf(char * __restrict__ _Dest, size_t 
_Count, const char * __r
   va_end(_Args);
   return ret;
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(_snprintf))(char *__restrict__, size_t, const 
char *__restrict__, ...) = _snprintf;
diff --git a/mingw-w64-crt/stdio/ucrt__snscanf.c 
b/mingw-w64-crt/stdio/ucrt__snscanf.c
index 341b0e5ad..10ce566f0 100644
--- a/mingw-w64-crt/stdio/ucrt__snscanf.c
+++ b/mingw-w64-crt/stdio/ucrt__snscanf.c
@@ -18,4 +18,3 @@ int __cdecl _snscanf(const char * __restrict__ _Src, size_t 
_MaxCount, const cha
   va_end(_ArgList);
   return ret;
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(_snscanf))(const char *__restrict__, size_t, 
const char * __restrict__, ...) = _snscanf;
diff --git a/mingw-w64-crt/stdio/ucrt__snwprintf.c 
b/mingw-w64-crt/stdio/ucrt__snwprintf.c
index 07cdf18a4..94fdc1b37 100644
--- a/mingw-w64-crt/stdio/ucrt__snwprintf.c
+++ b/mingw-w64-crt/stdio/ucrt__snwprintf.c
@@ -34,8 +34,6 @@ int __cdecl _snwprintf(wchar_t * restrict _Dest, size_t 
_Count, const wchar_t *
   va_end(ap);
   return ret;
 }
-
-int __cdecl (*__MINGW_IMP_SYMBOL(_snwprintf))(wchar_t *restrict, size_t, const 
wchar_t *restrict, ...) = _snwprintf;
 #ifdef __GNUC__
 #pragma GCC diagnostic pop
 #endif
diff --git a/mingw-w64-crt/stdio/ucrt__vsnprintf.c 
b/mingw-w64-crt/stdio/ucrt__vsnprintf.c
index fbdf4f881..758b4b525 100644
--- a/mingw-w64-crt/stdio/ucrt__vsnprintf.c
+++ b/mingw-w64-crt/stdio/ucrt__vsnprintf.c
@@ -12,4 +12,3 @@ int __cdecl _vsnprintf(char * __restrict__ _Dest,size_t 
_Count,const char * __re
 {
   return __stdio_common_vsprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | 
_CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, _Dest, _Count, _Format, 
NULL, _Args);
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(_vsnprintf))(char *__restrict__, size_t, 
const char *__restrict__, va_list) = _vsnprintf;
diff --git a/mingw-w64-crt/stdio/ucrt__vsnwprintf.c 
b/mingw-w64-crt/stdio/ucrt__vsnwprintf.c
index 7f88fee8e..376a683b9 100644
--- a/mingw-w64-crt/stdio/ucrt__vsnwprintf.c
+++ b/mingw-w64-crt/stdio/ucrt__vsnwprintf.c
@@ -12,4 +12,3 @@ int __cdecl _vsnwprintf(wchar_t * __restrict__ _Dest,size_t 
_Count,const wchar_t
 {
   return __stdio_common_vswprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | 
_CRT_INTERNAL_PRINTF_LEGACY_VSPRINTF_NULL_TERMINATION, _Dest, _Count, _Format, 
NULL, _Args);
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(_vsnwprintf))(wchar_t *__restrict__, size_t, 
const wchar_t *__restrict__, va_list) = _vsnwprintf;
diff --git a/mingw-w64-crt/stdio/ucrt_fprintf.c 
b/mingw-w64-crt/stdio/ucrt_fprintf.c
index ab223d62f..0b06b14e9 100644
--- a/mingw-w64-crt/stdio/ucrt_fprintf.c
+++ b/mingw-w64-crt/stdio/ucrt_fprintf.c
@@ -17,4 +17,3 @@ int __cdecl fprintf(FILE * __restrict__ _File,const char * 
__restrict__ _Format,
   __builtin_va_end(ap);
   return ret;
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(fprintf))(FILE *__restrict__, const char 
*__restrict__, ...) = fprintf;
diff --git a/mingw-w64-crt/stdio/ucrt_fscanf.c 
b/mingw-w64-crt/stdio/ucrt_fscanf.c
index 4b013f0a7..f42e5a51e 100644
--- a/mingw-w64-crt/stdio/ucrt_fscanf.c
+++ b/mingw-w64-crt/stdio/ucrt_fscanf.c
@@ -16,4 +16,3 @@ int __cdecl fscanf(FILE * __restrict__ _File,const char * 
__restrict__ _Format,.
   __builtin_va_end(__ap);
   return __ret;
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(fscanf))(FILE *__restrict__, const char 
*__restrict__, ...) = fscanf;
diff --git a/mingw-w64-crt/stdio/ucrt_fwprintf.c 
b/mingw-w64-crt/stdio/ucrt_fwprintf.c
index d51a6d692..5bd72247f 100644
--- a/mingw-w64-crt/stdio/ucrt_fwprintf.c
+++ b/mingw-w64-crt/stdio/ucrt_fwprintf.c
@@ -34,8 +34,6 @@ int __cdecl fwprintf(FILE *ptr, const wchar_t *fmt, ...)
   va_end(ap);
   return ret;
 }
-
-int __cdecl (*__MINGW_IMP_SYMBOL(fwprintf))(FILE *, const wchar_t *, ...) = 
fwprintf;
 #ifdef __GNUC__
 #pragma GCC diagnostic pop
 #endif
diff --git a/mingw-w64-crt/stdio/ucrt_ms_fprintf.c 
b/mingw-w64-crt/stdio/ucrt_ms_fprintf.c
index 15588bcae..09b21a31e 100644
--- a/mingw-w64-crt/stdio/ucrt_ms_fprintf.c
+++ b/mingw-w64-crt/stdio/ucrt_ms_fprintf.c
@@ -19,4 +19,3 @@ int __cdecl __ms_fprintf(FILE * restrict file, const char * 
restrict format, ...
   va_end(ap);
   return ret;
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(__ms_fprintf))(FILE * restrict, const char * 
restrict, ...) = __ms_fprintf;
diff --git a/mingw-w64-crt/stdio/ucrt_ms_fwprintf.c 
b/mingw-w64-crt/stdio/ucrt_ms_fwprintf.c
index f44c78d94..9244f941a 100644
--- a/mingw-w64-crt/stdio/ucrt_ms_fwprintf.c
+++ b/mingw-w64-crt/stdio/ucrt_ms_fwprintf.c
@@ -21,4 +21,3 @@ int __cdecl __ms_fwprintf(FILE *file, const wchar_t *fmt, ...)
   va_end(ap);
   return ret;
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(__ms_fwprintf))(FILE *, const wchar_t *, ...) 
= __ms_fwprintf;
diff --git a/mingw-w64-crt/stdio/ucrt_printf.c 
b/mingw-w64-crt/stdio/ucrt_printf.c
index 4ecf1548c..02d2f706b 100644
--- a/mingw-w64-crt/stdio/ucrt_printf.c
+++ b/mingw-w64-crt/stdio/ucrt_printf.c
@@ -17,4 +17,3 @@ int __cdecl printf(const char * __restrict__ _Format,...)
   __builtin_va_end(ap);
   return ret;
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(printf))(const char *__restrict__, ...) = 
printf;
diff --git a/mingw-w64-crt/stdio/ucrt_scanf.c b/mingw-w64-crt/stdio/ucrt_scanf.c
index 0e5035d15..1aaff2fe6 100644
--- a/mingw-w64-crt/stdio/ucrt_scanf.c
+++ b/mingw-w64-crt/stdio/ucrt_scanf.c
@@ -16,4 +16,3 @@ int __cdecl scanf(const char * __restrict__ _Format,...) {
   __builtin_va_end(__ap);
   return __ret;
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(scanf))(const char *__restrict__, ...) = 
scanf;
diff --git a/mingw-w64-crt/stdio/ucrt_snprintf.c 
b/mingw-w64-crt/stdio/ucrt_snprintf.c
index 56bc7400e..19b832925 100644
--- a/mingw-w64-crt/stdio/ucrt_snprintf.c
+++ b/mingw-w64-crt/stdio/ucrt_snprintf.c
@@ -17,4 +17,3 @@ int __cdecl snprintf (char * __restrict__ __stream, size_t 
__n, const char * __r
   __builtin_va_end(ap);
   return ret;
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(snprintf))(char *__restrict__, size_t, const 
char *__restrict__, ...) = snprintf;
diff --git a/mingw-w64-crt/stdio/ucrt_sprintf.c 
b/mingw-w64-crt/stdio/ucrt_sprintf.c
index 69ee54cae..5da61d1e4 100644
--- a/mingw-w64-crt/stdio/ucrt_sprintf.c
+++ b/mingw-w64-crt/stdio/ucrt_sprintf.c
@@ -17,4 +17,3 @@ int __cdecl sprintf(char * __restrict__ _Dest,const char * 
__restrict__ _Format,
   __builtin_va_end(ap);
   return ret;
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(sprintf))(char *__restrict__, const char 
*__restrict__, ...) = sprintf;
diff --git a/mingw-w64-crt/stdio/ucrt_sscanf.c 
b/mingw-w64-crt/stdio/ucrt_sscanf.c
index eb87379c4..ebbaf50ac 100644
--- a/mingw-w64-crt/stdio/ucrt_sscanf.c
+++ b/mingw-w64-crt/stdio/ucrt_sscanf.c
@@ -16,5 +16,3 @@ int __cdecl sscanf(const char * __restrict__ _Src,const char 
* __restrict__ _For
   __builtin_va_end(__ap);
   return __ret;
 }
-
-int __cdecl (*__MINGW_IMP_SYMBOL(sscanf))(const char *__restrict__, const char 
*__restrict__, ...) = sscanf;
diff --git a/mingw-w64-crt/stdio/ucrt_vfprintf.c 
b/mingw-w64-crt/stdio/ucrt_vfprintf.c
index 7ee9c9b74..6ac1bb8c1 100644
--- a/mingw-w64-crt/stdio/ucrt_vfprintf.c
+++ b/mingw-w64-crt/stdio/ucrt_vfprintf.c
@@ -12,4 +12,3 @@ int __cdecl vfprintf(FILE * __restrict__ _File,const char * 
__restrict__ _Format
 {
   return __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, _File, 
_Format, NULL, _ArgList);
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(vfprintf))(FILE *__restrict__, const char 
*__restrict__, va_list) = vfprintf;
diff --git a/mingw-w64-crt/stdio/ucrt_vfscanf.c 
b/mingw-w64-crt/stdio/ucrt_vfscanf.c
index 8d1a76a8b..07b165f33 100644
--- a/mingw-w64-crt/stdio/ucrt_vfscanf.c
+++ b/mingw-w64-crt/stdio/ucrt_vfscanf.c
@@ -11,4 +11,3 @@
 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) = vfscanf;
diff --git a/mingw-w64-crt/stdio/ucrt_vprintf.c 
b/mingw-w64-crt/stdio/ucrt_vprintf.c
index 2964dd1be..abae22a90 100644
--- a/mingw-w64-crt/stdio/ucrt_vprintf.c
+++ b/mingw-w64-crt/stdio/ucrt_vprintf.c
@@ -12,4 +12,3 @@ int __cdecl vprintf(const char * __restrict__ _Format,va_list 
_ArgList)
 {
   return __stdio_common_vfprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS, stdout, 
_Format, NULL, _ArgList);
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(vprintf))(const char *__restrict__, va_list) 
= vprintf;
diff --git a/mingw-w64-crt/stdio/ucrt_vscanf.c 
b/mingw-w64-crt/stdio/ucrt_vscanf.c
index fc5ae1b1e..b694eedfe 100644
--- a/mingw-w64-crt/stdio/ucrt_vscanf.c
+++ b/mingw-w64-crt/stdio/ucrt_vscanf.c
@@ -11,4 +11,3 @@
 int __cdecl vscanf(const char *__format, __builtin_va_list __local_argv) {
   return __stdio_common_vfscanf(0, stdin, __format, NULL, __local_argv);
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(vscanf))(const char *, __builtin_va_list) = 
vscanf;
diff --git a/mingw-w64-crt/stdio/ucrt_vsnprintf.c 
b/mingw-w64-crt/stdio/ucrt_vsnprintf.c
index 94ed44add..5ccf5fafe 100644
--- a/mingw-w64-crt/stdio/ucrt_vsnprintf.c
+++ b/mingw-w64-crt/stdio/ucrt_vsnprintf.c
@@ -12,4 +12,3 @@ int __cdecl vsnprintf (char * __restrict__ __stream, size_t 
__n, const char * __
 {
   return __stdio_common_vsprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | 
_CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, __stream, __n, __format, NULL, 
__local_argv);
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(vsnprintf))(char *__restrict__, size_t, const 
char *__restrict__, va_list) = vsnprintf;
diff --git a/mingw-w64-crt/stdio/ucrt_vsprintf.c 
b/mingw-w64-crt/stdio/ucrt_vsprintf.c
index 3bdddd6c6..a9f5593f1 100644
--- a/mingw-w64-crt/stdio/ucrt_vsprintf.c
+++ b/mingw-w64-crt/stdio/ucrt_vsprintf.c
@@ -12,4 +12,3 @@ int __cdecl vsprintf(char * __restrict__ _Dest,const char * 
__restrict__ _Format
 {
   return __stdio_common_vsprintf(_CRT_INTERNAL_LOCAL_PRINTF_OPTIONS | 
_CRT_INTERNAL_PRINTF_STANDARD_SNPRINTF_BEHAVIOR, _Dest, (size_t)-1, _Format, 
NULL, _Args);
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(vsprintf))(char *__restrict__, const char 
*__restrict__, va_list) = vsprintf;
diff --git a/mingw-w64-crt/stdio/ucrt_vsscanf.c 
b/mingw-w64-crt/stdio/ucrt_vsscanf.c
index 1fb76fcf1..44ccccec8 100644
--- a/mingw-w64-crt/stdio/ucrt_vsscanf.c
+++ b/mingw-w64-crt/stdio/ucrt_vsscanf.c
@@ -11,4 +11,3 @@
 int __cdecl vsscanf (const char * __restrict__ __source, const char * 
__restrict__ __format, __builtin_va_list __local_argv) {
   return __stdio_common_vsscanf(0, __source, (size_t)-1, __format, NULL, 
__local_argv);
 }
-int __cdecl (*__MINGW_IMP_SYMBOL(vsscanf))(const char *__restrict, const char 
*__restrict__, __builtin_va_list) = vsscanf;
-- 
2.43.0



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to