Skip to content

Commit f81a832

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

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

haskell/private/actions/link.bzl

+10
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ 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")
147+
args.add("-optldynamic_lookup")
148+
144149
args.add_all(hs.toolchain.ghcopts)
145150
args.add_all(compiler_flags)
146151

@@ -382,6 +387,11 @@ def link_library_dynamic(hs, cc, posix, dep_info, extra_srcs, object_files, my_p
382387
args.add(paths.join(ar_bindir, "otool"), format = "-pgmotool=%s")
383388
args.add(paths.join(ar_bindir, "install_name_tool"), format = "-pgminstall_name_tool=%s")
384389

390+
# Allow the macOS linker to resolve undefined symbols
391+
# by performing a dynamic lookup at runtime
392+
args.add("-optl-undefined")
393+
args.add("-optldynamic_lookup")
394+
385395
args.add_all(hs.toolchain.ghcopts)
386396
args.add_all(compiler_flags)
387397

0 commit comments

Comments
 (0)