I found that when tried to link "arch/x86/realmode/rm" component of linux kernel,
LLD reports:
ld: arch/x86/realmode/rm/header.o is incompatible with elf_x86_64 ...
All objects are i386, but invocation contains -m elf_x86_64 and we report a error.
That does not seem to be correct. Both gold and bfd allow to link that. Specification says:
-m emulation Emulate the emulation linker. You can list the available emulations with the --verbose or -V op- tions. This option overrides the compiled-in de- fault, which is the system for which you configured ld.
Patch makes target to be created basing on machine type inferred from
first object. If that is not possible then emulation option is used.
This is PR31678
I think you could just remove this piece of code from inferMachineTypes to do the same thing, no?