[PATCH] libgomp: Include <limits.h> early to avoid link failure with glibc 2.34
Florian Weimer
fweimer@redhat.com
Mon Jul 12 15:29:36 GMT 2021
* Florian Weimer:
> * Florian Weimer:
>
>> I tested this on csky-linux-gnuabiv2 with the glibc version that failed
>> before, and it works. So I guess your version is fine, too.
>
> Build on powerpc64-linux-gnu and other targets now fails with:
>
> /home/bmg/src/gcc/libgomp/config/linux/affinity.c: In function ‘gomp_init_affini
> ty’:
> /home/bmg/src/gcc/libgomp/config/linux/affinity.c:53:41: error: ‘ULONG_MAX’ unde
> clared (first use in this function)
> 53 | if (!gomp_affinity_init_level (1, ULONG_MAX, true))
> | ^~~~~~~~~
>
> So affinity.c will need to include <limits.h>.
I verifed that this change on top successfully builds GCC for all glibc
targets:
diff --git a/libgomp/config/linux/affinity.c b/libgomp/config/linux/affinity.c
index c5abdce23..1b636c613 100644
--- a/libgomp/config/linux/affinity.c
+++ b/libgomp/config/linux/affinity.c
@@ -35,6 +35,7 @@
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <limits.h>
#ifdef HAVE_PTHREAD_AFFINITY_NP
Thanks,
Florian
More information about the Gcc-patches
mailing list