This is the mail archive of the
mailing list for the glibc project.
Re: Potential issue with strstr on x86 with sse4.2 in glibc-2.18
- From: Rich Felker <dalias at aerifal dot cx>
- To: Allan McRae <allan at archlinux dot org>
- Cc: Andreas Schwab <schwab at suse dot de>, Alexander Monakov <amonakov at ispras dot ru>, libc-alpha at sourceware dot org
- Date: Tue, 20 Aug 2013 04:04:32 -0400
- Subject: Re: Potential issue with strstr on x86 with sse4.2 in glibc-2.18
- References: <alpine dot LNX dot 2 dot 00 dot 1308191628370 dot 2626 at monopod dot intra dot ispras dot ru> <20130819144648 dot GF20515 at brightrain dot aerifal dot cx> <alpine dot LNX dot 2 dot 00 dot 1308191924490 dot 2626 at monopod dot intra dot ispras dot ru> <5212A278 dot 3090909 at archlinux dot org> <20130819230644 dot GM20515 at brightrain dot aerifal dot cx> <5212E278 dot 4030703 at archlinux dot org> <20130820033430 dot GN20515 at brightrain dot aerifal dot cx> <20130820043956 dot GO20515 at brightrain dot aerifal dot cx> <mvm1u5oon01 dot fsf at hawking dot suse dot de> <52131F2D dot 4030706 at archlinux dot org>
On Tue, Aug 20, 2013 at 05:47:57PM +1000, Allan McRae wrote:
> On 20/08/13 17:11, Andreas Schwab wrote:
> > Rich Felker <firstname.lastname@example.org> writes:
> >> What may be viable is globally using -mpreferred-stack-boundary=2
> > Please take a look at sysdeps/i386/Makefile.
> So is a viable solution to add:
> sysdep-CFLAGS += -mpreferred-stack-boundary=4
> to in the string directory section of sysdeps/i386/i686/multiarch/Makefile?
No, -mpreferred-stack-boundary=4 is really a near-nop. All it does is
cause GCC to generate code that _preserves_ the value of esp%16 across
calls. So if esp%16 was 0 when your function was called, it will be 0
at calls you make. But if esp%16 was 4 when your function was called,
it will be 4 at calls you make. In order to get gcc to re-align, you
need to also use -mincoming-stack-boundary=2.