Title: [278302] trunk/Source
Revision
278302
Author
[email protected]
Date
2021-06-01 06:01:01 -0700 (Tue, 01 Jun 2021)

Log Message

[WPE][GTK] Support building against uClibc
https://bugs.webkit.org/show_bug.cgi?id=226244

Reviewed by Michael Catanzaro.

Source/_javascript_Core:

* assembler/MacroAssemblerARM64.cpp:
(getauxval): Provide a fallback implementation of getauxval() for
systems which do not provide <sys/auxv.h>, like those using uClibc
as their C library.

Source/WTF:

* wtf/PlatformRegisters.h: Use the <sys/ucontext.h> header instead of
<ucontext.h>, which is enough to gain access to the type definitions
for CPU registers and is available on every libc. On the other hand,
uClibc does not have <ucontext.h>, so this fixes the build in that
case.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (278301 => 278302)


--- trunk/Source/_javascript_Core/ChangeLog	2021-06-01 11:59:21 UTC (rev 278301)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-06-01 13:01:01 UTC (rev 278302)
@@ -1,3 +1,15 @@
+2021-06-01  Adrian Perez de Castro  <[email protected]>
+
+        [WPE][GTK] Support building against uClibc
+        https://bugs.webkit.org/show_bug.cgi?id=226244
+
+        Reviewed by Michael Catanzaro.
+
+        * assembler/MacroAssemblerARM64.cpp:
+        (getauxval): Provide a fallback implementation of getauxval() for
+        systems which do not provide <sys/auxv.h>, like those using uClibc
+        as their C library.
+
 2021-05-30  Chris Dumez  <[email protected]>
 
         Drop UncheckedCondition / UncheckedLock

Modified: trunk/Source/_javascript_Core/assembler/MacroAssemblerARM64.cpp (278301 => 278302)


--- trunk/Source/_javascript_Core/assembler/MacroAssemblerARM64.cpp	2021-06-01 11:59:21 UTC (rev 278301)
+++ trunk/Source/_javascript_Core/assembler/MacroAssemblerARM64.cpp	2021-06-01 13:01:01 UTC (rev 278302)
@@ -34,8 +34,26 @@
 
 #if OS(LINUX)
 #include <asm/hwcap.h>
+#if __has_include(<sys/auxv.h>)
 #include <sys/auxv.h>
+#else
+#include <linux/auxvec.h>
+// Provide an implementation for C libraries which do not ship one.
+static unsigned long getauxval(unsigned long type)
+{
+    char** env = environ;
+    while (*env++) { /* no-op */ }
+
+    for (auto* auxv = reinterpret_cast<unsigned long*>(env); *auxv != AT_NULL; auxv += 2) {
+        if (*auxv == type)
+            return auxv[1];
+    }
+
+    errno = ENOENT;
+    return 0;
+}
 #endif
+#endif
 
 namespace JSC {
 

Modified: trunk/Source/WTF/ChangeLog (278301 => 278302)


--- trunk/Source/WTF/ChangeLog	2021-06-01 11:59:21 UTC (rev 278301)
+++ trunk/Source/WTF/ChangeLog	2021-06-01 13:01:01 UTC (rev 278302)
@@ -1,3 +1,16 @@
+2021-06-01  Adrian Perez de Castro  <[email protected]>
+
+        [WPE][GTK] Support building against uClibc
+        https://bugs.webkit.org/show_bug.cgi?id=226244
+
+        Reviewed by Michael Catanzaro.
+
+        * wtf/PlatformRegisters.h: Use the <sys/ucontext.h> header instead of
+        <ucontext.h>, which is enough to gain access to the type definitions
+        for CPU registers and is available on every libc. On the other hand,
+        uClibc does not have <ucontext.h>, so this fixes the build in that
+        case.
+
 2021-05-30  Chris Dumez  <[email protected]>
 
         Drop UncheckedCondition / UncheckedLock

Modified: trunk/Source/WTF/wtf/PlatformRegisters.h (278301 => 278302)


--- trunk/Source/WTF/wtf/PlatformRegisters.h	2021-06-01 11:59:21 UTC (rev 278301)
+++ trunk/Source/WTF/wtf/PlatformRegisters.h	2021-06-01 13:01:01 UTC (rev 278302)
@@ -35,7 +35,7 @@
 #elif OS(WINDOWS)
 #include <windows.h>
 #else
-#include <ucontext.h>
+#include <sys/ucontext.h>
 #endif
 
 namespace WTF {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to