summaryrefslogtreecommitdiff
path: root/tools/napi/generate_symbols_lists.js
diff options
context:
space:
mode:
authorLuke Channings <461449+LukeChannings@users.noreply.github.com>2022-10-16 23:53:35 +0100
committerGitHub <noreply@github.com>2022-10-17 00:53:35 +0200
commitd2c8b5f0875c6c5ee7d99d2b2f487adf01a3b903 (patch)
treeef91eef2e30c4ab71f773a03179171da1b0b1327 /tools/napi/generate_symbols_lists.js
parent9fe508dfb955ff49e7e87aa208717a1cbf525437 (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 }; ```
Diffstat (limited to 'tools/napi/generate_symbols_lists.js')
-rwxr-xr-xtools/napi/generate_symbols_lists.js18
1 files changed, 11 insertions, 7 deletions
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 });