changeset 12:fdb709369d57

Do not use -z,relro,-z,now on Systems where it is not supported. This is especially Darwin.
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 17 Sep 2025 15:31:57 +0200
parents f704f0a78213
children d6cbc8049ab0
files mupdf-source/Makerules mupdf-source/scripts/jlib.py setup.py
diffstat 3 files changed, 28 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/mupdf-source/Makerules	Wed Sep 17 12:49:20 2025 +0200
+++ b/mupdf-source/Makerules	Wed Sep 17 15:31:57 2025 +0200
@@ -152,13 +152,22 @@
   LDFLAGS += -g
 else ifeq ($(build),release)
   CFLAGS += -pipe -O2 -DNDEBUG
-  LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s,-z,relro,-z,now
+  LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s
+  ifneq ($(OS),Darwin)
+    LDFLAGS += -Wl,-z,relro,-z,now
+  endif  
 else ifeq ($(build),small)
   CFLAGS += -pipe -Os -DNDEBUG
-  LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s,-z,relro,-z,now
+  LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s
+  ifneq ($(OS),Darwin)
+    LDFLAGS += -Wl,-z,relro,-z,now
+  endif  
 else ifeq ($(build),valgrind)
   CFLAGS += -pipe -O2 -DNDEBUG -DPACIFY_VALGRIND
-  LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s,-z,relro,-z,now
+  LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s
+  ifneq ($(OS),Darwin)
+    LDFLAGS += -Wl,-z,relro,-z,now
+  endif  
 else ifeq ($(build),sanitize)
   CFLAGS += -pipe -g $(SANITIZE_FLAGS)
   LDFLAGS += -g $(SANITIZE_FLAGS)
@@ -173,7 +182,10 @@
   LIBS += -lgcov
 else ifeq ($(build),native)
   CFLAGS += -pipe -O2 -DNDEBUG -march=native
-  LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s,-z,relro,-z,now
+  LDFLAGS += $(LDREMOVEUNREACH) -Wl,-s
+  ifneq ($(OS),Darwin)
+    LDFLAGS += -Wl,-z,relro,-z,now
+  endif  
 else ifeq ($(build),memento)
   CFLAGS += -pipe -g -DMEMENTO -DMEMENTO_MUPDF_HACKS
   LDFLAGS += -g -rdynamic
--- a/mupdf-source/scripts/jlib.py	Wed Sep 17 12:49:20 2025 +0200
+++ b/mupdf-source/scripts/jlib.py	Wed Sep 17 15:31:57 2025 +0200
@@ -2303,10 +2303,11 @@
             ret += ' -Wl,-rpath,@loader_path/.'
         else:
             ret += " -Wl,-rpath,'$ORIGIN',-z,origin"
-    # FreeBSD
-    #   Full RELRO
-    ret += ' -Wl,-z,relro,-z,now'
-    #   Strip
-    ret += ' -Wl,-s'
+    if not darwin and (platform.system() != 'Windows'):
+        # *BSD and Linux
+        #   Full RELRO
+        ret += ' -Wl,-z,relro,-z,now'
+        #   Strip
+        ret += ' -Wl,-s'
     #log('{sos=} {ld_origin=} {ret=}')
     return ret.strip()
--- a/setup.py	Wed Sep 17 12:49:20 2025 +0200
+++ b/setup.py	Wed Sep 17 15:31:57 2025 +0200
@@ -1215,11 +1215,12 @@
         compiler_extra += f' {pyodide_flags}'
         linker_extra += f' {pyodide_flags}'
 
-    # FreeBSD:
-    #   Full RELRO
-    linker_extra += ' -Wl,-z,relro,-z,now'
-    #   Strip
-    linker_extra += ' -Wl,-s'
+    if not darwin and (platform.system() != 'Windows'):
+        # *BSD and Linux
+        #   Full RELRO
+        linker_extra += ' -Wl,-z,relro,-z,now'
+        #   Strip
+        linker_extra += ' -Wl,-s'
         
     return compiler_extra, linker_extra, includes, defines, optimise, debug, libpaths, libs, libraries,