This responds to PR36475,
r325763 led to unexprected layout change, though
new behavior seems to be more correct.
Previously we could have following script:
.foo : { *(.foo) } .bar : { *(.synthetic_empty) BYTE(0x11) }}
where synthetic_empty is a synthetic section which is empty and
hence removed by linker.
Before r325763 .bar would receive section flags from .synthetic_empty,
but after this revision it receives flags the same as .foo section has.
It is the same as if there would not be any synthetic_empty section in a script,
so looks reasonable and consistent behavior:
.foo : { *(.foo) } .bar : { BYTE(0x11) }}
Patch adds testcase to document it.
For multi-line linker script, can you avoid using \ for line continuation? I found that that is hard to debug when something goes wrong, because this "echo" ends up with a very long single line with a lot of whitespace characters, and "^" marker doesn't make sense in such output because lines are wrapped around.
You could instead write
That said, since this example is short, the best way of doing it is to write it in one line.