public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Gcc 4.2.2 build failure (fixincludes breaks limits.h)
@ 2008-01-15 15:27 Kristian Van Der Vliet
  0 siblings, 0 replies; only message in thread
From: Kristian Van Der Vliet @ 2008-01-15 15:27 UTC (permalink / raw)
  To: gcc-help

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

I'm in the process of upgrading the Syllable port of Gcc 4.1.2 to 4.2.2
but have run into a build failure. The stage2 configure tests for mmap()
always pass, although mmap() is not available on Syllable. This produces
a stage2 xgcc which fails during the stage3 build with:

"virtual memory exhausted: Function not implemented"

I've tracked this down to a problem where fixincludes has produced a
local limits.h file. This is the file which the configure tests include
before checking for the __stub_mmap macro.

In the normal case the Glibc limits.h includes features.h, which
includes stubs.h which then defines these stub macros, but the limits.h
which is produced by fixincludes does not include features.h, so the
macro is never defined and the simple conftest incorrectly passes.

This is obviously also a problem for all of the other functions which
are tested for in the same manner, although mmap() is the one I'm
specifically having trouble with.

I've pulled the test out of the configure script to test this
(attached), and built it with

/boot/home/root/Build/gcc/_gcc-4.2.2/./prev-gcc/xgcc
-B/boot/home/root/Build/gcc/_gcc-4.2.2/./prev-gcc/
-B/usr/gcc/i586-pc-syllable/bin/ -o conftest -O2 -g -fomit-frame-pointer
-v  conftest.c

Is there any way I can stop fixincludes from mangling limits.h, or at
least ensuring it always keeps the include for features.h?

-- 
Vanders
http://www.syllable.org

[-- Attachment #2: conftest.c --]
[-- Type: text/x-csrc, Size: 984 bytes --]

#define mmap innocuous_mmap

/* System header to define __stub macros and hopefully few prototypes,
    which can conflict with char mmap (); below.
    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
    <limits.h> exists even on freestanding compilers.  */

#ifdef __STDC__
# include <limits.h>
#else
# include <assert.h>
#endif

#undef mmap

/* Override any gcc2 internal prototype to avoid an error.  */
#ifdef __cplusplus
extern "C"
{
#endif
/* We use char because int might match the return type of a gcc2
   builtin and then its argument prototype would still apply.  */
char mmap ();
/* The GNU C library defines this for functions which it implements
    to always fail with ENOSYS.  Some functions are actually named
    something starting with __ and the normal name is an alias.  */
#if defined (__stub_mmap) || defined (__stub___mmap)
choke me
#else
char (*f) () = mmap;
#endif
#ifdef __cplusplus
}
#endif

int
main ()
{
return f != mmap;
  ;
  return 0;
}

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2008-01-14 13:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-01-15 15:27 Gcc 4.2.2 build failure (fixincludes breaks limits.h) Kristian Van Der Vliet

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).