On Tue, Nov 3, 2020 at 9:41 AM Jozef Lawrynowicz
<joze...@mittosystems.com> wrote:
>
> The attached patch implements TARGET_ASM_MARK_DECL_PRESERVED for ELF GNU
> OSABI targets, so that declarations that have the "used" attribute
> applied will be saved from linker garbage collection.
>
> TARGET_ASM_MARK_DECL_PRESERVED will emit an assembler ".retain"

Can you use the "R" flag instead?

> directive for the decl, and the assembler will apply the SHF_GNU_RETAIN
> flag to the section containing the decl.
> The linker will not garbage collect sections marked with the
> SHF_GNU_RETAIN flag.
>
> SHF_GNU_RETAIN is a GNU OSABI ELF extension, and it was discussed on the
> GNU gABI mailing list here:
> https://sourceware.org/pipermail/gnu-gabi/2020q3/000429.html
>
> The Binutils patch to implement .retain and other SHF_GNU_RETAIN
> handling is posted here:
> https://sourceware.org/pipermail/binutils/2020-November/113993.html
>
> Successfully bootstrapped and regtested for x86_64-pc-linux-gnu, and
> regtested for arm-none-eabi.
>
> Ok for trunk?
>
> Thanks,
> Jozef



-- 
H.J.

Reply via email to