Marking v8::Platform et al. V8_EXPORT

40 views
Skip to first unread message

Daryl Haresign

unread,
Nov 22, 2021, 7:19:11 PM11/22/21
to v8-dev
We recently discovered an interesting result of LTO, whereby Isolate::Initialize() was failing where it checks that the platform's foreground task runner has non-nestable tasks enabled: https://source.chromium.org/chromium/chromium/src/+/main:v8/src/api/api.cc;l=8690-8696?q=Isolate::Initi&ss=chromium

Despite our implementation returning true, the check was still failing.  After some investigation it turned out that within the dll that houses Chromium, LTO had kicked in and turned the virtual call into simple load: https://github.com/llvm/llvm-project/blob/release/13.x/llvm/lib/Transforms/IPO/WholeProgramDevirt.cpp#L14-L18

As our implementation or v8::TaskRunner lives outside of this dll, it wasn't generated with this extra slot for the value next to its vtable, so at runtime Isolate::Initialize() was loading garbage and thus the check was failing.

It seems that the fix is to mark the v8::TaskRunner class as V8_EXPORT so that LTO doesn't apply: https://clang.llvm.org/docs/LTOVisibility.html

Is there any reason these weren't marked already?  If not, I'm happy to submit a patch.

Thanks,
Daryl.

Andreas Haas

unread,
Nov 26, 2021, 3:25:24 AM11/26/21
to v8-...@googlegroups.com
Hi Daryl,

As far as I know there is no reason other than that it was not necessary so far. Feel free to submit a patch.

Thanks,
Andreas

--
--
v8-dev mailing list
v8-...@googlegroups.com
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-dev+un...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/v8-dev/5121dc21-9ad7-4bcf-b8ba-aa3964bdcf53n%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages