Package: gcl
Version: 2.6.7-42
Severity: important
Tags: patch
Justification: fails to build from source


The new ADDR_NO_RANDOMIZE detection snippets in configure fail under
dpkg-buildpackage because dpkg-bp defaults CFLAGS to "-g -O2", and gcc
4.[1,2,3] fails to compile the snippet. The attached patch (and
running autoconf to rebuild configure) fixes this by splitting 
h/unrandomize.h into headers (outside main) and code (inside main).

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'testing')
Architecture: i386 (i686)

Kernel: Linux 2.6.25-2-686 (SMP w/2 CPU cores)
Locale: LANG=en_CA.UTF-8, LC_CTYPE=en_CA.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages gcl depends on:
ii  debconf                   1.5.23         Debian configuration management sy
ii  emacs [emacsen]           22.2+2-3       The GNU Emacs editor (metapackage)
ii  emacs22-gtk [emacsen]     22.2+2-3       The GNU Emacs editor (with GTK use
ii  gcc                       4:4.3.1-2      The GNU C compiler
ii  libc6                     2.7-13         GNU C Library: Shared libraries
ii  libgmp3c2                 2:4.2.2+dfsg-3 Multiprecision arithmetic library
ii  libice6                   2:1.0.4-1      X11 Inter-Client Exchange library
ii  libncurses5               5.6+20080804-1 shared libraries for terminal hand
ii  libreadline5              5.2-3          GNU readline and history libraries
ii  libsm6                    2:1.0.3-2      X11 Session Management library
ii  libx11-6                  2:1.1.4-2      X11 client-side library
ii  libxaw7                   2:1.0.4-2      X11 Athena Widget library
ii  libxext6                  2:1.0.4-1      X11 miscellaneous extension librar
ii  libxmu6                   2:1.0.4-1      X11 miscellaneous utility library
ii  libxt6                    1:1.0.5-3      X11 toolkit intrinsics library
ii  tcl8.4                    8.4.19-2       Tcl (the Tool Command Language) v8
ii  tk8.4                     8.4.19-2       Tk toolkit for Tcl and X11, v8.4 -

gcl recommends no packages.

Versions of packages gcl suggests:
ii  gcl-doc                       2.6.7-42   Documentation for GNU Common Lisp

-- debconf information:
  gcl/default_gcl_ansi:
  gcl/default_gcl_prof:
diff --git a/configure.in b/configure.in
index b665142..8564e71 100644
--- a/configure.in
+++ b/configure.in
@@ -1022,7 +1022,8 @@ if test "$HAVE_SBRK" = "1" ; then
 	fi
 
 	AC_MSG_CHECKING([for personality(ADDR_NO_RANDOMIZE) support])
-	AC_TRY_RUN([void gprof_cleanup() {};
+	AC_TRY_RUN([#include "h/unrandomize_hdr.h"
+		    void gprof_cleanup() {};
 		    int main(int argc,char *argv[],char *envp[]) {
 	            #include "h/unrandomize.h"
 		    return 0;}],CAN_UNRANDOMIZE_SBRK=1,CAN_UNRANDOMIZE_SBRK=0,CAN_UNRANDOMIZE_SBRK=0)
@@ -1036,6 +1037,10 @@ if test "$HAVE_SBRK" = "1" ; then
 
 	AC_MSG_CHECKING([that sbrk is (now) non-random])
 	AC_TRY_RUN([#include <stdio.h>
+	    	    #ifdef CAN_UNRANDOMIZE_SBRK
+		    #include "h/unrandomize_hdr.h"
+		    #endif
+
 	            void gprof_cleanup() {};
 		    int main(int argc,char * argv[],char * envp[]) {
 			FILE *f;
@@ -1050,6 +1055,10 @@ if test "$HAVE_SBRK" = "1" ; then
 		exit 1
 	fi
 	AC_TRY_RUN([#include <stdio.h>
+	    	    #ifdef CAN_UNRANDOMIZE_SBRK
+		    #include "h/unrandomize_hdr.h"
+		    #endif
+
                     void gprof_cleanup() {};
 		    int main(int argc,char * argv[],char * envp[]) {
 			FILE *f;
diff --git a/h/unrandomize.h b/h/unrandomize.h
index 3970872..a9d8e0a 100644
--- a/h/unrandomize.h
+++ b/h/unrandomize.h
@@ -1,9 +1,3 @@
-#include <sys/personality.h>
-#include <syscall.h>
-#include <unistd.h>
-#include <stdio.h>
-#include <stdlib.h>
-
 {
 
   long pers = personality(0xffffffffUL);
diff --git a/h/unrandomize_hdr.h b/h/unrandomize_hdr.h
new file mode 100644
index 0000000..e1c15d4
--- /dev/null
+++ b/h/unrandomize_hdr.h
@@ -0,0 +1,5 @@
+#include <sys/personality.h>
+#include <syscall.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
diff --git a/o/main.c b/o/main.c
index efd2f2c..44104b3 100755
--- a/o/main.c
+++ b/o/main.c
@@ -117,6 +117,10 @@ void install_segmentation_catcher(void);
 #endif
 #endif
 
+#ifdef CAN_UNRANDOMIZE_SBRK
+#include "unrandomize_hdr.h"
+#endif
+
 int
 main(int argc, char **argv, char **envp) {
 #ifdef BSD

Reply via email to