0

Exported things should always be visible

This changes our COMPONENT_EXPORT macros to make the things they export
visible all the time on non-windows, rather than making them visible in
the named component only. This avoids subtle bugs where things defined
in multiple components end up with one copy per component, only one of
which is visible, and so the linker doesn't know it's supposed to dedup
them.

Some, but not all, of these issues are detected by the new clang warning
-Wunique-object-duplication. This change addresses some instances of that
warning firing on chromium code, but not all. Conversely, there are likely
instances which the warning does not catch, which are fixed by this CL.

Bug: 368047728
Change-Id: I829a9bd84e57e3c7d80ec33aea0408951019bde7
AX-Relnotes: n/a.
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6264795
Owners-Override: Avi Drissman <avi@chromium.org>
Reviewed-by: Avi Drissman <avi@chromium.org>
Commit-Queue: Devon Loehr <dloehr@google.com>
Cr-Commit-Position: refs/heads/main@{#1456614}
This commit is contained in:
Devon Loehr
2025-05-06 14:23:23 -07:00
committed by Chromium LUCI CQ
parent f0fd8115bc
commit edf5748269
157 changed files with 8 additions and 651 deletions
ash
base
build/rust/tests
bindgen_static_fns_test
bindgen_test
cc
chrome/browser
chromeos
components
content/common
crypto
dbus
device
extensions/common
fuchsia_web/webengine
gin
google_apis/gcm/base
gpu
headless/public
ios/web_view/public
ipc
media
mojo
net/base
ppapi
remoting/host
sandbox
services
device
metrics
service_manager
public
skia/ext
ui
url/ipc

@ -15,11 +15,7 @@
#endif // defined(COMPONENTS_PREFS_IMPLEMENTATION)
#else // defined(WIN32)
#if defined(COMPONENTS_PREFS_IMPLEMENTATION)
#define COMPONENTS_PREFS_EXPORT __attribute__((visibility("default")))
#else
#define COMPONENTS_PREFS_EXPORT
#endif
#endif
#else // defined(COMPONENT_BUILD)