477 Commits

Author SHA1 Message Date
Marvin Häuser
fd7f3b94b1 BaseTools: Introduce new HII section design 2023-05-10 10:22:23 +03:00
Marvin Häuser
35b4251dc5 BaseTools: Remove GenFw 2023-05-10 10:22:22 +03:00
Marvin Häuser
e446bbff25 ImageTool: Update command syntax to suit BaseTools/GenMake 2023-05-10 10:22:22 +03:00
Marvin Häuser
942e747a91 ImageTool: Append .hii during PE generation 2023-05-10 10:22:22 +03:00
Marvin Häuser
fff229d0cb BaseTools: Simplify ELF-to-PE build 2023-05-10 10:22:22 +03:00
Marvin Häuser
85a3942525 ImageTool: Unify 32-bit and 64-bit tool variants 2023-05-10 10:22:22 +03:00
Marvin Häuser
42988773a0 BaseTools/tools_def: Omit object file relocations for X64 PIE 2023-04-17 12:08:02 +02:00
Marvin Häuser
b498c75ea8 BaseTools/build_rule: Drop deprecated ASM16 definition 2023-04-16 18:03:47 +02:00
Marvin Häuser
0e4af8d5bc BaseTools/tools_def: Remove unused macros 2023-04-15 16:01:26 +02:00
Mikhail Krichanov
7ae4bf8995 Build: Renamed XIPFLAGS as SECPEIFLAGS, added comment in build_rule.template on its usage. 2023-04-12 16:46:40 +03:00
Mikhail Krichanov
05cd2dee1e BaseTools: Removed GCC48/49 toolchains. 2023-04-12 16:46:40 +03:00
Mikhail Krichanov
7236d37bcd Conf: Remove unused IPHONE_TOOLS, SOURCERY_CYGWIN_TOOLS defs and EBC (EFI Byte Code) compiler definitions. 2023-04-12 16:46:40 +03:00
Mikhail Krichanov
df4c475562 BaseTools: Removed VS2008-VS2013 toolchains. 2023-04-12 16:46:40 +03:00
Mikhail Krichanov
669f98f9f8 Conf: Removed CLANG35/38 toolchains. 2023-04-12 16:46:40 +03:00
Marvin Häuser
5fe6994faf BaseTools/tools_def: Add ARM and AARCH64 support to CLANGDWARF 2023-04-11 09:51:01 +02:00
Marvin Häuser
f7c6e92fc9 BaseTools/tools_def: Add missing -no-pie DLINK for ARM GCC 2023-04-11 09:27:39 +02:00
Marvin Häuser
23e0a765a5 BaseTools/tools_def: Declare -Wno-unknown-warning-option for XCODE5 2023-04-02 00:04:46 +02:00
Mikhail Krichanov
789aa9ded5 BaseTools: Returned -march=armv7-a -mthumb for ARM compilation, removed useless ARCHASM_FLAGS. 2023-03-16 15:33:03 +03:00
Mikhail Krichanov
9b440f29ea BaseTools: Removed useless OBJCOPY_FLAGS, ARCHCC_FLAGS and PLATFORM_FLAGS, defined OBJCOPY_PATH for ARM, AARCH64. 2023-03-16 15:33:03 +03:00
Mikhail Krichanov
c9e1823fbc BaseTools: Placed MdeBuildOptions.dsc.inc into tools_def.txt. 2023-03-16 12:20:13 +03:00
Mikhail Krichanov
2a18a22be4 BaseTools: Made !ifdef-choice configurable on command line. 2023-03-16 12:20:13 +03:00
Mikhail Krichanov
1d0697c7ab BaseTools: Added support for !ifdef constructions inside tools_def.txt. 2023-03-16 12:20:13 +03:00
Mikhail Krichanov
2bb2e22db8 BaseTools: Reduced minimal alignment to 32 bytes. 2023-03-16 12:20:13 +03:00
Mikhail Krichanov
6117177c2e BaseTools: Added MDEPKG_REDUCE_FW_SIZE and MDEPKG_MERGE_RODATA_INTO_TEXT build options. 2023-03-16 12:20:13 +03:00
Mikhail Krichanov
7836cea3bd BaseTools: Fixed VS2019 build by removing EFI_IMAGE_SCN_MEM_DISCARDABLE flag from .xdata and .pdata sections and as a result correcting DataRVA inside .hii. 2023-03-13 20:48:55 +06:00
Marvin Häuser
9f35d83d71 BaseTools/tools_def: Introduce MTOC_PREFIX environment variable
Most compiler toolchains and tools have support for PREFIX environment
variables to specify their location, but Apple mtoc does not. While
it used to be in a stable install location, it has recently been
deprecated and ocmtoc is maintained as a fork. Homebrew has accepted
ocmtoc into its repository, including its ARM version. As Homebrew on
ARM does not install its packages into /usr/local, XCODE5 currently
does not work on Apple silicon with ocmtoc installed via Homebrew.

Introduce the MTOC_PREFIX environment variable to customize the
installation location of Apple mtoc or ocmtoc.

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2023-03-06 20:16:39 +01:00
Marvin Häuser
418524ac00 BaseTools: Rename __RELOC_FIX to __RO_RELOCS 2023-02-12 14:51:26 +01:00
Marvin Häuser
f5b2118058 BaseTools: Add -require_read_only_relocs to MTOC_FLAGS 2023-02-12 14:51:26 +01:00
Marvin Häuser
742a1e3326 BaseTools: Support read-only data for ASLC 2023-02-12 14:51:26 +01:00
Marvin Häuser
1eff93c8e2 BaseTools: ASLC files may not contain relocs 2023-02-12 14:51:26 +01:00
Marvin Häuser
bb53e3652b BaseTools: Fix __RELOC_FIX generation to always use a populated section 2023-02-12 14:51:26 +01:00
Savva Mitrofanov
9e4ebf488e BaseTools/tools_def: Add read_only_relocs arg to X64 target on XCODE5
For now "-read_only_relocs suppress" is safe, as relocations can now
target __TEXT without triggering the issue with Mach-O relocation
offsets

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-02-10 14:00:28 +03:00
Mikhail Krichanov
0212a1af87 ImageTool: Refactored relocs calculation. 2023-02-10 14:00:28 +03:00
Mikhail Krichanov
ec2ea092ed BaseTools: Moved .rodata into a separate section, enforced appropriate .rodata names for different toolchains. 2023-02-10 14:00:28 +03:00
Mikhail Krichanov
464cf15edb BaseTools: United GCC and CLANG linker scripts, set default 4K alignment for all toolchains. 2023-02-10 14:00:28 +03:00
Savva Mitrofanov
91789af684
BaseTools/Conf: Fixes CLANGPDB and CLANGDWARF build
Corrects llvm-rc arguments

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
2023-02-03 12:40:06 +06:00
Mikhail Krichanov
cf92e9f7d7 BaseTools: Replaced GenFw with ImageTool and MicroTool. 2022-12-28 17:21:20 +03:00
Marvin Häuser
acac38949d BaseTools/tools_def: Disable PIE generation for IA32 CLANGDWARF
Commit c25d390 disabled PIE generation for GCC49 and GCC5 as the GCC toolchains
at the time started enabling it by default. LLVM 15 has now done the same thing
for all Linux targets [1]. This causes the emission of a GOT with relocations
that GenFw does not currently support.

As such, disable PIC and PIE for the CLANGDWARF toolchain for IA32 targets, as
already done for GCC49 and GCC5, to support LLVM 15.

[1] ca68038d12

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
2022-12-24 17:14:25 +01:00
Mikhail Krichanov
76b839a71f Build: Previous fix update. 2022-12-21 12:45:25 +03:00
Mikhail Krichanov
aea03cb7b9 Build: Fixed missing HII for X64, IA32 CLANGDWARF DEBUG, NOOPT. 2022-12-21 12:35:26 +03:00
Vitaly Cheptsov
d5e819edeb
BaseTools: Allow .text relocations in CLANGDWARF toolchain
UefiCpuPkg modules like ExceptionHandlerAsm.nasm require relocations
to .text or PIC as they use instructions like mov or bt against
external symbols:

1. mov     rax, ASM_PFX(CommonInterruptEntry)
2. mov     rax, HookAfterStubHeaderEnd
3. bt      [ASM_PFX(mErrorCodeFlag)], ecx
4. mov     [rcx + (@VectorNum - HookAfterStubHeaderBegin)], al

It is not easily possible to rewrite 3/4 cases without involving
more registers or more commands, and EDK II has never targeted
read-only .text at load time, only at runtime.

Change the defaults to let OVMF compile by CLANGDWARF as per:
https://lists.llvm.org/pipermail/llvm-dev/2017-March/111441.html

Signed-off-by: Vitaly Cheptsov <cheptsov@ispras.ru>
2022-12-05 16:01:53 +06:00
Wu, JessyX
4d29da411f remove GCC build warning
Fix gcc: warning:
 -x c after last input file has no effect

These kind of flag can only affect the source code after them.
For the build command in build_rule.template, we have no other source code or object after these two flag.
It seems we don't need them here.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: JessyX Wu <jessyx.wu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2022-10-24 06:21:08 +00:00
Chao Li
cb4f1dfcc1 BaseTools: Updated for GCC5 tool chain for LoongArch platfrom.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053

BaseTools define template files changes for building EDK2 LoongArch
platform.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>

Signed-off-by: Chao Li <lichao@loongson.cn>
Co-authored-by: Dongyan Qian <qiandongyan@loongson.cn>
Co-authored-by: Baoqi Zhang <zhangbaoqi@loongson.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2022-10-14 02:16:33 +00:00
Gerd Hoffmann
f0b97e165e Revert "OvmfPkg/Sec: fix stack switch"
This reverts commit ff36b2550f94dc5fac838cf298ae5a23cfddf204.

Has no effect because GCC_IA32_CC_FLAGS and GCC_X64_CC_FLAGS are unused.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2022-06-10 17:19:59 +00:00
Gerd Hoffmann
ff36b2550f OvmfPkg/Sec: fix stack switch
The ebp/rbp register can either be used for the frame pointer or
as general purpose register.  With gcc (and clang) this depends
on the -f(no-)omit-frame-pointer switch.

This patch updates tools_def.template to explicitly set the compiler
option and also add a define to allow conditionally compile code.

The new define is used to fix stack switching in TemporaryRamMigration.
The ebp/rbp must not be touched when the compiler can use it as general
purpose register.  With version 12 gcc starts actually using the
register, so changing it leads to firmware crashes in some
configurations.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3934
Reported-by: Jiri Slaby <jirislaby@kernel.org>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2022-06-08 11:48:07 +00:00
Rebecca Cran
708620d29d BaseTools: Remove RVCT support
RVCT is obsolete and no longer used.
Remove support for it.

Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2022-05-13 14:58:54 +00:00
Jake Garver via groups.io
d372ab585a BaseTools/Conf: Fix Dynamic-Library-File template
In the Dynamic-Library-File template, add missing output file
declarations.  These files are generated by the template and other rules
explicitly depend on them.

This change resolves missing dependency issues we encountered while
running a recursive make with job control.

Signed-off-by: Jake Garver <jake@nvidia.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2022-04-28 13:42:00 +00:00
Jason
6a890db161 BaseTools: Upgrade the version of NASM tool
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3790

Upgrade the version of NASM tool to avoid compilation errors when
compiling NASM code change.

Signed-off-by: Jason Lou <yun.lou@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
2022-03-01 01:45:47 +00:00
Rebecca Cran
c9b7c6e0cc BaseTools: Update CLANG{35,38}_WARNING_OVERRIDES to ignore unused vars
Building with the CLANG35 and CLANG38 toolset fails because of variables
which are set but not otherwise used in the RELEASE build.

GCC added -Wno-unused-but-set-variable back in 2016, and later added
-Wno-unused-const-variable. Add those to CLANG35_WARNING_OVERRIDES and
CLANG38_WARNING_OVERRIDES.

Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2022-02-10 02:03:57 +00:00
Wei6 Xu
c09dbc92e9 BaseTools/Conf: Add new macro for customizing dll file reduction.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3810

New macro OBJCOPY_STRIPFLAG is added in build_rule.template to replace
'--strip-unneeded -R .eh_frame', so that module can have some unique
objcopy flags for its own purpose.
In tools_def.template, set '--strip-unneeded -R .eh_frame' as default
value of OBJCOPY_STRIPFLAG.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2022-02-07 02:39:18 +00:00