Created attachment 46523 [details] test case Compiling the attached file fails: /usr/bin/ld: /tmp/ccuSWyMB.o: in function `main': inner-section.c:(.text+0x5): undefined reference to `inner.1911' collect2: error: ld returned 1 exit status I've looked into the problem a little, and it seems that the C frontend sets DECL_CONTEXT only after the section attribute is handled, so this code if (DECL_CONTEXT (decl) && TREE_CODE (DECL_CONTEXT (decl)) == FUNCTION_DECL) { node->origin = cgraph_node::get_create (DECL_CONTEXT (decl)); node->next_nested = node->origin->nested; node->origin->nested = node; } in cgraph.c is run early, when DECL_CONTEXT isn't yet set, so the function is never added to the nested list. I might be wrong, though. The attached patch seems to fix this specific example on this specific machine, but I'm almost certain it'll turn out to be wrong somehow.
Created attachment 46524 [details] illustrative patch
Confirmed.