V2 [PATCH] Use SHF_GNU_RETAIN to preserve symbol definitions

H.J. Lu hjl.tools@gmail.com
Fri Nov 13 13:45:55 GMT 2020


On Fri, Nov 13, 2020 at 3:36 AM Jozef Lawrynowicz
<jozef.l@mittosystems.com> wrote:
>
> On Thu, Nov 12, 2020 at 02:41:52PM -0800, H.J. Lu wrote:
> > diff --git a/gcc/varasm.c b/gcc/varasm.c
> > index 435c7b348a5..c48ef9692ee 100644
> > --- a/gcc/varasm.c
> > +++ b/gcc/varasm.c
> > @@ -289,6 +289,10 @@ get_section (const char *name, unsigned int flags, tree decl,
> >    slot = section_htab->find_slot_with_hash (name, htab_hash_string (name),
> >                                           INSERT);
> >    flags |= SECTION_NAMED;
> > +#if HAVE_GAS_SHF_GNU_RETAIN
> > +  if (decl != nullptr && DECL_PRESERVE_P (decl))
>
> Minor nit, but I think this should be "decl != NULL_TREE".

We are using C++ now.  Should we start using nullptr instead of
NULL_TREE or NULL_RTX?

> We should also test that "used" with the "section" attribute applies the
> "R" flag. Please apply the attached patch if this gets approved. These
> new tests pass with arm-none-eabi and x86_64-pc-linux-gnu.
>

Done.  Here is the updated patch.

-- 
H.J.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Use-SHF_GNU_RETAIN-to-preserve-symbol-definitions.patch
Type: text/x-patch
Size: 16312 bytes
Desc: not available
URL: <https://gcc.gnu.org/pipermail/gcc-patches/attachments/20201113/b5aa5819/attachment-0001.bin>


More information about the Gcc-patches mailing list