public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH 0/3] BaseTools: patches to build with gcc12
@ 2022-03-24 12:04 Gerd Hoffmann
  2022-03-24 12:04 ` [PATCH 1/3] BaseTools: fix gcc12 warning Gerd Hoffmann
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: Gerd Hoffmann @ 2022-03-24 12:04 UTC (permalink / raw)
  To: devel
  Cc: Pawel Polawski, Liming Gao, Yuwei Chen, Oliver Steffen, Bob Feng,
	Gerd Hoffmann

Two bugfixes (patches 1+2), one workaround (#3).

Gerd Hoffmann (3):
  BaseTools: fix gcc12 warning
  BaseTools: fix gcc12 warning
  Basetools: turn off gcc12 warning

 BaseTools/Source/C/GenFfs/GenFfs.c              | 2 +-
 BaseTools/Source/C/GenSec/GenSec.c              | 2 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c | 3 ++-
 BaseTools/Source/C/DevicePath/GNUmakefile       | 3 +++
 4 files changed, 7 insertions(+), 3 deletions(-)

-- 
2.35.1


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

* [PATCH 1/3] BaseTools: fix gcc12 warning
  2022-03-24 12:04 [PATCH 0/3] BaseTools: patches to build with gcc12 Gerd Hoffmann
@ 2022-03-24 12:04 ` Gerd Hoffmann
  2022-03-24 12:04 ` [PATCH 2/3] " Gerd Hoffmann
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 10+ messages in thread
From: Gerd Hoffmann @ 2022-03-24 12:04 UTC (permalink / raw)
  To: devel
  Cc: Pawel Polawski, Liming Gao, Yuwei Chen, Oliver Steffen, Bob Feng,
	Gerd Hoffmann

GenFfs.c:545:5: error: pointer ‘InFileHandle’ used after ‘fclose’ [-Werror=use-after-free]
  545 |     Error(NULL, 0, 4001, "Resource", "memory cannot be allocated  of %s", InFileHandle);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GenFfs.c:544:5: note: call to ‘fclose’ here
  544 |     fclose (InFileHandle);
      |     ^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 BaseTools/Source/C/GenFfs/GenFfs.c | 2 +-
 BaseTools/Source/C/GenSec/GenSec.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c
index 949025c33325..d78d62ab3689 100644
--- a/BaseTools/Source/C/GenFfs/GenFfs.c
+++ b/BaseTools/Source/C/GenFfs/GenFfs.c
@@ -542,7 +542,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
   PeFileBuffer = (UINT8 *) malloc (PeFileSize);
   if (PeFileBuffer == NULL) {
     fclose (InFileHandle);
-    Error(NULL, 0, 4001, "Resource", "memory cannot be allocated  of %s", InFileHandle);
+    Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile);
     return EFI_OUT_OF_RESOURCES;
   }
   fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c
index d54a4f9e0a7d..b1d05367ec0b 100644
--- a/BaseTools/Source/C/GenSec/GenSec.c
+++ b/BaseTools/Source/C/GenSec/GenSec.c
@@ -1062,7 +1062,7 @@ GetAlignmentFromFile(char *InFile, UINT32 *Alignment)
   PeFileBuffer = (UINT8 *) malloc (PeFileSize);
   if (PeFileBuffer == NULL) {
     fclose (InFileHandle);
-    Error(NULL, 0, 4001, "Resource", "memory cannot be allocated  of %s", InFileHandle);
+    Error(NULL, 0, 4001, "Resource", "memory cannot be allocated for %s", InFile);
     return EFI_OUT_OF_RESOURCES;
   }
   fread (PeFileBuffer, sizeof (UINT8), PeFileSize, InFileHandle);
-- 
2.35.1


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

* [PATCH 2/3] BaseTools: fix gcc12 warning
  2022-03-24 12:04 [PATCH 0/3] BaseTools: patches to build with gcc12 Gerd Hoffmann
  2022-03-24 12:04 ` [PATCH 1/3] BaseTools: fix gcc12 warning Gerd Hoffmann
@ 2022-03-24 12:04 ` Gerd Hoffmann
  2022-03-24 12:04 ` [PATCH 3/3] Basetools: turn off " Gerd Hoffmann
  2022-03-26 13:57 ` [edk2-devel] [PATCH 0/3] BaseTools: patches to build with gcc12 Bob Feng
  3 siblings, 0 replies; 10+ messages in thread
From: Gerd Hoffmann @ 2022-03-24 12:04 UTC (permalink / raw)
  To: devel
  Cc: Pawel Polawski, Liming Gao, Yuwei Chen, Oliver Steffen, Bob Feng,
	Gerd Hoffmann

Sdk/C/LzmaEnc.c: In function ‘LzmaEnc_CodeOneMemBlock’:
Sdk/C/LzmaEnc.c:2828:19: error: storing the address of local variable ‘outStream’ in ‘*p.rc.outStream’ [-Werror=dangling-pointer=]
 2828 |   p->rc.outStream = &outStream.vt;
      |   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
Sdk/C/LzmaEnc.c:2811:28: note: ‘outStream’ declared here
 2811 |   CLzmaEnc_SeqOutStreamBuf outStream;
      |                            ^~~~~~~~~
Sdk/C/LzmaEnc.c:2811:28: note: ‘pp’ declared here
Sdk/C/LzmaEnc.c:2828:19: error: storing the address of local variable ‘outStream’ in ‘*(CLzmaEnc *)pp.rc.outStream’ [-Werror=dangling-pointer=]
 2828 |   p->rc.outStream = &outStream.vt;
      |   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
Sdk/C/LzmaEnc.c:2811:28: note: ‘outStream’ declared here
 2811 |   CLzmaEnc_SeqOutStreamBuf outStream;
      |                            ^~~~~~~~~
Sdk/C/LzmaEnc.c:2811:28: note: ‘pp’ declared here
cc1: all warnings being treated as errors

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
index 4e9b499f8d80..4b9f5fa69248 100644
--- a/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
+++ b/BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c
@@ -2825,12 +2825,13 @@ SRes LzmaEnc_CodeOneMemBlock(CLzmaEncHandle pp, BoolInt reInit,
 
   nowPos64 = p->nowPos64;
   RangeEnc_Init(&p->rc);
-  p->rc.outStream = &outStream.vt;
 
   if (desiredPackSize == 0)
     return SZ_ERROR_OUTPUT_EOF;
 
+  p->rc.outStream = &outStream.vt;
   res = LzmaEnc_CodeOneBlock(p, desiredPackSize, *unpackSize);
+  p->rc.outStream = NULL;
 
   *unpackSize = (UInt32)(p->nowPos64 - nowPos64);
   *destLen -= outStream.rem;
-- 
2.35.1


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

* [PATCH 3/3] Basetools: turn off gcc12 warning
  2022-03-24 12:04 [PATCH 0/3] BaseTools: patches to build with gcc12 Gerd Hoffmann
  2022-03-24 12:04 ` [PATCH 1/3] BaseTools: fix gcc12 warning Gerd Hoffmann
  2022-03-24 12:04 ` [PATCH 2/3] " Gerd Hoffmann
@ 2022-03-24 12:04 ` Gerd Hoffmann
  2022-03-28 21:29   ` [edk2-devel] " Rebecca Cran
  2022-03-26 13:57 ` [edk2-devel] [PATCH 0/3] BaseTools: patches to build with gcc12 Bob Feng
  3 siblings, 1 reply; 10+ messages in thread
From: Gerd Hoffmann @ 2022-03-24 12:04 UTC (permalink / raw)
  To: devel
  Cc: Pawel Polawski, Liming Gao, Yuwei Chen, Oliver Steffen, Bob Feng,
	Gerd Hoffmann

In function ‘SetDevicePathEndNode’,
    inlined from ‘FileDevicePath’ at DevicePathUtilities.c:857:5:
DevicePathUtilities.c:321:3: error: writing 4 bytes into a region of size 1 [-Werror=stringop-overflow=]
  321 |   memcpy (Node, &mUefiDevicePathLibEndDevicePath, sizeof (mUefiDevicePathLibEndDevicePath));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from UefiDevicePathLib.h:22,
                 from DevicePathUtilities.c:16:
../Include/Protocol/DevicePath.h: In function ‘FileDevicePath’:
../Include/Protocol/DevicePath.h:51:9: note: destination object ‘Type’ of size 1
   51 |   UINT8 Type;       ///< 0x01 Hardware Device Path.
      |         ^~~~

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 BaseTools/Source/C/DevicePath/GNUmakefile | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile b/BaseTools/Source/C/DevicePath/GNUmakefile
index 7ca08af9662d..b05d2bddfa68 100644
--- a/BaseTools/Source/C/DevicePath/GNUmakefile
+++ b/BaseTools/Source/C/DevicePath/GNUmakefile
@@ -13,6 +13,9 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili
 
 include $(MAKEROOT)/Makefiles/app.makefile
 
+# gcc 12 trips over device path handling
+BUILD_CFLAGS += -Wno-error=stringop-overflow
+
 LIBS = -lCommon
 ifeq ($(CYGWIN), CYGWIN)
   LIBS += -L/lib/e2fsprogs -luuid
-- 
2.35.1


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

* Re: [edk2-devel] [PATCH 0/3] BaseTools: patches to build with gcc12
  2022-03-24 12:04 [PATCH 0/3] BaseTools: patches to build with gcc12 Gerd Hoffmann
                   ` (2 preceding siblings ...)
  2022-03-24 12:04 ` [PATCH 3/3] Basetools: turn off " Gerd Hoffmann
@ 2022-03-26 13:57 ` Bob Feng
  3 siblings, 0 replies; 10+ messages in thread
From: Bob Feng @ 2022-03-26 13:57 UTC (permalink / raw)
  To: devel@edk2.groups.io, kraxel@redhat.com
  Cc: Pawel Polawski, Gao, Liming, Chen, Christine, Oliver Steffen

Reviewed-by: Bob Feng<bob.c.feng@intel.com>

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Gerd Hoffmann
Sent: Thursday, March 24, 2022 8:05 PM
To: devel@edk2.groups.io
Cc: Pawel Polawski <ppolawsk@redhat.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>; Oliver Steffen <osteffen@redhat.com>; Feng, Bob C <bob.c.feng@intel.com>; Gerd Hoffmann <kraxel@redhat.com>
Subject: [edk2-devel] [PATCH 0/3] BaseTools: patches to build with gcc12

Two bugfixes (patches 1+2), one workaround (#3).

Gerd Hoffmann (3):
  BaseTools: fix gcc12 warning
  BaseTools: fix gcc12 warning
  Basetools: turn off gcc12 warning

 BaseTools/Source/C/GenFfs/GenFfs.c              | 2 +-
 BaseTools/Source/C/GenSec/GenSec.c              | 2 +-
 BaseTools/Source/C/LzmaCompress/Sdk/C/LzmaEnc.c | 3 ++-
 BaseTools/Source/C/DevicePath/GNUmakefile       | 3 +++
 4 files changed, 7 insertions(+), 3 deletions(-)

-- 
2.35.1







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

* Re: [edk2-devel] [PATCH 3/3] Basetools: turn off gcc12 warning
  2022-03-24 12:04 ` [PATCH 3/3] Basetools: turn off " Gerd Hoffmann
@ 2022-03-28 21:29   ` Rebecca Cran
  2022-03-29  4:00     ` Bob Feng
  0 siblings, 1 reply; 10+ messages in thread
From: Rebecca Cran @ 2022-03-28 21:29 UTC (permalink / raw)
  To: devel, kraxel
  Cc: Pawel Polawski, Liming Gao, Yuwei Chen, Oliver Steffen, Bob Feng

This breaks building BaseTools with clang 13.1.6 on macOS:


/Applications/Xcode.app/Contents/Developer/usr/bin/make -C DevicePath
gcc  -c  -I .. -I ../Include/Common -I ../Include/ -I 
../Include/IndustryStandard -I ../Common/ -I .. -I . -I 
../Include/AArch64/ -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror 
-Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result 
-nostdlib -g -O2  -Wno-error=stringop-overflow DevicePath.c -o DevicePath.o
error: unknown warning option '-Werror=stringop-overflow'; did you mean 
'-Werror=shift-overflow'? [-Werror,-Wunknown-warning-option]


-- 

Rebecca Cran


On 3/24/22 6:04 AM, Gerd Hoffmann wrote:
> In function ‘SetDevicePathEndNode’,
>      inlined from ‘FileDevicePath’ at DevicePathUtilities.c:857:5:
> DevicePathUtilities.c:321:3: error: writing 4 bytes into a region of size 1 [-Werror=stringop-overflow=]
>    321 |   memcpy (Node, &mUefiDevicePathLibEndDevicePath, sizeof (mUefiDevicePathLibEndDevicePath));
>        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from UefiDevicePathLib.h:22,
>                   from DevicePathUtilities.c:16:
> ../Include/Protocol/DevicePath.h: In function ‘FileDevicePath’:
> ../Include/Protocol/DevicePath.h:51:9: note: destination object ‘Type’ of size 1
>     51 |   UINT8 Type;       ///< 0x01 Hardware Device Path.
>        |         ^~~~
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>   BaseTools/Source/C/DevicePath/GNUmakefile | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile b/BaseTools/Source/C/DevicePath/GNUmakefile
> index 7ca08af9662d..b05d2bddfa68 100644
> --- a/BaseTools/Source/C/DevicePath/GNUmakefile
> +++ b/BaseTools/Source/C/DevicePath/GNUmakefile
> @@ -13,6 +13,9 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili
>   
>   include $(MAKEROOT)/Makefiles/app.makefile
>   
> +# gcc 12 trips over device path handling
> +BUILD_CFLAGS += -Wno-error=stringop-overflow
> +
>   LIBS = -lCommon
>   ifeq ($(CYGWIN), CYGWIN)
>     LIBS += -L/lib/e2fsprogs -luuid

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

* Re: [edk2-devel] [PATCH 3/3] Basetools: turn off gcc12 warning
  2022-03-28 21:29   ` [edk2-devel] " Rebecca Cran
@ 2022-03-29  4:00     ` Bob Feng
  2022-03-29 18:14       ` grant
  0 siblings, 1 reply; 10+ messages in thread
From: Bob Feng @ 2022-03-29  4:00 UTC (permalink / raw)
  To: Rebecca Cran, devel@edk2.groups.io, kraxel@redhat.com
  Cc: Pawel Polawski, Gao, Liming, Chen, Christine, Oliver Steffen

Hi Gerd,

Could you provide a patch to fix this issue or revert the original commit? 

Thanks,
Bob

-----Original Message-----
From: Rebecca Cran <rebecca@bsdio.com> 
Sent: Tuesday, March 29, 2022 5:30 AM
To: devel@edk2.groups.io; kraxel@redhat.com
Cc: Pawel Polawski <ppolawsk@redhat.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Chen, Christine <yuwei.chen@intel.com>; Oliver Steffen <osteffen@redhat.com>; Feng, Bob C <bob.c.feng@intel.com>
Subject: Re: [edk2-devel] [PATCH 3/3] Basetools: turn off gcc12 warning

This breaks building BaseTools with clang 13.1.6 on macOS:


/Applications/Xcode.app/Contents/Developer/usr/bin/make -C DevicePath gcc  -c  -I .. -I ../Include/Common -I ../Include/ -I ../Include/IndustryStandard -I ../Common/ -I .. -I . -I ../Include/AArch64/ -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -g -O2  -Wno-error=stringop-overflow DevicePath.c -o DevicePath.o
error: unknown warning option '-Werror=stringop-overflow'; did you mean '-Werror=shift-overflow'? [-Werror,-Wunknown-warning-option]


-- 

Rebecca Cran


On 3/24/22 6:04 AM, Gerd Hoffmann wrote:
> In function ‘SetDevicePathEndNode’,
>      inlined from ‘FileDevicePath’ at DevicePathUtilities.c:857:5:
> DevicePathUtilities.c:321:3: error: writing 4 bytes into a region of size 1 [-Werror=stringop-overflow=]
>    321 |   memcpy (Node, &mUefiDevicePathLibEndDevicePath, sizeof (mUefiDevicePathLibEndDevicePath));
>        |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> In file included from UefiDevicePathLib.h:22,
>                   from DevicePathUtilities.c:16:
> ../Include/Protocol/DevicePath.h: In function ‘FileDevicePath’:
> ../Include/Protocol/DevicePath.h:51:9: note: destination object ‘Type’ of size 1
>     51 |   UINT8 Type;       ///< 0x01 Hardware Device Path.
>        |         ^~~~
>
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>   BaseTools/Source/C/DevicePath/GNUmakefile | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile 
> b/BaseTools/Source/C/DevicePath/GNUmakefile
> index 7ca08af9662d..b05d2bddfa68 100644
> --- a/BaseTools/Source/C/DevicePath/GNUmakefile
> +++ b/BaseTools/Source/C/DevicePath/GNUmakefile
> @@ -13,6 +13,9 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o 
> DevicePathFromText.o  DevicePathUtili
>   
>   include $(MAKEROOT)/Makefiles/app.makefile
>   
> +# gcc 12 trips over device path handling BUILD_CFLAGS += 
> +-Wno-error=stringop-overflow
> +
>   LIBS = -lCommon
>   ifeq ($(CYGWIN), CYGWIN)
>     LIBS += -L/lib/e2fsprogs -luuid

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

* Re: [edk2-devel] [PATCH 3/3] Basetools: turn off gcc12 warning
  2022-03-29  4:00     ` Bob Feng
@ 2022-03-29 18:14       ` grant
  2022-03-29 21:38         ` Andrew Fish
       [not found]         ` <16E0F7C6F57A7FEC.28871@groups.io>
  0 siblings, 2 replies; 10+ messages in thread
From: grant @ 2022-03-29 18:14 UTC (permalink / raw)
  To: Bob Feng, devel

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

While I can't test this myself, the following does appear to result in a successful build using the same clang version:

diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile b/BaseTools/Source/C/DevicePath/GNUmakefile

index b05d2bddfa..81aa35aa31 100644

--- a/BaseTools/Source/C/DevicePath/GNUmakefile

+++ b/BaseTools/Source/C/DevicePath/GNUmakefile

@@ -14,7 +14,9 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili

include $(MAKEROOT)/Makefiles/app.makefile

# gcc 12 trips over device path handling

-BUILD_CFLAGS += -Wno-error=stringop-overflow

+ifeq($(CC), gcc)

+  BUILD_CFLAGS += -Wno-error=stringop-overflow

+endif

LIBS = -lCommon

ifeq ($(CYGWIN), CYGWIN)

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

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

* Re: [edk2-devel] [PATCH 3/3] Basetools: turn off gcc12 warning
  2022-03-29 18:14       ` grant
@ 2022-03-29 21:38         ` Andrew Fish
       [not found]         ` <16E0F7C6F57A7FEC.28871@groups.io>
  1 sibling, 0 replies; 10+ messages in thread
From: Andrew Fish @ 2022-03-29 21:38 UTC (permalink / raw)
  To: edk2-devel-groups-io, grant; +Cc: Bob Feng

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



> On Mar 29, 2022, at 11:14 AM, grant@grantlmul.xyz wrote:
> 
> While I can't test this myself, the following does appear to result in a successful build using the same clang version:
> 
> 
> diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile b/BaseTools/Source/C/DevicePath/GNUmakefile
> index b05d2bddfa..81aa35aa31 100644
> --- a/BaseTools/Source/C/DevicePath/GNUmakefile
> +++ b/BaseTools/Source/C/DevicePath/GNUmakefile
> @@ -14,7 +14,9 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili
>  include $(MAKEROOT)/Makefiles/app.makefile
>  
>  # gcc 12 trips over device path handling
> -BUILD_CFLAGS += -Wno-error=stringop-overflow
> +ifeq($(CC), gcc)
> +  BUILD_CFLAGS += -Wno-error=stringop-overflow
> +endif
>  

Gerd,

I’m not sure if this was caused by my email client but your fix did not work for me.
GNUmakefile:17: *** missing separator.  Stop.

I had to add a space after `ifeq` to get it to work.
diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile b/BaseTools/Source/C/DevicePath/GNUmakefile
index b05d2bddfa68..ebab1d3e2617 100644
--- a/BaseTools/Source/C/DevicePath/GNUmakefile
+++ b/BaseTools/Source/C/DevicePath/GNUmakefile
@@ -14,7 +14,9 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili
 include $(MAKEROOT)/Makefiles/app.makefile
 
 # gcc 12 trips over device path handling
-BUILD_CFLAGS += -Wno-error=stringop-overflow
+ifeq ($(CC), gcc)
+  BUILD_CFLAGS += -Wno-error=stringop-overflow
+endif
 
 LIBS = -lCommon
 ifeq ($(CYGWIN), CYGWIN)


I had been working around like this previously (I’m not sure about the portability of -Wno-unknown-warning-option):

diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile b/BaseTools/Source/C/DevicePath/GNUmakefile
index b05d2bddfa68..d08588a81f80 100644
--- a/BaseTools/Source/C/DevicePath/GNUmakefile
+++ b/BaseTools/Source/C/DevicePath/GNUmakefile
@@ -14,7 +14,7 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili
 include $(MAKEROOT)/Makefiles/app.makefile
 
 # gcc 12 trips over device path handling
-BUILD_CFLAGS += -Wno-error=stringop-overflow
+BUILD_CFLAGS += -Wno-error=stringop-overflow -Wno-unknown-warning-option
 
 LIBS = -lCommon
 ifeq ($(CYGWIN), CYGWIN)

Thanks,

Andrew Fish
>  LIBS = -lCommon
>  ifeq ($(CYGWIN), CYGWIN)
> 


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

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

* Re: [edk2-devel] [PATCH 3/3] Basetools: turn off gcc12 warning
       [not found]         ` <16E0F7C6F57A7FEC.28871@groups.io>
@ 2022-03-29 21:39           ` Andrew Fish
  0 siblings, 0 replies; 10+ messages in thread
From: Andrew Fish @ 2022-03-29 21:39 UTC (permalink / raw)
  To: edk2-devel-groups-io, Andrew Fish; +Cc: grant, Bob Feng

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



> On Mar 29, 2022, at 2:38 PM, Andrew Fish via groups.io <afish=apple.com@groups.io> wrote:
> 
> 
> 
>> On Mar 29, 2022, at 11:14 AM, grant@grantlmul.xyz <mailto:grant@grantlmul.xyz> wrote:
>> 
>> While I can't test this myself, the following does appear to result in a successful build using the same clang version:
>> 
>> 
>> diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile b/BaseTools/Source/C/DevicePath/GNUmakefile
>> index b05d2bddfa..81aa35aa31 100644
>> --- a/BaseTools/Source/C/DevicePath/GNUmakefile
>> +++ b/BaseTools/Source/C/DevicePath/GNUmakefile
>> @@ -14,7 +14,9 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili
>>  include $(MAKEROOT)/Makefiles/app.makefile
>>  
>>  # gcc 12 trips over device path handling
>> -BUILD_CFLAGS += -Wno-error=stringop-overflow
>> +ifeq($(CC), gcc)
>> +  BUILD_CFLAGS += -Wno-error=stringop-overflow
>> +endif
>>  
> 
> Gerd,
> 
> I’m not sure if this was caused by my email client but your fix did not work for me.
> GNUmakefile:17: *** missing separator.  Stop.
> 

Sorry I forgot to mention I was using an Xcode clang on macOS. 

Thanks,

Andrew Fish

> I had to add a space after `ifeq` to get it to work.
> diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile b/BaseTools/Source/C/DevicePath/GNUmakefile
> index b05d2bddfa68..ebab1d3e2617 100644
> --- a/BaseTools/Source/C/DevicePath/GNUmakefile
> +++ b/BaseTools/Source/C/DevicePath/GNUmakefile
> @@ -14,7 +14,9 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili
>  include $(MAKEROOT)/Makefiles/app.makefile
>  
>  # gcc 12 trips over device path handling
> -BUILD_CFLAGS += -Wno-error=stringop-overflow
> +ifeq ($(CC), gcc)
> +  BUILD_CFLAGS += -Wno-error=stringop-overflow
> +endif
>  
>  LIBS = -lCommon
>  ifeq ($(CYGWIN), CYGWIN)
> 
> 
> I had been working around like this previously (I’m not sure about the portability of -Wno-unknown-warning-option):
> 
> diff --git a/BaseTools/Source/C/DevicePath/GNUmakefile b/BaseTools/Source/C/DevicePath/GNUmakefile
> index b05d2bddfa68..d08588a81f80 100644
> --- a/BaseTools/Source/C/DevicePath/GNUmakefile
> +++ b/BaseTools/Source/C/DevicePath/GNUmakefile
> @@ -14,7 +14,7 @@ OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o  DevicePathUtili
>  include $(MAKEROOT)/Makefiles/app.makefile
>  
>  # gcc 12 trips over device path handling
> -BUILD_CFLAGS += -Wno-error=stringop-overflow
> +BUILD_CFLAGS += -Wno-error=stringop-overflow -Wno-unknown-warning-option
>  
>  LIBS = -lCommon
>  ifeq ($(CYGWIN), CYGWIN)
> 
> Thanks,
> 
> Andrew Fish
>>  LIBS = -lCommon
>>  ifeq ($(CYGWIN), CYGWIN)
> 
> 


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

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

end of thread, other threads:[~2022-03-29 21:39 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-24 12:04 [PATCH 0/3] BaseTools: patches to build with gcc12 Gerd Hoffmann
2022-03-24 12:04 ` [PATCH 1/3] BaseTools: fix gcc12 warning Gerd Hoffmann
2022-03-24 12:04 ` [PATCH 2/3] " Gerd Hoffmann
2022-03-24 12:04 ` [PATCH 3/3] Basetools: turn off " Gerd Hoffmann
2022-03-28 21:29   ` [edk2-devel] " Rebecca Cran
2022-03-29  4:00     ` Bob Feng
2022-03-29 18:14       ` grant
2022-03-29 21:38         ` Andrew Fish
     [not found]         ` <16E0F7C6F57A7FEC.28871@groups.io>
2022-03-29 21:39           ` Andrew Fish
2022-03-26 13:57 ` [edk2-devel] [PATCH 0/3] BaseTools: patches to build with gcc12 Bob Feng

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