Files
gentoo/sys-devel/binutils/files/binutils-2.40-linker-search-path.patch
James Le Cuirot 6010348df4 sys-devel/binutils: Drop ld.so.conf prefix patch and enable -L patch for cross
The ld.so.conf prefix patch didn't work in all the cases we needed it to. We'll
fix the issue with /usr/etc/ld.so.conf via env-update instead.

The -L patch was previously only applied to prefixed systems, but it's needed to
fix crossdev environments too. We should probably just take it into the general
patchset.

Bug: https://bugs.gentoo.org/892549
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2023-10-01 15:08:05 +01:00

39 lines
1.6 KiB
Diff

https://bugs.gentoo.org/892549
https://github.com/gentoo/binutils-gdb/pull/4
From 1601840f9f2397edd56177871527a198a14277bd Mon Sep 17 00:00:00 2001
From: James Le Cuirot <chewi@gentoo.org>
Date: Sat, 11 Feb 2023 15:15:20 +0000
Subject: [PATCH 1/2] ldelf.c: Always consider -L arguments when handling
DT_NEEDED
This is for consistency with other linkers, including gold. Without
this, we typically rely on ld.so.conf to find libraries such as
libstdc++.so.6, while other linkers do not use this file at all.
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -1090,8 +1090,8 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab,
linker will search. That means that we want to use
rpath_link, rpath, then the environment variable
LD_LIBRARY_PATH (native only), then the DT_RPATH/DT_RUNPATH
- entries (native only), then the linker script LIB_SEARCH_DIRS.
- We do not search using the -L arguments.
+ entries (native only), then the linker script LIB_SEARCH_DIRS,
+ then the -L arguments.
We search twice. The first time, we skip objects which may
introduce version mismatches. The second time, we force
@@ -1165,11 +1165,7 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab,
len = strlen (l->name);
for (search = search_head; search != NULL; search = search->next)
{
- char *filename;
-
- if (search->cmdline)
- continue;
- filename = (char *) xmalloc (strlen (search->name) + len + 2);
+ char *filename = (char *) xmalloc (strlen (search->name) + len + 2);
sprintf (filename, "%s/%s", search->name, l->name);
nn.name = filename;
if (ldelf_try_needed (&nn, force, is_linux))