From 8bf9f02d5193c9712d6b383bdf7d98d853c4711b Mon Sep 17 00:00:00 2001 From: Anuj Mittal Date: Wed, 23 Nov 2022 12:40:56 +0800 Subject: clang: backport patches to fix lldb errors OE-core recently upgraded to swig 4.1.0 which results in errors: 11:49:31 | /poky/build/tmp/work-shared/llvm-project-source-15.0.4-r0/git/lldb/bindings/interfaces.swig:5: Error: Macro '__STDC_LIMIT_MACROS' redefined, 11:49:31 | :1: Error: previous definition of '__STDC_LIMIT_MACROS'. Backport patches from release/15.x branch to fix these. Signed-off-by: Anuj Mittal --- .../clang/clang/0035-lldb-fix-swig-error.patch | 30 ++++++++++++++ ...-dc8f6ffc3bf297098a1dfd3fbce801afbe9f5238.patch | 46 ++++++++++++++++++++++ recipes-devtools/clang/common.inc | 2 + 3 files changed, 78 insertions(+) create mode 100644 recipes-devtools/clang/clang/0035-lldb-fix-swig-error.patch create mode 100644 recipes-devtools/clang/clang/0036-dc8f6ffc3bf297098a1dfd3fbce801afbe9f5238.patch diff --git a/recipes-devtools/clang/clang/0035-lldb-fix-swig-error.patch b/recipes-devtools/clang/clang/0035-lldb-fix-swig-error.patch new file mode 100644 index 0000000..460680b --- /dev/null +++ b/recipes-devtools/clang/clang/0035-lldb-fix-swig-error.patch @@ -0,0 +1,30 @@ +From 392963bb1daf7ec8822a0f02929a8ada17eb0a0a Mon Sep 17 00:00:00 2001 +From: Jitka Plesnikova +Date: Wed, 21 Sep 2022 11:42:46 +0200 +Subject: [PATCH] [lldb] Fix 'error: non-const lvalue...' caused by SWIG 4.1.0 + +Fix the failure caused by change in SwigValueWraper for C++11 and later +for improved move semantics in SWIG commit. + +https://github.com/swig/swig/commit/d1055f4b3d51cb8060893f8036846ac743302dab +(cherry picked from commit f0a25fe0b746f56295d5c02116ba28d2f965c175) + +Upstream-Status: Backport +Signed-off-by: Anuj Mittal +--- + lldb/bindings/python/python-typemaps.swig | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lldb/bindings/python/python-typemaps.swig b/lldb/bindings/python/python-typemaps.swig +index bf3de66b91bf..d45431c771ca 100644 +--- a/lldb/bindings/python/python-typemaps.swig ++++ b/lldb/bindings/python/python-typemaps.swig +@@ -435,7 +435,7 @@ template <> bool SetNumberFromPyObject(double &number, PyObject *obj) { + + %typemap(out) lldb::FileSP { + $result = nullptr; +- lldb::FileSP &sp = $1; ++ const lldb::FileSP &sp = $1; + if (sp) { + PythonFile pyfile = unwrapOrSetPythonException(PythonFile::FromFile(*sp)); + if (!pyfile.IsValid()) diff --git a/recipes-devtools/clang/clang/0036-dc8f6ffc3bf297098a1dfd3fbce801afbe9f5238.patch b/recipes-devtools/clang/clang/0036-dc8f6ffc3bf297098a1dfd3fbce801afbe9f5238.patch new file mode 100644 index 0000000..2c3498c --- /dev/null +++ b/recipes-devtools/clang/clang/0036-dc8f6ffc3bf297098a1dfd3fbce801afbe9f5238.patch @@ -0,0 +1,46 @@ +From dc8f6ffc3bf297098a1dfd3fbce801afbe9f5238 Mon Sep 17 00:00:00 2001 +From: serge-sans-paille +Date: Thu, 29 Sep 2022 21:48:38 +0200 +Subject: [PATCH] [lldb] Get rid of __STDC_LIMIT_MACROS and + __STDC_CONSTANT_MACROS + +C++11 made the use of these macro obsolete, see https://sourceware.org/bugzilla/show_bug.cgi?id=15366 + +As a side effect this prevents https://github.com/swig/swig/issues/2193. + +Differential Revision: https://reviews.llvm.org/D134877 + +(cherry picked from commit 81fc5f7909a4ef5a8d4b5da2a10f77f7cb01ba63) +Upstream-Status: Backport +Signed-off-by: Anuj Mittal +--- + lldb/bindings/CMakeLists.txt | 2 -- + lldb/bindings/interfaces.swig | 3 --- + 2 files changed, 5 deletions(-) + +diff --git a/lldb/bindings/CMakeLists.txt b/lldb/bindings/CMakeLists.txt +index c8aa0bcf9681..9eed2f1e6299 100644 +--- a/lldb/bindings/CMakeLists.txt ++++ b/lldb/bindings/CMakeLists.txt +@@ -26,8 +26,6 @@ set(SWIG_COMMON_FLAGS + -features autodoc + -I${LLDB_SOURCE_DIR}/include + -I${CMAKE_CURRENT_SOURCE_DIR} +- -D__STDC_LIMIT_MACROS +- -D__STDC_CONSTANT_MACROS + ${DARWIN_EXTRAS} + ) + +diff --git a/lldb/bindings/interfaces.swig b/lldb/bindings/interfaces.swig +index c9a6d0f06056..021c7683d170 100644 +--- a/lldb/bindings/interfaces.swig ++++ b/lldb/bindings/interfaces.swig +@@ -1,8 +1,5 @@ + /* Various liblldb typedefs that SWIG needs to know about. */ + #define __extension__ /* Undefine GCC keyword to make Swig happy when processing glibc's stdint.h. */ +-/* The ISO C99 standard specifies that in C++ implementations limit macros such +- as INT32_MAX should only be defined if __STDC_LIMIT_MACROS is. */ +-#define __STDC_LIMIT_MACROS + %include "stdint.i" + + %include "lldb/lldb-defines.h" diff --git a/recipes-devtools/clang/common.inc b/recipes-devtools/clang/common.inc index a0f8a00..5f6a6f4 100644 --- a/recipes-devtools/clang/common.inc +++ b/recipes-devtools/clang/common.inc @@ -44,6 +44,8 @@ SRC_URI = "\ file://0032-compiler-rt-Enable-__int128-for-ppc32.patch \ file://0033-llvm-Do-not-use-cmake-infra-to-detect-libzstd.patch \ file://0034-Revert-MIPS-compiler-rt-Fix-stat-struct-s-size-for-O.patch \ + file://0035-lldb-fix-swig-error.patch \ + file://0036-dc8f6ffc3bf297098a1dfd3fbce801afbe9f5238.patch \ " # Fallback to no-PIE if not set GCCPIE ??= "" -- cgit v1.2.3-54-g00ecf