Skip to content

Commit 9aa8839

Browse files
authored
Add linkopts to mojo_binary / mojo_test / mojo_shared_library (#29)
At the very least this is useful for `-v` for debugging
1 parent 99fc56a commit 9aa8839

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

mojo/private/mojo_binary_test.bzl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ _ATTRS = {
2525
"data": attr.label_list(allow_files = True),
2626
"enable_assertions": attr.bool(default = True),
2727
"env": attr.string_dict(),
28+
"linkopts": attr.string_list(
29+
doc = "Additional options to pass to the linker.",
30+
),
2831
"python_version": attr.string(
2932
doc = "The version of Python to use for this target and all its dependencies.",
3033
),
@@ -151,6 +154,7 @@ def _mojo_binary_test_implementation(ctx, *, shared_library = False):
151154
cc_toolchain = cc_toolchain,
152155
linking_contexts = [object_linking_context] + [dep[CcInfo].linking_context for dep in (ctx.attr.deps + mojo_toolchain.implicit_deps) if CcInfo in dep],
153156
name = ctx.label.name,
157+
user_link_flags = ctx.attr.linkopts,
154158
**link_kwargs
155159
)
156160

0 commit comments

Comments
 (0)