From a6928c0809f6212c1810287781002b50935a184b Mon Sep 17 00:00:00 2001 From: Nick Gasson Date: Mon, 17 Jan 2022 18:23:08 +0800 Subject: [PATCH] Work around incorrect link package opcode --- src/lower.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lower.c b/src/lower.c index 5c101818..4e4b6501 100644 --- a/src/lower.c +++ b/src/lower.c @@ -1536,9 +1536,14 @@ static vcode_reg_t lower_context_for_call(ident_t unit_name) vcode_state_restore(&state); if (vcode_unit_kind() == VCODE_UNIT_THUNK) return emit_null(vtype_context(scope_name)); - else if (ident_until(scope_name, '-') != scope_name) { + else if (ident_until(scope_name, '-') != scope_name + || ident_until(unit_name, '-') != unit_name) { // Call to function defined in architecture - return emit_null(vtype_context(scope_name)); + tree_t pack = lib_get_qualified(scope_name); + if (pack != NULL && tree_kind(pack) == T_PACKAGE) + return emit_link_package(scope_name); + else + return emit_null(vtype_context(scope_name)); } else return emit_link_package(scope_name); -- 2.39.2