mirror of https://github.com/acidanthera/audk.git
6f756db5ea
This adds support for LLVM 3.8.x in LTO mode for IA32 and X64. CLANG38 enable LLVM Link Time Optimization (LTO) and code size optimization flag (-Oz) by default for aggressive code size improvement. CLANG38 X64 code is small code model + PIE. CLANG LTO needs PIE in link flags to generate PIE code correctly, otherwise the PIE is not really enabled. (e.g. OvmfPkgX64 will hang in 64bits SEC at high address because of small model code displacement overflow). Test pass platforms: OVMF (OvmfPkgIa32.dsc, OvmfPkgX64.dsc and OvmfPkgIa32X64.dsc). Test compiler and linker version: LLVM 3.8, GNU ld 2.26. Example steps to use the CLANG38 tool chain to build OVMF platform: 1. Download and extract the llvm 3.8.0 Pre-Built Binaries from http://www.llvm.org/releases/ (e.g. http://www.llvm.org/releases/ 3.8.0/clang+llvm-3.8.0-x86_64-linux-gnu-ubuntu-16.04.tar.xz and extract it as ~/clang38). 2. Copy LLVMgold.so from https://github.com/shijunjing/edk2/blob/ llvm/BaseTools/Bin/LLVMgold.so to above clang lib folder (e.g. ~/clang38/lib/LLVMgold.so) 3. Install new version linker with plugin support (e.g. ld 2.26 in GNU Binutils 2.26 or Ubuntu16.04) $ cd edk2 $ git checkout llvm $ export CLANG38_BIN=path/to/your/clang38/ (e.g. export CLANG38_BIN=~/clang38/bin/) $ source edksetup.sh $ make -C BaseTools/Source/C $ build -t CLANG38 -a X64 -p OvmfPkg/OvmfPkgX64.dsc -n 5 -b DEBUG -DDEBUG_ON_SERIAL_PORT $ cd edk2/Build/OvmfX64/DEBUG_CLANG38/FV $ qemu-system-x86_64.exe -bios OVMF.fd -serial file:serial.log -m 4096 -hda fat:. If you want, you can build and install GNU Binutils 2.26 as below steps in Ubuntu: Download binutils-2.26 source code from http://ftp.gnu.org/gnu/binutils/ and extract it to ~/binutils-2.26 $sudo apt-get install bison $sudo apt-get install flex Install other necessary binutils build tools if missing $ mkdir build $ cd build $ ../binutils-2.26/configure --enable-gold --enable-plugins --disable-werror --prefix=/usr $ make -j 5 $ sudo make install If you want, you can build LLVMgold.so as below steps Download llvm-3.8.0 source code from http://www.llvm.org/releases/ 3.8.0/llvm-3.8.0.src.tar.xz and extract it to ~/llvm-3.8.0.src Download clang3.8.0 source code from http://www.llvm.org/releases/ 3.8.0/cfe-3.8.0.src.tar.xz and extract it to ~/llvm-3.8.0.src/tools/clang Refer http://clang.llvm.org/get_started.html to Install other necessary clang build tools if missing $ mkdir llvm38build $ cd llvm38build If your GNU Binutils 2.26 is in /home/jshi19/binutils-2.26, $ cmake ../llvm-3.8.0.src -G "Unix Makefiles" -DCMAKE_BUILD_TYPE="Release" -DLLVM_TARGETS_TO_BUILD="X86" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_CXX_COMPILER="/usr/bin/g++" -DCMAKE_C_COMPILER="/usr/bin/gcc" -DLLVM_BINUTILS_INCDIR=/home/jshi19/binutils-2.26/include $ make -j 5 LLVMgold The LLVMgold.so is in ~/llvm38build/lib/LLVMgold.so Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Steven Shi <steven.shi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> |
||
---|---|---|
.. | ||
XMLSchema | ||
Empty_Package_Information_Data_File.ini | ||
FrameworkDatabase.template | ||
ReadMe.txt | ||
build_rule.template | ||
target.template | ||
tools_def.template |
ReadMe.txt
This directory contains the template files for the next generation of the EDK II Build infrastructure. These files will be copied into the WORKSPACE's Conf directory if and only if the target files do not exist. These files may be updated frequently. The XMLSchema directory contains the EDK II Packaging XML definitions. The schema may change in the future. It differs somewhat from the early versions of the XML Schema.