Adding new target for hobby OS

Hi,

I'm contemplating using Clang for my hobby OS project called
"wkernel". I want to add a new target i686-pc-wkernel. Later I want to
support x86-64 and ARMv7. Is there any documentation on how to add a
target like this? What is the state of the Universal Driver Project?
When grepping for "freebsd" or "openbsd" it seems I need to add my
target to the following files:

include/clang/Driver/HostInfo.h
lib/Basic/Targets.cpp
lib/CodeGen/TargetInfo.cpp
lib/Driver/HostInfo.cpp
lib/Driver/Tools.cpp
lib/Driver/Driver.cpp
lib/Driver/ToolChains.h
lib/Driver/Tools.h
lib/Driver/ToolChains.cpp
lib/Frontend/InitHeaderSearch.cpp
... and maybe:
lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp

It could be nice to add a target by just creating a target
configuration file (with everything in one file), maybe using plain
text files or tablegen. My guess is that many targets are similar in
different aspects, so some form of inheritance or include mechanism
should be available.

I built the gold linker (as cross-compiler) from Binutils for my
target. It required few changes since my target is similar to
i686-pc-elf. On the other hand there might be more to it with Clang
since I'm creating my own C library using building blocks from PDCLIB
0.5 and hopefully I'll be using libc++ in the future. Where does a
cross-compiler look for header files and libraries compared to
compiling for the native target?

- Bjarke

This concerns me as well. I've accepted a programming bounty to port LLVM to
AROS x86. Once that's done I suspect many people will want it ported to the
other processors AROS supports.