diff --git a/gold/aarch64.cc b/gold/aarch64.cc index c9bb6b730d..dd6a7ddab3 100644 --- a/gold/aarch64.cc +++ b/gold/aarch64.cc @@ -3746,8 +3746,13 @@ Target_aarch64::scan_reloc_for_stub( psymval = &symval; } else if (gsym->is_undefined()) - // There is no need to generate a stub symbol is undefined. - return; + { + // There is no need to generate a stub symbol is undefined. + gold_debug(DEBUG_TARGET, + "stub: not creating a stub for undefined symbol %s in file %s", + gsym->name(), aarch64_relobj->name().c_str()); + return; + } } // Get the symbol value. @@ -5403,6 +5408,14 @@ maybe_apply_stub(unsigned int r_type, if (stub_type == ST_NONE) return false; + // We don't create stubs for undefined symbols so don't look for one. + if (gsym && gsym->is_undefined()) { + gold_debug(DEBUG_TARGET, + "stub: looking for a stub for undefined symbol: %s", + gsym->name()); + return false; + } + const The_aarch64_relobj* aarch64_relobj = static_cast(object); The_stub_table* stub_table = aarch64_relobj->stub_table(relinfo->data_shndx);