Currently for following script LLD produce broken output silently:
bar : ONLY_IF_RO { *(no_such_section) } bar : ONLY_IF_RW { *(foo_aw) } sym1 = SIZEOF(bar); sym2 = ADDR(bar);
Values of sym1 and sym2 are zeroes.
That happens because of NameToOutputSection member which currently is a
mapping from name to OutputSection. Though in case above there are two different
output section commands, so I believe it should be a mapping to vector.
Patch changes implementation of mapping what fixes the issue observed.
If I understand correctly this might create a forward reference to some OutputSection Name that we've not seen yet? I don't think that this is allowed in this case: https://sourceware.org/binutils/docs/ld/Builtin-Functions.html