2005-03-10 00:29:28

by Jeff Dike

[permalink] [raw]
Subject: [PATCH 4/9] UML - Export gcov symbol based on gcc version

The init function called by gcc when gcov is enabled is __gcov_init or
__bb_init_func, depending on the gcc version. Anton is using 3.3.4 and
seeing __gcov_init. I'm using 3.3.2 and seeing __bb_init_func, so we need
to close that gap a bit.

Signed-off-by: Jeff Dike <[email protected]>

Index: linux-2.6.11/arch/um/kernel/gmon_syms.c
===================================================================
--- linux-2.6.11.orig/arch/um/kernel/gmon_syms.c 2005-03-07 10:53:03.000000000 -0500
+++ linux-2.6.11/arch/um/kernel/gmon_syms.c 2005-03-07 16:29:37.000000000 -0500
@@ -5,8 +5,14 @@

#include "linux/module.h"

+#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3) || \
+ (__GNUC__ == 3 && __GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ >= 4)
+extern void __gcov_init(void *);
+EXPORT_SYMBOL(__gcov_init);
+#else
extern void __bb_init_func(void *);
EXPORT_SYMBOL(__bb_init_func);
+#endif

/*
* Overrides for Emacs so that we follow Linus's tabbing style.


2005-03-10 22:57:12

by Adrian Bunk

[permalink] [raw]
Subject: Re: [PATCH 4/9] UML - Export gcov symbol based on gcc version

On Wed, Mar 09, 2005 at 09:16:02PM -0500, Jeff Dike wrote:
> The init function called by gcc when gcov is enabled is __gcov_init or
> __bb_init_func, depending on the gcc version. Anton is using 3.3.4 and
> seeing __gcov_init. I'm using 3.3.2 and seeing __bb_init_func, so we need
> to close that gap a bit.
>
> Signed-off-by: Jeff Dike <[email protected]>
>
> Index: linux-2.6.11/arch/um/kernel/gmon_syms.c
> ===================================================================
> --- linux-2.6.11.orig/arch/um/kernel/gmon_syms.c 2005-03-07 10:53:03.000000000 -0500
> +++ linux-2.6.11/arch/um/kernel/gmon_syms.c 2005-03-07 16:29:37.000000000 -0500
> @@ -5,8 +5,14 @@
>
> #include "linux/module.h"
>
> +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3) || \
> + (__GNUC__ == 3 && __GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ >= 4)
>...

This patch is still wrong.

It seems my comment on this [1] was lost:

<-- snip -->

This line has to be something like

( (__GNUC__ == 3 && __GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ >= 4) && \
HEAVILY_PATCHED_SUSE_GCC )

I hope SuSE has added some #define to distinguish what they call
"gcc 3.3.4" from GNU gcc 3.3.4

<-- snip -->


cu
Adrian

[1] http://www.ussg.iu.edu/hypermail/linux/kernel/0503.0/1876.html

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2005-03-10 23:27:04

by Linus Torvalds

[permalink] [raw]
Subject: Re: [PATCH 4/9] UML - Export gcov symbol based on gcc version



On Thu, 10 Mar 2005, Adrian Bunk wrote:
>
> This patch is still wrong.

Can't we just fix it by havign an alias for both names? It seems stupid to
jump through hoops and worry about compiler versions, when afaik we could
just do something like

extern xxxx(...) __attribute__((alias("yyyy")));

instead. Exact details left to the reader who knows more about all the
magic gcc/linker things..

Linus

2005-03-11 16:16:42

by Jeff Dike

[permalink] [raw]
Subject: Re: [PATCH 4/9] UML - Export gcov symbol based on gcc version

[email protected] said:
> Can't we just fix it by havign an alias for both names? It seems
> stupid to jump through hoops and worry about compiler versions, when
> afaik we could just do something like

> extern xxxx(...) __attribute__((alias("yyyy")));

> instead. Exact details left to the reader who knows more about all the
> magic gcc/linker things..

OK, this exceeds my current linker-fu, but I'll take a look and get a better
fix for this.

Jeff

2005-03-11 16:18:33

by Jeff Dike

[permalink] [raw]
Subject: Re: [PATCH 4/9] UML - Export gcov symbol based on gcc version

[email protected] said:
> This patch is still wrong.
> It seems my comment on this [1] was lost:
> <-- snip -->
> This line has to be something like
> ( (__GNUC__ == 3 && __GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ >= 4)
> && \
> HEAVILY_PATCHED_SUSE_GCC )

> I hope SuSE has added some #define to distinguish what they call "gcc
> 3.3.4" from GNU gcc 3.3.4

It wasn't lost - I am just disinclined to cater to distros making their
gcc lie about its version.

Jeff

2005-03-11 16:55:33

by Adrian Bunk

[permalink] [raw]
Subject: Re: [PATCH 4/9] UML - Export gcov symbol based on gcc version

On Fri, Mar 11, 2005 at 01:48:54PM -0500, Jeff Dike wrote:
> [email protected] said:
> > This patch is still wrong.
> > It seems my comment on this [1] was lost:
> > <-- snip -->
> > This line has to be something like
> > ( (__GNUC__ == 3 && __GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ >= 4)
> > && \
> > HEAVILY_PATCHED_SUSE_GCC )
>
> > I hope SuSE has added some #define to distinguish what they call "gcc
> > 3.3.4" from GNU gcc 3.3.4
>
> It wasn't lost - I am just disinclined to cater to distros making their
> gcc lie about its version.

And therefore you added a patch that helps only those distros at the
price of breaking other people and distros using sane compilers?

> Jeff

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2005-03-11 17:01:39

by stian

[permalink] [raw]
Subject: Re: [uml-devel] Re: [PATCH 4/9] UML - Export gcov symbol based on gcc version

>> > ( (__GNUC__ == 3 && __GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ >= 4)
>> > && \
>> > HEAVILY_PATCHED_SUSE_GCC )
>> > I hope SuSE has added some #define to distinguish what they call "gcc
>> > 3.3.4" from GNU gcc 3.3.4
>> It wasn't lost - I am just disinclined to cater to distros making their
>> gcc lie about its version.
> And therefore you added a patch that helps only those distros at the
> price of breaking other people and distros using sane compilers?

A dirty method would be to use a configure prinsip to test-compile, and
have a define that depends on it. Perhaps dirty, conserning kbuild, but
resolves problems, unless the alias symbol works.

Stian

2005-03-11 17:25:10

by Blaisorblade

[permalink] [raw]
Subject: Re: [uml-devel] Re: [PATCH 4/9] UML - Export gcov symbol based on gcc version

On Thursday 10 March 2005 23:53, Adrian Bunk wrote:
> On Wed, Mar 09, 2005 at 09:16:02PM -0500, Jeff Dike wrote:
> > The init function called by gcc when gcov is enabled is __gcov_init or
> > __bb_init_func, depending on the gcc version. Anton is using 3.3.4 and
> > seeing __gcov_init. I'm using 3.3.2 and seeing __bb_init_func, so we
> > need to close that gap a bit.
> >
> > Signed-off-by: Jeff Dike <[email protected]>
> >
> > Index: linux-2.6.11/arch/um/kernel/gmon_syms.c
> > ===================================================================
> > --- linux-2.6.11.orig/arch/um/kernel/gmon_syms.c 2005-03-07
> > 10:53:03.000000000 -0500 +++
> > linux-2.6.11/arch/um/kernel/gmon_syms.c 2005-03-07 16:29:37.000000000
> > -0500 @@ -5,8 +5,14 @@
> >
> > #include "linux/module.h"
> >
> > +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3) || \
> > + (__GNUC__ == 3 && __GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ >= 4)
> >...
>
> This patch is still wrong.
>
> It seems my comment on this [1] was lost:
>
> <-- snip -->
>
> This line has to be something like
>
> ( (__GNUC__ == 3 && __GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ >= 4) && \
> HEAVILY_PATCHED_SUSE_GCC )
>
> I hope SuSE has added some #define to distinguish what they call
> "gcc 3.3.4" from GNU gcc 3.3.4
"You hope" does not mean "it exists".
Secondly, the patch is wrong anyway, as I said elsewhere.
--
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade

2005-03-11 17:25:00

by Blaisorblade

[permalink] [raw]
Subject: Re: [uml-devel] Re: [PATCH 4/9] UML - Export gcov symbol based on gcc version

On Friday 11 March 2005 00:21, Linus Torvalds wrote:
> On Thu, 10 Mar 2005, Adrian Bunk wrote:
> > This patch is still wrong.
>
> Can't we just fix it by havign an alias for both names?
No, because the patch is wrong. It should export both symbols in the second
case.
> It seems stupid to
> jump through hoops and worry about compiler versions, when afaik we could
> just do something like
>
> extern xxxx(...) __attribute__((alias("yyyy")));
>
> instead. Exact details left to the reader who knows more about all the
> magic gcc/linker things..
>
> Linus

--
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade


2005-03-11 19:45:39

by Blaisorblade

[permalink] [raw]
Subject: Re: [uml-devel] [PATCH 4/9] UML - Export gcov symbol based on gcc version

On Thursday 10 March 2005 03:16, Jeff Dike wrote:
> The init function called by gcc when gcov is enabled is __gcov_init or
> __bb_init_func, depending on the gcc version. Anton is using 3.3.4 and
> seeing __gcov_init. I'm using 3.3.2 and seeing __bb_init_func, so we need
> to close that gap a bit.

I'll have to undo this patch... I said that you must export both symbols when
GCC version is the right one.

And I can say this version is > 3.3.4, since my good Gentoo's 3.3.4 does not
include this symbol.

We rediscussed this with Jeff, and I'll post a better patch:
EXPORT_SYMBOL(__gcov_init), and weakly define it to an empty function. I'll
do it tomorrow.

> Signed-off-by: Jeff Dike <[email protected]>
>
> Index: linux-2.6.11/arch/um/kernel/gmon_syms.c
> ===================================================================
> --- linux-2.6.11.orig/arch/um/kernel/gmon_syms.c 2005-03-07
> 10:53:03.000000000 -0500 +++
> linux-2.6.11/arch/um/kernel/gmon_syms.c 2005-03-07 16:29:37.000000000 -0500
> @@ -5,8 +5,14 @@
>
> #include "linux/module.h"
>
> +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 3) || \
> + (__GNUC__ == 3 && __GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ >= 4)
> +extern void __gcov_init(void *);
> +EXPORT_SYMBOL(__gcov_init);
> +#else
> extern void __bb_init_func(void *);
> EXPORT_SYMBOL(__bb_init_func);
> +#endif
>
> /*
> * Overrides for Emacs so that we follow Linus's tabbing style.


--
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade

2005-03-11 22:22:52

by Jeff Dike

[permalink] [raw]
Subject: Re: [PATCH 4/9] UML - Export gcov symbol based on gcc version

[email protected] said:
> And therefore you added a patch that helps only those distros at the
> price of breaking other people and distros using sane compilers?

Didn't you start this thread by pointing out that SuSE has a gcc 3.3.4
which isn't? I would call that a compiler which lies about its version, and
for the purposes of this argument, I would say that it is not a sane
compiler.

Given this, your original (correct) claim was that my patch would not help
such compilers. Are you now claiming that it does help such compilers, and
no one else?

Jeff


2005-03-11 23:44:24

by Adrian Bunk

[permalink] [raw]
Subject: Re: [PATCH 4/9] UML - Export gcov symbol based on gcc version

On Fri, Mar 11, 2005 at 06:53:15PM -0500, Jeff Dike wrote:
> [email protected] said:
> > And therefore you added a patch that helps only those distros at the
> > price of breaking other people and distros using sane compilers?
>
> Didn't you start this thread by pointing out that SuSE has a gcc 3.3.4
> which isn't? I would call that a compiler which lies about its version, and
> for the purposes of this argument, I would say that it is not a sane
> compiler.

I said:

<-- snip -->

This line has to be something like

( (__GNUC__ == 3 && __GNUC_MINOR__ == 3 && __GNUC_PATCHLEVEL__ >= 4) && \
HEAVILY_PATCHES_SUSE_GCC )

<-- snip -->

IOW:
Only heavily patches gcc 3.3 compiler define __gcov_init.


Anton's original report said that he needs __gcov_init with
SuSE gcc 3.3.4 .


> Given this, your original (correct) claim was that my patch would not help
> such compilers. Are you now claiming that it does help such compilers, and
> no one else?

No, my claim is that no sane gcc 3.3 defines __gcov_init.

> Jeff

cu
Adrian

--

"Is there not promise of rain?" Ling Tan asked suddenly out
of the darkness. There had been need of rain for many days.
"Only a promise," Lao Er said.
Pearl S. Buck - Dragon Seed

2005-03-12 01:18:36

by Jeff Dike

[permalink] [raw]
Subject: Re: [PATCH 4/9] UML - Export gcov symbol based on gcc version

[email protected] said:
> No, my claim is that no sane gcc 3.3 defines __gcov_init.

Ah, OK. Thanks for the clarification.

Jeff