All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 1/3] libxcrypt: Allow undefined symbols in version scripts with lld linker
@ 2025-08-12  5:13 Khem Raj
  2025-08-12  5:13 ` [PATCH v2 2/3] zlib: Always use GNU ld for linking Khem Raj
  2025-08-12  5:13 ` [PATCH 3/3] libtirpc: Fix version scripts to work with lld linker Khem Raj
  0 siblings, 2 replies; 4+ messages in thread
From: Khem Raj @ 2025-08-12  5:13 UTC (permalink / raw)
  To: openembedded-core; +Cc: Khem Raj

Unlike GNU ld, LLD defaults to erroring about undefined version symbols
add commandline parameter to sush lld here

Fixes
| x86_64-yoesdk-linux-ld.lld: error: version script assignment of 'XCRYPT_2.0' to symbol 'crypt_gensalt_r' failed: symbol not defined
| x86_64-yoesdk-linux-ld.lld: error: version script assignment of 'XCRYPT_2.0' to symbol 'xcrypt' failed: symbol not defined
| x86_64-yoesdk-linux-ld.lld: error: version script assignment of 'XCRYPT_2.0' to symbol 'xcrypt_gensalt' failed: symbol not defined
| x86_64-yoesdk-linux-ld.lld: error: version script assignment of 'XCRYPT_2.0' to symbol 'xcrypt_gensalt_r' failed: symbol not defined
| x86_64-yoesdk-linux-ld.lld: error: version script assignment of 'XCRYPT_2.0' to symbol 'xcrypt_r' failed: symbol not defined
| x86_64-yoesdk-linux-clang: error: linker command failed with exit code 1 (use -v to see invocation)

LLD has stricter defaults and strict symbol versioning enforcement.
LLD requires that all symbols
referenced in version scripts actually exist in the object files being
linked Same errors/behavior can be
seen with GNU linker as well if we add -Wl,--undefined-version to LDFLAGS
GNU linker chooses to be a bit lenient with defaults.

Having LLD to lower its barrier does not change the output it
produces, it's the same as GNU ld

This is known issue seen with other distros e.g. NixOS upstream [1]

[1] https://github.com/besser82/libxcrypt/issues/181

Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
v2: Add upstream defect information

 meta/recipes-core/libxcrypt/libxcrypt.inc | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/meta/recipes-core/libxcrypt/libxcrypt.inc b/meta/recipes-core/libxcrypt/libxcrypt.inc
index 77fec832348..da515d19270 100644
--- a/meta/recipes-core/libxcrypt/libxcrypt.inc
+++ b/meta/recipes-core/libxcrypt/libxcrypt.inc
@@ -24,3 +24,5 @@ API = "--disable-obsolete-api"
 EXTRA_OECONF += "${API}"
 
 BBCLASSEXTEND = "native nativesdk"
+# Needed until https://github.com/besser82/libxcrypt/issues/181 is addressed
+LDFLAGS += "${@bb.utils.contains('DISTRO_FEATURES', 'ld-is-lld', '-Wl,--undefined-version', '', d)}"


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-12 11:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-12  5:13 [PATCH v2 1/3] libxcrypt: Allow undefined symbols in version scripts with lld linker Khem Raj
2025-08-12  5:13 ` [PATCH v2 2/3] zlib: Always use GNU ld for linking Khem Raj
2025-08-12  5:13 ` [PATCH 3/3] libtirpc: Fix version scripts to work with lld linker Khem Raj
2025-08-12 11:41   ` [OE-core] " Mathieu Dubois-Briand

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.