Now the problem with this, of course, is the fact that one has to manually edit the Makefile during the build process. I've been trying to experiment with using GCC's target fragment files to try to make it so that for my cross-compiler, libgcc wouldn't be tried to be build with -fPIC enabled, because otherwise it will fail by saying that the kernel mcmodel does not support PIC. Various options including things like setting MULTILIB_OPTIONS into multiple orientations such as:Compiling libgcc with -mcmodel=kernel
This may require a workaround. First compile binutils as usual, then add the binaries to the PATH, and start to compile gcc. When compiling libgcc with -mcmodel=kernel, it will fail. Then patch the Makefile to disable PIC, repeat and continue
Code: Select all
MULTILIBS_OPTIONS = mcmodel=kernel/fpic mno-red-zone
So I was wondering whether anyone else has had any better luck with this, or whether there really is no other way forwards other than to manually patch the Makefiles in the middle of the build.
Of course a possible solution would be to build libgcc with -mno-red-zone and -mcmodel=large, but that does seem rather inefficient.