riscv64: Workaround -Wstringop-truncation error

On riscv64, the compiler complained:

     In file included from /usr/include/string.h:548,
                      from omxregister.c:42:
     In function 'strncpy',
         inlined from 'showComponentsList' at omxregister.c:110:3,
         inlined from 'main' at omxregister.c:463:9:
     /usr/include/bits/string_fortified.h:95:10: error: '__builtin_strncpy' destination unchanged after copying no bytes [-Werror=stringop-truncation]
        95 |   return __builtin___strncpy_chk (__dest, __src, __len,
           |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        96 |                                   __glibc_objsize (__dest));
           |                                   ~~~~~~~~~~~~~~~~~~~~~~~~~
     cc1: all warnings being treated as errors

It seems that the -O optimization to generate arch assemblies
leads to different behavior between riscv and arm, x86.
Add -Wno-stringop-truncation CFLAGS to workaround the problem.
This commit is contained in:
laokz 2023-10-06 11:51:44 +08:00 committed by laokz
parent 41df89f615
commit 42b59db319

View File

@ -1,6 +1,6 @@
Name: libomxil-bellagio
Version: 0.9.3
Release: 23
Release: 24
Summary: OpenMAX Integration Layer
License: LGPLv2+
URL: http://omxil.sourceforge.net
@ -50,6 +50,9 @@ autoreconf -vif
%build
%ifarch riscv64
export CFLAGS="$CFLAGS -Wno-stringop-truncation"
%endif
%configure --disable-static
sed -i.rpath 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
@ -101,6 +104,9 @@ install -pm 0755 test/components/resource_manager/.libs/{omxprioritytest,omxrmte
%changelog
* Sat Oct 07 2023 laokz <zhangkai@iscas.ac.cn> - 0.9.3-24
- Workaround -Wstringop-truncation error for riscv64
* Sat Jul 15 2023 yaoxin <yao_xin001@hoperun.com> - 0.9.3-23
- Fix build failure caused by gcc upgrade to 12.3.1