From 90ffc40e4f3d81ad6b9f57092074f8fef68cf128 Mon Sep 17 00:00:00 2001 From: Hiroshi Ioka Date: Sun, 13 Aug 2017 00:19:51 +0900 Subject: [PATCH] cmd/link: correct Mach-O file flag Only set MH_NOUNDEFS if there are no undefined symbols. Doesn't seem to matter, but may as well do it right. Change-Id: I6c472e000578346c28cf0e10f24f870e3a0de628 Reviewed-on: https://go-review.googlesource.com/55310 Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor TryBot-Result: Gobot Gobot --- src/cmd/link/internal/ld/macho.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cmd/link/internal/ld/macho.go b/src/cmd/link/internal/ld/macho.go index 161833f357c..ccdbc54f66d 100644 --- a/src/cmd/link/internal/ld/macho.go +++ b/src/cmd/link/internal/ld/macho.go @@ -263,7 +263,11 @@ func machowrite() int { } Thearch.Lput(uint32(len(load)) + uint32(nseg) + uint32(ndebug)) Thearch.Lput(uint32(loadsize)) - Thearch.Lput(MH_NOUNDEFS) /* flags - no undefines */ + if nkind[SymKindUndef] == 0 { + Thearch.Lput(MH_NOUNDEFS) /* flags - no undefines */ + } else { + Thearch.Lput(0) /* flags */ + } if macho64 { Thearch.Lput(0) /* reserved */ }