[Bug bootstrap/11171] New: Wrong ctype/OS include files when using Newlib
ronald@landheer.com
gcc-bugzilla@gcc.gnu.org
Thu Jun 12 12:26:00 GMT 2003
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11171
Summary: Wrong ctype/OS include files when using Newlib
Product: gcc
Version: 3.3
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: bootstrap
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: ronald@landheer.com
CC: gcc-bugs@gcc.gnu.org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i386-unknown-freebsd4.7
Used configuration line:
$ ../src/configure --prefix=/home/cross/tmp --target=i386-unknown-freebsd4.7
--with-newlib --disable-threads --disable-shared --enable-languages=c,c++,java
When building for FreeBSD (and presumably any other platform that doesn't
automagically use Newlib as crt) the FreeBSD headers for ctype (and other
OS-specific headers) are used automatically, regardless of whether we're using
Newlib or not.
The bug is located in configure.target, in the block that starts at:
106 # Set any OS-dependent bits.
107 # Set the os_include_dir.
108 # Set c_model, c_compatibility here.
109 # If atomic ops and/or numeric limits are OS-specific rather than
110 # CPU-specifc, set those here too.
111 # THIS TABLE IS SORTED. KEEP IT THAT WAY.
In my particular case, the bug is at:
137 freebsd*)
138 os_include_dir="os/bsd/freebsd"
139 # The FreeBSD ABI is expressed in the major version number only.
140 abi_baseline_triplet=`echo ${target} | sed 's,\(\.[0-9]*\)*$,,'`
141 ;;
IMHO, after this table is passed, the --with-newlib option for configure should
be re-examined and the os_include_dir should be overridden accordingly.
Something like this:
if test x"$with_newlib" = "xyes"; then
os_include_dir="os/newlib"
fi
should do nicely. This does require a two-liner in acinclude.m4:
AC_ARG_WITH(newlib,
[ --with-newlib use newlib])
(in the GLIBCPP_CONFIGURE macro)
Stragely enough, the same change is required in configure.in: while the
GLIBCPP_CONFIGURE macro is called the block starting at
114 # Construct crosses by hand, eliminating bits that need ld...
115 # GLIBCPP_CHECK_COMPILER_FEATURES
116 # GLIBCPP_CHECK_BUILTIN_MATH_SUPPORT
117 # GLIBCPP_CHECK_MATH_SUPPORT
overrides some of the settings. (specifically it overrides the os_include_dir
that was set in configure.target). I see no reason to do this twice, but had to
include
274 if test x"$with_newlib" = "xyes"; then
275 os_include_dir="os/newlib"
276 fi
I'll prepare a patch and send it to gcc-patches.
HTH
rlc
More information about the Gcc-bugs
mailing list