1This is a test that COMDAT sections with differing visibilities get resolved
2to the most restrictive visibility, by the usual rules of symbol
3resolution.
4
5The GNU compiler, or build systems which use `-fvisibility*` inconsistently
6often emit technically incorrect COMDAT sections where by the sections are not
7strictly equivalent because they differ in visibility.  This tests that we
8resolve, and resolve them to the most restrictive visibility as the compiler
9expects.
10
11We do this...
12
13- `visible.s`
14	defines our two COMDAT symbols/sections (`data_symbol` and `bss_symbol`)
15	with default visibility
16
17- `hidden.s`
18	defines our two COMDAT symbols/sections (`data_symbol` and
19	`bss_symbol`) with hidden visibility
20
21- `access.S`
22	provides access to our data using relocations we control,
23	just in case
24
25- `main.c`
26	an actual test wrapper that just checks the values of the
27	data
28
29- `Makefile.test`
30	A Makefile to build the tests on the system under test
31
32...and check that the resulting `test` binary links and runs.
33
34For an added check we intentionally break the COMDAT rules ourselves, and know
35a little bit about the link-editor implementation.  `hidden.s` and `visible.s`
36give `data_symbol` _different values_.  We know based on the link-editor
37implementation that the first section seen will be the one taken by the
38link-editor, so we check for the value from `data.s`, but implicitly rely on the
39_visibility_ from `hidden.s` to link.  Proving to ourselves that the visibility
40came from symbol resolution and not any other means.
41