Skip to content

Commit

Permalink
doc: we can now build gcc-4.5.1 w/ host gcc-8.2.1
Browse files Browse the repository at this point in the history
Signed-off-by: Alessandro Rubini <[email protected]>
  • Loading branch information
rubini committed Feb 9, 2019
1 parent 2c3ad98 commit f3d6e44
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions doc/lm32-toolchain.in
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ projects;
The current status of this work is:
@itemize @bullet
@item We have a working 64-bit build of gcc-4.5.3, with newer support libraries;
@item We can build this with a recent host compiler (@i{gcc-8.2.1});
@item Newer compilers work, but create bigger binaries and are not suitable
for our projects, at least the big ones
@item No work on LLVM is yet completed.
Expand Down Expand Up @@ -873,6 +874,42 @@ was the fix for me:
ln -s libmpfr.so.6 /usr/lib/x86_64-linux-gnu/libmpfr.so.4
@end example

@c ##########################################################################
@node Rebuild on Recent Hosts
@chapter Rebuild on Recent Hosts

With a few additional patches to @i{binutils} and @i{gcc}, I was able
to rebuild @i{gcc-4.5.3} on Fedora 29, which features @i{gcc-8.2.1}
as host compiler, which is the most recent at time of writing.

You can compile with the current patch-set part of this package,
but you must first install a host library:

@example
yum install mpfr-devel
@end example

The problem is a fine issue related to @t{mpfr.h}: auto-configuration
of the compiler has a wrong patch for including header, and ends up
picking the host one instead. If the host header is missing,
compilation would fail. We can ignore the potential version difference
between the host version and the cross-compiled version; the library
is stable over time and not really used in our LM32 environments.

The errors were a detail in @i{gcc} documentation (which is built by default,
so the error was fatal for the overall compilation) and a zillion warnings
in @i{binutils}, that turn into errors if @t{-Werror} is used. Thus,
I removed @i{-Werror}, as a simple solution to an otherwise impossible task.

The resulting binary can successfully run on Debian-8, even if if
features an older @i{libc} than the one used to build it (2.19
vs. 2.28), thanks to forward- and backward-compatibility rules in
system libraries.

I didn't try to build other compiler versions; if needed, there should
be similar problems as the ones I patched in 4.5.3, but fewer and
fewer as you build newer versions.

@c ##########################################################################
@node Things to Do
@chapter Things to Do
Expand Down

0 comments on commit f3d6e44

Please sign in to comment.