(morty) gcc: fix ubsan empty string check

Submitted by Anton Novikov on June 21, 2017, 8:09 a.m. | Patch ID: 141145

Details

Message ID 0e3ce726-1eb7-e456-8270-84fb866a423b@yadro.com
State New
Headers show

Commit Message

Anton Novikov June 21, 2017, 8:09 a.m.
Thanks,

Anton

Patch hide | download patch | download mbox

From 10d86dd98109c66814229c18dc199d08fa49145c Mon Sep 17 00:00:00 2001
From: Anton Novikov <a.novikov@yadro.com>
Date: Tue, 20 Jun 2017 15:42:34 +0300
Subject: [PATCH 1/3] fix GCC build

GCC 6.2 build with recent GCC was failing (for example, on my Arch system).
Patch fixing it was added from GCC upstream commit. Part of it adding noise to
ChangeLog was skipped, as it wasn't applying for some reason.

https://gnu.googlesource.com/gcc/+/c0c52589c6a7265e8fc6b77706a83d22aa1ef0ce

Signed-off-by: Anton Novikov <a.novikov@yadro.com>
---
 meta/recipes-devtools/gcc/gcc-6.2.inc              |  1 +
 .../0049-ubsan-empty-string-check-fix.patch        | 25 ++++++++++++++++++++++
 2 files changed, 26 insertions(+)
 create mode 100644 meta/recipes-devtools/gcc/gcc-6.2/0049-ubsan-empty-string-check-fix.patch

diff --git a/meta/recipes-devtools/gcc/gcc-6.2.inc b/meta/recipes-devtools/gcc/gcc-6.2.inc
index b118995e1d..97ee7bfbc5 100644
--- a/meta/recipes-devtools/gcc/gcc-6.2.inc
+++ b/meta/recipes-devtools/gcc/gcc-6.2.inc
@@ -78,6 +78,7 @@  SRC_URI = "\
            file://0045-libgcc-Add-knob-to-use-ldbl-128-on-ppc.patch \
            file://0046-Link-libgcc-using-LDFLAGS-not-just-SHLIB_LDFLAGS.patch \
            file://0047-libgcc_s-Use-alias-for-__cpu_indicator_init-instead-.patch \
+           file://0049-ubsan-empty-string-check-fix.patch \
            ${BACKPORTS} \
 "
 BACKPORTS = ""
diff --git a/meta/recipes-devtools/gcc/gcc-6.2/0049-ubsan-empty-string-check-fix.patch b/meta/recipes-devtools/gcc/gcc-6.2/0049-ubsan-empty-string-check-fix.patch
new file mode 100644
index 0000000000..3bbdbe7115
--- /dev/null
+++ b/meta/recipes-devtools/gcc/gcc-6.2/0049-ubsan-empty-string-check-fix.patch
@@ -0,0 +1,25 @@ 
+2017-01-26  Richard Biener  <rguenther@suse.de>
+
+	Backport from mainline
+	2016-09-03  Kirill Yukhin  <kirill.yukhin@intel.com>
+
+	* ubsan.c (ubsan_use_new_style_p): Fix check for empty string.
+
+
+git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-6-branch@244923 138bc75d-0d04-0410-961f-82ee72b054a4
+
+diff --git a/gcc/ubsan.c b/gcc/ubsan.c
+index 56637d8..1093824 100644
+--- a/gcc/ubsan.c
++++ b/gcc/ubsan.c
+
+@@ -1471,7 +1471,7 @@
+ 
+   expanded_location xloc = expand_location (loc);
+   if (xloc.file == NULL || strncmp (xloc.file, "\1", 2) == 0
+-      || xloc.file == '\0' || xloc.file[0] == '\xff'
++      || xloc.file[0] == '\0' || xloc.file[0] == '\xff'
+       || xloc.file[1] == '\xff')
+     return false;
+ 
+
-- 
2.13.1