Re: [PATCH] x11/py-gtk2: -mxgot workaround for mips64*

2013-11-07 Thread Donovan Watteau
Bump

2013/10/30 Donovan Watteau tso...@gmail.com:
 Hi,

 x11/py-gtk2 is marked as BROKEN on alpha and mips64 (actually, it
 should be marked as BROKEN on mips64el too) because .got subsegment
 exceeds 64K.

 However, building the offending library with -mxgot lets it build
 on mips64el.  It looks like -mxgot makes it slower but, IHMO,
 a) it's better to have a slower py-gtk2 than no py-gtk2, especially
 as it's a common dependency, and b) these platforms are already
 slow for most serious desktop usage anyway.

 With this, Gimp builds and works on my loongson.

 Index: Makefile
 ===
 RCS file: /cvs/ports/x11/py-gtk2/Makefile,v
 retrieving revision 1.57
 diff -u -p -r1.57 Makefile
 --- Makefile16 Oct 2013 16:35:15 -  1.57
 +++ Makefile27 Oct 2013 21:00:42 -
 @@ -2,7 +2,6 @@

  SHARED_ONLY=   Yes
  BROKEN-alpha=  .got subsegment exceeds 64K
 -BROKEN-mips64= .got subsegment exceeds 64K

  COMMENT=   GTK+2 Python bindings

 @@ -39,6 +38,10 @@ RUN_DEPENDS= graphics/py-cairo=1.2 \
 math/py-numpy

  USE_GMAKE= No
 +
 +.if ${MACHINE_ARCH} == mips64 || ${MACHINE_ARCH} == mips64el
 +PATCH_LIST=patch-* sup-mips64-*
 +.endif

  LIBTOOL_FLAGS+=--tag=disable-static
  CONFIGURE_STYLE=gnu
 Index: patches/sup-mips64-gtk_Makefile_in
 ===
 RCS file: patches/sup-mips64-gtk_Makefile_in
 diff -N patches/sup-mips64-gtk_Makefile_in
 --- /dev/null   1 Jan 1970 00:00:00 -
 +++ patches/sup-mips64-gtk_Makefile_in  27 Oct 2013 21:00:42 -
 @@ -0,0 +1,15 @@
 +$OpenBSD$
 +
 +Work around relocation truncated to fit: R_MIPS_CALL16 on mips64.
 +
 +--- gtk/Makefile.in.orig   Fri Apr  1 12:41:04 2011
  gtk/Makefile.inSun Oct 27 21:50:49 2013
 +@@ -442,7 +442,7 @@ GTK_OVERRIDES = \
 +   gtkwidget.override  \
 +   gtkwindow.override
 +
 +-_gtk_la_CFLAGS = $(PYCAIRO_CFLAGS) $(GTK_CFLAGS) $(am__append_33)
 ++_gtk_la_CFLAGS = $(PYCAIRO_CFLAGS) $(GTK_CFLAGS) -mxgot $(am__append_33)
 + _gtk_la_LDFLAGS = $(common_ldflags) -export-symbols-regex init_gtk
 + _gtk_la_LIBADD = $(GTK_LIBS)
 + _gtk_la_SOURCES = \



Re: [PATCH] x11/py-gtk2: -mxgot workaround for mips64*

2013-11-07 Thread Stuart Henderson
I think this makes sense but I would prefer if somebody using mips64* committed 
it :)


On 2013/11/07 12:04, Donovan Watteau wrote:
 Bump
 
 2013/10/30 Donovan Watteau tso...@gmail.com:
  Hi,
 
  x11/py-gtk2 is marked as BROKEN on alpha and mips64 (actually, it
  should be marked as BROKEN on mips64el too) because .got subsegment
  exceeds 64K.
 
  However, building the offending library with -mxgot lets it build
  on mips64el.  It looks like -mxgot makes it slower but, IHMO,
  a) it's better to have a slower py-gtk2 than no py-gtk2, especially
  as it's a common dependency, and b) these platforms are already
  slow for most serious desktop usage anyway.
 
  With this, Gimp builds and works on my loongson.
 
  Index: Makefile
  ===
  RCS file: /cvs/ports/x11/py-gtk2/Makefile,v
  retrieving revision 1.57
  diff -u -p -r1.57 Makefile
  --- Makefile16 Oct 2013 16:35:15 -  1.57
  +++ Makefile27 Oct 2013 21:00:42 -
  @@ -2,7 +2,6 @@
 
   SHARED_ONLY=   Yes
   BROKEN-alpha=  .got subsegment exceeds 64K
  -BROKEN-mips64= .got subsegment exceeds 64K
 
   COMMENT=   GTK+2 Python bindings
 
  @@ -39,6 +38,10 @@ RUN_DEPENDS= graphics/py-cairo=1.2 \
  math/py-numpy
 
   USE_GMAKE= No
  +
  +.if ${MACHINE_ARCH} == mips64 || ${MACHINE_ARCH} == mips64el
  +PATCH_LIST=patch-* sup-mips64-*
  +.endif
 
   LIBTOOL_FLAGS+=--tag=disable-static
   CONFIGURE_STYLE=gnu
  Index: patches/sup-mips64-gtk_Makefile_in
  ===
  RCS file: patches/sup-mips64-gtk_Makefile_in
  diff -N patches/sup-mips64-gtk_Makefile_in
  --- /dev/null   1 Jan 1970 00:00:00 -
  +++ patches/sup-mips64-gtk_Makefile_in  27 Oct 2013 21:00:42 -
  @@ -0,0 +1,15 @@
  +$OpenBSD$
  +
  +Work around relocation truncated to fit: R_MIPS_CALL16 on mips64.
  +
  +--- gtk/Makefile.in.orig   Fri Apr  1 12:41:04 2011
   gtk/Makefile.inSun Oct 27 21:50:49 2013
  +@@ -442,7 +442,7 @@ GTK_OVERRIDES = \
  +   gtkwidget.override  \
  +   gtkwindow.override
  +
  +-_gtk_la_CFLAGS = $(PYCAIRO_CFLAGS) $(GTK_CFLAGS) $(am__append_33)
  ++_gtk_la_CFLAGS = $(PYCAIRO_CFLAGS) $(GTK_CFLAGS) -mxgot $(am__append_33)
  + _gtk_la_LDFLAGS = $(common_ldflags) -export-symbols-regex init_gtk
  + _gtk_la_LIBADD = $(GTK_LIBS)
  + _gtk_la_SOURCES = \
 



Re: [PATCH] x11/py-gtk2: -mxgot workaround for mips64*

2013-10-30 Thread Brian Callahan

On 10/30/2013 2:45 PM, Donovan Watteau wrote:

Hi,

x11/py-gtk2 is marked as BROKEN on alpha and mips64 (actually, it
should be marked as BROKEN on mips64el too) because .got subsegment
exceeds 64K.

However, building the offending library with -mxgot lets it build
on mips64el.  It looks like -mxgot makes it slower but, IHMO,
a) it's better to have a slower py-gtk2 than no py-gtk2, especially
as it's a common dependency, and b) these platforms are already
slow for most serious desktop usage anyway.

With this, Gimp builds and works on my loongson.



Woah. Cool! Got this built on my loongson.
One of the tests fails on loongson (I don't know what it looks like on 
other archs) but I don't think that's a reason not to get this in.

ok for me if someone wants to commit.

~Brian


Index: Makefile
===
RCS file: /cvs/ports/x11/py-gtk2/Makefile,v
retrieving revision 1.57
diff -u -p -r1.57 Makefile
--- Makefile16 Oct 2013 16:35:15 -  1.57
+++ Makefile27 Oct 2013 21:00:42 -
@@ -2,7 +2,6 @@

  SHARED_ONLY=  Yes
  BROKEN-alpha= .got subsegment exceeds 64K
-BROKEN-mips64= .got subsegment exceeds 64K

  COMMENT=  GTK+2 Python bindings

@@ -39,6 +38,10 @@ RUN_DEPENDS= graphics/py-cairo=1.2 \
math/py-numpy

  USE_GMAKE=No
+
+.if ${MACHINE_ARCH} == mips64 || ${MACHINE_ARCH} == mips64el
+PATCH_LIST=patch-* sup-mips64-*
+.endif

  LIBTOOL_FLAGS+=   --tag=disable-static
  CONFIGURE_STYLE=gnu
Index: patches/sup-mips64-gtk_Makefile_in
===
RCS file: patches/sup-mips64-gtk_Makefile_in
diff -N patches/sup-mips64-gtk_Makefile_in
--- /dev/null   1 Jan 1970 00:00:00 -
+++ patches/sup-mips64-gtk_Makefile_in  27 Oct 2013 21:00:42 -
@@ -0,0 +1,15 @@
+$OpenBSD$
+
+Work around relocation truncated to fit: R_MIPS_CALL16 on mips64.
+
+--- gtk/Makefile.in.orig   Fri Apr  1 12:41:04 2011
 gtk/Makefile.inSun Oct 27 21:50:49 2013
+@@ -442,7 +442,7 @@ GTK_OVERRIDES = \
+   gtkwidget.override  \
+   gtkwindow.override
+
+-_gtk_la_CFLAGS = $(PYCAIRO_CFLAGS) $(GTK_CFLAGS) $(am__append_33)
++_gtk_la_CFLAGS = $(PYCAIRO_CFLAGS) $(GTK_CFLAGS) -mxgot $(am__append_33)
+ _gtk_la_LDFLAGS = $(common_ldflags) -export-symbols-regex init_gtk
+ _gtk_la_LIBADD = $(GTK_LIBS)
+ _gtk_la_SOURCES = \





Re: [PATCH] x11/py-gtk2: -mxgot workaround for mips64*

2013-10-30 Thread Alexey E. Suslikov
Brian Callahan bcallah at devio.us writes:

 Woah. Cool! Got this built on my loongson.
 One of the tests fails on loongson (I don't know what it looks like on 
 other archs) but I don't think that's a reason not to get this in.
 ok for me if someone wants to commit.

(for archive)

http://gcc.gnu.org/onlinedocs/gcc/MIPS-Options.html

-mxgot
-mno-xgot

Lift (do not lift) the usual restrictions on the size of the global
offset table.

GCC normally uses a single instruction to load values from the GOT.
While this is relatively efficient, it only works if the GOT is smaller
than about 64k. Anything larger causes the linker to report an error
such as:

  relocation truncated to fit: R_MIPS_GOT16 foobar

If this happens, you should recompile your code with -mxgot. This works
with very large GOTs, although the code is also less efficient, since it
takes three instructions to fetch the value of a global symbol.

Note that some linkers can create multiple GOTs. If you have such a
linker, you should only need to use -mxgot when a single object file
accesses more than 64k's worth of GOT entries. Very few do.

These options have no effect unless GCC is generating position
independent code.