GNU bug report logs -
#30820
Chunked store references in compiled code break grafting (again)
Previous Next
Reported by: ludo <at> gnu.org (Ludovic Courtès)
Date: Wed, 14 Mar 2018 15:48:01 UTC
Severity: serious
Merged with 30395
Done: ludo <at> gnu.org (Ludovic Courtès)
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
ludo <at> gnu.org (Ludovic Courtès) skribis:
> void foo (char *x, char *y)
> {
> /* MEMCPY (x, str, sizeof str); */
> MEMCPY (y, "this is a literal /gnu/store string", 35);
> }
This was not a correct example because “/gnu/store” must be followed by
at least 34 chars for the patch to work. And indeed, it does work in
this case:
--8<---------------cut here---------------start------------->8---
$ cat strmov.c
#define _GNU_SOURCE
#include <string.h>
static const char str[] = "MEMpCPY /gnu/store/THIS IS A LONG STRING, A VERY, VERY, VERY LOOOOONG STRING";
extern char *p, *q;
#ifndef MEMCPY
# define MEMCPY memcpy
#endif
void foo (char *x, char *y)
{
/* MEMCPY (x, str, sizeof str); */
MEMCPY (y, "this is a literal /gnu/store/eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee string", 35);
}
$ guix environment --ad-hoc gcc-toolchain <at> 5 -C -- gcc -O2 -c strmov.c
$ objdump -S strmov.o |grep movabs
--8<---------------cut here---------------end--------------->8---
So the real issue is this:
> The second issue is that the patch only ever worked with literal
> strings. It does not “see” strings in constant arrays like the ‘str’
> array in the example above.
Ludo’.
This bug report was last modified 7 years and 120 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.