LibJS: Export symbols causing linker errors in various consumers

After LibJS had its symbol exports optimized the targets
js, test-js, test262-runner, test-wasm, and LibWeb began to get linker
errors after the work to add Windows support for test-web and ladybird
targets. These extra JS_API annotations fix all those linker errors.
This commit is contained in:
ayeteadoe 2025-08-03 14:05:09 -07:00 committed by Andrew Kaster
parent 9c67c4a270
commit 6dbb59da77
Notes: github-actions[bot] 2025-08-23 22:06:25 +00:00
13 changed files with 17 additions and 16 deletions

View file

@ -54,7 +54,7 @@ create_ast_node(SourceRange range, Args&&... args)
return adopt_ref(*new T(move(range), forward<Args>(args)...)); return adopt_ref(*new T(move(range), forward<Args>(args)...));
} }
class ASTNode : public RefCounted<ASTNode> { class JS_API ASTNode : public RefCounted<ASTNode> {
public: public:
virtual ~ASTNode() = default; virtual ~ASTNode() = default;
@ -780,7 +780,7 @@ struct FunctionParsingInsights {
bool might_need_arguments_object { false }; bool might_need_arguments_object { false };
}; };
class FunctionNode { class JS_API FunctionNode {
public: public:
Utf16FlyString name() const { return m_name ? m_name->string() : Utf16FlyString {}; } Utf16FlyString name() const { return m_name ? m_name->string() : Utf16FlyString {}; }
RefPtr<Identifier const> name_identifier() const { return m_name; } RefPtr<Identifier const> name_identifier() const { return m_name; }

View file

@ -89,7 +89,7 @@ private:
}; };
// 16.2.1.4 Abstract Module Records, https://tc39.es/ecma262/#sec-abstract-module-records // 16.2.1.4 Abstract Module Records, https://tc39.es/ecma262/#sec-abstract-module-records
class Module : public Cell { class JS_API Module : public Cell {
GC_CELL(Module, Cell); GC_CELL(Module, Cell);
GC_DECLARE_ALLOCATOR(Module); GC_DECLARE_ALLOCATOR(Module);

View file

@ -29,7 +29,7 @@ JS_API GC::Ref<ObjectEnvironment> new_object_environment(Object&, bool is_with_e
GC::Ref<FunctionEnvironment> new_function_environment(ECMAScriptFunctionObject&, Object* new_target); GC::Ref<FunctionEnvironment> new_function_environment(ECMAScriptFunctionObject&, Object* new_target);
GC::Ref<PrivateEnvironment> new_private_environment(VM& vm, PrivateEnvironment* outer); GC::Ref<PrivateEnvironment> new_private_environment(VM& vm, PrivateEnvironment* outer);
GC::Ref<Environment> get_this_environment(VM&); GC::Ref<Environment> get_this_environment(VM&);
bool can_be_held_weakly(Value); JS_API bool can_be_held_weakly(Value);
Object* get_super_constructor(VM&); Object* get_super_constructor(VM&);
ThrowCompletionOr<Value> require_object_coercible(VM&, Value); ThrowCompletionOr<Value> require_object_coercible(VM&, Value);
JS_API ThrowCompletionOr<Value> call_impl(VM&, Value function, Value this_value, ReadonlySpan<Value> arguments = {}); JS_API ThrowCompletionOr<Value> call_impl(VM&, Value function, Value this_value, ReadonlySpan<Value> arguments = {});

View file

@ -10,7 +10,7 @@
namespace JS { namespace JS {
class ConsoleObject final : public Object { class JS_API ConsoleObject final : public Object {
JS_OBJECT(ConsoleObject, Object); JS_OBJECT(ConsoleObject, Object);
GC_DECLARE_ALLOCATOR(ConsoleObject); GC_DECLARE_ALLOCATOR(ConsoleObject);

View file

@ -8,6 +8,7 @@
#include <AK/HashMap.h> #include <AK/HashMap.h>
#include <AK/Utf16FlyString.h> #include <AK/Utf16FlyString.h>
#include <LibJS/Export.h>
#include <LibJS/Runtime/AbstractOperations.h> #include <LibJS/Runtime/AbstractOperations.h>
#include <LibJS/Runtime/Completion.h> #include <LibJS/Runtime/Completion.h>
#include <LibJS/Runtime/Environment.h> #include <LibJS/Runtime/Environment.h>
@ -15,7 +16,7 @@
namespace JS { namespace JS {
class DeclarativeEnvironment : public Environment { class JS_API DeclarativeEnvironment : public Environment {
JS_ENVIRONMENT(DeclarativeEnvironment, Environment); JS_ENVIRONMENT(DeclarativeEnvironment, Environment);
GC_DECLARE_ALLOCATOR(DeclarativeEnvironment); GC_DECLARE_ALLOCATOR(DeclarativeEnvironment);

View file

@ -18,7 +18,7 @@
namespace JS { namespace JS {
// 7.4.1 Iterator Records, https://tc39.es/ecma262/#sec-iterator-records // 7.4.1 Iterator Records, https://tc39.es/ecma262/#sec-iterator-records
class IteratorRecord final : public Cell { class JS_API IteratorRecord final : public Cell {
GC_CELL(IteratorRecord, Cell); GC_CELL(IteratorRecord, Cell);
GC_DECLARE_ALLOCATOR(IteratorRecord); GC_DECLARE_ALLOCATOR(IteratorRecord);

View file

@ -14,7 +14,7 @@
namespace JS { namespace JS {
// 27.2.1.1 PromiseCapability Records, https://tc39.es/ecma262/#sec-promisecapability-records // 27.2.1.1 PromiseCapability Records, https://tc39.es/ecma262/#sec-promisecapability-records
class PromiseCapability final : public Cell { class JS_API PromiseCapability final : public Cell {
GC_CELL(PromiseCapability, Cell); GC_CELL(PromiseCapability, Cell);
GC_DECLARE_ALLOCATOR(PromiseCapability); GC_DECLARE_ALLOCATOR(PromiseCapability);

View file

@ -6,6 +6,7 @@
#pragma once #pragma once
#include <LibJS/Export.h>
#include <LibJS/Runtime/Environment.h> #include <LibJS/Runtime/Environment.h>
#include <LibJS/Runtime/EnvironmentCoordinate.h> #include <LibJS/Runtime/EnvironmentCoordinate.h>
#include <LibJS/Runtime/PropertyKey.h> #include <LibJS/Runtime/PropertyKey.h>
@ -15,7 +16,7 @@ namespace JS {
Reference make_private_reference(VM&, Value base_value, Utf16FlyString const& private_identifier); Reference make_private_reference(VM&, Value base_value, Utf16FlyString const& private_identifier);
class Reference { class JS_API Reference {
public: public:
enum class BaseType : u8 { enum class BaseType : u8 {
Unresolvable, Unresolvable,

View file

@ -26,7 +26,7 @@ struct ParseRegexPatternError {
ErrorOr<String, ParseRegexPatternError> parse_regex_pattern(Utf16View const& pattern, bool unicode, bool unicode_sets); ErrorOr<String, ParseRegexPatternError> parse_regex_pattern(Utf16View const& pattern, bool unicode, bool unicode_sets);
ThrowCompletionOr<String> parse_regex_pattern(VM& vm, Utf16View const& pattern, bool unicode, bool unicode_sets); ThrowCompletionOr<String> parse_regex_pattern(VM& vm, Utf16View const& pattern, bool unicode, bool unicode_sets);
class RegExpObject : public Object { class JS_API RegExpObject : public Object {
JS_OBJECT(RegExpObject, Object); JS_OBJECT(RegExpObject, Object);
GC_DECLARE_ALLOCATOR(RegExpObject); GC_DECLARE_ALLOCATOR(RegExpObject);

View file

@ -20,7 +20,7 @@
namespace JS { namespace JS {
class TypedArrayBase : public Object { class JS_API TypedArrayBase : public Object {
JS_OBJECT(TypedArrayBase, Object); JS_OBJECT(TypedArrayBase, Object);
public: public:

View file

@ -8,12 +8,13 @@
#include <AK/HashMap.h> #include <AK/HashMap.h>
#include <LibGC/WeakContainer.h> #include <LibGC/WeakContainer.h>
#include <LibJS/Export.h>
#include <LibJS/Runtime/GlobalObject.h> #include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/Object.h> #include <LibJS/Runtime/Object.h>
namespace JS { namespace JS {
class WeakMap final class JS_API WeakMap final
: public Object : public Object
, public GC::WeakContainer { , public GC::WeakContainer {
JS_OBJECT(WeakMap, Object); JS_OBJECT(WeakMap, Object);

View file

@ -8,12 +8,13 @@
#include <AK/HashTable.h> #include <AK/HashTable.h>
#include <LibGC/WeakContainer.h> #include <LibGC/WeakContainer.h>
#include <LibJS/Export.h>
#include <LibJS/Runtime/GlobalObject.h> #include <LibJS/Runtime/GlobalObject.h>
#include <LibJS/Runtime/Object.h> #include <LibJS/Runtime/Object.h>
namespace JS { namespace JS {
class WeakSet final class JS_API WeakSet final
: public Object : public Object
, public GC::WeakContainer { , public GC::WeakContainer {
JS_OBJECT(WeakSet, Object); JS_OBJECT(WeakSet, Object);

View file

@ -13,12 +13,9 @@
#include <AK/Vector.h> #include <AK/Vector.h>
#include <LibCore/ArgsParser.h> #include <LibCore/ArgsParser.h>
#include <LibCore/File.h> #include <LibCore/File.h>
#include <LibJS/Bytecode/BasicBlock.h>
#include <LibJS/Bytecode/Generator.h>
#include <LibJS/Bytecode/Interpreter.h> #include <LibJS/Bytecode/Interpreter.h>
#include <LibJS/Contrib/Test262/GlobalObject.h> #include <LibJS/Contrib/Test262/GlobalObject.h>
#include <LibJS/Parser.h> #include <LibJS/Parser.h>
#include <LibJS/Runtime/Agent.h>
#include <LibJS/Runtime/VM.h> #include <LibJS/Runtime/VM.h>
#include <LibJS/Runtime/ValueInlines.h> #include <LibJS/Runtime/ValueInlines.h>
#include <LibJS/Script.h> #include <LibJS/Script.h>