shithub: mc

Download patch

ref: 671e174caf52f96683cabb294f77623d55fbb91b
parent: 133e0113e998eacbb469db5e773552ed69c85a55
author: Carlin Bingham <cb@viennan.net>
date: Tue Dec 12 00:28:51 EST 2017

Correctly invoke the linker when binding with C

If the glue file is a lib, dynlibs is empty when linkcmd() is called

--- a/mbld/deps.myr
+++ b/mbld/deps.myr
@@ -177,6 +177,7 @@
 			for l : ll
 				std.slpush(&dynlibs, l)
 			;;
+			mt.isdyn = true
 		elif std.hassuffix(f, config.Objsuffix)
 			depends(g, go, p)
 		else
@@ -461,7 +462,7 @@
 	if std.sleq(opt_sys, "osx")
 		std.slpush(&n.cmd, std.sldup("-macosx_version_min"))
 		std.slpush(&n.cmd, std.sldup("10.6"))
-	elif std.sleq(opt_sys, "linux") && dynlibs.len != 0
+	elif std.sleq(opt_sys, "linux") && mt.isdyn
 		std.slpush(&n.cmd, std.sldup("-dynamic-linker"))
 		std.slpush(&n.cmd, std.sldup("/lib64/ld-linux-x86-64.so.2"))
 	;;
--- a/mbld/parse.myr
+++ b/mbld/parse.myr
@@ -472,6 +472,7 @@
 		.islib=false,
 		.istest=istest,
 		.isbench=isbench,
+		.isdyn=false,
 		/* attrs */
 		.tags=tags,
 		.install=install,
--- a/mbld/types.myr
+++ b/mbld/types.myr
@@ -46,6 +46,7 @@
 		islib	: bool
 		istest	: bool
 		isbench	: bool
+		isdyn	: bool
 		install	: bool
 
 	;;