* [PATCH v2 1/3] kea: Fix build with clang/libc++ 21
@ 2025-09-04 5:15 Khem Raj
2025-09-04 5:15 ` [PATCH v2 2/3] kexec-tools: Fix build with LLD linker Khem Raj
2025-09-04 5:15 ` [PATCH v3 3/3] grub,grub-efi: Always use BFD linker with clang Khem Raj
0 siblings, 2 replies; 5+ messages in thread
From: Khem Raj @ 2025-09-04 5:15 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Clang with libc++ hardening on, rejects Boost’s enum trait probe
which is ill-formed for scoped/limited
enums whose valid range does not include −1
(e.g. enums with values [0..3])
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v2: No change
...s-dhcpsrv-Avoid-Boost-lexical_cast-o.patch | 348 ++++++++++++++++++
meta/recipes-connectivity/kea/kea_3.0.1.bb | 1 +
2 files changed, 349 insertions(+)
create mode 100644 meta/recipes-connectivity/kea/files/0001-d2-dhcp-46-radius-dhcpsrv-Avoid-Boost-lexical_cast-o.patch
diff --git a/meta/recipes-connectivity/kea/files/0001-d2-dhcp-46-radius-dhcpsrv-Avoid-Boost-lexical_cast-o.patch b/meta/recipes-connectivity/kea/files/0001-d2-dhcp-46-radius-dhcpsrv-Avoid-Boost-lexical_cast-o.patch
new file mode 100644
index 00000000000..6facc4d32d7
--- /dev/null
+++ b/meta/recipes-connectivity/kea/files/0001-d2-dhcp-46-radius-dhcpsrv-Avoid-Boost-lexical_cast-o.patch
@@ -0,0 +1,348 @@
+From e3a0d181a279334c7d7a10c5b09fd1610384101c Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 3 Sep 2025 12:52:51 -0700
+Subject: [PATCH] d2/dhcp[46]/radius/dhcpsrv: Avoid Boost lexical_cast on enums
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+Clang with libc++ hardening (-D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_FAST)
+rejects Boost's enum trait probe used by `boost::lexical_cast`:
+`boost::type_traits::is_signed/is_unsigned` defines
+`static const T minus_one = (T)-1;`, which is ill-formed for scoped/limited
+enums whose valid range does not include −1 (e.g. enums with values [0..3]).
+When an enum is passed to `lexical_cast<std::string>`, this triggers errors like:
+
+ error: in-class initializer for static data member is not a constant expression
+ ... minus_one = (static_cast<no_cv_t>(-1));
+
+In Kea this surfaced via logging `.arg(enum_value)` and when writing
+`Lease6::type_` to CSV.
+
+This change makes all such call sites avoid `lexical_cast` on enums:
+
+* d2 transactions (`check_exists_*`, `nc_*`, `simple_*`):
+ cast `getDnsUpdateStatus()` to `int` before passing to `.arg(...)`.
+
+* d2 queue manager (`d2_queue_mgr.cc`):
+ cast `mgr_state_` to `int` before logging.
+
+* DHCPv4/6 servers (`dhcp4_srv.cc`, `dhcp6_srv.cc`):
+ cast `dhcp_ddns::NameChangeSender::Result` to `int` before logging.
+
+* RADIUS hook (`radius_accounting.cc`):
+ cast `env.event_` to `int` for the numeric field; we still log the textual
+ form via `eventToText(event_)` in the next argument.
+
+* DHCPv6 CSV writer (`csv_lease_file6.cc`):
+ write `lease_type` using `isc::dhcp::Lease::typeToText(lease.type_)`
+ instead of passing the enum directly. This is human-readable and uses Kea’s
+ own canonical stringifier, while avoiding the Boost enum path entirely.
+
+why:
+
+- Prevents Boost from instantiating enum trait checks that cast −1 to an enum.
+- Unblocks builds with recent Clang/libc++ hardening.
+- Keeps log output stable (numeric codes retained) and improves CSV clarity
+ for lease type by using the provided textual converter.
+
+No functional/ABI changes; only formatting of certain log/CSV values.
+If a downstream consumer expects a numeric `lease_type`, it can be adjusted
+to parse the textual value or the change can be trivially flipped to
+`static_cast<unsigned>(lease.type_)`.
+
+Upstream-Status: Submitted [https://gitlab.isc.org/isc-projects/kea/-/issues/4100]
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ src/bin/d2/check_exists_add.cc | 6 +++---
+ src/bin/d2/check_exists_remove.cc | 6 +++---
+ src/bin/d2/d2_queue_mgr.cc | 2 +-
+ src/bin/d2/nc_add.cc | 6 +++---
+ src/bin/d2/nc_remove.cc | 6 +++---
+ src/bin/d2/simple_add.cc | 4 ++--
+ src/bin/d2/simple_add_without_dhcid.cc | 4 ++--
+ src/bin/d2/simple_remove.cc | 4 ++--
+ src/bin/d2/simple_remove_without_dhcid.cc | 4 ++--
+ src/bin/dhcp4/dhcp4_srv.cc | 2 +-
+ src/bin/dhcp6/dhcp6_srv.cc | 2 +-
+ src/hooks/dhcp/radius/radius_accounting.cc | 2 +-
+ src/lib/dhcpsrv/csv_lease_file6.cc | 2 +-
+ 13 files changed, 25 insertions(+), 25 deletions(-)
+
+diff --git a/src/bin/d2/check_exists_add.cc b/src/bin/d2/check_exists_add.cc
+index 11bb29f..edfef31 100644
+--- a/src/bin/d2/check_exists_add.cc
++++ b/src/bin/d2/check_exists_add.cc
+@@ -270,7 +270,7 @@ CheckExistsAddTransaction::addingFwdAddrsHandler() {
+ // bigger is wrong.
+ LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_ADD_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+@@ -397,7 +397,7 @@ CheckExistsAddTransaction::replacingFwdAddrsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_FORWARD_REPLACE_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+@@ -541,7 +541,7 @@ CheckExistsAddTransaction::replacingRevPtrsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_REVERSE_REPLACE_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+diff --git a/src/bin/d2/check_exists_remove.cc b/src/bin/d2/check_exists_remove.cc
+index 8ae5296..8b6b221 100644
+--- a/src/bin/d2/check_exists_remove.cc
++++ b/src/bin/d2/check_exists_remove.cc
+@@ -268,7 +268,7 @@ CheckExistsRemoveTransaction::removingFwdAddrsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_FORWARD_REMOVE_ADDRS_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+@@ -404,7 +404,7 @@ CheckExistsRemoveTransaction::removingFwdRRsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_FORWARD_REMOVE_RRS_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+@@ -556,7 +556,7 @@ CheckExistsRemoveTransaction::removingRevPtrsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_REVERSE_REMOVE_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+diff --git a/src/bin/d2/d2_queue_mgr.cc b/src/bin/d2/d2_queue_mgr.cc
+index f902b22..effa56b 100644
+--- a/src/bin/d2/d2_queue_mgr.cc
++++ b/src/bin/d2/d2_queue_mgr.cc
+@@ -78,7 +78,7 @@ D2QueueMgr::operator()(const dhcp_ddns::NameChangeListener::Result result,
+ // this is unexpected so we will treat it as a receive error.
+ // This is most likely an unforeseen programmatic issue.
+ LOG_ERROR(dhcp_to_d2_logger, DHCP_DDNS_QUEUE_MGR_UNEXPECTED_STOP)
+- .arg(mgr_state_);
++ .arg(static_cast<int>(mgr_state_));
+ stopListening(STOPPED_RECV_ERROR);
+ }
+
+diff --git a/src/bin/d2/nc_add.cc b/src/bin/d2/nc_add.cc
+index 7bffc16..1d17bb2 100644
+--- a/src/bin/d2/nc_add.cc
++++ b/src/bin/d2/nc_add.cc
+@@ -272,7 +272,7 @@ NameAddTransaction::addingFwdAddrsHandler() {
+ // bigger is wrong.
+ LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_ADD_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+@@ -399,7 +399,7 @@ NameAddTransaction::replacingFwdAddrsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_FORWARD_REPLACE_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+@@ -542,7 +542,7 @@ NameAddTransaction::replacingRevPtrsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_REVERSE_REPLACE_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+diff --git a/src/bin/d2/nc_remove.cc b/src/bin/d2/nc_remove.cc
+index 874e43b..182343c 100644
+--- a/src/bin/d2/nc_remove.cc
++++ b/src/bin/d2/nc_remove.cc
+@@ -268,7 +268,7 @@ NameRemoveTransaction::removingFwdAddrsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_FORWARD_REMOVE_ADDRS_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+@@ -404,7 +404,7 @@ NameRemoveTransaction::removingFwdRRsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_FORWARD_REMOVE_RRS_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+@@ -555,7 +555,7 @@ NameRemoveTransaction::removingRevPtrsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_REVERSE_REMOVE_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+diff --git a/src/bin/d2/simple_add.cc b/src/bin/d2/simple_add.cc
+index 6113b4d..73aa5b4 100644
+--- a/src/bin/d2/simple_add.cc
++++ b/src/bin/d2/simple_add.cc
+@@ -259,7 +259,7 @@ SimpleAddTransaction::replacingFwdAddrsHandler() {
+ // bigger is wrong.
+ LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_ADD_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+@@ -404,7 +404,7 @@ SimpleAddTransaction::replacingRevPtrsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_REVERSE_REPLACE_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+diff --git a/src/bin/d2/simple_add_without_dhcid.cc b/src/bin/d2/simple_add_without_dhcid.cc
+index ccea83a..97918ad 100644
+--- a/src/bin/d2/simple_add_without_dhcid.cc
++++ b/src/bin/d2/simple_add_without_dhcid.cc
+@@ -260,7 +260,7 @@ SimpleAddWithoutDHCIDTransaction::replacingFwdAddrsHandler() {
+ // bigger is wrong.
+ LOG_ERROR(d2_to_dns_logger, DHCP_DDNS_FORWARD_ADD_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+@@ -406,7 +406,7 @@ SimpleAddWithoutDHCIDTransaction::replacingRevPtrsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_REVERSE_REPLACE_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+diff --git a/src/bin/d2/simple_remove.cc b/src/bin/d2/simple_remove.cc
+index e1d9a78..14f416b 100644
+--- a/src/bin/d2/simple_remove.cc
++++ b/src/bin/d2/simple_remove.cc
+@@ -272,7 +272,7 @@ SimpleRemoveTransaction::removingFwdRRsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_FORWARD_REMOVE_RRS_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+@@ -423,7 +423,7 @@ SimpleRemoveTransaction::removingRevPtrsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_REVERSE_REMOVE_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+diff --git a/src/bin/d2/simple_remove_without_dhcid.cc b/src/bin/d2/simple_remove_without_dhcid.cc
+index 04fe4df..cefdda8 100644
+--- a/src/bin/d2/simple_remove_without_dhcid.cc
++++ b/src/bin/d2/simple_remove_without_dhcid.cc
+@@ -273,7 +273,7 @@ SimpleRemoveWithoutDHCIDTransaction::removingFwdRRsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_FORWARD_REMOVE_RRS_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+@@ -425,7 +425,7 @@ SimpleRemoveWithoutDHCIDTransaction::removingRevPtrsHandler() {
+ LOG_ERROR(d2_to_dns_logger,
+ DHCP_DDNS_REVERSE_REMOVE_BAD_DNSCLIENT_STATUS)
+ .arg(getRequestId())
+- .arg(getDnsUpdateStatus())
++ .arg(static_cast<int>(getDnsUpdateStatus()))
+ .arg(getNcr()->getFqdn())
+ .arg(getCurrentServer()->toText());
+
+diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc
+index 0701ed4..471e94c 100644
+--- a/src/bin/dhcp4/dhcp4_srv.cc
++++ b/src/bin/dhcp4/dhcp4_srv.cc
+@@ -5101,7 +5101,7 @@ Dhcpv4Srv::d2ClientErrorHandler(const
+ dhcp_ddns::NameChangeSender::Result result,
+ dhcp_ddns::NameChangeRequestPtr& ncr) {
+ LOG_ERROR(ddns4_logger, DHCP4_DDNS_REQUEST_SEND_FAILED).
+- arg(result).arg((ncr ? ncr->toText() : " NULL "));
++ arg(static_cast<int>(result)).arg((ncr ? ncr->toText() : " NULL "));
+ // We cannot communicate with kea-dhcp-ddns, suspend further updates.
+ /// @todo We may wish to revisit this, but for now we will simply turn
+ /// them off.
+diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc
+index 417960b..818046d 100644
+--- a/src/bin/dhcp6/dhcp6_srv.cc
++++ b/src/bin/dhcp6/dhcp6_srv.cc
+@@ -5054,7 +5054,7 @@ Dhcpv6Srv::d2ClientErrorHandler(const
+ dhcp_ddns::NameChangeSender::Result result,
+ dhcp_ddns::NameChangeRequestPtr& ncr) {
+ LOG_ERROR(ddns6_logger, DHCP6_DDNS_REQUEST_SEND_FAILED).
+- arg(result).arg((ncr ? ncr->toText() : " NULL "));
++ arg(static_cast<int>(result)).arg((ncr ? ncr->toText() : " NULL "));
+ // We cannot communicate with kea-dhcp-ddns, suspend further updates.
+ /// @todo We may wish to revisit this, but for now we will simply turn
+ /// them off.
+diff --git a/src/hooks/dhcp/radius/radius_accounting.cc b/src/hooks/dhcp/radius/radius_accounting.cc
+index 30eb07e..31f6d5e 100644
+--- a/src/hooks/dhcp/radius/radius_accounting.cc
++++ b/src/hooks/dhcp/radius/radius_accounting.cc
+@@ -760,7 +760,7 @@ RadiusAccounting::terminate(RadiusAcctEnv env, int result) {
+ if (result != OK_RC) {
+ LOG_ERROR(radius_logger, RADIUS_ACCOUNTING_ERROR)
+ .arg(env.session_id_)
+- .arg(env.event_)
++ .arg(static_cast<int>(env.event_))
+ .arg(eventToText(env.event_))
+ .arg(result)
+ .arg(exchangeRCtoText(result));
+diff --git a/src/lib/dhcpsrv/csv_lease_file6.cc b/src/lib/dhcpsrv/csv_lease_file6.cc
+index 830d2e5..a899aef 100644
+--- a/src/lib/dhcpsrv/csv_lease_file6.cc
++++ b/src/lib/dhcpsrv/csv_lease_file6.cc
+@@ -51,7 +51,7 @@ CSVLeaseFile6::append(const Lease6& lease) {
+ row.writeAt(getColumnIndex("expire"), static_cast<uint64_t>(lease.cltt_) + lease.valid_lft_);
+ row.writeAt(getColumnIndex("subnet_id"), lease.subnet_id_);
+ row.writeAt(getColumnIndex("pref_lifetime"), lease.preferred_lft_);
+- row.writeAt(getColumnIndex("lease_type"), lease.type_);
++ row.writeAt(getColumnIndex("lease_type"), isc::dhcp::Lease::typeToText(lease.type_));
+ row.writeAt(getColumnIndex("iaid"), lease.iaid_);
+ row.writeAt(getColumnIndex("prefix_len"),
+ static_cast<int>(lease.prefixlen_));
diff --git a/meta/recipes-connectivity/kea/kea_3.0.1.bb b/meta/recipes-connectivity/kea/kea_3.0.1.bb
index 8dc6bdfea80..cc34c05093a 100644
--- a/meta/recipes-connectivity/kea/kea_3.0.1.bb
+++ b/meta/recipes-connectivity/kea/kea_3.0.1.bb
@@ -20,6 +20,7 @@ SRC_URI = "http://ftp.isc.org/isc/kea/${PV}/${BP}.tar.xz \
file://0001-build-boost-1.89.0-fixes.patch \
file://0001-meson-use-a-runtime-safe-interpreter-string.patch \
file://0001-mk_cfgrpt.sh-strip-prefixes.patch \
+ file://0001-d2-dhcp-46-radius-dhcpsrv-Avoid-Boost-lexical_cast-o.patch \
"
SRC_URI[sha256sum] = "ec84fec4bb7f6b9d15a82e755a571e9348eb4d6fbc62bb3f6f1296cd7a24c566"
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/3] kexec-tools: Fix build with LLD linker
2025-09-04 5:15 [PATCH v2 1/3] kea: Fix build with clang/libc++ 21 Khem Raj
@ 2025-09-04 5:15 ` Khem Raj
2025-09-04 5:31 ` Patchtest results for " patchtest
2025-09-04 8:38 ` [OE-core] " Mathieu Dubois-Briand
2025-09-04 5:15 ` [PATCH v3 3/3] grub,grub-efi: Always use BFD linker with clang Khem Raj
1 sibling, 2 replies; 5+ messages in thread
From: Khem Raj @ 2025-09-04 5:15 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v2: Update the Patch-Status to Submitted
...nt-base-match-pinned-section-address.patch | 36 +++++++++++++++++++
.../kexec/kexec-tools_2.0.31.bb | 1 +
2 files changed, 37 insertions(+)
create mode 100644 meta/recipes-kernel/kexec/kexec-tools/0001-Make-the-segment-base-match-pinned-section-address.patch
diff --git a/meta/recipes-kernel/kexec/kexec-tools/0001-Make-the-segment-base-match-pinned-section-address.patch b/meta/recipes-kernel/kexec/kexec-tools/0001-Make-the-segment-base-match-pinned-section-address.patch
new file mode 100644
index 00000000000..42d81439957
--- /dev/null
+++ b/meta/recipes-kernel/kexec/kexec-tools/0001-Make-the-segment-base-match-pinned-section-address.patch
@@ -0,0 +1,36 @@
+From 0d8a9e12b6509cb2a79818f5f4062a0bee33edfc Mon Sep 17 00:00:00 2001
+From: Khem Raj <raj.khem@gmail.com>
+Date: Wed, 3 Sep 2025 13:28:32 -0700
+Subject: [PATCH] Make the segment base match pinned section address
+
+ET_EXEC uses image base of 0x400000, but the build forces
+section VMAs like .text = 0x10000. LLD now errors when any
+section address is below the image base unless you explicitly
+set the base. (Older LLD tolerated it.)
+
+To fix this, set the image base to match forced section addresses
+
+Fixes
+| x86_64-yoe-linux-ld.lld: error: section '.text' address (0x10000) is smaller than image base (0x400000); specify --image-base
+| x86_64-yoe-linux-ld.lld: error: section '.bss' address (0x12000) is smaller than image base (0x400000); specify --image-base
+
+Upstream-Status: Submitted [https://lists.infradead.org/pipermail/kexec/2025-September/033481.html]
+
+Signed-off-by: Khem Raj <raj.khem@gmail.com>
+---
+ kexec_test/Makefile | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/kexec_test/Makefile b/kexec_test/Makefile
+index fec6210..f9fa92c 100644
+--- a/kexec_test/Makefile
++++ b/kexec_test/Makefile
+@@ -31,7 +31,7 @@ $(KEXEC_TEST): CPPFLAGS+=-DRELOC=$(RELOC)
+ $(KEXEC_TEST): ASFLAGS+=-m32
+ #$(KEXEC_TEST): LDFLAGS=-m32 -Wl,-e -Wl,_start -Wl,-Ttext -Wl,$(RELOC) \
+ # -nostartfiles
+-$(KEXEC_TEST): LDFLAGS=-melf_i386 -e _start -Ttext $(RELOC)
++$(KEXEC_TEST): LDFLAGS=-melf_i386 -e _start --image-base=$(RELOC) -Ttext $(RELOC)
+
+ $(KEXEC_TEST): $(KEXEC_TEST_OBJS)
+ mkdir -p $(@D)
diff --git a/meta/recipes-kernel/kexec/kexec-tools_2.0.31.bb b/meta/recipes-kernel/kexec/kexec-tools_2.0.31.bb
index 7333aa73c17..b12f76a0bf4 100644
--- a/meta/recipes-kernel/kexec/kexec-tools_2.0.31.bb
+++ b/meta/recipes-kernel/kexec/kexec-tools_2.0.31.bb
@@ -19,6 +19,7 @@ SRC_URI = "${KERNELORG_MIRROR}/linux/utils/kernel/kexec/kexec-tools-${PV}.tar.gz
file://0001-arm64-kexec-disabled-check-if-kaslr-seed-dtb-propert.patch \
file://0001-kexec.c-add-MFD_NOEXEC_SEAL-flag-explicitly.patch \
file://0001-ppc-fs2dt-Match-function-signatures.patch \
+ file://0001-Make-the-segment-base-match-pinned-section-address.patch \
"
SRC_URI[sha256sum] = "ddaaa65b02b4f8aa9222586b1f26565b93a4baeffd35bcbd523f15fae7aa4897"
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v3 3/3] grub,grub-efi: Always use BFD linker with clang
2025-09-04 5:15 [PATCH v2 1/3] kea: Fix build with clang/libc++ 21 Khem Raj
2025-09-04 5:15 ` [PATCH v2 2/3] kexec-tools: Fix build with LLD linker Khem Raj
@ 2025-09-04 5:15 ` Khem Raj
1 sibling, 0 replies; 5+ messages in thread
From: Khem Raj @ 2025-09-04 5:15 UTC (permalink / raw)
To: openembedded-core; +Cc: Khem Raj
LLD 21+ is erroring on text address being lower than the default
segment address for binaries. Erroring during configure e.g.
cannot link at address 0x2000
With LLD 21, -Ttext,<addr> only moves the .text section
it does not change the image base and LLD 21 errors out
if any section VMA is below the image base and the segment (image)
base still defaults to 0x400000 when using LLD, hence the error
LLD support in Grub needs to be done properly, it will need
to adjust how linker options are constructed in configure. We
default to use BFD linker always when using clang for now.
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v3: No change
meta/recipes-bsp/grub/grub2.inc | 1 +
1 file changed, 1 insertion(+)
diff --git a/meta/recipes-bsp/grub/grub2.inc b/meta/recipes-bsp/grub/grub2.inc
index ffa04e415d3..dd1587acd6e 100644
--- a/meta/recipes-bsp/grub/grub2.inc
+++ b/meta/recipes-bsp/grub/grub2.inc
@@ -71,6 +71,7 @@ CFLAGS:remove = "-O2"
# CFLAGS += -mno-mmx -mno-sse
# So also remove -mfpmath=sse from TUNE_CCARGS
TUNE_CCARGS:remove = "-mfpmath=sse"
+TUNE_CCARGS:append:toolchain-clang = " -fuse-ld=bfd -Wno-error=unused-command-line-argument"
EXTRA_OECONF = "--with-platform=${GRUBPLATFORM} \
--disable-grub-mkfont \
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Patchtest results for [PATCH v2 2/3] kexec-tools: Fix build with LLD linker
2025-09-04 5:15 ` [PATCH v2 2/3] kexec-tools: Fix build with LLD linker Khem Raj
@ 2025-09-04 5:31 ` patchtest
2025-09-04 8:38 ` [OE-core] " Mathieu Dubois-Briand
1 sibling, 0 replies; 5+ messages in thread
From: patchtest @ 2025-09-04 5:31 UTC (permalink / raw)
To: Khem Raj; +Cc: openembedded-core
[-- Attachment #1: Type: text/plain, Size: 2910 bytes --]
Thank you for your submission. Patchtest identified one
or more issues with the patch. Please see the log below for
more information:
---
Testing patch /home/patchtest/share/mboxes/v2-2-3-kexec-tools-Fix-build-with-LLD-linker.patch
FAIL: test commit message presence: Please include a commit message on your patch explaining the change (test_mbox.TestMbox.test_commit_message_presence)
PASS: pretest src uri left files (test_metadata.TestMetadata.pretest_src_uri_left_files)
PASS: test CVE check ignore (test_metadata.TestMetadata.test_cve_check_ignore)
PASS: test CVE tag format (test_patch.TestPatch.test_cve_tag_format)
PASS: test Signed-off-by presence (test_mbox.TestMbox.test_signed_off_by_presence)
PASS: test Signed-off-by presence (test_patch.TestPatch.test_signed_off_by_presence)
PASS: test Upstream-Status presence (test_patch.TestPatch.test_upstream_status_presence_format)
PASS: test author valid (test_mbox.TestMbox.test_author_valid)
PASS: test commit message user tags (test_mbox.TestMbox.test_commit_message_user_tags)
PASS: test lic files chksum modified not mentioned (test_metadata.TestMetadata.test_lic_files_chksum_modified_not_mentioned)
PASS: test max line length (test_metadata.TestMetadata.test_max_line_length)
PASS: test mbox format (test_mbox.TestMbox.test_mbox_format)
PASS: test non-AUH upgrade (test_mbox.TestMbox.test_non_auh_upgrade)
PASS: test shortlog format (test_mbox.TestMbox.test_shortlog_format)
PASS: test shortlog length (test_mbox.TestMbox.test_shortlog_length)
PASS: test src uri left files (test_metadata.TestMetadata.test_src_uri_left_files)
PASS: test target mailing list (test_mbox.TestMbox.test_target_mailing_list)
SKIP: pretest pylint: No python related patches, skipping test (test_python_pylint.PyLint.pretest_pylint)
SKIP: test bugzilla entry format: No bug ID found (test_mbox.TestMbox.test_bugzilla_entry_format)
SKIP: test lic files chksum presence: No added recipes, skipping test (test_metadata.TestMetadata.test_lic_files_chksum_presence)
SKIP: test license presence: No added recipes, skipping test (test_metadata.TestMetadata.test_license_presence)
SKIP: test pylint: No python related patches, skipping test (test_python_pylint.PyLint.test_pylint)
SKIP: test series merge on head: Merge test is disabled for now (test_mbox.TestMbox.test_series_merge_on_head)
SKIP: test summary presence: No added recipes, skipping test (test_metadata.TestMetadata.test_summary_presence)
---
Please address the issues identified and
submit a new revision of the patch, or alternatively, reply to this
email with an explanation of why the patch should be accepted. If you
believe these results are due to an error in patchtest, please submit a
bug at https://bugzilla.yoctoproject.org/ (use the 'Patchtest' category
under 'Yocto Project Subprojects'). For more information on specific
failures, see: https://wiki.yoctoproject.org/wiki/Patchtest. Thank
you!
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [OE-core] [PATCH v2 2/3] kexec-tools: Fix build with LLD linker
2025-09-04 5:15 ` [PATCH v2 2/3] kexec-tools: Fix build with LLD linker Khem Raj
2025-09-04 5:31 ` Patchtest results for " patchtest
@ 2025-09-04 8:38 ` Mathieu Dubois-Briand
1 sibling, 0 replies; 5+ messages in thread
From: Mathieu Dubois-Briand @ 2025-09-04 8:38 UTC (permalink / raw)
To: raj.khem, openembedded-core
On Thu Sep 4, 2025 at 7:15 AM CEST, Khem Raj via lists.openembedded.org wrote:
> Signed-off-by: Khem Raj <raj.khem@gmail.com>
> ---
Hi Khem,
Thanks for the new version.
It looks like the build is failing:
ERROR: kexec-tools-2.0.31-r0 do_compile: Execution of '/srv/pokybuild/yocto-worker/genericx86/build/build/tmp/work/core2-32-poky-linux/kexec-tools/2.0.31/temp/run.do_compile.3699006' failed with exit code 1
...
| i686-poky-linux-ld --sysroot=/srv/pokybuild/yocto-worker/genericx86/build/build/tmp/work/core2-32-poky-linux/kexec-tools/2.0.31/recipe-sysroot -melf_i386 -e _start --image-base=0x10000 -Ttext 0x10000 -o build/lib/kexec-tools/kexec_test kexec_test/kexec_test16.o kexec_test/kexec_test.o
| i686-poky-linux-ld: section .note.gnu.property LMA [000100f4,0001011b] overlaps section .text LMA [00010000,00010e3c]
| make: *** [../sources/kexec-tools-2.0.31/kexec_test/Makefile:38: build/lib/kexec-tools/kexec_test] Error 1
| ERROR: oe_runmake failed
https://autobuilder.yoctoproject.org/valkyrie/#/builders/19/builds/2327
Can you have a look at this please?
Thanks,
Mathieu
--
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2025-09-04 8:38 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-04 5:15 [PATCH v2 1/3] kea: Fix build with clang/libc++ 21 Khem Raj
2025-09-04 5:15 ` [PATCH v2 2/3] kexec-tools: Fix build with LLD linker Khem Raj
2025-09-04 5:31 ` Patchtest results for " patchtest
2025-09-04 8:38 ` [OE-core] " Mathieu Dubois-Briand
2025-09-04 5:15 ` [PATCH v3 3/3] grub,grub-efi: Always use BFD linker with clang Khem Raj
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.