[igt-dev] [PATCH i-g-t 1/4] lib/igt_core: Make igt_subtest_jmpbuf/igt_dynamic_jmpbuf extern

Lyude lyude at redhat.com
Mon Mar 16 16:11:29 UTC 2020


From: Lyude Paul <lyude at redhat.com>

Since gcc 10, -fno-common has become the default (vs. -fcommon). As a
result, gcc is much stricter about missing extern and static keywords
and causes our build to fail in anything including igt_core.h:

/usr/bin/ld:
lib/libigt-i915_gem_context_c.a(i915_gem_context.c.o):lib/igt_core.h:149:
multiple definition of `igt_dynamic_jmpbuf';
lib/libigt-drmtest_c.a(drmtest.c.o):lib/igt_core.h:149: first defined
here
/usr/bin/ld:
lib/libigt-i915_gem_context_c.a(i915_gem_context.c.o):lib/igt_core.h:148:
multiple definition of `igt_subtest_jmpbuf';
lib/libigt-drmtest_c.a(drmtest.c.o):lib/igt_core.h:148: first defined
here

So, fix this by marking these as extern and declaring them in
lib/igt_core.c.

Signed-off-by: Lyude Paul <lyude at redhat.com>
---
 lib/igt_core.c | 3 +++
 lib/igt_core.h | 4 ++--
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/lib/igt_core.c b/lib/igt_core.c
index 51041793..2b928f1a 100644
--- a/lib/igt_core.c
+++ b/lib/igt_core.c
@@ -261,6 +261,9 @@
  * such as those related to Chamelium support.
  */
 
+jmp_buf igt_subtest_jmpbuf;
+jmp_buf igt_dynamic_jmpbuf;
+
 static unsigned int exit_handler_count;
 const char *igt_interactive_debug;
 bool igt_skip_crc_compare;
diff --git a/lib/igt_core.h b/lib/igt_core.h
index c17a7ba8..fae5f59e 100644
--- a/lib/igt_core.h
+++ b/lib/igt_core.h
@@ -145,8 +145,8 @@ void __igt_fixture_end(void) __attribute__((noreturn));
 			 __igt_fixture_complete())
 
 /* subtest infrastructure */
-jmp_buf igt_subtest_jmpbuf;
-jmp_buf igt_dynamic_jmpbuf;
+extern jmp_buf igt_subtest_jmpbuf;
+extern jmp_buf igt_dynamic_jmpbuf;
 typedef int (*igt_opt_handler_t)(int opt, int opt_index, void *data);
 #define IGT_OPT_HANDLER_SUCCESS 0
 #define IGT_OPT_HANDLER_ERROR -2
-- 
2.24.1



More information about the igt-dev mailing list