# clang-elfv2.mk # Bootstrap toolchain for NATIVE powerpc64 elfv1 -> elfv2 ABI transition build. # (For cross building, either update your native llvm with the flag # day patches and then do a cross build, or force clang bootstrap # with the patches in src.) # HOWTO: # Note: Commands assume you are in a bourne shell session. # # 0) * TEMPORARY UNTIL LLVM 8.0.1 LANDS * # Hack llvm80 build to be 8.0.1-rc2 or later (see distinfo # history, there was an accidental commit that can be used) # Remember to update DISTVERSION= 8.0.1rc2 # Build and install this updated llvm80. # # 1) Install this toolchain file to /usr/local/share/toolchains/ # # 2) Apply outstanding llvm-elfv2 patches AND the flag day patches. # # 3) Manually symlink in a couple of legacy tools: # mkdir -p "/usr/obj/usr/src/powerpc.powerpc64/tmp/legacy/bin" # ln -s /usr/local/llvm80/bin/clang-tblgen /usr/obj/usr/src/powerpc.powerpc64/tmp/legacy/usr/bin/ # ln -s /usr/local/llvm80/bin/llvm-tblgen /usr/obj/usr/src/powerpc.powerpc64/tmp/legacy/usr/bin/ # # 4) Do a 64-bit cross buildworld using this toolchain file: # cd /usr/src # make CROSS_TOOLCHAIN=clang-elfv2 TARGET=powerpc TARGET_ARCH=powerpc64 WITHOUT_BOOT= WITHOUT_LIB32= buildworld -j32 # # 5) Install this 64-bit only toolchain to a chroot. # mkdir /usr/elfv2_chroot # make CROSS_TOOLCHAIN=clang-elfv2 TARGET=powerpc TARGET_ARCH=powerpc64 WITHOUT_BOOT= WITHOUT_LIB32= installworld DESTDIR=/usr/elfv2_chroot # TARGET=powerpc TARGET_ARCH=powerpc64 WITHOUT_BOOT= WITHOUT_LIB32= mergemaster -p -i -D /usr/elfv2_chroot # mount -t devfs none /usr/elfv2_chroot/dev # cp -a /usr/src/. /usr/elfv2_chroot/usr/src/. # # 6) Do a second buildworld inside the chroot to do the full native build. # chroot /usr/elfv2_chroot # cd /usr/src # make buildworld buildkernel KERNCONF=GENERIC64 -j32 # # 7) Make release artifacts as desired. XCC=/usr/local/bin/clang80 XCXX=/usr/local/bin/clang++80 XCPP=/usr/local/bin/clang-cpp80 XLD=/usr/local/llvm80/bin/ld.lld CROSS_BINUTILS_PREFIX=/var/empty X_COMPILER_TYPE=clang # Force ELFv2 so this works with unpatched clang. XCFLAGS="-mabi=elfv2" XCXXFLAGS="-mabi=elfv2"