Skip to content

Commit 71a1def

Browse files
committed
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2: Disable inlining and inter-procedure-analyses for zend_string_equal_val() function that may be overriden for valgrind (#13099)
2 parents 10e8a0d + 6339938 commit 71a1def

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

Zend/zend_string.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -374,36 +374,28 @@ ZEND_API void zend_interned_strings_switch_storage(bool request)
374374
}
375375
}
376376

377+
#if defined(__GNUC__) && (defined(__i386__) || (defined(__x86_64__) && !defined(__ILP32__)))
377378
/* Even if we don't build with valgrind support, include the symbol so that valgrind available
378379
* only at runtime will not result in false positives. */
379380
#ifndef I_REPLACE_SONAME_FNNAME_ZU
380381
# define I_REPLACE_SONAME_FNNAME_ZU(soname, fnname) _vgr00000ZU_ ## soname ## _ ## fnname
381382
#endif
382383

383384
/* See GH-9068 */
384-
#if defined(__GNUC__) && (__GNUC__ >= 11 || defined(__clang__)) && __has_attribute(no_caller_saved_registers)
385-
# define NO_CALLER_SAVED_REGISTERS __attribute__((no_caller_saved_registers))
386-
# ifndef __clang__
387-
# pragma GCC push_options
388-
# pragma GCC target ("general-regs-only")
389-
# define POP_OPTIONS
390-
# endif
385+
#if __has_attribute(noipa)
386+
# define NOIPA __attribute__((noipa))
391387
#else
392-
# define NO_CALLER_SAVED_REGISTERS
388+
# define NOIPA
393389
#endif
394390

395-
ZEND_API bool ZEND_FASTCALL NO_CALLER_SAVED_REGISTERS I_REPLACE_SONAME_FNNAME_ZU(NONE,zend_string_equal_val)(const zend_string *s1, const zend_string *s2)
391+
ZEND_API bool ZEND_FASTCALL I_REPLACE_SONAME_FNNAME_ZU(NONE,zend_string_equal_val)(const zend_string *s1, const zend_string *s2)
396392
{
397393
return !memcmp(ZSTR_VAL(s1), ZSTR_VAL(s2), ZSTR_LEN(s1));
398394
}
399-
400-
#ifdef POP_OPTIONS
401-
# pragma GCC pop_options
402-
# undef POP_OPTIONS
403395
#endif
404396

405397
#if defined(__GNUC__) && defined(__i386__)
406-
ZEND_API bool ZEND_FASTCALL zend_string_equal_val(const zend_string *s1, const zend_string *s2)
398+
ZEND_API zend_never_inline NOIPA bool ZEND_FASTCALL zend_string_equal_val(const zend_string *s1, const zend_string *s2)
407399
{
408400
const char *ptr = ZSTR_VAL(s1);
409401
size_t delta = (const char*)s2 - (const char*)s1;
@@ -441,7 +433,7 @@ ZEND_API bool ZEND_FASTCALL zend_string_equal_val(const zend_string *s1, const z
441433
}
442434

443435
#elif defined(__GNUC__) && defined(__x86_64__) && !defined(__ILP32__)
444-
ZEND_API bool ZEND_FASTCALL zend_string_equal_val(const zend_string *s1, const zend_string *s2)
436+
ZEND_API zend_never_inline NOIPA bool ZEND_FASTCALL zend_string_equal_val(const zend_string *s1, const zend_string *s2)
445437
{
446438
const char *ptr = ZSTR_VAL(s1);
447439
size_t delta = (const char*)s2 - (const char*)s1;

0 commit comments

Comments
 (0)