[U-Boot] recent tools on FreeBSD

Simon Glass sjg at chromium.org
Thu Feb 5 04:34:32 CET 2015


Hi Jeroen,

On 4 February 2015 at 12:37, Jeroen Hofstee <jeroen at 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?

> a/tools/imagetool.lds b/tools/imagetool.lds
> index 7e92b4a..b18eadb 100644
> --- a/tools/imagetool.lds
> +++ b/tools/imagetool.lds
> @@ -19,6 +19,17 @@ SECTIONS
>         __u_boot_sandbox_option_end = .;
>
>         __bss_start = .;
> +
> +       . = ALIGN(32 / 8);
> +         PROVIDE (__preinit_array_start = .);
> +         .preinit_array     : { *(.preinit_array) }
> +         PROVIDE (__preinit_array_end = .);
> +         PROVIDE (__init_array_start = .);
> +         .init_array     : { *(.init_array) }
> +         PROVIDE (__init_array_end = .);
> +         PROVIDE (__fini_array_start = .);
> +         .fini_array     : { *(.fini_array) }
> +         PROVIDE (__fini_array_end = .);
>  }
>
> -INSERT BEFORE .data;
> +/* INSERT BEFORE .data; */
>

Regards,
Simon


More information about the U-Boot mailing list