Files
alpha-quadrant/dev-lang/php/files/0010-Fix-GH-16168-Fix-inline-assembly-labels-to-not-crash-PHP7.4.patch
T

104 lines
2.4 KiB
Diff

From 9fbcc192064146df6c7784265ca826ce63c7c402 Mon Sep 17 00:00:00 2001
From: Shivam Mathur <shivam_jpr@hotmail.com>
Date: Sun, 12 Oct 2025 04:26:14 +0530
Subject: [PATCH 1/1] Fix GH-16168: Fix inline assembly labels to not crash
with Xcode 16 clang
---
Zend/zend_string.c | 40 ++++++++++++++++++++--------------------
1 file changed, 20 insertions(+), 20 deletions(-)
diff --git a/Zend/zend_string.c b/Zend/zend_string.c
index 75e7e6249f..ee6a89125c 100644
--- a/Zend/zend_string.c
+++ b/Zend/zend_string.c
@@ -328,32 +328,32 @@ ZEND_API void zend_interned_strings_switch_storage(zend_bool request)
ZEND_API zend_bool ZEND_FASTCALL zend_string_equal_val(zend_string *s1, zend_string *s2)
{
char *ptr = ZSTR_VAL(s1);
- size_t delta = (char*)s2 - (char*)s1;
+ uintptr_t delta = (uintptr_t) s2 - (uintptr_t) s1;
size_t len = ZSTR_LEN(s1);
zend_ulong ret;
__asm__ (
- ".LL0%=:\n\t"
+ "0:\n\t"
"movl (%2,%3), %0\n\t"
"xorl (%2), %0\n\t"
- "jne .LL1%=\n\t"
+ "jne 1f\n\t"
"addl $0x4, %2\n\t"
"subl $0x4, %1\n\t"
- "ja .LL0%=\n\t"
+ "ja 0b\n\t"
"movl $0x1, %0\n\t"
- "jmp .LL3%=\n\t"
- ".LL1%=:\n\t"
+ "jmp 3f\n\t"
+ "1:\n\t"
"cmpl $0x4,%1\n\t"
- "jb .LL2%=\n\t"
+ "jb 2f\n\t"
"xorl %0, %0\n\t"
- "jmp .LL3%=\n\t"
- ".LL2%=:\n\t"
+ "jmp 3f\n\t"
+ "2:\n\t"
"negl %1\n\t"
"lea 0x20(,%1,8), %1\n\t"
"shll %b1, %0\n\t"
"sete %b0\n\t"
"movzbl %b0, %0\n\t"
- ".LL3%=:\n"
+ "3:\n"
: "=&a"(ret),
"+c"(len),
"+r"(ptr)
@@ -396,32 +396,32 @@ ZEND_API zend_bool ZEND_FASTCALL I_WRAP_SONAME_FNNAME_ZU(NONE,zend_string_equal_
ZEND_API zend_bool ZEND_FASTCALL zend_string_equal_val(zend_string *s1, zend_string *s2)
{
char *ptr = ZSTR_VAL(s1);
- size_t delta = (char*)s2 - (char*)s1;
+ uintptr_t delta = (uintptr_t) s2 - (uintptr_t) s1;
size_t len = ZSTR_LEN(s1);
zend_ulong ret;
__asm__ (
- ".LL0%=:\n\t"
+ "0:\n\t"
"movq (%2,%3), %0\n\t"
"xorq (%2), %0\n\t"
- "jne .LL1%=\n\t"
+ "jne 1f\n\t"
"addq $0x8, %2\n\t"
"subq $0x8, %1\n\t"
- "ja .LL0%=\n\t"
+ "ja 0b\n\t"
"movq $0x1, %0\n\t"
- "jmp .LL3%=\n\t"
- ".LL1%=:\n\t"
+ "jmp 3f\n\t"
+ "1:\n\t"
"cmpq $0x8,%1\n\t"
- "jb .LL2%=\n\t"
+ "jb 2f\n\t"
"xorq %0, %0\n\t"
- "jmp .LL3%=\n\t"
- ".LL2%=:\n\t"
+ "jmp 3f\n\t"
+ "2:\n\t"
"negq %1\n\t"
"lea 0x40(,%1,8), %1\n\t"
"shlq %b1, %0\n\t"
"sete %b0\n\t"
"movzbq %b0, %0\n\t"
- ".LL3%=:\n"
+ "3:\n"
: "=&a"(ret),
"+c"(len),
"+r"(ptr)
--
2.50.1 (Apple Git-155)