My Haiku ARM (UEFI) port progress

Maybe this is not entirely right?

#define LINK_SPEC "%{!o*:-o %b} -m armelf_haiku %{!r:-shared} %{nostart:-e 0} %{shared:-e 0} %{!shared: %{!nostart: -no-undefined}}\
  %{mbig-endian:-EB} %{mlittle-endian:-EL} -X"

The part with %{!o*:-o %b} in particular is really suspicious to me.
As I was able to decode it, it instructs gcc to invoke ld with “-o output_file_basename” if -o flag is NOT specified.
However, there’s the following comment in gcc.c near the line where we got the ICE:

      case 'b':
        /* Don't use %b in the linker command.  */
        gcc_assert (suffixed_basename_length);

Also this %{!o*:-o %b} is not present on the i386. (not sure about RISC-V though, as it has this suspicious clause in LINK_SPEC but maybe no one tried yet RISC-V bootstrap on gcc-11?)

Edit: the clause in question was removed from i386 in 2009 in commit #beaf9299f
If I remove it from gcc/config/arm/haiku.h, the bootstrap get going again, at least it won’t stop with ICE in the configure script. It will take a bit more time to see if it can finish successfully…

1 Like