Skip to contentSkip to conversation

UML - Export gcov symbol based on gcc version

PATCH In review Jeff Dike 5 participants 13 messages Mar 10, 2005 – Mar 12, 2005 User-mode Linux (UML)

lore
Share & tools
lore

Jeff Dike

author
#0 lore raw

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.

arch/um/kernel/gmon_syms.c +6 -0
Index: linux-2.6.11/arch/um/kernel/gmon_syms.c
===================================================================
@@ -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.

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#1 lore raw
Quoted 12 lines · Jeff Dike

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.

Index: linux-2.6.11/arch/um/kernel/gmon_syms.c
===================================================================

arch/um/kernel/gmon_syms.c line 9

Quoted 6 lines
arch/um/kernel/gmon_syms.c +2 -0
@@ -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

Signature · 16 lines
       "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



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#2 lore raw
Quoted 2 lines · Adrian Bunk

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

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

author
#3 lore raw
Quoted 8 lines · [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

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

author
#5 lore raw
In reply to Adrian Bunk
Quoted 10 lines · [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

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#6 lore raw
Quoted 9 lines · Jeff Dike
Quoted 7 lines · [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 )

Quoted 5 lines
Quoted 2 lines

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?

Quoted 1 line

Jeff

cu
Adrian

Signature · 4 lines
       "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
#7 lore raw
Quoted 9 lines
Quoted 7 lines
Quoted 5 lines

( (__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

#4 lore raw
In reply to Linus Torvalds
Quoted 4 lines · Linus Torvalds
Quoted 1 line · Adrian Bunk

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.

Quoted 10 lines

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

Signature · 3 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade
#11 lore raw
In reply to Adrian Bunk
Quoted 27 lines · Adrian Bunk
Quoted 14 lines · Jeff Dike

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.

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 @@

Quoted 5 lines

#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 -->

Quoted 7 lines

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.

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




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#12 lore raw
In reply to Jeff Dike
Quoted 4 lines · Jeff Dike

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.

Quoted 22 lines

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

arch/um/kernel/gmon_syms.c +6 -0
@@ -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.
Signature · 16 lines
Paolo Giarrusso, aka Blaisorblade
Linux registered user n. 292729
http://www.user-mode-linux.org/~blaisorblade




-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
author
#8 lore raw
In reply to Adrian Bunk
Quoted 2 lines · [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

-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#9 lore raw
Quoted 8 lines · Jeff Dike
Quoted 2 lines · [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 .

Quoted 3 lines

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.

Quoted 1 line

Jeff

cu
Adrian

Signature · 16 lines
       "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



-------------------------------------------------------
SF email is sponsored by - The IT Product Guide
Read honest & candid reviews on hundreds of IT Products from real users.
Discover which products truly live up to the hype. Start reading now.
http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
author
#10 lore raw
Quoted 1 line · [email protected] said:

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

Ah, OK. Thanks for the clarification.

Jeff