On 12/15/20 10:30 AM, H.J. Lu wrote:
> When definitions marked with used attribute and unmarked definitions are
> placed in the section with the same name, switch to a new section if the
> SECTION_RETAIN bit doesn't match.
>
> gcc/
>
>       PR target/98146
>       * output.h (switch_to_section): Add a tree argument, default to
>       nullptr.
>       * varasm.c (get_section): If the SECTION_RETAIN bit doesn't match,
>       return and switch to a new section later.
>       (assemble_start_function): Pass decl to switch_to_section.
>       (assemble_variable): Likewise.
>       (switch_to_section): If the SECTION_RETAIN bit doesn't match,
>       switch to a new section.
>
> gcc/testsuite/
>
>       PR target/98146
>       * c-c++-common/attr-used-5.c: New test.
>       * c-c++-common/attr-used-6.c: Likewise.
>       * c-c++-common/attr-used-7.c: Likewise.
>       * c-c++-common/attr-used-8.c: Likewise.
>       * c-c++-common/attr-used-9.c: Likewise.
So as an additional follow-up could you add to the get_section comment
the special handling were add SECTION_WRITE and SECTION_RELRO to the
flags.  That's not something I would expect that function to do either. 
Consider that comment addition pre-approved.

Jeff


Reply via email to