public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Andrew Fish" <afish@apple.com>
To: devel@edk2.groups.io, pedroyossis@gmail.com
Subject: Re: [edk2-devel] Remove debug strings from OVMF.fd
Date: Tue, 16 Apr 2019 09:52:50 -0700	[thread overview]
Message-ID: <34850C25-D7DE-4F3B-A0B4-15AC6B7FD8AF@apple.com> (raw)
In-Reply-To: <CAJhsXKwgdALQR1LDmtXadujm_cXZ3WkB0SKHLBw6b1Ty1nkM+w@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3771 bytes --]

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
> sites.google.com/site/pedroysb <http://sites.google.com/site/pedroysb>
> 


[-- Attachment #2: Type: text/html, Size: 54825 bytes --]

  parent reply	other threads:[~2019-04-16 16:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16 15:46 Remove debug strings from OVMF.fd Pedro Barbosa
2019-04-16 16:39 ` [edk2-devel] " Laszlo Ersek
2019-04-16 16:52 ` Andrew Fish [this message]
2019-04-17  6:52 ` Liming Gao
2019-04-17 17:35   ` Andrew Fish
2019-04-18  0:14     ` Liming Gao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=34850C25-D7DE-4F3B-A0B4-15AC6B7FD8AF@apple.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox