]> git.ipfire.org Git - thirdparty/postgresql.git/commitdiff
Suppress "has no symbols" linker warnings on macOS.
authorNathan Bossart <nathan@postgresql.org>
Wed, 29 Apr 2026 17:25:09 +0000 (12:25 -0500)
committerNathan Bossart <nathan@postgresql.org>
Wed, 29 Apr 2026 17:25:09 +0000 (12:25 -0500)
After a recent macOS update, building Postgres produces warnings
that look like this:

    ranlib: warning: 'libpgport_shlib.a(pg_cpu_x86.c.o)' has no symbols
    ranlib: warning: 'libpgport_shlib.a(pg_popcount_x86.c.o)' has no symbols

To fix, add a dummy symbol to files that may otherwise have none.
Per project policy, this is a candidate for back-patching into
out-of-support branches: it suppresses annoying compiler warnings
but changes no behavior.

Reported-by: Zhang Mingli <zmlpostgres@gmail.com>
Reviewed-by: John Naylor <johncnaylorls@gmail.com>
Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/229aaaf3-f529-44ed-8e50-00cb6909af21%40Spark
Backpatch-through: 13

src/port/pg_popcount_aarch64.c
src/port/pg_popcount_avx512.c

index 0b6b86de4d0bcfeb182c3fddca8d127639245749..0c93e2e625ed714076b0d5169f4d5e4ee54a77e8 100644 (file)
@@ -478,4 +478,10 @@ pg_popcount_masked_neon(const char *buf, int bytes, bits8 mask)
        return popcnt;
 }
 
-#endif                                                 /* POPCNT_AARCH64 */
+#else                                                  /* POPCNT_AARCH64 */
+
+/* prevent linker complaints about empty module */
+extern int     pg_popcount_aarch64_dummy_variable;
+int                    pg_popcount_aarch64_dummy_variable = 0;
+
+#endif                                                 /* ! POPCNT_AARCH64 */
index 80c0aee3e73fad4e77822ea10b12290f47df52dd..896bc7473b23ddaea05f953975a349e1f9c4d46f 100644 (file)
@@ -220,4 +220,11 @@ pg_popcount_masked_avx512(const char *buf, int bytes, bits8 mask)
 }
 
 #endif                                                 /* TRY_POPCNT_X86_64 */
-#endif                                                 /* USE_AVX512_POPCNT_WITH_RUNTIME_CHECK */
+
+#else                                                  /* USE_AVX512_POPCNT_WITH_RUNTIME_CHECK */
+
+/* prevent linker complaints about empty module */
+extern int     pg_popcount_avx512_dummy_variable;
+int                    pg_popcount_avx512_dummy_variable = 0;
+
+#endif                                                 /* ! USE_AVX512_POPCNT_WITH_RUNTIME_CHECK */