Skip to contentSkip to conversation

maybe just one more bug left in building the examples directory in 1.1.2

U-Boot-Users John Davis 4 participants 11 messages Nov 15, 2005 – Mar 8, 2006

lore
Share & tools
lore

John Davis

author
#0 lore raw

Hello
I am getting closer to getting the examples code to build. I have added a
bunch of object files and library files to the link command in the examples Makefile. However,
I have gotten to the last bug and I don't know how to solve it. Below, it complains about __got2_entries. I found this defined in our board directories linker script.
The current command line and results:
make[1]: Entering directory `/home/davis/cvs/mcp4/uboot/mine/u-boot-1.1.2
/examples'
ppc-linux-ld -g -Ttext 0x40000 \
-o hello_world -e hello_world hello_world.o libstubs.a \
/home/davis/cvs/mcp4/uboot/mine/u-boot-1.1.2/cpu/ppc4xx/start.o \
/home/davis/cvs/mcp4/uboot/mine/u-boot-1.1.2/board/fsp1/fsp1_pra.o \
/home/davis/cvs/mcp4/uboot/mine/u-boot-1.1.2/board/fsp1/eddr2.o \
-L/home/davis/cvs/mcp4/uboot/mine/u-boot-1.1.2/common -lcommon \
-L/home/davis/cvs/mcp4/uboot/mine/u-boot-1.1.2/lib_generic -lgeneric \
-L/home/davis/cvs/mcp4/uboot/mine/u-boot-1.1.2/net -lnet \
-L/home/davis/cvs/mcp4/uboot/mine/u-boot-1.1.2/rtc -lrtc \
-L/home/davis/cvs/mcp4/uboot/mine/u-boot-1.1.2/board/fsp1 -lfsp1 \
-L/home/davis/cvs/mcp4/uboot/mine/u-boot-1.1.2/cpu/ppc4xx -lppc4xx \
-L/home/davis/cvs/mcp4/uboot/mine/u-boot-1.1.2/lib_ppc -lppc \
-L/opt/fld_fakeroot/opt/mcp/ppc/bin/../lib/gcc-lib/ppc-linux/3.3.3 -lgcc /home/davis/cvs/mcp4/uboot/mine/u-boot-1.1.2 /cpu/ppc4xx/start.o(.text+0x25ae):/home/davis/cvs/mcp4/uboot/mine/u- boot-1.1.2/cpu/ppc4xx/start.S:1374: undefined reference to `__got2_entries'
ppc-linux-ld: BFD 2.15.90.0.1.1 20040303 (SuSE Linux) assertion fail ../../bfd/elf32-ppc.c:5645
make[1]: *** [hello_world] Segmentation fault
make[1]: *** Deleting file `hello_world'
make[1]: Leaving directory `/home/davis/cvs/mcp4/uboot/mine/u-boot-1.1.2 /examples'
make: *** [examples] Error 2
[davis at dyn-9-152-249-44 u-boot-1.1.2]$
The relevant portion of the linker script which defines the __got2_entries
variable.
board/fsp1/u-boot.lds:
... stuff snipped
__got2_entries = (_FIXUP_TABLE_ - _GOT2_TABLE_) >>2;
... stuff snipped
Any advice on how to apply this to my makefile is appreciated.
JD
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20051115/cd9fb1c1/attachment.htm

#1 lore raw

Dear John,

Quoted 4 lines · in message <[email protected]> you…

I am getting closer to getting the examples code to build. I have added a
bunch of object files and library files to the link command in the examples Makefile. However,

I really, really don't understand what you are actually doing. If you put your code in the examples directory, then just adding the binary name to the "BIN" definition in the "examples/Makefile" is *all* you have to do to get it build correctly.

If you prefer to keep the code in your own board directory (which is a much better approach, especially if you intend to submit it as a patch) then just have a look at the trab_fkt* targets in the "board/trab/Makefile".

Nothing more needs to be done. Really.

If this does not work for you, then your toolchain is broken and should be replaced.

Quoted 1 line

I have gotten to the last bug and I don't know how to solve it. Below, it

"the last bug" ??? Famous last words.

Quoted 1 line

complains about __got2_entries. I found this defined in our board

....

Quoted 3 lines

ppc-linux-ld: BFD 2.15.90.0.1.1 20040303 (SuSE Linux) assertion fail ../../bfd/elf32-ppc.c:5645
make[1]: *** [hello_world] Segmentation fault

Your tool crashes  with  a  segmentation  fault.  That's  a  tolchain
problem.  Get  yourself  working  tools  and  forget  about  all this

trouble.

Best regards,

Wolfgang Denk

Signature · 5 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Compassion -- that's the one things no machine ever had.  Maybe it's
the one thing that keeps men ahead of them.
	-- McCoy, "The Ultimate Computer", stardate 4731.3
author
#2 lore raw

Hello Wolfgang,
Ok. Thank you for the reality check. Could you please tell me where i can
get a reliable toolchain so I can end my frustration?
FWIW, I am not currently adding new code, I am just trying to get the
existing examples directory to build. I talked to my more knowledgeble co-worker and he told me that my approach was not what I wanted anyway. By statically linking to the libraries as
I have done, I am not created a loadable applet which is my main goal.
Many thanks in advance,
JD

Quoted 44 lines · Wolfgang Denk

Dear John,

in message <[email protected]>

Quoted 2 lines · you

I am getting closer to getting the examples code to build. I have added

a

Quoted 1 line

bunch of object files and library files to the link command in the

examples

Quoted 1 line

Makefile. However,

I really, really don't understand what you are actually doing. If you put your code in the examples directory, then just adding the binary name to the "BIN" definition in the "examples/Makefile" is *all* you have to do to get it build correctly.

If you prefer to keep the code in your own board directory (which is a much better approach, especially if you intend to submit it as a patch) then just have a look at the trab_fkt* targets in the "board/trab/Makefile".

Nothing more needs to be done. Really.

If this does not work for you, then your toolchain is broken and should be replaced.

Quoted 1 line

I have gotten to the last bug and I don't know how to solve it. Below,

it

"the last bug" ??? Famous last words.

Quoted 1 line

complains about __got2_entries. I found this defined in our board

....

Quoted 3 lines

ppc-linux-ld: BFD 2.15.90.0.1.1 20040303 (SuSE Linux) assertion fail ../../bfd/elf32-ppc.c:5645
make[1]: *** [hello_world] Segmentation fault

Your tool crashes with a segmentation fault. That's a tolchain problem. Get yourself working tools and forget about all this trouble.

Best regards,

Quoted 9 lines

Wolfgang Denk

--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Compassion -- that's the one things no machine ever had. Maybe it's the one thing that keeps men ahead of them.
-- McCoy, "The Ultimate Computer", stardate 4731.3

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20051115/db232547/attachment.htm

#3 lore raw
Andrew Wozniak  |  Mercury Computer Systems
978.967.1895    |  System SW, ICS Group
Quoted 10 lines · John Davis

Hello Wolfgang,

Ok. Thank you for the reality check. Could you please tell me where i
can get a reliable toolchain so I can end my frustration?

FWIW, I am not currently adding new code, I am just trying to get the existing examples directory to build. I talked to my more knowledgeble co-worker and he told me that my approach was not what I wanted anyway. By statically linking to the libraries as
I have done, I am not created a loadable applet which is my main goal.

Your co-worker is correct. The U-Boot examples are loadable applets which use the U-Boot application binary interface (ABI) to access U-Boot library functions. The #include <exports.h> entry within hello_world.c defines which library functions are provided by U-Boot.

Since the ABI is used by the examples, you SHOULD NOT attempt to link in generic or other libraries! The example code and makefiles have worked for quite some time now - forget about trying to fix something that is not broken. Instead, focus on your toolchain as suggested Wolfgang.

Quoted 63 lines

Many thanks in advance,

JD

On 11/15/05, *Wolfgang Denk* <wd at denx.de <mailto:[email protected]>> wrote:

Dear John,

in message <
6a7ac2300511150252w60601196qea018696ae5d1813 at mail.gmail.com <mailto:[email protected]>> you wrote:
>
> I am getting closer to getting the examples code to build. I
have added a
> bunch of object files and library files to the link command in
the examples
> Makefile. However,

I really, really don't understand what you are actually doing. If you put your code in the examples directory, then just adding the binary name to the "BIN" definition in the "examples/Makefile" is *all* you have to do to get it build correctly.

If you prefer to keep the code in your own board directory (which is a much better approach, especially if you intend to submit it as a patch) then just have a look at the trab_fkt* targets in the "board/trab/Makefile".

Nothing more needs to be done. Really.

If this does not work for you, then your toolchain is broken and should be replaced.

> I have gotten to the last bug and I don't know how to solve it.
Below, it

"the last bug" ??? Famous last words.

> complains about __got2_entries. I found this defined in our board
....
> ppc-linux-ld: BFD 2.15.90.0.1.1 20040303 (SuSE Linux) assertion fail > ../../bfd/elf32-ppc.c:5645
> make[1]: *** [hello_world] Segmentation fault

Your tool crashes with a segmentation fault. That's a tolchain problem. Get yourself working tools and forget about all this trouble.

Best regards,

Wolfgang Denk

--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email:
wd at denx.de <mailto:[email protected]>
Compassion -- that's the one things no machine ever had. Maybe it's the one thing that keeps men ahead of them.
-- McCoy, "The Ultimate Computer", stardate 4731.3

#4 lore raw
In reply to John Davis
Quoted 3 lines · In message <[email protected]> you…

Ok. Thank you for the reality check. Could you please tell me where i can
get a reliable toolchain so I can end my frustration?

ELDK? See http://www.denx.de/wiki/view/DULG/ELDKAvailability

Best regards,

Wolfgang Denk

Signature · 6 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Brontosaurus Principle: Organizations  can  grow  faster  than  their
brains  can manage them in relation to their environment and to their
own physiology: when this occurs, they are an endangered species.
                                                - Thomas K. Connellan
author
#5 lore raw

Hello Wolfgang,
Man you are modest. I didn't realize until now that you have your own
toolchain as well as working on u-boot.
Geez, I feel like a noob.
I'll try it out now.
Many thanks,
JD

Quoted 15 lines · Wolfgang Denk

In message <[email protected]>

Quoted 2 lines · you

Ok. Thank you for the reality check. Could you please tell me where i

can

Quoted 1 line

get a reliable toolchain so I can end my frustration?

ELDK? See http://www.denx.de/wiki/view/DULG/ELDKAvailability

Best regards,

Wolfgang Denk

Quoted 8 lines

--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de Brontosaurus Principle: Organizations can grow faster than their brains can manage them in relation to their environment and to their own physiology: when this occurs, they are an endangered species.
- Thomas K. Connellan

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20051115/505767a2/attachment.htm

#6 lore raw
In reply to Wolfgang Denk
Quoted 3 lines · Wolfgang Denk

in message <[email protected]> you wrote:

"the last bug" ??? Famous last words.

There's always one "last bug" left. ;)

Quoted 9 lines
Quoted 1 line

complains about __got2_entries. I found this defined in our board

....

Quoted 3 lines

ppc-linux-ld: BFD 2.15.90.0.1.1 20040303 (SuSE Linux) assertion fail ../../bfd/elf32-ppc.c:5645
make[1]: *** [hello_world] Segmentation fault

Your tool crashes  with  a  segmentation  fault.  That's  a  tolchain
problem.  Get  yourself  working  tools  and  forget  about  all this

trouble.

Not entirely a toolchain problem. Here is a patch that fixes the problem, if the toolchain happens to include the SuSE gcc 3.3.3 "Hammer" compiler. Patch is against git tree on kernel.org.

examples/stubs.c renamed from examples/stubs.c~hammer +1 -1
@@ -136,7 +136,7 @@ gd_t *global_data;
  * implementation. On the other hand, asm() statements with
  * arguments can be used only inside the functions (gcc limitation)
  */
-#if GCC_VERSION < 3004
+#if GCC_VERSION < 3003
 static
 #endif /* GCC_VERSION */
 void __attribute__((unused)) dummy(void)

This patch is clearly unacceptable, as it breaks real gcc 3.3 compilers. But it would still be nice to have some sort of workaround for the SuSE-created problem.

J?rn

Signature · 2 lines
"Error protection by error detection and correction."
-- from a university class
#7 lore raw
Quoted 8 lines · In message <[email protected]> you wrote:
Quoted 6 lines
Quoted 2 lines

make[1]: *** [hello_world] Segmentation fault

Your tool crashes  with  a  segmentation  fault.  That's  a  tolchain
problem.  Get  yourself  working  tools  and  forget  about  all this

trouble.

Not entirely a toolchain problem. Here is a patch that fixes the

It is entirely a toolchain problem. No matter what input you feed into it, the linker (like any other program) must NEVER crash with a segmentation fault. There is no excuse for such a bug.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
The human race is faced with a cruel choice: work  or  daytime  tele-
vision.
#8 lore raw
Quoted 8 lines · Wolfgang Denk
Quoted 7 lines · In message <[email protected]> you wrote:
Quoted 6 lines
Quoted 2 lines

make[1]: *** [hello_world] Segmentation fault

Your tool crashes  with  a  segmentation  fault.  That's  a  tolchain
problem.  Get  yourself  working  tools  and  forget  about  all this

trouble.

Quoted 5 lines
Quoted 1 line

Not entirely a toolchain problem. Here is a patch that fixes the

It is entirely a toolchain problem. No matter what input you feed into it, the linker (like any other program) must NEVER crash with a segmentation fault. There is no excuse for such a bug.

Yes, sure. The "Hammer" compiler has its issues, it has bitten me before and will likely bite me again. The sad fact remains that I'm forced to work with it, after all.

The world is not perfect and we have to deal with it. And I'd claim that compilers aren't perfect and programs have to deal with it as well, within reason. Would it be unreasonable to have a workaround for this problem in U-Boot?

J?rn

Signature · 2 lines
Ninety percent of everything is crap.
-- Sturgeon's Law
#9 lore raw
Quoted 3 lines · In message <[email protected]> you wrote:

well, within reason. Would it be unreasonable to have a workaround for this problem in U-Boot?

No, of course not, but the workaround must not interfere with any other configuration, and I can't see how to do this. Using the GCC version id is obviously not sufficient here.

Best regards,

Wolfgang Denk

Signature · 4 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Der Horizont vieler Menschen ist ein Kreis mit Radius Null --
und das nennen sie ihren Standpunkt.
#10 lore raw
Quoted 8 lines · Wolfgang Denk
Quoted 3 lines · In message <[email protected]> you wrote:

well, within reason. Would it be unreasonable to have a workaround for this problem in U-Boot?

No, of course not, but the workaround must not interfere with any other configuration, and I can't see how to do this. Using the GCC version id is obviously not sufficient here.

Correct. So far, the only clue GCC is giving me is this:

$ ppc-linux-gcc --version
ppc-linux-gcc (GCC) 3.3.3 (SuSE Linux)
                           ^^^^^^^^^^

So some Makefile magic with a grep, adding a #define and using it in the conditional compile statement would be possible. But maybe there's a nicer solution as well.

J?rn

Signature · 2 lines
Prosperity makes friends, adversity tries them.
-- Publilius Syrus