916730425594 ("elf: Add elf_backend_add_glibc_version_dependency")
introduced adding an extra GLIBC_2.36 version dependency for x86_64. But
on x86_64 GNU/Hurd, there has never been a glibc 2.36 port, and thus the
GLIBC_2.36 version is not defined. The additional version dependency is
thus spurious and produces binaries that cannot be executed:

./test: /lib/x86_64-gnu/libc.so.0.3: version `GLIBC_2.36' not found (required 
by ./test)

This change fixes this by adding the version dependency only on x86_64
Linux.
diff --git a/bfd/elf64-x86-64.c b/bfd/elf64-x86-64.c
index 60aa1802552..8cdb0d3eef7 100644
--- a/bfd/elf64-x86-64.c
+++ b/bfd/elf64-x86-64.c
@@ -5694,12 +5694,14 @@ elf_x86_64_add_glibc_version_dependency
       i++;
     }
 
+#ifdef __linux__
   htab = elf_x86_hash_table (rinfo->info, X86_64_ELF_DATA);
   if (htab != NULL && htab->params->mark_plt)
     {
       version[i] = "GLIBC_2.36";
       i++;
     }
+#endif
 
   if (i != 0)
     _bfd_elf_link_add_glibc_version_dependency (rinfo, version);

Reply via email to