This no longer appears to be the case? `assemble_name' is still called with `fn', and correctly marks `fn' as being referenced, but no body is ever emitted.
-fno-unit-at-a-time might help. This disables some of the cgraph optimizations. This will probably go away eventually.
Do I now need to do something more than just calling assemble_name to get gcc to output the function body in such a case?
No. cgraph should determine by itself that the function is needed. The assemble_name call shouldn't be relevant here.
/* ??? If the assembler name is set by hand, it is possible to assemble the name later after finalizing the function and the fact is noticed in assemble_name then. This is arguably a bug. */
I think this is referring to use of __asm__ to change the name of a function in unexpected ways. It doesn't have anything to do with your problem.
What you should do here is pick a target that works, and debug cgraph to see how it works. Then debug your target to see why it doesn't.
The sequence of events should be something like: 1) We walk the tree for main, and note that main calls fn. 2) We emit main because it is extern. 3) We then emit everything that main calls, which includes fn.
I won't hazard a guess as to what is wrong, as I don't see how this could be failing.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com