When building a kernel using llvm70 and llvm80, I got this error message. kernel.full ld.lld: error: unknown -z value: common-page-size=4096 This error doesn't occur when building the base system or for a few ports. Also, this error happens when building a kernel after a basesystem was rebuilt without linker in it. Because LD is not working from make.conf, I softlinked /usr/bin/ld to llvm's different linkers from ports. When I softlinked /usr/bin/ld to /local/x86_64-unknown-freebsd12.0/bin/ld (binutil's linker) this worked. This error may be likely with other llvm versions too, and also for other architectures.
It looks like you are attempting to defeat the linker detection mechanism in /usr/share/mk/bsd.linker.mk, and succeeding. :) If you say "building a kernel using llvm70 and llvm80", can you describe exactly how you are doing this? As far as I know, it is not possible to build anything with two different compilers at the same time. Note that symlinking /usr/bin/ld to something random might or might not work, your mileage may vary (a lot). I think that in your case, overriding LINKER_TYPE might be the best approach. E.g. if you symlink /usr/bin/ld to a ports version of lld, it is safest to put LINKER_TYPE=lld in your environment or make.conf. All that said, it would be much easier if you just used any of the devel/xtoolchain-llvm[6-9]0 ports.
Thank you. I meant that at different times, that the compiler and linker from llvm70 and llvm80 from ports operated the same way. LD and LINKER_TYPE had to both be set to the same linker in make.conf for it to start compiling the kernel, but it didn't work for compiling the world. This was after removing the ld link. When I used devel/xtoolchain-llvm* in the past, it gave an instruction to use an X prefix in from of CC, CXX, CPP and LD to XCC, XCXX ... I believe that's all it does. The X prefix is an override for the ports tree. It seems that the error messages for the linker should be observed in stable, current and the later linker versions from ports. It may not be necessary for in 12.0, except for llvm90 for consistency in future versions.