depends: Greatly simplify the Clang 12 patch
We can avoid the "%s" optimization with "%s%s" :D Co-authored-by: Daira Hopwood <daira@jacaranda.org>
This commit is contained in:
parent
5bb339824d
commit
bdaf3e1ab2
|
@ -1,25 +1,17 @@
|
|||
diff -ur db-6.2.23-orig/src/blob/blob_util.c db-6.2.23/src/blob/blob_util.c
|
||||
--- db-6.2.23-orig/src/blob/blob_util.c 2016-03-28 20:45:53.000000000 +0100
|
||||
+++ db-6.2.23/src/blob/blob_util.c 2021-07-30 18:07:29.942811600 +0100
|
||||
@@ -544,7 +544,20 @@
|
||||
+++ db-6.2.23/src/blob/blob_util.c 2021-07-30 19:52:37.082811600 +0100
|
||||
@@ -544,7 +544,12 @@
|
||||
goto err;
|
||||
|
||||
memset(path, 0, len);
|
||||
- name_len += sprintf(path, "%s", blob_sub_dir);
|
||||
+ // name_len += sprintf(path, "%s", blob_sub_dir);
|
||||
+ {
|
||||
+ // Clang 12 introduced an "libcall optimization" that lowers the above
|
||||
+ // to stpcpy to avoid the machinery involved in parsing format strings.
|
||||
+ // This causes build problems when cross-compiling to Windows with the
|
||||
+ // version of mingw-w64 that Zcash supports. We haven't figured out why
|
||||
+ // but in the meantime we replace this with an inlined stpcpy impl from
|
||||
+ // https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/commit/?id=5934637641c863cc2c1765a0d01c5b6f53ecc4fc
|
||||
+ char *dest = path;
|
||||
+ const char *src = blob_sub_dir;
|
||||
+ while ((*dest++ = *src++) != '\0')
|
||||
+ /* nothing */;
|
||||
+ name_len += (--dest - path);
|
||||
+ }
|
||||
+ // but in the meantime using "%s%s" inhibits the optimization.
|
||||
+ name_len += sprintf(path, "%s%s", blob_sub_dir, "");
|
||||
|
||||
__blob_calculate_dirs(blob_id, path, &name_len, &depth);
|
||||
|
||||
|
|
Loading…
Reference in New Issue