[lld] r227711 - [test] Add test for section groups and deadstrip
Shankar Easwaran
shankare at codeaurora.org
Thu Feb 5 16:07:12 PST 2015
The test case here tests using YAML and lld core( which uses --dead-strip).
On 2/5/2015 5:15 PM, Rui Ueyama wrote:
> I added --gc-sections and used it in your testcase. And... it crashed. :(
>
> I guess the garbage collector reclaims live atoms. I wouldn't be surprised
> because ELF reader has never been tested with garbage collection enabled.
>
> On Thu, Feb 5, 2015 at 3:05 PM, Rui Ueyama <ruiu at google.com> wrote:
>
>> Looks like the GNU driver doesn't support --gc-sections, and the
>> gc-sections feature is turned off by default. So no section is removed as
>> long as you are using the GNU driver.
>>
>> I think we first have to add that command line option to the driver to
>> turn on the flag in the linking context. Whether turning on the flag is
>> enough or not is that I don't know. We should just try.
>>
>> On Thu, Feb 5, 2015 at 2:53 PM, Rafael EspĂndola <
>> rafael.espindola at gmail.com> wrote:
>>
>>> I think this is testing for a gnu ld bug/limitation:
>>>
>>> With the attached testcase, gnu ld keeps zed and bar. Gold keeps only bar.
>>>
>>> lld keeps _start, bad, zed and produces wrong bindings :-(
>>>
>>>
>>> On 1 February 2015 at 00:47, Shankar Easwaran <shankare at codeaurora.org>
>>> wrote:
>>>> Author: shankare
>>>> Date: Sat Jan 31 23:47:02 2015
>>>> New Revision: 227711
>>>>
>>>> URL: http://llvm.org/viewvc/llvm-project?rev=227711&view=rev
>>>> Log:
>>>> [test] Add test for section groups and deadstrip
>>>>
>>>> This adds a test that deadstrip should preserve the section group even
>>> if there
>>>> is only one reference to a function in the group.
>>>>
>>>> Added:
>>>> lld/trunk/test/core/sectiongroup-deadstrip.objtxt
>>>>
>>>> Added: lld/trunk/test/core/sectiongroup-deadstrip.objtxt
>>>> URL:
>>> http://llvm.org/viewvc/llvm-project/lld/trunk/test/core/sectiongroup-deadstrip.objtxt?rev=227711&view=auto
>>> ==============================================================================
>>>> --- lld/trunk/test/core/sectiongroup-deadstrip.objtxt (added)
>>>> +++ lld/trunk/test/core/sectiongroup-deadstrip.objtxt Sat Jan 31
>>> 23:47:02 2015
>>>> @@ -0,0 +1,92 @@
>>>> +# Test for section group members be preserved even if there is a
>>>> +# reference to only one functions in the group.
>>>> +# RUN: lld -core --dead-strip %s | FileCheck %s
>>>> +
>>>> +#
>>>> +# Test that section groups are parsed properly when there is a
>>> reference to a
>>>> +# group atom from outside a group.
>>>> +#
>>>> +
>>>> +---
>>>> +defined-atoms:
>>>> + - name: entry
>>>> + dead-strip: never
>>>> + references:
>>>> + - offset: 1
>>>> + kind: pcrel32
>>>> + target: d1
>>>> + - name: f1
>>>> + scope: global
>>>> + type: code
>>>> + - name: f2
>>>> + scope: global
>>>> + type: code
>>>> + - name: g1
>>>> + scope: global
>>>> + type: code
>>>> + - name: d1
>>>> + scope: global
>>>> + type: data
>>>> + - name: g1
>>>> + scope: global
>>>> + type: group-comdat
>>>> + references:
>>>> + - kind: group-child
>>>> + target: f1
>>>> + - kind: group-child
>>>> + target: f2
>>>> + - kind: group-child
>>>> + target: d1
>>>> + - kind: group-child
>>>> + target: g1
>>>> + - name: anotherfunction
>>>> + scope: global
>>>> + type: data
>>>> + references:
>>>> + - kind: layout-before
>>>> + target: f1
>>>> +---
>>>> +undefined-atoms:
>>>> + - name: f1
>>>> + can-be-null: never
>>>> +...
>>>> +
>>>> +#CHECK: defined-atoms:
>>>> +#CHECK: - name: g1
>>>> +#CHECK: ref-name: [[PARENT:[a-zA-Z\.0-9_]+]]
>>>> +#CHECK: scope: global
>>>> +#CHECK: type: group-comdat
>>>> +#CHECK: references:
>>>> +#CHECK: - kind: group-child
>>>> +#CHECK: offset: 0
>>>> +#CHECK: target: [[GCHILDONE:[a-zA-Z\.0-9_]+]]
>>>> +#CHECK: - kind: group-child
>>>> +#CHECK: offset: 0
>>>> +#CHECK: target: [[GCHILDTWO:[a-zA-Z\.0-9_]+]]
>>>> +#CHECK: - kind: group-child
>>>> +#CHECK: offset: 0
>>>> +#CHECK: target: [[GCHILDTHREE:[a-zA-Z\.0-9_]+]]
>>>> +#CHECK: - kind: group-child
>>>> +#CHECK: offset: 0
>>>> +#CHECK: target: [[GCHILDFOUR:[a-zA-Z\.0-9_]+]]
>>>> +#CHECK: - name: f1
>>>> +#CHECK: ref-name: [[GCHILDONE]]
>>>> +#CHECK: scope: global
>>>> +#CHECK: - name: f2
>>>> +#CHECK: ref-name: [[GCHILDTWO]]
>>>> +#CHECK: scope: global
>>>> +#CHECK: - name: d1
>>>> +#CHECK: ref-name: [[GCHILDTHREE]]
>>>> +#CHECK: scope: global
>>>> +#CHECK: type: data
>>>> +#CHECK: - name: g1
>>>> +#CHECK: ref-name: [[GCHILDFOUR]]
>>>> +#CHECK: scope: global
>>>> +#CHECK: - name: anotherfunction
>>>> +#CHECK: scope: global
>>>> +#CHECK: type: data
>>>> +#CHECK: references:
>>>> +#CHECK: - kind: layout-before
>>>> +#CHECK: offset: 0
>>>> +#CHECK: target: [[GCHILDONE]]
>>>> +#CHECK: ...
>>>>
>>>>
>>>> _______________________________________________
>>>> llvm-commits mailing list
>>>> llvm-commits at cs.uiuc.edu
>>>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>>
--
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation
More information about the llvm-commits
mailing list