diff --git a/repos/ports/ports/binutils.hash b/repos/ports/ports/binutils.hash index 75c4123199..088fa952bb 100644 --- a/repos/ports/ports/binutils.hash +++ b/repos/ports/ports/binutils.hash @@ -1 +1 @@ -72d94ea55bccc7631054aea3008472a290ecb255 +8168bb385105edb070c5003e00510db6a77dba6e diff --git a/repos/ports/src/noux-pkg/binutils/patches/lib_name_patterns.patch b/repos/ports/src/noux-pkg/binutils/patches/lib_name_patterns.patch new file mode 100644 index 0000000000..490e827d42 --- /dev/null +++ b/repos/ports/src/noux-pkg/binutils/patches/lib_name_patterns.patch @@ -0,0 +1,99 @@ +lib_name_patterns.patch + +From: Christian Prochaska + + +--- + ld/ldelf.c | 15 ++++++++++++++- + ld/ldfile.c | 24 ++++++++++++++++++++---- + 2 files changed, 34 insertions(+), 5 deletions(-) + +diff --git a/ld/ldelf.c b/ld/ldelf.c +index eff6693e..cfc2a32a 100644 +--- a/ld/ldelf.c ++++ b/ld/ldelf.c +@@ -1942,7 +1942,7 @@ ldelf_open_dynamic_archive (const char *arch, search_dirs_type *search, + { + size_t xlen = 0; + +- len += strlen (arch) + sizeof "/lib.so"; ++ len += strlen (arch) + sizeof "/lib.lib.so"; + #ifdef EXTRA_SHLIB_EXTENSION + xlen = (strlen (EXTRA_SHLIB_EXTENSION) > 3 + ? strlen (EXTRA_SHLIB_EXTENSION) - 3 +@@ -1950,6 +1950,19 @@ ldelf_open_dynamic_archive (const char *arch, search_dirs_type *search, + #endif + string = (char *) xmalloc (len + xlen); + sprintf (string, "%s/lib%s%s.so", search->name, filename, arch); ++ ++ opened = ldfile_try_open_bfd (string, entry); ++ ++ /* search for Genode libraries */ ++ ++ if (!opened) { ++ sprintf (string, "%s/%s.lib.so", search->name, filename); ++ opened = ldfile_try_open_bfd (string, entry); ++ } ++ ++ if (!opened) ++ sprintf (string, "%s/lib%s.lib.so", search->name, filename); ++ + #ifdef EXTRA_SHLIB_EXTENSION + /* Try the .so extension first. If that fails build a new filename + using EXTRA_SHLIB_EXTENSION. */ +diff --git a/ld/ldfile.c b/ld/ldfile.c +index b8fd4e5d..0dfc3944 100644 +--- a/ld/ldfile.c ++++ b/ld/ldfile.c +@@ -369,8 +369,19 @@ ldfile_open_file_search (const char *arch, + } + + if (entry->flags.maybe_archive && !entry->flags.full_name_provided) +- string = concat (search->name, slash, lib, entry->filename, +- arch, suffix, (const char *) NULL); ++ { ++ string = concat (search->name, slash, "", entry->filename, ++ arch, suffix, (const char *) NULL); ++ ++ if (ldfile_try_open_bfd (string, entry)) ++ { ++ entry->filename = string; ++ return true; ++ } ++ ++ string = concat (search->name, slash, lib, entry->filename, ++ arch, suffix, (const char *) NULL); ++ } + else + string = concat (search->name, slash, entry->filename, + (const char *) 0); +@@ -437,6 +448,11 @@ ldfile_open_file (lang_input_statement_type *entry) + /* Try to open or lib.a. */ + for (arch = search_arch_head; arch != NULL; arch = arch->next) + { ++ /* try to open Genode library */ ++ found = ldfile_open_file_search (arch->name, entry, "lib", ".lib.a"); ++ if (found) ++ break; ++ /* original code */ + found = ldfile_open_file_search (arch->name, entry, "lib", ".a"); + if (found) + break; +@@ -496,7 +512,7 @@ ldfile_open_file (lang_input_statement_type *entry) + #endif + else + einfo (_("%P: cannot find %s: %E\n"), entry->local_sym_name); +- ++#if 0 + /* PR 25747: Be kind to users who forgot to add the + "lib" prefix to their library when it was created. */ + for (arch = search_arch_head; arch != NULL; arch = arch->next) +@@ -512,7 +528,7 @@ ldfile_open_file (lang_input_statement_type *entry) + break; + } + } +- ++#endif + entry->flags.missing_file = true; + input_flags.missing_file = true; + } diff --git a/repos/ports/src/noux-pkg/binutils/patches/series b/repos/ports/src/noux-pkg/binutils/patches/series index b4d92b5827..f09993da3d 100644 --- a/repos/ports/src/noux-pkg/binutils/patches/series +++ b/repos/ports/src/noux-pkg/binutils/patches/series @@ -2,3 +2,4 @@ bfd.patch merge_sections.patch arm.patch riscv.patch +lib_name_patterns.patch