Some types of macOS builds broke a while ago due to unsupported linker flags. This patch should resolve this.
diff --git i/xed_build_common.py w/xed_build_common.py
index 6d2d2d01..25bb3e45 100755
--- i/xed_build_common.py
+++ w/xed_build_common.py
@@ -137,12 +137,17 @@ def gnu_secured_build(env: dict) -> str:
# Generates position-independent code during the compilation phase
flags += ' -fPIC'
if not env['debug']:
- ### Stack and Heap Overlap Protection ###
- # Enables Read-Only Relocation (RELRO) and Immediate Binding protections
- env.add_to_var('LINKFLAGS','-Wl,-z,relro,-z,now')
- ### Inexecutable Stack ###
- # Specifies that the stack memory should be marked as non-executable
- env.add_to_var('LINKFLAGS','-z noexecstack')
+ if env.on_mac():
+ # Modern macOS protects relocations and the stack by default,
+ # and doesn't support the link flags in the else clause.
+ env.add_to_var('LINKFLAGS','-Wl,-bind_at_load')
+ else:
+ ### Stack and Heap Overlap Protection ###
+ # Enables Read-Only Relocation (RELRO) and Immediate Binding protections
+ env.add_to_var('LINKFLAGS','-Wl,-z,relro,-z,now')
+ ### Inexecutable Stack ###
+ # Specifies that the stack memory should be marked as non-executable
+ env.add_to_var('LINKFLAGS','-z noexecstack')
else: # Windows
# Enables Data Execution Prevention (DEP) for executables.
env.add_to_var('LINKFLAGS','-Wl,-nxcompat')
Some types of macOS builds broke a while ago due to unsupported linker flags. This patch should resolve this.