Skip to content

Commit a0fa33f

Browse files
committed
allow macOS linker to ignore undefined symbols
1 parent dac3b6c commit a0fa33f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

Diff for: haskell/private/actions/link.bzl

+8
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,10 @@ def link_binary(
141141
args.add(paths.join(ar_bindir, "otool"), format = "-pgmotool=%s")
142142
args.add(paths.join(ar_bindir, "install_name_tool"), format = "-pgminstall_name_tool=%s")
143143

144+
# Allow the macOS linker to resolve undefined symbols
145+
# by performing a dynamic lookup at runtime
146+
args.add("-optl-undefined,dynamic_lookup")
147+
144148
args.add_all(hs.toolchain.ghcopts)
145149
args.add_all(compiler_flags)
146150

@@ -382,6 +386,10 @@ def link_library_dynamic(hs, cc, posix, dep_info, extra_srcs, object_files, my_p
382386
args.add(paths.join(ar_bindir, "otool"), format = "-pgmotool=%s")
383387
args.add(paths.join(ar_bindir, "install_name_tool"), format = "-pgminstall_name_tool=%s")
384388

389+
# Allow the macOS linker to resolve undefined symbols
390+
# by performing a dynamic lookup at runtime
391+
args.add("-optl-undefined,dynamic_lookup")
392+
385393
args.add_all(hs.toolchain.ghcopts)
386394
args.add_all(compiler_flags)
387395

0 commit comments

Comments
 (0)