1*a196c3ffSRichard LoweThis is a test that sections which are members of groups are not merged when
2*a196c3ffSRichard Lowecreating relocatable objects.
3*a196c3ffSRichard Lowe
4*a196c3ffSRichard LoweIf we place an input section which is in a group in the same output section as
5*a196c3ffSRichard Loweanother input section this leaves us with problems:
6*a196c3ffSRichard Lowe
7*a196c3ffSRichard Lowe1. If the other input section was not previously member of a group, its data
8*a196c3ffSRichard Lowe   becomes part of a group and we may now discard it along with that group.
9*a196c3ffSRichard Lowe2. If the other input section _was_ a member of a group we now have two groups
10*a196c3ffSRichard Lowe   containing the same section, where discarding one will corrupt the other.
11*a196c3ffSRichard Lowe3. ... and if that section had associated relocations, which must have been
12*a196c3ffSRichard Lowe   part of the group, we will now associate those relocations with the merged
13*a196c3ffSRichard Lowe   output section further corrupting the group, as there is now no mapping
14*a196c3ffSRichard Lowe   between input and output relocation sections.
15*a196c3ffSRichard Lowe
16*a196c3ffSRichard LoweWe test this by defining 3 sections in two groups in two input objects:
17*a196c3ffSRichard Lowe- `.test_data_conflict` in `group1`
18*a196c3ffSRichard Lowe- `.test_data_conflict` in `group2`
19*a196c3ffSRichard Lowe- `.test_data_conflict` in no group at all
20*a196c3ffSRichard Lowe
21*a196c3ffSRichard LoweWe then link these objects together using `ld -r` and expect:
22*a196c3ffSRichard Lowe- `.test_data_conflict` from `group1` remains in `group1`, is merged with no
23*a196c3ffSRichard Lowe  other input section, and has the duplicate section discarded by the COMDAT
24*a196c3ffSRichard Lowe  group logic.
25*a196c3ffSRichard Lowe- `.test_data_conflict` from `group2` remains in `group2`, is merged with no
26*a196c3ffSRichard Lowe  other input section, and has the duplicate section discarded by the COMDAT
27*a196c3ffSRichard Lowe  group logic.
28*a196c3ffSRichard Lowe- the ungrouped `.test_data_conflict` remains in no groups, and the two input
29*a196c3ffSRichard Lowe  sections are merged into a single output section.
30