unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: base: Build glibc-hurd for i586-pc-gnu instead of i686-pc-gnu.
@ 2015-06-29 16:43 Manolis Ragkousis
  2015-06-30 19:36 ` Ludovic Courtès
  0 siblings, 1 reply; 2+ messages in thread
From: Manolis Ragkousis @ 2015-06-29 16:43 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix-devel

[-- Attachment #1: Type: text/plain, Size: 303 bytes --]

With this patch we can produce working static binaries for a Hurd system.

We had to change it to use i586, because the default i686 variant
introduces bugs.

And when building for i586, we had the no_hidden issue so I had to
apply the patch
for that.

Next is the patch for make-bootstrap.scm

Manolis

[-- Attachment #2: 0001-gnu-base-Build-glibc-hurd-for-i586-pc-gnu-instead-of.patch --]
[-- Type: text/x-patch, Size: 4907 bytes --]

From 30137dd367eb67b349411d61249af97fade40f2f Mon Sep 17 00:00:00 2001
From: Manolis Ragkousis <manolis837@gmail.com>
Date: Mon, 29 Jun 2015 19:12:51 +0300
Subject: [PATCH] gnu: base: Build glibc-hurd for i586-pc-gnu instead of
 i686-pc-gnu.

With this commit "guix build bootstrap-tarballs --target=i586-pc-gnu"
produces working static binaries.

* gnu/packages/base.scm (glibc/hurd, glibc/hurd-headers): Change i686-pc-gnu
  to i586-pc-gnu.
* gnu/packages/cross-base.scm (cross-libc): Same.
* gnu/packages/hurd.scm (gnumach-headers, hurd-headers): Same.
* gnu/packages/patches/glibc-hurd-libs.patch: New patch.
---
 gnu/packages/base.scm                      |  9 ++++++---
 gnu/packages/cross-base.scm                |  2 +-
 gnu/packages/hurd.scm                      |  4 ++--
 gnu/packages/patches/glibc-hurd-libs.patch | 24 ++++++++++++++++++++++++
 4 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/base.scm b/gnu/packages/base.scm
index 05cbd66..811e334 100644
--- a/gnu/packages/base.scm
+++ b/gnu/packages/base.scm
@@ -629,7 +629,10 @@ with the Linux kernel.")
     (arguments
      (substitute-keyword-arguments (package-arguments glibc/linux)
        ((#:configure-flags original-configure-flags)
-        `(append (list "--host=i686-pc-gnu"
+        `(append (list "--host=i586-pc-gnu"
+
+                       ;; We need this to get a working openpty() function.
+                       "--enable-pt_chown"
 
                        ;; nscd fails to build for GNU/Hurd:
                        ;; <https://lists.gnu.org/archive/html/bug-hurd/2014-07/msg00006.html>.
@@ -651,7 +654,7 @@ with the Linux kernel.")
   "Return the glibc for TARGET, GLIBC/LINUX for a Linux host or
 GLIBC/HURD for a Hurd host"
   (match target
-    ("i686-pc-gnu" glibc/hurd)
+    ("i586-pc-gnu" glibc/hurd)
     (_ glibc/linux)))
 
 (define-syntax glibc
@@ -764,7 +767,7 @@ command.")
        ;; We just pass the flags really needed to build the headers.
        ((#:configure-flags _)
         `(list "--enable-add-ons"
-               "--host=i686-pc-gnu"
+               "--host=i586-pc-gnu"
                "--enable-obsolete-rpc"))
        ((#:phases _)
         '(alist-replace
diff --git a/gnu/packages/cross-base.scm b/gnu/packages/cross-base.scm
index 6e9d544..e3b4f4b 100644
--- a/gnu/packages/cross-base.scm
+++ b/gnu/packages/cross-base.scm
@@ -385,7 +385,7 @@ XBINUTILS and the cross tool chain."
 
   ;; Choose libc based on target
   (match target
-    ("i686-pc-gnu"
+    ("i586-pc-gnu"
      (package (inherit glibc/hurd)
        (name (string-append "glibc-hurd-cross-" target))
        (arguments
diff --git a/gnu/packages/hurd.scm b/gnu/packages/hurd.scm
index 43e8b1d..24cac25 100644
--- a/gnu/packages/hurd.scm
+++ b/gnu/packages/hurd.scm
@@ -58,7 +58,7 @@
       ;; least install its headers when not cross-compiling.
       ,@(if (%current-target-system)
           '()
-          '(#:configure-flags '("--build=i686-pc-gnu")))
+          '(#:configure-flags '("--build=i586-pc-gnu")))
       #:tests? #f))
     (home-page "https://www.gnu.org/software/hurd/microkernel/mach/gnumach.html")
     (synopsis "GNU Mach kernel headers")
@@ -126,7 +126,7 @@ communication.")
                            ;; that.
                            ,@(if (%current-target-system)
                                  '()
-                                 '("--host=i686-pc-gnu"))
+                                 '("--host=i586-pc-gnu"))
 
                            ;; Reduce set of dependencies.
                            "--disable-ncursesw"
diff --git a/gnu/packages/patches/glibc-hurd-libs.patch b/gnu/packages/patches/glibc-hurd-libs.patch
index cae1a40..2102f77 100644
--- a/gnu/packages/patches/glibc-hurd-libs.patch
+++ b/gnu/packages/patches/glibc-hurd-libs.patch
@@ -17,3 +17,27 @@ See <http://lists.gnu.org/archive/html/bug-hurd/2011-03/msg00112.html>
  	mv -f $@.new $@
  
  endif
+
+hurd-i386 defines NO_HIDDEN, thus __GI_* versions are not available.
+This was introduced by
+https://sourceware.org/bugzilla/show_bug.cgi?id=15605
+
+See <http://lists.gnu.org/archive/html/bug-hurd/2015-06/msg00046.html>.
+
+---
+ symbol-hacks.h |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+Index: eglibc-2.18/sysdeps/generic/symbol-hacks.h
+===================================================================
+--- eglibc-2.18.orig/sysdeps/generic/symbol-hacks.h	2013-06-15 17:37:04.000000000 +0000
++++ eglibc-2.18/sysdeps/generic/symbol-hacks.h	2013-10-10 06:28:31.000000000 +0000
+@@ -1,6 +1,9 @@
+ /* Some compiler optimizations may transform loops into memset/memmove
+    calls and without proper declaration it may generate PLT calls.  */
+ #if !defined __ASSEMBLER__ && !defined NOT_IN_libc && defined SHARED
++#include <config.h>
++#  if !defined NO_HIDDEN
+ asm ("memmove = __GI_memmove");
+ asm ("memset = __GI_memset");
++#  endif
+ #endif
-- 
2.4.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] gnu: base: Build glibc-hurd for i586-pc-gnu instead of i686-pc-gnu.
  2015-06-29 16:43 [PATCH] gnu: base: Build glibc-hurd for i586-pc-gnu instead of i686-pc-gnu Manolis Ragkousis
@ 2015-06-30 19:36 ` Ludovic Courtès
  0 siblings, 0 replies; 2+ messages in thread
From: Ludovic Courtès @ 2015-06-30 19:36 UTC (permalink / raw)
  To: Manolis Ragkousis; +Cc: Guix-devel

Manolis Ragkousis <manolis837@gmail.com> skribis:

> With this patch we can produce working static binaries for a Hurd system.

Woohoo!  :-)

> We had to change it to use i586, because the default i686 variant
> introduces bugs.

Specifically, static binaries (cross-)built for i686-gnu segfault early
on (heap address seems to be miscalculated), like this:

--8<---------------cut here---------------start------------->8---
$ gdb --args ./true
GNU gdb (Debian 7.7.1+dfsg-5) 7.7.1
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i586-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./true...done.
(gdb) r
Starting program: /home/ludo/t/static.debug3/bin/true 

Program received signal EXC_BAD_ACCESS, Could not access memory.
allocate_dtv (result=result@entry=0x8132a38) at dl-tls.c:300
300     dl-tls.c: No such file or directory.
(gdb) bt full
#0  allocate_dtv (result=result@entry=0x8132a38) at dl-tls.c:300
        dtv = 0x806ef50 <__memset_sse2>
        dtv_length = 15
#1  0x08087add in _dl_allocate_tls_storage () at dl-tls.c:364
        allocated = 0x8132208
        result = 0x8132a38
        size = 2116
#2  0x08087d3d in _dl_allocate_tls (mem=mem@entry=0x0) at dl-tls.c:460
No locals.
#3  0x0804cce3 in __pthread_create_internal (thread=thread@entry=0x1001e5c, attr=attr@entry=0x0, start_routine=start_routine@entry=0x0, arg=arg@entry=0x0) at ./pthread/pt-create.c:152
        err = 0
        pthread = 0x8131e38
        setup = <optimized out>
        sigset = 2147483647
        stacksize = 2097152
        __PRETTY_FUNCTION__ = "__pthread_create_internal"
#4  0x0804bfcc in _init_routine (stack=0x0) at ../libpthread/sysdeps/mach/hurd/pt-sysdep.c:66
        thread = 0x8050043 <__mach_msg+67>
        err = <optimized out>
#5  init_routine () at ../libpthread/sysdeps/mach/hurd/pt-sysdep.c:90
No locals.
#6  0x0805905b in init (data=0x1001ea0) at ../sysdeps/mach/hurd/i386/init-first.c:206
        newsp = <optimized out>
        od = <optimized out>
        argv = 0x1001ea4
        argc = <optimized out>
        envp = 0x1001f10
        d = 0x1001f10
#7  doinit1 (argc=1) at ../sysdeps/mach/hurd/i386/init-first.c:358
No locals.
#8  0x08048e74 in _start () at ../sysdeps/mach/hurd/i386/static-start.S:22
No locals.
--8<---------------cut here---------------end--------------->8---

> From 30137dd367eb67b349411d61249af97fade40f2f Mon Sep 17 00:00:00 2001
> From: Manolis Ragkousis <manolis837@gmail.com>
> Date: Mon, 29 Jun 2015 19:12:51 +0300
> Subject: [PATCH] gnu: base: Build glibc-hurd for i586-pc-gnu instead of
>  i686-pc-gnu.
>
> With this commit "guix build bootstrap-tarballs --target=i586-pc-gnu"
> produces working static binaries.
>
> * gnu/packages/base.scm (glibc/hurd, glibc/hurd-headers): Change i686-pc-gnu
>   to i586-pc-gnu.
> * gnu/packages/cross-base.scm (cross-libc): Same.
> * gnu/packages/hurd.scm (gnumach-headers, hurd-headers): Same.
> * gnu/packages/patches/glibc-hurd-libs.patch: New patch.

[...]

> --- a/gnu/packages/hurd.scm
> +++ b/gnu/packages/hurd.scm
> @@ -58,7 +58,7 @@
>        ;; least install its headers when not cross-compiling.
>        ,@(if (%current-target-system)
>            '()
> -          '(#:configure-flags '("--build=i686-pc-gnu")))
> +          '(#:configure-flags '("--build=i586-pc-gnu")))

Could you add here a link to his message, for future reference?  (I
don’t know where we can file this bug, maybe we should just ask the Hurd
folks.)

OK for wip-hurd with this change, thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-06-30 19:36 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-29 16:43 [PATCH] gnu: base: Build glibc-hurd for i586-pc-gnu instead of i686-pc-gnu Manolis Ragkousis
2015-06-30 19:36 ` Ludovic Courtès

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).