From 28bf768883d2411d4cd75582d396d465ab6a54b2 Mon Sep 17 00:00:00 2001 From: Andrew Kelley Date: Mon, 18 Feb 2019 16:47:30 -0500 Subject: export _mh_execute_header with weak linkage * also fix extern variables with initialiaztion values to generate runtime code * remove the workaround in example/shared_library/mathtest.zig * introduce the ability for global variables to have Weak and LinkOnce linkage * fix `@export` to work for non-functions. this code needs to be audited though. * fix comptime ptrcast not keeping bigger alignment * fix linker warnings when targeting darwin closes #1903 --- src/link.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/link.cpp') diff --git a/src/link.cpp b/src/link.cpp index 956e5b6bfc..f6f0c0ffcd 100644 --- a/src/link.cpp +++ b/src/link.cpp @@ -899,7 +899,11 @@ static void construct_linker_job_macho(LinkJob *lj) { lj->args.append("-ios_simulator_version_min"); break; } - lj->args.append(buf_ptr(buf_sprintf("%d.%d.%d", platform.major, platform.minor, platform.micro))); + Buf *version_string = buf_sprintf("%d.%d.%d", platform.major, platform.minor, platform.micro); + lj->args.append(buf_ptr(version_string)); + + lj->args.append("-sdk_version"); + lj->args.append(buf_ptr(version_string)); if (g->out_type == OutTypeExe) { @@ -920,7 +924,9 @@ static void construct_linker_job_macho(LinkJob *lj) { add_rpath(lj, &g->output_file_path); if (shared) { - lj->args.append("-headerpad_max_install_names"); + if (g->system_linker_hack) { + lj->args.append("-headerpad_max_install_names"); + } } else if (g->is_static) { lj->args.append("-lcrt0.o"); } else { -- cgit v1.2.3