NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

misc/37932: build distribution with USE_FORT/_FORTIFY_SOURCES fails



>Number:         37932
>Category:       misc
>Synopsis:       build distribution with USE_FORT fails
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    misc-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 31 15:00:01 +0000 2008
>Originator:     Yakovetsky Vladimir
>Release:        NetBSD 4.99.51
>Environment:
System: NetBSD lrou.x.ua 4.99.51 NetBSD 4.99.51 (lrou-1.880) #0: Tue Jan 29 
17:27:05 EET 2008 Yakovetsky Vladimir 
<yx%x.ua@localhost>@lrou.x.ua:/sys/arch/i386/compile/lrou i386
Architecture: i386
Machine: i386
>Description:
        build distribution with USE_FORT fails

>How-To-Repeat:

# uname -srm
NetBSD 4.99.51 i386
# grep '^USE_FORT' /etc/mk.conf
USE_FORT=               yes
# cd /usr/src && ./build.sh distribution
...

step-by-step:
(1)
...
    compile  libpthread/pthread_cancelstub.o
pthread_cancelstub.c:431: error: redefinition of '__read_alias'
/usr/src/obj/destdir.i386/usr/include/ssp/unistd.h:46: error: previous 
definition of '__read_alias' was here

*** Failed target:  pthread_cancelstub.o
*** Failed command: 
/usr/src/obj/tooldir.NetBSD-4.99.51-i386/bin/i386--netbsdelf-gcc -O2 -Wall 
-Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wno-sign-compare 
-Wno-traditional -Wreturn-type -Wswitch -Wshadow -Wcast-qual -Wwrite-strings 
-Wextra -Wno-unused-parameter -std=gnu99 -Werror -march=pentium4 
-fstack-protector -Wstack-protector --param ssp-buffer-size=1 -Wno-cast-qual 
-I/usr/src/lib/libpthread/arch/i386 -I/usr/src/lib/libpthread 
-I/usr/src/lib/libpthread -D_LIBC -D__LIBPTHREAD_SOURCE__ -I/usr/src/sys 
-I/usr/src/lib/libpthread/../libc -D_FORTIFY_SOURCE=2 -nostdinc -isystem 
/usr/src/obj/destdir.i386/usr/include -c pthread_cancelstub.c -o 
pthread_cancelstub.o
*** Error code 1

Stop.
nbmake: stopped in /usr/src/lib/libpthread
...


workaround1:
--- lib/libpthread/pthread_cancelstub.c.orig
+++ lib/libpthread/pthread_cancelstub.c
@@ -426,6 +426,10 @@
        return retval;
 }
 
+#ifdef _FORTIFY_SOURCE
+#undef read
+#endif
+
 ssize_t
 read(int d, void *buf, size_t nbytes)
 {


(2)
...
    compile  libnlsut/xgetcwd.o
/usr/src/gnu/dist/gettext/gettext-tools/lib/xgetcwd.c:43:15: error: macro 
"getcwd" requires 2 arguments, but only 1 given
/usr/src/gnu/dist/gettext/gettext-tools/lib/xgetcwd.c:43: error: 'getcwd' 
redeclared as different kind of symbol
/usr/src/obj/destdir.i386/usr/include/unistd.h:117: error: previous declaration 
of 'getcwd' was here

*** Failed target:  xgetcwd.o
*** Failed command: 
/usr/src/obj/tooldir.NetBSD-4.99.51-i386/bin/i386--netbsdelf-gcc -O2 -Werror 
-march=pentium4 -fstack-protector -Wstack-protector --param ssp-buffer-size=1 
-DHAVE_CONFIG_H -I/usr/src/gnu/usr.bin/gettext/libnlsut 
-I/usr/src/gnu/usr.bin/gettext/libnlsut/../include 
-I/usr/src/gnu/dist/gettext/gettext-tools/lib -DLOCALEDIR=\"/usr/share/locale\" 
-DEXEEXT=\"\" -DHAVE_CONFIG_H -I/usr/src/gnu/usr.bin/gettext/libnlsut 
-I/usr/src/gnu/usr.bin/gettext/libnlsut/../include 
-I/usr/src/gnu/dist/gettext/gettext-tools/lib -DLOCALEDIR=\"/usr/share/locale\" 
-D_FORTIFY_SOURCE=2 -nostdinc -isystem /usr/src/obj/destdir.i386/usr/include -c 
/usr/src/gnu/dist/gettext/gettext-tools/lib/xgetcwd.c -o xgetcwd.o
*** Error code 1

Stop.
nbmake: stopped in /usr/src/gnu/usr.bin/gettext/libnlsut
...


workaround2:
--- gnu/dist/gettext/gettext-tools/lib/xgetcwd.c.orig
+++ gnu/dist/gettext/gettext-tools/lib/xgetcwd.c
@@ -40,7 +40,9 @@
    /* We want the directory in Unix syntax, not in VMS syntax.  */
 #  define getcwd(Buf, Max) (getcwd) (Buf, Max, 0)
 # else
+#  ifndef _FORTIFY_SOURCE
 char *getcwd ();
+#  endif
 # endif
 #else
 char *getwd ();


(3)
...
    compile  libgdb/regcache.o
cc1: warnings being treated as errors
/usr/src/gnu/dist/gdb6/gdb/regcache.c: In function 'regcache_xfer_part':
/usr/src/gnu/dist/gdb6/gdb/regcache.c:864: warning: passing argument 1 of 
'__read_alias' makes integer from pointer without a cast
/usr/src/gnu/dist/gdb6/gdb/regcache.c:864: warning: passing argument 2 of 
'__read_alias' makes pointer from integer without a cast
/usr/src/gnu/dist/gdb6/gdb/regcache.c:864: warning: passing argument 3 of 
'__read_alias' makes integer from pointer without a cast

*** Failed target:  regcache.o
*** Failed command: 
/usr/src/obj/tooldir.NetBSD-4.99.51-i386/bin/i386--netbsdelf-gcc -O2 -Werror 
-march=pentium4 -fstack-protector -Wstack-protector --param ssp-buffer-size=1 
-Wno-stack-protector -I/usr/src/gnu/usr.bin/gdb6/libgdb 
-I/usr/src/gnu/usr.bin/gdb6/libgdb/../arch/i386 -I/usr/src/gnu/dist/gdb6/gdb 
-I/usr/src/gnu/dist/gdb6/gdb/config -I/usr/src/gnu/dist/gdb6/include/opcode 
-I/usr/src/gnu/dist/gdb6 -I/usr/src/gnu/usr.bin/gdb6/libgdb/../bfd/arch/i386 
-I/usr/src/gnu/dist/gdb6/bfd -I/usr/src/gnu/dist/gdb6/include 
-DLOCALEDIR="\"/usr/share/locale\"" -DHAVE_CONFIG_H -DMI_OUT=1 -DTUI=1 
-D_FORTIFY_SOURCE=2 -nostdinc -isystem /usr/src/obj/destdir.i386/usr/include -c 
/usr/src/gnu/dist/gdb6/gdb/regcache.c -o regcache.o
*** Error code 1

Stop.
nbmake: stopped in /usr/src/gnu/usr.bin/gdb6/libgdb
...


workaround3:
--- gnu/dist/gdb6/gdb/regcache.c.orig
+++ gnu/dist/gdb6/gdb/regcache.c
@@ -840,6 +840,10 @@
 typedef void (regcache_write_ftype) (struct regcache *regcache, int regnum,
                                     const void *buf);
 
+#ifdef _FORTIFY_SOURCE
+#undef read
+#endif
+
 static void
 regcache_xfer_part (struct regcache *regcache, int regnum,
                    int offset, int len, void *in, const void *out,

(4)
...
    compile  libgdb/user-regs.o
/usr/src/gnu/dist/gdb6/gdb/user-regs.c:202:26: error: macro "read" requires 3 
arguments, but only 1 given
cc1: warnings being treated as errors
/usr/src/gnu/dist/gdb6/gdb/user-regs.c: In function 'value_of_user_reg':
/usr/src/gnu/dist/gdb6/gdb/user-regs.c:202: warning: return from incompatible 
pointer type

*** Failed target:  user-regs.o
*** Failed command: 
/usr/src/obj/tooldir.NetBSD-4.99.51-i386/bin/i386--netbsdelf-gcc -O2 -Werror 
-march=pentium4 -fstack-protector -Wstack-protector --param ssp-buffer-size=1 
-Wno-stack-protector -I/usr/src/gnu/usr.bin/gdb6/libgdb 
-I/usr/src/gnu/usr.bin/gdb6/libgdb/../arch/i386 -I/usr/src/gnu/dist/gdb6/gdb 
-I/usr/src/gnu/dist/gdb6/gdb/config -I/usr/src/gnu/dist/gdb6/include/opcode 
-I/usr/src/gnu/dist/gdb6 -I/usr/src/gnu/usr.bin/gdb6/libgdb/../bfd/arch/i386 
-I/usr/src/gnu/dist/gdb6/bfd -I/usr/src/gnu/dist/gdb6/include 
-DLOCALEDIR="\"/usr/share/locale\"" -DHAVE_CONFIG_H -DMI_OUT=1 -DTUI=1 
-D_FORTIFY_SOURCE=2 -nostdinc -isystem /usr/src/obj/destdir.i386/usr/include -c 
/usr/src/gnu/dist/gdb6/gdb/user-regs.c -o user-regs.o
*** Error code 1

Stop.
nbmake: stopped in /usr/src/gnu/usr.bin/gdb6/libgdb
...


workaround4:
--- gnu/dist/gdb6/gdb/user-regs.c.orig
+++ gnu/dist/gdb6/gdb/user-regs.c
@@ -191,6 +191,10 @@
     }
 }
 
+#ifdef _FORTIFY_SOURCE
+#undef read
+#endif
+
 struct value *
 value_of_user_reg (int regnum, struct frame_info *frame)
 {


(5)
...
    compile  scsictl/scsictl.o
cc1: warnings being treated as errors
scsictl.c: In function 'device_format':
scsictl.c:630: warning: call to __builtin___memcpy_chk will always overflow 
destination buffer

*** Failed target:  scsictl.o
*** Failed command: 
/usr/src/obj/tooldir.NetBSD-4.99.51-i386/bin/i386--netbsdelf-gcc -O2 
-march=pentium4 -fstack-protector -Wstack-protector --param ssp-buffer-size=1 
-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith 
-Wno-sign-compare -Wno-traditional -Wreturn-type -Wswitch -Wshadow -Wcast-qual 
-Wwrite-strings -Wextra -Wno-unused-parameter -Werror -nostdinc -isystem 
/usr/src/obj/destdir.i386/usr/include -D_FORTIFY_SOURCE=2 -c scsictl.c
*** Error code 1

Stop.
nbmake: stopped in /usr/src/sbin/scsictl
...


--- sbin/scsictl/scsictl.c.orig
+++ sbin/scsictl/scsictl.c
@@ -627,7 +627,7 @@
                                    req.retsts);
                                break;
                        }
-                       memcpy(&sense, req.sense, SENSEBUFLEN);
+                       memcpy(&sense, req.sense, sizeof(sense));
                        if (sense.sks.sks_bytes[0] & SSD_SKSV) {
                                j = (sense.sks.sks_bytes[1] << 8) |
                                    (sense.sks.sks_bytes[2]);


(6)
...
    compile  gspa/gsp_out.o
In file included from gsp_out.c:43:
gsp_ass.h:186:1: error: "bcopy" redefined
In file included from /usr/src/obj/destdir.i386/usr/include/strings.h:72,
                 from /usr/src/obj/destdir.i386/usr/include/string.h:83,
                 from gsp_out.c:41:
/usr/src/obj/destdir.i386/usr/include/ssp/strings.h:45:1: error: this is the 
location of the previous definition

*** Failed target:  gsp_out.o
*** Failed command: 
/usr/src/obj/tooldir.NetBSD-4.99.51-i386/bin/i386--netbsdelf-gcc -O2 
-march=pentium4 -fstack-protector -Wstack-protector --param ssp-buffer-size=1 
-Wall -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith 
-Wno-sign-compare -Wno-traditional -Werror -I. -I/usr/src/usr.sbin/gspa/gspa 
-nostdinc -isystem /usr/src/obj/destdir.i386/usr/include -D_FORTIFY_SOURCE=2 -c 
gsp_out.c
*** Error code 1

Stop.
nbmake: stopped in /usr/src/usr.sbin/gspa/gspa
...


--- usr.sbin/gspa/gspa/gsp_ass.h.orig
+++ usr.sbin/gspa/gspa/gsp_ass.h
@@ -181,6 +181,12 @@
 #endif
 #endif
 
+#ifdef __NetBSD__
+#ifndef BSD
+#define BSD
+#endif
+#endif
+
 #ifndef BSD
 #ifndef amiga
 #define bcopy(s, d, l) memcpy(d, s, l)


>Fix:
        summary:
--- lib/libpthread/pthread_cancelstub.c.orig
+++ lib/libpthread/pthread_cancelstub.c
@@ -426,6 +426,10 @@
        return retval;
 }
 
+#ifdef _FORTIFY_SOURCE
+#undef read
+#endif
+
 ssize_t
 read(int d, void *buf, size_t nbytes)
 {
--- gnu/dist/gettext/gettext-tools/lib/xgetcwd.c.orig
+++ gnu/dist/gettext/gettext-tools/lib/xgetcwd.c
@@ -40,7 +40,9 @@
    /* We want the directory in Unix syntax, not in VMS syntax.  */
 #  define getcwd(Buf, Max) (getcwd) (Buf, Max, 0)
 # else
+#  ifndef _FORTIFY_SOURCE
 char *getcwd ();
+#  endif
 # endif
 #else
 char *getwd ();
--- gnu/dist/gdb6/gdb/regcache.c.orig
+++ gnu/dist/gdb6/gdb/regcache.c
@@ -840,6 +840,10 @@
 typedef void (regcache_write_ftype) (struct regcache *regcache, int regnum,
                                     const void *buf);
 
+#ifdef _FORTIFY_SOURCE
+#undef read
+#endif
+
 static void
 regcache_xfer_part (struct regcache *regcache, int regnum,
                    int offset, int len, void *in, const void *out,
--- gnu/dist/gdb6/gdb/user-regs.c.orig
+++ gnu/dist/gdb6/gdb/user-regs.c
@@ -191,6 +191,10 @@
     }
 }
 
+#ifdef _FORTIFY_SOURCE
+#undef read
+#endif
+
 struct value *
 value_of_user_reg (int regnum, struct frame_info *frame)
 {
--- sbin/scsictl/scsictl.c.orig
+++ sbin/scsictl/scsictl.c
@@ -627,7 +627,7 @@
                                    req.retsts);
                                break;
                        }
-                       memcpy(&sense, req.sense, SENSEBUFLEN);
+                       memcpy(&sense, req.sense, sizeof(sense));
                        if (sense.sks.sks_bytes[0] & SSD_SKSV) {
                                j = (sense.sks.sks_bytes[1] << 8) |
                                    (sense.sks.sks_bytes[2]);
--- usr.sbin/gspa/gspa/gsp_ass.h.orig
+++ usr.sbin/gspa/gspa/gsp_ass.h
@@ -181,6 +181,12 @@
 #endif
 #endif
 
+#ifdef __NetBSD__
+#ifndef BSD
+#define BSD
+#endif
+#endif
+
 #ifndef BSD
 #ifndef amiga
 #define bcopy(s, d, l) memcpy(d, s, l)




Home | Main Index | Thread Index | Old Index