[LLVMdev] non-enable-llvm support in llvm-gcc-4.2 issue

Jay Freeman (saurik) saurik at saurik.com
Sun Mar 23 04:50:48 PDT 2008


There seems to be a bunch of code for making certain that gcc still works even if --enable-gcc isn't used, so I'm assuming that it's at least supposed to be a supported configuration, and hence this issue that I found should probably be looked at:

If you compile llvm-gcc-4.2 _without_ --enable-gcc, and then try to compile the following program, you get a rather nasty RTL error.

    void f() { try { throw; } catch (...) {} }

    test.cpp: In function .void f().:
    test.cpp:1: error: unrecognizable insn:
    (insn 39 5 40 2 (set (reg:SI 107)
            (UnKnown Unknown)) -1 (nil)
        (nil))
    test.cpp:1: internal compiler error: in extract_insn, at recog.c:2100


I managed to track this down to init_one_libfunc being broken. There's some logic to try to divert an llvm_init_one_libfunc to the old implementation (via some #defines) when --emnable-llvm isn't being used, but it doesn't even have the right return type anymore and only seems to do half the old logic (the rest being in llvm_init_one_libfunnc now).

I've managed to fix it pretty easily with the following hack, but it really does feel like a hack:

diff --git a/gcc/expr.h b/gcc/expr.h
index 850e7af..265b550 100644
--- a/gcc/expr.h
+++ b/gcc/expr.h
@@ -753,9 +753,6 @@ extern rtx init_one_libfunc (const char *);
 /* LLVM LOCAL begin */
 /* Call this to initialize an optab function tree.  */
 extern tree llvm_init_one_libfunc (const char *);
-#ifndef ENABLE_LLVM
-#define llvm_init_one_libfunc init_one_libfunc
-#endif
 /* LLVM LOCAL end */

 extern int vector_mode_valid_p (enum machine_mode);
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 06243c9..d5a1b19 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -5137,7 +5137,6 @@ init_intraclass_conv_libfuncs (convert_optab tab, const char *opname,


 /* LLVM local begin */
-#undef llvm_init_one_libfunc
 tree
 llvm_init_one_libfunc (const char *name)
 {

Sincerely,
Jay Freeman (saurik)
saurik at saurik.com
http://www.saurik.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20080323/450d9fb1/attachment.html>


More information about the llvm-dev mailing list