Make SIMD syms private for x86[-64]/Mach-O builds
... if building with YASM. NASM doesn't currently support the necessary
directives.
Closes #212
diff --git a/BUILDING.md b/BUILDING.md
index 0e63964..429963e 100644
--- a/BUILDING.md
+++ b/BUILDING.md
@@ -18,6 +18,9 @@
when building macho64 objects.) NASM or YASM can be obtained from
[MacPorts](http://www.macports.org/) or [Homebrew](http://brew.sh/).
* If using YASM, 1.2.0 or later is required.
+ - NOTE: Currently, if it is desirable to hide the SIMD function symbols in
+ Mac executables or shared libraries that statically link with
+ libjpeg-turbo, then YASM must be used when building libjpeg-turbo.
* If building on Windows, **nasm.exe**/**yasm.exe** should be in your `PATH`.
The binary RPMs released by the NASM project do not work on older Linux
diff --git a/ChangeLog.md b/ChangeLog.md
index 7bac416..a5e6c86 100644
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -107,9 +107,10 @@
algorithm that caused incorrect dithering in the output image. This algorithm
now produces bitwise-identical results to the unmerged algorithms.
-12. The SIMD function symbols for x86[-64]/ELF, MIPS/ELF, and iOS/ARM[64]
-builds are now private. This prevents those symbols from being exposed in
-applications or shared libraries that link statically with libjpeg-turbo.
+12. The SIMD function symbols for x86[-64]/ELF, MIPS/ELF, macOS/x86[-64] (if
+libjpeg-turbo is built with YASM), and iOS/ARM[64] builds are now private.
+This prevents those symbols from being exposed in applications or shared
+libraries that link statically with libjpeg-turbo.
1.5.3
diff --git a/simd/nasm/jsimdext.inc b/simd/nasm/jsimdext.inc
index e91e009..fc9c855 100644
--- a/simd/nasm/jsimdext.inc
+++ b/simd/nasm/jsimdext.inc
@@ -194,11 +194,17 @@
%ifdef ELF ; ----(nasm -felf[64] -DELF ...)--------
%define GLOBAL_FUNCTION(name) global EXTN(name):function hidden
%define GLOBAL_DATA(name) global EXTN(name):data hidden
-;%elifdef MACHO ; ----(nasm -fmacho -DMACHO ...)--------
-;%define GLOBAL_FUNCTION(name) global EXTN(name):private_extern
-;%define GLOBAL_DATA(name) global EXTN(name):private_extern
-%else
+%elifdef MACHO ; ----(nasm -fmacho -DMACHO ...)--------
+%ifdef __YASM_VER__
+%define GLOBAL_FUNCTION(name) global EXTN(name):private_extern
+%define GLOBAL_DATA(name) global EXTN(name):private_extern
+%endif
+%endif
+
+%ifndef GLOBAL_FUNCTION
%define GLOBAL_FUNCTION(name) global EXTN(name)
+%endif
+%ifndef GLOBAL_DATA
%define GLOBAL_DATA(name) global EXTN(name)
%endif