Pedro,

There is an assumption that you have Link Time Optimization (LTO) turned on to dead strip. There are 3 PCD flags that let you control what ends up in the ROM. Assuming LTO you should be able to use PcdFixedDebugPrintErrorLevel to strip sets of strings out of the file. You can also turn all DEBUG prints off via PcdDebugPropertyMask.

https://github.com/tianocore/edk2/blob/master/MdePkg/MdePkg.dec


## This flag is used to control build time optimization based on debug print level.
# Its default value is 0xFFFFFFFF to expose all debug print level.
# BIT0 - Initialization message.<BR>
# BIT1 - Warning message.<BR>
# BIT2 - Load Event message.<BR>
# BIT3 - File System message.<BR>
# BIT4 - Allocate or Free Pool message.<BR>
# BIT5 - Allocate or Free Page message.<BR>
# BIT6 - Information message.<BR>
# BIT7 - Dispatcher message.<BR>
# BIT8 - Variable message.<BR>
# BIT10 - Boot Manager message.<BR>
# BIT12 - BlockIo Driver message.<BR>
# BIT14 - Network Driver message.<BR>
# BIT16 - UNDI Driver message.<BR>
# BIT17 - LoadFile message.<BR>
# BIT19 - Event message.<BR>
# BIT20 - Global Coherency Database changes message.<BR>
# BIT21 - Memory range cachability changes message.<BR>
# BIT22 - Detailed debug message.<BR>
# BIT31 - Error message.<BR>
# @Prompt Fixed Debug Message Print Level.
gEfiMdePkgTokenSpaceGuid.PcdFixedDebugPrintErrorLevel|0xFFFFFFFF|UINT32|0x30001016

## The mask is used to control DebugLib behavior.<BR><BR>
# BIT0 - Enable Debug Assert.<BR>
# BIT1 - Enable Debug Print.<BR>
# BIT2 - Enable Debug Code.<BR>
# BIT3 - Enable Clear Memory.<BR>
# BIT4 - Enable BreakPoint as ASSERT.<BR>
# BIT5 - Enable DeadLoop as ASSERT.<BR>
# @Prompt Debug Property.
# @Expression 0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask & 0xC0) == 0
gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0|UINT8|0x00000005
## This flag is used to control the print out Debug message.<BR><BR>
# BIT0 - Initialization message.<BR>
# BIT1 - Warning message.<BR>
# BIT2 - Load Event message.<BR>
# BIT3 - File System message.<BR>
# BIT4 - Allocate or Free Pool message.<BR>
# BIT5 - Allocate or Free Page message.<BR>
# BIT6 - Information message.<BR>
# BIT7 - Dispatcher message.<BR>
# BIT8 - Variable message.<BR>
# BIT10 - Boot Manager message.<BR>
# BIT12 - BlockIo Driver message.<BR>
# BIT14 - Network Driver message.<BR>
# BIT16 - UNDI Driver message.<BR>
# BIT17 - LoadFile message.<BR>
# BIT19 - Event message.<BR>
# BIT20 - Global Coherency Database changes message.<BR>
# BIT21 - Memory range cachability changes message.<BR>
# BIT22 - Detailed debug message.<BR>
# BIT31 - Error message.<BR>
# @Prompt Debug Message Print Level.
# @Expression 0x80000002 | (gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel & 0x7F84AA00) == 0
gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel|0x80000000|UINT32|0x00000006

Thanks,

Andrew Fish

On Apr 16, 2019, at 8:46 AM, Pedro Barbosa <pedroyossis@gmail.com> wrote:

Hi EDK2 developers,

I'm trying to build OVMF without debug symbols but even building as RELEASE, I still can see some strings on the PE files, such as:
<my-edk2-folder>/Build/OvmfX64/RELEASE_GCC5/X64/MdeModulePkg/Application/UiApp/UiApp/DEBUG/UiApp.dll
and many others in the format */DEBUG/*.dll

Is there a way to build without these strings?

Thanks!

--
[]s

Pedro YĆ³ssis Silva Barbosa
Security Engineer, Google
PhD in Computer Science, UFCG, Brazil