prevent multiply defined symbols
authorDaryl W. Grunau <dwg@lanl.gov>
Thu, 23 Jul 2020 21:39:07 +0000 (15:39 -0600)
committerMarge Bot <eric+marge@anholt.net>
Tue, 28 Jul 2020 20:17:52 +0000 (20:17 +0000)
Without this patch applied gcc@10.1.0 fails to compile with the following
error (note mesa@18.3.6 but the latest release also posseses this problem):

  ld: ../../../../src/gallium/auxiliary/.libs/libgallium.a(u_debug_symbol.o):/tmp/spack/spack-stage/spack-stage-mesa-18.3.6-be7kyg2dyxwktir3zrai27n6a6coadab/spack-src/src/galli um/auxiliary/util/u_debug_symbol.c:273: multiple definition of `symbols_hash'; ../../../../src/gallium/auxiliary/.libs/libgallium.a(u_debug_stack.o):/tmp/spa ck/spack-stage/spack-stage-mesa-18.3.6-be7kyg2dyxwktir3zrai27n6a6coadab/spack-src/src/gallium/auxiliary/util/u_debug_stack.c:49: first defined here
  collect2: error: ld returned 1 exit status
  make[4]: *** [libGL.la] Error 1
  make[4]: Leaving directory `/tmp/spack/spack-stage/spack-stage-mesa-18.3.6-be7kyg2dyxwktir3zrai27n6a6coadab/spack-src/src/gallium/targets/libgl-xlib'
  make[3]: *** [all-recursive] Error 1
  make[3]: Leaving directory `/tmp/spack/spack-stage/spack-stage-mesa-18.3.6-be7kyg2dyxwktir3zrai27n6a6coadab/spack-src/src/gallium'
  make[2]: *** [all-recursive] Error 1
  make[2]: Leaving directory `/tmp/spack/spack-stage/spack-stage-mesa-18.3.6-be7kyg2dyxwktir3zrai27n6a6coadab/spack-src/src'
  make[1]: *** [all] Error 2
  make[1]: Leaving directory `/tmp/spack/spack-stage/spack-stage-mesa-18.3.6-be7kyg2dyxwktir3zrai27n6a6coadab/spack-src/src'
  make: *** [all-recursive] Error 1

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3298
Cc: mesa-stable
Reviewed-by: Michel Dänzer <mdaenzer@redhat.com>
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6053>

src/gallium/auxiliary/util/u_debug_stack.c
src/gallium/auxiliary/util/u_debug_symbol.c

index e16123b90870755228560e823e462f77b72314b6..a1e7b27f63d6bc352907cbecb1011da8874c97aa 100644 (file)
@@ -47,7 +47,7 @@
 #include "os/os_thread.h"
 #include "u_hash_table.h"
 
-struct hash_table* symbols_hash;
+static struct hash_table* symbols_hash;
 static mtx_t symbols_mutex = _MTX_INITIALIZER_NP;
 
 /* TODO with some refactoring we might be able to re-use debug_symbol_name_cached()
index 4bbed585d8176c72153d30663f3e28aefce2909d..d6471928a9d9a65bf2afdeb8c7215b7fb10ad96c 100644 (file)
@@ -270,7 +270,7 @@ debug_symbol_print(const void *addr)
    debug_printf("\t%s\n", buf);
 }
 
-struct hash_table* symbols_hash;
+static struct hash_table* symbols_hash;
 #ifdef PIPE_OS_WINDOWS
 static mtx_t symbols_mutex;
 #else