Re: [edk2] [PATCH 0/6] BaseTools/Source/C: take EXTRA_OPTFLAGS and EXTRA_LDFLAGS from the caller

2018-08-08 Thread Laszlo Ersek
On 08/07/18 14:23, Laszlo Ersek wrote:
> On 08/07/18 07:27, Gao, Liming wrote:
>> Laszlo:
>>   I mean to keep the minimal change in PCCT. I don't prevent the necessary 
>> change in PCCT code. Per your comments, this change in PCCT is necessary. If 
>> so, I am OK to this patch. 
>>
>>   Reviewed-by: Liming Gao 
> 
> Thanks -- I understand it better now. I will return to the RHBZ and
> discuss the PCCTS question with the requestors. I will explain your
> preference. If they feel it's really necessary to build PCCTS (antlr and
> dlg) with the additional flags, even just for generating the lexer and
> the parser for VfrCompile, I'll go ahead with your R-b for all six
> patches. If they agree the PCCTS build can ignore the flags, I won't
> modify PCCTS.
> 
> Thank you for taking the time to discuss this! I'll report back.

I will soon submit a v2 that does not touch the PCCTS (antlr & dlg)
build flags.

Thanks!
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 0/6] BaseTools/Source/C: take EXTRA_OPTFLAGS and EXTRA_LDFLAGS from the caller

2018-08-06 Thread Gao, Liming
Laszlo:
  I mean to keep the minimal change in PCCT. I don't prevent the necessary 
change in PCCT code. Per your comments, this change in PCCT is necessary. If 
so, I am OK to this patch. 

  Reviewed-by: Liming Gao 

Thanks
Liming
>-Original Message-
>From: Laszlo Ersek [mailto:ler...@redhat.com]
>Sent: Tuesday, August 07, 2018 12:41 AM
>To: Gao, Liming 
>Cc: edk2-devel-01 
>Subject: Re: [edk2] [PATCH 0/6] BaseTools/Source/C: take EXTRA_OPTFLAGS
>and EXTRA_LDFLAGS from the caller
>
>Hi Liming,
>
>On 08/06/18 17:18, Laszlo Ersek wrote:
>> On 08/06/18 16:48, Gao, Liming wrote:
>>> Laszlo:
>>>   Thanks for your detail information. I understand EXTRA_OPTFLAGS.
>>>   So, its name is OK to me.
>>>
>>>   On Pccts, it is the third party code. I would like to make the
>>>   minimal change. So, I ask whether we not touch it.
>>
>> OK, thank you, I'll look into that.
>
>I started writing up a summary for the stake-holders of
><https://bugzilla.redhat.com/show_bug.cgi?id=1540244>, explaining that
>some source code that goes into the VfrCompile utility is native to the
>edk2 project, while the code that *generates* the lexer and parser
>source code for VfrCompile comes from the PCCTS project, and is used
>only temporarily. And, that this should be a good enough reason to
>ignore PCCTS, because in upstream the maintainers prefer not touching
>PCCTS source.
>
>However: our git history for "BaseTools/Source/C/VfrCompile/Pccts" does
>not corroborate this preference.
>
>Consider:
>
>(a)  1  30fdf1140b8d [2009-07-17] Check In tool source code based on Build tool
>project revision r1655.
> 2  b69fd59e6f1a [2014-08-25] Fix nmake cleanall bugs.
> 3  5ddccf34c4f5 [2015-07-08] BaseTools: Fix build on FreeBSD and allow use
>of non-gcc system compiler
> 4  819a2394f17f [2016-01-11] BaseTools/VfrCompile: honor CC if it is set
> 5  4ac14ceae076 [2016-09-08] BaseTools VfrCompile Pccts: Update GCC Flags
>to the specific one with BUILD_ prefix
>
>Commits #3 through #5 modify the same set of files as my patches 4-6
>-- the "antlr" and "dlg" makefiles.
>
>(b)  6  99e55970ff07 [2016-10-20] BaseTools: Fix typos in comments and
>variables
>
>This is from Gary's series
>
>  [edk2] [PATCH 00/33] Fix typos in comments and variables
>
>and it modifies "dlg" source code.
>
>(c)  7  bab5ad2fd14b [2016-11-08] BaseTools/VfrCompile: Add checks for array
>access
> 8  77dee0b1859d [2016-11-08] BaseTools/VfrCompile: Avoid freeing freed
>memory in classes
> 9  d55638362727 [2016-11-08] BaseTools/VfrCompile/Pccts: Add virtual
>destructor for class DLGInputStream
>10  fef15ecd20dd [2016-11-08] BaseTools/VfrCompile/Pccts: Make
>assignment operator not returning void
>
>These four commits (#7 through #10) are from Hao's series
>
>  [edk2] [PATCH v2 00/53] Resolve issues for C source codes in BaseTools
>
>and they modify PCCTS headers.
>
>(d) 11  5b26adf03a0b [2016-12-20] BaseTools: fix format-security build
>warnings
>12  8230d45bba51 [2016-12-20] BaseTools: fix format type build warnings
>
>Commits #11 and #12 are from Heyi's series
>
>  [edk2] [PATCH 0/4] Fix GCC build warnings for BaseTools
>
>and they modify the "antlr" source code.
>
>(e) 13  0a64f49fde09 [2016-12-23] BaseTools/Pccts: Resolve GCC sting format
>mismatch build warning
>
>This patch is again from Hao, and it modifies utility code in PCCTS
>that is built into both "dlg" and "antlr" (namely, "set.c").
>
>(f) 14  a5b84d3480b4 [2018-01-02] BaseTools: eliminate unused expression
>result
>15  4e97974c1e52 [2018-01-02] BaseTools: silence parentheses-equality
>warning
>
>These are from a series that Zenith432 posted without a cover
>letter. They modify "antlr" and "dlg" source code.
>
>The above examples imply that we have modified both the makefiles and
>the source code under PCCTS, over time.
>
>Do you still prefer that I drop those parts of my series?
>
>I can attempt to do that, but then I cannot tell the RHBZ#1540244
>stakeholders that we "generally" avoid patching the bundled PCCTS
>instance -- because, we do patch it whenever necessary.
>
>Thanks!
>Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 0/6] BaseTools/Source/C: take EXTRA_OPTFLAGS and EXTRA_LDFLAGS from the caller

2018-08-06 Thread Laszlo Ersek
Hi Liming,

On 08/06/18 17:18, Laszlo Ersek wrote:
> On 08/06/18 16:48, Gao, Liming wrote:
>> Laszlo:
>>   Thanks for your detail information. I understand EXTRA_OPTFLAGS.
>>   So, its name is OK to me.
>>
>>   On Pccts, it is the third party code. I would like to make the
>>   minimal change. So, I ask whether we not touch it.
>
> OK, thank you, I'll look into that.

I started writing up a summary for the stake-holders of
, explaining that
some source code that goes into the VfrCompile utility is native to the
edk2 project, while the code that *generates* the lexer and parser
source code for VfrCompile comes from the PCCTS project, and is used
only temporarily. And, that this should be a good enough reason to
ignore PCCTS, because in upstream the maintainers prefer not touching
PCCTS source.

However: our git history for "BaseTools/Source/C/VfrCompile/Pccts" does
not corroborate this preference.

Consider:

(a)  1  30fdf1140b8d [2009-07-17] Check In tool source code based on Build tool 
project revision r1655.
 2  b69fd59e6f1a [2014-08-25] Fix nmake cleanall bugs.
 3  5ddccf34c4f5 [2015-07-08] BaseTools: Fix build on FreeBSD and allow use 
of non-gcc system compiler
 4  819a2394f17f [2016-01-11] BaseTools/VfrCompile: honor CC if it is set
 5  4ac14ceae076 [2016-09-08] BaseTools VfrCompile Pccts: Update GCC Flags 
to the specific one with BUILD_ prefix

Commits #3 through #5 modify the same set of files as my patches 4-6
-- the "antlr" and "dlg" makefiles.

(b)  6  99e55970ff07 [2016-10-20] BaseTools: Fix typos in comments and variables

This is from Gary's series

  [edk2] [PATCH 00/33] Fix typos in comments and variables

and it modifies "dlg" source code.

(c)  7  bab5ad2fd14b [2016-11-08] BaseTools/VfrCompile: Add checks for array 
access
 8  77dee0b1859d [2016-11-08] BaseTools/VfrCompile: Avoid freeing freed 
memory in classes
 9  d55638362727 [2016-11-08] BaseTools/VfrCompile/Pccts: Add virtual 
destructor for class DLGInputStream
10  fef15ecd20dd [2016-11-08] BaseTools/VfrCompile/Pccts: Make assignment 
operator not returning void

These four commits (#7 through #10) are from Hao's series

  [edk2] [PATCH v2 00/53] Resolve issues for C source codes in BaseTools

and they modify PCCTS headers.

(d) 11  5b26adf03a0b [2016-12-20] BaseTools: fix format-security build warnings
12  8230d45bba51 [2016-12-20] BaseTools: fix format type build warnings

Commits #11 and #12 are from Heyi's series

  [edk2] [PATCH 0/4] Fix GCC build warnings for BaseTools

and they modify the "antlr" source code.

(e) 13  0a64f49fde09 [2016-12-23] BaseTools/Pccts: Resolve GCC sting format 
mismatch build warning

This patch is again from Hao, and it modifies utility code in PCCTS
that is built into both "dlg" and "antlr" (namely, "set.c").

(f) 14  a5b84d3480b4 [2018-01-02] BaseTools: eliminate unused expression result
15  4e97974c1e52 [2018-01-02] BaseTools: silence parentheses-equality 
warning

These are from a series that Zenith432 posted without a cover
letter. They modify "antlr" and "dlg" source code.

The above examples imply that we have modified both the makefiles and
the source code under PCCTS, over time.

Do you still prefer that I drop those parts of my series?

I can attempt to do that, but then I cannot tell the RHBZ#1540244
stakeholders that we "generally" avoid patching the bundled PCCTS
instance -- because, we do patch it whenever necessary.

Thanks!
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 0/6] BaseTools/Source/C: take EXTRA_OPTFLAGS and EXTRA_LDFLAGS from the caller

2018-08-06 Thread Gao, Liming
Laszlo:
  Thanks for your detail information. I understand EXTRA_OPTFLAGS. So, its name 
is OK to me. 

  On Pccts, it is the third party code. I would like to make the minimal 
change. So, I ask whether we not touch it. 

Thanks
Liming
> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Friday, August 3, 2018 1:41 AM
> To: Gao, Liming ; edk2-devel-01 
> 
> Cc: Zhu, Yonghong 
> Subject: Re: [PATCH 0/6] BaseTools/Source/C: take EXTRA_OPTFLAGS and 
> EXTRA_LDFLAGS from the caller
> 
> On 08/02/18 17:40, Gao, Liming wrote:
> > Laszlo:
> >   I understand this patch set is to provide the way to append compile and 
> > link option for BaseTools source build.
> 
> Yes.
> 
> > If so, the extend flag name may be EXTRA_CCFLAGS
> 
> I can rename EXTRA_OPTFLAGS to EXTRA_CCFLAGS, but in that case,
> internally we will have:
> 
>   BUILD_OPTFLAGS = -O2 $(EXTRA_CCFLAGS)
> 
> in "header.makefile". In that case, I expect to receive a comment that
> we shouldn't append a generic "CCFLAGS" variable to a more specialized
> "OPTFLAGS" variable.
> 
> Obviously, I can rename "BUILD_OPTFLAGS" to "BUILD_CCFLAGS" as well --
> but, in that case, I expect to receive a comment that we already have
> "BUILD_CFLAGS".
> 
> The variable (more precisely, "RPM macro") that the Fedora distribution
> will put into EXTRA_OPTFLAGS is also called %{optflags}. So I think
> EXTRA_OPTFLAGS is an appropriate name.
> 
> 
> If you still disagree, then can you please suggest a new name not just
> for EXTRA_OPTFLAGS (-->EXTRA_CCFLAGS), but also for BUILD_OPTFLAGS?
> Patch #3 explains why we need a separate BUILD_OPTFLAGS Makefile macro.
> 
> 
> > and EXTRA_LDFLAGS.
> 
> Right, that's the currently proposed name.
> 
> > And, the extend flags are appended in the tail.
> 
> Correct.
> 
> >   Besides, Pccts is the internal tool to generate VfrCompiler syntax source 
> > file. It is not used in build process. I am not sure why they
> also require the additional CC and LD flags.
> 
> It's a general policy thing; all native binaries should be built with
> the system-wide flags. Some of those flags will let the binaries detect
> some buffer overflows automatically, for example, which is helpful even
> if the utility is never installed / packaged, just used as a one-off
> build tool.
> 
> Thanks!
> Laszlo
> 
> >
> > Thanks
> > Liming
> >> -Original Message-
> >> From: Laszlo Ersek [mailto:ler...@redhat.com]
> >> Sent: Thursday, July 26, 2018 8:44 AM
> >> To: edk2-devel-01 
> >> Cc: Gao, Liming ; Zhu, Yonghong 
> >> 
> >> Subject: [PATCH 0/6] BaseTools/Source/C: take EXTRA_OPTFLAGS and 
> >> EXTRA_LDFLAGS from the caller
> >>
> >> Repo:   https://github.com/lersek/edk2.git
> >> Branch: extra_flags_rhbz1540244
> >>
> >> In the Fedora distribution, we'd like to pass system-wide flags related
> >> to optimization and linking when the C and C++ language base tools are
> >> built. This series lets the outermost "make" command push the
> >> EXTRA_OPTFLAGS and EXTRA_LDFLAGS macros into the BaseTools build.
> >>
> >> Cc: Liming Gao 
> >> Cc: Yonghong Zhu 
> >>
> >> Thanks
> >> Laszlo
> >>
> >> Laszlo Ersek (6):
> >>   BaseTools/footer.makefile: expand BUILD_CFLAGS last for C files too
> >>   BaseTools/header.makefile: remove "-c" from BUILD_CFLAGS
> >>   BaseTools/Source/C: split "-O2" to BUILD_OPTFLAGS
> >>   BaseTools/Pccts: clean up antlr and dlg makefiles
> >>   BaseTools/Source/C: take EXTRA_OPTFLAGS from the caller
> >>   BaseTools/Source/C: take EXTRA_LDFLAGS from the caller
> >>
> >>  BaseTools/Source/C/Makefiles/footer.makefile   |  2 +-
> >>  BaseTools/Source/C/Makefiles/header.makefile   | 16 ---
> >>  BaseTools/Source/C/VfrCompile/GNUmakefile  | 11 +---
> >>  BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile | 22 ++-
> >>  BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile   | 28 
> >> +---
> >>  5 files changed, 56 insertions(+), 23 deletions(-)
> >>
> >> --
> >> 2.14.1.3.gb7cf6e02401b
> >

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 0/6] BaseTools/Source/C: take EXTRA_OPTFLAGS and EXTRA_LDFLAGS from the caller

2018-08-02 Thread Laszlo Ersek
On 08/02/18 17:40, Gao, Liming wrote:
> Laszlo:
>   I understand this patch set is to provide the way to append compile and 
> link option for BaseTools source build.

Yes.

> If so, the extend flag name may be EXTRA_CCFLAGS

I can rename EXTRA_OPTFLAGS to EXTRA_CCFLAGS, but in that case,
internally we will have:

  BUILD_OPTFLAGS = -O2 $(EXTRA_CCFLAGS)

in "header.makefile". In that case, I expect to receive a comment that
we shouldn't append a generic "CCFLAGS" variable to a more specialized
"OPTFLAGS" variable.

Obviously, I can rename "BUILD_OPTFLAGS" to "BUILD_CCFLAGS" as well --
but, in that case, I expect to receive a comment that we already have
"BUILD_CFLAGS".

The variable (more precisely, "RPM macro") that the Fedora distribution
will put into EXTRA_OPTFLAGS is also called %{optflags}. So I think
EXTRA_OPTFLAGS is an appropriate name.


If you still disagree, then can you please suggest a new name not just
for EXTRA_OPTFLAGS (-->EXTRA_CCFLAGS), but also for BUILD_OPTFLAGS?
Patch #3 explains why we need a separate BUILD_OPTFLAGS Makefile macro.


> and EXTRA_LDFLAGS.

Right, that's the currently proposed name.

> And, the extend flags are appended in the tail. 

Correct.

>   Besides, Pccts is the internal tool to generate VfrCompiler syntax source 
> file. It is not used in build process. I am not sure why they also require 
> the additional CC and LD flags.

It's a general policy thing; all native binaries should be built with
the system-wide flags. Some of those flags will let the binaries detect
some buffer overflows automatically, for example, which is helpful even
if the utility is never installed / packaged, just used as a one-off
build tool.

Thanks!
Laszlo

> 
> Thanks
> Liming
>> -Original Message-
>> From: Laszlo Ersek [mailto:ler...@redhat.com]
>> Sent: Thursday, July 26, 2018 8:44 AM
>> To: edk2-devel-01 
>> Cc: Gao, Liming ; Zhu, Yonghong 
>> 
>> Subject: [PATCH 0/6] BaseTools/Source/C: take EXTRA_OPTFLAGS and 
>> EXTRA_LDFLAGS from the caller
>>
>> Repo:   https://github.com/lersek/edk2.git
>> Branch: extra_flags_rhbz1540244
>>
>> In the Fedora distribution, we'd like to pass system-wide flags related
>> to optimization and linking when the C and C++ language base tools are
>> built. This series lets the outermost "make" command push the
>> EXTRA_OPTFLAGS and EXTRA_LDFLAGS macros into the BaseTools build.
>>
>> Cc: Liming Gao 
>> Cc: Yonghong Zhu 
>>
>> Thanks
>> Laszlo
>>
>> Laszlo Ersek (6):
>>   BaseTools/footer.makefile: expand BUILD_CFLAGS last for C files too
>>   BaseTools/header.makefile: remove "-c" from BUILD_CFLAGS
>>   BaseTools/Source/C: split "-O2" to BUILD_OPTFLAGS
>>   BaseTools/Pccts: clean up antlr and dlg makefiles
>>   BaseTools/Source/C: take EXTRA_OPTFLAGS from the caller
>>   BaseTools/Source/C: take EXTRA_LDFLAGS from the caller
>>
>>  BaseTools/Source/C/Makefiles/footer.makefile   |  2 +-
>>  BaseTools/Source/C/Makefiles/header.makefile   | 16 ---
>>  BaseTools/Source/C/VfrCompile/GNUmakefile  | 11 +---
>>  BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile | 22 ++-
>>  BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile   | 28 +---
>>  5 files changed, 56 insertions(+), 23 deletions(-)
>>
>> --
>> 2.14.1.3.gb7cf6e02401b
> 

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 0/6] BaseTools/Source/C: take EXTRA_OPTFLAGS and EXTRA_LDFLAGS from the caller

2018-08-02 Thread Gao, Liming
Laszlo:
  I understand this patch set is to provide the way to append compile and link 
option for BaseTools source build. If so, the extend flag name may be 
EXTRA_CCFLAGS and EXTRA_LDFLAGS. And, the extend flags are appended in the 
tail. 

  Besides, Pccts is the internal tool to generate VfrCompiler syntax source 
file. It is not used in build process. I am not sure why they also require the 
additional CC and LD flags. 

Thanks
Liming
> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Thursday, July 26, 2018 8:44 AM
> To: edk2-devel-01 
> Cc: Gao, Liming ; Zhu, Yonghong 
> Subject: [PATCH 0/6] BaseTools/Source/C: take EXTRA_OPTFLAGS and 
> EXTRA_LDFLAGS from the caller
> 
> Repo:   https://github.com/lersek/edk2.git
> Branch: extra_flags_rhbz1540244
> 
> In the Fedora distribution, we'd like to pass system-wide flags related
> to optimization and linking when the C and C++ language base tools are
> built. This series lets the outermost "make" command push the
> EXTRA_OPTFLAGS and EXTRA_LDFLAGS macros into the BaseTools build.
> 
> Cc: Liming Gao 
> Cc: Yonghong Zhu 
> 
> Thanks
> Laszlo
> 
> Laszlo Ersek (6):
>   BaseTools/footer.makefile: expand BUILD_CFLAGS last for C files too
>   BaseTools/header.makefile: remove "-c" from BUILD_CFLAGS
>   BaseTools/Source/C: split "-O2" to BUILD_OPTFLAGS
>   BaseTools/Pccts: clean up antlr and dlg makefiles
>   BaseTools/Source/C: take EXTRA_OPTFLAGS from the caller
>   BaseTools/Source/C: take EXTRA_LDFLAGS from the caller
> 
>  BaseTools/Source/C/Makefiles/footer.makefile   |  2 +-
>  BaseTools/Source/C/Makefiles/header.makefile   | 16 ---
>  BaseTools/Source/C/VfrCompile/GNUmakefile  | 11 +---
>  BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile | 22 ++-
>  BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile   | 28 +---
>  5 files changed, 56 insertions(+), 23 deletions(-)
> 
> --
> 2.14.1.3.gb7cf6e02401b

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH 0/6] BaseTools/Source/C: take EXTRA_OPTFLAGS and EXTRA_LDFLAGS from the caller

2018-07-25 Thread Laszlo Ersek
Repo:   https://github.com/lersek/edk2.git
Branch: extra_flags_rhbz1540244

In the Fedora distribution, we'd like to pass system-wide flags related
to optimization and linking when the C and C++ language base tools are
built. This series lets the outermost "make" command push the
EXTRA_OPTFLAGS and EXTRA_LDFLAGS macros into the BaseTools build.

Cc: Liming Gao 
Cc: Yonghong Zhu 

Thanks
Laszlo

Laszlo Ersek (6):
  BaseTools/footer.makefile: expand BUILD_CFLAGS last for C files too
  BaseTools/header.makefile: remove "-c" from BUILD_CFLAGS
  BaseTools/Source/C: split "-O2" to BUILD_OPTFLAGS
  BaseTools/Pccts: clean up antlr and dlg makefiles
  BaseTools/Source/C: take EXTRA_OPTFLAGS from the caller
  BaseTools/Source/C: take EXTRA_LDFLAGS from the caller

 BaseTools/Source/C/Makefiles/footer.makefile   |  2 +-
 BaseTools/Source/C/Makefiles/header.makefile   | 16 ---
 BaseTools/Source/C/VfrCompile/GNUmakefile  | 11 +---
 BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile | 22 ++-
 BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile   | 28 +---
 5 files changed, 56 insertions(+), 23 deletions(-)

-- 
2.14.1.3.gb7cf6e02401b

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel