public inbox for libc-hacker@sourceware.org
 help / color / mirror / Atom feed
* dwarf2 unwind info check broken
@ 2002-03-17  2:14 Andreas Jaeger
  2002-03-17  2:19 ` Andreas Jaeger
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Jaeger @ 2002-03-17  2:14 UTC (permalink / raw)
  To: GNU libc hacker


With current binutils and both gcc 2.95.3 and GCC 3.2 CVS on
i686-linux-gnu I now get:

checking for DWARF2 unwind info support... (cached) no

The test program from configure:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
static char __EH_FRAME_BEGIN__[];
_start ()
{
#ifdef CHECK__register_frame
  __register_frame (__EH_FRAME_BEGIN__);
  __deregister_frame (__EH_FRAME_BEGIN__);
#endif
#ifdef CHECK__register_frame_info
  __register_frame_info (__EH_FRAME_BEGIN__);
  __deregister_frame_info (__EH_FRAME_BEGIN__);
#endif
}
int __eh_pc;
__throw () {}
/* FIXME: this is fragile.  */
malloc () {}
strcmp () {}
strlen () {}
memcpy () {}
memset () {}
free () {}
abort () {}
__bzero () {}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

gives with gcc 2.95.3:
gromit:~/tmp:[1]$ gcc -O2 -DCHECK__register_frame_info -nostdlib -nostartfiles -o conftest dwarf-test.c -lgcc
dwarf-test.c: In function `abort':
dwarf-test.c:22: warning: `noreturn' function does return
/tmp/ccXEbOxh.o: In function `_start':
/tmp/ccXEbOxh.o(.text+0xa): undefined reference to `__EH_FRAME_BEGIN__'
/tmp/ccXEbOxh.o(.text+0x17): undefined reference to `__EH_FRAME_BEGIN__'
collect2: ld returned 1 exit status
gromit:~/tmp:[1]$ gcc -O2 -DCHECK__register_frame -nostdlib -nostartfiles -o conftest dwarf-test.c -lgcc
dwarf-test.c: In function `abort':
dwarf-test.c:22: warning: `noreturn' function does return
/tmp/ccyGGtkH.o: In function `_start':
/tmp/ccyGGtkH.o(.text+0xa): undefined reference to `__EH_FRAME_BEGIN__'
/tmp/ccyGGtkH.o(.text+0x17): undefined reference to `__EH_FRAME_BEGIN__'
collect2: ld returned 1 exit status

And with gcc 3.2 CVS:
gromit:~/tmp:[1]$ /opt/gcc/3.2-devel/bin/gcc -O2 -DCHECK__register_frame_info -nostdlib -nostartfiles -o conftest dwarf-test.c -lgcc
dwarf-test.c: In function `abort':
dwarf-test.c:22: warning: `noreturn' function does return
/tmp/ccaTwPiF.o: In function `_start':
/tmp/ccaTwPiF.o(.text+0x9): undefined reference to `__EH_FRAME_BEGIN__'
/tmp/ccaTwPiF.o(.text+0xe): undefined reference to `__register_frame_info'
/tmp/ccaTwPiF.o(.text+0x15): undefined reference to `__EH_FRAME_BEGIN__'
/tmp/ccaTwPiF.o(.text+0x1a): undefined reference to `__deregister_frame_info'
collect2: ld returned 1 exit status
gromit:~/tmp:[1]$ /opt/gcc/3.2-devel/bin/gcc -O2 -DCHECK__register_frame -nostdlib -nostartfiles -o conftest dwarf-test.c -lgcc
dwarf-test.c: In function `abort':
dwarf-test.c:22: warning: `noreturn' function does return
/tmp/ccWPMC6G.o: In function `_start':
/tmp/ccWPMC6G.o(.text+0x9): undefined reference to `__EH_FRAME_BEGIN__'
/tmp/ccWPMC6G.o(.text+0xe): undefined reference to `__register_frame'
/tmp/ccWPMC6G.o(.text+0x15): undefined reference to `__EH_FRAME_BEGIN__'
/tmp/ccWPMC6G.o(.text+0x1a): undefined reference to `__deregister_frame'
collect2: ld returned 1 exit status

Any ideas?

This leads to the following bug when linking sln:

/opt/gcc/3.2-devel/bin/gcc -nostdlib -nostartfiles -static -o /builds/glibc/gcc-3.2/elf/sln   /builds/glibc/gcc-3.2/csu/crt1.o /builds/glibc/gcc-3.2/csu/crti.o `/opt/gcc/3.2-devel/bin/gcc --print-file-name=crtbegin.o` /builds/glibc/gcc-3.2/elf/sln.o  /builds/glibc/gcc-3.2/libc.a -lgcc /builds/glibc/gcc-3.2/libc.a `/opt/gcc/3.2-devel/bin/gcc --print-file-name=crtend.o` /builds/glibc/gcc-3.2/csu/crtn.o
/opt/gcc/3.2-devel/lib/gcc-lib/i686-pc-linux-gnu/3.2/crtbegin.o: In function `__do_global_dtors_aux':
/opt/gcc/3.2-devel/lib/gcc-lib/i686-pc-linux-gnu/3.2/crtbegin.o(.text+0x36): undefined reference to `__deregister_frame_info_bases'
/opt/gcc/3.2-devel/lib/gcc-lib/i686-pc-linux-gnu/3.2/crtbegin.o(.text+0x46): undefined reference to `__deregister_frame_info_bases'
/opt/gcc/3.2-devel/lib/gcc-lib/i686-pc-linux-gnu/3.2/crtbegin.o: In function `frame_dummy':
/opt/gcc/3.2-devel/lib/gcc-lib/i686-pc-linux-gnu/3.2/crtbegin.o(.text+0x62): undefined reference to `__register_frame_info_bases'
/opt/gcc/3.2-devel/lib/gcc-lib/i686-pc-linux-gnu/3.2/crtbegin.o(.text+0x97): undefined reference to `__register_frame_info_bases'
collect2: ld returned 1 exit status
make[2]: *** [/builds/glibc/gcc-3.2/elf/sln] Error 1

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

* Re: dwarf2 unwind info check broken
  2002-03-17  2:14 dwarf2 unwind info check broken Andreas Jaeger
@ 2002-03-17  2:19 ` Andreas Jaeger
  2002-03-17  4:25   ` Andreas Jaeger
  2002-03-17  7:02   ` Andreas Schwab
  0 siblings, 2 replies; 15+ messages in thread
From: Andreas Jaeger @ 2002-03-17  2:19 UTC (permalink / raw)
  To: GNU libc hacker

Andreas Jaeger <aj@suse.de> writes:

> With current binutils and both gcc 2.95.3 and GCC 3.2 CVS on
> i686-linux-gnu I now get:
>
> checking for DWARF2 unwind info support... (cached) no
>
> The test program from configure:
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> static char __EH_FRAME_BEGIN__[];

I figured out the problem: the []; gets removed by autoconf - but my
autoconf version didn't remove it. :-(

We should remove the [] from configure.in since it's broken there.

Ok to commit the appended patch?

Andreas

2002-03-17  Andreas Jaeger  <aj@suse.de>

	* configure.in: Fix dwarf2 unwind test.

============================================================
Index: configure.in
--- configure.in	2002/03/16 02:54:00	1.340
+++ configure.in	2002/03/17 10:19:06
@@ -1389,7 +1389,7 @@ fi
 AC_CACHE_CHECK(for DWARF2 unwind info support, libc_cv_gcc_dwarf2_unwind_info,
 [cat > conftest.c <<EOF
 #line __oline__ "configure"
-static char __EH_FRAME_BEGIN__[];
+static char __EH_FRAME_BEGIN__;
 _start ()
 {
 #ifdef CHECK__register_frame

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

* Re: dwarf2 unwind info check broken
  2002-03-17  2:19 ` Andreas Jaeger
@ 2002-03-17  4:25   ` Andreas Jaeger
  2002-03-17  4:54     ` Andreas Jaeger
  2002-03-17 12:14     ` Jakub Jelinek
  2002-03-17  7:02   ` Andreas Schwab
  1 sibling, 2 replies; 15+ messages in thread
From: Andreas Jaeger @ 2002-03-17  4:25 UTC (permalink / raw)
  To: GNU libc hacker

Andreas Jaeger <aj@suse.de> writes:

> Andreas Jaeger <aj@suse.de> writes:
>
>> With current binutils and both gcc 2.95.3 and GCC 3.2 CVS on
>> i686-linux-gnu I now get:
>>
>> checking for DWARF2 unwind info support... (cached) no
>>
>> The test program from configure:
>> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> static char __EH_FRAME_BEGIN__[];
>
> I figured out the problem: the []; gets removed by autoconf - but my
> autoconf version didn't remove it. :-(

But that's not the whole story, something is still broken for me:

arthur:~/tmp:[1]$ /opt/gcc/3.2-devel/bin/gcc -DCHECK__register_frame_info -nostdlib -nostartfiles dwarf-test.c -o conftest -lgcc
dwarf-test.c: In function `abort':
dwarf-test.c:22: warning: `noreturn' function does return
/tmp/ccomS4ZM.o: In function `_start':
/tmp/ccomS4ZM.o(.text+0x11): undefined reference to `__register_frame_info'
/tmp/ccomS4ZM.o(.text+0x20): undefined reference to `__deregister_frame_info'
collect2: ld returned 1 exit status
arthur:~/tmp:[1]$ /opt/gcc/3.2-devel/bin/gcc -DCHECK__register_frame -nostdlib -nostartfiles dwarf-test.c -o conftest -lgcc
dwarf-test.c: In function `abort':
dwarf-test.c:22: warning: `noreturn' function does return
/tmp/ccQkgVW6.o: In function `_start':
/tmp/ccQkgVW6.o(.text+0x11): undefined reference to `__register_frame'
/tmp/ccQkgVW6.o(.text+0x20): undefined reference to `__deregister_frame'
collect2: ld returned 1 exit status

But adding -lgcc_s fixes the problem:

arthur:~/tmp:[1]$ /opt/gcc/3.2-devel/bin/gcc -DCHECK__register_frame -nostdlib -nostartfiles dwarf-test.c -o conftest -lgcc -lgcc_s
dwarf-test.c: In function `abort':
dwarf-test.c:22: warning: `noreturn' function does return
arthur:~/tmp:[0]$ /opt/gcc/3.2-devel/bin/gcc -DCHECK__register_frame_info -nostdlib -nostartfiles dwarf-test.c -o conftest -lgcc -lgcc_s
dwarf-test.c: In function `abort':
dwarf-test.c:22: warning: `noreturn' function does return

So, how can we fix that configure test - and do we need to add -lgcc_s
for sln?

Sorry, I'm a bit confused about this stuff...

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

* Re: dwarf2 unwind info check broken
  2002-03-17  4:25   ` Andreas Jaeger
@ 2002-03-17  4:54     ` Andreas Jaeger
  2002-03-17 12:14     ` Jakub Jelinek
  1 sibling, 0 replies; 15+ messages in thread
From: Andreas Jaeger @ 2002-03-17  4:54 UTC (permalink / raw)
  To: GNU libc hacker

Andreas Jaeger <aj@suse.de> writes:

[...]

> So, how can we fix that configure test - and do we need to add -lgcc_s
> for sln?

Not -lgcc_s, it's -lgcc_eh.

I still don't understand why it fails on my newer system but works
fine on an older system...

This seems to be related to this patch:

2001-12-15  Jakub Jelinek  <jakub@redhat.com>
        [...]
        * gcc.c (init_gcc_specs): For -static-libgcc, use -lgcc -lgcc_eh.
        If neither -static-libgcc nor -shared-libgcc is passed and -shared,
        use -lgcc if LINK_EH_SPEC is defined and -lgcc_s -lgcc if not.
        If none of the above switches are passed, use -lgcc -lgcc_eh.
        (init_spec): If LINK_EH_SPEC is defined, prepend it to link_spec.

Jakub, can you have a look at glibc?  Any ideas what's broken - or
what I'm doing wrong on my system?

Thanks,
Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

* Re: dwarf2 unwind info check broken
  2002-03-17  2:19 ` Andreas Jaeger
  2002-03-17  4:25   ` Andreas Jaeger
@ 2002-03-17  7:02   ` Andreas Schwab
  1 sibling, 0 replies; 15+ messages in thread
From: Andreas Schwab @ 2002-03-17  7:02 UTC (permalink / raw)
  To: GNU libc hacker

Andreas Jaeger <aj@suse.de> writes:

|> Andreas Jaeger <aj@suse.de> writes:
|> 
|> > With current binutils and both gcc 2.95.3 and GCC 3.2 CVS on
|> > i686-linux-gnu I now get:
|> >
|> > checking for DWARF2 unwind info support... (cached) no
|> >
|> > The test program from configure:
|> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|> > static char __EH_FRAME_BEGIN__[];
|> 
|> I figured out the problem: the []; gets removed by autoconf - but my
|> autoconf version didn't remove it. :-(
|> 
|> We should remove the [] from configure.in since it's broken there.

Change the quote characters.  This should work with every version of
autoconf:

changequote(,)dnl
static char __EH_FRAME_BEGIN__[];
changequote([,])dnl

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE GmbH, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

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

* Re: dwarf2 unwind info check broken
  2002-03-17  4:25   ` Andreas Jaeger
  2002-03-17  4:54     ` Andreas Jaeger
@ 2002-03-17 12:14     ` Jakub Jelinek
  2002-03-19  8:32       ` Andreas Jaeger
                         ` (2 more replies)
  1 sibling, 3 replies; 15+ messages in thread
From: Jakub Jelinek @ 2002-03-17 12:14 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: GNU libc hacker

On Sun, Mar 17, 2002 at 01:25:16PM +0100, Andreas Jaeger wrote:
> Andreas Jaeger <aj@suse.de> writes:
> 
> > Andreas Jaeger <aj@suse.de> writes:
> >
> >> With current binutils and both gcc 2.95.3 and GCC 3.2 CVS on
> >> i686-linux-gnu I now get:
> >>
> >> checking for DWARF2 unwind info support... (cached) no
> >>
> >> The test program from configure:
> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> >> static char __EH_FRAME_BEGIN__[];
> >
> > I figured out the problem: the []; gets removed by autoconf - but my
> > autoconf version didn't remove it. :-(
> 
> But that's not the whole story, something is still broken for me:

There are 2 different cases if the register_frame_info &
register_frame check both fail.
Either you have gcc 3.1+ configured with old binutils, or new binutils.
In the former case, we should define HAVE_DWARF2_UNWIND_INFO and
HAVE_DWARF2_UNWIND_INFO_STATIC, in the latter case nothing (as in that
case no registry should happen).

So the unwind info check should be extended to something like
(untested):

 if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame_info
                             -nostdlib -nostartfiles
                             -o conftest conftest.c -lgcc >&AC_FD_CC]); then
   libc_cv_gcc_dwarf2_unwind_info=static
 else
   libc_cv_gcc_dwarf2_unwind_info=no
 fi
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame_info
+                            -nostdlib -nostartfiles
+                            -o conftest conftest.c -lgcc -lgcc_eh >&AC_FD_CC]); then
+  if ${CC-cc} $CFLAGS -DCHECK__register_frame_info -nostdlib -nostartfiles \
+     -o conftest conftest.c -lgcc -lgcc_eh 2>&1 >/dev/null \
+     | grep -q -- --eh-frame-hdr; then
+    libc_cv_gcc_dwarf2_unwind_info=no_registry_needed
+  else
+    libc_cv_gcc_dwarf2_unwind_info=static
+  fi
+else
+  libc_cv_gcc_dwarf2_unwind_info=no
+fi
 if test $libc_cv_gcc_dwarf2_unwind_info = no; then
   if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame
                               -nostdlib -nostartfiles
                               -o conftest conftest.c -lgcc >&AC_FD_CC]);
 then
     libc_cv_gcc_dwarf2_unwind_info=yes
   else
     libc_cv_gcc_dwarf2_unwind_info=no
   fi
 fi

> So, how can we fix that configure test - and do we need to add -lgcc_s
> for sln?

Um, why? Especially since adding -lgcc_s to -static will lead to failed link
(there is no static -lgcc_s).
gcc takes care of adding -lgcc_eh when it is necessary for -static link.

	Jakub

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

* Re: dwarf2 unwind info check broken
  2002-03-17 12:14     ` Jakub Jelinek
@ 2002-03-19  8:32       ` Andreas Jaeger
  2002-03-19 12:19       ` Andreas Jaeger
  2002-03-24  8:32       ` Andreas Jaeger
  2 siblings, 0 replies; 15+ messages in thread
From: Andreas Jaeger @ 2002-03-19  8:32 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GNU libc hacker

Jakub Jelinek <jakub@redhat.com> writes:

> On Sun, Mar 17, 2002 at 01:25:16PM +0100, Andreas Jaeger wrote:
>> Andreas Jaeger <aj@suse.de> writes:
>> 
>> > Andreas Jaeger <aj@suse.de> writes:
>> >
>> >> With current binutils and both gcc 2.95.3 and GCC 3.2 CVS on
>> >> i686-linux-gnu I now get:
>> >>
>> >> checking for DWARF2 unwind info support... (cached) no
>> >>
>> >> The test program from configure:
>> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> >> static char __EH_FRAME_BEGIN__[];
>> >
>> > I figured out the problem: the []; gets removed by autoconf - but my
>> > autoconf version didn't remove it. :-(
>> 
>> But that's not the whole story, something is still broken for me:
>
> There are 2 different cases if the register_frame_info &
> register_frame check both fail.
> Either you have gcc 3.1+ configured with old binutils, or new binutils.
> In the former case, we should define HAVE_DWARF2_UNWIND_INFO and
> HAVE_DWARF2_UNWIND_INFO_STATIC, in the latter case nothing (as in that
> case no registry should happen).
>
> So the unwind info check should be extended to something like
> (untested):
>
>  if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame_info
>                              -nostdlib -nostartfiles
>                              -o conftest conftest.c -lgcc >&AC_FD_CC]); then
>    libc_cv_gcc_dwarf2_unwind_info=static
>  else
>    libc_cv_gcc_dwarf2_unwind_info=no
>  fi
> +if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame_info
> +                            -nostdlib -nostartfiles
> +                            -o conftest conftest.c -lgcc -lgcc_eh >&AC_FD_CC]); then
> +  if ${CC-cc} $CFLAGS -DCHECK__register_frame_info -nostdlib -nostartfiles \
> +     -o conftest conftest.c -lgcc -lgcc_eh 2>&1 >/dev/null \
> +     | grep -q -- --eh-frame-hdr; then
> +    libc_cv_gcc_dwarf2_unwind_info=no_registry_needed
> +  else
> +    libc_cv_gcc_dwarf2_unwind_info=static
> +  fi
> +else
> +  libc_cv_gcc_dwarf2_unwind_info=no
> +fi
>  if test $libc_cv_gcc_dwarf2_unwind_info = no; then
>    if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame
>                                -nostdlib -nostartfiles
>                                -o conftest conftest.c -lgcc >&AC_FD_CC]);
>  then
>      libc_cv_gcc_dwarf2_unwind_info=yes
>    else
>      libc_cv_gcc_dwarf2_unwind_info=no
>    fi
>  fi
>
>> So, how can we fix that configure test - and do we need to add -lgcc_s
>> for sln?
>
> Um, why? Especially since adding -lgcc_s to -static will lead to failed link
> (there is no static -lgcc_s).
> gcc takes care of adding -lgcc_eh when it is necessary for -static link.

Strange, it now works for me - but I installed different binutils.
I'll try to investigate something more what's the problem is,

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

* Re: dwarf2 unwind info check broken
  2002-03-17 12:14     ` Jakub Jelinek
  2002-03-19  8:32       ` Andreas Jaeger
@ 2002-03-19 12:19       ` Andreas Jaeger
       [not found]         ` <20020319160357.J1213@devserv.devel.redhat.com>
  2002-03-24  8:32       ` Andreas Jaeger
  2 siblings, 1 reply; 15+ messages in thread
From: Andreas Jaeger @ 2002-03-19 12:19 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GNU libc hacker

Jakub Jelinek <jakub@redhat.com> writes:

> On Sun, Mar 17, 2002 at 01:25:16PM +0100, Andreas Jaeger wrote:
>> Andreas Jaeger <aj@suse.de> writes:
>> 
>> > Andreas Jaeger <aj@suse.de> writes:
>> >
>> >> With current binutils and both gcc 2.95.3 and GCC 3.2 CVS on
>> >> i686-linux-gnu I now get:
>> >>
>> >> checking for DWARF2 unwind info support... (cached) no
>> >>
>> >> The test program from configure:
>> >> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> >> static char __EH_FRAME_BEGIN__[];
>> >
>> > I figured out the problem: the []; gets removed by autoconf - but my
>> > autoconf version didn't remove it. :-(
>> 
>> But that's not the whole story, something is still broken for me:
>
> There are 2 different cases if the register_frame_info &
> register_frame check both fail.
> Either you have gcc 3.1+ configured with old binutils, or new binutils.
> In the former case, we should define HAVE_DWARF2_UNWIND_INFO and
> HAVE_DWARF2_UNWIND_INFO_STATIC, in the latter case nothing (as in that
> case no registry should happen).
>
> So the unwind info check should be extended to something like
> (untested):
>
>  if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame_info
>                              -nostdlib -nostartfiles
>                              -o conftest conftest.c -lgcc >&AC_FD_CC]); then
>    libc_cv_gcc_dwarf2_unwind_info=static
>  else
>    libc_cv_gcc_dwarf2_unwind_info=no
>  fi
> +if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame_info
> +                            -nostdlib -nostartfiles
> +                            -o conftest conftest.c -lgcc -lgcc_eh >&AC_FD_CC]); then
> +  if ${CC-cc} $CFLAGS -DCHECK__register_frame_info -nostdlib -nostartfiles \
> +     -o conftest conftest.c -lgcc -lgcc_eh 2>&1 >/dev/null \
> +     | grep -q -- --eh-frame-hdr; then

This does not look right.  I suppose you want to grep through ld
--help?  In that case let's use ${LD-ld} or gcc -Wl,--help,

Andreas

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

* Re: dwarf2 unwind info check broken
       [not found]         ` <20020319160357.J1213@devserv.devel.redhat.com>
@ 2002-03-19 13:25           ` Andreas Jaeger
  0 siblings, 0 replies; 15+ messages in thread
From: Andreas Jaeger @ 2002-03-19 13:25 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GNU libc hacker

Jakub Jelinek <jakub@redhat.com> writes:

> On Tue, Mar 19, 2002 at 09:12:07PM +0100, Andreas Jaeger wrote:
>> > So the unwind info check should be extended to something like
>> > (untested):
>> >
>> >  if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame_info
>> >                              -nostdlib -nostartfiles
>> >                              -o conftest conftest.c -lgcc >&AC_FD_CC]); then
>> >    libc_cv_gcc_dwarf2_unwind_info=static
>> >  else
>> >    libc_cv_gcc_dwarf2_unwind_info=no
>> >  fi
>> > +if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame_info
>> > +                            -nostdlib -nostartfiles
>> > +                            -o conftest conftest.c -lgcc -lgcc_eh >&AC_FD_CC]); then
>> > +  if ${CC-cc} $CFLAGS -DCHECK__register_frame_info -nostdlib -nostartfiles \
>> > +     -o conftest conftest.c -lgcc -lgcc_eh 2>&1 >/dev/null \
>> > +     | grep -q -- --eh-frame-hdr; then
>> 
>> This does not look right.  I suppose you want to grep through ld
>> --help?  In that case let's use ${LD-ld} or gcc -Wl,--help,
>
> Um, why? I want to grep in the ld command line gcc driver creates.

But you do not display the ld command line at all.
> If ld --help shows --eh-frame-hdr, it doesn't mean gcc uses it and only if
> gcc uses it, we can skip the __register_* call.

That means, you want to add -v to that command line.

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

* Re: dwarf2 unwind info check broken
  2002-03-17 12:14     ` Jakub Jelinek
  2002-03-19  8:32       ` Andreas Jaeger
  2002-03-19 12:19       ` Andreas Jaeger
@ 2002-03-24  8:32       ` Andreas Jaeger
  2002-03-24  9:34         ` Andreas Jaeger
  2 siblings, 1 reply; 15+ messages in thread
From: Andreas Jaeger @ 2002-03-24  8:32 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GNU libc hacker

Jakub Jelinek <jakub@redhat.com> writes:

> So the unwind info check should be extended to something like
> (untested):

I've tested this now extensivly and I'm happy with the appended
version of this patch.

Ok to commit?

Andreas

2002-03-24  Jakub Jelinek  <jakub@redhat.com>,
	    Andreas Jaeger  <aj@suse.de>

	* configure.in: Fix DWARF2 unwind info check for newer GCC and
	binutils.

============================================================
Index: configure.in
--- configure.in	2002/03/16 02:54:00	1.340
+++ configure.in	2002/03/24 16:22:04
@@ -1389,7 +1389,7 @@ fi
 AC_CACHE_CHECK(for DWARF2 unwind info support, libc_cv_gcc_dwarf2_unwind_info,
 [cat > conftest.c <<EOF
 #line __oline__ "configure"
-static char __EH_FRAME_BEGIN__[];
+static char *__EH_FRAME_BEGIN__;
 _start ()
 {
 #ifdef CHECK__register_frame
@@ -1421,6 +1421,20 @@ if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCH
 else
   libc_cv_gcc_dwarf2_unwind_info=no
 fi
+if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame_info
+                            -nostdlib -nostartfiles
+                            -o conftest conftest.c -lgcc -lgcc_eh >&AC_FD_CC]); then
+  if ${CC-cc} $CFLAGS -DCHECK__register_frame_info -nostdlib -nostartfiles \
+     -o conftest conftest.c -lgcc -lgcc_eh -v 2>&1 >/dev/null \
+     | grep -q -- --eh-frame-hdr; then
+    libc_cv_gcc_dwarf2_unwind_info=no_registry_needed
+  else
+    libc_cv_gcc_dwarf2_unwind_info=static
+  fi
+else
+  libc_cv_gcc_dwarf2_unwind_info=no
+fi
+
 if test $libc_cv_gcc_dwarf2_unwind_info = no; then
   if AC_TRY_COMMAND([${CC-cc} $CFLAGS -DCHECK__register_frame
 			      -nostdlib -nostartfiles

-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

* Re: dwarf2 unwind info check broken
  2002-03-24  8:32       ` Andreas Jaeger
@ 2002-03-24  9:34         ` Andreas Jaeger
  2002-03-24 11:02           ` Jakub Jelinek
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Jaeger @ 2002-03-24  9:34 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GNU libc hacker

Andreas Jaeger <aj@suse.de> writes:

> Jakub Jelinek <jakub@redhat.com> writes:
>
>> So the unwind info check should be extended to something like
>> (untested):
>
> I've tested this now extensivly and I'm happy with the appended
> version of this patch.

I missed one point in my testing: Building of static programs in
glibc:

/opt/gcc/3.1-devel/bin/gcc -nostdlib -nostartfiles -static -o /builds/glibc/gcc-3.1/elf/sln   /builds/glibc/gcc-3.1/csu/crt1.o /builds/glibc/gcc-3.1/csu/crti.o `/opt/gcc/3.1-devel/bin/gcc --print-file-name=crtbegin.o` /builds/glibc/gcc-3.1/elf/sln.o  /builds/glibc/gcc-3.1/libc.a -lgcc /builds/glibc/gcc-3.1/libc.a `/opt/gcc/3.1-devel/bin/gcc --print-file-name=crtend.o` /builds/glibc/gcc-3.1/csu/crtn.o
/opt/gcc/3.1-devel/lib/gcc-lib/i686-pc-linux-gnu/3.1/crtbegin.o: In function `__do_global_dtors_aux':
/opt/gcc/3.1-devel/lib/gcc-lib/i686-pc-linux-gnu/3.1/crtbegin.o(.text+0x36): undefined reference to `__deregister_frame_info_bases'
...

We use -static but since we use -nostdlib, -lgcc_eh is not added
here:-(

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

* Re: dwarf2 unwind info check broken
  2002-03-24  9:34         ` Andreas Jaeger
@ 2002-03-24 11:02           ` Jakub Jelinek
  2002-03-24 11:48             ` Andreas Jaeger
  0 siblings, 1 reply; 15+ messages in thread
From: Jakub Jelinek @ 2002-03-24 11:02 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: GNU libc hacker

On Sun, Mar 24, 2002 at 06:32:27PM +0100, Andreas Jaeger wrote:
> Andreas Jaeger <aj@suse.de> writes:
> 
> > Jakub Jelinek <jakub@redhat.com> writes:
> >
> >> So the unwind info check should be extended to something like
> >> (untested):
> >
> > I've tested this now extensivly and I'm happy with the appended
> > version of this patch.
> 
> I missed one point in my testing: Building of static programs in
> glibc:
> 
> /opt/gcc/3.1-devel/bin/gcc -nostdlib -nostartfiles -static -o /builds/glibc/gcc-3.1/elf/sln   /builds/glibc/gcc-3.1/csu/crt1.o /builds/glibc/gcc-3.1/csu/crti.o `/opt/gcc/3.1-devel/bin/gcc --print-file-name=crtbegin.o` /builds/glibc/gcc-3.1/elf/sln.o  /builds/glibc/gcc-3.1/libc.a -lgcc /builds/glibc/gcc-3.1/libc.a `/opt/gcc/3.1-devel/bin/gcc --print-file-name=crtend.o` /builds/glibc/gcc-3.1/csu/crtn.o
> /opt/gcc/3.1-devel/lib/gcc-lib/i686-pc-linux-gnu/3.1/crtbegin.o: In function `__do_global_dtors_aux':
> /opt/gcc/3.1-devel/lib/gcc-lib/i686-pc-linux-gnu/3.1/crtbegin.o(.text+0x36): undefined reference to `__deregister_frame_info_bases'
> ...
> 
> We use -static but since we use -nostdlib, -lgcc_eh is not added
> here:-(

Configure should detect if -lgcc_eh exist and add it in in addition to
-lgcc (well, for gcc-3.1+ configured with binutils 2.12 it doesn't matter),
but for gcc-3.1+ configured with older binutils it matters.

	Jakub

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

* Re: dwarf2 unwind info check broken
  2002-03-24 11:02           ` Jakub Jelinek
@ 2002-03-24 11:48             ` Andreas Jaeger
  2002-03-24 12:38               ` Jakub Jelinek
  0 siblings, 1 reply; 15+ messages in thread
From: Andreas Jaeger @ 2002-03-24 11:48 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GNU libc hacker

Jakub Jelinek <jakub@redhat.com> writes:

> On Sun, Mar 24, 2002 at 06:32:27PM +0100, Andreas Jaeger wrote:
>> Andreas Jaeger <aj@suse.de> writes:
>> 
>> > Jakub Jelinek <jakub@redhat.com> writes:
>> >
>> >> So the unwind info check should be extended to something like
>> >> (untested):
>> >
>> > I've tested this now extensivly and I'm happy with the appended
>> > version of this patch.
>> 
>> I missed one point in my testing: Building of static programs in
>> glibc:
>> 
>> /opt/gcc/3.1-devel/bin/gcc -nostdlib -nostartfiles -static -o /builds/glibc/gcc-3.1/elf/sln   /builds/glibc/gcc-3.1/csu/crt1.o /builds/glibc/gcc-3.1/csu/crti.o `/opt/gcc/3.1-devel/bin/gcc --print-file-name=crtbegin.o` /builds/glibc/gcc-3.1/elf/sln.o  /builds/glibc/gcc-3.1/libc.a -lgcc /builds/glibc/gcc-3.1/libc.a `/opt/gcc/3.1-devel/bin/gcc --print-file-name=crtend.o` /builds/glibc/gcc-3.1/csu/crtn.o
>> /opt/gcc/3.1-devel/lib/gcc-lib/i686-pc-linux-gnu/3.1/crtbegin.o: In function `__do_global_dtors_aux':
>> /opt/gcc/3.1-devel/lib/gcc-lib/i686-pc-linux-gnu/3.1/crtbegin.o(.text+0x36): undefined reference to `__deregister_frame_info_bases'
>> ...
>> 
>> We use -static but since we use -nostdlib, -lgcc_eh is not added
>> here:-(
>
> Configure should detect if -lgcc_eh exist and add it in in addition to
> -lgcc (well, for gcc-3.1+ configured with binutils 2.12 it doesn't matter),
> but for gcc-3.1+ configured with older binutils it matters.

This is with gcc 3.1 and current binutils from CVS.  But -lgcc_eh is
not added and I don't think there's code to do so,

Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

* Re: dwarf2 unwind info check broken
  2002-03-24 11:48             ` Andreas Jaeger
@ 2002-03-24 12:38               ` Jakub Jelinek
  2002-03-25 22:30                 ` Andreas Jaeger
  0 siblings, 1 reply; 15+ messages in thread
From: Jakub Jelinek @ 2002-03-24 12:38 UTC (permalink / raw)
  To: Andreas Jaeger; +Cc: GNU libc hacker

On Sun, Mar 24, 2002 at 08:48:48PM +0100, Andreas Jaeger wrote:
> > Configure should detect if -lgcc_eh exist and add it in in addition to
> > -lgcc (well, for gcc-3.1+ configured with binutils 2.12 it doesn't matter),
> > but for gcc-3.1+ configured with older binutils it matters.
> 
> This is with gcc 3.1 and current binutils from CVS.  But -lgcc_eh is
> not added and I don't think there's code to do so,

But if gcc 3.1 is configured with binutils >= 2.12, then crtbegin*.o don't
ever call __register_* or __deregister_*, so you don't actually need
-lgcc_eh.

	Jakub

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

* Re: dwarf2 unwind info check broken
  2002-03-24 12:38               ` Jakub Jelinek
@ 2002-03-25 22:30                 ` Andreas Jaeger
  0 siblings, 0 replies; 15+ messages in thread
From: Andreas Jaeger @ 2002-03-25 22:30 UTC (permalink / raw)
  To: Jakub Jelinek; +Cc: GNU libc hacker

Jakub Jelinek <jakub@redhat.com> writes:

> On Sun, Mar 24, 2002 at 08:48:48PM +0100, Andreas Jaeger wrote:
>> > Configure should detect if -lgcc_eh exist and add it in in addition to
>> > -lgcc (well, for gcc-3.1+ configured with binutils 2.12 it doesn't matter),
>> > but for gcc-3.1+ configured with older binutils it matters.
>> 
>> This is with gcc 3.1 and current binutils from CVS.  But -lgcc_eh is
>> not added and I don't think there's code to do so,
>
> But if gcc 3.1 is configured with binutils >= 2.12, then crtbegin*.o don't
> ever call __register_* or __deregister_*, so you don't actually need
> -lgcc_eh.

With the patch applied, I get:
checking for DWARF2 unwind info support... static
checking for __builtin_expect... yes

I guess that I configured GCC 3.1 wrong. gcc/auto-host.h has:
/* Define if your linker supports --eh-frame-hdr option. */
/* #undef HAVE_LD_EH_FRAME_HDR */

But I think I got it - GCC used the wrong assembler,  I configured GCC
with --with-gnu-as and it used for detection /usr/bin/as - but for
building it used the newer binutils that were in /opt/binutils/bin.
Replacing my binutils in /usr/bin fixed the problems I had.

So, I'm happy for now - but I'll play a bit more around,
Andreas
-- 
 Andreas Jaeger
  SuSE Labs aj@suse.de
   private aj@arthur.inka.de
    http://www.suse.de/~aj

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

end of thread, other threads:[~2002-03-26  6:30 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-03-17  2:14 dwarf2 unwind info check broken Andreas Jaeger
2002-03-17  2:19 ` Andreas Jaeger
2002-03-17  4:25   ` Andreas Jaeger
2002-03-17  4:54     ` Andreas Jaeger
2002-03-17 12:14     ` Jakub Jelinek
2002-03-19  8:32       ` Andreas Jaeger
2002-03-19 12:19       ` Andreas Jaeger
     [not found]         ` <20020319160357.J1213@devserv.devel.redhat.com>
2002-03-19 13:25           ` Andreas Jaeger
2002-03-24  8:32       ` Andreas Jaeger
2002-03-24  9:34         ` Andreas Jaeger
2002-03-24 11:02           ` Jakub Jelinek
2002-03-24 11:48             ` Andreas Jaeger
2002-03-24 12:38               ` Jakub Jelinek
2002-03-25 22:30                 ` Andreas Jaeger
2002-03-17  7:02   ` Andreas Schwab

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