Whamcloud - gitweb
tst_libext2fs: Avoid multiple definition of global variables
authorLukas Czerner <lczerner@redhat.com>
Mon, 10 Feb 2020 15:24:59 +0000 (16:24 +0100)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 28 Feb 2020 03:31:14 +0000 (22:31 -0500)
commit336c440ccea8f94b0728f881cddee84f730e7cc7
tree29adf7a6694cd7fb346bcf96b2c743eea9b8e66d
parenta5676f8da792062f4c0e8ee49e0a5f0877268411
tst_libext2fs: Avoid multiple definition of global variables

gcc version 10 changed the default from -fcommon to -fno-common and as a
result e2fsprogs make check tests fail because tst_libext2fs.c end up
with a build error.

This is because it defines two global variables debug_prog_name and
extra_cmds that are already defined in debugfs/debugfs.c. With -fcommon
linker was able to resolve those into the same object, however with
-fno-common it's no longer able to do it and we end up with multiple
definition errors.

Fix the problem by using SKIP_GLOBDEFS macro to skip the variables
definition in debugfs.c. Note that debug_prog_name is also defined in
lib/ext2fs/extent.c when DEBUG macro is used, but this does not work even
with older gcc versions and is never used regardless so I am not going to
bother with it.

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
debugfs/debugfs.c
debugfs/debugfs.h
lib/ext2fs/Makefile.in