public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Re: Tutorial Time
@ 2002-06-13 16:13 Mark Butcher
  0 siblings, 0 replies; 5+ messages in thread
From: Mark Butcher @ 2002-06-13 16:13 UTC (permalink / raw)
  To: Richard Henderson; +Cc: gcc, gcc-help

Hi Richard

mcore-pe.h:#define CC1_SPEC "-funsigned-bitfields %{!DIN_GCC:-fno-rtti}
%{!DIN_GCC:-fno-exceptions}" is indeed in gcc 3.1 but (sorry forgot to
specify) I had the problem with gcc 3.0.4, where its isn't.

gcc 3.1 was released a few weeks back but I have been working on the
problem from before then !! Have just loaded gcc 3.1 and will continue the
experiments with that...

Cheers

Mark

^ permalink raw reply	[flat|nested] 5+ messages in thread
* Tutorial Time
@ 2002-06-12 15:48 Mark Butcher
  2002-06-13  9:04 ` Richard Henderson
  2002-06-13  9:12 ` Gokhan Kisacikoglu
  0 siblings, 2 replies; 5+ messages in thread
From: Mark Butcher @ 2002-06-12 15:48 UTC (permalink / raw)
  To: gcc-help; +Cc: gcc

Hi All

This is both a request for help and a discussion of internal workings.

The background is that I am (still) having problems building a cross
compiler for the Mcore target and have decided to learn as much as possible
about the procedure and environment so that I can solve them myself (still
beginner status with regards to just about everything).

I have configured to build c and c++ and the build is failing while
configuring internally to build the c++ library "libstdc++".



Here is the script which is failing while trying to identify the exception
model:



/************************************ beginning of script part causing
error ************************************************/
  echo $ac_n "checking for exception model to use""... $ac_c" 1>&6
echo "configure:3700: checking for exception model to use" >&5
  
  ac_ext=C
# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS
conftest.$ac_ext $LIBS 1>&5'
cross_compiling=$ac_cv_prog_cxx_cross

  # Check whether --enable-sjlj-exceptions or --disable-sjlj-exceptions was
given.
if test "${enable_sjlj_exceptions+set}" = set; then
  enableval="$enable_sjlj_exceptions"
  :
else
                       cat > conftest.$ac_ext << EOF
#line 3715 "configure"
struct S { ~S(); };
void bar();
void foo()
{
  S s;
  bar();
}
EOF
   old_CXXFLAGS="$CXXFLAGS"  
   CXXFLAGS=-S
   if { (eval echo configure:3726: \"$ac_compile\") 1>&5; (eval
$ac_compile) 2>&5; }; then
     if grep _Unwind_SjLj_Resume conftest.s >/dev/null 2>&1 ; then
       enable_sjlj_exceptions=yes
     elif grep _Unwind_Resume conftest.s >/dev/null 2>&1 ; then
       enable_sjlj_exceptions=no
     fi
   fi
   CXXFLAGS="$old_CXXFLAGS"
   rm -f conftest*
fi

   if test x$enable_sjlj_exceptions = xyes; then
     cat >> confdefs.h <<\EOF
#define _GLIBCPP_SJLJ_EXCEPTIONS 1
EOF

     ac_exception_model_name=sjlj
   elif test x$enable_sjlj_exceptions = xno; then
     ac_exception_model_name="call frame"
   else
     { echo "configure: error: unable to detect exception model" 1>&2; exit
1; }
   fi

/************************************ end of script part causing error
************************************************/


After analysing this I have identified that a test file called conftest.c
is temporarily created with the following contents

#line 3715 "configure"
struct S { ~S(); };
void bar();
void foo()
{
  S s;
  bar();
}

This is then compiled to test what the compiler generates - the exact
command being:

/usr/local/src/gnu/BUILD/gcc/gcc/xgcc -B/usr/local/src/gnu/BUILD/gcc/gcc/
-nostdinc++  -L/usr/local/src/gnu/BUILD/gcc/mcore-elf/libstdc++-v3/src
-L/usr/local/src/gnu/BUILD/gcc/mcore-elf/libstdc++-v3/src/.libs
-B/usr/local/mcore/mcore-elf/bin/ -B/usr/local/mcore/mcore-elf/lib/
-isystem /usr/local/mcore/mcore-elf/include -c -S  conftest.C

Now, if I actually compile this file with the said command I see that the
generated assembler file is correct for the desired target (Mcore) - the
content is:

        .file   "conftest.c"
        .text
        .align  1
        .export _Z3foov
        .type   _Z3foov,@function
_Z3foov:
        subi    sp,16
        stw     r15,(sp,8)
        stw     r8,(sp,12)
        mov     r8,sp
        jbsr    _Z3barv
        mov     r2,r8
        jbsr    _ZN1SD1Ev
        mov     sp,r8
        ldw     r15,(sp,8)
        ldw     r8,(sp,12)
        addi    sp,16
        jmp     r15
.Lfe1:
        .size   _Z3foov,.Lfe1-_Z3foov
        .ident  "GCC: (GNU) 3.0.4"


If I am correctly interpreting the script, grep is used to search for
information about two possible exception models, either the string
_Unwind_SjLj_Resume or 
_Unwind_Resume
should be somewhere in the S-file.

Since none of these are in the file, the configuration can not identify the
model and aborts.


Now to the questions:

1. Are these strings (which are searched for) added by some compilers and
not by the mcore cross compiler ?
2. Could this error be avoided by configuring with
"--disable-sjlj-exceptions"
3. What does sjij mean ?
4. Can anyone explain what this 'exception' model is, or where to get the
necessary details about it ?
5. I have scanned various documents and have not yet found a mention of the
Motorola Mcore being supported by GCC (I didn't find anything in the latest
version of the gcc compiler manual). Have I missed something or is this
really the case ?
6. Does anyone know details about the target configuration (for example use
of --disable-sjlj-exceptions, if necessary) ? I checked out lists of test
reports and found no mention of the Mcore there.
7. Am I mad ? (if not, certainly on the way...)

Thanks for any remarks

Cheers

Mark in Switzerland


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2002-06-13 23:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-06-13 16:13 Tutorial Time Mark Butcher
  -- strict thread matches above, loose matches on Subject: below --
2002-06-12 15:48 Mark Butcher
2002-06-13  9:04 ` Richard Henderson
2002-06-13 10:53   ` mike stump
2002-06-13  9:12 ` Gokhan Kisacikoglu

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