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. The whole point of the patch was avoid referencing something that isn't really referenced. And it wasn't specific to one backend, many backends simply used to emit say externs for both signed and unsigned division when expansion saw range of operands would allow both signed and unsigned division and so expanded both to pick the cheaper one.