audk/BaseTools
Shi, Steven 6f756db5ea BaseTools-Conf:Introduce CLANG38 new toolchain for x86
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>
2016-08-10 12:56:34 +08:00
..
Bin BaseTools: Improve LzmaF86Compress wrapper 2016-01-20 05:15:55 +00:00
BinWrappers/PosixLike BaseTools: Bash script fix for PosixLike/LzmaF86Compress 2016-06-02 13:10:17 +08:00
Conf BaseTools-Conf:Introduce CLANG38 new toolchain for x86 2016-08-10 12:56:34 +08:00
Scripts BaseTools GCC: drop GNU notes section from EFI image 2016-08-02 10:54:11 +02:00
Source BaseTools/UPT: Fix a install issue 2016-08-09 14:39:56 +08:00
Tests BaseTools: Use python2 if available in Tests/GNUmakefile 2016-01-20 05:14:10 +00:00
UserManuals BaseTools: update man page to add some descriptions 2015-12-07 09:10:33 +00:00
gcc Sync BaseTools Branch (version r2321) to EDKII main trunk. 2011-09-18 12:17:25 +00:00
.gitignore BaseTools: Ignore BaseTools/Bin/Win32 directory in .gitignore 2015-04-17 07:40:44 +00:00
BuildEnv BaseTools: Update edksetup.sh to support multiple workspaces 2015-10-08 09:29:56 +00:00
BuildNotes.txt BaseTools: Updated BuildNotes URLs 2016-03-25 09:46:44 +08:00
Contributions.txt */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
GNUmakefile Sync BaseTool trunk (version r2599) into EDKII BaseTools. 2013-08-23 02:18:16 +00:00
License.txt Sync BaseTool trunk (version r2599) into EDKII BaseTools. 2013-08-23 02:18:16 +00:00
Makefile Sync EDKII BaseTools to BaseTools project r1971 2010-05-18 05:04:32 +00:00
ReadMe.txt BaseTools: Correct ReadMe.txt file with CRLF line ending 2016-07-29 09:18:11 +08:00
building-gcc.txt Sync BaseTool trunk (version r2649) into EDKII BaseTools. 2014-01-27 05:23:15 +00:00
get_vsvars.bat BaseTools: Update Scripts to support VS2015 env 2015-12-22 01:01:54 +00:00
toolsetup.bat BaseTools/toolsetup.bat: Fix bug caused by 'CONF_PATH' not defined 2016-07-26 14:10:56 +08:00

ReadMe.txt

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This directory contains the next generation of EDK II build tools and template files.
Templates are located in the Conf directory, while the tools executables for
Microsoft Windows 32-bit Operating Systems are located in the Bin\Win32 directory, other 
directory contatins tools source.

1. Build step to generate the binary tools.

=== Windows/Visual Studio Notes ===

To build the BaseTools, you should run the standard vsvars32.bat script
from your preferred Visual Studio installation or you can run get_vsvars.bat
to use latest automatically detected version.

In addition to this, you should set the following environment variables:

 * EDK_TOOLS_PATH - Path to the BaseTools sub directory under the edk2 tree
 * BASE_TOOLS_PATH - The directory where the BaseTools source is located.
   (It is the same directory where this README.txt is located.)
 * PYTHON_FREEZER_PATH - Path to where the python freezer tool is installed

After this, you can run the toolsetup.bat file, which is in the same
directory as this file.  It should setup the remainder of the environment,
and build the tools if necessary.

Please also refer to the 'BuildNotes.txt' file for more information on
building under Windows.

=== Unix-like operating systems ===

To build on Unix-like operating systems, you only need to type 'make' in
the base directory of the project.

=== Ubuntu Notes ===

On Ubuntu, the following command should install all the necessary build
packages to build all the C BaseTools:

  sudo apt-get install build-essential uuid-dev

=== Python sqlite3 module ===
On Windows, the cx_freeze will not copy the sqlite3.dll to the frozen 
binary directory (the same directory as build.exe and GenFds.exe). 
Please copy it manually from <PythonHome>\DLLs.

The Python distributed with most recent Linux will have sqlite3 module
built in. If not, please install sqlit3 package separately.

26-OCT-2011