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

LFS Trac trac at linuxfromscratch.org
Wed May 19 13:04:41 PDT 2010

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

Comment(by bdubbs@…):

 Replying to [comment:2 matthew@…]:

 > What I'm thinking is if you could change the Kernel Makefile to set '-Os
 -fno-<optimzation option>' instead of plain '-Os' to selectively turn off
 individual optimization options that are explicitly mentioned in the
 manual as being turned on by '-Os'.  I realise that this is probably going
 to be a fair bit of work unless you hit really lucky, so understand if you
 don't want to expend that effort.

 What I have to do to test this in the kernel is to remove the offending .o
 file, change the Makefile and remake the kernel.  That wouldn't be too
 bad, but each test requires rebooting.  Because I don't have an emulator
 on the target system, a crash means that I have to power cycle.

 I suppose I could do:

 -Os -fno<option1> -fno<option2> ...

 Which should work if I disable all the options.  Then removing the no from
 the options one at a time should work each time until I get to the problem
 From my reading, I suspect either -finline-small-functions or -findirect-

 Even that technique concerns me because of the statement "-Os enables all
 -O2 optimizations that do not typically increase code size. It also
 performs further optimizations designed to reduce code size."

 I don't know what the "further" optimizations are.

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

More information about the lfs-book mailing list