diff mbox series

[v6,07/13] llvm: forcibly disable __isoc23_strtol usage

Message ID 20250407-mesa-25-v6-7-29bf4cae8d28@oss.qualcomm.com
State New
Headers show
Series mesa: upgrade to 25.0.2 | expand

Commit Message

Dmitry Baryshkov April 7, 2025, 9:48 a.m. UTC
In the multiconfig builds the llvm-native build can get reused from the
sstate cache with uninative being bypassed. This can result in the
undefined __isoc23_strtol symbols (which are supported by the uninative,
but not by the host library).

In order to prevent such link issues, forcibly disable usage of C23
strtol functions inside the native LLVM build.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
---
 meta/recipes-devtools/llvm/llvm/isoc23.h  | 11 +++++++++++
 meta/recipes-devtools/llvm/llvm_20.1.1.bb |  4 ++++
 2 files changed, 15 insertions(+)

Comments

Alexander Kanavin April 7, 2025, 11:22 a.m. UTC | #1
On Mon, 7 Apr 2025 at 11:48, Dmitry Baryshkov via
lists.openembedded.org
<dmitry.baryshkov=oss.qualcomm.com@lists.openembedded.org> wrote:
>
> In the multiconfig builds the llvm-native build can get reused from the
> sstate cache with uninative being bypassed. This can result in the
> undefined __isoc23_strtol symbols (which are supported by the uninative,
> but not by the host library).

I don't understand. How and where is uninative being bypassed?

Alex
Dmitry Baryshkov April 7, 2025, 11:58 a.m. UTC | #2
On Mon, 7 Apr 2025 at 14:22, Alexander Kanavin <alex.kanavin@gmail.com> wrote:
>
> On Mon, 7 Apr 2025 at 11:48, Dmitry Baryshkov via
> lists.openembedded.org
> <dmitry.baryshkov=oss.qualcomm.com@lists.openembedded.org> wrote:
> >
> > In the multiconfig builds the llvm-native build can get reused from the
> > sstate cache with uninative being bypassed. This can result in the
> > undefined __isoc23_strtol symbols (which are supported by the uninative,
> > but not by the host library).
>
> I don't understand. How and where is uninative being bypassed?

See [1] . During multiconfig.MultiConfig.test_multiconfig there are
two additional multiconfs. Both musl and tiny end up not using
uninative. If I understand the issue correctly after reproducing it
locally, multiconfs end up using llvm-native from sstate cache, but
respective functions are not available in host's libc.

[1] https://autobuilder.yoctoproject.org/valkyrie/#/builders/23/builds/1374
diff mbox series

Patch

diff --git a/meta/recipes-devtools/llvm/llvm/isoc23.h b/meta/recipes-devtools/llvm/llvm/isoc23.h
new file mode 100644
index 0000000000000000000000000000000000000000..b6738b6aaeb4e140aebad37ba0efb48a29cfac9b
--- /dev/null
+++ b/meta/recipes-devtools/llvm/llvm/isoc23.h
@@ -0,0 +1,11 @@ 
+/*
+ * Copyright (c) 2024 Qualcomm Technologies, Inc.
+ * SPDX-License-Identifier: Apache-2.0-with-LLVM-exception
+ */
+#include <features.h>
+
+#undef __GLIBC_USE_C23_STRTOL
+#define __GLIBC_USE_C23_STRTOL 0
+
+#undef __GLIBC_USE_C2X_STRTOL
+#define __GLIBC_USE_C2X_STRTOL 0
diff --git a/meta/recipes-devtools/llvm/llvm_20.1.1.bb b/meta/recipes-devtools/llvm/llvm_20.1.1.bb
index b95473c88b64961cb6ae2f4ace14aac4600cf98e..69f19aee59388f92c254c1f049622845713f4e94 100644
--- a/meta/recipes-devtools/llvm/llvm_20.1.1.bb
+++ b/meta/recipes-devtools/llvm/llvm_20.1.1.bb
@@ -27,6 +27,7 @@  SRC_URI = "https://github.com/llvm/llvm-project/releases/download/llvmorg-${PV}/
            file://0007-llvm-allow-env-override-of-exe-path.patch \
            file://0001-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch \
            file://llvm-config \
+           file://isoc23.h \
            "
 SRC_URI[sha256sum] = "4d5ebbd40ce1e984a650818a4bb5ae86fc70644dec2e6d54e78b4176db3332e0"
 UPSTREAM_CHECK_URI = "https://github.com/llvm/llvm-project"
@@ -71,6 +72,9 @@  LLVM_TARGETS ?= "AMDGPU;${@get_llvm_host_arch(bb, d)}"
 ARM_INSTRUCTION_SET:armv5 = "arm"
 ARM_INSTRUCTION_SET:armv4t = "arm"
 
+
+BUILD_CPPFLAGS += "-include ${UNPACKDIR}/isoc23.h"
+
 EXTRA_OECMAKE += "-DLLVM_ENABLE_ASSERTIONS=OFF \
                   -DLLVM_ENABLE_EXPENSIVE_CHECKS=OFF \
                   -DLLVM_ENABLE_PIC=ON \