* [PATCH] Mark __libc_freeres_fn as used [# 27002]
@ 2020-12-02 23:09 H.J. Lu
2020-12-03 9:39 ` Florian Weimer
0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2020-12-02 23:09 UTC (permalink / raw)
To: 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.
---
include/libc-symbols.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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) \
--
2.28.0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Mark __libc_freeres_fn as used [# 27002]
2020-12-02 23:09 [PATCH] Mark __libc_freeres_fn as used [# 27002] H.J. Lu
@ 2020-12-03 9:39 ` Florian Weimer
2020-12-03 12:22 ` H.J. Lu
0 siblings, 1 reply; 6+ messages in thread
From: Florian Weimer @ 2020-12-03 9:39 UTC (permalink / raw)
To: H.J. Lu via Libc-alpha
* 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
--
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Mark __libc_freeres_fn as used [# 27002]
2020-12-03 9:39 ` Florian Weimer
@ 2020-12-03 12:22 ` H.J. Lu
2020-12-03 13:36 ` Florian Weimer
0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2020-12-03 12:22 UTC (permalink / raw)
To: Florian Weimer; +Cc: H.J. Lu via Libc-alpha
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] Mark __libc_freeres_fn as used [# 27002]
2020-12-03 12:22 ` H.J. Lu
@ 2020-12-03 13:36 ` Florian Weimer
2020-12-11 22:22 ` V2 " H.J. Lu
0 siblings, 1 reply; 6+ messages in thread
From: Florian Weimer @ 2020-12-03 13:36 UTC (permalink / raw)
To: H.J. Lu; +Cc: H.J. Lu via Libc-alpha
* 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
--
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill
^ permalink raw reply [flat|nested] 6+ messages in thread
* V2 [PATCH] Mark __libc_freeres_fn as used [# 27002]
2020-12-03 13:36 ` Florian Weimer
@ 2020-12-11 22:22 ` H.J. Lu
2020-12-16 10:30 ` Florian Weimer
0 siblings, 1 reply; 6+ messages in thread
From: H.J. Lu @ 2020-12-11 22:22 UTC (permalink / raw)
To: Florian Weimer; +Cc: H.J. Lu via Libc-alpha
[-- Attachment #1: Type: text/plain, Size: 428 bytes --]
On Thu, Dec 3, 2020 at 5:36 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * 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>
>
Independent of the GCC issue, __libc_freeres_fn should have the
used attribute. OK for master?
--
H.J.
[-- Attachment #2: 0001-Mark-__libc_freeres_fn-as-used-BZ-27002.patch --]
[-- Type: text/x-patch, Size: 1829 bytes --]
From afb70a56cd57f0900f7a0b61e51500da2cdf1f4e Mon Sep 17 00:00:00 2001
From: "H.J. Lu" <hjl.tools@gmail.com>
Date: Wed, 2 Dec 2020 14:26:28 -0800
Subject: [PATCH] Mark __libc_freeres_fn as used [BZ #27002]
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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
gconv_dl.c: In function ‘free_mem’:
gconv_dl.c:191:1: error: ‘do_release_all’ without ‘used’ attribute and ‘free_mem’ with ‘used’ attribute are placed in a section with the same name [-Werror=attributes]
191 | do_release_all (void *nodep)
| ^~~~~~~~~~~~~~
In file included from <command-line>:
gconv_dl.c:202:18: note: ‘free_mem’ was declared here
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)
| ^~~~
cc1: all warnings being treated as errors
---
include/libc-symbols.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 154a73b5e5..f06ce3053a 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) \
--
2.29.2
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: V2 [PATCH] Mark __libc_freeres_fn as used [# 27002]
2020-12-11 22:22 ` V2 " H.J. Lu
@ 2020-12-16 10:30 ` Florian Weimer
0 siblings, 0 replies; 6+ messages in thread
From: Florian Weimer @ 2020-12-16 10:30 UTC (permalink / raw)
To: H.J. Lu; +Cc: H.J. Lu via Libc-alpha
* H. J. Lu:
> On Thu, Dec 3, 2020 at 5:36 AM Florian Weimer <fweimer@redhat.com> wrote:
>>
>> * 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>
>>
>
> Independent of the GCC issue, __libc_freeres_fn should have the
> used attribute. OK for master?
Looks okay to me. Thanks.
Florian
--
Red Hat GmbH, https://de.redhat.com/ , Registered seat: Grasbrunn,
Commercial register: Amtsgericht Muenchen, HRB 153243,
Managing Directors: Charles Cachera, Brian Klemm, Laurie Krebs, Michael O'Neill
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2020-12-16 10:31 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-02 23:09 [PATCH] Mark __libc_freeres_fn as used [# 27002] H.J. Lu
2020-12-03 9:39 ` Florian Weimer
2020-12-03 12:22 ` H.J. Lu
2020-12-03 13:36 ` Florian Weimer
2020-12-11 22:22 ` V2 " H.J. Lu
2020-12-16 10:30 ` Florian Weimer
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).