For comdats (e.g. caused by -ffunction-sections), Section is already set here; make sure it's null, for the weak external symbol to be undefined.
This fixes PR46779.
This setup did reveal another issue wrt mingw style associative comdats in combination with weak symbols, when the actual leader symbol isn't named func but .weak.func.default in these cases. I'm looking at ways of fixing that as well (as a general headsup re potentially getting the fix for that into the release as well).