https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113182
--- Comment #7 from dave.anglin at bell dot net --- On 2024-01-08 9:29 a.m., jakub at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113182 > > Jakub Jelinek <jakub at gcc dot gnu.org> changed: > > What |Removed |Added > ---------------------------------------------------------------------------- > CC| |jakub at gcc dot gnu.org > > --- Comment #6 from Jakub Jelinek <jakub at gcc dot gnu.org> --- > (In reply to John David Anglin from comment #5) >> The problem is TREE_SYMBOL_REFERENCED is not set for libfuncs. This fixes >> problem on hppa64-hpux: >> >> bash-5.1$ git diff gcc/varasm.cc >> diff --git a/gcc/varasm.cc b/gcc/varasm.cc >> index 69f8f8ee018..0a1cc022023 100644 >> --- a/gcc/varasm.cc >> +++ b/gcc/varasm.cc >> @@ -2527,9 +2527,7 @@ process_pending_assemble_externals (void) >> for (rtx list = pending_libcall_symbols; list; list = XEXP (list, 1)) >> { >> rtx symbol = XEXP (list, 0); >> - tree id = get_identifier (XSTR (symbol, 0)); >> - if (TREE_SYMBOL_REFERENCED (id)) >> - targetm.asm_out.external_libcall (symbol); >> + targetm.asm_out.external_libcall (symbol); >> } >> >> pending_assemble_externals = 0; >> >> If you don't care about libfuncs, you could move the TREE_SYMBOL_REFERENCED >> check into the bpf target. > Then the bug is that it isn't set when they are actually referenced. Exactly. This has been a problem for a long time. There is a work around in the define for ASM_OUTPUT_EXTERNAL_LIBCALL in pa/som.h. Issue is also mentioned in sol2.cc.