[U-Boot] compiled failed when turned off gcc optimazition

2013-07-01 Thread TigerLiu
Hi, experts:
I tried to turn off gcc optimazition by changing config.mk file:
OPTFLAGS= -O0 #-fomit-frame-pointer

But failed to compile u-boot, it tipped:
..
/home/lion/Origen0921/arm-2010.09/bin/arm-none-eabi-ld:
arch/arm/cpu/armv7/libarmv7.o: relocation R_ARM_MOVW_ABS_NC against `a
local symbol' can not be used when making a shared object; recompile
with -fPIC
arch/arm/cpu/armv7/libarmv7.o: could not read symbols: Bad value
make[1]: *** [u-boot] Error 1
make[1]: Leaving directory `/home/lion/DebugLinux/uboot-0627/u-boot'
make: *** [smdkc100] Error 2


Best wishes,
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] compiled failed when turned off gcc optimazition

2013-07-01 Thread Wolfgang Denk
Dear tiger...@viatech.com.cn,

In message  you 
wrote:
>
> I tried to turn off gcc optimazition by changing config.mk file:
> OPTFLAGS= -O0 #-fomit-frame-pointer
> 
> But failed to compile u-boot, it tipped:

Don't do it, then.

Q: why would you want to switch off optimization?  That's almost
always a bad idea...

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: w...@denx.de
I have made mistakes, but have never made the mistake of  claiming  I
never made one. - James G. Bennet
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] compiled failed when turned off gcc optimazition

2013-07-01 Thread TigerLiu
Hi, Denk:
During debug u-boot with JTAG tools, maybe turning off optimizations was 
recommended.

Best wishes,
-邮件原件-
发件人: Wolfgang Denk [mailto:w...@denx.de] 
发送时间: 2013年7月1日 18:03
收件人: Tiger Liu
抄送: u-boot@lists.denx.de
主题: Re: [U-Boot] compiled failed when turned off gcc optimazition

Dear tiger...@viatech.com.cn,

In message  you 
wrote:
>
> I tried to turn off gcc optimazition by changing config.mk file:
> OPTFLAGS= -O0 #-fomit-frame-pointer
> 
> But failed to compile u-boot, it tipped:

Don't do it, then.

Q: why would you want to switch off optimization?  That's almost
always a bad idea...

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: w...@denx.de
I have made mistakes, but have never made the mistake of  claiming  I
never made one. - James G. Bennet
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] compiled failed when turned off gcc optimazition

2013-07-01 Thread Wolfgang Denk
Dear tiger...@viatech.com.cn,

please do not top post / full quote.

In message  you 
wrote:
>
> During debug u-boot with JTAG tools, maybe turning off optimizations was 
> recommended.

Many people recommend many things. Even strange or non-working or
incorrect or dangerous ones.

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: w...@denx.de
There's no future in time travel.
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] compiled failed when turned off gcc optimazition

2013-07-01 Thread Mike Dunn
On 07/01/2013 04:37 AM, Wolfgang Denk wrote:
> Dear tiger...@viatech.com.cn,
> 
> please do not top post / full quote.
> 
> In message  
> you wrote:
>>
>> During debug u-boot with JTAG tools, maybe turning off optimizations was 
>> recommended.
> 
> Many people recommend many things. Even strange or non-working or
> incorrect or dangerous ones.


A while back I tried this for the Linux kernel, with similiar results.  I just
let it go without investigating further, guessing that maybe some tricks with
compiler directives were incompatible with turning off optimization.

But there's a good motivation for wanting to turn off optimization.
Single-stepping with a debugger at the C source level is almost useless.  I've
since gotten better at single-stepping at the assembly level while using the
mixed c and assembly view of gdb.

Mike

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] compiled failed when turned off gcc optimazition

2013-07-01 Thread Wolfgang Denk
Dear Mike Dunn,

In message <51d1c455.9010...@newsguy.com> you wrote:
>
> But there's a good motivation for wanting to turn off optimization.

I disagree here.  If you are hunting down a problem, you want to be as
close at the original code as possible.  Disabling optimization is
such a dramatic change to the generated code that you actually debug a
different program.

> Single-stepping with a debugger at the C source level is almost useless.  I've
> since gotten better at single-stepping at the assembly level while using the
> mixed c and assembly view of gdb.

Hm... Did you read up the documentation, say [1], and try out these
recommendations?

[1] http://www.denx.de/wiki/view/DULG/DebuggingTricks

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: w...@denx.de
You've no idea of what a poor opinion  I  have  of  myself,  and  how
little I deserve it.  - W. S. Gilbert
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] compiled failed when turned off gcc optimazition

2013-07-02 Thread Mike Dunn
On 07/01/2013 12:51 PM, Wolfgang Denk wrote:
> Dear Mike Dunn,
> 
> In message <51d1c455.9010...@newsguy.com> you wrote:
>>
>> But there's a good motivation for wanting to turn off optimization.
> 
> I disagree here.  If you are hunting down a problem, you want to be as
> close at the original code as possible.  Disabling optimization is
> such a dramatic change to the generated code that you actually debug a
> different program.


I guess it depends on what problem being debugged...  I think your point is
valid for things like tracking down race conditions or misbehaving hardware.
But for more mundane problems like logical errors in the code, optimizations get
in the way.  It would be nice to be able to experiment with optimizations off.
Just knowing that a particular problem still exists when unoptimized code is run
will provide some clues.


> 
>> Single-stepping with a debugger at the C source level is almost useless.  
>> I've
>> since gotten better at single-stepping at the assembly level while using the
>> mixed c and assembly view of gdb.
> 
> Hm... Did you read up the documentation, say [1], and try out these
> recommendations?
> 
> [1] http://www.denx.de/wiki/view/DULG/DebuggingTricks


No, but I will.  Many thanks!
Mike

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] compiled failed when turned off gcc optimazition

2013-07-02 Thread Graeme Russ
Hi Mike,

On Wed, Jul 3, 2013 at 5:40 AM, Mike Dunn  wrote:

> On 07/01/2013 12:51 PM, Wolfgang Denk wrote:
> > Dear Mike Dunn,
> >
> > In message <51d1c455.9010...@newsguy.com> you wrote:
> >>
> >> But there's a good motivation for wanting to turn off optimization.
> >
> > I disagree here.  If you are hunting down a problem, you want to be as
> > close at the original code as possible.  Disabling optimization is
> > such a dramatic change to the generated code that you actually debug a
> > different program.
>
>
> I guess it depends on what problem being debugged...  I think your point is
> valid for things like tracking down race conditions or misbehaving
> hardware.
> But for more mundane problems like logical errors in the code,
> optimizations get
> in the way.  It would be nice to be able to experiment with optimizations
> off.
> Just knowing that a particular problem still exists when unoptimized code
> is run
> will provide some clues.
>
>
Do be honest, I have never used an online debugger

I have always found that a combination of hardware LEDs and printf's has
been more than sufficient, particularly for mundane issues.

I'll freely admit that an online debugger might been faster for me, but I
just wanted to point out that there is more than one way to skin a cat.

I also believe that the more onerous the debugging tool is (and it doesn't
get more so than using the hardware LEDs) the more attention you pay to the
code rather than the output ;)

Regards,

Graeme
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] compiled failed when turned off gcc optimazition

2013-07-05 Thread TigerLiu
Hi, experts:

Would any expert fix this question?

It seems related MOVW instruction's usuage when turning off gcc
optimazition.

 

If i just turned on "-O1" or "-O2", still failed to compile uboot code.

 

Best wishes,

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot