Skip to contentSkip to conversation

"raise" not defined, when compiler uses its own div0

U-Boot Ulf Samuelsson 4 participants 9 messages Aug 11, 2009 – Aug 13, 2009

lore
Share & tools
lore
#0 lore raw

When trying to build U-Boot under Buildroot and OpenEmbedded, I run into a problem:

When linking u-boot the linker seems to use the div0 from the C compiler libgcc instead of the u-boot div0.

gcc div0 for ARM contains a call to "raise" which is not defined in libgcc.a (someone said it was part of glibc),
so the linking process fails due to no "raise" symbol

gcc/config/arm/lib1funcs.asm contains:

FUNC_START div0

	tmfd sp!, {r1, lr}
	mov r0, #SIGFPE
	bl SYM(raise) __PLT__
	...

The problem can be fixed by patching the C compiler:

+ bl SYM(raise) __PLT__
+ bl SYM(_div0) __PLT__

------
What I'd like to know: Is there a way to fix this in u-boot?

Tried creating a "raise" function in libarm/board.c void raise(void)

{
	hang();
}

which did not work.

I later saw that raise needs a parameter,
but it complained that raise is not found,
and not that the parameters is wrong.

Is board.c not included in the link?

Anyone else got this problem?

BR
Ulf Samuelsson

#1 lore raw
Quoted 6 lines · Ulf Samuelsson

When trying to build U-Boot under Buildroot and OpenEmbedded, I run into a problem:

When linking u-boot the linker seems to use the div0 from the C compiler libgcc instead of the u-boot div0.

Yes i had the same problem with a home made toolchain (eglibc-2.10, gcc-4.4.1| gcc-4.3.4 | gcc-4.3.3 | gcc-4.3.2) with smdk2410 board. It seems to be same with this thread
http://lists.denx.de/pipermail/u-boot/2009-August/058349.html with codesourcery's toolchain.
However, I have tested u-boot-arm repository which includes a controversial :-) "ARM: Don't include libgcc anymore" (70163a381f1a5c93fcc181365cdb092566d8c5c5) without compile errors.

Regards

#3 lore raw
In reply to Ulf Samuelsson

Dear Ulf Samuelsson,

Quoted 1 line · In message <[email protected]> you wrote:

When trying to build U-Boot under Buildroot and OpenEmbedded,

These probably count to the tool chains with "broken" ARM cross compilers.

Quoted 2 lines

When linking u-boot the linker seems to use the div0 from the C compiler libgcc instead of the u-boot div0.

Try setting USE_PRIVATE_LIBGCC=yes in your envrionment, like

USE_PRIVATE_LIBGCC=yes make ...

Best regards,

Wolfgang Denk

Signature · 5 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
Quote from the Boss... "I didn't say it was your fault.  I said I was
going to blame it on you."
#2 lore raw
In reply to Gaye Abdoulaye Walsimou

Dear Gaye Abdoulaye Walsimou,

Quoted 4 lines · In message <[email protected]> you wrote:

However, I have tested u-boot-arm repository which includes a controversial :-) "ARM: Don't include libgcc anymore" (70163a381f1a5c93fcc181365cdb092566d8c5c5) without compile errors.

It's not controversial. It has been formally NAKed and rejected. It is not needed as working fixes are already available in mainline.

Best regards,

Wolfgang Denk

Signature · 7 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
You said you  didn't  want  to  use  CGI.pm,  but  methinks  you  are
needlessly reinventing the wheel, one spoke at a time. Either you are
masochistic,  or  you  just haven't seen enough of what CGI.pm can do
for you. -- Randal L. Schwartz in <[email protected]>
#4 lore raw
In reply to Wolfgang Denk

Wolfgang Denk skrev:

Quoted 7 lines

Dear Ulf Samuelsson,

Quoted 1 line · In message <[email protected]> you wrote:

When trying to build U-Boot under Buildroot and OpenEmbedded,

These probably count to the tool chains with "broken" ARM cross compilers.

Maybe,
Buildroot is even more broken, if you try to use an external toolchain and I would be surprised if openembedded is better.
In the end, noone wants to mess around with one compiler per application so it is better if a small fix to u-boot can be applied.

Quoted 7 lines
Quoted 3 lines

When linking u-boot the linker seems to use the div0 from the C compiler libgcc instead of the u-boot div0.

Try setting USE_PRIVATE_LIBGCC=yes in your envrionment, like

USE_PRIVATE_LIBGCC=yes make ...

I have done two fixes to make it build with openembedded.
1) Define "raise" in libarm/board.c which calls hang.
2) Changes mapi to "-mapi=aapcs-linux" in cpu/arm926ej-s/config.mk Some toolchains want to keep apcs-gnu I guess.

Quoted 5 lines

Best regards,

Wolfgang Denk

BR
Ulf Samuelsson

#5 lore raw

Dear Ulf Samuelsson,

Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 4 lines

Try setting USE_PRIVATE_LIBGCC=yes in your envrionment, like

USE_PRIVATE_LIBGCC=yes make ...

I have done two fixes to make it build with openembedded.
1) Define "raise" in libarm/board.c which calls hang.

Did you use "USE_PRIVATE_LIBGCC=yes", and it still needed raise(), or did you implement that workaround instead of using "USE_PRIVATE_LIBGCC=yes".

Normally no raise() should be needed when using USE_PRIVATE_LIBGCC=yes

Quoted 2 lines

2) Changes mapi to "-mapi=aapcs-linux" in cpu/arm926ej-s/config.mk Some toolchains want to keep apcs-gnu I guess.

I wonder why we enforce a specific API at all - would it not be better to use the toolchain provided default settings?

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
Single tasking: Just Say No.
#6 lore raw

Sent: Tuesday, August 11, 2009 11:58 PM
Subject: Re: [U-Boot] "raise" not defined, when compiler uses its own div0

Quoted 8 lines

Dear Ulf Samuelsson,

Quoted 5 lines · In message <[email protected]> you wrote:
Quoted 4 lines

Try setting USE_PRIVATE_LIBGCC=yes in your envrionment, like

USE_PRIVATE_LIBGCC=yes make ...

Quoted 8 lines
Quoted 2 lines

I have done two fixes to make it build with openembedded.
1) Define "raise" in libarm/board.c which calls hang.

Did you use "USE_PRIVATE_LIBGCC=yes", and it still needed raise(), or did you implement that workaround instead of using "USE_PRIVATE_LIBGCC=yes".

Normally no raise() should be needed when using USE_PRIVATE_LIBGCC=yes

Instead, since I think it is ugly.
If I build u-boot from the u-boot dir outside the buildsystem, it also means a lot of typing - If I remember to do it...

Why not make it a default mode?
Then there is no problem anywhere and the patch is not needed.

Quoted 5 lines
Quoted 2 lines

2) Changes mapi to "-mapi=aapcs-linux" in cpu/arm926ej-s/config.mk Some toolchains want to keep apcs-gnu I guess.

I wonder why we enforce a specific API at all - would it not be better to use the toolchain provided default settings?

I tried that, but that did not work with openembedded. '
I suspect that the openembedded libraries are built with -mapi-aapcs-linux. -mapi=apcs-gnu is not a problem with buildroot.

A similar thing:
For ARM, "-msoftfloat" is enforced, and I think that should be removed. AFAIK there are no floating point stuff in u-boot, and why then enforce something which might or might not work for an arbitrary toolchain.

Is there any toolchain that will not work, if -msoftfloat is removed?

Quoted 11 lines

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
Single tasking: Just Say No.

Best Regards
Ulf Samuelsson ulf at atmel.com
Atmel Nordic AB

Mail:  Box 2033, 174 02 Sundbyberg, Sweden
Visit:  Kavalleriv?gen 24, 174 58 Sundbyberg, Sweden

Phone +46 (8) 441 54 22 Fax +46 (8) 441 54 29
GSM +46 (706) 22 44 57

#7 lore raw

Dear "Ulf Samuelsson",

Quoted 5 lines · In message <E26FF1FBF0834320AC6F19CE783C7E69@aeglos> you wrote:

If I build u-boot from the u-boot dir outside the buildsystem, it also means a lot of typing - If I remember to do it...

Why not make it a default mode?

Because the default mode is to assume you are using a "good" tool chain.

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
He had quite a powerful intellect, but it  was  as  powerful  like  a
locomotive,  and  ran on rails and was therefore almost impossible to
steer.                          - Terry Pratchett, _Lords and Ladies_
#8 lore raw
Quoted 8 lines · On Wednesday 12 August 2009 08:04:40 Wolfgang Denk wrote:
Quoted 4 lines · Ulf Samuelsson

If I build u-boot from the u-boot dir outside the buildsystem, it also means a lot of typing - If I remember to do it...

Why not make it a default mode?

Because the default mode is to assume you are using a "good" tool chain.

considering these "broken" toolchains are merely following upstream gcc behavior, the definition of "good" will quickly become synonymous with "old" if it hasnt already. while the situation does blow, might as well accept reality and make the local one the default.
-mike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
Url : http://lists.denx.de/pipermail/u-boot/attachments/20090813/cef3ed45/attachment.pgp