diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-04-30 01:13:01 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-04-30 01:13:01 +0000 |
commit | 86216d9dd123510eae51c9631c8751fdc865cdd7 (patch) | |
tree | 7695611490e6d3f3c607bd67d24ae7e5fc4d7d11 | |
parent | 987291bd16032c4adfe97894abab6abd1c71c5f4 (diff) | |
parent | c3d97aa4219e73aaaad86ce6a8c2f69600871bc6 (diff) | |
download | pcre-android11-tests-release.tar.gz |
Snap for 6445537 from c3d97aa4219e73aaaad86ce6a8c2f69600871bc6 to rvc-releaseandroid-vts-11.0_r9android-vts-11.0_r8android-vts-11.0_r7android-vts-11.0_r6android-vts-11.0_r5android-vts-11.0_r4android-vts-11.0_r3android-vts-11.0_r2android-vts-11.0_r16android-vts-11.0_r15android-vts-11.0_r14android-vts-11.0_r13android-vts-11.0_r12android-vts-11.0_r11android-vts-11.0_r10android-vts-11.0_r1android-security-11.0.0_r76android-security-11.0.0_r75android-security-11.0.0_r74android-security-11.0.0_r73android-security-11.0.0_r72android-security-11.0.0_r71android-security-11.0.0_r70android-security-11.0.0_r69android-security-11.0.0_r68android-security-11.0.0_r67android-security-11.0.0_r66android-security-11.0.0_r65android-security-11.0.0_r64android-security-11.0.0_r63android-security-11.0.0_r62android-security-11.0.0_r61android-security-11.0.0_r60android-security-11.0.0_r59android-security-11.0.0_r58android-security-11.0.0_r57android-security-11.0.0_r56android-security-11.0.0_r55android-security-11.0.0_r54android-security-11.0.0_r53android-security-11.0.0_r52android-security-11.0.0_r51android-security-11.0.0_r50android-security-11.0.0_r49android-security-11.0.0_r1android-platform-11.0.0_r2android-platform-11.0.0_r1android-cts-11.0_r9android-cts-11.0_r8android-cts-11.0_r7android-cts-11.0_r6android-cts-11.0_r5android-cts-11.0_r4android-cts-11.0_r3android-cts-11.0_r2android-cts-11.0_r16android-cts-11.0_r15android-cts-11.0_r14android-cts-11.0_r13android-cts-11.0_r12android-cts-11.0_r11android-cts-11.0_r10android-cts-11.0_r1android-11.0.0_r6android-11.0.0_r5android-11.0.0_r4android-11.0.0_r3android-11.0.0_r25android-11.0.0_r2android-11.0.0_r17android-11.0.0_r1android11-tests-releaseandroid11-security-releaseandroid11-s1-releaseandroid11-release
Change-Id: Ie3930108595b4fd7ccc6301feded4fb8d1807244
-rw-r--r-- | Android.bp | 4 | ||||
-rw-r--r-- | dist2/CMakeLists.txt | 11 | ||||
-rw-r--r-- | dist2/config-cmake.h.in | 1 | ||||
-rw-r--r-- | dist2/configure.ac | 18 | ||||
-rw-r--r-- | dist2/src/config.h.in | 3 | ||||
-rw-r--r-- | dist2/src/pcre2_internal.h | 11 | ||||
-rw-r--r-- | dist2/src/pcre2_match.c | 3 | ||||
-rw-r--r-- | include_internal/config.h | 3 |
8 files changed, 48 insertions, 6 deletions
@@ -38,10 +38,6 @@ cc_defaults { "-DHAVE_CONFIG_H", "-Wall", "-Werror", - // TODO(http://b/153760240): Remove this once we have - // patched sources to leave a large stack array uninitialized - // (stack_frames_vector from pcre2_match.c). - "-ftrivial-auto-var-init=uninitialized", ], tidy_checks: [ "-google-build-using-namespace", diff --git a/dist2/CMakeLists.txt b/dist2/CMakeLists.txt index 4737687b..a7ef67e1 100644 --- a/dist2/CMakeLists.txt +++ b/dist2/CMakeLists.txt @@ -107,8 +107,9 @@ FIND_PACKAGE( Editline ) # Configuration checks -INCLUDE(CheckIncludeFile) +INCLUDE(CheckCSourceCompiles) INCLUDE(CheckFunctionExists) +INCLUDE(CheckIncludeFile) INCLUDE(CheckTypeSize) CHECK_INCLUDE_FILE(dirent.h HAVE_DIRENT_H) @@ -123,6 +124,14 @@ CHECK_FUNCTION_EXISTS(bcopy HAVE_BCOPY) CHECK_FUNCTION_EXISTS(memmove HAVE_MEMMOVE) CHECK_FUNCTION_EXISTS(strerror HAVE_STRERROR) +set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS}) +set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -Werror") +CHECK_C_SOURCE_COMPILES( + "int main() { char buf[128] __attribute__((uninitialized)); (void)buf; return 0; }" + HAVE_ATTRIBUTE_UNINITIALIZED +) +set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS}) + # User-configurable options # # Note: CMakeSetup displays these in alphabetical order, regardless of diff --git a/dist2/config-cmake.h.in b/dist2/config-cmake.h.in index 529b0093..44d51ae8 100644 --- a/dist2/config-cmake.h.in +++ b/dist2/config-cmake.h.in @@ -1,5 +1,6 @@ /* config.h for CMake builds */ +#cmakedefine HAVE_ATTRIBUTE_UNINITIALIZED 1 #cmakedefine HAVE_DIRENT_H 1 #cmakedefine HAVE_INTTYPES_H 1 #cmakedefine HAVE_STDINT_H 1 diff --git a/dist2/configure.ac b/dist2/configure.ac index 93c2b531..f3086f18 100644 --- a/dist2/configure.ac +++ b/dist2/configure.ac @@ -72,6 +72,24 @@ AC_PROG_LN_S PCRE2_VISIBILITY +# Check for Clang __attribute__((uninitialized)) feature + +AC_MSG_CHECKING([for __attribute__((uninitialized))]) +AC_LANG_PUSH([C]) +tmp_CFLAGS=$CFLAGS +CFLAGS="$CFLAGS -Werror" +AC_COMPILE_IFELSE([AC_LANG_PROGRAM(, + [[char buf[128] __attribute__((uninitialized));(void)buf]])], + [pcre2_cc_cv_attribute_uninitialized=yes], + [pcre2_cc_cv_attribute_uninitialized=no]) +AC_MSG_RESULT([$pcre2_cc_cv_attribute_uninitialized]) +if test "$pcre2_cc_cv_attribute_uninitialized" = yes; then + AC_DEFINE([HAVE_ATTRIBUTE_UNINITIALIZED], 1, [Define this if your compiler + supports __attribute__((uninitialized))]) +fi +CFLAGS=$tmp_CFLAGS +AC_LANG_POP([C]) + # Versioning PCRE2_MAJOR="pcre2_major" diff --git a/dist2/src/config.h.in b/dist2/src/config.h.in index 6b8eb7e9..5406da0a 100644 --- a/dist2/src/config.h.in +++ b/dist2/src/config.h.in @@ -52,6 +52,9 @@ sure both macros are undefined; an emulation function will then be used. */ LF does in an ASCII/Unicode environment. */ #undef EBCDIC_NL25 +/* Define this if your compiler supports __attribute__((uninitialized)) */ +#undef HAVE_ATTRIBUTE_UNINITIALIZED + /* Define to 1 if you have the `bcopy' function. */ #undef HAVE_BCOPY diff --git a/dist2/src/pcre2_internal.h b/dist2/src/pcre2_internal.h index 814d91bd..aa7ce887 100644 --- a/dist2/src/pcre2_internal.h +++ b/dist2/src/pcre2_internal.h @@ -76,6 +76,17 @@ typedef int BOOL; #include <valgrind/memcheck.h> #endif +/* -ftrivial-auto-var-init support supports initializing all local variables +to avoid some classes of bug, but this can cause an unacceptable slowdown +for large on-stack arrays in hot functions. This macro lets us annotate +such arrays. */ + +#ifdef HAVE_ATTRIBUTE_UNINITIALIZED +#define PCRE2_KEEP_UNINITIALIZED __attribute__((uninitialized)) +#else +#define PCRE2_KEEP_UNINITIALIZED +#endif + /* Older versions of MSVC lack snprintf(). This define allows for warning/error-free compilation and testing with MSVC compilers back to at least MSVC 10/2010. Except for VC6 (which is missing some fundamentals and fails). */ diff --git a/dist2/src/pcre2_match.c b/dist2/src/pcre2_match.c index 419561fd..e5cf2c42 100644 --- a/dist2/src/pcre2_match.c +++ b/dist2/src/pcre2_match.c @@ -6048,7 +6048,8 @@ proves to be too small, it is replaced by a larger one on the heap. To get a vector of the size required that is aligned for pointers, allocate it as a vector of pointers. */ -PCRE2_SPTR stack_frames_vector[START_FRAMES_SIZE/sizeof(PCRE2_SPTR)]; +PCRE2_SPTR stack_frames_vector[START_FRAMES_SIZE/sizeof(PCRE2_SPTR)] + PCRE2_KEEP_UNINITIALIZED; mb->stack_frames = (heapframe *)stack_frames_vector; /* A length equal to PCRE2_ZERO_TERMINATED implies a zero-terminated diff --git a/include_internal/config.h b/include_internal/config.h index a699a139..10c77e5c 100644 --- a/include_internal/config.h +++ b/include_internal/config.h @@ -53,6 +53,9 @@ sure both macros are undefined; an emulation function will then be used. */ LF does in an ASCII/Unicode environment. */ /* #undef EBCDIC_NL25 */ +/* Define this if your compiler supports __attribute__((uninitialized)) */ +#define HAVE_ATTRIBUTE_UNINITIALIZED 1 + /* Define to 1 if you have the `bcopy' function. */ #define HAVE_BCOPY 1 |