public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] Turning optimizations off
@ 2009-05-28 20:05 Fahd Abidi
  2009-05-28 22:04 ` Wolfgang Denk
  2009-05-29 15:12 ` Jerry Van Baren
  0 siblings, 2 replies; 3+ messages in thread
From: Fahd Abidi @ 2009-05-28 20:05 UTC (permalink / raw)
  To: u-boot

Hello,
 
I am debugging u-boot with a BDI and am running into a case where a
variable gets optimized out. For the sake of debugging I am trying to
turn off optimizations.
I have the following in u-boot-2009.01/config.mk, but GDB still reports
optimizations:

OPTFLAGS= -Os -fno-schedule-insns -fno-schedule-insns2
#-fomit-frame-pointer

(gdb) stepi

0x0ff78750 in get_table_entry_name (table=<value optimized out>,

msg=0xff9e1a8 "Unknown Architecture", id=7) at image.c:544

544 }

Does anyone know how to completely turn optimization off? Using no -O
flag results in u-boot not compiling.
 
Fahd Abidi
Product Manager - Technical Tools and Development
Ultimate Solutions, Inc.
================================================================
Your Single Source for Professional Development Tools and Embedded
Solutions
Ph: 978-455-3383 x255
Fx: 978-926-3091
Email: fabidi at ultsol.com
Visit: http://www.ultsol.com <http://www.ultsol.com/>  
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] Turning optimizations off
  2009-05-28 20:05 [U-Boot] Turning optimizations off Fahd Abidi
@ 2009-05-28 22:04 ` Wolfgang Denk
  2009-05-29 15:12 ` Jerry Van Baren
  1 sibling, 0 replies; 3+ messages in thread
From: Wolfgang Denk @ 2009-05-28 22:04 UTC (permalink / raw)
  To: u-boot

Dear "Fahd Abidi",

In message <71DEA556544D7A4F9C6848402D8184340C45D7@usi01.ultsol.local> you wrote:
>
> I have the following in u-boot-2009.01/config.mk, but GDB still reports
> optimizations:
>
> OPTFLAGS= -Os -fno-schedule-insns -fno-schedule-insns2
> #-fomit-frame-pointer

Well, "-Os" means "optimize for minimal code size"...

> (gdb) stepi
>
> 0x0ff78750 in get_table_entry_name (table=<value optimized out>,

... so it is only natural that GCC will eliminate unneeded code.

> Does anyone know how to completely turn optimization off? Using no -O
> flag results in u-boot not compiling.

You cannot globally disable optimization. You might get away with
doing this on a per-file level, but there is no guarantee for that.

It is better to arrange to keep optimization turned on - after all,
this is the real code that will later be running.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
It is your destiny.                                     - Darth Vader

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [U-Boot] Turning optimizations off
  2009-05-28 20:05 [U-Boot] Turning optimizations off Fahd Abidi
  2009-05-28 22:04 ` Wolfgang Denk
@ 2009-05-29 15:12 ` Jerry Van Baren
  1 sibling, 0 replies; 3+ messages in thread
From: Jerry Van Baren @ 2009-05-29 15:12 UTC (permalink / raw)
  To: u-boot

Fahd Abidi wrote:
> Hello,
>  
> I am debugging u-boot with a BDI and am running into a case where a
> variable gets optimized out. For the sake of debugging I am trying to
> turn off optimizations.
> I have the following in u-boot-2009.01/config.mk, but GDB still reports
> optimizations:
> 
> OPTFLAGS= -Os -fno-schedule-insns -fno-schedule-insns2
> #-fomit-frame-pointer
> 
> (gdb) stepi
> 
> 0x0ff78750 in get_table_entry_name (table=<value optimized out>,

If you (temporarily) put "volatile" on the variable, the compiler should 
not optimize it out.  Obviously, this is a limited solution, but may get 
your past your problem.

[snip]

> Does anyone know how to completely turn optimization off? Using no -O
> flag results in u-boot not compiling.

Theoretically, you could compile individual files w/o optimization (e.g. 
if you compile it by hand, make shouldn't re-compile it).  I doubt that 
you want to go there, though...

> Fahd Abidi

Good luck,
gvb

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-05-29 15:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-28 20:05 [U-Boot] Turning optimizations off Fahd Abidi
2009-05-28 22:04 ` Wolfgang Denk
2009-05-29 15:12 ` Jerry Van Baren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox