Acidanthera UEFI Development Kit based on EDK II edk2-stable202311
Go to file
Ard Biesheuvel 9ba8baae15 BaseTools/tools_def: AARCH64: disable LTO type mismatch warnings
On AARCH64, any code that may execute with the MMU off needs to be built
with -mstrict-align, given that unaligned accesses are not allowed unless
the MMU is enabled. This does not only affect SEC and PEI modules, but
also static libraries of the BASE type, which may be linked into such
modules, as well as into modules of other types. As it turns out, the
presence of -mstrict-align is reflected in the internal representations
of the types defined in those libraries.

When -fstrict-aliasing is passed to GCC, it assumes that pointers to
objects of different types cannot refer to the same memory location, and
attempts to exploit this fact when optimizing the code. Since such
assumptions are only valid under very strict conditions which are not
guaranteed to be met in EDK2, we disable this optimization by passing
-fno-strict-aliasing by default. [*]

When LTO is in effect, this applies equally to the code generation that
may occur at link time, which is why the linker warns about unexpected
differences in type definitions between the intermediate representations
that are present in the object files being linked. This may result in
warnings such as the one below, even if -fno-strict-aliasing is used:

  MdePkg/Include/Library/BaseLib.h:1712:1:
  warning: type of 'StrToGuid' does not match original declaration
  [-Wlto-type-mismatch]
   StrToGuid (
   ^
  MdePkg/Library/BaseLib/SafeString.c:1506:1:
  note: 'StrToGuid' was previously declared here
   StrToGuid (
   ^
  MdePkg/Library/BaseLib/SafeString.c:1506:1:
  note: code may be misoptimized unless -fno-strict-aliasing is used

This warning is inadvertently triggered when linking BASE libraries built
with -mstrict-align into modules of types other than SEC or PEI, since the
types are subtly different, even though the use of code that maintains
strict alignment in a module that does not care about this is unlikely to
cause problems. And even if it did, it would still only affect code built
with -fstrict-aliasing enabled, which we disable unconditionally. So let's
just silence the warning by passing -Wno-lto-type-mismatch.

[*] Leif adds: "-fstrict-aliasing is GCC default, because it is a
    restriction in the C language. Because it's a bit non-obvious, things
    can go hilariously wrong in very non-obvious ways, and the potential
    optimization gains are unlikely to be generally relevant,
    -fno-strict-aliasing is a sensible thing to always have set (like we
    do)."

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
2017-06-22 11:07:02 +00:00
AppPkg AppPkg/Applications/Python/PyMod-2.7.2: Replace non-ascii characters 2017-04-10 08:34:08 +08:00
ArmPkg ArmPkg: Add CNTHCTL_EL2 support functions 2017-05-22 15:19:34 +01:00
ArmPlatformPkg ArmPlatformPkg: eliminate Juno gcc build warning 2017-06-20 13:02:07 +01:00
ArmVirtPkg ArmPlatformPkg,ArmVirtPkg: delete redundant PL031 functions 2017-05-10 14:28:37 +01:00
BaseTools BaseTools/tools_def: AARCH64: disable LTO type mismatch warnings 2017-06-22 11:07:02 +00:00
BeagleBoardPkg BeagleBoardPkg: add missing BootLogoLib resolution 2017-03-31 11:43:22 +01:00
Conf EDK II: Add .gitignore 2014-10-14 16:08:15 +00:00
CorebootModulePkg CorebootPayloadPkg/CbSupportPei: Fix the memory map issue 2016-11-17 14:49:11 -08:00
CorebootPayloadPkg CorebootPayloadPkg: Use EfiEventGroupSignal from UefiLib 2017-01-20 15:55:41 +08:00
CryptoPkg CryptoPkg/BaseCryptLib: Add NULL pointer checks in DH and P7Verify 2017-05-22 08:57:48 +08:00
DuetPkg DuetPkg FSVariable: Add missing change in e286e118ba 2017-06-22 17:56:13 +08:00
EdkCompatibilityPkg EdkCompatibilityPkg: Fix some typos of "according" 2017-02-08 14:49:21 +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: import EfiTimeBaseLib (as TimeBaseLib) 2017-05-10 14:28:14 +01:00
EmulatorPkg EmulatorPkg/build.sh: Merge GCC toolchain detection from OVMF 2017-06-02 17:44:00 -07:00
FatBinPkg FatBinPkg: New EnhancedFatDxe binaries for IA32, X64, EBC and IPF 2017-04-07 13:14:20 +08:00
FatPkg FatPkg: Refine casting expression result to bigger size 2017-03-06 14:33:21 +08:00
IntelFrameworkModulePkg IntelFrameworkModulePkg: Update comments in SimpleTextInEx 2017-06-20 09:29:41 +08:00
IntelFrameworkPkg IntelFrameworkPkg/UefiLib: Avoid mis-calculate of graphic console size 2017-04-14 13:16:12 +08:00
IntelFsp2Pkg IntelFsp2Pkg: Convert files to CRLF line ending 2017-04-06 15:42:56 +08:00
IntelFsp2WrapperPkg IntelFsp2WrapperPkg: Convert files to CRLF line ending 2017-04-06 15:43:08 +08:00
IntelFspPkg IntelFspPkg: Fix typos in comments 2016-10-24 09:26:28 +08:00
IntelFspWrapperPkg IntelFspWrapperPkg: Refine casting expression result to bigger size 2017-03-06 14:33:23 +08:00
IntelSiliconPkg IntelSiliconPkg: Fix format issues 2016-12-20 10:51:16 +08:00
MdeModulePkg MdeModulePkg Variable: Add missing change in dd59d95e19 2017-06-22 17:56:13 +08:00
MdePkg MdePkg: Minor update to the Data parameter for PEI GetVariable() 2017-06-22 17:56:12 +08:00
NetworkPkg NetworkPkg/HttpBootDxe: Add HTTP Boot Callback protocol support. 2017-06-22 10:56:25 +08:00
Nt32Pkg Nt32Pkg/FvbServicesRuntimeDxe: correct NumOfLba vararg type in EraseBlocks() 2017-05-29 14:42:12 +02:00
Omap35xxPkg ArmPkg: remove unused PcdArmUncachedMemoryMask PCD 2017-02-27 16:18:29 +00:00
OptionRomPkg OptionRomPkg: Fix calling convention issue for UndiRuntiumeDxe driver. 2017-04-24 10:10:45 +08:00
OvmfPkg OvmfPkg/AcpiPlatformDxe: fix spurious uninitialized var warning 2017-06-09 08:57:39 +00:00
PcAtChipsetPkg PcAtChipsetPkg/SerialIoLib: Remove negative value shift 2017-05-19 12:12:06 -07:00
PerformancePkg PerformancePkg Dp_App: Handle "/" separator in debug path for GCC build 2017-03-16 11:08:44 +08:00
QuarkPlatformPkg QuarkPlatformPkg/SpiFvbServices: correct NumOfLba vararg type in EraseBlocks() 2017-05-29 14:42:36 +02:00
QuarkSocPkg QuarkSocPkg: Remove use of IntelFrameworkModulePkg legacy libs 2016-12-02 15:59:19 +00:00
SecurityPkg SecurityPkg TcgDxe: Simplify debug msg when "TPM not working properly" 2017-06-10 13:19:59 +08:00
ShellBinPkg ShellBinPkg: Ia32/X64 Shell binary update. 2017-06-13 16:23:18 +08:00
ShellPkg ShellPkg: Fix typo errors in ifconfig help output 2017-06-10 10:23:18 +08:00
SignedCapsulePkg SignedCapsulePkg: Convert files to CRLF line ending 2017-04-06 15:43:14 +08:00
SourceLevelDebugPkg PeCoffGetEntryPointLib: Fix spelling issue 2017-04-26 08:58:18 +08:00
StdLib StdLib: GCC 6 build fixes 2017-04-28 17:06:59 +01:00
StdLibPrivateInternalFiles StdLib: Clarify and improve comments. 2016-01-06 00:31:42 +00:00
UefiCpuPkg UefiCpuPkg/SmmCpuFeatureLib: Add more CPU ID for SmmFeatureControl. 2017-06-15 09:27:35 +08:00
UnixPkg
Vlv2DeviceRefCodePkg Vlv2DeviceRefCodePkg: Fixed thermal issue. 2017-02-08 15:32:39 +08:00
Vlv2TbltDevicePkg Vlv2TbltDevicePkg/FvbRuntimeDxe: correct NumOfLba vararg type in EraseBlocks() 2017-05-26 14:41:13 +08:00
.gitignore edk2: Add .DS_Store to .gitignore for macOS 2017-05-19 15:14:34 -07:00
BuildNotes2.txt BaseTools: Updated BuildNotes URLs 2016-03-25 09:46:44 +08:00
Edk2Setup.bat Edk2Setup.bat: Fix build errors from VS tools PREFIX ENV missing 2016-11-05 09:10:58 +08:00
Maintainers.txt Maintainers.txt: Update maintainers for DuetPkg & Nt32Pkg 2017-06-01 09:01:49 +08:00
edksetup.bat edksetup.bat: make sure BASE_TOOLS_PATH be set correctly 2016-10-26 13:45:45 +08:00
edksetup.sh edksetup.sh, BaseTools/BuildEnv: add --reconfig support 2016-10-24 13:53:16 +01:00