Skip to contentSkip to conversation

Link the correct libgcc.a on ARMv4T architecture

PATCH New Paul Hsu 2 participants 5 messages Sep 8, 2010 Kbuild

lore
Share & tools
lore

Paul Hsu

author
#0 lore raw

PATCH 1/1 Link the correct libgcc.a on ARMv4T architecture

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.

---
 Makefile |   15 +++++++++++++++
 1 files changed, 15 insertions(+), 0 deletions(-)
Makefile +15 -0
index 4f1cb1b..978c9cd 100644
@@ -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
 
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 Link the correct libgcc.a on ARMv4T architecture

Dear Paul Hsu,

Quoted 3 lines · In message <[email protected]> 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?

Quoted 4 lines
---
 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

Signature · 4 lines
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
author
#2 lore raw

PATCH 1/1 Link the correct libgcc.a on ARMv4T architecture

Quoted 8 lines · Wolfgang Denk

Dear Paul Hsu,

Quoted 3 lines · In message <[email protected]> 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.
Quoted 10 lines

And how does this problem manifest?

Quoted 4 lines

---
?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

Quoted 11 lines

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

Signature · 5 lines
? ? ???(Paul Hsu)
? ? pochun.hsu at gmail.com
? ? Cell phone?0975-277-823
? ? (MSN)pochun.hsu at gmail.com
? ? (Skype)paulhsu1981
#3 lore raw

PATCH 1/1 Link the correct libgcc.a on ARMv4T architecture

Dear Paul Hsu,

Quoted 5 lines · In message <[email protected]> you…
Quoted 2 lines

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.

Quoted 1 line
Quoted 1 line

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?

Quoted 6 lines
Quoted 2 lines

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

Signature · 6 lines
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
author
#4 lore raw

PATCH 1/1 Link the correct libgcc.a on ARMv4T architecture

Quoted 9 lines · Wolfgang Denk

Dear Paul Hsu,

Quoted 5 lines · In message <[email protected]> you…
Quoted 2 lines

On which tool chain is this causing problems?

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

Quoted 6 lines

Thanks for the information.

Quoted 1 line
Quoted 1 line

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.

Quoted 10 lines
Quoted 8 lines
Quoted 4 lines

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

Quoted 13 lines

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

Signature · 2 lines
? ? ???(Paul Hsu)
? ? pochun.hsu at gmail.com