diff options
author | Liubov Dmitrieva <liubov.dmitrieva@intel.com> | 2012-12-14 18:41:37 +0400 |
---|---|---|
committer | Liubov Dmitrieva <ldmitrie@sourceware.org> | 2013-10-23 19:07:35 +0400 |
commit | 304c5527fb95a038cb115dce3a16dde4a68c99f4 (patch) | |
tree | 300dd5e1010f74b1776d6151f4eff603fc3f7031 | |
parent | cc433f63434c62a737f553a59eee5dfd359ef740 (diff) | |
download | glibc-304c5527fb95a038cb115dce3a16dde4a68c99f4.tar.gz glibc-304c5527fb95a038cb115dce3a16dde4a68c99f4.tar.xz glibc-304c5527fb95a038cb115dce3a16dde4a68c99f4.zip |
Inappropriate code style for Intel MPX in debug/strcpy_chk.c Use different version if MPX enabled.
-rw-r--r-- | debug/strcpy_chk.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/debug/strcpy_chk.c b/debug/strcpy_chk.c index 81bf46f992..ba6da70190 100644 --- a/debug/strcpy_chk.c +++ b/debug/strcpy_chk.c @@ -27,6 +27,7 @@ __strcpy_chk (dest, src, destlen) char *dest; const char *src; size_t destlen; +#ifndef __CHKP__ { char c; char *s = (char *) src; @@ -65,3 +66,45 @@ __strcpy_chk (dest, src, destlen) return dest; } +#else +{ + char c; + char *s = (char *) src; + char *d = (char *) dest; + + while (__builtin_expect (destlen >= 4, 0)) + { + c = s[0]; + d[0] = c; + if (c == '\0') + return dest; + c = s[1]; + d[1] = c; + if (c == '\0') + return dest; + c = s[2]; + d[2] = c; + if (c == '\0') + return dest; + c = s[3]; + d[3] = c; + if (c == '\0') + return dest; + destlen -= 4; + d += 4; + s += 4; + } + + do + { + if (__builtin_expect (destlen-- == 0, 0)) + __chk_fail (); + c = *s; + *(d++) = c; + s++; + } + while (c != '\0'); + + return dest; +} +#endif |