Re: [PATCH v2] tst_libext2fs: Avoid multiple definition of global variables
From: Eric Sandeen <hidden>
Date: 2020-02-11 21:08:42
On 2/11/20 2:22 PM, Eric Sandeen wrote:
On 2/10/20 9:24 AM, Lukas Czerner wrote:quoted
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 <redacted> --- v2: Previous fix wasn't really working properlyWhat was not working properly? It seemed reasonable to me. The new mechanism looks like it would work, but the first patch seemed more obvious, so I'd like to know what the problem was.
I built e2fsprogs & ran make check from git on Fedora Rawhide w/ your first patch, and it all seemed to work fine so I'll just stand by for more info. :) -Eric