Skip to content

BaseTools/Source/C: Remove duplicate -fshort-wchar#87

Draft
mikebeaton wants to merge 136 commits intoacidanthera:masterfrom
mikebeaton:short-wchar
Draft

BaseTools/Source/C: Remove duplicate -fshort-wchar#87
mikebeaton wants to merge 136 commits intoacidanthera:masterfrom
mikebeaton:short-wchar

Conversation

@mikebeaton
Copy link
Member

@mikebeaton mikebeaton commented Nov 21, 2025

Description

-fshort-wchar -flto -DUSING_LTO was added via CPPFLAGS to all relevant uses of gcc and g++ in commit 2f61ab9.

However CFLAGS, as defined in the lines above that change, is never consumed without CPPFLAGS, therefore -fshort-wchar can be removed from CFLAGS to avoid it appearing twice in every call to gcc which uses CFLAGS.

Note that the affected files within BaseTools/Source/C (those that include the changed file, and all those that those include) are:

Makefiles/app.makefile
Makefiles/lib.makefile
GNUmakefile
VfrCompile/GNUmakefile
Makefiles/footer.makefile
Makefiles/header.makefile

Note also that in VfrCompile/GNUmakefile g++ is affected by CPPFLAGS, but not CXXFLAGS.

  • Breaking change?
    • NO.
  • Impacts security?
    • NO.
  • Includes tests?
    • NO.

How This Was Tested

Confirm in BaseTools/Source/C build console output prior to change that all single and double appearances of -fshort-wchar match the pattern mentioned. Confirm compiled executables before and after change are the same size (they are not binary identical, and differ at multiple locations, but this is believed to be as expected due to meta-data).

Integration Instructions

N/A

Mikhail Krichanov and others added 30 commits April 7, 2025 12:02
    
Adds a Pedro Falcato's UEFI EXT4 filesystem driver that implements the 
EFI_FILE_PROTOCOL and EFI_SIMPLE_FILE_SYSTEM_PROTOCOL.
    
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2510

Some firmwares:
- Report Shift modifier even when they report upper-case unicode letter.
- Report Ctrl modifier with "shifted" UniChar (i.e. X - 'A' + 1).

This change provides support for these firmwares preserving the compatibility
with the previous input handling.

Signed-off-by: Michael Belyaev <usrsse2@icloud.com>
Reviewed-by: Vitaly Cheptsov <vit9696@protonmail.com>
SioBusDxe by default does not create a device for PS/2 mice, this patch adds that device.
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>
Added missing EFIAPI modifier to SmmSwDispatcher function which passed into gSmst->SmiHandlerRegister routine.

Signed-off-by: Savva Mitrofanov <sk.mitrofanov@ispras.ru>
Reviewed-by: Vitaly Cheptsov <cheptsov@ispras.ru>
In case PlatformBootManagerLib does not have PciLib dependency,
we need to explicitly depend on UefiBootServicesTableLib.
Otherwise UefiBootServicesTableLib may not be constructed before
DxePciLibI440FxQ35, which uses a constructor-less PcdLib that directly
accesses gBS.

This can be viewed as a bug in the current implementation of BaseTools,
namely GetModuleLibInstances. This function drops all constructor-less
dependencies from the dependency resolution list to avoid dependency
cycles, which at the same time causes issues like above.

To properly fix the issue one should go over each library with
constructors and for each its dependency without constructors add all
the secondary dependencies that do have constructors. While doable,
it may cause considerable performance issues and is thus not done
in this patch.

Signed-off-by: Vitaly Cheptsov <cheptsov@ispras.ru>
GetSize routines should return zero size when checking Token existence

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Reviewed-by: Vitaly Cheptsov <vit9696@protonmail.com>
Missing masks leads to shift out of bounds. Also there is no need to
construct CHAR16 using cast to CHAR8 buffer, better to use native endian
by assigning data directly into Ucs2Char variable

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Reviewed-by: Marvin Häuser <mhaeuser@posteo.de>
Add missing GDT alignment into mBuffer to prevent possible memory
corruption on ALIGN_POINTER operation on NewGdtTable
in ArchExceptionHandler

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Corrects typedef redefinition, in particular for openssl e_os2.h

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
We need to pass DestSize as pointer, because we assign this output var
to TotalOut value inside BrotliDecompress routine

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Removes unused local variable Size in GetSmbiosStringById

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Corrects compiler warning due to unused variable in VarCheckHiiGenFromFv

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Removes unused variable in WifiMgrRefreshNetworkList routine to correct
build

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Removes unused Index local variable in RetrieveRelocatedCapsule to
suppress compiler warning in LLVM 15

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
…ller

Adds EFI_EXCEPTION_CALLBACK and EFI_PERIODIC_CALLBACK casts to
RegisteredCallback call in InterruptDistributionHub to suppress
deprecated non-prototype LLVM 15 warning

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Update the brotli submodule to the latest commit (ed1995b6bda1)
so that the build isn't broken in GCC 12 compilers.

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Disables redefinition warning due to win 10 sdk to fix build using MSVC
toolchain

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Silences "sometimes-uninitialized" warning by initializing the variable FspMultiPhaseApiOffset and corrects build using LLVM 15 toolchain

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Adds missing EFIAPI modifiers. Fixes calling conventions by defining as
ms_abi

Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Signed-off-by: Savva Mitrofanov <savvamtr@gmail.com>
Mikhail Krichanov and others added 22 commits August 4, 2025 09:34
Memory Attributes Table needs to be updated to contain executable
permissions for UEFI runtime drivers loaded after EndOfDxe.
Fixes a regression introduced by bb248a9.

Signed-off-by: Vitaly Cheptsov <vit9696@protonmail.com>
Support for EFI Events has been added to userspace in the
OpenCorePkg project. To pass CI for VS2019, the UserEvent file
needs to be added to Makefiles in this commit

Signed-off-by: Pavel Naberezhnev <pavelnaberezhnev@gmail.com>
The Xcode 26 linker no longer supports two-way section renaming used
to generate the empty __RO_RELOCS segment. Instead, generate it from
the new, empty XcodeRoRelocsEmptyFile file.
The issues which are warned about can happen as a
normal part of life when using Linux, especially
`Needs journal recovery, mounting read-only`.
This means that when using Ext4Dxe with OpenCore
it becomes necessary not to include WARN in HaltLevel,
whereas in general, to keep a clean system, one
might want to include it.

More generally this PR tries to reflect the idea that
WARNs should be to let users know of config (and
other) errors which they should really fix. Whereas
here we have a state which occurs quite commonly
and which the user can do nothing about.

I am pretty certain that (from the point of view
described above) the changes in Superblock.c are
correct. I am less certain about the changes in
Symlink.c - but all the same, if they are not errors
and the system can continue, and the user can do
nothing about it, then probably the same logic applies.
Nasm 3.0 complains about 'dword' being invalid.  The comment talks about
a '8-byte value' so 'qword' should be correct here.

Fixes: tianocore/edk2#11635
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
This was found building ArmVirtQemu using CLANGDWARF with
unused-but-set-variable warning enabled.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
…,UefiCpuPkg,root: Apply unix2dos to convert to CRLF all files with incorrect LF line endings (acidanthera#83)
The UEFI Platform Initialization Specification and the Unified Extensible
Firmware Interface (UEFI) Specification (respectively for PEI and DXE)
determine that the signature for these methods must have a VOID return value,
but in all cases fields of the given types are initialised from methods
matching the CopyMem and SetMem declarations in BaseMemoryLib.h, which
have a VOID * return value.

There is no guarantee that a function returning a pointer can be safely
called by a caller expecting it to return void, even if this works in
practice with the calling conventions used, so wrapper methods are more
correct.

Fixing this is required to be able to compile with cast-function-type-mismatch
warning enabled for Xcode and clang toolchains, but it is at least arguably
a genuine unwanted mismatch in any case.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
This is required to be able to compile with cast-function-type-mismatch
warning enabled for Xcode.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
This is required to be able to compile with cast-function-type-mismatch
warning enabled for Xcode.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
This is required to be able to compile with cast-function-type-mismatch
warning enabled for Xcode.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
This matches the format of the remaining 8 .sh files in EDK 2, two of
which are also in OvmfPkg, and matches what makes sense as .sh
files are to be consumed in Unix* (including this one which has
a hashbang for /bin/sh).

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
…era#84)

And additionally check for CRLF in the many fewer files which
should be LF.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
Remove default from checkbox statement that is not part
of the checkbox statement syntax to remove VFR compiler
warning.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Since we have improved NULL macros for DEBUG and ASSERT
(which are also now in upstream
tianocore/edk2@ae83c6b)
-Wno-unused-but-set-variable and -Wno-unused-variable warning
suppression is no longer needed in any builds, and the
warnings can be re-enabled to catch real errors.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
DestSize should have been received and passed as a pointer in order to
successfully pass the output value.

The existence of this error was spotted by XCODE5 toolchain, which gave:
BrotliDecompress.c:85:18: error: parameter 'DestSize' set but not used

As discussed in tianocore/edk2#11729, since the
method is in fact internal and only called in one place, and since the
DestSize return value is in fact unused, instead of fixing the parameter
and method call we instead remove the parameter, also marking the method
STATIC and renaming it to ...Internal.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
Enable `parentheses-equality`.

Enable `unused-but-set-parameter` (which appears to be enabled
by default in Xcode but not in LLVM).

Former code cleaning for XCODE5 toolchain means these should
already pass CI.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
`-fshort-wchar -flto -DUSING_LTO` was added via CPPFLAGS to all relevant
uses of gcc and g++ in commit 2f61ab9.

However CFLAGS, as defined in the lines above that change, is never
consumed without CPPFLAGS, therefore `-fshort-wchar` can be removed from
CFLAGS to avoid it appearing twice in every call to gcc which uses CFLAGS.

Note that the affected files within BaseTools/Source/C (those that
include the changed file, and all those that those include) are:

```
Makefiles/app.makefile
Makefiles/lib.makefile
GNUmakefile
VfrCompile/GNUmakefile
Makefiles/footer.makefile
Makefiles/header.makefile
```

Note also that in VfrCompile/GNUmakefile g++ is affected by CPPFLAGS,
but not CXXFLAGS.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
@mikebeaton mikebeaton marked this pull request as draft November 21, 2025 11:21
@mikebeaton
Copy link
Member Author

mikebeaton commented Nov 21, 2025

Can't see why tianocore/edk2#11779 is failing, but putting this to draft status too as a precaution, until resolved.

@savvamitrofanov savvamitrofanov force-pushed the master branch 2 times, most recently from 3d47654 to 25f2ca4 Compare March 4, 2026 11:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

9 participants