diff options
| author | Jakub Konka <kubkon@jakubkonka.com> | 2022-01-11 11:30:53 +0100 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2022-01-11 11:30:53 +0100 |
| commit | a615425b513eb981cb2d5f0b780d720203c8defe (patch) | |
| tree | 20cc2e7305456b4175b1e19040016edb8ad303d2 /src/stage1/codegen.cpp | |
| parent | 4731a6e5d57d5fe6c17c42028aebd9fce3682ddb (diff) | |
| parent | 247b638ccf8bfd5e0c4729935d230022726f97aa (diff) | |
| download | zig-a615425b513eb981cb2d5f0b780d720203c8defe.tar.gz zig-a615425b513eb981cb2d5f0b780d720203c8defe.zip | |
Merge branch 'linker-eport-symbols' of github.com:Luukdegram/zig into Luukdegram-linker-eport-symbols
Diffstat (limited to 'src/stage1/codegen.cpp')
| -rw-r--r-- | src/stage1/codegen.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/stage1/codegen.cpp b/src/stage1/codegen.cpp index 0cf8024995..cfd455e815 100644 --- a/src/stage1/codegen.cpp +++ b/src/stage1/codegen.cpp @@ -9905,6 +9905,18 @@ void codegen_build_object(CodeGen *g) { codegen_add_time_event(g, "Done"); codegen_switch_sub_prog_node(g, nullptr); + + // append all export symbols to stage2 so we can provide them to the linker + if (target_is_wasm(g->zig_target)){ + Error err; + auto export_it = g->exported_symbol_names.entry_iterator(); + decltype(g->exported_symbol_names)::Entry *curr_entry = nullptr; + while ((curr_entry = export_it.next()) != nullptr) { + if ((err = stage2_append_symbol(&g->stage1, buf_ptr(curr_entry->key), buf_len(curr_entry->key)))) { + fprintf(stderr, "Unable to export symbol '%s': %s\n", buf_ptr(curr_entry->key), err_str(err)); + } + } + } } ZigPackage *codegen_create_package(CodeGen *g, const char *root_src_dir, const char *root_src_path, |
