https://gcc.gnu.org/bugzilla/show_bug.cgi?id=114641
--- Comment #5 from Oleg Endo <olegendo at gcc dot gnu.org> --- (In reply to Rich Felker from comment #4) > It's a C conformance bug that's been present ever since the version of the > FDPIC support I submitted for merge, so I think it's appropriate for > backport to any branch that's still open and fixing bugs of this type. The > code has not been modified since initial merge afaik, so the patch should > apply cleanly to any version. OK, got it. > I can't speak to whether this patch is the best way to fix it. The condition > I'm trying to convey is "non-hidden external symbol". > > Probably the comment should be updated too, since "weak ref" and "non-hidden > external symbol" are distinct conditions that both require going thru the > GOT for their own reasons. Weak-ref because it could evaluate to null (which > can't be represented as an offset from PC) and non-hidden-external because > we need the canonical address for function pointer equality to hold. It's probably better to make a dedicated function for that, like 'bool sh_non_hidden_external_symbol_p (rtx sym_ref)' Like that the intention is clearly conveyed in the place where it's being used and if it's later found that the check is not adequate, it can be easily fixed inside that function.