wierd gcc behaviour

Guest (guest@manjak.knm.org.pl)
Tue, 19 Jan 1999 23:00:07 +0100


Hello,

I was trying to compile a kernel module with g++ compiler. All
goes fine until I enable optimization (-O, -O2). When I looked
at assembler output I spotted a little problem. I think the
diff below is self explanatory:

--- test-without-optimization.s Tue Jan 19 22:55:48 1999
+++ test.s Tue Jan 19 22:57:03 1999
@@ -1,12 +1,15 @@
.file "test.c"
.version "01.01"
/ GNU C++ version egcs-2.90.27 980315 (egcs-1.0.2 release) (i386-redhat-linux)
compiled by GNU C version egcs-2.90.27 980315 (egcs-1.0.2 release).
-/ options passed:
-/ options enabled: -fpeephole -ffunction-cse -fkeep-static-consts
-/ -fpcc-struct-return -fsched-interblock -fsched-spec -fexceptions -fcommon
-/ -fverbose-asm -fgnu-linker -fargument-alias -m80387 -mhard-float
-/ -mno-soft-float -mieee-fp -mfp-ret-in-387 -mschedule-prologue -mcpu=i386
-/ -march=pentium
+/ options passed: -O2
+/ options enabled: -fdefer-pop -fcse-follow-jumps -fcse-skip-blocks
+/ -fexpensive-optimizations -fthread-jumps -fstrength-reduce -fpeephole
+/ -fforce-mem -ffunction-cse -finline -fkeep-static-consts -fcaller-saves
+/ -fpcc-struct-return -frerun-cse-after-loop -frerun-loop-opt
+/ -fschedule-insns2 -fsched-interblock -fsched-spec -fexceptions -fcommon
+/ -fverbose-asm -fgnu-linker -fregmove -falias-check -fargument-alias
+/ -m80387 -mhard-float -mno-soft-float -mieee-fp -mfp-ret-in-387
+/ -mschedule-prologue -mcpu=i386 -march=pentium
[...]
.Lfe2:
.size cleanup_module__Fv,.Lfe2-cleanup_module__Fv
-.section .modinfo,"a",@progbits
- .type __module_kernel_version,@object
- .size __module_kernel_version,26
-__module_kernel_version:
- .string "kernel_version=2.2.0-pre8"

This is the important bit. My question is: why g++ get rid of this
section when I enable optimization ?

Thanks in advance,
Martin

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/