]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Define _gnutls_file_mutex in gnutls_global.c instead of in verify-tofu.c
authorMartin Storsjo <martin@martin.st>
Mon, 21 Jan 2013 14:00:10 +0000 (16:00 +0200)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Mon, 21 Jan 2013 17:20:07 +0000 (18:20 +0100)
This fixes issues with linking the tools on OS X if not building
shared libraries.

Currently, if building with --disable-shared on OS X, the build
fails with:
  CCLD   gnutls-serv
Undefined symbols for architecture x86_64:
  "__gnutls_file_mutex", referenced from:
      _gnutls_global_deinit in libgnutls.a(gnutls_global.o)
      _gnutls_global_init in libgnutls.a(gnutls_global.o)
ld: symbol(s) not found for architecture x86_64

It seems that the linker fails to pull in verify-tofu.o to satisfy
the undefined reference to _gnutls_file_mutex.o in gnutls_global.o
unless gnutls_global.o (or any other object file in the link) also
calls functions that pulls in verify-tofu.o. Since gnutls_global.o
always is linked in, but verify-tofu.o can be left out unless someone
calls the functions in it, defining the mutex in gnutls_global.c makes
sense and simplifies the dependencies.

Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
lib/gnutls_global.c
lib/verify-tofu.c

index 295e6201d141101b8509640c4e578a776912c59f..1959bd315afd8e7de8b88afa26abc7ad640749c6 100644 (file)
@@ -42,7 +42,7 @@
 /* created by asn1c */
 extern const ASN1_ARRAY_TYPE gnutls_asn1_tab[];
 extern const ASN1_ARRAY_TYPE pkix_asn1_tab[];
-extern void *_gnutls_file_mutex;
+void *_gnutls_file_mutex;
 
 ASN1_TYPE _gnutls_pkix1_asn;
 ASN1_TYPE _gnutls_gnutls_asn;
index 3592395803f1d6e11afa2f31ff8201f9d059ff42..4c19c90bc73d5014dd0e6c228ece52d64c6e08d3 100644 (file)
@@ -60,7 +60,7 @@ int store_pubkey(const char* db_name, const char* host,
 static int find_config_file(char* file, size_t max_size);
 #define MAX_FILENAME 512
 
-void *_gnutls_file_mutex;
+extern void *_gnutls_file_mutex;
 
 struct gnutls_tdb_int default_tdb = {
   store_pubkey,