From 507ebb86c028c3efe2140c5e0e29905ed28b5cde Mon Sep 17 00:00:00 2001
From: Andrei Gherzan <andrei.gherzan@huawei.com>
Date: Wed, 8 Dec 2021 16:26:04 +0100
Subject: [PATCH] gcc-cross: Bring back the dwarf fix for non-Linux targets
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This changes brings back the fix in

commit f5f47b3340a8d490243640ff8fe6aa78aae9503d
Author: Bernhard Rosenkränzer <bernhard.rosenkraenzer.ext@huawei.com>
Date:   Thu Oct 21 22:40:17 2021 +0200
    gcc: Use DWARF-4 by default on non-Linux targets

It was dropped when removing the local oniro version of gcc.

Signed-off-by: Andrei Gherzan <andrei.gherzan@huawei.com>
---
 .../recipes-devtools/gcc/gcc-cross_11.2.bbappend   | 14 ++++++++++++++
 1 file changed, 14 insertions(+)
 create mode 100644 meta-oniro-core/recipes-devtools/gcc/gcc-cross_11.2.bbappend

diff --git a/meta-oniro-core/recipes-devtools/gcc/gcc-cross_11.2.bbappend b/meta-oniro-core/recipes-devtools/gcc/gcc-cross_11.2.bbappend
new file mode 100644
index 00000000..7592dfd0
--- /dev/null
+++ b/meta-oniro-core/recipes-devtools/gcc/gcc-cross_11.2.bbappend
@@ -0,0 +1,14 @@
+# SPDX-FileCopyrightText: Huawei Inc.
+#
+# SPDX-License-Identifier: Apache-2.0
+
+do_configure:prepend () {
+    if ! echo ${@d.getVar("TARGET_OS")} | grep -qi linux; then
+        # Building Zephyr with DWARF-5 is problematic because
+        # its kernel tests use pyelftools, which has incomplete
+        # DWARF-5 support (even after applying preliminary
+        # support patches). Use DWARF-4 on Zephyr and FreeRTOS
+        # for the time being.
+        sed -i -e 's,Var(dwarf_version) Init(5),Var(dwarf_version) Init(4),' ${S}/gcc/common.opt
+    fi
+}
-- 
GitLab