From 4bf450998481c6d3ab4ec3d4afac5e8ff65192d1 Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Wed, 2 Jul 2025 12:47:17 -0500 Subject: [PATCH] Go back to the #ifdefs to work around compiler regressions. While both gcc 12.2 and clang 18.0 compiled weak and non-weak versions of the same symbol in the same file just fine, newer versions only work if the weak symbol is in a different compilation unit than the non-weak one. Otherwise they error out on the "redefinition". --- lib/hash.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/hash.c b/lib/hash.c index 16fa1b40..2ba40145 100644 --- a/lib/hash.c +++ b/lib/hash.c @@ -57,7 +57,7 @@ void hash_by_name(int fd, char *name, char *result) } // Builtin implementations -#endif +#else struct browns { unsigned *rconsttable32; @@ -306,7 +306,7 @@ static void hash_update(char *data, unsigned int len, } } -__attribute__((__weak__)) void hash_by_name(int fd, char *name, char *result) +void hash_by_name(int fd, char *name, char *result) { unsigned long long count[2]; int i, chunksize, digestlen, method; @@ -391,3 +391,4 @@ __attribute__((__weak__)) void hash_by_name(int fd, char *name, char *result) for (pp = (void *)libbuf; pp-(unsigned *)libbuf