-
spang authored
This fixes the component=shared_library build on Chrome OS. Previously, the TPM token initialization would crash the browser because libchaps.so loads a 2nd, incompatible copy of the protobuf-lite library into the browser. The crash happens because by default the global scope takes precedence, so symbols in the bundled copy shadow symbols in the system copy. This can lead to accessing the wrong object or calling the wrong function. The usual symptom is a crash during static initialization of libchaps.so. RTL_DEEPBIND rearranges the scope for libchaps.so so that the system library takes precedence instead. The scope for chrome is unaffected. Some other possibilities were considered: - Unbundling the library. This would cause us to lose our local modifications to libprotobuf on Chrome OS. - Fixing the soname so that the bundled copy is used by chaps. This doesn't even link because the bundled code is not ABI compatible with upstream. - Statically linking libchaps.so. This is tricky because we need position-independent static libs for its deps, and we don't support building those currently. It will also cause bloat. This hack is minimally invasive and allows use of shared library builds on Chrome OS devices. BUG=175508 TEST=cros chrome-sdk --board=link GYP_DEFINES="$GYP_DEFINES component=shared_library" gclient runhooks ninja -C out_link/Release chrome chrome-sandbox deploy_chrome --board link --build-dir out_link/Release --to $IP Log into the system. No crash. TPM-backed user certs show up in chrome://certificate-manager. Review URL: https://codereview.chromium.org/1111373003 Cr-Commit-Position: refs/heads/master@{#329743}
ba254c4e