From f0131276474997b9d4e593bbf8c5616b879d3bd5 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Tue, 18 May 2021 18:08:43 +0200 Subject: [PATCH] msvcrt: Add sincos to importlib. Fixes cross compilation with GCC 11, which may optimize a pair of sin(), cos() calls to a single sincos() call, which is not exported by any msvcrt version. Signed-off-by: Jacek Caban Signed-off-by: Piotr Caban Signed-off-by: Alexandre Julliard --- dlls/msvcr100/Makefile.in | 1 + dlls/msvcr110/Makefile.in | 1 + dlls/msvcr120/Makefile.in | 1 + dlls/msvcr70/Makefile.in | 1 + dlls/msvcr71/Makefile.in | 1 + dlls/msvcr80/Makefile.in | 1 + dlls/msvcr90/Makefile.in | 1 + dlls/msvcrt/Makefile.in | 1 + dlls/msvcrt/sincos.c | 40 +++++++++++++++++++++++++++++++++++++++ dlls/ucrtbase/Makefile.in | 1 + 10 files changed, 49 insertions(+) create mode 100644 dlls/msvcrt/sincos.c diff --git a/dlls/msvcr100/Makefile.in b/dlls/msvcr100/Makefile.in index c5a7710ea41..edf4b4d4407 100644 --- a/dlls/msvcr100/Makefile.in +++ b/dlls/msvcr100/Makefile.in @@ -34,6 +34,7 @@ C_SRCS = \ process.c \ scanf.c \ scheduler.c \ + sincos.c \ string.c \ thread.c \ time.c \ diff --git a/dlls/msvcr110/Makefile.in b/dlls/msvcr110/Makefile.in index d2ba0ac29e3..c3ee2ca7e8e 100644 --- a/dlls/msvcr110/Makefile.in +++ b/dlls/msvcr110/Makefile.in @@ -34,6 +34,7 @@ C_SRCS = \ process.c \ scanf.c \ scheduler.c \ + sincos.c \ string.c \ thread.c \ time.c \ diff --git a/dlls/msvcr120/Makefile.in b/dlls/msvcr120/Makefile.in index 68a85c581d1..953e9760ca0 100644 --- a/dlls/msvcr120/Makefile.in +++ b/dlls/msvcr120/Makefile.in @@ -34,6 +34,7 @@ C_SRCS = \ process.c \ scanf.c \ scheduler.c \ + sincos.c \ string.c \ thread.c \ time.c \ diff --git a/dlls/msvcr70/Makefile.in b/dlls/msvcr70/Makefile.in index e6dd41b32a5..4c443ecd7f6 100644 --- a/dlls/msvcr70/Makefile.in +++ b/dlls/msvcr70/Makefile.in @@ -33,6 +33,7 @@ C_SRCS = \ onexit.c \ process.c \ scanf.c \ + sincos.c \ string.c \ thread.c \ time.c \ diff --git a/dlls/msvcr71/Makefile.in b/dlls/msvcr71/Makefile.in index 7795ce1ae24..6f51a326c6b 100644 --- a/dlls/msvcr71/Makefile.in +++ b/dlls/msvcr71/Makefile.in @@ -33,6 +33,7 @@ C_SRCS = \ onexit.c \ process.c \ scanf.c \ + sincos.c \ string.c \ thread.c \ time.c \ diff --git a/dlls/msvcr80/Makefile.in b/dlls/msvcr80/Makefile.in index 7d11f65b3a3..3e2da553562 100644 --- a/dlls/msvcr80/Makefile.in +++ b/dlls/msvcr80/Makefile.in @@ -33,6 +33,7 @@ C_SRCS = \ onexit.c \ process.c \ scanf.c \ + sincos.c \ string.c \ thread.c \ time.c \ diff --git a/dlls/msvcr90/Makefile.in b/dlls/msvcr90/Makefile.in index 9cb511bbe06..4a49fcfd254 100644 --- a/dlls/msvcr90/Makefile.in +++ b/dlls/msvcr90/Makefile.in @@ -33,6 +33,7 @@ C_SRCS = \ onexit.c \ process.c \ scanf.c \ + sincos.c \ string.c \ thread.c \ time.c \ diff --git a/dlls/msvcrt/Makefile.in b/dlls/msvcrt/Makefile.in index 486e6f5491b..16405262fca 100644 --- a/dlls/msvcrt/Makefile.in +++ b/dlls/msvcrt/Makefile.in @@ -38,6 +38,7 @@ C_SRCS = \ process.c \ scanf.c \ scheduler.c \ + sincos.c \ string.c \ thread.c \ time.c \ diff --git a/dlls/msvcrt/sincos.c b/dlls/msvcrt/sincos.c new file mode 100644 index 00000000000..1a34c50f034 --- /dev/null +++ b/dlls/msvcrt/sincos.c @@ -0,0 +1,40 @@ +/* + * sincos implementation + * + * Copyright 2021 Jacek Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#if 0 +#pragma makedep implib +#endif + +#include + +/* GCC may optimize a pair of sin(), cos() calls to a single sincos() call, + * which is not exported by any msvcrt version. */ + +void sincos(double x, double *s, double *c) +{ + *s = sin(x); + *c = cos(x); +} + +void sincosf(float x, float *s, float *c) +{ + *s = sinf(x); + *c = cosf(x); +} diff --git a/dlls/ucrtbase/Makefile.in b/dlls/ucrtbase/Makefile.in index a576cf0250b..2910016f29f 100644 --- a/dlls/ucrtbase/Makefile.in +++ b/dlls/ucrtbase/Makefile.in @@ -37,6 +37,7 @@ C_SRCS = \ printf.c \ process.c \ scanf.c \ + sincos.c \ string.c \ thread.c \ time.c \