forked from mistymntncop/CVE-2023-3079
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fix_torque_build_error.patch
46 lines (44 loc) · 2.42 KB
/
fix_torque_build_error.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
diff --git a/src/base/contextual.h b/src/base/contextual.h
index 7f575997da2..bee0669bef3 100644
--- a/src/base/contextual.h
+++ b/src/base/contextual.h
@@ -74,13 +74,16 @@ class V8_EXPORT_PRIVATE ContextualVariable {
// If there is a linking error for `Top()`, then the contextual variable
// probably needs to be exported using EXPORT_CONTEXTUAL_VARIABLE.
#if defined(USING_V8_SHARED)
- // Hide the definition from other DLLs/libraries to avoid access to `top_`,
- // since access to thread_local variables from other DLLs/libraries does not
- // work correctly.
- static Scope*& Top();
+ // Hide the access to `top_` from other DLLs/libraries, since access to
+ // thread_local variables from other DLLs/libraries does not work correctly.
+ static Scope*& Top() { return ExportedTop(); }
#else
static Scope*& Top() { return top_; }
#endif
+ // Same as `Top()`, but non-inline and exported to DLLs/libraries.
+ // If there is a linking error for `ExportedTop()`, then the contextual
+ // variable probably needs to be exported using EXPORT_CONTEXTUAL_VARIABLE.
+ static Scope*& ExportedTop();
};
// Usage: DECLARE_CONTEXTUAL_VARIABLE(VarName, VarType)
@@ -90,13 +93,13 @@ class V8_EXPORT_PRIVATE ContextualVariable {
// Contextual variables that are accessed in tests need to be
// exported. For this, place the following macro in the global namespace inside
// of a .cc file.
-#define EXPORT_CONTEXTUAL_VARIABLE(VarName) \
- namespace v8::base { \
- template <> \
- V8_EXPORT_PRIVATE typename VarName::Scope*& \
- ContextualVariable<VarName, typename VarName::VarT>::Top() { \
- return top_; \
- } \
+#define EXPORT_CONTEXTUAL_VARIABLE(VarName) \
+ namespace v8::base { \
+ template <> \
+ V8_EXPORT_PRIVATE typename VarName::Scope*& \
+ ContextualVariable<VarName, typename VarName::VarT>::ExportedTop() { \
+ return top_; \
+ } \
}
// By inheriting from {ContextualClass} a class can become a contextual variable