v8_monolith always uses fvisibility=default, foiling LTO

9 views
Skip to first unread message

marcel

unread,
Mar 12, 2026, 2:33:46 PM (6 days ago) Mar 12
to v8-users
I'm investigating binary size of compiled v8. I found that when using v8_monolith all source files are built with fvisibility=default. This is the correct option for embedders using dlopen (eg nodejs), but not for embedders using v8 without dynamically-loaded native code. 

When linking with LTO the public visibility means these symbols cannot be removed. In my application a one-line patch to v8.gni [https://github.com/laverdet/isolated-vm/blob/experimental/patches/10.symbols.patch], stripped binary size drops from 45M to 31M. After compression the comparison is 27M to 16M.


I'm pretty surprised this condition has existed since 2018. I think the default should be hidden visibility for embedders, and those who use dlopen would add another flag to get those public symbols. Otherwise we're potentially doubling the binary size for embedders and the only recourse is patching v8's build.
Reply all
Reply to author
Forward
0 new messages