http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58719
Bug ID: 58719
Summary: libgcc/enable-execute-stack-mprotect.c: bootstrap
failure due to missing #include <sys/types.h>
Product: gcc
Version: 4.8.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: bootstrap
Assignee: unassigned at gcc dot gnu.org
Reporter: skunk at iskunk dot org
Host: i686-unknown-freebsd4.8
Target: i686-unknown-freebsd4.8
Build: i686-unknown-freebsd4.8
After patching bug #58274, a bootstrap of GCC 4.8.1 on FreeBSD 4.8 stops with
/tmp/gcc-build/./gcc/xgcc -B/tmp/gcc-build/./gcc/
-B/usr/local/i686-unknown-freebsd4.8/bin/
-B/usr/local/i686-unknown-freebsd4.8/lib/ -isystem
/usr/local/i686-unknown-freebsd4.8/include -isystem
/usr/local/i686-unknown-freebsd4.8/sys-include -g -O2 -O2 -g -O2 -DIN_GCC
-W -Wall -Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wold-style-definition -isystem ./include -fpic -pthread -g -DIN_LIBGCC2
-fbuilding-libgcc -fno-stack-protector -fpic -pthread -I. -I. -I../.././gcc
-I../../../gcc-4.8.1/libgcc -I../../../gcc-4.8.1/libgcc/.
-I../../../gcc-4.8.1/libgcc/../gcc -I../../../gcc-4.8.1/libgcc/../include
-DHAVE_CC_TLS -DUSE_EMUTLS -o enable-execute-stack.o -MT enable-execute-stack.o
-MD -MP -MF enable-execute-stack.dep -c enable-execute-stack.c
-fvisibility=hidden -DHIDE_EXPORTS
In file included from /usr/include/sys/mman.h:135:0,
from enable-execute-stack.c:25:
/usr/include/sys/mman.h:141:14: error: unknown type name 'mode_t'
int shm_open __P((const char *, int, mode_t));
^
/usr/include/sys/mman.h:144:11: error: unknown type name 'size_t'
int mlock __P((const void *, size_t));
^
/usr/include/sys/mman.h:147:13: error: unknown type name 'size_t'
void * mmap __P((void *, size_t, int, int, int, off_t));
^
/usr/include/sys/mman.h:147:13: error: unknown type name 'off_t'
void * mmap __P((void *, size_t, int, int, int, off_t));
^
/usr/include/sys/mman.h:149:14: error: unknown type name 'size_t'
int mprotect __P((const void *, size_t, int));
^
/usr/include/sys/mman.h:150:11: error: unknown type name 'size_t'
int msync __P((void *, size_t, int));
^
/usr/include/sys/mman.h:151:13: error: unknown type name 'size_t'
int munlock __P((const void *, size_t));
^
/usr/include/sys/mman.h:152:12: error: unknown type name 'size_t'
int munmap __P((void *, size_t));
^
/usr/include/sys/mman.h:154:13: error: unknown type name 'size_t'
int madvise __P((void *, size_t, int));
^
/usr/include/sys/mman.h:155:13: error: unknown type name 'size_t'
int mincore __P((const void *, size_t, char *));
^
/usr/include/sys/mman.h:156:14: error: unknown type name 'size_t'
int minherit __P((void *, size_t, int));
^
enable-execute-stack.c: In function '__enable_execute_stack':
enable-execute-stack.c:86:7: warning: implicit declaration of function
'mprotect' [-Wimplicit-function-declaration]
if (mprotect (page, end - page, STACK_PROT_RWX) < 0)
^
gmake[3]: *** [enable-execute-stack.o] Error 1
gmake[3]: Leaving directory `/tmp/gcc-build/i686-unknown-freebsd4.8/libgcc'
gmake[2]: *** [all-stage1-target-libgcc] Error 2
gmake[2]: Leaving directory `/tmp/gcc-build'
gmake[1]: *** [stage1-bubble] Error 2
gmake[1]: Leaving directory `/tmp/gcc-build'
gmake: *** [bootstrap] Error 2
$ ls -l /tmp/gcc-build/i686-unknown-freebsd4.8/libgcc/enable-execute-stack.c
lrwxr-xr-x 1 cport r&d 57 Oct 14 02:31
/tmp/gcc-build/i686-unknown-freebsd4.8/libgcc/enable-execute-stack.c ->
../../../gcc-4.8.1/libgcc/enable-execute-stack-mprotect.c
Adding an '#include <sys/types.h>' to libgcc/enable-execute-stack-mprotect.c,
right before the sys/mman.h #include, is enough to get the bootstrap going
again.