------- Comment #32 from hp at gcc dot gnu dot org 2008-08-23 18:38 ------- Thanks, I got everything I need.
The problem seen for the Darwin bootstrap is caused not by the output_operand call to assemble_external, but by another call, in cp/decl2.c:mark_used. Plainly treating that (as now) the same as the assemble_external call from output_operand, causes lots of actually not used (perhaps inlined, but not referenced) functions to be marked as weak. You can see this diffing e.g. prims.s for unpatched 139232 and 139233 for x86_64-linux but you don't see it for unpatched darwin because of the assemble_external call being masked by the #ifdef. For GNU/Linux, having random .weak annotations for unreferenced and undefined symbols apparently has no visible effect. The reason that the Darwin assembler complains when it sees some of these, is that they're coupled with annotations specifically for weak *definitions* for one reason or another (without a matching symbol definition), while with more common targets the weak annotations for references and definitions look the same, the absence/presence of the actual definition defines what weakness type it is. I'm not sure why there are assemble_external calls all over and from language front-ends; there should be only one in output_operand (for code) and one where data is output. Come to think of it, they shouldn't be there either, but in expand, so we don't have to play target-specific tricks. Not sure whether that change would fit in this PR, or if I should go with just remove or gate the bogus and redundant assemble_external calls. Bah, I guess I should just have asked for revert of 139233; that and related earlier changes obviously weren't fit for trunk. Ok, one more try. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37170