johannes Tue, 09 Feb 2010 22:29:10 +0000 Revision: http://svn.php.net/viewvc?view=revision&revision=294827
Log: merge 294825: Detect if we can rely on compiler-specific alignment features else use custom workarounds. Fixes #50753 (johannes) Bug: http://bugs.php.net/50753 (Closed) crypt_sha256.c / crypt_sha512.c - Gnu specific code, non-Gnu compiler Changed paths: _U php/php-src/branches/PHP_5_3_2/ U php/php-src/branches/PHP_5_3_2/ext/standard/config.m4 U php/php-src/branches/PHP_5_3_2/ext/standard/crypt_sha256.c U php/php-src/branches/PHP_5_3_2/ext/standard/crypt_sha512.c _U php/php-src/branches/PHP_5_3_2/ext/tidy/tests/ _U php/php-src/branches/PHP_5_3_2/tests/security/open_basedir_parse_ini_file.phpt
Property changes on: php/php-src/branches/PHP_5_3_2 ___________________________________________________________________ Modified: svn:mergeinfo - /php/php-src/branches/PHP_5_3:292504,292574,292594-292595,292611,292624,292630,292632-292635,292654,292677,292682-292683,292693,292716,292719,292762,292765,292771,292777,292823,293051,293075,293114,293126,293131,293144,293146,293152,293175-293176,293180,293216,293235,293253,293268,293341,293380,293400,293442,293447,293466,293487,293502,293538,293548,293558,293588,293590,293597,293627,293644,293653,293655,293699,293726-293728,293732,293735,293762,293768,293804,293815-293816,293862,293894,293896-293897,293901-293906,293917-293918,293965-293966,293974,293976-293977,293985,293998,294040,294053,294075,294077-294078,294081,294089,294094,294100,294102,294104,294126-294127,294129,294164,294251-294253,294255,294259-294261,294265,294267,294269,294272,294278,294285,294302-294304,294307-294308,294310,294312-294313,294315,294317,294320-294323,294333-294336,294353,294418,294421,294487,294498,294532,294571,294695,294697,294724,294814,294816 /php/php-src/trunk:284726 + /php/php-src/branches/PHP_5_3:292504,292574,292594-292595,292611,292624,292630,292632-292635,292654,292677,292682-292683,292693,292716,292719,292762,292765,292771,292777,292823,293051,293075,293114,293126,293131,293144,293146,293152,293175-293176,293180,293216,293235,293253,293268,293341,293380,293400,293442,293447,293466,293487,293502,293538,293548,293558,293588,293590,293597,293627,293644,293653,293655,293699,293726-293728,293732,293735,293762,293768,293804,293815-293816,293862,293894,293896-293897,293901-293906,293917-293918,293965-293966,293974,293976-293977,293985,293998,294040,294053,294075,294077-294078,294081,294089,294094,294100,294102,294104,294126-294127,294129,294164,294251-294253,294255,294259-294261,294265,294267,294269,294272,294278,294285,294302-294304,294307-294308,294310,294312-294313,294315,294317,294320-294323,294333-294336,294353,294418,294421,294487,294498,294532,294571,294695,294697,294724,294814,294816,294825 /php/php-src/trunk:284726 Modified: php/php-src/branches/PHP_5_3_2/ext/standard/config.m4 =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/standard/config.m4 2010-02-09 22:06:31 UTC (rev 294826) +++ php/php-src/branches/PHP_5_3_2/ext/standard/config.m4 2010-02-09 22:29:10 UTC (rev 294827) @@ -235,6 +235,41 @@ dnl If one of them is missing, use our own implementation, portable code is then possible dnl if test "$ac_cv_crypt_blowfish" = "no" || test "$ac_cv_crypt_des" = "no" || test "$ac_cv_crypt_ext_des" = "no" || test "x$php_crypt_r" = "x0"; then + + dnl + dnl Check for __alignof__ support in the compiler + dnl + AC_CACHE_CHECK(whether the compiler supports __alignof__,ac_cv_alignof_exists,[ + AC_TRY_COMPILE([ +int main() { + int align = __alignof__(int); + return 0; +} + ],[ + ac_cv_alignof_exists=yes + ],[ + ac_cv_alignof_exists=no + ])]) + if test "$ac_cv_alignof_exists" = "yes"; then + AC_DEFINE([HAVE_ALIGNOF], 1, [whether the compiler supports __alignof__]) + fi + + dnl + dnl Check for __attribute__ ((__aligned__)) support in the compiler + dnl + AC_CACHE_CHECK(whether the compiler supports aligned attribute,ac_cv_attribute_aligned,[ + AC_TRY_COMPILE([ + unsigned char test[32] __attribute__ ((__aligned__ (__alignof__ (int)))); + ],[ + ac_cv_attribute_aligned=yes + ],[ + ac_cv_attribute_aligned=no + ])]) + if test "$ac_cv_attribute_aligned" = "yes"; then + AC_DEFINE([HAVE_ATTRIBUTE_ALIGNED], 1, [wheter the compiler supports __attribute__ ((__aligned__))]) + fi + + AC_DEFINE_UNQUOTED(PHP_USE_PHP_CRYPT_R, 1, [Whether PHP has to use its own crypt_r for blowfish, des, ext des and md5]) AC_DEFINE_UNQUOTED(PHP_STD_DES_CRYPT, 1, [Whether the system supports standard DES salt]) AC_DEFINE_UNQUOTED(PHP_BLOWFISH_CRYPT, 1, [Whether the system supports BlowFish salt]) Modified: php/php-src/branches/PHP_5_3_2/ext/standard/crypt_sha256.c =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/standard/crypt_sha256.c 2010-02-09 22:06:31 UTC (rev 294826) +++ php/php-src/branches/PHP_5_3_2/ext/standard/crypt_sha256.c 2010-02-09 22:29:10 UTC (rev 294827) @@ -19,7 +19,15 @@ # elif HAVE_STDINT_H # include <stdint.h> # endif -# include <stdbool.h> +# ifndef HAVE_ALIGNOF +# include <stddef.h> +# define __alignof__(type) offsetof (struct { char c; type member;}, member) +# endif +# if HAVE_ATTRIBUTE_ALIGNED +# define ALIGNED(size) __attribute__ ((__aligned__ (size))) +# else +# define ALIGNED(size) +# endif #endif #include <stdio.h> @@ -344,10 +352,8 @@ __declspec(align(32)) unsigned char temp_result[32]; # endif #else - unsigned char alt_result[32] - __attribute__ ((__aligned__ (__alignof__ (uint32_t)))); - unsigned char temp_result[32] - __attribute__ ((__aligned__ (__alignof__ (uint32_t)))); + unsigned char alt_result[32] ALIGNED(__alignof__ (uint32_t)); + unsigned char temp_result[32] ALIGNED(__alignof__ (uint32_t)); #endif struct sha256_ctx ctx; Modified: php/php-src/branches/PHP_5_3_2/ext/standard/crypt_sha512.c =================================================================== --- php/php-src/branches/PHP_5_3_2/ext/standard/crypt_sha512.c 2010-02-09 22:06:31 UTC (rev 294826) +++ php/php-src/branches/PHP_5_3_2/ext/standard/crypt_sha512.c 2010-02-09 22:29:10 UTC (rev 294827) @@ -18,7 +18,15 @@ # elif HAVE_STDINT_H # include <stdint.h> # endif -# include <stdbool.h> +# ifndef HAVE_ALIGNOF +# include <stddef.h> +# define __alignof__(type) offsetof (struct { char c; type member;}, member) +# endif +# if HAVE_ATTRIBUTE_ALIGNED +# define ALIGNED(size) __attribute__ ((__aligned__ (size))) +# else +# define ALIGNED(size) +# endif #endif #include <stdio.h> @@ -372,10 +380,8 @@ __declspec(align(64)) unsigned char temp_result[64]; # endif #else - unsigned char alt_result[64] - __attribute__ ((__aligned__ (__alignof__ (uint64_t)))); - unsigned char temp_result[64] - __attribute__ ((__aligned__ (__alignof__ (uint64_t)))); + unsigned char alt_result[64] ALIGNED(__alignof__ (uint64_t)); + unsigned char temp_result[64] ALIGNED(__alignof__ (uint64_t)); #endif struct sha512_ctx ctx; struct sha512_ctx alt_ctx; Property changes on: php/php-src/branches/PHP_5_3_2/ext/tidy/tests ___________________________________________________________________ Modified: svn:mergeinfo - /php/php-src/branches/PHP_5_3/ext/tidy/tests:292562,292566,292571,292574,292635,292716,292719,292765,293146,293152,293175-293176,293180,293216,293235,293253,293380,293400,293442,293447,293466,293487,293502,293538,293548,293558,293588,293590,293597,293627,293644,293653,293655,293699,293726-293728,293732,293735,293762,293768,293804,293815-293816,293862,293894,293896-293897,293901-293906,293917-293918,293965-293966,293976-293977,293985,293998,294040,294053,294075,294077-294078,294081,294089,294094,294100,294102,294104,294126-294127,294129,294164,294251-294253,294255,294259-294261,294265,294267,294269,294272,294278,294285,294302-294304,294307-294308,294310,294312-294313,294315,294317,294320-294323,294333-294336,294353,294418,294421,294487,294498,294532,294571,294695,294697,294724,294814,294816 /php/php-src/trunk/ext/tidy/tests:29815-29816,284726,287798-287941 + /php/php-src/branches/PHP_5_3/ext/tidy/tests:292562,292566,292571,292574,292635,292716,292719,292765,293146,293152,293175-293176,293180,293216,293235,293253,293380,293400,293442,293447,293466,293487,293502,293538,293548,293558,293588,293590,293597,293627,293644,293653,293655,293699,293726-293728,293732,293735,293762,293768,293804,293815-293816,293862,293894,293896-293897,293901-293906,293917-293918,293965-293966,293976-293977,293985,293998,294040,294053,294075,294077-294078,294081,294089,294094,294100,294102,294104,294126-294127,294129,294164,294251-294253,294255,294259-294261,294265,294267,294269,294272,294278,294285,294302-294304,294307-294308,294310,294312-294313,294315,294317,294320-294323,294333-294336,294353,294418,294421,294487,294498,294532,294571,294695,294697,294724,294814,294816,294825 /php/php-src/trunk/ext/tidy/tests:29815-29816,284726,287798-287941 Property changes on: php/php-src/branches/PHP_5_3_2/tests/security/open_basedir_parse_ini_file.phpt ___________________________________________________________________ Modified: svn:mergeinfo - /php/php-src/branches/PHP_5_3/tests/security/open_basedir_parse_ini_file.phpt:292562,292566,292571,292574,292716,293146,293152,293175-293176,293180,293216,293235,293253,293380,293400,293442,293447,293466,293487,293502,293538,293548,293558,293588,293590,293597,293627,293644,293653,293655,293699,293726-293728,293732,293735,293762,293768,293804,293815-293816,293862,293894,293896-293897,293901-293906,293917-293918,293965-293966,293976-293977,293985,293998,294040,294053,294075,294077-294078,294081,294089,294094,294100,294102,294104,294126-294127,294129,294164,294251-294253,294255,294259-294261,294265,294267,294269,294272,294278,294285,294302-294304,294307-294308,294310,294312-294313,294315,294317,294320-294323,294333-294336,294353,294418,294421,294487,294498,294532,294571,294695,294697,294724,294814,294816 /php/php-src/trunk/tests/security/open_basedir_parse_ini_file.phpt:29815-29816,265951 + /php/php-src/branches/PHP_5_3/tests/security/open_basedir_parse_ini_file.phpt:292562,292566,292571,292574,292716,293146,293152,293175-293176,293180,293216,293235,293253,293380,293400,293442,293447,293466,293487,293502,293538,293548,293558,293588,293590,293597,293627,293644,293653,293655,293699,293726-293728,293732,293735,293762,293768,293804,293815-293816,293862,293894,293896-293897,293901-293906,293917-293918,293965-293966,293976-293977,293985,293998,294040,294053,294075,294077-294078,294081,294089,294094,294100,294102,294104,294126-294127,294129,294164,294251-294253,294255,294259-294261,294265,294267,294269,294272,294278,294285,294302-294304,294307-294308,294310,294312-294313,294315,294317,294320-294323,294333-294336,294353,294418,294421,294487,294498,294532,294571,294695,294697,294724,294814,294816,294825 /php/php-src/trunk/tests/security/open_basedir_parse_ini_file.phpt:29815-29816,265951
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php