crt: Define ftello64 symbol as alias to _ftelli64

mingw-w64 implementation of ftello64() and _ftelli64() functions are same.

So remove the ftello64 implementation and define ftello64 symbol as an
alias to the _ftelli64 symbol.

This change allows to use native msvcr80+ / UCRT implementation of
_ftelli64() function for the POSIX ftello64() instead of statically linking
the mingw-w64 implementation.

Signed-off-by: Martin Storsjö <martin@martin.st>
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 8ee5b8c..dfe88f6 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -1127,7 +1127,7 @@
   stdio/_Exit.c            stdio/_findfirst64i32.c   stdio/_findnext64i32.c   stdio/_wfindfirst64i32.c  stdio/_wfindnext64i32.c \
   stdio/asprintf.c \
   stdio/fopen64.c                                                                                                               \
-  stdio/ftello64.c         stdio/ftruncate64.c       stdio/lltoa.c            stdio/lltow.c             stdio/lseek64.c         \
+  stdio/ftruncate64.c      stdio/lltoa.c             stdio/lltow.c             stdio/lseek64.c \
   stdio/__mingw_fix_stat.h stdio/__mingw_fix_stat_finish.c \
   stdio/__mingw_fix_stat_path.c stdio/__mingw_fix_wstat_path.c \
   \
diff --git a/mingw-w64-crt/def-include/crt-aliases.def.in b/mingw-w64-crt/def-include/crt-aliases.def.in
index b30e8ea..eb80f45 100644
--- a/mingw-w64-crt/def-include/crt-aliases.def.in
+++ b/mingw-w64-crt/def-include/crt-aliases.def.in
@@ -321,6 +321,7 @@
 #endif
 #ifndef FIXED_SIZE_SYMBOLS
 fseeko64 == _fseeki64
+ftello64 == _ftelli64
 #endif
 
 ; This is list of symbol aliases for GNU functions which are not part of POSIX or ISO C
diff --git a/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def b/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def
index 38bd1aa..f22ad05 100644
--- a/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def
+++ b/mingw-w64-crt/lib-common/api-ms-win-crt-stdio-l1-1-0.def
@@ -68,6 +68,7 @@
 _fsopen
 _ftell_nolock
 _ftelli64
+ftello64 == _ftelli64
 _ftelli64_nolock
 _fwrite_nolock
 _get_fmode
diff --git a/mingw-w64-crt/stdio/_ftelli64.c b/mingw-w64-crt/stdio/_ftelli64.c
index c139099..b2589c5 100644
--- a/mingw-w64-crt/stdio/_ftelli64.c
+++ b/mingw-w64-crt/stdio/_ftelli64.c
@@ -17,3 +17,6 @@
 }
 
 __int64 __cdecl (*__MINGW_IMP_SYMBOL(_ftelli64))(FILE*) = _ftelli64;
+
+_off64_t __attribute__ ((alias ("_ftelli64"))) __cdecl ftello64(FILE*);
+extern _off64_t __attribute__ ((alias (__MINGW64_STRINGIFY(__MINGW_IMP_SYMBOL(_ftelli64))))) (__cdecl *__MINGW_IMP_SYMBOL(ftello64))(FILE*);
diff --git a/mingw-w64-crt/stdio/ftello64.c b/mingw-w64-crt/stdio/ftello64.c
deleted file mode 100644
index a0192fb..0000000
--- a/mingw-w64-crt/stdio/ftello64.c
+++ /dev/null
@@ -1,16 +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.
- */
-#include <stdio.h>
-
-_off64_t
-ftello64 (FILE * stream)
-{
-  fpos_t pos;
-  if (fgetpos(stream, &pos))
-    return  -1LL;
-  else
-   return ((off64_t) pos);
-}