From: Adhemerval Zanella Date: Mon, 24 Mar 2025 18:04:04 +0000 (-0300) Subject: Enable --no-undefined-version by default X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=94aa80daac28e5ec1c62218b3a5f6604e4374c5e;p=thirdparty%2Fglibc.git Enable --no-undefined-version by default Recent lld version default to --no-undefined-version, which triggers errors when building multiple libraries. For ld.so on x86_64 it fails with: ld.lld: error: version script assignment of 'GLIBC_2.4' to symbol '__stack_chk_guard' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_PRIVATE' to symbol '__nptl_set_robust_list_avail' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_PRIVATE' to symbol '__pointer_chk_guard' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_PRIVATE' to symbol '_dl_starting_up' failed: symbol not defined While for libc.so: ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_clearerr' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fgetc' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fileno' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_freopen' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fscanf' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_fseek' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_peekc_unlocked' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_stderr_' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_stdin_' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_stdout_' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_pclose' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_perror' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_rewind' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_scanf' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_setbuf' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_setlinebuf' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_wdefault_setbuf' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '_IO_wfile_setbuf' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '__ctype32_tolower' failed: symbol not defined ld.lld: error: version script assignment of 'GLIBC_2.17' to symbol '__ctype32_toupper' failed: symbol not defined ld.lld: error: too many errors emitted, stopping now (use --error-limit=0 to see all errors) The version script is created with multiple missing symbols to simplify the build for multiple ABIs, each of which may have different symbols. For instance, __stack_chk_guard is defined by default. This avoids requiring each ABI to add this symbol to its version script, depending on the stack protector ABI it uses. The libc.so warnings do show unused symbols being defined (like _IO_clearerr), which might trigger potential errors depending on how symbols are exported. However, since we already have ABI checks for missing and extra symbols, the linker's extra checks are not really necessary. The --no-undefined-version is the default for ld.bfd. --- diff --git a/Makerules b/Makerules index 7714888cdc..caa1e43faa 100644 --- a/Makerules +++ b/Makerules @@ -508,7 +508,9 @@ ifeq ($(build-shared),yes) map-file = $(firstword $($(@F:.so=-map)) \ $(addprefix $(common-objpfx), \ $(filter $(@F:.so=.map),$(version-maps)))) -load-map-file = $(map-file:%=-Wl,--version-script=%) +# The map version is created with multiple symbols that might not be +# exported depending of the ABI. +load-map-file = $(map-file:%=-Wl,--version-script=%) -Wl,--undefined-version endif # Compiler arguments to use to link a shared object with libc and