[PATCH]: Use RAX_LP/RDX_LP on SAVE_PTR in sysdeps/x86_64/strtok.S
Roland McGrath
roland@hack.frob.com
Wed Jun 13 18:21:00 GMT 2012
> > 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
More information about the Libc-alpha
mailing list