Acidanthera UEFI Development Kit based on EDK II edk2-stable202311
Go to file
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
AppPkg AppPkg/.../Python: Clean up and document how to escape the -# option. 2016-01-06 01:00:19 +00:00
ArmPkg ArmPkg/ArmGicDxe: Fix double GIC EIOR write per interrupt 2016-08-08 15:46:00 +02:00
ArmPlatformPkg ArmPlatformPkg: change PcdBdsLinuxSupport default value 2016-08-04 14:32:19 +01:00
ArmVirtPkg ArmVirtPkg ARM: make relocatable PrePi users build with CLANG35 2016-08-03 15:45:23 +02:00
BaseTools BaseTools-Conf:Introduce CLANG38 new toolchain for x86 2016-08-10 12:56:34 +08:00
BeagleBoardPkg BeagleBoardPkg: Convert to build FatPkg from source 2016-04-07 20:45:39 +02:00
Conf EDK II: Add .gitignore 2014-10-14 16:08:15 +00:00
CorebootModulePkg CorebootModulePkg/SecCore: Adding NASM files in SecCore module 2016-08-03 17:20:17 -07:00
CorebootPayloadPkg CorebootModulePkg/PciHostBridgeLib: Fix PCI 64bit memory BAR size issue 2016-05-27 14:28:37 -07:00
CryptoPkg CryptoPkg DSC: Add build option to disable deprecated APIs 2016-08-08 11:00:13 +08:00
DuetPkg DuetPkg FSVariable: return error for empty str VariableName to GetVariable 2016-05-15 17:48:53 +08:00
EdkCompatibilityPkg EdkCompatibilityPkg: Fix GCC build failure 2016-08-01 12:44:44 +08:00
EdkShellBinPkg */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
EdkShellPkg */Contributions.txt: Update example email address 2015-02-03 17:29:14 +00:00
EmbeddedPkg EmbeddedPkg: make PrePiMemoryAllocationLib a SEC type library 2016-08-03 15:45:23 +02:00
EmulatorPkg BaseTools GCC: use 'gcc' as the linker command for GCC44 and later 2016-08-02 08:40:43 +02:00
FatBinPkg FatBinPkg: Change to 2-clause BSD license 2016-04-22 00:55:21 -07:00
FatPkg FatPkg DSC: Add build option to disable deprecated APIs 2016-08-08 11:00:03 +08:00
IntelFrameworkModulePkg IntelFrameworkModulePkg DSC: Add build option to disable deprecated APIs 2016-08-08 11:00:04 +08:00
IntelFrameworkPkg IntelFrameworkPkg DSC: Add build option to disable deprecated APIs 2016-08-08 11:00:04 +08:00
IntelFsp2Pkg IntelFsp2Pkg: Converted PatchFvUserManual from .docx to .md format 2016-08-08 20:57:05 +08:00
IntelFsp2WrapperPkg IntelFsp2WrapperPkg DSC: Add build option to disable deprecated APIs 2016-08-08 11:00:05 +08:00
IntelFspPkg IntelFspPkg DSC: Add build option to disable deprecated APIs 2016-08-08 11:00:06 +08:00
IntelFspWrapperPkg IntelFspWrapperPkg DSC: Add build option to disable deprecated APIs 2016-08-08 11:00:06 +08:00
IntelSiliconPkg IntelSiliconPkg/IgdOpRegion: Add definition for Intel IGD 2016-06-16 08:42:44 +08:00
MdeModulePkg MdeModulePkg DSC: Add build option to disable deprecated APIs 2016-08-08 11:00:07 +08:00
MdePkg MdePkg: Enhance PathRemoveLastItem() to support "FS0:File.txt" 2016-08-10 10:17:11 +08:00
NetworkPkg NetworkPkg DSC: Add build option to disable deprecated APIs 2016-08-08 11:00:08 +08:00
Nt32Pkg Nt32Pkg: Make Shell as the first boot option 2016-08-01 12:58:43 +08:00
Omap35xxPkg Omap35xxPkg: drop CpuExceptionHandlerLib library class resolution 2016-03-17 09:15:11 +01:00
OptionRomPkg OptionRomPkg: Fix typos in comments 2016-07-11 10:29:47 +08:00
OvmfPkg OvmfPkg: use StatusCode Router and Handler from MdeModulePkg 2016-08-02 20:52:10 +02:00
PcAtChipsetPkg PcAtChipsetPkg DSC: Add build option to disable deprecated APIs 2016-08-08 11:00:09 +08:00
PerformancePkg PerformancePkg DSC: Add build option to disable deprecated APIs 2016-08-08 11:00:09 +08:00
QuarkPlatformPkg QuarkPlatformPkg: fix ASSERT_EFI_ERROR() typos 2016-06-30 13:08:14 +02:00
QuarkSocPkg QuarkSocPkg/SmmCpuFeaturesLib: Add SMRR PhysBase/PhysMask fields check 2016-05-19 10:04:34 -07:00
SecurityPkg SecurityPkg DSC: Add build option to disable deprecated APIs 2016-08-08 11:00:10 +08:00
ShellBinPkg ShellBinPkg Arm/AArch64 Shell binary update 2016-08-02 12:25:13 +02:00
ShellPkg ShellPkg/ls: Display the correct directory path 2016-08-10 10:17:17 +08:00
SourceLevelDebugPkg SourceLevelDebugPkg DSC: Add build option to disable deprecated APIs 2016-08-08 11:00:11 +08:00
StdLib StdLib/LibC ARM AARCH64: do not redefine compiler intrinsics 2016-08-09 10:10:12 +02:00
StdLibPrivateInternalFiles StdLib: Clarify and improve comments. 2016-01-06 00:31:42 +00:00
UefiCpuPkg UefiCpuPkg DSC: Add build option to disable deprecated APIs 2016-08-08 11:00:12 +08:00
UnixPkg UnixPkg: Remove UnixPkg files (It is replaced by EmulatorPkg) 2013-07-29 21:09:55 +00:00
Vlv2DeviceRefCodePkg Vlv2DeviceRefCodePkg/ValleyView2Soc: Remove the unused code 2016-08-03 11:02:19 +08:00
Vlv2TbltDevicePkg Vlv2TbltDevicePkg/FvbRuntimeDxe: Remove unused variables 2016-08-03 16:09:44 +08:00
.gitignore EDK II: Add .gitignore 2014-10-14 16:08:15 +00:00
BuildNotes2.txt BaseTools: Updated BuildNotes URLs 2016-03-25 09:46:44 +08:00
Edk2Setup.bat BaseTools: Update Edk2Setup.bat to support multiple workspaces 2015-10-08 09:29:36 +00:00
Maintainers.txt Change ShellPkg&ShellBinPkg maintainer 2016-07-06 08:05:21 -07:00
edksetup.bat Update edksetup.bat to check NASM system environment variable 2016-07-26 10:16:48 +08:00
edksetup.sh BaseTools: Update edksetup.sh to support multiple workspaces 2015-10-08 09:29:56 +00:00