I found that gcc 4.7 has
- changed struct gcov_info format. Compare gcc/gcov-io.h with kernel/gcov/gcov.h.
- renamed the elf section name of the constructor from .ctors to .init_array.
These break kernel/gcov coverage monitor descried in Documentation/gcov.txt.
First, __gcov_init is not called upon module load. You see no *.gcda or *.gcno files under /sys/kernel/debug/gcov.
Second, even if you fix kernel/module.c and replace ".ctors" with ".init_array", __gcov_init is called with wrong gcov_info format, thereby causing random malloc failure and maybe kernel crash.
I do not know exactly when gcc has made these changes, but at least, it is broken on Fedora 17 gcc 4.7.
In Japanese
gcc 4.7 では、gcov_info 構造体が変わっているのと、コンストラクターと呼ばれる ELF セクションの名前が .ctors から .init_array になっているため、Linux カーネルのカバレッジモニター kernel/gcov が動かなくなっています。
まず、モジュールロードで呼ばれるはずの、__gcov_init が、セクション名が違うために、呼ばれません。このため、 /sys/kernel/debug/gcov の下に、*.gcda, *.gcno ファイルが現れません。
kernel/module.c にある、セクション名を、無理やり変えて動かすと、今度は、メモリがとれないと言われませす。
gcov_info が変わったために、ごみを見るためです。
正確に、gcc のいつからこうなったのかは知りません。カーネル側の人は、諦めているのでしょうかね。