Necessary for native builds on LoongArch. Only Linux is added for now,
matching upstream config.git changes.
Unfortunately, the upstream config.guess is GPLv3+ since 2012, and
LLVM is without autoconf support for a long time, so the script's
licensing exception no longer works and a bump could not be trivially
done.
This implements the same logic as the upstream commit adding LoongArch,
but rewritten to match the 2011 style that our script is holding on
to. libc detection is also done differently (the code is copied from
RISC-V as it's the same).