Skip to content

Commit 03b9c29

Browse files
committed
chore: wip
1 parent 60dc5ee commit 03b9c29

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

scripts/build-php.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,16 +1718,13 @@ exec "$@"
17181718
buildEnv.PATH = `${phpSourceDir}:${buildEnv.PATH}`
17191719

17201720
// Fix "fixup not sufficiently aligned" errors in OPcache JIT on macOS
1721-
// Add aggressive compiler flags to ensure proper alignment for inline assembly
1721+
// Add macOS-compatible compiler flags to ensure proper alignment for inline assembly
17221722
const additionalCFlags = [
1723-
'-falign-functions=32', // Align functions to 32-byte boundaries (more aggressive)
1724-
'-falign-loops=32', // Align loops to 32-byte boundaries (more aggressive)
1725-
'-falign-jumps=32', // Align jump targets to 32-byte boundaries
1726-
'-falign-labels=32', // Align labels to 32-byte boundaries
1723+
'-falign-functions=32', // Align functions to 32-byte boundaries (supported on macOS)
1724+
'-falign-loops=32', // Align loops to 32-byte boundaries (supported on macOS)
17271725
'-fno-strict-aliasing', // Prevent strict aliasing optimizations
17281726
'-fno-delete-null-pointer-checks', // Prevent null pointer optimizations
17291727
'-fno-optimize-sibling-calls', // Prevent tail call optimization that can affect alignment
1730-
'-fno-reorder-blocks', // Prevent block reordering that can affect alignment
17311728
'-mstackrealign', // Force stack realignment for better alignment guarantees
17321729
]
17331730

@@ -1736,6 +1733,11 @@ exec "$@"
17361733
additionalCFlags.push('-mno-unaligned-access') // ARM64-specific: prevent unaligned access
17371734
}
17381735

1736+
// Remove unsupported flags on macOS clang:
1737+
// - '-falign-jumps=32' (not supported by clang)
1738+
// - '-falign-labels=32' (not supported by clang)
1739+
// - '-fno-reorder-blocks' (not supported by clang)
1740+
17391741
// Add these flags to CFLAGS and CXXFLAGS if they don't already exist
17401742
const currentCFlags = buildEnv.CFLAGS || ''
17411743
const currentCXXFlags = buildEnv.CXXFLAGS || ''

0 commit comments

Comments
 (0)