resolv, rt: Change some extern inline functions to static inline
Checks
| Context |
Check |
Description |
| redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
Commit Message
The following functions:
__aio_create_helper_thread
__aio_start_notify_thread
__gai_create_helper_thread
__gai_start_notify_thread
are declared as extern inline, but no translation unit provides their
real definitions. This can lead to a link failure if the functions are
not inlined. Fix it by declaring them as static inline instead.
---
resolv/gai_misc.c | 2 +-
rt/aio_misc.c | 2 +-
sysdeps/mach/hurd/gai_misc.h | 4 ++--
sysdeps/nptl/gai_misc.h | 4 ++--
sysdeps/unix/sysv/linux/aio_misc.h | 4 ++--
5 files changed, 8 insertions(+), 8 deletions(-)
Comments
* Peter Collingbourne:
> The following functions:
>
> __aio_create_helper_thread
> __aio_start_notify_thread
> __gai_create_helper_thread
> __gai_start_notify_thread
>
> are declared as extern inline, but no translation unit provides their
> real definitions. This can lead to a link failure if the functions are
> not inlined. Fix it by declaring them as static inline instead.
I would drop the “inline” as well, encouraging the compiler to make
the inlining decision.
On Fri, May 1, 2026 at 1:39 AM Florian Weimer <fw@deneb.enyo.de> wrote:
>
> * Peter Collingbourne:
>
> > The following functions:
> >
> > __aio_create_helper_thread
> > __aio_start_notify_thread
> > __gai_create_helper_thread
> > __gai_start_notify_thread
> >
> > are declared as extern inline, but no translation unit provides their
> > real definitions. This can lead to a link failure if the functions are
> > not inlined. Fix it by declaring them as static inline instead.
>
> I would drop the “inline” as well, encouraging the compiler to make
> the inlining decision.
That causes some build failures, e.g.
In file included from aio_error.c:30:
../sysdeps/unix/sysv/linux/aio_misc.h:38:1: error: ‘__aio_create_helper_thread’
defined but not used [-Werror=unused-function]
38 | __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
../sysdeps/unix/sysv/linux/aio_misc.h:29:1: error: ‘__aio_start_notify_thread’ d
efined but not used [-Werror=unused-function]
29 | __aio_start_notify_thread (void)
| ^~~~~~~~~~~~~~~~~~~~~~~~~
Peter
On Fri, May 1, 2026 at 12:43 PM Peter Collingbourne <pcc@google.com> wrote:
>
> On Fri, May 1, 2026 at 1:39 AM Florian Weimer <fw@deneb.enyo.de> wrote:
> >
> > * Peter Collingbourne:
> >
> > > The following functions:
> > >
> > > __aio_create_helper_thread
> > > __aio_start_notify_thread
> > > __gai_create_helper_thread
> > > __gai_start_notify_thread
> > >
> > > are declared as extern inline, but no translation unit provides their
> > > real definitions. This can lead to a link failure if the functions are
> > > not inlined. Fix it by declaring them as static inline instead.
> >
> > I would drop the “inline” as well, encouraging the compiler to make
> > the inlining decision.
>
> That causes some build failures, e.g.
>
> In file included from aio_error.c:30:
> ../sysdeps/unix/sysv/linux/aio_misc.h:38:1: error: ‘__aio_create_helper_thread’
> defined but not used [-Werror=unused-function]
> 38 | __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> ../sysdeps/unix/sysv/linux/aio_misc.h:29:1: error: ‘__aio_start_notify_thread’ d
> efined but not used [-Werror=unused-function]
> 29 | __aio_start_notify_thread (void)
> | ^~~~~~~~~~~~~~~~~~~~~~~~~
So, they need a __attribute_maybe_unused__ annotation.
* Cristian Rodriguez:
> On Fri, May 1, 2026 at 12:43 PM Peter Collingbourne <pcc@google.com> wrote:
>>
>> On Fri, May 1, 2026 at 1:39 AM Florian Weimer <fw@deneb.enyo.de> wrote:
>> >
>> > * Peter Collingbourne:
>> >
>> > > The following functions:
>> > >
>> > > __aio_create_helper_thread
>> > > __aio_start_notify_thread
>> > > __gai_create_helper_thread
>> > > __gai_start_notify_thread
>> > >
>> > > are declared as extern inline, but no translation unit provides their
>> > > real definitions. This can lead to a link failure if the functions are
>> > > not inlined. Fix it by declaring them as static inline instead.
>> >
>> > I would drop the “inline” as well, encouraging the compiler to make
>> > the inlining decision.
>>
>> That causes some build failures, e.g.
>>
>> In file included from aio_error.c:30:
>> ../sysdeps/unix/sysv/linux/aio_misc.h:38:1: error: ‘__aio_create_helper_thread’
>> defined but not used [-Werror=unused-function]
>> 38 | __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> ../sysdeps/unix/sysv/linux/aio_misc.h:29:1: error: ‘__aio_start_notify_thread’ d
>> efined but not used [-Werror=unused-function]
>> 29 | __aio_start_notify_thread (void)
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> So, they need a __attribute_maybe_unused__ annotation.
Yeah, or we should clean this up properly: It seems to me a generic
implementation of__aio_create_helper_thread could use
internal_signal_block_all. And drop the stack size reduction
for __aio_create_helper_thread, perhaps.
Or use separate .c files with proper sysdeps overrides.
* Cristian Rodriguez:
> On Fri, May 1, 2026 at 12:43 PM Peter Collingbourne <pcc@google.com> wrote:
>>
>> On Fri, May 1, 2026 at 1:39 AM Florian Weimer <fw@deneb.enyo.de> wrote:
>> >
>> > * Peter Collingbourne:
>> >
>> > > The following functions:
>> > >
>> > > __aio_create_helper_thread
>> > > __aio_start_notify_thread
>> > > __gai_create_helper_thread
>> > > __gai_start_notify_thread
>> > >
>> > > are declared as extern inline, but no translation unit provides their
>> > > real definitions. This can lead to a link failure if the functions are
>> > > not inlined. Fix it by declaring them as static inline instead.
>> >
>> > I would drop the “inline” as well, encouraging the compiler to make
>> > the inlining decision.
>>
>> That causes some build failures, e.g.
>>
>> In file included from aio_error.c:30:
>> ../sysdeps/unix/sysv/linux/aio_misc.h:38:1: error: ‘__aio_create_helper_thread’
>> defined but not used [-Werror=unused-function]
>> 38 | __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
>> ../sysdeps/unix/sysv/linux/aio_misc.h:29:1: error: ‘__aio_start_notify_thread’ d
>> efined but not used [-Werror=unused-function]
>> 29 | __aio_start_notify_thread (void)
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> So, they need a __attribute_maybe_unused__ annotation.
Peter, could you post a v2 with this additional change?
Thanks,
Florian
On Mon, May 4, 2026 at 6:34 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * Cristian Rodriguez:
>
> > On Fri, May 1, 2026 at 12:43 PM Peter Collingbourne <pcc@google.com> wrote:
> >>
> >> On Fri, May 1, 2026 at 1:39 AM Florian Weimer <fw@deneb.enyo.de> wrote:
> >> >
> >> > * Peter Collingbourne:
> >> >
> >> > > The following functions:
> >> > >
> >> > > __aio_create_helper_thread
> >> > > __aio_start_notify_thread
> >> > > __gai_create_helper_thread
> >> > > __gai_start_notify_thread
> >> > >
> >> > > are declared as extern inline, but no translation unit provides their
> >> > > real definitions. This can lead to a link failure if the functions are
> >> > > not inlined. Fix it by declaring them as static inline instead.
> >> >
> >> > I would drop the “inline” as well, encouraging the compiler to make
> >> > the inlining decision.
> >>
> >> That causes some build failures, e.g.
> >>
> >> In file included from aio_error.c:30:
> >> ../sysdeps/unix/sysv/linux/aio_misc.h:38:1: error: ‘__aio_create_helper_thread’
> >> defined but not used [-Werror=unused-function]
> >> 38 | __aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
> >> | ^~~~~~~~~~~~~~~~~~~~~~~~~~
> >> ../sysdeps/unix/sysv/linux/aio_misc.h:29:1: error: ‘__aio_start_notify_thread’ d
> >> efined but not used [-Werror=unused-function]
> >> 29 | __aio_start_notify_thread (void)
> >> | ^~~~~~~~~~~~~~~~~~~~~~~~~
> >
> >
> > So, they need a __attribute_maybe_unused__ annotation.
>
> Peter, could you post a v2 with this additional change?
Setting aside whether it's really worth trying to encourage these
functions to be inlined (they start threads, which is expensive
anyway), "static inline __always_inline" seems like a better
expression of our intent, so I did that in v2.
Peter
* Peter Collingbourne:
> The following functions:
>
> __aio_create_helper_thread
> __aio_start_notify_thread
> __gai_create_helper_thread
> __gai_start_notify_thread
>
> are declared as extern inline, but no translation unit provides their
> real definitions. This can lead to a link failure if the functions are
> not inlined. Fix it by declaring them as static inline instead.
This is better than the other patch, so let's use it.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Peter, can you push this yourself?
Thansk,
Florian
On Tue, May 5, 2026 at 1:31 AM Florian Weimer <fweimer@redhat.com> wrote:
>
> * Peter Collingbourne:
>
> > The following functions:
> >
> > __aio_create_helper_thread
> > __aio_start_notify_thread
> > __gai_create_helper_thread
> > __gai_start_notify_thread
> >
> > are declared as extern inline, but no translation unit provides their
> > real definitions. This can lead to a link failure if the functions are
> > not inlined. Fix it by declaring them as static inline instead.
>
> This is better than the other patch, so let's use it.
>
> Reviewed-by: Florian Weimer <fweimer@redhat.com>
>
> Peter, can you push this yourself?
I don't have access, can you do that for me please?
Peter
On Tue, May 5, 2026 at 10:57 AM Peter Collingbourne <pcc@google.com> wrote:
>
> On Tue, May 5, 2026 at 1:31 AM Florian Weimer <fweimer@redhat.com> wrote:
> >
> > * Peter Collingbourne:
> >
> > > The following functions:
> > >
> > > __aio_create_helper_thread
> > > __aio_start_notify_thread
> > > __gai_create_helper_thread
> > > __gai_start_notify_thread
> > >
> > > are declared as extern inline, but no translation unit provides their
> > > real definitions. This can lead to a link failure if the functions are
> > > not inlined. Fix it by declaring them as static inline instead.
> >
> > This is better than the other patch, so let's use it.
> >
> > Reviewed-by: Florian Weimer <fweimer@redhat.com>
> >
> > Peter, can you push this yourself?
>
> I don't have access, can you do that for me please?
Ping
Peter
* Peter Collingbourne:
> On Tue, May 5, 2026 at 10:57 AM Peter Collingbourne <pcc@google.com> wrote:
>>
>> On Tue, May 5, 2026 at 1:31 AM Florian Weimer <fweimer@redhat.com> wrote:
>> >
>> > * Peter Collingbourne:
>> >
>> > > The following functions:
>> > >
>> > > __aio_create_helper_thread
>> > > __aio_start_notify_thread
>> > > __gai_create_helper_thread
>> > > __gai_start_notify_thread
>> > >
>> > > are declared as extern inline, but no translation unit provides their
>> > > real definitions. This can lead to a link failure if the functions are
>> > > not inlined. Fix it by declaring them as static inline instead.
>> >
>> > This is better than the other patch, so let's use it.
>> >
>> > Reviewed-by: Florian Weimer <fweimer@redhat.com>
>> >
>> > Peter, can you push this yourself?
>>
>> I don't have access, can you do that for me please?
>
> Ping
Sorry, pushed now.
Thanks,
Florian
@@ -28,7 +28,7 @@
#ifndef gai_create_helper_thread
# define gai_create_helper_thread __gai_create_helper_thread
-extern inline int
+static inline int
__gai_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
void *arg)
{
@@ -33,7 +33,7 @@
#ifndef aio_create_helper_thread
# define aio_create_helper_thread __aio_create_helper_thread
-extern inline int
+static inline int
__aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *), void *arg)
{
pthread_attr_t attr;
@@ -22,7 +22,7 @@
#define gai_start_notify_thread __gai_start_notify_thread
#define gai_create_helper_thread __gai_create_helper_thread
-extern inline void
+static inline void
__gai_start_notify_thread (void)
{
sigset_t ss;
@@ -32,7 +32,7 @@ __gai_start_notify_thread (void)
assert_perror (sigerr);
}
-extern inline int
+static inline int
__gai_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
void *arg)
{
@@ -76,7 +76,7 @@
#define gai_start_notify_thread __gai_start_notify_thread
#define gai_create_helper_thread __gai_create_helper_thread
-extern inline void
+static inline void
__gai_start_notify_thread (void)
{
sigset_t ss;
@@ -84,7 +84,7 @@ __gai_start_notify_thread (void)
(void) __pthread_sigmask (SIG_SETMASK, &ss, NULL);
}
-extern inline int
+static inline int
__gai_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
void *arg)
{
@@ -25,7 +25,7 @@
# define aio_start_notify_thread __aio_start_notify_thread
# define aio_create_helper_thread __aio_create_helper_thread
-extern inline void
+static inline void
__aio_start_notify_thread (void)
{
sigset_t ss;
@@ -34,7 +34,7 @@ __aio_start_notify_thread (void)
__NSIG_BYTES);
}
-extern inline int
+static inline int
__aio_create_helper_thread (pthread_t *threadp, void *(*tf) (void *),
void *arg)
{