[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: build error of unused function as MACRO G_DEFINE_AUTOPTR_CLEANUP_FUN
From: |
Alexander Bulekov |
Subject: |
Re: build error of unused function as MACRO G_DEFINE_AUTOPTR_CLEANUP_FUNC expand |
Date: |
Wed, 8 Jul 2020 15:23:39 -0400 |
User-agent: |
NeoMutt/20180716 |
Hi Li,
I usually build the fuzzer with "make i386-softmmu/fuzz", so I must have
missed the nbd issue... I could not reproduce this locally since:
alxndr@mozz:qemu(master)$ dpkg -l "*glib2.0-bin*"
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-==============-============-============-=================================
ii libglib2.0-bin 2.60.6-2 amd64 Programs for the GLib library
The issue described in 9bda600b083 only shows up in versions older than
2.57.2...
After some digging, in ./configure:
...
if test "$have_fuzzer" = "yes"; then
FUZZ_LDFLAGS=" -fsanitize=address,fuzzer"
FUZZ_CFLAGS=" -fsanitize=address,fuzzer"
CFLAGS=" -fsanitize=address,fuzzer-no-link"
Thats probably the issue. Should be
CFLAGS="$CFLAGS -fsanitize=address,fuzzer-no-link"
I'm also having trouble building, but for a different reason..
CC=clang-8 CXX=clang++-8 ./configure --target-list="i386-softmmu"
--enable-fuzzing
...
CC i386-softmmu/tests/qtest/fuzz/qtest_wrappers.o
/tmp/qemu/tests/qtest/fuzz/fuzz.c:215:5: error: implicit declaration of
function 'rcu_enable_atfork' is invalid in C99
[-Werror,-Wimplicit-function-declaration]
rcu_enable_atfork();
^
45222b9a9016488289a1938a528239c3b83eddb1 is the first bad commit
commit 45222b9a9016488289a1938a528239c3b83eddb1
Author: Alexander Bulekov <alxndr@bu.edu>
Date: Thu Jun 18 12:05:16 2020 -0400
fuzz: fix broken qtest check at rcu_disable_atfork
Looks like I forgot a header... I'll send fixes for both of these
issues.
Thank you
-Alex
On 200708 1850, Philippe Mathieu-Daudé wrote:
> Cc'ing the fuzzing maintainers.
>
> On 7/8/20 5:41 PM, Li Qiang wrote:
> > Hello all,
> >
> >
> >
> > I build qemu with fuzzing enabled using clang and following error come.
> >
> >
> >
> > nbd/server.c:1937:1: error: unused function
> > 'glib_listautoptr_cleanup_NBDExtentArray' [-Werror,-Wunused-function]
> >
> > G_DEFINE_AUTOPTR_CLEANUP_FUNC(NBDExtentArray, nbd_extent_array_free);
> >
> > ^
> >
> > /usr/include/glib-2.0/glib/gmacros.h:462:22: note: expanded from macro
> > 'G_DEFINE_AUTOPTR_CLEANUP_FUNC'
> >
> > static inline void _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName) (GList **_l)
> > { g_list_free_full (*_l, (GDestroyNotify) func); } \
> >
> > ^
> >
> > /usr/include/glib-2.0/glib/gmacros.h:443:48: note: expanded from macro
> > '_GLIB_AUTOPTR_LIST_FUNC_NAME'
> >
> > #define _GLIB_AUTOPTR_LIST_FUNC_NAME(TypeName)
> > glib_listautoptr_cleanup_##TypeName
> >
> > ^
> >
> > <scratch space>:170:1: note: CC crypto/hash-glib.o
> >
> > expanded from here
> >
> > glib_listautoptr_cleanup_NBDExtentArray
> >
> > ^
> >
> > nbd/server.c:1937:1: error: unused function
> > 'glib_slistautoptr_cleanup_NBDExtentArray' [-Werror,-Wunused-function]
> >
> > /usr/include/glib-2.0/glib/gmacros.h:463:22: note: expanded from macro
> > 'G_DEFINE_AUTOPTR_CLEANUP_FUNC'
> >
> > static inline void _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName) (GSList
> > **_l) { g_slist_free_full (*_l, (GDestroyNotify) func); } \
> >
> > ^
> >
> > /usr/include/glib-2.0/glib/gmacros.h:445:49: note: expanded from macro
> > '_GLIB_AUTOPTR_SLIST_FUNC_NAME'
> >
> > #define _GLIB_AUTOPTR_SLIST_FUNC_NAME(TypeName)
> > glib_slistautoptr_cleanup_##TypeName
> >
> > ^
> >
> > <scratch space>:171:1: note: expanded from here
> >
> > glib_slistautoptr_cleanup_NBDExtentArray
> >
> >
> >
> >
> >
> > I see Eric’s patch 9bda600b083(“build: Silence clang warning on older
> > glib autoptr usage”)
> >
> > So I know there should be a ‘-Wno-unused-function’ in CFLAGS. It is
> > after ./configure:
> >
> >
> >
> > CFLAGS -g -Wno-unused-function
> >
> > QEMU_CFLAGS -I/usr/include/pixman-1 -Werror -pthread
> > -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
> > -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
> > -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef
> > -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common
> > -fwrapv -std=gnu99 -Wno-string-plus-int -Wno-typedef-redefinition
> > -Wno-initializer-overrides -Wexpansion-to-defined -Wendif-labels
> > -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body
> > -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self
> > -Wignored-qualifiers -Wold-style-definition -Wtype-limits
> > -fstack-protector-strong -I$(SRC_PATH)/capstone/include
> >
> >
> >
> > However while I ‘make V=1’ I see the build nbd/serer.c using following
> > command:
> >
> > clang-8 -iquote /home/test/qemu/nbd -iquote nbd -iquote
> > /home/test/qemu/tcg/i386 -isystem /home/test/qemu/linux-headers -isystem
> > /home/test/qemu/linux-headers -iquote . -iquote /home/test/qemu -iquote
> > /home/test/qemu/accel/tcg -iquote /home/test/qemu/include -iquote
> > /home/test/qemu/disas/libvixl -I/usr/include/pixman-1 -Werror -pthread
> > -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
> > -fPIE -DPIE -m64 -mcx16 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
> > -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef
> > -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common
> > -fwrapv -std=gnu99 -Wno-string-plus-int -Wno-typedef-redefinition
> > -Wno-initializer-overrides -Wexpansion-to-defined -Wendif-labels
> > -Wno-shift-negative-value -Wno-missing-include-dirs -Wempty-body
> > -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self
> > -Wignored-qualifiers -Wold-style-definition -Wtype-limits
> > -fstack-protector-strong -I/home/test/qemu/capstone/include
> > -I/home/test/qemu/tests -I/home/test/qemu/tests/qtest -MMD -MP -MT
> > nbd/server.o -MF nbd/server.d -fsanitize=address,fuzzer-no-link -c -o
> > nbd/server.o nbd/server.c
> >
> >
> >
> > There’s no CFLAGS ‘-Wno-unused-function’.
> >
> >
> >
> > So I want to know:
> >
> > 1. Wha’t the relation of CFLAGS and QEMU_CFLAGS, it seems the CFLAGS
> > doesn’t work in this.
> >
> > 2. Any hits to solve this? My env error or needs a patch?
> >
> >
> >
> > I use following command in Ubuntu 18.04.1.
> >
> > CC=clang-8 CXX=clang++-8 ./configure --target-list="i386-softmmu"
> > --enable-debug --enable-debug --enable-kvm --enable-fuzzing
> >
> >
> >
> >
> >
> > Thanks,
> >
> > Li Qiang
> >
>