Hidden symbols in group sections shouldn't reduce under ld -r -Breduce
You should not refer to a section in a group from outside the group from a local symbol.
When using ld -r, the group survives to be processed when the output object is (presumably) involved in another link-edit.
When we use ld -r -Breduce (such as when producing objects for capabilities variants), we should thus refuse to reduce symbols in groups. Presuming they will be reduced at the same time the group is processed.
It is possible this only is true for groups which are comdat groups.
It is possible this logic is just wrong.
There is an implementation of this at https://github.com/illumos/illumos-gate/compare/master...richlowe:ld/group-symcaps?expand=1
but I don't plan to go further unless/until I can be sure it's actually the right thing to be doing.
#6094 is tenuously related here, the difference being that the reduction prevents a later match on symbol attributes. It is possible, but less possible, that we should protect symbols in COMDAT sections regardless of comdat mechanism in the same way as this.
It is also possible that we should not reduce hidden symbols at all when the output is a relocatable object, even under -Breduce.