protobuf: Add -latomic to CXXFLAGS

Adding to LDFLAGS works with LLD linker but not with BFD ld since it
gets added before the abseil-cpp libraries on linker cmdline which does
not link it and still finds the atomic function like `__atomic_store_8'
as missing

Use mipsarcho32 for override which covers both mips and mipsel

Thanks for suggestions - RAED [1]

[1] https://github.com/openembedded/meta-openembedded/pull/952

Signed-off-by: Khem Raj <raj.khem@gmail.com>
This commit is contained in:
Khem Raj 2025-03-23 23:28:31 -07:00
parent e5271adea7
commit 7308156a13
No known key found for this signature in database
GPG Key ID: BB053355919D3314
2 changed files with 5 additions and 5 deletions

View File

@ -3,10 +3,10 @@ From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 10 Mar 2025 19:59:19 -0700
Subject: [PATCH] Fix build on mips/clang
clang13 crashes on mips, until its fixed upstream disable tailcall on
clang20 crashes on mips, until its fixed upstream disable tailcall on
mips
https://bugs.llvm.org/show_bug.cgi?id=52367
https://github.com/llvm/llvm-project/issues/51709
Upstream-Status: Inappropriate [Clang workaround]
Signed-off-by: Khem Raj <raj.khem@gmail.com>

View File

@ -22,8 +22,7 @@ SRC_URI = "git://github.com/protocolbuffers/protobuf.git;branch=29.x;protocol=ht
file://0001-fix-protobuf-native-build-failure-with-gcc-10.patch \
file://0001-utf8_range-add-version-marker-to-library-19009.patch \
"
SRC_URI:append:mips:toolchain-clang = " file://0001-Fix-build-on-mips-clang.patch "
SRC_URI:append:mipsel:toolchain-clang = " file://0001-Fix-build-on-mips-clang.patch "
SRC_URI:append:mipsarcho32:toolchain-clang = " file://0001-Fix-build-on-mips-clang.patch "
UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>.(25\.(\d+)))"
@ -51,7 +50,8 @@ EXTRA_OECMAKE += "\
TEST_SRC_DIR = "examples"
LANG_SUPPORT = "cpp ${@bb.utils.contains('PACKAGECONFIG', 'python', 'python', '', d)}"
LDFLAGS:append:riscv32 = " -latomic"
CXXFLAGS:append:mipsarcho32 = " -latomic"
CXXFLAGS:append:riscv32 = " -latomic"
do_compile_ptest() {
mkdir -p "${B}/${TEST_SRC_DIR}"