
Hi Simon,
On 05-02-15 04:34, Simon Glass wrote:
Hi Jeroen,
On 4 February 2015 at 12:37, Jeroen Hofstee jeroen@myspectrum.nl wrote:
Hello Guilherme / Simon,
It seems that commit f86ed6a8d52c99bb2d17d3cac1647edca0c4399c, "tools: moved code common to all image tools to a separated module."
cause some trouble when building on FreeBSD.
/usr/bin/ld:./tools/imagetool.lds:24: syntax error cc: error: linker command failed with exit code 1 (use -v to see invocation)
which is about the last line, /* INSERT BEFORE .data; */
And thereafter about: /usr/lib/crt1.o: In function `_start': /usr/src/lib/csu/amd64/crt1.c:(.text+0x90): undefined reference to `__preinit_array_start' /usr/src/lib/csu/amd64/crt1.c:(.text+0x95): undefined reference to `__preinit_array_end' /usr/src/lib/csu/amd64/crt1.c:(.text+0xb1): undefined reference to `__preinit_array_start' /usr/src/lib/csu/amd64/crt1.c:(.text+0xb6): undefined reference to `__preinit_array_end' /usr/src/lib/csu/amd64/crt1.c:(.text+0xd4): undefined reference to `__preinit_array_start' /usr/src/lib/csu/amd64/crt1.c:(.text+0xf9): undefined reference to `__init_array_start' /usr/src/lib/csu/amd64/crt1.c:(.text+0xfe): undefined reference to `__init_array_end' /usr/src/lib/csu/amd64/crt1.c:(.text+0x11a): undefined reference to `__init_array_start' /usr/src/lib/csu/amd64/crt1.c:(.text+0x11f): undefined reference to `__init_array_end' /usr/src/lib/csu/amd64/crt1.c:(.text+0x144): undefined reference to `__init_array_start' /usr/lib/crt1.o: In function `finalizer': /usr/src/lib/csu/amd64/crt1.c:(.text+0x187): undefined reference to `__fini_array_start' /usr/src/lib/csu/amd64/crt1.c:(.text+0x18c): undefined reference to `__fini_array_end' /usr/src/lib/csu/amd64/crt1.c:(.text+0x1b4): undefined reference to `__fini_array_start' /usr/bin/ld: tools/mkenvimage: hidden symbol `__preinit_array_start' isn't defined
Which seems to be about missing sections. The (default) ld on FreeBSD branched of from an old version [1], With below patch [2] things build at least.
Some question about this:
- why do we need linker magic for tools at all? Given that there is no
custom linker script for tools (or I failed to find it), this adds a dependency between the host default linker script and the tweaks in imagetool.lds
- what it the INSERT BEFORE .data supposed to do?
- and last but not least, how can we make this work in general
- and really last, how do I test if it works..
With kind regards, Jeroen
[1] ld --version GNU ld 2.17.50 [FreeBSD] 2007-07-03
[2] diff --git a/tools/imagetool.lds b/tools/imagetool.ldsdiff --git
Where is this file?
It is in 2015-04-rc1, see e.g. http://git.denx.de/?p=u-boot.git;a=blob;f=tools/imagetool.lds;h=7e92b4ac66c8...
Regards, Jeroen