Message ID | 20201202230943.4027351-1-hjl.tools@gmail.com |
---|---|
State | New |
Headers | show |
Series | Mark __libc_freeres_fn as used [# 27002] | expand |
* 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. Thanks, Florian
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. Lu: > 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. Okay, I filed: <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98121> Thanks, Florian
diff --git a/include/libc-symbols.h b/include/libc-symbols.h index b8103b98bb..b8fc1584d2 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -307,7 +307,7 @@ for linking") /* Resource freeing functions from libc.so go in this section. */ #define __libc_freeres_fn_section \ - __attribute__ ((section ("__libc_freeres_fn"))) + __attribute__ ((__used__, section ("__libc_freeres_fn"))) /* Resource freeing functions for libc.so. */ #define libc_freeres_fn(name) \