This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH]: Use RAX_LP/RDX_LP on SAVE_PTR in sysdeps/x86_64/strtok.S
- From: Roland McGrath <roland at hack dot frob dot com>
- To: "H.J. Lu" <hjl dot tools at gmail dot com>
- Cc: GNU C Library <libc-alpha at sourceware dot org>
- Date: Wed, 13 Jun 2012 11:21:26 -0700 (PDT)
- Subject: Re: [PATCH]: Use RAX_LP/RDX_LP on SAVE_PTR in sysdeps/x86_64/strtok.S
- References: <20120613173953.GA17018@intel.com><20120613175258.GA11514@intel.com>
> > I need to use -O1 on tst-strtok_r.c. Otherwise, it won't fail with
> > broken strtok.S.
Can you explain why?
> +CFLAGS-tst-strtok_r.c = -O1 -fno-inline -fno-builtin
This needs a comment about why these flags matter (other than -fno-builtin).
I suspect this would be done better using -D__NO_STRING_INLINES if that's
the true issue.
> --- /dev/null
> +++ b/string/tst-strtok_r.c
> @@ -0,0 +1,11 @@
> +#include <stdlib.h>
> +#include <string.h>
Give it a copyright header.
> +int main()
Use test-skeleton.c.
> +{
> + char line[] = "udf 75868 1 - Live 0xffffffffa0bfb000\n";
Use const.
> + char *saveptr, *tok = strtok_r(line, " \t", &saveptr);
Space before paren.
> + if (strcmp (tok, "udf") != 0)
> + abort ();
> + return 0;
No need for abort. A failing test can just exit nonzero.
> @@ -79,13 +79,12 @@ ENTRY (BP_SYM (FUNCTION))
>
> #ifdef USE_AS_STRTOK_R
> /* The value is stored in the third argument. */
> - movq %rdx, %rax
> movq %rdx, %r9 /* Save value - see def. of SAVE_PTR. */
Might as well make SAVE_PTR %R9_LP and use 'mov %RDX_LP, SAVE_PTR' here.
Thanks,
Roland