[LFS Trac] #2662: gcc 4.5.0 -Os does not generate correct code

LFS Trac trac at linuxfromscratch.org
Wed Jun 2 21:31:27 PDT 2010


#2662: gcc 4.5.0 -Os does not generate correct code
-----------------------------------------+----------------------------------
 Reporter:  bdubbs@…                     |       Owner:  bdubbs@…                   
     Type:  defect                       |      Status:  assigned                   
 Priority:  high                         |   Milestone:  6.7                        
Component:  Book                         |     Version:  SVN                        
 Severity:  major                        |    Keywords:                             
-----------------------------------------+----------------------------------

Comment(by hohoxu_hao115):

 Replying to [comment:8 bdubbs@…]:
 > Replying to [comment:7 hohoxu_hao115]:
 > > I think this bug is hardware dependent.My kernel compiled by gcc-4.5
 for x86_64,with or without size optimization,has no problems.
 >
 > Thanks for the feedback.  The obvious question is "Did it boot
 properly."  The build normally completes, but the kernel panics upon boot.
 >
 > Can you post the results of `cat \proc\cpuinfo`
 >
 > It would also help if you could run the following from the kernel
 directory:
 >
 > gcc -Wp,-MD,arch/x86/kernel/.tsc.o.d  -nostdinc -isystem
 > /usr/lib/gcc/x86_64-unknown-linux-gnu/4.5.1/include
 > -I/sources/linux-2.6.33.4-gcc45/arch/x86/include -Iinclude  -include
 > include/generated/autoconf.h -D__KERNEL__ -Wall -Wundef -Wstrict-
 prototypes
 > -Wno-trigraphs -fno-strict-aliasing -fno-common
 > -Werror-implicit-function-declaration -Wno-format-security
 > -fno-delete-null-pointer-checks -Os -m64 -march=core2 -mno-red-zone
 > -mcmodel=kernel -funit-at-a-time -maccumulate-outgoing-args
 -DCONFIG_AS_CFI=1
 > -DCONFIG_AS_CFI_SIGNAL_FRAME=1 -pipe -Wno-sign-compare
 > -fno-asynchronous-unwind-tables -mno-sse -mno-mmx -mno-sse2 -mno-3dnow
 > -Wframe-larger-than=2048 -fno-stack-protector -fno-omit-frame-pointer
 > -fno-optimize-sibling-calls -Wdeclaration-after-statement -Wno-pointer-
 sign
 > -fno-strict-overflow -fno-dwarf2-cfi-asm -fconserve-stack -fno-stack-
 protector
 >  -D"KBUILD_STR(s)=#s" -D"KBUILD_BASENAME=KBUILD_STR(tsc)"
 > -D"KBUILD_MODNAME=KBUILD_STR(tsc)"  -S -c -o arch/x86/kernel/tsc.S
 > arch/x86/kernel/tsc.c
 >
 > and post arch/x86/kernel/tsc.S as an attachment
 >
 > If you can check your log of the build, where arch/x86/kernel/tsc.c is
 built, does it match the above build string?

 Yes,it boots fine.

 /proc/cpuinfo:
 {{{
 processor       : 0
 vendor_id       : GenuineIntel
 cpu family      : 6
 model           : 37
 model name      : Intel(R) Core(TM) i3 CPU       M 330  @ 2.13GHz
 stepping        : 2
 cpu MHz         : 933.000
 cache size      : 3072 KB
 physical id     : 0
 siblings        : 4
 core id         : 0
 cpu cores       : 2
 apicid          : 0
 initial apicid  : 0
 fpu             : yes
 fpu_exception   : yes
 cpuid level     : 11
 wp              : yes
 flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
 cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology
 nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16
 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm arat tpr_shadow vnmi flexpriority
 ept vpid
 bogomips        : 4256.09
 clflush size    : 64
 cache_alignment : 64
 address sizes   : 36 bits physical, 48 bits virtual
 power management:

 processor       : 1
 vendor_id       : GenuineIntel
 cpu family      : 6
 model           : 37
 model name      : Intel(R) Core(TM) i3 CPU       M 330  @ 2.13GHz
 stepping        : 2
 cpu MHz         : 933.000
 cache size      : 3072 KB
 physical id     : 0
 siblings        : 4
 core id         : 0
 cpu cores       : 2
 apicid          : 1
 initial apicid  : 1
 fpu             : yes
 fpu_exception   : yes
 cpuid level     : 11
 wp              : yes
 flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
 cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology
 nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16
 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm arat tpr_shadow vnmi flexpriority
 ept vpid
 bogomips        : 4255.76
 clflush size    : 64
 cache_alignment : 64
 address sizes   : 36 bits physical, 48 bits virtual
 power management:

 processor       : 2
 vendor_id       : GenuineIntel
 cpu family      : 6
 model           : 37
 model name      : Intel(R) Core(TM) i3 CPU       M 330  @ 2.13GHz
 stepping        : 2
 cpu MHz         : 933.000
 cache size      : 3072 KB
 physical id     : 0
 siblings        : 4
 core id         : 2
 cpu cores       : 2
 apicid          : 4
 initial apicid  : 4
 fpu             : yes
 fpu_exception   : yes
 cpuid level     : 11
 wp              : yes
 flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
 cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology
 nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16
 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm arat tpr_shadow vnmi flexpriority
 ept vpid
 bogomips        : 4255.77
 clflush size    : 64
 cache_alignment : 64
 address sizes   : 36 bits physical, 48 bits virtual
 power management:

 processor       : 3
 vendor_id       : GenuineIntel
 cpu family      : 6
 model           : 37
 model name      : Intel(R) Core(TM) i3 CPU       M 330  @ 2.13GHz
 stepping        : 2
 cpu MHz         : 933.000
 cache size      : 3072 KB
 physical id     : 0
 siblings        : 4
 core id         : 2
 cpu cores       : 2
 apicid          : 5
 initial apicid  : 5
 fpu             : yes
 fpu_exception   : yes
 cpuid level     : 11
 wp              : yes
 flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
 cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx
 rdtscp lm constant_tsc arch_perfmon pebs bts rep_good xtopology
 nonstop_tsc aperfmperf pni dtes64 monitor ds_cpl vmx est tm2 ssse3 cx16
 xtpr pdcm sse4_1 sse4_2 popcnt lahf_lm arat tpr_shadow vnmi flexpriority
 ept vpid
 bogomips        : 4255.77
 clflush size    : 64
 cache_alignment : 64
 address sizes   : 36 bits physical, 48 bits virtual
 power management:
 }}}

 and I checked the build command of tsc.o, I can't find any differences
 with yours except kernel source path.

 PS:In my build log,it's -D__KERNEL__, not -DKERNEL,may be this difference
 is related to kernel version(I use 2.6.34)?

 Sorry for my english.

-- 
Ticket URL: <http://wiki.linuxfromscratch.org/lfs/ticket/2662#comment:10>
LFS Trac <http://wiki.linuxfromscratch.org/lfs/>
Linux From Scratch: Your Distro, Your Rules.



More information about the lfs-book mailing list