[ELF] - Add testcase documenting flags assigned when empty synthetic section is removed.
authorGeorge Rimar <grimar@accesssoftek.com>
Fri, 23 Feb 2018 09:57:17 +0000 (09:57 +0000)
committerGeorge Rimar <grimar@accesssoftek.com>
Fri, 23 Feb 2018 09:57:17 +0000 (09:57 +0000)
commit4e6f52c9a4f057256f081abe644be04ac782ebec
tree213fce8c2b674cd2b8b6ef48710bd91bfb719ccf
parent3cd76b1448cbab44080c205c5fdec3dad5f5d346
[ELF] - Add testcase documenting flags assigned when empty synthetic section is removed.

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.

Differential revision: https://reviews.llvm.org/D43632

llvm-svn: 325873
lld/test/ELF/linkerscript/empty-synthetic-removed-flags.s [new file with mode: 0644]