Hi ports, > http://build-failures.rhaalovely.net//powerpc/2019-02-04/www/webkitgtk4.log
On top of jca@'s recent ports-gcc commits, macppc needs some additional linking bits. This diff brings two things: 1) Use long calls and address relaxing. This avoids relocation overflows. 2) clang generates code using the __mulodi4 symbol for __builtin_mul_overflow. __mulodi4 is only available on archs with base-clang. I've modified that upstream submitted patch [1], so it targets only clang+powerpc. It will require some changes if other !base-clang archs can really go up to this port very final linking (or a smarter conditional). Testing: Runtime is as bad as it is on sparc64. I can only render local static HTML with www/surf, all the rest results to an "internal Webkit error". Building with debug flags causes an OOM error so i can't report anything sadly. Comments are very welcome :) Charlène. [1] https://bugs.webkit.org/show_bug.cgi?id=190208 Index: Makefile =================================================================== RCS file: /cvs/ports/www/webkitgtk4/Makefile,v retrieving revision 1.97 diff -u -p -u -p -r1.97 Makefile --- Makefile 5 Mar 2019 16:24:23 -0000 1.97 +++ Makefile 9 Mar 2019 00:01:57 -0000 @@ -13,7 +13,7 @@ PORTROACH = limitw:1,even COMMENT = GTK+ port of the WebKit rendering engine V = 2.22.7 -REVISION = 0 +REVISION = 1 DISTNAME = webkitgtk-${V} PKGNAME = webkitgtk4-${V} EXTRACT_SUFX = .tar.xz @@ -110,6 +110,13 @@ LDFLAGS += -Wl,--no-keep-memory .if ${MACHINE_ARCH} == "i386" CFLAGS += -march=i686 CXXFLAGS += -march=i686 +.endif + +# Workaround relocation overflow. +.if ${MACHINE_ARCH} == "powerpc" +CFLAGS += -mlongcall +CXXFLAGS += -mlongcall +LDFLAGS += -Wl,--relax .endif post-extract: 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 9 Mar 2019 00:01:57 -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 +@@ -32,6 +32,10 @@ + #include <stdint.h> + #include <type_traits> + ++#if COMPILER(GCC_OR_CLANG) && !(defined(__clang__) && defined(__powerpc__)) ++#define USE_MUL_OVERFLOW 1 ++#endif ++ + /* Checked<T> + * + * This class provides a mechanism to perform overflow-safe integer arithmetic +@@ -317,7 +321,7 @@ template <typename LHS, typename RHS, typename ResultT + + static inline bool multiply(LHS lhs, RHS rhs, ResultType& result) WARN_UNUSED_RETURN + { +-#if COMPILER(GCC_OR_CLANG) ++#if USE(MUL_OVERFLOW) + ResultType temp; + if (__builtin_mul_overflow(lhs, rhs, &temp)) + return false; +@@ -390,7 +394,7 @@ template <typename LHS, typename RHS, typename ResultT + + static inline bool multiply(LHS lhs, RHS rhs, ResultType& result) WARN_UNUSED_RETURN + { +-#if COMPILER(GCC_OR_CLANG) ++#if USE(MUL_OVERFLOW) + ResultType temp; + if (__builtin_mul_overflow(lhs, rhs, &temp)) + return false; +@@ -453,7 +457,7 @@ template <typename ResultType> struct ArithmeticOperat + + static inline bool multiply(int64_t lhs, int64_t rhs, ResultType& result) + { +-#if COMPILER(GCC_OR_CLANG) ++#if USE(MUL_OVERFLOW) + ResultType temp; + if (__builtin_mul_overflow(lhs, rhs, &temp)) + return false;