diff options
author | Luke Channings <461449+LukeChannings@users.noreply.github.com> | 2022-10-16 23:53:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-17 00:53:35 +0200 |
commit | d2c8b5f0875c6c5ee7d99d2b2f487adf01a3b903 (patch) | |
tree | ef91eef2e30c4ab71f773a03179171da1b0b1327 | |
parent | 9fe508dfb955ff49e7e87aa208717a1cbf525437 (diff) |
fix(build) fix linux symbols export list format (#16313)
Fixes the error reported in #16304.
> = note:
/usr/bin/ld:/home/abotella/Projects/deno/cli/generated_symbol_exports_list_linux.def:1:
syntax error in dynamic list
collect2: error: ld returned 1 exit status
This was caused by the format of the symbols list on Linux being
malformed (as the error implies).
The format is documented in ld's
[VERSION](https://sourceware.org/binutils/docs/ld/VERSION.html) as well
as:
> --export-dynamic-symbol-list=file
Specify a --export-dynamic-symbol for each pattern in the
file. The format of the file is the same as the version node
without scope and node name. See VERSION for more
information.
Previously, the format for the Linux symbols list was simply a list of
symbols, now it follows the format:
```
{ symbol_name_a; ...; symbol_name_z };
```
-rw-r--r-- | cli/build.rs | 6 | ||||
-rw-r--r-- | cli/generated_symbol_exports_list_linux.def | 144 | ||||
-rw-r--r-- | cli/napi_sym/generated_symbol_exports_list_linux.def | 1 | ||||
-rw-r--r-- | cli/napi_sym/generated_symbol_exports_list_macos.def (renamed from cli/generated_symbol_exports_list_macos.def) | 2 | ||||
-rw-r--r-- | cli/napi_sym/generated_symbol_exports_list_windows.def (renamed from cli/generated_symbol_exports_list_windows.def) | 2 | ||||
-rwxr-xr-x | tools/napi/generate_symbols_lists.js | 18 |
6 files changed, 19 insertions, 154 deletions
diff --git a/cli/build.rs b/cli/build.rs index 98d044a3e..48af79101 100644 --- a/cli/build.rs +++ b/cli/build.rs @@ -333,7 +333,11 @@ fn main() { } let symbols_path = std::path::Path::new( - format!("generated_symbol_exports_list_{}.def", env::consts::OS).as_str(), + format!( + "napi_sym/generated_symbol_exports_list_{}.def", + env::consts::OS + ) + .as_str(), ) .canonicalize() .expect( diff --git a/cli/generated_symbol_exports_list_linux.def b/cli/generated_symbol_exports_list_linux.def deleted file mode 100644 index 0adba1dce..000000000 --- a/cli/generated_symbol_exports_list_linux.def +++ /dev/null @@ -1,144 +0,0 @@ -node_api_create_syntax_error -napi_make_callback -napi_has_named_property -napi_async_destroy -napi_coerce_to_object -napi_get_arraybuffer_info -napi_detach_arraybuffer -napi_get_undefined -napi_reference_unref -napi_fatal_error -napi_open_callback_scope -napi_close_callback_scope -napi_get_value_uint32 -napi_create_function -napi_create_arraybuffer -napi_get_value_int64 -napi_get_all_property_names -napi_resolve_deferred -napi_is_detached_arraybuffer -napi_create_string_utf8 -napi_create_threadsafe_function -node_api_throw_syntax_error -napi_create_bigint_int64 -napi_wrap -napi_set_property -napi_get_value_bigint_int64 -napi_open_handle_scope -napi_create_error -napi_create_buffer -napi_cancel_async_work -napi_is_exception_pending -napi_acquire_threadsafe_function -napi_create_external -napi_get_threadsafe_function_context -napi_get_null -napi_create_string_utf16 -napi_get_value_bigint_uint64 -napi_module_register -napi_is_typedarray -napi_create_external_buffer -napi_get_new_target -napi_get_instance_data -napi_close_handle_scope -napi_get_value_string_utf16 -napi_get_property_names -napi_is_arraybuffer -napi_get_cb_info -napi_define_properties -napi_add_env_cleanup_hook -node_api_get_module_file_name -napi_get_node_version -napi_create_int64 -napi_create_double -napi_get_and_clear_last_exception -napi_create_reference -napi_get_typedarray_info -napi_call_threadsafe_function -napi_get_last_error_info -napi_create_array_with_length -napi_coerce_to_number -napi_get_global -napi_is_error -napi_set_instance_data -napi_create_typedarray -napi_throw_type_error -napi_has_property -napi_get_value_external -napi_create_range_error -napi_typeof -napi_ref_threadsafe_function -napi_create_bigint_uint64 -napi_get_prototype -napi_adjust_external_memory -napi_release_threadsafe_function -napi_delete_async_work -napi_create_string_latin1 -napi_is_array -napi_unref_threadsafe_function -napi_throw_error -napi_has_own_property -napi_get_reference_value -napi_remove_env_cleanup_hook -napi_get_value_string_utf8 -napi_is_promise -napi_get_boolean -napi_run_script -napi_get_element -napi_get_named_property -napi_get_buffer_info -napi_get_value_bool -napi_reference_ref -napi_create_object -napi_create_promise -napi_create_int32 -napi_escape_handle -napi_open_escapable_handle_scope -napi_throw -napi_get_value_double -napi_set_named_property -napi_call_function -napi_create_date -napi_object_freeze -napi_get_uv_event_loop -napi_get_value_string_latin1 -napi_reject_deferred -napi_add_finalizer -napi_create_array -napi_delete_reference -napi_get_date_value -napi_create_dataview -napi_get_version -napi_define_class -napi_is_date -napi_remove_wrap -napi_delete_property -napi_instanceof -napi_create_buffer_copy -napi_delete_element -napi_object_seal -napi_queue_async_work -napi_get_value_bigint_words -napi_is_buffer -napi_get_array_length -napi_get_property -napi_new_instance -napi_set_element -napi_create_bigint_words -napi_strict_equals -napi_is_dataview -napi_close_escapable_handle_scope -napi_get_dataview_info -napi_get_value_int32 -napi_unwrap -napi_throw_range_error -napi_coerce_to_bool -napi_create_uint32 -napi_has_element -napi_create_external_arraybuffer -napi_create_symbol -napi_coerce_to_string -napi_create_type_error -napi_fatal_exception -napi_create_async_work -napi_async_init diff --git a/cli/napi_sym/generated_symbol_exports_list_linux.def b/cli/napi_sym/generated_symbol_exports_list_linux.def new file mode 100644 index 000000000..eceac0a43 --- /dev/null +++ b/cli/napi_sym/generated_symbol_exports_list_linux.def @@ -0,0 +1 @@ +{ "node_api_create_syntax_error"; "napi_make_callback"; "napi_has_named_property"; "napi_async_destroy"; "napi_coerce_to_object"; "napi_get_arraybuffer_info"; "napi_detach_arraybuffer"; "napi_get_undefined"; "napi_reference_unref"; "napi_fatal_error"; "napi_open_callback_scope"; "napi_close_callback_scope"; "napi_get_value_uint32"; "napi_create_function"; "napi_create_arraybuffer"; "napi_get_value_int64"; "napi_get_all_property_names"; "napi_resolve_deferred"; "napi_is_detached_arraybuffer"; "napi_create_string_utf8"; "napi_create_threadsafe_function"; "node_api_throw_syntax_error"; "napi_create_bigint_int64"; "napi_wrap"; "napi_set_property"; "napi_get_value_bigint_int64"; "napi_open_handle_scope"; "napi_create_error"; "napi_create_buffer"; "napi_cancel_async_work"; "napi_is_exception_pending"; "napi_acquire_threadsafe_function"; "napi_create_external"; "napi_get_threadsafe_function_context"; "napi_get_null"; "napi_create_string_utf16"; "napi_get_value_bigint_uint64"; "napi_module_register"; "napi_is_typedarray"; "napi_create_external_buffer"; "napi_get_new_target"; "napi_get_instance_data"; "napi_close_handle_scope"; "napi_get_value_string_utf16"; "napi_get_property_names"; "napi_is_arraybuffer"; "napi_get_cb_info"; "napi_define_properties"; "napi_add_env_cleanup_hook"; "node_api_get_module_file_name"; "napi_get_node_version"; "napi_create_int64"; "napi_create_double"; "napi_get_and_clear_last_exception"; "napi_create_reference"; "napi_get_typedarray_info"; "napi_call_threadsafe_function"; "napi_get_last_error_info"; "napi_create_array_with_length"; "napi_coerce_to_number"; "napi_get_global"; "napi_is_error"; "napi_set_instance_data"; "napi_create_typedarray"; "napi_throw_type_error"; "napi_has_property"; "napi_get_value_external"; "napi_create_range_error"; "napi_typeof"; "napi_ref_threadsafe_function"; "napi_create_bigint_uint64"; "napi_get_prototype"; "napi_adjust_external_memory"; "napi_release_threadsafe_function"; "napi_delete_async_work"; "napi_create_string_latin1"; "napi_is_array"; "napi_unref_threadsafe_function"; "napi_throw_error"; "napi_has_own_property"; "napi_get_reference_value"; "napi_remove_env_cleanup_hook"; "napi_get_value_string_utf8"; "napi_is_promise"; "napi_get_boolean"; "napi_run_script"; "napi_get_element"; "napi_get_named_property"; "napi_get_buffer_info"; "napi_get_value_bool"; "napi_reference_ref"; "napi_create_object"; "napi_create_promise"; "napi_create_int32"; "napi_escape_handle"; "napi_open_escapable_handle_scope"; "napi_throw"; "napi_get_value_double"; "napi_set_named_property"; "napi_call_function"; "napi_create_date"; "napi_object_freeze"; "napi_get_uv_event_loop"; "napi_get_value_string_latin1"; "napi_reject_deferred"; "napi_add_finalizer"; "napi_create_array"; "napi_delete_reference"; "napi_get_date_value"; "napi_create_dataview"; "napi_get_version"; "napi_define_class"; "napi_is_date"; "napi_remove_wrap"; "napi_delete_property"; "napi_instanceof"; "napi_create_buffer_copy"; "napi_delete_element"; "napi_object_seal"; "napi_queue_async_work"; "napi_get_value_bigint_words"; "napi_is_buffer"; "napi_get_array_length"; "napi_get_property"; "napi_new_instance"; "napi_set_element"; "napi_create_bigint_words"; "napi_strict_equals"; "napi_is_dataview"; "napi_close_escapable_handle_scope"; "napi_get_dataview_info"; "napi_get_value_int32"; "napi_unwrap"; "napi_throw_range_error"; "napi_coerce_to_bool"; "napi_create_uint32"; "napi_has_element"; "napi_create_external_arraybuffer"; "napi_create_symbol"; "napi_coerce_to_string"; "napi_create_type_error"; "napi_fatal_exception"; "napi_create_async_work"; "napi_async_init"; };
\ No newline at end of file diff --git a/cli/generated_symbol_exports_list_macos.def b/cli/napi_sym/generated_symbol_exports_list_macos.def index 7c588ea2f..be69d297f 100644 --- a/cli/generated_symbol_exports_list_macos.def +++ b/cli/napi_sym/generated_symbol_exports_list_macos.def @@ -141,4 +141,4 @@ _napi_coerce_to_string _napi_create_type_error _napi_fatal_exception _napi_create_async_work -_napi_async_init +_napi_async_init
\ No newline at end of file diff --git a/cli/generated_symbol_exports_list_windows.def b/cli/napi_sym/generated_symbol_exports_list_windows.def index 0b6cb946a..45f5d3aab 100644 --- a/cli/generated_symbol_exports_list_windows.def +++ b/cli/napi_sym/generated_symbol_exports_list_windows.def @@ -143,4 +143,4 @@ EXPORTS napi_create_type_error napi_fatal_exception napi_create_async_work - napi_async_init + napi_async_init
\ No newline at end of file diff --git a/tools/napi/generate_symbols_lists.js b/tools/napi/generate_symbols_lists.js index 3e41c3f06..0b4317170 100755 --- a/tools/napi/generate_symbols_lists.js +++ b/tools/napi/generate_symbols_lists.js @@ -5,15 +5,19 @@ import exports from "../../cli/napi_sym/symbol_exports.json" assert { type: "json", }; -for await (const os of ["linux", "macos", "windows"]) { - let def = os === "windows" ? "LIBRARY\nEXPORTS\n" : ""; - const prefix = os === "windows" ? " " : os === "macos" ? "_" : ""; - for (const symbol of exports.symbols) { - def += `${prefix}${symbol}\n`; - } +const symbolExportLists = { + linux: `{ ${exports.symbols.map((s) => `"${s}"`).join("; ")}; };`, + windows: `LIBRARY\nEXPORTS\n${ + exports.symbols + .map((symbol) => " " + symbol) + .join("\n") + }`, + macos: exports.symbols.map((symbol) => "_" + symbol).join("\n"), +}; +for await (const [os, def] of Object.entries(symbolExportLists)) { const defUrl = new URL( - `../../cli/generated_symbol_exports_list_${os}.def`, + `../../cli/napi_sym/generated_symbol_exports_list_${os}.def`, import.meta.url, ); await Deno.writeTextFile(defUrl.pathname, def, { create: true }); |