]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commit
libclc: Set LDFLAGS to BUILD_LDFLAGS in do_build_prepare_builtins
authorKhem Raj <raj.khem@gmail.com>
Wed, 30 Jul 2025 06:18:07 +0000 (23:18 -0700)
committerMathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Wed, 30 Jul 2025 09:53:45 +0000 (11:53 +0200)
commit5c60aefcf4dd90adad7f4ae2130e112e591e55e2
tree892b91de8d5de7a84e4c2acf805dd90b4c2d32a1
parent60a425efbf93fbd9c4b7a9816dc4999c6af918f1
libclc: Set LDFLAGS to BUILD_LDFLAGS in do_build_prepare_builtins

This function is compiling a native binary, however its operating
largely inside a target or nativesdk shell environment. It does
tricks by passing toolchain-native.cmake to provide native
overrides for cmake, which works for most of variables of interest
besides LDFLAGS. In the toolchain.cmake files on OE we do not
override LDFLAGS but append to it via CMAKE_CXX_LINK_FLAGS  or
CMAKE_C_LINK_FLAGS, which causes problems because LDFLAGS for
nativesdk will contain --dynamic-linker option pointing into
nativesdk string and when doing target build it will use the
LDFLAGS from target environment which might work if it does
not contain conflicting flags.

Currently prepare_builtins binary durin nativesdk build ends up with

 [Requesting program interpreter: /usr/local/oe-sdk-hardcoded-buildpath/sysroots/x86_64-yoesdk-linux/lib/ld-linux-x86-64.so.2]

 This is because LDFLAGS for nativesdk contain the --dynamic-linker
flags pointing into this path.

Target builds for musl targets also end up with similar problems

So lets pass LDFLAGS=BUILD_LDFLAGS to fix this problem

Should toolchain.cmake class define CMAKE_EXE_LINKER_FLAGS,
CMAKE_SHARED_LINKER_FLAGS, CMAKE_MODULE_LINKER_FLAGS etc. as well
is a question that deserve a separate discussion

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Cc: Ross Burton <ross.burton@arm.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
meta/recipes-devtools/clang/libclc_git.bb