[oe] [meta-java][PATCH] icedtea7-native: Fix compilation error due to format-overflow

Hussin, Mohamad Noor Alim mohamad.noor.alim.hussin at intel.com
Mon Dec 30 08:11:37 UTC 2019


Hi Richard,

I am using gcc 8.3.0. I get this error while compiling the source code hotspot/src/share/vm/adlc/output_c.cpp which related to sprintf. 
See the error log below.

/workspace/poky/build/tmp/work/x86_64-linux/icedtea7-native/2.1.3-r1.0/icedtea-2.1.3/build/openjdk-boot/hotspot/src/share/vm/adlc/output_c.cpp:1239:34: error: ‘_idx’ directive writing 4 bytes into a region of size between 2 and 12 [-Werror=format-overflow=]
           sprintf(left_reg_index,",inst%d_idx%d", left_index, left_op_index);
                                  ^~~~~~~~~~~~~~~
/workspace/poky/build/tmp/work/x86_64-linux/icedtea7-native/2.1.3-r1.0/icedtea-2.1.3/build/openjdk-boot/hotspot/src/share/vm/adlc/output_c.cpp:1239:34: note: directive argument in the range [-2147483648, 9999]
In file included from /usr/include/stdio.h:873,
                 from /workspace/poky/build/tmp/work/x86_64-linux/icedtea7-native/2.1.3-r1.0/icedtea-2.1.3/build/openjdk-boot/hotspot/src/share/vm/adlc/adlc.hpp:33,
                 from /workspace/poky/build/tmp/work/x86_64-linux/icedtea7-native/2.1.3-r1.0/icedtea-2.1.3/build/openjdk-boot/hotspot/src/share/vm/adlc/output_c.cpp:27:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:36:34: note: ‘__builtin___sprintf_chk’ output between 12 and 32 bytes into a destination of size 18
   return __builtin___sprintf_chk (__s, __USE_FORTIFY_LEVEL - 1,
          ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       __bos (__s), __fmt, __va_arg_pack ());
       ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/workspace/poky/build/tmp/work/x86_64-linux/icedtea7-native/2.1.3-r1.0/icedtea-2.1.3/build/openjdk-boot/hotspot/src/share/vm/adlc/output_c.cpp:1252:37: error: ‘_idx’ directive writing 4 bytes into a region of size between 2 and 12 [-Werror=format-overflow=]
             sprintf(right_reg_index,",inst%d_idx%d", right_index, right_op_index);
                                     ^~~~~~~~~~~~~~~

By the way, this patch file "recipes-core/icedtea/openjdk-7-03b147/icedtea-hotspot-handle-gcc7-format-overflow.patch" is set to apply=no 
in recipe file https://git.yoctoproject.org/cgit/cgit.cgi/meta-java/tree/recipes-core/icedtea/openjdk-7-release-03b147.inc#n92.
So, that patch file will not apply during do_patch.

Regards,
Alim Hussin

-----Original Message-----
From: Richard Leitner <richard.leitner at skidata.com> 
Sent: Friday, December 27, 2019 7:00 PM
To: Hussin, Mohamad Noor Alim <mohamad.noor.alim.hussin at intel.com>; openembedded-devel at lists.openembedded.org
Subject: Re: [oe] [meta-java][PATCH] icedtea7-native: Fix compilation error due to format-overflow

Hi,

On 05/12/2019 03:43, mohamad.noor.alim.hussin at intel.com wrote:
> From: Mohamad Noor Alim Hussin <mohamad.noor.alim.hussin at intel.com>
> 
> Getting a compilaton error due to format-overflow. Workaround to 
> suppress the error message by ignore the warning.

Same as for jdk 8, AFAIK these warnings should be fixed by recipes-core/icedtea/openjdk-7-03b147/icedtea-hotspot-handle-gcc7-format-overflow.patch

Where/why do you get them?

regards;Richard.L

> 
> Signed-off-by: Mohamad Noor Alim Hussin 
> <mohamad.noor.alim.hussin at intel.com>
> ---
>   recipes-core/icedtea/icedtea7-native.inc | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/recipes-core/icedtea/icedtea7-native.inc 
> b/recipes-core/icedtea/icedtea7-native.inc
> index b578cb2..0329d71 100644
> --- a/recipes-core/icedtea/icedtea7-native.inc
> +++ b/recipes-core/icedtea/icedtea7-native.inc
> @@ -26,7 +26,7 @@ CXXFLAGS_append = " -fno-tree-dse"
>   CXX_append = " -std=gnu++98"
>   
>   # WORKAROUND: ignore errors from new compilers -CFLAGS_append = " 
> -Wno-error=stringop-overflow -Wno-error=return-type"
> +CFLAGS_append = " -Wno-error=stringop-overflow -Wno-error=return-type -Wno-error=format-overflow"
>   
>   inherit native java autotools pkgconfig
>   inherit openjdk-build-helper
> 


More information about the Openembedded-devel mailing list