* [PATCH] hosttools: force a --no-rosegment option if host ld supports it
@ 2026-02-06 13:28 Alexander Kanavin
2026-02-06 13:46 ` [OE-core] " Paul Barker
0 siblings, 1 reply; 2+ messages in thread
From: Alexander Kanavin @ 2026-02-06 13:28 UTC (permalink / raw)
To: openembedded-core; +Cc: Alexander Kanavin
From: Alexander Kanavin <alex@linutronix.de>
Please see https://bugzilla.yoctoproject.org/show_bug.cgi?id=16087
for the tricky, unpleasant details. This is addressing an issue with
recent Fedora distributions where they can contaminate sstate with
native executables that don't work when transferred onto alma/rocky 8/9.
[YOCTO #16087]
Signed-off-by: Alexander Kanavin <alex@linutronix.de>
---
meta/classes-global/base.bbclass | 21 ++++++++++++++++++++-
1 file changed, 20 insertions(+), 1 deletion(-)
diff --git a/meta/classes-global/base.bbclass b/meta/classes-global/base.bbclass
index cf303c237a..22b427a521 100644
--- a/meta/classes-global/base.bbclass
+++ b/meta/classes-global/base.bbclass
@@ -111,6 +111,22 @@ def get_lic_checksum_file_list(d):
bb.fatal(d.getVar('PN') + ": LIC_FILES_CHKSUM contains an invalid URL: " + url)
return " ".join(filelist)
+# Please see https://bugzilla.yoctoproject.org/show_bug.cgi?id=16087 for details
+# This can be removed after host distributions with kernels < 5.18
+# (e.g. rhel 8/9 and derivatives) are taken out of testing and support.
+def write_ld_wrapper(srctool, desttool):
+ wrapper = "#!/bin/sh\n{} --no-rosegment $@".format(srctool)
+
+ stdout, _ = bb.process.run("{} --help".format(srctool))
+ if "--no-rosegment" in stdout:
+ with open(desttool, 'w') as f:
+ f.write(wrapper)
+ import stat
+ st = os.stat(desttool)
+ os.chmod(desttool, st.st_mode | stat.S_IEXEC)
+ else:
+ os.symlink(srctool, desttool)
+
def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
tools = d.getVar(toolsvar).split()
origbbenv = d.getVar("BB_ORIGENV", False)
@@ -139,7 +155,10 @@ def setup_hosttools_dir(dest, toolsvar, d, fatal=True):
if os.path.islink(srctool) and os.path.basename(os.readlink(srctool)) == 'ccache':
srctool = bb.utils.which(path, tool, executable=True, direction=1)
if srctool:
- os.symlink(srctool, desttool)
+ if tool == "ld" or tool.startswith("ld."):
+ write_ld_wrapper(srctool, desttool)
+ else:
+ os.symlink(srctool, desttool)
else:
notfound.append(tool)
--
2.47.3
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [OE-core] [PATCH] hosttools: force a --no-rosegment option if host ld supports it
2026-02-06 13:28 [PATCH] hosttools: force a --no-rosegment option if host ld supports it Alexander Kanavin
@ 2026-02-06 13:46 ` Paul Barker
0 siblings, 0 replies; 2+ messages in thread
From: Paul Barker @ 2026-02-06 13:46 UTC (permalink / raw)
To: alex.kanavin, openembedded-core; +Cc: Alexander Kanavin
[-- Attachment #1: Type: text/plain, Size: 1204 bytes --]
On Fri, 2026-02-06 at 14:28 +0100, Alexander Kanavin via
lists.openembedded.org wrote:
> From: Alexander Kanavin <alex@linutronix.de>
>
> Please see https://bugzilla.yoctoproject.org/show_bug.cgi?id=16087
> for the tricky, unpleasant details. This is addressing an issue with
> recent Fedora distributions where they can contaminate sstate with
> native executables that don't work when transferred onto alma/rocky 8/9.
>
> [YOCTO #16087]
Hi Alex,
Thanks for working on this, we really appreciate the time is has taken
to investigate!
I think we need a little more detail in the commit message so that it is
understandable if the bugzilla data is ever not accessible. Perhaps just
something along the lines of:
From Fedora 42 onwards, the --rosegment argument is passed to the
linker by default when building native binaries. This triggers
re-arrangement of sections by patchelf, resulting in binaries which
are loaded incorrectly by older kernel versions. These "contaminated"
native binaries end up in sstate and cause build failures when they
are used on older distros such as AlmaLinux 8 & 9 or Rocky Linux 8 &
9.
Best regards,
--
Paul Barker
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-02-06 13:46 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-06 13:28 [PATCH] hosttools: force a --no-rosegment option if host ld supports it Alexander Kanavin
2026-02-06 13:46 ` [OE-core] " Paul Barker
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox