diff mbox series

[06/11] clang: remove LLVM_LDFLAGS from llvm-config --ldflags output

Message ID 20250424-clang-merge-v1-6-5a492a8461aa@gmail.com
State New
Headers show
Series clang-merge: Bring clang recipes from meta-clang | expand

Commit Message

Khem Raj April 24, 2025, 7:20 a.m. UTC
From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>

On OE builds the LLVM_LDFLAGS gets a lot of extra flags which may
depend on exact build dir and as such be inappropriate to binaries
shared through sstate-cache. It is not possible to override this
behaviour in llvm-config since crossscripts are not being used for
native builds. Ignore LLVM_LDFLAGS for native builds.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
 ...g-remove-LLVM_LDFLAGS-from-ldflags-output.patch | 32 ++++++++++++++++++++++
 meta/recipes-devtools/clang/common.inc             |  1 +
 2 files changed, 33 insertions(+)

Comments

Dmitry Baryshkov April 24, 2025, 9:10 a.m. UTC | #1
On Thu, Apr 24, 2025 at 12:20:40AM -0700, Khem Raj wrote:
> From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> 
> On OE builds the LLVM_LDFLAGS gets a lot of extra flags which may
> depend on exact build dir and as such be inappropriate to binaries
> shared through sstate-cache. It is not possible to override this
> behaviour in llvm-config since crossscripts are not being used for
> native builds. Ignore LLVM_LDFLAGS for native builds.
> 
> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
>  ...g-remove-LLVM_LDFLAGS-from-ldflags-output.patch | 32 ++++++++++++++++++++++
>  meta/recipes-devtools/clang/common.inc             |  1 +
>  2 files changed, 33 insertions(+)

This defintely doesn't need to come separately from patch 04
Khem Raj April 24, 2025, 6:20 p.m. UTC | #2
On Thu, Apr 24, 2025 at 2:10 AM Dmitry Baryshkov
<dmitry.baryshkov@oss.qualcomm.com> wrote:
>
> On Thu, Apr 24, 2025 at 12:20:40AM -0700, Khem Raj wrote:
> > From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> >
> > On OE builds the LLVM_LDFLAGS gets a lot of extra flags which may
> > depend on exact build dir and as such be inappropriate to binaries
> > shared through sstate-cache. It is not possible to override this
> > behaviour in llvm-config since crossscripts are not being used for
> > native builds. Ignore LLVM_LDFLAGS for native builds.
> >
> > Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
> > Signed-off-by: Khem Raj <raj.khem@gmail.com>
> > ---
> >  ...g-remove-LLVM_LDFLAGS-from-ldflags-output.patch | 32 ++++++++++++++++++++++
> >  meta/recipes-devtools/clang/common.inc             |  1 +
> >  2 files changed, 33 insertions(+)
>
> This defintely doesn't need to come separately from patch 04
>

squashed

> --
> With best wishes
> Dmitry
diff mbox series

Patch

diff --git a/meta/recipes-devtools/clang/clang/0039-llvm-config-remove-LLVM_LDFLAGS-from-ldflags-output.patch b/meta/recipes-devtools/clang/clang/0039-llvm-config-remove-LLVM_LDFLAGS-from-ldflags-output.patch
new file mode 100644
index 0000000000000000000000000000000000000000..36831845490409d8ecb1f9c27cfc34ba3be8b3dd
--- /dev/null
+++ b/meta/recipes-devtools/clang/clang/0039-llvm-config-remove-LLVM_LDFLAGS-from-ldflags-output.patch
@@ -0,0 +1,32 @@ 
+From 648a28fcbde4f5c1899699185f9bceb389c0ad8c Mon Sep 17 00:00:00 2001
+From: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
+Date: Wed, 2 Apr 2025 17:05:17 +0300
+Subject: [PATCH] llvm-config: remove LLVM_LDFLAGS from --ldflags output
+
+On native OE builds the LLVM_LDFLAGS gets a lot of extra flags which may
+depend on exact build dir and as such be inappropriate to binaries
+shared through sstate-cache. It is not possible to override this
+behaviour in llvm-config since crossscripts are not being used for
+native builds. As a OE-specific modification ignore LLVM_LDFLAGS for
+native builds.
+
+Upstream-Status: Inappropriate [OE-Specific]
+Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ llvm/tools/llvm-config/llvm-config.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/llvm/tools/llvm-config/llvm-config.cpp b/llvm/tools/llvm-config/llvm-config.cpp
+index a739f0d8dbea..3120f95fba9d 100644
+--- a/llvm/tools/llvm-config/llvm-config.cpp
++++ b/llvm/tools/llvm-config/llvm-config.cpp
+@@ -542,7 +542,7 @@ int main(int argc, char **argv) {
+         OS << ActiveIncludeOption << ' ' << LLVM_CXXFLAGS << '\n';
+       } else if (Arg == "--ldflags") {
+         OS << ((HostTriple.isWindowsMSVCEnvironment()) ? "-LIBPATH:" : "-L")
+-           << ActiveLibDir << ' ' << LLVM_LDFLAGS << '\n';
++           << ActiveLibDir << '\n';
+       } else if (Arg == "--system-libs") {
+         PrintSystemLibs = true;
+       } else if (Arg == "--libs") {
diff --git a/meta/recipes-devtools/clang/common.inc b/meta/recipes-devtools/clang/common.inc
index f77a3eea0ec7af3de8bc7f075cd8ba88b77f6beb..6c89d853d5219b4d1f2907100dfad91953b126e9 100644
--- a/meta/recipes-devtools/clang/common.inc
+++ b/meta/recipes-devtools/clang/common.inc
@@ -70,6 +70,7 @@  SRC_URI = "\
     file://0036-Fix-build-on-ppc64-musl.patch \
     file://0037-clangd-Add-a-build-option-to-disable-building-dexp.patch \
     file://0038-AsmMatcherEmitter-sort-ClassInfo-lists-by-name-as-we.patch \
+    file://0039-llvm-config-remove-LLVM_LDFLAGS-from-ldflags-output.patch \
 "
 # Fallback to no-PIE if not set
 GCCPIE ??= ""