https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100152
--- Comment #34 from Richard Biener <rguenth at gcc dot gnu.org> --- (In reply to Richard Biener from comment #33) > (In reply to Iain Sandoe from comment #32) > > (In reply to Iain Sandoe from comment #31) > > > (In reply to Richard Biener from comment #30) > > > > (In reply to Iain Sandoe from comment #29) > > > > > what is also somewhat peculiar is that replacing the first function > > > > > in the > > > > > reduced test case with "extern void ___UTF_8_put(char *a, int b);" > > > > > changes > > > > > the code-gen for the second function. > > > > > > > > That might hint at IPA RA which you can try disabling via -fno-ipa-ra > > > > which > > > > in turn hints at a target issue. > > > > > > yeah, it does switch back to using rbx, at least on the reduced test case. > > > > (also on the original). > > > > I wonder if the problem is that IPA can't "see" the lazy symbol resolver, so > > it just sees a call to ___UTF_8_put and doesn't know that this will be > > resolved indirectly. > > > > .. but something similar must apply to PLT and targets with linker veneers ? > > I don't know how IPA RA works in detail but obviously the target has to > expose this detail. It looks like IPA RA causes us to add some notes to > call insns which are supposed to describe those details and there's > collect_fn_hard_reg_usage which looks at the target function (but likely > does not include the ABI details of the call itself, in this case the > resolver). @deftypevr {Target Hook} bool TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS Set to true if each call that binds to a local definition explicitly clobbers or sets all non-fixed registers modified by performing the call. That is, by the call pattern itself, or by code that might be inserted by the linker (e.g.@: stubs, veneers, branch islands), but not including those modifiable by the callee. The affected registers may be mentioned explicitly in the call pattern, or included as clobbers in CALL_INSN_FUNCTION_USAGE. The default version of this hook is set to false. The purpose of this hook is to enable the fipa-ra optimization. @end deftypevr might be relevant - though when compiling for a shared library the call to ___UTF_8_put does not bind locally (but then IPA RA shouldn't apply either I guess). So, does ___UTF_8_put bind locally?