aboutsummaryrefslogtreecommitdiff
path: root/libgcc
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@golang.org>2021-03-11 16:12:22 -0800
committerIan Lance Taylor <iant@golang.org>2021-03-11 16:12:22 -0800
commitbc636c218f2b28da06cd1404d5b35d1f8cc43fd1 (patch)
tree764937d8460563db6132d7c75e19b95ef3ea6ea8 /libgcc
parent89d7be42db00cd0953e7d4584877cf50a56ed046 (diff)
parent7ad5a72c8bc6aa71a0d195ddfa207db01265fe0b (diff)
downloadgcc-bc636c218f2b28da06cd1404d5b35d1f8cc43fd1.zip
gcc-bc636c218f2b28da06cd1404d5b35d1f8cc43fd1.tar.gz
gcc-bc636c218f2b28da06cd1404d5b35d1f8cc43fd1.tar.bz2
Merge from trunk revision 7ad5a72c8bc6aa71a0d195ddfa207db01265fe0b.
Diffstat (limited to 'libgcc')
-rw-r--r--libgcc/ChangeLog88
-rw-r--r--libgcc/config.in3
-rw-r--r--libgcc/config/arm/t-arm2
-rw-r--r--libgcc/config/rs6000/_dd_to_kf.c37
-rw-r--r--libgcc/config/rs6000/_kf_to_dd.c37
-rw-r--r--libgcc/config/rs6000/_kf_to_sd.c37
-rw-r--r--libgcc/config/rs6000/_kf_to_td.c37
-rw-r--r--libgcc/config/rs6000/_sd_to_kf.c37
-rw-r--r--libgcc/config/rs6000/_sprintfkf.c58
-rw-r--r--libgcc/config/rs6000/_sprintfkf.h27
-rw-r--r--libgcc/config/rs6000/_strtokf.c53
-rw-r--r--libgcc/config/rs6000/_strtokf.h27
-rw-r--r--libgcc/config/rs6000/_td_to_kf.c37
-rw-r--r--libgcc/config/rs6000/quad-float128.h8
-rw-r--r--libgcc/config/rs6000/t-float12837
-rwxr-xr-xlibgcc/configure4
-rw-r--r--libgcc/configure.ac2
-rw-r--r--libgcc/dfp-bit.c13
-rw-r--r--libgcc/dfp-bit.h26
-rw-r--r--libgcc/libgcc2.c2
-rw-r--r--libgcc/libgcov-driver.c66
-rw-r--r--libgcc/libgcov.h63
22 files changed, 672 insertions, 29 deletions
diff --git a/libgcc/ChangeLog b/libgcc/ChangeLog
index 90bea1b..a99aaa0 100644
--- a/libgcc/ChangeLog
+++ b/libgcc/ChangeLog
@@ -1,3 +1,91 @@
+2021-03-06 Jakub Jelinek <jakub@redhat.com>
+
+ PR gcov-profile/99406
+ * libgcov.h (MAP_FAILED, MAP_ANONYMOUS): If HAVE_SYS_MMAN_H is
+ defined, define these macros if not defined already.
+
+2021-03-04 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/99105
+ * libgcov-driver.c (write_top_counters): Rename to ...
+ (write_topn_counters): ... this.
+ (write_one_data): Pre-allocate buffer for number of items
+ in the corresponding linked lists.
+ * libgcov.h (malloc_mmap): New function.
+ (allocate_gcov_kvp): Use it.
+
+2021-03-04 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/99385
+ * libgcov.h (allocate_gcov_kvp): Call mmap with fd equal to -1.
+
+2021-03-03 Martin Liska <mliska@suse.cz>
+
+ PR gcov-profile/97461
+ * config.in: Regenerate.
+ * configure: Likewise.
+ * configure.ac: Check sys/mman.h header file
+ * libgcov-driver.c (struct gcov_kvp): Remove static
+ pre-allocated pool and use a dynamic one.
+ * libgcov.h (MMAP_CHUNK_SIZE): New.
+ (gcov_counter_add): Use mmap to allocate pool for struct
+ gcov_kvp.
+
+2021-03-02 Michael Meissner <meissner@linux.ibm.com>
+
+ * config/rs6000/_sprintfkf.h (__sprintfkf): Fix prototype to match
+ the function.
+ * config/rs6000/_sprintfkf.c: Include _sprintfkf.h.
+
+2021-02-24 Jakub Jelinek <jakub@redhat.com>
+
+ PR libgcc/99236
+ * libgcc2.c (__powisf2, __powidf2, __powitf2, __powixf2): Perform
+ negation of m in unsigned type.
+
+2021-02-24 Christophe Lyon <christophe.lyon@linaro.org>
+ Hau Hsu <hsuhau617@gmail.com>
+
+ PR target/99157
+ * config/arm/t-arm: Fix cmse support detection.
+
+2021-02-22 Michael Meissner <meissner@linux.ibm.com>
+
+ * dfp-bit.c (BFP_TO_DFP): Fix a comment line that was too long.
+
+2021-02-22 Michael Meissner <meissner@linux.ibm.com>
+
+ * config/rs6000/_dd_to_kf.c: New file.
+ * config/rs6000/_kf_to_dd.c: New file.
+ * config/rs6000/_kf_to_sd.c: New file.
+ * config/rs6000/_kf_to_td.c: New file.
+ * config/rs6000/_sd_to_kf.c: New file.
+ * config/rs6000/_sprintfkf.c: New file.
+ * config/rs6000/_sprintfkf.h: New file.
+ * config/rs6000/_strtokf.h: New file.
+ * config/rs6000/_strtokf.c: New file.
+ * config/rs6000/_td_to_kf.c: New file.
+ * config/rs6000/quad-float128.h: Add new declarations.
+ * config/rs6000/t-float128 (fp128_dec_funcs): New macro.
+ (fp128_decstr_funcs): New macro.
+ (ibm128_dec_funcs): New macro.
+ (fp128_ppc_funcs): Add the new conversions.
+ (fp128_dec_objs): Force Decimal <-> __float128 conversions to be
+ compiled with -mabi=ieeelongdouble.
+ (fp128_decstr_objs): Force __float128 <-> string conversions to be
+ compiled with -mabi=ibmlongdouble.
+ (ibm128_dec_objs): Force Decimal <-> __float128 conversions to be
+ compiled with -mabi=ieeelongdouble.
+ (FP128_CFLAGS_DECIMAL): New macro.
+ (IBM128_CFLAGS_DECIMAL): New macro.
+ * dfp-bit.c (DFP_TO_BFP): Add PowerPC _Float128 support.
+ (BFP_TO_DFP): Add PowerPC _Float128 support.
+ * dfp-bit.h (BFP_KIND): Add new binary floating point kind for
+ IEEE 128-bit floating point.
+ (DFP_TO_BFP): Add PowerPC _Float128 support.
+ (BFP_TO_DFP): Add PowerPC _Float128 support.
+ (BFP_SPRINTF): New macro.
+
2021-01-27 Jakub Jelinek <jakub@redhat.com>
* config/i386/savms64.h: Add .note.GNU-stack section on Linux.
diff --git a/libgcc/config.in b/libgcc/config.in
index 5be5321..f93c64a 100644
--- a/libgcc/config.in
+++ b/libgcc/config.in
@@ -49,6 +49,9 @@
/* Define to 1 if you have the <sys/auxv.h> header file. */
#undef HAVE_SYS_AUXV_H
+/* Define to 1 if you have the <sys/mman.h> header file. */
+#undef HAVE_SYS_MMAN_H
+
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
diff --git a/libgcc/config/arm/t-arm b/libgcc/config/arm/t-arm
index 364f40e..3625a25 100644
--- a/libgcc/config/arm/t-arm
+++ b/libgcc/config/arm/t-arm
@@ -4,7 +4,7 @@ LIB1ASMFUNCS = _thumb1_case_sqi _thumb1_case_uqi _thumb1_case_shi \
HAVE_CMSE:=$(findstring __ARM_FEATURE_CMSE,$(shell $(gcc_compile_bare) -dM -E - </dev/null))
HAVE_V81M:=$(findstring armv8.1-m.main,$(gcc_compile_bare))
-ifeq ($(shell $(gcc_compile_bare) -E -mcmse - </dev/null >/dev/null 2>/dev/null; echo $?),0)
+ifeq ($(shell $(gcc_compile_bare) -E -mcmse - </dev/null >/dev/null 2>/dev/null; echo $$?),0)
CMSE_OPTS:=-mcmse
endif
diff --git a/libgcc/config/rs6000/_dd_to_kf.c b/libgcc/config/rs6000/_dd_to_kf.c
new file mode 100644
index 0000000..6613c44
--- /dev/null
+++ b/libgcc/config/rs6000/_dd_to_kf.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* Decimal64 -> _Float128 conversion. */
+
+/* FINE_GRAINED_LIBRARIES is used so we can isolate just to dd_to_tf conversion
+ function from dp-bits.c. */
+#define FINE_GRAINED_LIBRARIES 1
+#define L_dd_to_kf 1
+#define WIDTH 64
+
+#if !defined(__LONG_DOUBLE_128__) || !defined(__LONG_DOUBLE_IEEE128__)
+#error "Long double is not IEEE 128-bit"
+#endif
+
+/* Use dfp-bit.c to do the real work. */
+#include "dfp-bit.c"
diff --git a/libgcc/config/rs6000/_kf_to_dd.c b/libgcc/config/rs6000/_kf_to_dd.c
new file mode 100644
index 0000000..93a1043
--- /dev/null
+++ b/libgcc/config/rs6000/_kf_to_dd.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* _Float128 -> Decimal64 conversion. */
+
+/* FINE_GRAINED_LIBRARIES is used so we can isolate just to tf_to_dd conversion
+ function from dp-bits.c. */
+#define FINE_GRAINED_LIBRARIES 1
+#define L_kf_to_dd 1
+#define WIDTH 64
+
+#if !defined(__LONG_DOUBLE_128__) || !defined(__LONG_DOUBLE_IEEE128__)
+#error "Long double is not IEEE 128-bit"
+#endif
+
+/* Use dfp-bit.c to do the real work. */
+#include "dfp-bit.c"
diff --git a/libgcc/config/rs6000/_kf_to_sd.c b/libgcc/config/rs6000/_kf_to_sd.c
new file mode 100644
index 0000000..01396da
--- /dev/null
+++ b/libgcc/config/rs6000/_kf_to_sd.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* _Float128 -> Decimal32 conversion. */
+
+/* FINE_GRAINED_LIBRARIES is used so we can isolate just to tf_to_sd conversion
+ function from dp-bits.c. */
+#define FINE_GRAINED_LIBRARIES 1
+#define L_kf_to_sd 1
+#define WIDTH 32
+
+#if !defined(__LONG_DOUBLE_128__) || !defined(__LONG_DOUBLE_IEEE128__)
+#error "Long double is not IEEE 128-bit"
+#endif
+
+/* Use dfp-bit.c to do the real work. */
+#include "dfp-bit.c"
diff --git a/libgcc/config/rs6000/_kf_to_td.c b/libgcc/config/rs6000/_kf_to_td.c
new file mode 100644
index 0000000..45bba92
--- /dev/null
+++ b/libgcc/config/rs6000/_kf_to_td.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* _Float128 -> Decimal128 conversion. */
+
+/* FINE_GRAINED_LIBRARIES is used so we can isolate just to tf_to_td conversion
+ function from dp-bits.c. */
+#define FINE_GRAINED_LIBRARIES 1
+#define L_kf_to_td 1
+#define WIDTH 128
+
+#if !defined(__LONG_DOUBLE_128__) || !defined(__LONG_DOUBLE_IEEE128__)
+#error "Long double is not IEEE 128-bit"
+#endif
+
+/* Use dfp-bit.c to do the real work. */
+#include "dfp-bit.c"
diff --git a/libgcc/config/rs6000/_sd_to_kf.c b/libgcc/config/rs6000/_sd_to_kf.c
new file mode 100644
index 0000000..9224444
--- /dev/null
+++ b/libgcc/config/rs6000/_sd_to_kf.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* Decimal32 -> _Float128 conversion. */
+
+/* FINE_GRAINED_LIBRARIES is used so we can isolate just to sd_to_tf conversion
+ function from dp-bits.c. */
+#define FINE_GRAINED_LIBRARIES 1
+#define L_sd_to_kf 1
+#define WIDTH 32
+
+#if !defined(__LONG_DOUBLE_128__) || !defined(__LONG_DOUBLE_IEEE128__)
+#error "Long double is not IEEE 128-bit"
+#endif
+
+/* Use dfp-bit.c to do the real work. */
+#include "dfp-bit.c"
diff --git a/libgcc/config/rs6000/_sprintfkf.c b/libgcc/config/rs6000/_sprintfkf.c
new file mode 100644
index 0000000..2d624f1
--- /dev/null
+++ b/libgcc/config/rs6000/_sprintfkf.c
@@ -0,0 +1,58 @@
+/* Copyright (C) 1989-2021 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* Conversion to IEEE 128-bit floating point from string using snprintf. */
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <soft-fp.h>
+#include <quad-float128.h>
+#include <stdio.h>
+#include <_sprintfkf.h>
+
+/* This function must be built with IBM 128-bit as long double, so that we can
+ access the strfroml function if do not have an IEEE 128-bit version, and if
+ that is not available, use sprintf. */
+#if !defined(__LONG_DOUBLE_128__) || !defined(__LONG_DOUBLE_IBM128__)
+#error "Long double is not IBM 128-bit"
+#endif
+
+/* If the user is using GLIBC 2.32, we can use the __snprintfieee128 function.
+
+ If we are linked against an earlier library, we will have fake it by
+ converting the value to long double, and using sprintf to do the conversion.
+ This isn't ideal, as IEEE 128-bit has more exponent range than IBM
+ 128-bit. */
+
+extern int __sprintfieee128 (char *restrict, const char *restrict, ...)
+ __attribute__ ((__weak__));
+
+int __sprintfkf (char *restrict string,
+ const char *restrict format,
+ _Float128 number)
+{
+ if (__sprintfieee128)
+ return __sprintfieee128 (string, format, number);
+
+ return sprintf (string, format, (long double) number);
+}
diff --git a/libgcc/config/rs6000/_sprintfkf.h b/libgcc/config/rs6000/_sprintfkf.h
new file mode 100644
index 0000000..de9d713
--- /dev/null
+++ b/libgcc/config/rs6000/_sprintfkf.h
@@ -0,0 +1,27 @@
+/* Copyright (C) 1989-2021 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* Declaration of the conversion function to IEEE 128-bit floating point from
+ string using snprintf. */
+
+extern int __sprintfkf (char *restrict, const char *restrict, _Float128);
diff --git a/libgcc/config/rs6000/_strtokf.c b/libgcc/config/rs6000/_strtokf.c
new file mode 100644
index 0000000..dc13534
--- /dev/null
+++ b/libgcc/config/rs6000/_strtokf.c
@@ -0,0 +1,53 @@
+/* Copyright (C) 1989-2021 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* Conversion to IEEE 128-bit floating point from string. */
+
+#include <stddef.h>
+#include <stdlib.h>
+#include <soft-fp.h>
+#include <quad-float128.h>
+
+/* This function must be built with IBM 128-bit as long double, so that we can
+ access the strtold function if do not have an IEEE 128-bit version. */
+#if !defined(__LONG_DOUBLE_128__) || !defined(__LONG_DOUBLE_IBM128__)
+#error "Long double is not IBM 128-bit"
+#endif
+
+/* If the user is using GLIBC 2.32, we can use the __strtoieee128 function.
+
+ If we are linked against an earlier library, we will have fake it by
+ converting the string to IBM 128-bit long double, and then converting that to
+ __float128. This isn't ideal, as IEEE 128-bit has more exponent range than
+ IBM 128-bit. */
+
+extern _Float128 __strtoieee128 (const char *, char **) __attribute__ ((__weak__));
+
+_Float128
+__strtokf (const char *string, char **endptr)
+{
+ if (__strtoieee128)
+ return __strtoieee128 (string, endptr);
+
+ return strtold (string, endptr);
+}
diff --git a/libgcc/config/rs6000/_strtokf.h b/libgcc/config/rs6000/_strtokf.h
new file mode 100644
index 0000000..a7ca8e0
--- /dev/null
+++ b/libgcc/config/rs6000/_strtokf.h
@@ -0,0 +1,27 @@
+/* Copyright (C) 1989-2021 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* Declaration of the conversion function to IEEE 128-bit floating point from
+ string. */
+
+extern _Float128 __strtokf (const char *, char **);
diff --git a/libgcc/config/rs6000/_td_to_kf.c b/libgcc/config/rs6000/_td_to_kf.c
new file mode 100644
index 0000000..0134581
--- /dev/null
+++ b/libgcc/config/rs6000/_td_to_kf.c
@@ -0,0 +1,37 @@
+/* Copyright (C) 2021 Free Software Foundation, Inc.
+
+This file is part of GCC.
+
+GCC is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free
+Software Foundation; either version 3, or (at your option) any later
+version.
+
+GCC 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 General Public License
+for more details.
+
+Under Section 7 of GPL version 3, you are granted additional
+permissions described in the GCC Runtime Library Exception, version
+3.1, as published by the Free Software Foundation.
+
+You should have received a copy of the GNU General Public License and
+a copy of the GCC Runtime Library Exception along with this program;
+see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
+<http://www.gnu.org/licenses/>. */
+
+/* Decimal128 -> _Float128 conversion. */
+
+/* FINE_GRAINED_LIBRARIES is used so we can isolate just to td_to_tf conversion
+ function from dp-bits.c. */
+#define FINE_GRAINED_LIBRARIES 1
+#define L_td_to_kf 1
+#define WIDTH 128
+
+#if !defined(__LONG_DOUBLE_128__) || !defined(__LONG_DOUBLE_IEEE128__)
+#error "Long double is not IEEE 128-bit"
+#endif
+
+/* Use dfp-bit.c to do the real work. */
+#include "dfp-bit.c"
diff --git a/libgcc/config/rs6000/quad-float128.h b/libgcc/config/rs6000/quad-float128.h
index 0eb1d34..5beb153 100644
--- a/libgcc/config/rs6000/quad-float128.h
+++ b/libgcc/config/rs6000/quad-float128.h
@@ -49,6 +49,7 @@ typedef __complex float TCtype __attribute__ ((mode (TC)));
#pragma GCC target ("vsx,float128")
#endif
+#include <stddef.h>
#include <quad.h>
#define IBM128_TYPE __ibm128
@@ -171,6 +172,13 @@ extern TFtype __trunctfkf2 (IBM128_TYPE);
extern TCtype __mulkc3 (TFtype, TFtype, TFtype, TFtype);
extern TCtype __divkc3 (TFtype, TFtype, TFtype, TFtype);
+/* Convert IEEE 128-bit floating point to/from string. We explicitly use
+ _Float128 instead of TFmode because _strtokf and _strfromkf must be compiled
+ with long double being IBM 128. */
+extern _Float128 __strtokf (const char *, char **);
+extern int __strfromkf (char *restrict, size_t, const char *restrict,
+ _Float128);
+
/* Implementation of conversions between __ibm128 and __float128, to allow the
same code to be used on systems with IEEE 128-bit emulation and with IEEE
128-bit hardware support. */
diff --git a/libgcc/config/rs6000/t-float128 b/libgcc/config/rs6000/t-float128
index d541344..6fb1a3d 100644
--- a/libgcc/config/rs6000/t-float128
+++ b/libgcc/config/rs6000/t-float128
@@ -22,10 +22,23 @@ fp128_softfp_static_obj = $(addsuffix -sw$(objext),$(fp128_softfp_funcs))
fp128_softfp_shared_obj = $(addsuffix -sw_s$(objext),$(fp128_softfp_funcs))
fp128_softfp_obj = $(fp128_softfp_static_obj) $(fp128_softfp_shared_obj)
+# Decimal <-> _Float128 conversions
+fp128_dec_funcs = _kf_to_sd _kf_to_dd _kf_to_td \
+ _sd_to_kf _dd_to_kf _td_to_kf
+
+# _Float128 to/from string conversions that must be compiled with IBM 128-bit
+# long double.
+fp128_decstr_funcs = _strtokf _sprintfkf
+
+# Decimal <-> __ibm128 conversions
+ibm128_dec_funcs = _tf_to_sd _tf_to_dd _tf_to_td \
+ _sd_to_tf _dd_to_tf _td_to_tf
+
# New functions for software emulation
fp128_ppc_funcs = floattikf floatuntikf fixkfti fixunskfti \
extendkftf2-sw trunctfkf2-sw \
- sfp-exceptions _mulkc3 _divkc3 _powikf2
+ sfp-exceptions _mulkc3 _divkc3 _powikf2 \
+ $(fp128_dec_funcs) $(fp128_decstr_funcs)
fp128_ppc_src = $(addprefix $(srcdir)/config/rs6000/,$(addsuffix \
.c,$(fp128_ppc_funcs)))
@@ -69,6 +82,28 @@ $(fp128_ppc_obj) : INTERNAL_CFLAGS += $(FP128_CFLAGS_SW)
$(fp128_obj) : $(fp128_includes)
$(fp128_obj) : $(srcdir)/config/rs6000/quad-float128.h
+# Force the TF mode to/from decimal functions to be compiled with IBM long
+# double. Add building the KF mode to/from decimal conversions with explict
+# IEEE long double.
+fp128_dec_objs = $(addsuffix $(objext),$(fp128_dec_funcs)) \
+ $(addsuffix _s$(objext),$(fp128_dec_funcs))
+
+fp128_decstr_objs = $(addsuffix $(objext),$(fp128_decstr_funcs)) \
+ $(addsuffix _s$(objext),$(fp128_decstr_funcs))
+
+ibm128_dec_objs = $(addsuffix $(objext),$(ibm128_dec_funcs)) \
+ $(addsuffix _s$(objext),$(ibm128_dec_funcs))
+
+FP128_CFLAGS_DECIMAL = -mno-gnu-attribute -Wno-psabi -mabi=ieeelongdouble
+IBM128_CFLAGS_DECIMAL = -mno-gnu-attribute -Wno-psabi -mabi=ibmlongdouble
+
+$(fp128_dec_objs) : INTERNAL_CFLAGS += $(FP128_CFLAGS_DECIMAL)
+$(fp128_decstr_objs) : INTERNAL_CFLAGS += $(IBM128_CFLAGS_DECIMAL)
+$(ibm128_dec_objs) : INTERNAL_CFLAGS += $(IBM128_CFLAGS_DECIMAL)
+
+$(fp128_decstr_objs) : $(srcdir)/config/rs6000/_strtokf.h \
+ $(srcdir)/config/rs6000/_sprintfkf.h \
+
$(fp128_softfp_src) : $(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@)) $(fp128_dep)
@src="$(srcdir)/soft-fp/$(subst -sw,,$(subst kf,tf,$@))"; \
echo "Create $@"; \
diff --git a/libgcc/configure b/libgcc/configure
index 78fc22a..dd3afb2 100755
--- a/libgcc/configure
+++ b/libgcc/configure
@@ -4458,7 +4458,7 @@ as_fn_arith $ac_cv_sizeof_long_double \* 8 && long_double_type_size=$as_val
for ac_header in inttypes.h stdint.h stdlib.h ftw.h \
unistd.h sys/stat.h sys/types.h \
- string.h strings.h memory.h sys/auxv.h
+ string.h strings.h memory.h sys/auxv.h sys/mman.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_preproc "$LINENO" "$ac_header" "$as_ac_Header"
@@ -4913,7 +4913,7 @@ case "$host" in
case "$enable_cet" in
auto)
# Check if target supports multi-byte NOPs
- # and if assembler supports CET insn.
+ # and if compiler and assembler support CET insn.
cet_save_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS -fcf-protection"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
diff --git a/libgcc/configure.ac b/libgcc/configure.ac
index ed50c0e..10ffb04 100644
--- a/libgcc/configure.ac
+++ b/libgcc/configure.ac
@@ -224,7 +224,7 @@ AC_SUBST(long_double_type_size)
AC_CHECK_HEADERS(inttypes.h stdint.h stdlib.h ftw.h \
unistd.h sys/stat.h sys/types.h \
- string.h strings.h memory.h sys/auxv.h)
+ string.h strings.h memory.h sys/auxv.h sys/mman.h)
AC_HEADER_STDC
# Check for decimal float support.
diff --git a/libgcc/dfp-bit.c b/libgcc/dfp-bit.c
index 17bca9c..ed14b86 100644
--- a/libgcc/dfp-bit.c
+++ b/libgcc/dfp-bit.c
@@ -606,6 +606,7 @@ INT_TO_DFP (INT_TYPE i)
#if defined (L_sd_to_sf) || defined (L_dd_to_sf) || defined (L_td_to_sf) \
|| defined (L_sd_to_df) || defined (L_dd_to_df) || defined (L_td_to_df) \
+ || defined (L_sd_to_kf) || defined (L_dd_to_kf) || defined (L_td_to_kf) \
|| ((defined (L_sd_to_xf) || defined (L_dd_to_xf) || defined (L_td_to_xf)) \
&& LONG_DOUBLE_HAS_XF_MODE) \
|| ((defined (L_sd_to_tf) || defined (L_dd_to_tf) || defined (L_td_to_tf)) \
@@ -626,6 +627,7 @@ DFP_TO_BFP (DFP_C_TYPE f)
#if defined (L_sf_to_sd) || defined (L_sf_to_dd) || defined (L_sf_to_td) \
|| defined (L_df_to_sd) || defined (L_df_to_dd) || defined (L_df_to_td) \
+ || defined (L_kf_to_sd) || defined (L_kf_to_dd) || defined (L_kf_to_td) \
|| ((defined (L_xf_to_sd) || defined (L_xf_to_dd) || defined (L_xf_to_td)) \
&& LONG_DOUBLE_HAS_XF_MODE) \
|| ((defined (L_tf_to_sd) || defined (L_tf_to_dd) || defined (L_tf_to_td)) \
@@ -641,8 +643,15 @@ BFP_TO_DFP (BFP_TYPE x)
decContextDefault (&context, CONTEXT_INIT);
DFP_INIT_ROUNDMODE (context.round);
- /* Use a C library function to write the floating point value to a string. */
- sprintf (buf, BFP_FMT, (BFP_VIA_TYPE) x);
+ /* Use the sprintf library function to write the floating point value to a
+ string.
+
+ If we are handling the IEEE 128-bit floating point on PowerPC, use the
+ special function __sprintfkf instead of sprintf. This function allows us
+ to use __sprintfieee128 if we have a new enough GLIBC, and it can fall back
+ to using the traditional sprintf via conversion to IBM 128-bit if the glibc
+ is older. */
+ BFP_SPRINTF (buf, BFP_FMT, (BFP_VIA_TYPE) x);
/* Convert from the floating point string to a decimal* type. */
FROM_STRING (&s, buf, &context);
diff --git a/libgcc/dfp-bit.h b/libgcc/dfp-bit.h
index 1fa42ee..5e3bfa6 100644
--- a/libgcc/dfp-bit.h
+++ b/libgcc/dfp-bit.h
@@ -241,6 +241,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#elif defined (L_sd_to_tf) || defined (L_dd_to_tf) || defined (L_td_to_tf) \
|| defined (L_tf_to_sd) || defined (L_tf_to_dd) || defined (L_tf_to_td)
#define BFP_KIND 4
+#elif defined (L_sd_to_kf) || defined (L_dd_to_kf) || defined (L_td_to_kf) \
+ || defined (L_kf_to_sd) || defined (L_kf_to_dd) || defined (L_kf_to_td)
+#define BFP_KIND 5
#endif
/* If BFP_KIND is defined, define additional macros:
@@ -291,6 +294,13 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#define BFP_VIA_TYPE long double
#endif /* LONG_DOUBLE_HAS_TF_MODE */
+#elif BFP_KIND == 5
+#define BFP_TYPE _Float128
+#define BFP_FMT "%.36Le"
+#define BFP_VIA_TYPE _Float128
+#define STR_TO_BFP __strtokf
+#include <_strtokf.h>
+
#endif /* BFP_KIND */
#if WIDTH == 128 || WIDTH_TO == 128
@@ -490,6 +500,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#elif BFP_KIND == 4
#define BFP_TO_DFP DPD_BID_NAME(__dpd_trunctfsd,__bid_trunctfsd)
#define DFP_TO_BFP DPD_BID_NAME(__dpd_extendsdtf,__bid_extendsdtf)
+#elif BFP_KIND == 5
+#define BFP_TO_DFP DPD_BID_NAME(__dpd_trunckfsd,__bid_trunckfsd)
+#define DFP_TO_BFP DPD_BID_NAME(__dpd_extendsdkf,__bid_extendsdkf)
#endif /* BFP_KIND */
#elif WIDTH == 64
@@ -505,6 +518,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#elif BFP_KIND == 4
#define BFP_TO_DFP DPD_BID_NAME(__dpd_trunctfdd,__bid_trunctfdd)
#define DFP_TO_BFP DPD_BID_NAME(__dpd_extendddtf,__bid_extendddtf)
+#elif BFP_KIND == 5
+#define BFP_TO_DFP DPD_BID_NAME(__dpd_trunckfdd,__bid_trunckfdd)
+#define DFP_TO_BFP DPD_BID_NAME(__dpd_extendddkf,__bid_extendddkf)
#endif /* BFP_KIND */
#elif WIDTH == 128
@@ -520,6 +536,9 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
#elif BFP_KIND == 4
#define BFP_TO_DFP DPD_BID_NAME(__dpd_extendtftd,__bid_extendtftd)
#define DFP_TO_BFP DPD_BID_NAME(__dpd_trunctdtf,__bid_trunctdtf)
+#elif BFP_KIND == 5
+#define BFP_TO_DFP DPD_BID_NAME(__dpd_extendkftd,__bid_extendkftd)
+#define DFP_TO_BFP DPD_BID_NAME(__dpd_trunctdkf,__bid_trunctdkf)
#endif /* BFP_KIND */
#endif /* WIDTH */
@@ -609,6 +628,7 @@ extern DFP_C_TYPE INT_TO_DFP (INT_TYPE);
#if defined (L_sd_to_sf) || defined (L_dd_to_sf) || defined (L_td_to_sf) \
|| defined (L_sd_to_df) || defined (L_dd_to_df) || defined (L_td_to_df) \
+ || defined (L_sd_to_kf) || defined (L_dd_to_kf) || defined (L_td_to_kf) \
|| ((defined (L_sd_to_xf) || defined (L_dd_to_xf) || defined (L_td_to_xf)) \
&& LONG_DOUBLE_HAS_XF_MODE) \
|| ((defined (L_sd_to_tf) || defined (L_dd_to_tf) || defined (L_td_to_tf)) \
@@ -623,6 +643,12 @@ extern BFP_TYPE DFP_TO_BFP (DFP_C_TYPE);
|| ((defined (L_tf_to_sd) || defined (L_tf_to_dd) || defined (L_tf_to_td)) \
&& LONG_DOUBLE_HAS_TF_MODE)
extern DFP_C_TYPE BFP_TO_DFP (BFP_TYPE);
+#define BFP_SPRINTF sprintf
+
+#elif defined (L_kf_to_sd) || defined (L_kf_to_dd) || defined (L_kf_to_td)
+extern DFP_C_TYPE BFP_TO_DFP (BFP_TYPE);
+#include <_sprintfkf.h>
+#define BFP_SPRINTF __sprintfkf
#endif
#endif /* _DFPBIT_H */
diff --git a/libgcc/libgcc2.c b/libgcc/libgcc2.c
index 960f594..17de0a7 100644
--- a/libgcc/libgcc2.c
+++ b/libgcc/libgcc2.c
@@ -1834,7 +1834,7 @@ __fixunssfSI (SFtype a)
TYPE
NAME (TYPE x, int m)
{
- unsigned int n = m < 0 ? -m : m;
+ unsigned int n = m < 0 ? -(unsigned int) m : (unsigned int) m;
TYPE y = n % 2 ? x : 1;
while (n >>= 1)
{
diff --git a/libgcc/libgcov-driver.c b/libgcc/libgcov-driver.c
index e474e03..a1338b6 100644
--- a/libgcc/libgcov-driver.c
+++ b/libgcc/libgcov-driver.c
@@ -42,6 +42,10 @@ void __gcov_init (struct gcov_info *p __attribute__ ((unused))) {}
#include <sys/stat.h>
#endif
+#if HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
#ifdef L_gcov
/* A utility function for outputting errors. */
@@ -334,30 +338,65 @@ read_error:
return -1;
}
+#define MAX(X,Y) ((X) > (Y) ? (X) : (Y))
+
/* Store all TOP N counters where each has a dynamic length. */
static void
-write_top_counters (const struct gcov_ctr_info *ci_ptr,
- unsigned t_ix,
- gcov_unsigned_t n_counts)
+write_topn_counters (const struct gcov_ctr_info *ci_ptr,
+ unsigned t_ix,
+ gcov_unsigned_t n_counts)
{
unsigned counters = n_counts / GCOV_TOPN_MEM_COUNTERS;
gcc_assert (n_counts % GCOV_TOPN_MEM_COUNTERS == 0);
+
+ /* It can happen in a multi-threaded environment that number of counters is
+ different from the size of the corresponding linked lists. */
+#define LIST_SIZE_MIN_LENGTH 4 * 1024
+
+ static unsigned *list_sizes = NULL;
+ static unsigned list_size_length = 0;
+
+ if (list_sizes == NULL || counters > list_size_length)
+ {
+ list_size_length = MAX (LIST_SIZE_MIN_LENGTH, 2 * counters);
+#if HAVE_SYS_MMAN_H
+ list_sizes
+ = (unsigned *)malloc_mmap (list_size_length * sizeof (unsigned));
+#endif
+
+ /* Malloc fallback. */
+ if (list_sizes == NULL)
+ list_sizes = (unsigned *)xmalloc (list_size_length * sizeof (unsigned));
+ }
+
+ memset (list_sizes, 0, counters * sizeof (unsigned));
unsigned pair_total = 0;
+
for (unsigned i = 0; i < counters; i++)
- pair_total += ci_ptr->values[GCOV_TOPN_MEM_COUNTERS * i + 1];
+ {
+ gcov_type start = ci_ptr->values[GCOV_TOPN_MEM_COUNTERS * i + 2];
+ for (struct gcov_kvp *node = (struct gcov_kvp *)(intptr_t)start;
+ node != NULL; node = node->next)
+ {
+ ++pair_total;
+ ++list_sizes[i];
+ }
+ }
+
unsigned disk_size = GCOV_TOPN_DISK_COUNTERS * counters + 2 * pair_total;
gcov_write_tag_length (GCOV_TAG_FOR_COUNTER (t_ix),
GCOV_TAG_COUNTER_LENGTH (disk_size));
for (unsigned i = 0; i < counters; i++)
{
- gcov_type pair_count = ci_ptr->values[GCOV_TOPN_MEM_COUNTERS * i + 1];
gcov_write_counter (ci_ptr->values[GCOV_TOPN_MEM_COUNTERS * i]);
- gcov_write_counter (pair_count);
+ gcov_write_counter (list_sizes[i]);
gcov_type start = ci_ptr->values[GCOV_TOPN_MEM_COUNTERS * i + 2];
+
+ unsigned j = 0;
for (struct gcov_kvp *node = (struct gcov_kvp *)(intptr_t)start;
- node != NULL; node = node->next)
+ j < list_sizes[i]; node = node->next, j++)
{
gcov_write_counter (node->value);
gcov_write_counter (node->count);
@@ -425,7 +464,7 @@ write_one_data (const struct gcov_info *gi_ptr,
n_counts = ci_ptr->num;
if (t_ix == GCOV_COUNTER_V_TOPN || t_ix == GCOV_COUNTER_V_INDIR)
- write_top_counters (ci_ptr, t_ix, n_counts);
+ write_topn_counters (ci_ptr, t_ix, n_counts);
else
{
/* Do not stream when all counters are zero. */
@@ -588,11 +627,14 @@ struct gcov_root __gcov_root;
struct gcov_master __gcov_master =
{GCOV_VERSION, 0};
-/* Pool of pre-allocated gcov_kvp strutures. */
-struct gcov_kvp __gcov_kvp_pool[GCOV_PREALLOCATED_KVP];
+/* Dynamic pool for gcov_kvp structures. */
+struct gcov_kvp *__gcov_kvp_dynamic_pool;
+
+/* Index into __gcov_kvp_dynamic_pool array. */
+unsigned __gcov_kvp_dynamic_pool_index;
-/* Index to first free gcov_kvp in the pool. */
-unsigned __gcov_kvp_pool_index;
+/* Size of _gcov_kvp_dynamic_pool array. */
+unsigned __gcov_kvp_dynamic_pool_size;
void
__gcov_exit (void)
diff --git a/libgcc/libgcov.h b/libgcc/libgcov.h
index ddc6885..7b0d367 100644
--- a/libgcc/libgcov.h
+++ b/libgcc/libgcov.h
@@ -45,6 +45,10 @@
#include "libgcc_tm.h"
#include "gcov.h"
+#if HAVE_SYS_MMAN_H
+#include <sys/mman.h>
+#endif
+
#if __CHAR_BIT__ == 8
typedef unsigned gcov_unsigned_t __attribute__ ((mode (SI)));
typedef unsigned gcov_position_t __attribute__ ((mode (SI)));
@@ -168,6 +172,16 @@ extern struct gcov_info *gcov_list;
#define ATTRIBUTE_HIDDEN
#endif
+#if HAVE_SYS_MMAN_H
+#ifndef MAP_FAILED
+#define MAP_FAILED ((void *)-1)
+#endif
+
+#if !defined (MAP_ANONYMOUS) && defined (MAP_ANON)
+#define MAP_ANONYMOUS MAP_ANON
+#endif
+#endif
+
#include "gcov-io.h"
/* Structures embedded in coveraged program. The structures generated
@@ -250,8 +264,9 @@ struct indirect_call_tuple
/* Exactly one of these will be active in the process. */
extern struct gcov_master __gcov_master;
-extern struct gcov_kvp __gcov_kvp_pool[GCOV_PREALLOCATED_KVP];
-extern unsigned __gcov_kvp_pool_index;
+extern struct gcov_kvp *__gcov_kvp_dynamic_pool;
+extern unsigned __gcov_kvp_dynamic_pool_index;
+extern unsigned __gcov_kvp_dynamic_pool_size;
/* Dump a set of gcov objects. */
extern void __gcov_dump_one (struct gcov_root *) ATTRIBUTE_HIDDEN;
@@ -404,31 +419,61 @@ gcov_counter_add (gcov_type *counter, gcov_type value,
*counter += value;
}
+#if HAVE_SYS_MMAN_H
+
+/* Allocate LENGTH with mmap function. */
+
+static inline void *
+malloc_mmap (size_t length)
+{
+ return mmap (NULL, length, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+}
+
+#endif
+
/* Allocate gcov_kvp from statically pre-allocated pool,
or use heap otherwise. */
static inline struct gcov_kvp *
allocate_gcov_kvp (void)
{
+#define MMAP_CHUNK_SIZE (128 * 1024)
struct gcov_kvp *new_node = NULL;
+ unsigned kvp_sizeof = sizeof(struct gcov_kvp);
+
+ /* Try mmaped pool if available. */
+#if !defined(IN_GCOV_TOOL) && !defined(L_gcov_merge_topn) && HAVE_SYS_MMAN_H
+ if (__gcov_kvp_dynamic_pool == NULL
+ || __gcov_kvp_dynamic_pool_index >= __gcov_kvp_dynamic_pool_size)
+ {
+ void *ptr = malloc_mmap (MMAP_CHUNK_SIZE);
+ if (ptr != MAP_FAILED)
+ {
+ __gcov_kvp_dynamic_pool = ptr;
+ __gcov_kvp_dynamic_pool_size = MMAP_CHUNK_SIZE / kvp_sizeof;
+ __gcov_kvp_dynamic_pool_index = 0;
+ }
+ }
-#if !defined(IN_GCOV_TOOL) && !defined(L_gcov_merge_topn)
- if (__gcov_kvp_pool_index < GCOV_PREALLOCATED_KVP)
+ if (__gcov_kvp_dynamic_pool != NULL)
{
unsigned index;
#if GCOV_SUPPORTS_ATOMIC
index
- = __atomic_fetch_add (&__gcov_kvp_pool_index, 1, __ATOMIC_RELAXED);
+ = __atomic_fetch_add (&__gcov_kvp_dynamic_pool_index, 1,
+ __ATOMIC_RELAXED);
#else
- index = __gcov_kvp_pool_index++;
+ index = __gcov_kvp_dynamic_pool_index++;
#endif
- if (index < GCOV_PREALLOCATED_KVP)
- new_node = &__gcov_kvp_pool[index];
+ if (index < __gcov_kvp_dynamic_pool_size)
+ new_node = __gcov_kvp_dynamic_pool + index;
}
#endif
+ /* Fallback to malloc. */
if (new_node == NULL)
- new_node = (struct gcov_kvp *)xcalloc (1, sizeof (struct gcov_kvp));
+ new_node = (struct gcov_kvp *)xcalloc (1, kvp_sizeof);
return new_node;
}