All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] Link the correct libgcc.a on ARMv4T architecture
@ 2010-09-08  7:54 Paul Hsu
  2010-09-08  8:16 ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Hsu @ 2010-09-08  7:54 UTC (permalink / raw)
  To: u-boot

If we use $(CC -print-libgcc-file-name) without option -march=armv4t,
we will link the wrong version libgcc.a(for ARMv5).
That causes cpu core raising excptions when u-boot running on the board.

Signed-off-by:Paul Hsu <pochun.hsu@gmail.com>
---
 Makefile |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/Makefile b/Makefile
index 4f1cb1b..978c9cd 100644
--- a/Makefile
+++ b/Makefile
@@ -259,6 +259,17 @@ LIBS := $(addprefix $(obj),$(LIBS))
 LIBBOARD = board/$(BOARDDIR)/lib$(BOARD).a
 LIBBOARD := $(addprefix $(obj),$(LIBBOARD))
 
+#check ARMV4T
+ifdef CPU
+ifeq ("$(CPU)","arm920t")
+ARMV4T := yes
+endif
+ifeq ("$(CPU)","arm720t")
+ARMV4T := yes
+endif
+endif
+
+
 # Add GCC lib
 ifdef USE_PRIVATE_LIBGCC
 ifeq ("$(USE_PRIVATE_LIBGCC)", "yes")
@@ -267,8 +278,12 @@ else
 PLATFORM_LIBGCC = -L $(USE_PRIVATE_LIBGCC) -lgcc
 endif
 else
+ifeq ("$(ARMV4T)","yes")
+PLATFORM_LIBGCC = -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name -march=armv4t`) -lgcc
+else
 PLATFORM_LIBGCC = -L $(shell dirname `$(CC) $(CFLAGS) -print-libgcc-file-name`) -lgcc
 endif
+endif
 PLATFORM_LIBS += $(PLATFORM_LIBGCC)
 export PLATFORM_LIBS
 
-- 
1.7.0.4

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

* [U-Boot] [PATCH] Link the correct libgcc.a on ARMv4T architecture
  2010-09-08  7:54 [U-Boot] [PATCH] Link the correct libgcc.a on ARMv4T architecture Paul Hsu
@ 2010-09-08  8:16 ` Wolfgang Denk
  2010-09-08  8:32   ` Paul Hsu
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2010-09-08  8:16 UTC (permalink / raw)
  To: u-boot

Dear Paul Hsu,

In message <1283932498-8989-1-git-send-email-pochun.hsu@gmail.com> you wrote:
> If we use $(CC -print-libgcc-file-name) without option -march=armv4t,
> we will link the wrong version libgcc.a(for ARMv5).
> That causes cpu core raising excptions when u-boot running on the board.

On which tool chain is this causing problems?

And how does this problem manifest?

> Signed-off-by:Paul Hsu <pochun.hsu@gmail.com>
> ---
>  Makefile |   15 +++++++++++++++
>  1 files changed, 15 insertions(+), 0 deletions(-)

NAK. If really needed, this needs to be fixed in ARM specific config
files / Makefiles, not in the top level Makefile.

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
core error - bus dumped

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

* [U-Boot] [PATCH] Link the correct libgcc.a on ARMv4T architecture
  2010-09-08  8:16 ` Wolfgang Denk
@ 2010-09-08  8:32   ` Paul Hsu
  2010-09-08  9:05     ` Wolfgang Denk
  0 siblings, 1 reply; 5+ messages in thread
From: Paul Hsu @ 2010-09-08  8:32 UTC (permalink / raw)
  To: u-boot

On Wed, Sep 8, 2010 at 4:16 PM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Paul Hsu,
>
> In message <1283932498-8989-1-git-send-email-pochun.hsu@gmail.com> you wrote:
>> If we use $(CC -print-libgcc-file-name) without option -march=armv4t,
>> we will link the wrong version libgcc.a(for ARMv5).
>> That causes cpu core raising excptions when u-boot running on the board.
>
> On which tool chain is this causing problems?

I use toolchain released by code sourcery(Sourcery G++ Lite 2010q1-202
for ARM GNU/Linux).

  $ /opt/arm-2010q1/bin/arm-none-linux-gnueabi-gcc
-print-libgcc-file-name -march=armv4t
  /opt/arm-2010q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/armv4t/libgcc.a
  This libgcc.a is a correct one we need on ARMv4T.

If you use the same command wihtout -march=armv4t
  $ /opt/arm-2010q1/bin/arm-none-linux-gnueabi-gcc -print-libgcc-file-name
  /opt/arm-2010q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/libgcc.a
  This is not the one we need.

>
> And how does this problem manifest?
>
>> Signed-off-by:Paul Hsu <pochun.hsu@gmail.com>
>> ---
>> ?Makefile | ? 15 +++++++++++++++
>> ?1 files changed, 15 insertions(+), 0 deletions(-)
>
> NAK. If really needed, this needs to be fixed in ARM specific config
> files / Makefiles, not in the top level Makefile.

I agree that we should find a better place to put ARM specific config in.
But currently, top level Makefile is the one I found.
Any suggestion?

BR,
Paul

>
> 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
> core error - bus dumped
>



-- 
? ? ???(Paul Hsu)
? ? pochun.hsu at gmail.com
? ? Cell phone?0975-277-823
? ? (MSN)pochun.hsu at gmail.com
? ? (Skype)paulhsu1981

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

* [U-Boot] [PATCH] Link the correct libgcc.a on ARMv4T architecture
  2010-09-08  8:32   ` Paul Hsu
@ 2010-09-08  9:05     ` Wolfgang Denk
  2010-09-08  9:25       ` Paul Hsu
  0 siblings, 1 reply; 5+ messages in thread
From: Wolfgang Denk @ 2010-09-08  9:05 UTC (permalink / raw)
  To: u-boot

Dear Paul Hsu,

In message <AANLkTin=dbkiHNGHO2W+knxaC3mk9TFJacQD9d8BwTHf@mail.gmail.com> you wrote:
>
> > On which tool chain is this causing problems?
> 
> I use toolchain released by code sourcery(Sourcery G++ Lite 2010q1-202
> for ARM GNU/Linux).

Thanks for the information.

> > And how does this problem manifest?

You did not answer this question.  Do you bet build errors? Or does
the build complete, but U-Boot does not work correctly?


> > NAK. If really needed, this needs to be fixed in ARM specific config
> > files / Makefiles, not in the top level Makefile.
> 
> I agree that we should find a better place to put ARM specific config in.
> But currently, top level Makefile is the one I found.
> Any suggestion?

arch/arm/config.mk ?

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
If some day we are defeated, well, war has  its  fortunes,  good  and
bad.
	-- Commander Kor, "Errand of Mercy", stardate 3201.7

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

* [U-Boot] [PATCH] Link the correct libgcc.a on ARMv4T architecture
  2010-09-08  9:05     ` Wolfgang Denk
@ 2010-09-08  9:25       ` Paul Hsu
  0 siblings, 0 replies; 5+ messages in thread
From: Paul Hsu @ 2010-09-08  9:25 UTC (permalink / raw)
  To: u-boot

On Wed, Sep 8, 2010 at 5:05 PM, Wolfgang Denk <wd@denx.de> wrote:
> Dear Paul Hsu,
>
> In message <AANLkTin=dbkiHNGHO2W+knxaC3mk9TFJacQD9d8BwTHf@mail.gmail.com> you wrote:
>>
>> > On which tool chain is this causing problems?
>>
>> I use toolchain released by code sourcery(Sourcery G++ Lite 2010q1-202
>> for ARM GNU/Linux).
>
> Thanks for the information.
>
>> > And how does this problem manifest?
>
> You did not answer this question. ?Do you bet build errors? Or does
> the build complete, but U-Boot does not work correctly?

Build process is complete, but U-Boot does not work correctly.
Because of linking the wrong version libgcc.a, which contains armv5 instruction
such that arm core raises a undefined instruction exception then code hanged.

>
>
>> > NAK. If really needed, this needs to be fixed in ARM specific config
>> > files / Makefiles, not in the top level Makefile.
>>
>> I agree that we should find a better place to put ARM specific config in.
>> But currently, top level Makefile is the one I found.
>> Any suggestion?
>
> arch/arm/config.mk ?

I found another way to solve this issue.

In arch/arm/cpu/arm920t/config.mk, change this line from
PLATFORM_CPPFLAGS += -march=armv4
to
PLATFORM_CPPFLAGS += -march=armv4t

Then everything goes well.
This solution won't make any modification on top level Makefile.

But I don't know exactly that the solution will incur other side effect or not?

BTW, If this solution is the right thing to do, shall I issue another patch?

BR,
Paul




>
> 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
> If some day we are defeated, well, war has ?its ?fortunes, ?good ?and
> bad.
> ? ? ? ?-- Commander Kor, "Errand of Mercy", stardate 3201.7
>



-- 
? ? ???(Paul Hsu)
? ? pochun.hsu at gmail.com

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

end of thread, other threads:[~2010-09-08  9:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-08  7:54 [U-Boot] [PATCH] Link the correct libgcc.a on ARMv4T architecture Paul Hsu
2010-09-08  8:16 ` Wolfgang Denk
2010-09-08  8:32   ` Paul Hsu
2010-09-08  9:05     ` Wolfgang Denk
2010-09-08  9:25       ` Paul Hsu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.