odin-lang / Odin

Odin Programming Language
https://odin-lang.org
BSD 3-Clause "New" or "Revised" License
6.1k stars 550 forks source link

linker: support `@(extra_linker_flags)` on WASM #3819

Closed laytan closed 4 days ago

laytan commented 4 days ago

Currently @(extra_linker_flags) does not do anything on WASM, it should probably pass them along to wasm-ld.

Kelimion commented 4 days ago

Are we not? I'm seeing extra_linker_flags here.

    #if defined(GB_SYSTEM_WINDOWS)
        result = system_exec_command_line_app("wasm-ld",
            "\"%.*s\\bin\\wasm-ld\" %s -o \"%.*s\" %.*s %.*s %s",
            LIT(build_context.ODIN_ROOT),
            inputs, LIT(output_filename), LIT(build_context.link_flags), LIT(build_context.extra_linker_flags),
            extra_orca_flags);
    #else
        result = system_exec_command_line_app("wasm-ld",
            "wasm-ld %s -o \"%.*s\" %.*s %.*s %s",
            inputs, LIT(output_filename),
            LIT(build_context.link_flags),
            LIT(build_context.extra_linker_flags),
            extra_orca_flags);
    #endif
        return result;
    }
laytan commented 4 days ago

No, for example:

package main

@(require, extra_linker_flags="foo")
foreign import foo "foo"

main :: proc() {}

Does not add these linker flags on the WASM targets

gingerBill commented 4 days ago

Should be trivial to add.