Our debug info currently contains a few magic paths that are
relative to the object directory. This confuses consumers of kernel
debug info, in particular, syzkaller's code coverage report generation.
In the past I used to frequently see kgdb complain about not being to
find headers under machine/.
clang and modern gcc support -fdebug-map-prefix=src=dst, which tells the
compiler to substitute dst for src in debug info when compiling files
whose path is prefixed by src. This helps with a couple of things:
- The machine, x86 and MACHINE_CPUARCH symlinks. We can just map those to their canonical paths in the src tree, so e.g., machine/frame.h is translated to sys/amd64/include/frame.h.
- Autogenerated headers, like vnode_if.h. We include them via a relative path (just "./") now, so substituting the object directory path gives a better chance of finding them.
TODO: add guards for gcc 4.2.