[syslinux] [PATCH 0/2] Cross-compilation patches

Benoît Allard
Mon, 10 Apr 2017 14:30:29 -0000

Replying to my own mail as I subscribe to the ML after the answer came,
and thus never received it in my mailbox.

On Wed,  5 Apr 2017 16:32:04 +0200
Beno?t Allard <benoit.allard at greenbone.net> wrote:

> Hi there,
>
> I've had issue with the integration of syslinux into the buildroot
> project [0]. After some research, it turned out that we were wrongly
> using the host toolchain instead of the target toolchain to build
> syslinux. This gave us bigger issues (for instance) when trying to
> link syslinux with gnu-efi, that was built using the target toolchain.
>
> The first one forces ld to output i386 binary when processing the
> binary files generated by nasm (for consistency with the other .o
> files), and the second one explicitely uses the host toolchain to
> build the utilities under utils/.
>
> Those two patches turned out to be necessary in order to have a
> proper build. please consider them for upstream inclusion.
>
> There was an aditionnal third patch [1] I required, but that one isn't
> authored by me. I would be grateful if you integrate it in your next
> release as well.
>
> Best Regards,
> Ben.
>
> [0] https://buildroot.org
> [1]
>
https://bugs.debian.org/cgi-bin/bugreport.cgi?att=1;bug=846679;filename=syslinux_6.03%2Bdfsg-14.1.debdiff;msg=10
>

I identified three categories of binaries built when building
syslinux:

1. utilities required during the build (prepcore)
2. utilities meant to be run in the target operating-system (isohybrid,
  memdisk, the extlinux installer, ...)
3. utilities used to boot the operating system

1. and 2. can possibly run on very different systems (different libc for
instance), so at least there, a distinction has to be possible.

The toolchain used to build 3. has to be the same as the one you used
when buidling the dependencies (gnu-efi), which is most likely the one
of the target-system. While we have no issues with different libc there
(no dependency on them), the version of the tools used has to be the
same: you can't mix different ld version very well.

My first patch is actually unrelated to that problematic and fixes an
issue when building with a toolchain that defaults to 64-bits. In that
case, we have to force ld to convert the nasm binary format into
32-bits elf binaries (else it generates 64-bits elf binaries).

My second patch uses variables familiar to people using autoconf. I
agree that a fallback should be made if those variables are not
present. As it turned out, overriding the CC make variable is
error-prone, so in the meantime, I have a new version of that patch
that does it differently. I will send it once we agree on the need for
a fix in that direction.

I have a third patch that builds prepcore using the CC_FOR_BUILD
compiler as well. That one was forgotten in my first serie.

If you look inside the file ``mk/build.mk``, there is already a
comment that mention that the distinction between the build toolchain
and the host toolchain should be made. Can we at least agree that some
step forward have to be made there ?

Regards,
Ben.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: OpenPGP digital signature
URL:
<http://www.zytor.com/pipermail/syslinux/attachments/20170410/9d31427a/attachment.sig>