custom build gcc/glibc w/ 16 bit wchar

Chuck T. freebsdfan@hotmail.com
Thu Mar 3 20:04:00 GMT 2005


I have a significant amount of Windoze code that I'm porting to Linux which
uses 16 bit wide characters extensively.  -fshort-wchar has served me well
so far, but now I'd like to rebuild glibc for 16 bit wide character support.
I thought it would be fairly simple to build a custom version of gcc/glibc,
but I haven't had any success.  Unless I specify -fshort-wchar a program
compiled with my custom gcc still shows sizeof(wchar_t) to be 4 bytes and
glibc is still using 4 byte wchars.

Since I'm building a cross compiler for the ARM I picked gcc 3.4.1 and
glibc 2.3.3 since those versions build for the ARM using crosstool-0.28 rc37
without any fuss.  Currently I'm building an x86 compiler just to simply
things.

In the gcc source tree I changed WCHAR_TYPE and WCHAR_TYPE_SIZE in
.../gcc/config/i386/linux.h and .../gcc/config/i386/linux-aout.h to
"short unsigned int", and WCHAR_TYPE_SIZE to 16 respectively.

In the glibc source tree I changed __WCHAR_MIN and __WCHAR_MAX in
.../sysdeps/unix/sysv/linux/i386/bits/wchar.h to -32786 and 32767 
respectively.

I've verified that those are the headers that are being references when gcc
is built.

I'm passing the following to the crosstool scripts:
TARGET=i686-unknown-linux-gnu
TARGET_CFLAGS="-O -fshort-wchar -g"

I've also tried without the -fshort-wchar flag in TARGET_CFLAGS without
success.

What am I missing?  Any help would be most appreciated!

Skip




More information about the Gcc-help mailing list