[PATCH] Mark __libc_freeres_fn as used [# 27002]

H.J. Lu hjl.tools@gmail.com
Thu Dec 3 12:22:50 GMT 2020


On Thu, Dec 3, 2020 at 1:39 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * H. J. Lu via Libc-alpha:
>
> > GCC 11 with
> >
> > commit 6fbec038f7a7ddf29f074943611b53210d17c40c
> > Author: H.J. Lu <hjl.tools@gmail.com>
> > Date:   Mon Feb 3 11:55:43 2020 -0800
> >
> >     Use SHF_GNU_RETAIN to preserve symbol definitions
> >
> > places used symbols in SECTION_RETAIN sections if assembler supports it.
> > Mark __libc_freeres_fn as used to avoid
> >
> > In file included from <command-line>:
> > gconv_dl.c: In function 'free_mem':
> > gconv_dl.c:202:18: error: 'free_mem' causes a section type conflict with 'do_release_all'
> >   202 | libc_freeres_fn (free_mem)
> >       |                  ^~~~~~~~
> > ./../include/libc-symbols.h:316:15: note: in definition of macro 'libc_freeres_fn'
> >   316 |   static void name (void)
> >       |               ^~~~
> > gconv_dl.c:191:1: note: 'do_release_all' was declared here
> >   191 | do_release_all (void *nodep)
> >       | ^~~~~~~~~~~~~~
> >
> > where free_mem is marked as used.
>
> Why isn't this a GCC 11 bug?  Using SHF_GNU_RETAIN for existing code is
> surprising.

GCC 11 is changed to place the used symbol in SHF_GNU_RETAIN section to
support --gc-sections.  If you believe it is wrong, please file a GCC bug.

-- 
H.J.


More information about the Libc-alpha mailing list