<p>Nico Huber has uploaded this change for <strong>review</strong>.</p><p><a href="https://review.coreboot.org/22786">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">buildgcc: Add patch to work around Musl libc issue<br><br>GCC includes `sched.h` after poisoning calloc(). This results in a<br>build failure with Musl libc. We work around the issue by including<br>`sched.h` earlier and throw around some void pointers so we only<br>have to do it in one place.<br><br>Change-Id: I1d5462eb9a448147a95dd4ec50361b3f5a28910c<br>Signed-off-by: Nico Huber <nico.h@gmx.de><br>---<br>A util/crossgcc/patches/gcc-6.3.0_ada-musl_workaround.patch<br>1 file changed, 107 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://review.coreboot.org:29418/coreboot refs/changes/86/22786/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">diff --git a/util/crossgcc/patches/gcc-6.3.0_ada-musl_workaround.patch b/util/crossgcc/patches/gcc-6.3.0_ada-musl_workaround.patch<br>new file mode 100644<br>index 0000000..a500343<br>--- /dev/null<br>+++ b/util/crossgcc/patches/gcc-6.3.0_ada-musl_workaround.patch<br>@@ -0,0 +1,107 @@<br>+Only in gcc-6.3.0: .unpack_success<br>+--- gcc-6.3.0.bak/gcc/ada/adaint.c<br>++++ gcc-6.3.0/gcc/ada/adaint.c<br>+@@ -103,6 +103,15 @@<br>+ #define xmalloc(S) malloc (S)<br>+ #define xrealloc(V,S) realloc (V,S)<br>+ #else<br>++#if !defined(__ANDROID__) && defined(__linux__)<br>++#ifdef __cplusplus<br>++extern "C" {<br>++#endif<br>++#include <sched.h><br>++#ifdef __cplusplus<br>++}<br>++#endif<br>++#endif<br>+ #include "config.h"<br>+ #include "system.h"<br>+ #include "version.h"<br>+@@ -3096,7 +3105,7 @@<br>+ <br>+ /* Dynamic cpu sets */<br>+ <br>+-cpu_set_t *<br>++void *<br>+ __gnat_cpu_alloc (size_t count)<br>+ {<br>+   return CPU_ALLOC (count);<br>+@@ -3109,19 +3118,19 @@<br>+ }<br>+ <br>+ void<br>+-__gnat_cpu_free (cpu_set_t *set)<br>++__gnat_cpu_free (void *set)<br>+ {<br>+   CPU_FREE (set);<br>+ }<br>+ <br>+ void<br>+-__gnat_cpu_zero (size_t count, cpu_set_t *set)<br>++__gnat_cpu_zero (size_t count, void *set)<br>+ {<br>+   CPU_ZERO_S (count, set);<br>+ }<br>+ <br>+ void<br>+-__gnat_cpu_set (int cpu, size_t count, cpu_set_t *set)<br>++__gnat_cpu_set (int cpu, size_t count, void *set)<br>+ {<br>+   /* Ada handles CPU numbers starting from 1, while C identifies the first<br>+      CPU by a 0, so we need to adjust. */<br>+@@ -3132,10 +3141,10 @@<br>+ <br>+ /* Static cpu sets */<br>+ <br>+-cpu_set_t *<br>++void *<br>+ __gnat_cpu_alloc (size_t count ATTRIBUTE_UNUSED)<br>+ {<br>+-  return (cpu_set_t *) xmalloc (sizeof (cpu_set_t));<br>++  return xmalloc (sizeof (cpu_set_t));<br>+ }<br>+ <br>+ size_t<br>+@@ -3145,19 +3154,19 @@<br>+ }<br>+ <br>+ void<br>+-__gnat_cpu_free (cpu_set_t *set)<br>++__gnat_cpu_free (void *set)<br>+ {<br>+   free (set);<br>+ }<br>+ <br>+ void<br>+-__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)<br>++__gnat_cpu_zero (size_t count ATTRIBUTE_UNUSED, void *set)<br>+ {<br>+   CPU_ZERO (set);<br>+ }<br>+ <br>+ void<br>+-__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, cpu_set_t *set)<br>++__gnat_cpu_set (int cpu, size_t count ATTRIBUTE_UNUSED, void *set)<br>+ {<br>+   /* Ada handles CPU numbers starting from 1, while C identifies the first<br>+      CPU by a 0, so we need to adjust. */<br>+--- gcc-6.3.0.bak/gcc/ada/adaint.h<br>++++ gcc-6.3.0/gcc/ada/adaint.h<br>+@@ -287,13 +287,11 @@<br>+ <br>+ /* Routines for interface to required CPU set primitives */<br>+ <br>+-#include <sched.h><br>+-<br>+-extern cpu_set_t *__gnat_cpu_alloc                 (size_t);<br>++extern void *__gnat_cpu_alloc                 (size_t);<br>+ extern size_t __gnat_cpu_alloc_size                (size_t);<br>+-extern void   __gnat_cpu_free                  (cpu_set_t *);<br>+-extern void   __gnat_cpu_zero                      (size_t, cpu_set_t *);<br>+-extern void   __gnat_cpu_set                       (int, size_t, cpu_set_t *);<br>++extern void   __gnat_cpu_free                  (void *);<br>++extern void   __gnat_cpu_zero                      (size_t, void *);<br>++extern void   __gnat_cpu_set                       (int, size_t, void *);<br>+ #endif<br>+ <br>+ #if defined (_WIN32)<br></pre><p>To view, visit <a href="https://review.coreboot.org/22786">change 22786</a>. To unsubscribe, visit <a href="https://review.coreboot.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://review.coreboot.org/22786"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: coreboot </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: I1d5462eb9a448147a95dd4ec50361b3f5a28910c </div>
<div style="display:none"> Gerrit-Change-Number: 22786 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Nico Huber <nico.h@gmx.de> </div>