RFC: Support both Cross and Native compiler from configure
Simon Richter
Simon.Richter@hogyros.de
Sun Jun 23 15:20:00 GMT 2019
Hi,
On Sun, Jun 23, 2019 at 01:32:12PM +0000, Tamar Christina wrote:
> For AArch64 we'd like to move the generation of some of our generated files from being a part of maintainer mode to just being an artefact of the normal build.
So you want to build things for the build arch as well?
The GNU system has "build", "host" and "target" architectures, and the
toplevel coordinates between them. If you need to compile a program that
should run during the build process, the toplevel creates a directory and
calls
.../tool/configure --build=$build --host=$build --target=$target
so the tool is built with the native compiler ($host == $build).
The programs that are part of the toolchain are configured normally, using
.../tool/configure --build=$build --host=$host --target=$target
If $build == $host on the toplevel, then both of these configurations are
identical, so the directory is shared.
The build system type (--build) is largely informational in autoconf, it is
used in a check to determine if we are cross-compiling, but looking for a
native compiler inside a configure script that also configures for cross
compiling is not going to work, because there is only a single namespace.
GCC has lots of example code for this -- the DFA generator tool AFAIK uses
libiberty, so it is built for the build system, and then again for the host
system when building the cross compiler. Your problem is likely to be a
simpler variant of what they do to build libgcc for the target when build
and host system are different.
Simon
More information about the Binutils
mailing list