In processRelocAux(), our handling of 1) link-time constant and 2) weak
undef is the same, so put them together to simplify the logic.
This moves the weak undef code around. The result is that:
For a writable section, we will not emit dynamic relocations for weak undefined
symbols.
Since this simplifies the logic, improves consistency with the readonly
case, and also seems to match what GNU linkers do, so this is probably
good to do.
The condition !Config->Shared was there probably because it is common
for a -shared link not to specify full dependencies. Keep it now but we
may revisit the decision in the future.
gABI says:
The behavior of weak symbols in areas not specified by this document is
implementation defined. Weak symbols are intended primarily for use in
system software. Applications using weak symbols are unreliable since
changes in the runtime environment might cause the execution to fail.
With this change, we can simplify another place
Symbol::includeInDynsym() (see D59549) a bit.
What is GNU linkers behavior in this case?