public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Remove debug strings from OVMF.fd
@ 2019-04-16 15:46 Pedro Barbosa
  2019-04-16 16:39 ` [edk2-devel] " Laszlo Ersek
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Pedro Barbosa @ 2019-04-16 15:46 UTC (permalink / raw)
  To: devel

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

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

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] Remove debug strings from OVMF.fd
  2019-04-16 15:46 Remove debug strings from OVMF.fd Pedro Barbosa
@ 2019-04-16 16:39 ` Laszlo Ersek
  2019-04-16 16:52 ` Andrew Fish
  2019-04-17  6:52 ` Liming Gao
  2 siblings, 0 replies; 6+ messages in thread
From: Laszlo Ersek @ 2019-04-16 16:39 UTC (permalink / raw)
  To: devel, pedroyossis

On 04/16/19 17:46, Pedro Barbosa 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!
> 

Do you see such strings in "UiApp.efi" too? (When built for RELEASE.)
"UiApp.dll" is an intermediate build product.

Thanks,
Laszlo

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] Remove debug strings from OVMF.fd
  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
  2019-04-17  6:52 ` Liming Gao
  2 siblings, 0 replies; 6+ messages in thread
From: Andrew Fish @ 2019-04-16 16:52 UTC (permalink / raw)
  To: devel, pedroyossis

[-- 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 --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] Remove debug strings from OVMF.fd
  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
@ 2019-04-17  6:52 ` Liming Gao
  2019-04-17 17:35   ` Andrew Fish
  2 siblings, 1 reply; 6+ messages in thread
From: Liming Gao @ 2019-04-17  6:52 UTC (permalink / raw)
  To: devel@edk2.groups.io, pedroyossis@gmail.com

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

<my-edk2-folder>/Build/OvmfX64/RELEASE_GCC5/X64/MdeModulePkg/Application/UiApp/UiApp/DEBUG/UiApp.dll is generated by GenFw tool. When GenFw tool convert ELF image to EFI image, it inserts the debug entry with the below string.

Thanks
Liming
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Pedro Barbosa
Sent: Tuesday, April 16, 2019 11:46 PM
To: devel@edk2.groups.io
Subject: [edk2-devel] Remove debug strings from OVMF.fd

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: 5619 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] Remove debug strings from OVMF.fd
  2019-04-17  6:52 ` Liming Gao
@ 2019-04-17 17:35   ` Andrew Fish
  2019-04-18  0:14     ` Liming Gao
  0 siblings, 1 reply; 6+ messages in thread
From: Andrew Fish @ 2019-04-17 17:35 UTC (permalink / raw)
  To: devel, Liming Gao; +Cc: pedroyossis@gmail.com

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



> On Apr 16, 2019, at 11:52 PM, Liming Gao <liming.gao@intel.com> wrote:
> 
> <my-edk2-folder>/Build/OvmfX64/RELEASE_GCC5/X64/MdeModulePkg/Application/UiApp/UiApp/DEBUG/UiApp.dll is generated by GenFw tool. When GenFw tool convert ELF image to EFI image, it inserts the debug entry with the below string.
>   <>
Liming,

Is there a way to turn it off? Does it follow the -g flag passed to the compiler? Can you post process with GenFw --zero to remove it? 

Thanks,

Andrew Fish


> Thanks
> Liming
>  <>From: devel@edk2.groups.io <mailto:devel@edk2.groups.io> [mailto:devel@edk2.groups.io <mailto:devel@edk2.groups.io>] On Behalf Of Pedro Barbosa
> Sent: Tuesday, April 16, 2019 11:46 PM
> To: devel@edk2.groups.io <mailto:devel@edk2.groups.io>
> Subject: [edk2-devel] Remove debug strings from OVMF.fd
>
> 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: 8053 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [edk2-devel] Remove debug strings from OVMF.fd
  2019-04-17 17:35   ` Andrew Fish
@ 2019-04-18  0:14     ` Liming Gao
  0 siblings, 0 replies; 6+ messages in thread
From: Liming Gao @ 2019-04-18  0:14 UTC (permalink / raw)
  To: devel@edk2.groups.io, afish@apple.com; +Cc: pedroyossis@gmail.com

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

Andrew:
  Yes. GenFw has -z option to clear debug entry data as zero. I try GenFw with -e PEIM –z together. But, I find the generated EFI image is wrong. I have submitted BZ https://bugzilla.tianocore.org/show_bug.cgi?id=1727 for it. I will fix it.

Thanks
Liming
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Andrew Fish via Groups.Io
Sent: Thursday, April 18, 2019 1:36 AM
To: devel@edk2.groups.io; Gao, Liming <liming.gao@intel.com>
Cc: pedroyossis@gmail.com
Subject: Re: [edk2-devel] Remove debug strings from OVMF.fd




On Apr 16, 2019, at 11:52 PM, Liming Gao <liming.gao@intel.com<mailto:liming.gao@intel.com>> wrote:

<my-edk2-folder>/Build/OvmfX64/RELEASE_GCC5/X64/MdeModulePkg/Application/UiApp/UiApp/DEBUG/UiApp.dll is generated by GenFw tool. When GenFw tool convert ELF image to EFI image, it inserts the debug entry with the below string.


Liming,

Is there a way to turn it off? Does it follow the -g flag passed to the compiler? Can you post process with GenFw --zero to remove it?

Thanks,

Andrew Fish



Thanks
Liming
From: devel@edk2.groups.io<mailto:devel@edk2.groups.io> [mailto:devel@edk2.groups.io] On Behalf Of Pedro Barbosa
Sent: Tuesday, April 16, 2019 11:46 PM
To: devel@edk2.groups.io<mailto:devel@edk2.groups.io>
Subject: [edk2-devel] Remove debug strings from OVMF.fd

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: 10091 bytes --]

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-04-18  0:14 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2019-04-17  6:52 ` Liming Gao
2019-04-17 17:35   ` Andrew Fish
2019-04-18  0:14     ` Liming Gao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox