There are a numerous number of problems with libmudflap which break FreeBSD bootstrapping. See http://gcc.gnu.org/ml/gcc/2003-06/msg02511.html for details. Furthermore the current cvs-version also bangs with /stuff/gcc.obj/gcc/xgcc -B/stuff/gcc.obj/gcc/ -B/stuff/gcc.install/i386-unknown-freebsd4.8/bin/ -B/stuff/gcc.install/i386-unknown-freebsd4.8/lib/ -isystem /stuff/gcc.install/i386-unknown-freebsd4.8/include -isystem /stuff/gcc.install/i386-unknown-freebsd4.8/sys-include -DHAVE_CONFIG_H -I. -I../../../gcc/libmudflap -I. -O2 -g -O2 -Wall -O2 -g -O2 -DLIBMUDFLAPTH -DWRAP_pthreadstuff -c ../../../gcc/libmudflap/mf-hooks3.c -fPIC -DPIC -o pth/.libs/pthreadstuff-hook.o ../../../gcc/libmudflap/mf-hooks3.c: In function `pthread_create': ../../../gcc/libmudflap/mf-hooks3.c:404: error: `MAP_ANONYMOUS' undeclared (first use in this function) ../../../gcc/libmudflap/mf-hooks3.c:404: error: (Each undeclared identifier is reported only once ../../../gcc/libmudflap/mf-hooks3.c:404: error: for each function it appears in.) [linus@hal9000 ~]$ uname -a FreeBSD hal9000.alcom.aland.fi 4.8-STABLE FreeBSD 4.8-STABLE #5: Fri Jul 4 11:24:45 EEST 2003 root@hal9000.alcom.aland.fi:/usr/obj/usr/src/sys/HAL i386 [linus@hal9000 ~]$
Looks like libmudflap is only supported on GNU/Linux and does not have enough configure magic to support it on other targets because I have the same problem on powerpc-apple-darwin6.6.
Created attachment 4478 [details] MAP_ANON support
The previous summary line was rather pessimistic. The code is periodically tested on other platforms, but clearly not all. That's why we need the help of people that try to build on oddball :-) hosts. Please try the attached patch.
With the patch applied that specific wrapper compiles fine. The remaining problems are: * WRAP_stat64 failes since there is no syscall stat64 * WRAP_fseeko64 failes since there is no syscall fseeko64 * WRAP_ftello64 failes since there is no syscall ftello64 * WRAP_semctl gives a 'error: redefinition of `union semun'' * _POSIX_SOURCE introduces a problem with sa_family_t since u_char is undefined. See http://gcc.gnu.org/ml/gcc/2003-06/msg02490.html http://gcc.gnu.org/ml/gcc/2003-06/msg02490.html for all the details.
Most of the remaining problems relate to the lack of Large File Support in freebsd. I'm investigating how to selectively leave these bits out of libmudflap.
No it is not related to the Lack of Large File Support but rather the Large File Support is support is not need as the regular ones are the 64bit ones so there is no need for the extra 64bit ones. All *BSD are this way including Darwin.
Linux, how do you propose the _POSIX_SOURCE issue be solved? Is there another bsd header worth #include'ing? (I see how to autoconf the rest.)
Subject: Re: libmudflap does not compile on freebsd From types.h: #ifndef _POSIX_SOURCE typedef unsigned char u_char; typedef unsigned short u_short; (...) #endif Not much to do there... The code compiles with _POSIX_SOURCE undefined (that's how I have been solving the problem temporarly), so an ugly fix is something like diff -u -u -r1.1.2.1 mf-hooks2.c --- mf-hooks2.c 4 Jul 2003 23:10:09 -0000 1.1.2.1 +++ mf-hooks2.c 25 Jul 2003 18:30:05 -0000 @@ -11,7 +11,9 @@ /* These attempt to coax various unix flavours to declare all our needed tidbits in the system headers. */ +#ifndef _FREEBSD /* Or some other magic that detects FreeBSD (prob. *BSD) */ #define _POSIX_SOURCE +#endif #define _GNU_SOURCE #define _XOPEN_SOURCE #define _BSD_TYPES
I experienced (and hack around) this before noticing this PR, so here are some comments on suggested resolutions: 1. The MAP_ANON patch looks good; would you mind applying it, Frank? 2. The _POSIX issue should be resolved as in http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11673#c8 but using __FreeBSD__ instead. Still, it would be good to note (in comments) which platforms require _POSIX. 3. I agree that autoconf-ing the *64 functions is the best approach, 4. and similarly for union semun.
Please try out the patch just committed.
Subject: Bug 11673 CVSROOT: /cvs/gcc Module name: gcc Branch: tree-ssa-20020619-branch Changes by: gerald@gcc.gnu.org 2003-07-29 19:32:40 Modified files: libmudflap : ChangeLog mf-hooks2.c Log message: PR other/11673 * mf-hooks2.c [WRAP_semctl]: Fix check for HAVE_UNION_SEMUN. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libmudflap/ChangeLog.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.69&r2=1.1.2.70 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/libmudflap/mf-hooks2.c.diff?cvsroot=gcc&only_with_tag=tree-ssa-20020619-branch&r1=1.1.2.2&r2=1.1.2.3
WORKSFORGERALD
Confirmed.