Peter Stuge wrote:
This can't work so well right?
sorry, I forgot to remove my older variant. Thanks! Updated patch attached
(May not be a bad thing, but please document it if intentional.)
Document where - inline? or is i386-linux-* recommended anywhere? (couldn't find it anywhere in the source)
i386-elf should make the intent "no operating system below the generated code" more clear in my opinion, and it builds without libc and headers here (of course, linking "normal" executables won't work then), which is why i386-elf seems to be the more appropriate prefix.
Regards, Patrick Georgi
Index: util/xcompile/xcompile =================================================================== --- util/xcompile/xcompile (revision 463) +++ util/xcompile/xcompile (working copy) @@ -91,14 +91,29 @@ fi ;; *) - # FIXME: This should be detected. - CC="i386-linux-gcc" - echo "CC_x86 := i386-linux-gcc" - echo "AR_x86 := i386-linux-ar" - echo "AS_x86 := i386-linux-as" - echo "LD_x86 := i386-linux-ld" - echo "NM_x86 := i386-linux-nm" - echo "OBJCOPY_x86 := i386-linux-objcopy" + # add more candidates here as appropriate + for candidate in \ + i386-elf- \ + i386-linux- \ + ; do + version=`${candidate}gcc --version |grep "(GCC)" |awk '{print $3;}'` + if [ -n "$version" ]; then + PREFIX=$candidate + break + fi + done + if [ "x$PREFIX" = "x" ]; then + echo "# warning: using default compiler for x86 target." + echo "# may or may not work - but likely won't" + fi + + CC="${PREFIX}gcc" + echo "CC_x86 := ${PREFIX}gcc" + echo "AR_x86 := ${PREFIX}ar" + echo "AS_x86 := ${PREFIX}as" + echo "LD_x86 := ${PREFIX}ld" + echo "NM_x86 := ${PREFIX}nm" + echo "OBJCOPY_x86 := ${PREFIX}objcopy" ;; esac