From bf3d06aaf43f2ffb6919a7c464f39a2d65c45b42 Mon Sep 17 00:00:00 2001 From: Jim Cromie Date: Thu, 20 Nov 2014 14:45:02 -0700 Subject: pp.c: dont work around glibc 2.2.5 _moddi3 bugs past 2.7 Add glibc version checks to avoid runtime workarounds for an ancient bug. p1- 224ec32361 in 2003 added a per-op one-time test to detect the bug, and patch around it in op_ppaddr. p2- befad5d118 in 2007 limited the workaround to GLIBC and IVSIZE == 8 p3- a5bd31f4dc in 2012 suppressed it for defined(PERL_DEBUG_READONLY_OPS) https://bugzilla.redhat.com/show_bug.cgi?id=65612 describes the test implemented in [p1] Per wikipedia: v2.2.5 isnt dated, but 2.2.4 is 7/2001. redhat fixed theirs in 9/2002 v2.3 is 10/2002, and likely never had the bug released. v2.3.2 in debian sarge, 2.3.4 in RHEL4 So picking v2.7 (10/2007) as last version pessimized is still quite conservative, but also already 7 years old, 2x++ our perlpolicy support window. Its unlikely that such a platform would be seeing an install of v5.22 or later. --- pp.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pp.c b/pp.c index e51d9072c2..3ec401d8b2 100644 --- a/pp.c +++ b/pp.c @@ -2453,7 +2453,8 @@ PP(pp_i_divide) } } -#if defined(__GLIBC__) && IVSIZE == 8 && !defined(PERL_DEBUG_READONLY_OPS) +#if defined(__GLIBC__) && IVSIZE == 8 && !defined(PERL_DEBUG_READONLY_OPS) \ + && ( __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 8)) STATIC PP(pp_i_modulo_0) #else @@ -2476,7 +2477,8 @@ PP(pp_i_modulo) } } -#if defined(__GLIBC__) && IVSIZE == 8 && !defined(PERL_DEBUG_READONLY_OPS) +#if defined(__GLIBC__) && IVSIZE == 8 && !defined(PERL_DEBUG_READONLY_OPS) \ + && ( __GLIBC__ < 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ < 8)) STATIC PP(pp_i_modulo_1) @@ -2512,7 +2514,7 @@ PP(pp_i_modulo) PL_ppaddr[OP_I_MODULO] = Perl_pp_i_modulo_0; /* .. but if we have glibc, we might have a buggy _moddi3 - * (at least glicb 2.2.5 is known to have this bug), in other + * (at least glibc 2.2.5 is known to have this bug), in other * words our integer modulus with negative quad as the second * argument might be broken. Test for this and re-patch the * opcode dispatch table if that is the case, remembering to -- cgit v1.2.1