l...@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@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’.