diff --git a/Tools/ardupilotwaf/boards.py b/Tools/ardupilotwaf/boards.py index 566d632a1f..f121def9ec 100644 --- a/Tools/ardupilotwaf/boards.py +++ b/Tools/ardupilotwaf/boards.py @@ -148,9 +148,15 @@ class Board: '-O0', ] - env.LINKFLAGS += [ - '-Wl,--gc-sections', - ] + if cfg.env.DEST_OS == 'darwin': + env.LINKFLAGS += [ + '-Wl,-dead_strip', + ] + else: + env.LINKFLAGS += [ + '-Wl,--gc-sections', + ] + def build(self, bld): bld.ap_version_append_str('GIT_VERSION', bld.git_head_hash(short=True)) diff --git a/Tools/ardupilotwaf/cxx_checks.py b/Tools/ardupilotwaf/cxx_checks.py index e342686e84..87b8403536 100644 --- a/Tools/ardupilotwaf/cxx_checks.py +++ b/Tools/ardupilotwaf/cxx_checks.py @@ -126,6 +126,9 @@ def ap_common_checks(cfg): @conf def check_librt(cfg, env): + if cfg.env.DEST_OS == 'darwin': + return True + ret = cfg.check( compiler='cxx', fragment='''