]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
jit: fix startup on aarch64
authorDavid Malcolm <dmalcolm@redhat.com>
Wed, 22 Jan 2025 13:35:41 +0000 (08:35 -0500)
committerDavid Malcolm <dmalcolm@redhat.com>
Wed, 22 Jan 2025 13:35:41 +0000 (08:35 -0500)
libgccjit fails on startup on aarch64 (and probably other archs).

The issues are that

(a) within jit_langhook_init the call to
targetm.init_builtins can use types that aren't representable
via jit::recording::type, and

(b) targetm.init_builtins can call lang_hooks.decls.pushdecl, which
although a no-op for libgccjit has a gcc_unreachable.

Fixed thusly.

gcc/jit/ChangeLog:
* dummy-frontend.cc (tree_type_to_jit_type): For POINTER_TYPE,
bail out if the inner call to tree_type_to_jit_type fails.
Don't abort on unknown types.
(jit_langhook_pushdecl): Replace gcc_unreachable with return of
NULL_TREE.

Signed-off-by: David Malcolm <dmalcolm@redhat.com>
gcc/jit/dummy-frontend.cc

index 5748516963110b8800e105cc292d181409f32c5f..1d0080d6fecb411b5f525157f686cdb6de3e5d37 100644 (file)
@@ -1278,6 +1278,8 @@ recording::type* tree_type_to_jit_type (tree type)
   {
     tree inner_type = TREE_TYPE (type);
     recording::type* element_type = tree_type_to_jit_type (inner_type);
+    if (!element_type)
+      return nullptr;
     return element_type->get_pointer ();
   }
   else
@@ -1299,10 +1301,6 @@ recording::type* tree_type_to_jit_type (tree type)
        }
       }
     }
-
-    fprintf (stderr, "Unknown type:\n");
-    debug_tree (type);
-    abort ();
   }
 
   return NULL;
@@ -1372,7 +1370,7 @@ jit_langhook_global_bindings_p (void)
 static tree
 jit_langhook_pushdecl (tree decl ATTRIBUTE_UNUSED)
 {
-  gcc_unreachable ();
+  return NULL_TREE;
 }
 
 static tree