2019-06-06 20:18:29

by Greg KH

[permalink] [raw]
Subject: Re: Linux 4.9.180 build fails with gcc 9 and 'cleanup_module' specifies less restrictive attr ibute than its target …

On Thu, Jun 06, 2019 at 08:25:28PM +0200, Miguel Ojeda wrote:
> On Thu, Jun 6, 2019 at 5:29 PM Greg KH <[email protected]> wrote:
> >
> > And if you want this, you should look at how the backports to 4.14.y
> > worked, they did not include a3f8a30f3f00 ("Compiler Attributes: use
> > feature checks instead of version checks"), as that gets really messy...
>
> I am confused -- I interpreted Rolf's message as reporting that he
> already successfully built 4.9 by applying a6e60d84989f
> ("include/linux/module.h: copy __init/__exit attrs to
> init/cleanup_module") and manually fixing it up. But maybe I am
> completely wrong... :-)

"manually fixing it up" means "hacked it to pieces" to me, I have no
idea what the end result really was :)

If someone wants to send me some patches I can actually apply, that
would be best...

thanks,

greg k-h


2019-06-08 12:03:31

by Miguel Ojeda

[permalink] [raw]
Subject: Re: Linux 4.9.180 build fails with gcc 9 and 'cleanup_module' specifies less restrictive attribute than its targ et …

On Thu, Jun 6, 2019 at 8:59 PM Greg KH <[email protected]> wrote:
>
> "manually fixing it up" means "hacked it to pieces" to me, I have no
> idea what the end result really was :)
>
> If someone wants to send me some patches I can actually apply, that
> would be best...

I will give it a go whenever I get some free time :)

Cheers,
Miguel

2019-06-12 08:34:43

by Rolf Eike Beer

[permalink] [raw]
Subject: Re: Linux 4.9.180 build fails with gcc 9 and 'cleanup_module' specifies less restrictive attribute than its target …

Am Donnerstag, 6. Juni 2019, 20:59:00 CEST schrieb Greg KH:
> On Thu, Jun 06, 2019 at 08:25:28PM +0200, Miguel Ojeda wrote:
> > On Thu, Jun 6, 2019 at 5:29 PM Greg KH <[email protected]> wrote:
> > > And if you want this, you should look at how the backports to 4.14.y
> > > worked, they did not include a3f8a30f3f00 ("Compiler Attributes: use
> > > feature checks instead of version checks"), as that gets really messy...
> >
> > I am confused -- I interpreted Rolf's message as reporting that he
> > already successfully built 4.9 by applying a6e60d84989f
> > ("include/linux/module.h: copy __init/__exit attrs to
> > init/cleanup_module") and manually fixing it up. But maybe I am
> > completely wrong... :-)
>
> "manually fixing it up" means "hacked it to pieces" to me, I have no
> idea what the end result really was :)
>
> If someone wants to send me some patches I can actually apply, that
> would be best...

Hi all,

the patch I actually used was this:

diff --git a/include/linux/module.h b/include/linux/module.h
index 8fa38d3e7538..f5bc4c046461 100644
--- a/include/linux/module.h
+++ b/include/linux/module.h
@@ -129,13 +129,13 @@ extern void cleanup_module(void);
#define module_init(initfn) \
static inline initcall_t __maybe_unused __inittest(void) \
{ return initfn; } \
- int init_module(void) __attribute__((alias(#initfn)));
+ int init_module(void) __attribute__((__copy__(initfn))) __attribute__((alias(#initfn)));

/* This is only required if you want to be unloadable. */
#define module_exit(exitfn) \
static inline exitcall_t __maybe_unused __exittest(void) \
{ return exitfn; } \
- void cleanup_module(void) __attribute__((alias(#exitfn)));
+ void cleanup_module(void) __attribute__((__copy__(exitfn))) __attribute__((alias(#exitfn)));

#endif


So the final question is: do we want 4.9.x to be buildable with gcc 9.x? If
yes then we can probably get this patches into shape.

Eike
--
Rolf Eike Beer, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055

emlix - smart embedded open source


Attachments:
signature.asc (321.00 B)
This is a digitally signed message part.

2019-06-12 08:39:12

by Greg KH

[permalink] [raw]
Subject: Re: Linux 4.9.180 build fails with gcc 9 and 'cleanup_module' specifies less restrictive attr ibute than its target …

On Wed, Jun 12, 2019 at 09:19:15AM +0200, Rolf Eike Beer wrote:
> Am Donnerstag, 6. Juni 2019, 20:59:00 CEST schrieb Greg KH:
> > On Thu, Jun 06, 2019 at 08:25:28PM +0200, Miguel Ojeda wrote:
> > > On Thu, Jun 6, 2019 at 5:29 PM Greg KH <[email protected]> wrote:
> > > > And if you want this, you should look at how the backports to 4.14.y
> > > > worked, they did not include a3f8a30f3f00 ("Compiler Attributes: use
> > > > feature checks instead of version checks"), as that gets really messy...
> > >
> > > I am confused -- I interpreted Rolf's message as reporting that he
> > > already successfully built 4.9 by applying a6e60d84989f
> > > ("include/linux/module.h: copy __init/__exit attrs to
> > > init/cleanup_module") and manually fixing it up. But maybe I am
> > > completely wrong... :-)
> >
> > "manually fixing it up" means "hacked it to pieces" to me, I have no
> > idea what the end result really was :)
> >
> > If someone wants to send me some patches I can actually apply, that
> > would be best...
>
> Hi all,
>
> the patch I actually used was this:
>
> diff --git a/include/linux/module.h b/include/linux/module.h
> index 8fa38d3e7538..f5bc4c046461 100644
> --- a/include/linux/module.h
> +++ b/include/linux/module.h
> @@ -129,13 +129,13 @@ extern void cleanup_module(void);
> #define module_init(initfn) \
> static inline initcall_t __maybe_unused __inittest(void) \
> { return initfn; } \
> - int init_module(void) __attribute__((alias(#initfn)));
> + int init_module(void) __attribute__((__copy__(initfn))) __attribute__((alias(#initfn)));
>
> /* This is only required if you want to be unloadable. */
> #define module_exit(exitfn) \
> static inline exitcall_t __maybe_unused __exittest(void) \
> { return exitfn; } \
> - void cleanup_module(void) __attribute__((alias(#exitfn)));
> + void cleanup_module(void) __attribute__((__copy__(exitfn))) __attribute__((alias(#exitfn)));
>
> #endif
>
>
> So the final question is: do we want 4.9.x to be buildable with gcc 9.x? If
> yes then we can probably get this patches into shape.

Eventually, yes, we (or at least I) will want to build 4.9.x with gcc
9.x. We went through this same process for gcc 8.x as all of my builder
test machines switched their default version of gcc...

thanks,

greg k-h

2019-08-02 13:13:51

by Rolf Eike Beer

[permalink] [raw]
Subject: Re: Linux 4.9.180 build fails with gcc 9 and 'cleanup_module' specifies less restrictive attribute than its target …

Am Samstag, 8. Juni 2019, 14:00:34 CEST schrieb Miguel Ojeda:
> On Thu, Jun 6, 2019 at 8:59 PM Greg KH <[email protected]> wrote:
> > "manually fixing it up" means "hacked it to pieces" to me, I have no
> > idea what the end result really was :)
> >
> > If someone wants to send me some patches I can actually apply, that
> > would be best...
>
> I will give it a go whenever I get some free time :)

I fear this has never happened, did it?

Eike
--
Rolf Eike Beer, emlix GmbH, http://www.emlix.com
Fon +49 551 30664-0, Fax +49 551 30664-11
Gothaer Platz 3, 37083 Göttingen, Germany
Sitz der Gesellschaft: Göttingen, Amtsgericht Göttingen HR B 3160
Geschäftsführung: Heike Jordan, Dr. Uwe Kracke – Ust-IdNr.: DE 205 198 055

emlix - smart embedded open source


Attachments:
signature.asc (321.00 B)
This is a digitally signed message part.

2019-08-02 13:15:03

by Greg KH

[permalink] [raw]
Subject: Re: Linux 4.9.180 build fails with gcc 9 and 'cleanup_module' specifies less restrictive attr ibute than its target …

On Fri, Aug 02, 2019 at 10:17:04AM +0200, Rolf Eike Beer wrote:
> Am Samstag, 8. Juni 2019, 14:00:34 CEST schrieb Miguel Ojeda:
> > On Thu, Jun 6, 2019 at 8:59 PM Greg KH <[email protected]> wrote:
> > > "manually fixing it up" means "hacked it to pieces" to me, I have no
> > > idea what the end result really was :)
> > >
> > > If someone wants to send me some patches I can actually apply, that
> > > would be best...
> >
> > I will give it a go whenever I get some free time :)
>
> I fear this has never happened, did it?

I do not think so, I'm still building 4.9.y and 4.14.y and 4.19.y with
gcc8 because of these issues :(

thanks,

greg k-h

2019-08-02 20:18:20

by Miguel Ojeda

[permalink] [raw]
Subject: Re: Linux 4.9.180 build fails with gcc 9 and 'cleanup_module' specifies less restrictive attribute than its targ et …

On Fri, Aug 2, 2019 at 10:17 AM Rolf Eike Beer <[email protected]> wrote:
>
> Am Samstag, 8. Juni 2019, 14:00:34 CEST schrieb Miguel Ojeda:
> > On Thu, Jun 6, 2019 at 8:59 PM Greg KH <[email protected]> wrote:
> > > "manually fixing it up" means "hacked it to pieces" to me, I have no
> > > idea what the end result really was :)
> > >
> > > If someone wants to send me some patches I can actually apply, that
> > > would be best...
> >
> > I will give it a go whenever I get some free time :)
>
> I fear this has never happened, did it?

No. Between summer, holidays and a conference I didn't get to do it.

Done the minimal approach here:

https://github.com/ojeda/linux/commits/compiler-attributes-backport

Tested building a handful of drivers with gcc 4.6.4, 8.3.0 and 9.1.1.

Greg, I could backport the entire compiler_attributes.h, but given
this is stable, we are supposed to minimize changes, right?

I tried to imitate what you do in other stable patches, please check
the Cc:, Link: lines and the "commit ... upstream" just in case.

HTH,

Cheers,
Miguel