Bug 9087 - 2.6.23-rc7 regression: psmouse section conflict on alpha
Summary: 2.6.23-rc7 regression: psmouse section conflict on alpha
Status: CLOSED INVALID
Alias: None
Product: Drivers
Classification: Unclassified
Component: Input Devices (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: Dmitry Torokhov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-09-27 04:50 UTC by Rafael J. Wysocki
Modified: 2010-03-05 19:16 UTC (History)
4 users (show)

See Also:
Kernel Version: 2.6.23-rc7
Tree: Mainline
Regression: No


Attachments

Description Rafael J. Wysocki 2007-09-27 04:50:57 UTC
References      : http://lkml.org/lkml/2007/9/22/64
Submitter       : Meelis Roos <mroos@linux.ee>
Comment 1 Meelis Roos 2007-09-27 08:20:22 UTC
  CC [M]  drivers/input/mouse/psmouse-base.o
drivers/input/mouse/psmouse-base.c:45: error: __param_proto causes a section type conflict
make[3]: *** [drivers/input/mouse/psmouse-base.o] Error 1

The same error is present on both 2.6.23-rc7 and 2.6.23-rc8. Debian unstable with gcc version 4.2.1 (Debian 4.2.1-5), binutils 2.18 (Debian 2.18-1).

.config in http://lkml.org/lkml/2007/9/22/64
Comment 2 Dmitry Torokhov 2007-09-27 09:09:33 UTC
Psmouse wan't changed in .23 at all, let's see if Sam has any ideas.
Comment 3 Sam Ravnborg 2007-09-27 14:01:10 UTC
I took a short look at this one.
I have had "section type conflict before" at least in following cases:
- reference to a symbol in a discarded section
- data marked __initdata and marked const
- something marked const and then exported

In this case I could think we have a similar issues as the
one with mixing static and export.
Can you please try to remove the static markers for the
the referenced functions.
First in the prototype just above and if this does not
help then in the implmentation.

You may also try to reveal exactly what line causes the error.

Do:
make drivers/input/mouse/psmouse-base.i
cd drivers/input/mouse/
cp psmouse-base.i psmouse-base.c

Edit the file to expand all lines around the former
module_param_named() macrocall.
Then try to build and see what line gcc error out on.

My alpha toolchain does not revel this bug otherwise
I would have done so myself.

	Sam
Comment 4 Adrian Bunk 2007-09-27 14:46:51 UTC
Sam, it's only present with the combination Alpha+gcc-4.2.

If your Alpha toolchain uses an older gcc you'll not see it.

And this is not a regression, the same issue is also present with older kernels.

I'll attach a possible patch.
Comment 5 Adrian Bunk 2007-09-27 14:50:05 UTC
I spoke too soon when I said I would senda patch...  :-(

What I thought to cause the problem doesn't seem to be the problem.
Comment 6 Sam Ravnborg 2007-09-27 22:08:08 UTC
If you can drop me a tar-ball of your alpha toolchain somewhere I can take a look again.
As I used Dan Kegel's crocctoll I only have gcc 4.1.0 here.

	Sam
Comment 8 Meelis Roos 2007-09-28 00:41:44 UTC
I did the preprocessor mangling and found out that this line is causing the error to occur:
static struct kernel_param const __param_proto __attribute__((__used__)) __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) = { __param_str_proto, 0644, psmouse_set_maxproto, psmouse_get_maxproto, &psmouse_max_proto };

It is the first module_param_named instance.
Comment 9 Sam Ravnborg 2007-09-30 00:13:38 UTC
> I did the preprocessor mangling and found out that this line is causing the
> error to occur:
> static struct kernel_param const __param_proto __attribute__((__used__))
> __attribute__ ((unused,__section__ ("__param"),aligned(sizeof(void *)))) = {
> __param_str_proto, 0644, psmouse_set_maxproto, psmouse_get_maxproto,
> &psmouse_max_proto };
> 
> It is the first module_param_named instance.

Now that I got a working alpha tool-chain it was easy to reproduce/fix.
The get_/set_/check_ variants of maxproto had to be non-static to let
it pass the build.
Why this manifest only on alpha I dunno. Building the same source with
same gcc version for x86_64 did not produce any error.

As this is a workaround for a compiler bug I dunno if we should fix it or not.
Anyway - patch below.

Signed-off-by: Sam Ravnborg <sam@ravnborg.org>


diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index b9f0fb2..2c88572 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -37,8 +37,8 @@ MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
 
 static unsigned int psmouse_max_proto = PSMOUSE_AUTO;
-static int psmouse_set_maxproto(const char *val, struct kernel_param *kp);
-static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp);
+int psmouse_set_maxproto(const char *val, struct kernel_param *kp);
+int psmouse_get_maxproto(char *buffer, struct kernel_param *kp);
 #define param_check_proto_abbrev(name, p)	__param_check(name, p, unsigned int)
 #define param_set_proto_abbrev			psmouse_set_maxproto
 #define param_get_proto_abbrev			psmouse_get_maxproto
@@ -1570,7 +1570,7 @@ static ssize_t psmouse_attr_set_resolution(struct psmouse *psmouse, void *data,
 }
 
 
-static int psmouse_set_maxproto(const char *val, struct kernel_param *kp)
+int psmouse_set_maxproto(const char *val, struct kernel_param *kp)
 {
 	const struct psmouse_protocol *proto;
 
@@ -1587,7 +1587,7 @@ static int psmouse_set_maxproto(const char *val, struct kernel_param *kp)
 	return 0;
 }
 
-static int psmouse_get_maxproto(char *buffer, struct kernel_param *kp)
+int psmouse_get_maxproto(char *buffer, struct kernel_param *kp)
 {
 	int type = *((unsigned int *)kp->arg);
 
Comment 10 Meelis Roos 2007-09-30 01:39:39 UTC
Yes, this fixes it for me too. However, there are more gcc-4.2 problems on alpha so this patch alone is not worth rushing in ASAP.
Comment 11 Dmitry Torokhov 2010-02-23 22:54:28 UTC
Is Alpha still b0rken? BTW, I'd rather not change these functions to be globals.
Comment 12 Meelis Roos 2010-03-05 13:08:56 UTC
2.6.33+git seems to compile fine on alpha with gcc 4.4.3, without any patch to psmouse.

Note You need to log in before you can comment on or make changes to this bug.