arrfab / rpms / glibc

Forked from rpms/glibc 4 years ago
Clone
Blob Blame History Raw
Backporting changes to the support/ subdirectory.

This is kept separate from glibc-rh1418978-1.patch to simplify rebases
of the support/ subdirectory.  Changes here should be restricted to
things that absolutely cannot be upstreamed at this point (such as
support for older compilers).

diff --git a/support/blob_repeat.c b/support/blob_repeat.c
index 16c1e448b990e386..a2d5e0cbd736f998 100644
--- a/support/blob_repeat.c
+++ b/support/blob_repeat.c
@@ -30,6 +30,9 @@
 #include <unistd.h>
 #include <wchar.h>
 
+/* For check_mul_overflow_size_t.  */
+#include <malloc/malloc-internal.h>
+
 /* Small allocations should use malloc directly instead of the mmap
    optimization because mappings carry a lot of overhead.  */
 static const size_t maximum_small_size = 4 * 1024 * 1024;
@@ -118,8 +121,8 @@ minimum_stride_size (size_t page_size, size_t element_size)
      common multiple, it appears only once.  Therefore, shift one
      factor.  */
   size_t multiple;
-  if (__builtin_mul_overflow (page_size >> common_zeros, element_size,
-                              &multiple))
+  if (check_mul_overflow_size_t (page_size >> common_zeros, element_size,
+                                 &multiple))
     return 0;
   return multiple;
 }
@@ -255,7 +258,7 @@ support_blob_repeat_allocate (const void *element, size_t element_size,
                               size_t count)
 {
   size_t total_size;
-  if (__builtin_mul_overflow (element_size, count, &total_size))
+  if (check_mul_overflow_size_t (element_size, count, &total_size))
     {
       errno = EOVERFLOW;
       return (struct support_blob_repeat) { 0 };
diff --git a/support/links-dso-program.cc b/support/links-dso-program.cc
index dba6976c0609a332..8ff3155dd7fcd757 100644
--- a/support/links-dso-program.cc
+++ b/support/links-dso-program.cc
@@ -1,3 +1,8 @@
+/* Change for backporting: The build system does not define _ISOMAC
+   for us because the tests-internal changes have not been
+   backported.  */
+#define _ISOMAC 1
+
 #include <iostream>
 
 using namespace std;