On Fri, 13 Nov 2020 22:33:05 -0500
Brad Smith wrote:

> On Fri, Nov 13, 2020 at 09:55:01PM -0500, George Koehler wrote:
> > On Wed, 11 Nov 2020 01:38:04 +0100
> > Charlene Wendling <juliana...@posteo.jp> wrote:
> > 
> > > On Tue, 10 Nov 2020 07:50:26 +0100
> > > Charlene Wendling wrote:
> > > 
> > > New diff with aja's and sthen's suggestions. I tested on macppc
> > > and, even if it has no impact there, amd64.
> > 
> > I built webkitgtk4 on macppc after you committed your fixes, and
> > with one more change: I deleted the -mlongcall flag.  I suggest to
> > keep -mlongcall for now, but the next person to edit
> > webkitgtk4/Makefile should remove -mlongcall at the same time.
> > 
> > Below the diff, I explain -mlongcall and -Wl,--relax flags.
> > 
> > Index: Makefile
> > ===================================================================
> > RCS file: /cvs/ports/www/webkitgtk4/Makefile,v
> > retrieving revision 1.130
> > diff -u -p -r1.130 Makefile
> > --- Makefile        11 Nov 2020 21:27:03 -0000      1.130
> > +++ Makefile        13 Nov 2020 20:45:24 -0000
> > @@ -119,8 +119,6 @@ LDFLAGS +=              -Wl,--no-keep-memory
> >  .if ${MACHINE_ARCH} == "powerpc"
> >  # XXX fix colors being off, it would be nice to fix the code
> >  CONFIGURE_ARGS +=  -DENABLE_GRAPHICS_CONTEXT_GL=OFF
> > -CFLAGS +=          -mlongcall
> > -CXXFLAGS +=                -mlongcall
> >  LDFLAGS +=         -Wl,--relax
> >  PATCH_LIST =               patch-* powerpc-patch-*
> >  .endif
> > 
> > In powerpc and powerpc64 code, the "bl" instruction for a direct
> > function call uses a signed 26-bit offset.  This limits the branch
> > distance to plus or minus 32 megabytes.  This works well when each
> > program or shared lib has less than 32M of code.
> > 
> > libwebkit2gtk-4.0.so.3.3 is too big, because its LOAD segment with
> > the E flag (for code) has size > 32M = 0x2_000_000 bytes:
> > 
> > $ readelf -l libwebkit2gtk-4.0.so.3.3|head
> > ...
> >   Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg
> > Align LOAD           0x000000 0x00000000 0x00000000 0x2e979e4
> > 0x2e979e4 R E 0x10000
> > 
> > With cc -mlongcall, each function call is indirect through a
> > function pointer.  This would get around the 32M limit, but it
> > doesn't work because /usr/lib/crt*.o don't use -mlongcall.  My test
> > program with code over 32M got linker errors from crtbegin.o and
> > crt0.o.
> > 
> > With cc -Wl,--relax, the linker ld.bfd can pass the 32M limit by
> > inserting a thunk (or branch island) between the "bl" and its
> > destination.  This doesn't need -mlongcall and does work with
> > crt*.o. We use -Wl,--relax without -mlongcall in devel/llvm on
> > powerpc.

Thanks for the explanation, i had the misconception that relaxing
implied long calls.

> > cc -Wl,--relax causes an error with ld.lld on powerpc64 (or with
> > cc -fuse-ld=lld on powerpc), but lld inserts thunks (branch islands)
> > by default.  If macppc switches to lld, we would remove -Wl,--relax
> > from ports.    --George
> 
> This reminds me I had a diff I was going to send out after I saw the
> recent discussion about webkitgtk4. There appear to be only two
> instances left in the tree.

I've built godot and webkitgtk4 successfully on macppc at home. As such,
i've slipped Brad's webkitgtk4 diff right now in the current bulk, since
it's not built there yet.

George, i think you should commit Brad's changes now, so it's not
forgotten later. It's OK cwen@

 
> Index: games/godot/Makefile
> ===================================================================
> RCS file: /home/cvs/ports/games/godot/Makefile,v
> retrieving revision 1.16
> diff -u -p -u -p -r1.16 Makefile
> --- games/godot/Makefile      19 Sep 2020 06:37:23 -0000      1.16
> +++ games/godot/Makefile      14 Nov 2020 03:20:12 -0000
> @@ -5,6 +5,7 @@ COMMENT =     2D and 3D game engine
>  V =          3.2.3
>  DISTNAME =   godot-${V}-stable
>  PKGNAME =    godot-${V}
> +REVISION =   0
>  CATEGORIES = games
>  HOMEPAGE =   https://godotengine.org/
>  MAINTAINER = Omar Polo <o...@omarpolo.com>
> @@ -78,8 +79,6 @@ WANTLIB +=     atomic
>  
>  # Fix relocation overflows
>  .if ${MACHINE_ARCH:Mpowerpc}
> -CFLAGS +=      -mlongcall
> -CXXFLAGS +=    -mlongcall
>  LDFLAGS +=     -Wl,--relax
>  .endif
>  
> Index: www/webkitgtk4/Makefile
> ===================================================================
> RCS file: /home/cvs/ports/www/webkitgtk4/Makefile,v
> retrieving revision 1.130
> diff -u -p -u -p -r1.130 Makefile
> --- www/webkitgtk4/Makefile   11 Nov 2020 21:27:03 -0000
> 1.130 +++ www/webkitgtk4/Makefile     13 Nov 2020 06:04:51 -0000
> @@ -14,7 +14,7 @@ PORTROACH =         limitw:1,even
>  COMMENT =            GTK+ port of the WebKit rendering engine
>  
>  V =                  2.30.2
> -REVISION =           0
> +REVISION =           1
>  DISTNAME =           webkitgtk-${V}
>  PKGNAME =            webkitgtk4-${V}
>  EXTRACT_SUFX =               .tar.xz
> @@ -119,8 +119,6 @@ LDFLAGS +=                -Wl,--no-keep-memory
>  .if ${MACHINE_ARCH} == "powerpc"
>  # XXX fix colors being off, it would be nice to fix the code
>  CONFIGURE_ARGS +=    -DENABLE_GRAPHICS_CONTEXT_GL=OFF
> -CFLAGS +=            -mlongcall
> -CXXFLAGS +=          -mlongcall
>  LDFLAGS +=           -Wl,--relax
>  PATCH_LIST =         patch-* powerpc-patch-*
>  .endif
> 

Reply via email to