From 0343c6f32c5bd8335e88595cb9d23506625b2586 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Mon, 12 Jan 2015 22:33:32 -0800 Subject: Fix for LLVM wchar_t literals not being four byte aligned, affecting OS X port. * configure: Detect a SIZEOF_WCHAR_T when detecting integer type that will hold a pointer. In the lit_align test, if we are on Apple Mac OSX, use a lit_align of 2, so the logic kicks in for padding literals and handling misalignment. * lib.h (litptr): Add a case for LIT_ALIGN < 4 and SIZEOF_WCHAR_T == 4. In this case we do the arithmetic on the pointer using short *, and then convert to wchar_t. * HACKING: New section 2.4.3 about new wchar_t hack. --- configure | 26 +++++++------------------- 1 file changed, 7 insertions(+), 19 deletions(-) (limited to 'configure') diff --git a/configure b/configure index 20b92858..f205b959 100755 --- a/configure +++ b/configure @@ -1083,6 +1083,7 @@ read_syms() if [ -z "$intptr" ] ; then cat > conftest.c < #include "config.h" #ifdef HAVE_SUPERLONG_T char SIZEOF_SUPERLONG_T[sizeof (superlong_t)]; @@ -1094,6 +1095,7 @@ char SIZEOF_PTR[sizeof (char *)]; char SIZEOF_LONG[sizeof (long)]; char SIZEOF_INT[sizeof (int)]; char SIZEOF_SHORT[sizeof (short)]; +char SIZEOF_WCHAR_T[sizeof (wchar_t)]; char DUMMY; ! if ! conftest_syms ; then @@ -1176,30 +1178,16 @@ fi printf "Conservatively guessing the alignment of wide literals ... " if [ -z "$lit_align" ] ; then - cat > conftest.c < -char SIZEOF_WCHAR_T[sizeof (wchar_t)]; -char DUMMY; -! - if ! conftest_syms ; then - printf "failed\n\n" - - printf "Errors from compilation: \n\n" - cat conftest.err - exit 1 - fi - - SIZEOF_WCHAR_T=0 - deferred_offset= - - read_syms - if [ $SIZEOF_WCHAR_T -eq 0 ] ; then printf "failed\n" exit 1 fi - lit_align=$SIZEOF_WCHAR_T + if [ -n "$need_darwin_c_source" ] ; then + lit_align=2 + else + lit_align=$SIZEOF_WCHAR_T + fi fi printf "%d\n" "$lit_align" -- cgit v1.2.3