From 7b024cb72b1567b8f67e968e4c940339c5bb8758 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 18 Sep 2024 05:23:16 +0000 Subject: [PATCH] Bug 1918285 - Avoid lz4frame symbols being exported from gtest libxul. r=firefox-build-system-reviewers,sergesanspaille The lz4 symbols were never meant to be exposed, the API in Compression.h being the official way to use it. This is we had LZ4LIB_VISIBILITY set to nothing. Unfortunately, that wasn't enough, because there is another similar define for lz4frame: LZ4FLIB_VISIBILITY. So we had been exporting those lz4frame symbols from firefox-bin forever, without noticing, but it didn't cause problems until the symbols were moved to libxul. With them moved to libxul, we end up with the situation where we might actually end up using the symbols from the system liblz4, which is pulled indirectly through other dependencies (through libsystemd, which comes through libdbus). This is all fine-ish on a "normal" opt build, but with LTO, things end up such that some calls go through our copy of lz4frame and others through the system one, and the discrepancy causes a crash. The symbols file for non-gtest libxul, that hides all symbols but a few, was saving the non-gtest case, fortunately. Differential Revision: https://phabricator.services.mozilla.com/D222574 --- mozglue/static/moz.build | 1 + 1 file changed, 1 insertion(+) diff --git a/mozglue/static/moz.build b/mozglue/static/moz.build index ba194f23a38c..9e3dfec41b68 100644 --- a/mozglue/static/moz.build +++ b/mozglue/static/moz.build @@ -21,6 +21,7 @@ SOURCES += [ SOURCES["lz4/xxhash.c"].flags += ["-Wno-unused-function"] DEFINES["LZ4LIB_VISIBILITY"] = "" +DEFINES["LZ4FLIB_VISIBILITY"] = "" # By putting it in js, it ends up in libxul too. FINAL_LIBRARY = "js"