[edk2-devel] [Patch] BaseTools: Update GenFw tool to support -e -z option together
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1727 -e -z option is to generate EFI image with zero debug entry. It can be used to check the EFI image in DEBUG build. Signed-off-by: Liming Gao Cc: Bob Feng --- BaseTools/Source/C/GenFw/GenFw.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c index 973bae5fe4..c99782b78e 100644 --- a/BaseTools/Source/C/GenFw/GenFw.c +++ b/BaseTools/Source/C/GenFw/GenFw.c @@ -,6 +,7 @@ Returns: time_t InputFileTime; time_t OutputFileTime; struct stat Stat_Buf; + BOOLEAN ZeroDebugFlag; SetUtilityName (UTILITY_NAME); @@ -1158,6 +1159,7 @@ Returns: NegativeAddr = FALSE; InputFileTime = 0; OutputFileTime = 0; + ZeroDebugFlag = FALSE; if (argc == 1) { Error (NULL, 0, 1001, "Missing options", "No input options."); @@ -1197,6 +1199,9 @@ Returns: goto Finish; } ModuleType = argv[1]; + if (mOutImageType == FW_ZERO_DEBUG_IMAGE) { +ZeroDebugFlag = TRUE; + } if (mOutImageType != FW_TE_IMAGE) { mOutImageType = FW_EFI_IMAGE; } @@ -1220,6 +1225,9 @@ Returns: } if ((stricmp (argv[0], "-t") == 0) || (stricmp (argv[0], "--terse") == 0)) { + if (mOutImageType == FW_ZERO_DEBUG_IMAGE) { +ZeroDebugFlag = TRUE; + } mOutImageType = FW_TE_IMAGE; argc --; argv ++; @@ -1241,7 +1249,12 @@ Returns: } if ((stricmp (argv[0], "-z") == 0) || (stricmp (argv[0], "--zero") == 0)) { - mOutImageType = FW_ZERO_DEBUG_IMAGE; + if (mOutImageType == FW_DUMMY_IMAGE) { +mOutImageType = FW_ZERO_DEBUG_IMAGE; + } + if (mOutImageType == FW_TE_IMAGE || mOutImageType == FW_EFI_IMAGE) { +ZeroDebugFlag = TRUE; + } argc --; argv ++; continue; @@ -2588,7 +2601,7 @@ Returns: // // Zero Time/Data field // - ZeroDebugData (FileBuffer, FALSE); + ZeroDebugData (FileBuffer, ZeroDebugFlag); if (mOutImageType == FW_TE_IMAGE) { if ((PeHdr->Pe32.FileHeader.NumberOfSections &~0xFF) || (Type &~0xFF)) { -- 2.13.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#46651): https://edk2.groups.io/g/devel/message/46651 Mute This Topic: https://groups.io/mt/33107042/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [Patch] BaseTools: Update GenFw tool to support -e -z option together
Liming, The patch looks good to me. A minor comment that the code looks fix the bug of the combinations of -e -z and -t -z, so would you please update the commit message to add "-t -z" Thanks, Bob -Original Message- From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Liming Gao Sent: Monday, September 2, 2019 9:31 AM To: devel@edk2.groups.io Cc: Feng, Bob C Subject: [edk2-devel] [Patch] BaseTools: Update GenFw tool to support -e -z option together BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1727 -e -z option is to generate EFI image with zero debug entry. It can be used to check the EFI image in DEBUG build. Signed-off-by: Liming Gao Cc: Bob Feng --- BaseTools/Source/C/GenFw/GenFw.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c index 973bae5fe4..c99782b78e 100644 --- a/BaseTools/Source/C/GenFw/GenFw.c +++ b/BaseTools/Source/C/GenFw/GenFw.c @@ -,6 +,7 @@ Returns: time_t InputFileTime; time_t OutputFileTime; struct stat Stat_Buf; + BOOLEAN ZeroDebugFlag; SetUtilityName (UTILITY_NAME); @@ -1158,6 +1159,7 @@ Returns: NegativeAddr = FALSE; InputFileTime = 0; OutputFileTime = 0; + ZeroDebugFlag = FALSE; if (argc == 1) { Error (NULL, 0, 1001, "Missing options", "No input options."); @@ -1197,6 +1199,9 @@ Returns: goto Finish; } ModuleType = argv[1]; + if (mOutImageType == FW_ZERO_DEBUG_IMAGE) { +ZeroDebugFlag = TRUE; + } if (mOutImageType != FW_TE_IMAGE) { mOutImageType = FW_EFI_IMAGE; } @@ -1220,6 +1225,9 @@ Returns: } if ((stricmp (argv[0], "-t") == 0) || (stricmp (argv[0], "--terse") == 0)) { + if (mOutImageType == FW_ZERO_DEBUG_IMAGE) { +ZeroDebugFlag = TRUE; + } mOutImageType = FW_TE_IMAGE; argc --; argv ++; @@ -1241,7 +1249,12 @@ Returns: } if ((stricmp (argv[0], "-z") == 0) || (stricmp (argv[0], "--zero") == 0)) { - mOutImageType = FW_ZERO_DEBUG_IMAGE; + if (mOutImageType == FW_DUMMY_IMAGE) { +mOutImageType = FW_ZERO_DEBUG_IMAGE; + } + if (mOutImageType == FW_TE_IMAGE || mOutImageType == FW_EFI_IMAGE) { +ZeroDebugFlag = TRUE; + } argc --; argv ++; continue; @@ -2588,7 +2601,7 @@ Returns: // // Zero Time/Data field // - ZeroDebugData (FileBuffer, FALSE); + ZeroDebugData (FileBuffer, ZeroDebugFlag); if (mOutImageType == FW_TE_IMAGE) { if ((PeHdr->Pe32.FileHeader.NumberOfSections &~0xFF) || (Type &~0xFF)) { -- 2.13.0.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#46727): https://edk2.groups.io/g/devel/message/46727 Mute This Topic: https://groups.io/mt/33107042/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [Patch] BaseTools: Update GenFw tool to support -e -z option together
Yes. Thanks for your comments. I will update it and push the change. Thanks Liming >-Original Message- >From: Feng, Bob C >Sent: Wednesday, September 04, 2019 9:03 AM >To: devel@edk2.groups.io; Gao, Liming >Subject: RE: [edk2-devel] [Patch] BaseTools: Update GenFw tool to support -e >-z option together > >Liming, > >The patch looks good to me. > >A minor comment that the code looks fix the bug of the combinations of -e -z >and -t -z, so would you please update the commit message to add "-t -z" > >Thanks, >Bob > >-Original Message- >From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of >Liming Gao >Sent: Monday, September 2, 2019 9:31 AM >To: devel@edk2.groups.io >Cc: Feng, Bob C >Subject: [edk2-devel] [Patch] BaseTools: Update GenFw tool to support -e -z >option together > >BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1727 >-e -z option is to generate EFI image with zero debug entry. >It can be used to check the EFI image in DEBUG build. > >Signed-off-by: Liming Gao >Cc: Bob Feng >--- > BaseTools/Source/C/GenFw/GenFw.c | 17 +++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > >diff --git a/BaseTools/Source/C/GenFw/GenFw.c >b/BaseTools/Source/C/GenFw/GenFw.c >index 973bae5fe4..c99782b78e 100644 >--- a/BaseTools/Source/C/GenFw/GenFw.c >+++ b/BaseTools/Source/C/GenFw/GenFw.c >@@ -,6 +,7 @@ Returns: > time_t InputFileTime; > time_t OutputFileTime; > struct stat Stat_Buf; >+ BOOLEAN ZeroDebugFlag; > > SetUtilityName (UTILITY_NAME); > >@@ -1158,6 +1159,7 @@ Returns: > NegativeAddr = FALSE; > InputFileTime = 0; > OutputFileTime = 0; >+ ZeroDebugFlag = FALSE; > > if (argc == 1) { > Error (NULL, 0, 1001, "Missing options", "No input options."); @@ -1197,6 >+1199,9 @@ Returns: > goto Finish; > } > ModuleType = argv[1]; >+ if (mOutImageType == FW_ZERO_DEBUG_IMAGE) { >+ZeroDebugFlag = TRUE; >+ } > if (mOutImageType != FW_TE_IMAGE) { > mOutImageType = FW_EFI_IMAGE; > } >@@ -1220,6 +1225,9 @@ Returns: > } > > if ((stricmp (argv[0], "-t") == 0) || (stricmp (argv[0], "--terse") == > 0)) { >+ if (mOutImageType == FW_ZERO_DEBUG_IMAGE) { >+ZeroDebugFlag = TRUE; >+ } > mOutImageType = FW_TE_IMAGE; > argc --; > argv ++; >@@ -1241,7 +1249,12 @@ Returns: > } > > if ((stricmp (argv[0], "-z") == 0) || (stricmp (argv[0], "--zero") == 0)) > { >- mOutImageType = FW_ZERO_DEBUG_IMAGE; >+ if (mOutImageType == FW_DUMMY_IMAGE) { >+mOutImageType = FW_ZERO_DEBUG_IMAGE; >+ } >+ if (mOutImageType == FW_TE_IMAGE || mOutImageType == >FW_EFI_IMAGE) { >+ZeroDebugFlag = TRUE; >+ } > argc --; > argv ++; > continue; >@@ -2588,7 +2601,7 @@ Returns: > // > // Zero Time/Data field > // >- ZeroDebugData (FileBuffer, FALSE); >+ ZeroDebugData (FileBuffer, ZeroDebugFlag); > > if (mOutImageType == FW_TE_IMAGE) { > if ((PeHdr->Pe32.FileHeader.NumberOfSections &~0xFF) || (Type &~0xFF)) >{ >-- >2.13.0.windows.1 > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#46729): https://edk2.groups.io/g/devel/message/46729 Mute This Topic: https://groups.io/mt/33107042/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-
Re: [edk2-devel] [Patch] BaseTools: Update GenFw tool to support -e -z option together
Thanks, with the change, Reviewed-by: Bob Feng -Original Message- From: Gao, Liming Sent: Wednesday, September 4, 2019 9:21 AM To: Feng, Bob C ; devel@edk2.groups.io Subject: RE: [edk2-devel] [Patch] BaseTools: Update GenFw tool to support -e -z option together Yes. Thanks for your comments. I will update it and push the change. Thanks Liming >-Original Message- >From: Feng, Bob C >Sent: Wednesday, September 04, 2019 9:03 AM >To: devel@edk2.groups.io; Gao, Liming >Subject: RE: [edk2-devel] [Patch] BaseTools: Update GenFw tool to >support -e -z option together > >Liming, > >The patch looks good to me. > >A minor comment that the code looks fix the bug of the combinations of >-e -z and -t -z, so would you please update the commit message to add "-t -z" > >Thanks, >Bob > >-Original Message- >From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of >Liming Gao >Sent: Monday, September 2, 2019 9:31 AM >To: devel@edk2.groups.io >Cc: Feng, Bob C >Subject: [edk2-devel] [Patch] BaseTools: Update GenFw tool to support >-e -z option together > >BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1727 >-e -z option is to generate EFI image with zero debug entry. >It can be used to check the EFI image in DEBUG build. > >Signed-off-by: Liming Gao >Cc: Bob Feng >--- > BaseTools/Source/C/GenFw/GenFw.c | 17 +++-- > 1 file changed, 15 insertions(+), 2 deletions(-) > >diff --git a/BaseTools/Source/C/GenFw/GenFw.c >b/BaseTools/Source/C/GenFw/GenFw.c >index 973bae5fe4..c99782b78e 100644 >--- a/BaseTools/Source/C/GenFw/GenFw.c >+++ b/BaseTools/Source/C/GenFw/GenFw.c >@@ -,6 +,7 @@ Returns: > time_t InputFileTime; > time_t OutputFileTime; > struct stat Stat_Buf; >+ BOOLEAN ZeroDebugFlag; > > SetUtilityName (UTILITY_NAME); > >@@ -1158,6 +1159,7 @@ Returns: > NegativeAddr = FALSE; > InputFileTime = 0; > OutputFileTime = 0; >+ ZeroDebugFlag = FALSE; > > if (argc == 1) { > Error (NULL, 0, 1001, "Missing options", "No input options."); @@ > -1197,6 >+1199,9 @@ Returns: > goto Finish; > } > ModuleType = argv[1]; >+ if (mOutImageType == FW_ZERO_DEBUG_IMAGE) { >+ZeroDebugFlag = TRUE; >+ } > if (mOutImageType != FW_TE_IMAGE) { > mOutImageType = FW_EFI_IMAGE; > } >@@ -1220,6 +1225,9 @@ Returns: > } > > if ((stricmp (argv[0], "-t") == 0) || (stricmp (argv[0], > "--terse") == 0)) { >+ if (mOutImageType == FW_ZERO_DEBUG_IMAGE) { >+ZeroDebugFlag = TRUE; >+ } > mOutImageType = FW_TE_IMAGE; > argc --; > argv ++; >@@ -1241,7 +1249,12 @@ Returns: > } > > if ((stricmp (argv[0], "-z") == 0) || (stricmp (argv[0], "--zero") == 0)) > { >- mOutImageType = FW_ZERO_DEBUG_IMAGE; >+ if (mOutImageType == FW_DUMMY_IMAGE) { >+mOutImageType = FW_ZERO_DEBUG_IMAGE; >+ } >+ if (mOutImageType == FW_TE_IMAGE || mOutImageType == >FW_EFI_IMAGE) { >+ZeroDebugFlag = TRUE; >+ } > argc --; > argv ++; > continue; >@@ -2588,7 +2601,7 @@ Returns: > // > // Zero Time/Data field > // >- ZeroDebugData (FileBuffer, FALSE); >+ ZeroDebugData (FileBuffer, ZeroDebugFlag); > > if (mOutImageType == FW_TE_IMAGE) { > if ((PeHdr->Pe32.FileHeader.NumberOfSections &~0xFF) || (Type >&~0xFF)) { >-- >2.13.0.windows.1 > > > -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#46730): https://edk2.groups.io/g/devel/message/46730 Mute This Topic: https://groups.io/mt/33107042/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-