Hi ports, This update causes various issues on powerpc (ports-clang is used for this one):
1) "There's nowhere that max_align_t is defined" bcallah@ found this during an attempt to build webkigtk4 on macppc with gcc-8.2 as ports-gcc [0]. I still use gcc-4.9 on my side, same thing. I'll let him address this issue as he's working on it. Temporarily i made a quick fix in webkitgtk4's code itself. 2) Unsigned char by default There are a few occurences of narrowing to signed char that breaks the build on macppc. I fixed them as clang++ told me where they were. 3) __mulodi4 generated by ports-clang on powerpc This is a follow-up of my diff against v2.22. Code changed, and so is the patch. Testing: - nothing is broken on amd64 (the build log is here, ¡28 Mbytes! [1]), i used surf without issues. - on macppc, it indeed builds, the runtime is still meh. According to various tests i did, the network code may be to blame [2]. I can display a prefetched OpenBSD homepage, even run basic javascript. As soon as i really want to browse online, i've the classical "Internal webkit error". Given that no webkitgtk4 means no Gnome, i felt like sharing early, as iirc arm* will be hit by 2). Opinions, comments, testing [...] welcome :) Charlène. [0] https://bsd.network/@bcallah/101784192360684678 [1] http://0x0.st/z8Un.txt [2] https://bsd.network/@julianaito/101788954290460434 Index: Makefile =================================================================== RCS file: /cvs/ports/www/webkitgtk4/Makefile,v retrieving revision 1.98 diff -u -p -u -p -r1.98 Makefile --- Makefile 14 Mar 2019 09:48:28 -0000 1.98 +++ Makefile 21 Mar 2019 19:02:58 -0000 @@ -13,6 +13,7 @@ PORTROACH = limitw:1,even COMMENT = GTK+ port of the WebKit rendering engine V = 2.24.0 +REVISION = 0 DISTNAME = webkitgtk-${V} PKGNAME = webkitgtk4-${V} EXTRACT_SUFX = .tar.xz @@ -110,6 +111,12 @@ LDFLAGS += -Wl,--no-keep-memory .if ${MACHINE_ARCH} == "i386" CFLAGS += -march=i686 CXXFLAGS += -march=i686 +.endif + +.if ${MACHINE_ARCH} == "powerpc" +CFLAGS += -mlongcall +CXXFLAGS += -mlongcall +LDFLAGS += -Wl,--relax .endif post-extract: Index: patches/patch-Source_JavaScriptCore_runtime_CachedTypes_cpp =================================================================== RCS file: patches/patch-Source_JavaScriptCore_runtime_CachedTypes_cpp diff -N patches/patch-Source_JavaScriptCore_runtime_CachedTypes_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-Source_JavaScriptCore_runtime_CachedTypes_cpp 21 Mar 2019 19:02:58 -0000 @@ -0,0 +1,27 @@ +$OpenBSD$ + +ports-clang: std::max_align_t cannot be found. + +Index: Source/JavaScriptCore/runtime/CachedTypes.cpp +--- Source/JavaScriptCore/runtime/CachedTypes.cpp.orig ++++ Source/JavaScriptCore/runtime/CachedTypes.cpp +@@ -44,6 +44,10 @@ + #include <wtf/UUID.h> + #include <wtf/text/AtomicStringImpl.h> + ++// ports-clang require this: ++#include <cstddef> ++using ::max_align_t; ++ + namespace JSC { + + template <typename T, typename = void> +@@ -160,7 +164,7 @@ class Encoder { (private) + + bool malloc(size_t size, ptrdiff_t& result) + { +- size_t alignment = std::min(alignof(std::max_align_t), static_cast<size_t>(WTF::roundUpToPowerOfTwo(size))); ++ size_t alignment = std::min(alignof(::max_align_t), static_cast<size_t>(WTF::roundUpToPowerOfTwo(size))); + ptrdiff_t offset = WTF::roundUpToMultipleOf(alignment, m_offset); + size = WTF::roundUpToMultipleOf(alignment, size); + if (static_cast<size_t>(offset + size) > m_capacity) Index: patches/patch-Source_WTF_wtf_CheckedArithmetic_h =================================================================== RCS file: patches/patch-Source_WTF_wtf_CheckedArithmetic_h diff -N patches/patch-Source_WTF_wtf_CheckedArithmetic_h --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-Source_WTF_wtf_CheckedArithmetic_h 21 Mar 2019 19:02:58 -0000 @@ -0,0 +1,52 @@ +$OpenBSD$ + +macppc linking fix: with ports-clang, libgcc is used instead of compiler-rt, +and it does not provide the __mulodi4 symbol used by clang for +__builtin_mul_overflow. + +Other !base-clang archs should be added if they can +go up to the final linking parts. + +see https://bugs.webkit.org/show_bug.cgi?id=190208 + +Index: Source/WTF/wtf/CheckedArithmetic.h +--- Source/WTF/wtf/CheckedArithmetic.h.orig ++++ Source/WTF/wtf/CheckedArithmetic.h +@@ -31,6 +31,10 @@ + #include <stdint.h> + #include <type_traits> + ++#if COMPILER(GCC_COMPATIBLE) && !(defined(__clang__) && defined(__powerpc__)) ++#define USE_MUL_OVERFLOW 1 ++#endif ++ + /* Checked<T> + * + * This class provides a mechanism to perform overflow-safe integer arithmetic +@@ -360,7 +364,7 @@ template <typename LHS, typename RHS, typename ResultT + + static inline bool multiply(LHS lhs, RHS rhs, ResultType& result) WARN_UNUSED_RETURN + { +-#if COMPILER(GCC_COMPATIBLE) ++#if USE(MUL_OVERFLOW) + ResultType temp; + if (__builtin_mul_overflow(lhs, rhs, &temp)) + return false; +@@ -433,7 +437,7 @@ template <typename LHS, typename RHS, typename ResultT + + static inline bool multiply(LHS lhs, RHS rhs, ResultType& result) WARN_UNUSED_RETURN + { +-#if COMPILER(GCC_COMPATIBLE) ++#if USE(MUL_OVERFLOW) + ResultType temp; + if (__builtin_mul_overflow(lhs, rhs, &temp)) + return false; +@@ -496,7 +500,7 @@ template <typename ResultType> struct ArithmeticOperat + + static inline bool multiply(int64_t lhs, int64_t rhs, ResultType& result) + { +-#if COMPILER(GCC_COMPATIBLE) ++#if USE(MUL_OVERFLOW) + ResultType temp; + if (__builtin_mul_overflow(lhs, rhs, &temp)) + return false; Index: patches/patch-Source_WebCore_contentextensions_DFACombiner_cpp =================================================================== RCS file: patches/patch-Source_WebCore_contentextensions_DFACombiner_cpp diff -N patches/patch-Source_WebCore_contentextensions_DFACombiner_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-Source_WebCore_contentextensions_DFACombiner_cpp 21 Mar 2019 19:02:58 -0000 @@ -0,0 +1,17 @@ +$OpenBSD$ + +On arm and powerpc, char is unsigned by default. + +Index: Source/WebCore/contentextensions/DFACombiner.cpp +--- Source/WebCore/contentextensions/DFACombiner.cpp.orig ++++ Source/WebCore/contentextensions/DFACombiner.cpp +@@ -37,7 +37,8 @@ namespace WebCore { + namespace ContentExtensions { + + class DFAMerger { +- typedef MutableRangeList<char, uint64_t, 128> CombinedTransitionsMutableRangeList; ++ // error: non-constant-expression cannot be narrowed from type 'char' to 'signed char' ++ typedef MutableRangeList<signed char, uint64_t, 128> CombinedTransitionsMutableRangeList; + + enum class WhichDFA { + A, Index: patches/patch-Source_WebCore_contentextensions_NFAToDFA_cpp =================================================================== RCS file: patches/patch-Source_WebCore_contentextensions_NFAToDFA_cpp diff -N patches/patch-Source_WebCore_contentextensions_NFAToDFA_cpp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ patches/patch-Source_WebCore_contentextensions_NFAToDFA_cpp 21 Mar 2019 19:02:58 -0000 @@ -0,0 +1,23 @@ +$OpenBSD$ + +On arm and powerpc, char is unsigned by default, breaking +the narrowing to signed char. + +Index: Source/WebCore/contentextensions/NFAToDFA.cpp +--- Source/WebCore/contentextensions/NFAToDFA.cpp.orig ++++ Source/WebCore/contentextensions/NFAToDFA.cpp +@@ -40,10 +40,10 @@ + namespace WebCore { + + namespace ContentExtensions { +- +-typedef MutableRange<char, NFANodeIndexSet> NFANodeRange; +-typedef MutableRangeList<char, NFANodeIndexSet> NFANodeRangeList; +-typedef MutableRangeList<char, NFANodeIndexSet, 128> PreallocatedNFANodeRangeList; ++//error: non-constant-expression cannot be narrowed from type 'char' to 'signed char' ++typedef MutableRange<signed char, NFANodeIndexSet> NFANodeRange; ++typedef MutableRangeList<signed char, NFANodeIndexSet> NFANodeRangeList; ++typedef MutableRangeList<signed char, NFANodeIndexSet, 128> PreallocatedNFANodeRangeList; + typedef Vector<uint32_t, 0, ContentExtensionsOverflowHandler> UniqueNodeList; + typedef Vector<UniqueNodeList, 0, ContentExtensionsOverflowHandler> NFANodeClosures; +