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>
int journal_enable_debug = -1;
#endif
+/*
+ * There must be only one definition if we're hooking in extra commands or
+ * chaging default prompt. Use -DSKIP_GLOBDEF for that.
+ */
+#ifndef SKIP_GLOBDEFS
ss_request_table *extra_cmds;
const char *debug_prog_name;
+#endif
int ss_sci_idx;
ext2_filsys current_fs;
extern void do_dump_unused(int argc, char **argv, int sci_idx, void *infop);
/* debugfs.c */
+extern ss_request_table *extra_cmds;
+extern const char *debug_prog_name;
extern void internal_dump_inode(FILE *, const char *, ext2_ino_t,
struct ext2_inode *, int);
debugfs.o: $(top_srcdir)/debugfs/debugfs.c
$(E) " CC $<"
- $(Q) $(CC) $(DEBUGFS_CFLAGS) -c $< -o $@
+ $(Q) $(CC) $(DEBUGFS_CFLAGS) -DSKIP_GLOBDEFS -c $< -o $@
extent_inode.o: $(top_srcdir)/debugfs/extent_inode.c
$(E) " CC $<"