epilogue count exceeds number of nested prologues
Hi all,
While trying to compile mozilla with libffi, the configure phase dies with a message:
Error: Epilogue count of 4294967296 exceeds number of nested prologues
(0)
I see that this message comes from a patch submitted by David in February. Is libffi broken? What is needed to fix it?
The offending assembly code is attached. it's the ".restore sp" near the end that is triggering the error.
thanks
randolph
.file "conftest.i" .pred.safe_across_calls p1-p5,p16-p63 .text .align 16 .global main# .proc main# main: .prologue 2, 2 .vframe r2 mov r2 = r12 .body ;;
#APP
.data
.align 8
1: data8 @fptr(ffi_closure_UNIX)
data8 1b
data8 0
data8 bar
data8 @fptr(baz)
data8 quux
.text
.global foo
.proc foo
foo:
addl r16 = @ltoff(1b), gp;;
ld8 gp = [r16];;
ld8 r17 = [gp];;
ld8 r19 = [r17],8;
adds r18 = 16,gp;;
ld8 r20 = [r17];;
st8 [r18]=r20;
mov b6 = r19
br.cond.sptk.many b6
.endp#NO_APP
;; mov r8 = r0 .restore sp mov r12 = r2 br.ret.sptk.many b0 .endp main# .ident "GCC: (GNU) 3.0.4"
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Randolph Chung
Randolph> Hi all, While trying to compile mozilla with libffi, the Randolph> configure phase dies with a message:
Randolph> Error: Epilogue count of 4294967296 exceeds number of Randolph> nested prologues (0)
Randolph> I see that this message comes from a patch submitted by Randolph> David in February. Is libffi broken? What is needed to fix Randolph> it?
Randolph> The offending assembly code is attached. it's the Randolph> ".restore sp" near the end that is triggering the error.
This is a bug in the assembler that was fixed on Feb 22nd. I think it should be in binutils-2.12, though I didn't not verify.
--david
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Randolph Chung
Randolph> Hi all, While trying to compile mozilla with libffi, the Randolph> configure phase dies with a message:
Randolph> Error: Epilogue count of 4294967296 exceeds number of Randolph> nested prologues (0)
Randolph> I see that this message comes from a patch submitted by Randolph> David in February. Is libffi broken? What is needed to fix Randolph> it?
I now realize that you must have been using the latest binutils, as the old one silently generated bad unwind info.
As Richard pointed out in his mail, the offending code really is broken. I was planning to update the mozilla libffi anyhow, both to sync up with Hans's recent unwind fixes and to look into whether we could use the assembler directives added for C++ vtables to simplify the generation of static closures. Let me take a look at it.
--david
Hi Randolph,
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Randolph Chung
Randolph> Hi all,
Randolph> While trying to compile mozilla with libffi, the configure phase Randolph> dies with a message:
Randolph> Error: Epilogue count of 4294967296 exceeds number of nested prologues Randolph> (0)
Randolph> I see that this message comes from a patch submitted by David in Randolph> February. Is libffi broken? What is needed to fix it?
Randolph> The offending assembly code is attached. it's the ".restore sp" Randolph> near the end that is triggering the error.
I'm unable to reproduce this. If I'm understanding you right, the problem occurred during the configure phase of mozilla (not libffi). I just rebuilt Mozilla from the current CVS tree with gcc3.1 pre-release and the current CVS binutils. It built just fine and the resulting binary seems to work flawlessly.
From the assembly code you provided, it looks as if conftest.c tried to call FFI_STATIC_CLOSURE() from within a function, which can't possibly work.
Can you provide a more precise pointer where this conftest.c is being generated?
Thanks,
--david
Randolph> .file "conftest.i" Randolph> .pred.safe_across_calls p1-p5,p16-p63 Randolph> .text Randolph> .align 16 Randolph> .global main# Randolph> .proc main# Randolph> main: Randolph> .prologue 2, 2 Randolph> .vframe r2 Randolph> mov r2 = r12 Randolph> .body Randolph> ;; Randolph> #APP Randolph> .data Randolph> .align 8 Randolph> 1: data8 @fptr(ffi_closure_UNIX) Randolph> data8 1b Randolph> data8 0 Randolph> data8 bar Randolph> data8 @fptr(baz) Randolph> data8 quux Randolph> .text Randolph> .global foo Randolph> .proc foo Randolph> foo: Randolph> addl r16 = @ltoff(1b), gp;; Randolph> ld8 gp = [r16];; Randolph> ld8 r17 = [gp];; Randolph> ld8 r19 = [r17],8; Randolph> adds r18 = 16,gp;; Randolph> ld8 r20 = [r17];; Randolph> st8 [r18]=r20; Randolph> mov b6 = r19 Randolph> br.cond.sptk.many b6 Randolph> .endp
Randolph> #NO_APP
Randolph> ;;
Randolph> mov r8 = r0
Randolph> .restore sp
Randolph> mov r12 = r2
Randolph> br.ret.sptk.many b0
Randolph> .endp main#
Randolph> .ident "GCC: (GNU) 3.0.4"
Randolph> _______________________________________________ Randolph> Linux-IA64 mailing list
Randolph> [email protected]
Randolph> http://lists.linuxia64.org/lists/listinfo/linux-ia64
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · Randolph Chung
Randolph> indeed, mozilla's configure.in says:
Randolph> if test "$LIBFFI_FOUND" = "yes"; then Randolph> AC_MSG_CHECKING("for FFI_STATIC_CLOSURE in libffi") Randolph> AC_TRY_COMPILE([#include "ffi.h"], Randolph> [ FFI_STATIC_CLOSURE(foo, bar, baz, quux); ], Randolph> [ LIBFFI_HAS_STATIC_CLOSURE=yes ]) Randolph> AC_MSG_RESULT("$result")
Randolph> fi
Randolph> which generates (from config.log):
Randolph> configure:13494: checking for FFI_STATIC_CLOSURE in libffi
Randolph> configure:13503: gcc-3.0 -c -I/home/randolph/debian/mozilla-0.9.9/build-tree/libffi-install/include -fshort-wchar -pthread -pipe -I/usr/X11R6/include conftest.c 1>&5
Randolph> {standard input}: Assembler messages:
Randolph> {standard input}:40: Error: Epilogue count of 4294967296 exceeds number of nested prologues (0) Randolph> configure: failed program was:
Randolph> #line 13496 "configure"
Randolph> #include "confdefs.h"
Randolph> #include "ffi.h"
Randolph> int main() {
Randolph> FFI_STATIC_CLOSURE(foo, bar, baz, quux);
Randolph> ; return 0; }
For some reason, I don't see this in my configure.in. Was this added by the Debian patch? In principle, it's a good idea to check for this macro, but I the check needs to be different. To get it to compile, FFI_STATIC_CLOSURE() would have to be declared at the outermost level. Alternatively, perhaps you can just grep for this macro in ffi.h (I think autoconf has support for doing this).
--david
PS: I dropped binutils from the cc list, as it's clearly not a binutils
issue.
Quoted 2 lines
I'm unable to reproduce this. If I'm understanding you right, the problem occurred during the configure phase of mozilla (not libffi).
that's right
Quoted 3 lines
I just rebuilt Mozilla from the current CVS tree with gcc3.1 pre-release and the current CVS binutils. It built just fine and the resulting binary seems to work flawlessly.
I'm building from Debian sources. It's possible that it's simply out of date (I'm building version 0.9.9).
Quoted 3 lines
Quoted 1 line
From the assembly code you provided, it looks as if
conftest.ctriedto call
FFI_STATIC_CLOSURE()from within a function, which can't possibly work.
indeed, mozilla's configure.in says:
if test "$LIBFFI_FOUND" = "yes"; then
AC_MSG_CHECKING("for FFI_STATIC_CLOSURE in libffi") AC_TRY_COMPILE([#include "ffi.h"],
[ FFI_STATIC_CLOSURE(foo, bar, baz, quux); ], [ LIBFFI_HAS_STATIC_CLOSURE=yes ])
AC_MSG_RESULT("$result")
fi
which generates (from config.log):
configure:13494: checking for FFI_STATIC_CLOSURE in libffi
configure:13503: gcc-3.0 -c -I/home/randolph/debian/mozilla-0.9.9/build-tree/libffi-install/include -fshort-wchar -pthread -pipe -I/usr/X11R6/include conftest.c 1>&5
{standard input}: Assembler messages:
{standard input}:40: Error: Epilogue count of 4294967296 exceeds number of nested prologues (0)
configure: failed program was:
#line 13496 "configure"
#include "confdefs.h"
#include "ffi.h"
int main() {
FFI_STATIC_CLOSURE(foo, bar, baz, quux);
; return 0; }
randolph
Quoted 6 lines
For some reason, I don't see this in my configure.in. Was this added by the Debian patch? In principle, it's a good idea to check for this macro, but I the check needs to be different. To get it to compile,
FFI_STATIC_CLOSURE()would have to be declared at the outermost level. Alternatively, perhaps you can just grep for this macro inffi.h(I think autoconf has support for doing this).
<sigh> you are right, i will go poke the Debian maintainer about this now. Sorry for the diversion.
randolph
Quoted 28 lines · Randolph Chung
Quoted 2 lines
I'm unable to reproduce this. If I'm understanding you right, the problem occurred during the configure phase of mozilla (not libffi).
that's right
Quoted 3 lines
I just rebuilt Mozilla from the current CVS tree with gcc3.1 pre-release and the current CVS binutils. It built just fine and the resulting binary seems to work flawlessly.
I'm building from Debian sources. It's possible that it's simply out of date (I'm building version 0.9.9).
Quoted 3 lines
Quoted 1 line
From the assembly code you provided, it looks as if
conftest.ctriedto call
FFI_STATIC_CLOSURE()from within a function, which can't possibly work.indeed, mozilla's configure.in says:
if test "$LIBFFI_FOUND" = "yes"; then
AC_MSG_CHECKING("for FFI_STATIC_CLOSURE in libffi")AC_TRY_COMPILE([#include "ffi.h"],
[FFI_STATIC_CLOSURE(foo, bar, baz, quux); ], [ LIBFFI_HAS_STATIC_CLOSURE=yes ])
AC_MSG_RESULT("$result")
fiwhich generates (from config.log):
Quoted 11 lines
configure:13494: checking for
FFI_STATIC_CLOSUREin libffi
configure:13503: gcc-3.0 -c -I/home/randolph/debian/mozilla-0.9.9/build-tree/libffi-install/include -fshort-wchar -pthread -pipe -I/usr/X11R6/includeconftest.c1>&5
{standard input}: Assembler messages:
{standard input}:40: Error: Epilogue count of 4294967296 exceeds number of nested prologues (0)
configure: failed program was:
#line 13496 "configure"
#include "confdefs.h"
#include "ffi.h"
intmain(){
FFI_STATIC_CLOSURE(foo, bar, baz, quux);
; return 0; }
I claim responsibility for this code. For some reason, it worked in older revisions.
But yes, I can see how that's incorrect, and should be changed. I can whip up a patch if no one else is tomorrow.