Andrew Geissler | c5535c9 | 2023-01-27 16:10:19 -0600 | [diff] [blame^] | 1 | From 9a296e537708296d32c07c1dc681f59de3d1acf9 Mon Sep 17 00:00:00 2001 |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 10 Mar 2022 21:21:33 -0800 |
| 4 | Subject: [PATCH] Only generate an RPATH entry if LD_RUN_PATH is not empty |
| 5 | |
| 6 | for cases where -rpath isn't specified. debian (#151024) |
| 7 | |
| 8 | Upstream-Status: Pending |
| 9 | |
| 10 | Signed-off-by: Chris Chimelis <chris@debian.org> |
| 11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 12 | --- |
| 13 | ld/ldelf.c | 5 +++++ |
| 14 | 1 file changed, 5 insertions(+) |
| 15 | |
| 16 | diff --git a/ld/ldelf.c b/ld/ldelf.c |
Andrew Geissler | c5535c9 | 2023-01-27 16:10:19 -0600 | [diff] [blame^] | 17 | index 95787012b89..bc29909386f 100644 |
Patrick Williams | 92b42cb | 2022-09-03 06:53:57 -0500 | [diff] [blame] | 18 | --- a/ld/ldelf.c |
| 19 | +++ b/ld/ldelf.c |
| 20 | @@ -1127,6 +1127,9 @@ ldelf_handle_dt_needed (struct elf_link_hash_table *htab, |
| 21 | && command_line.rpath == NULL) |
| 22 | { |
| 23 | path = (const char *) getenv ("LD_RUN_PATH"); |
| 24 | + if ((path) && (strlen (path) == 0)) |
| 25 | + path = NULL; |
| 26 | + |
| 27 | if (path |
| 28 | && ldelf_search_needed (path, &n, force, |
| 29 | is_linux, elfsize)) |
| 30 | @@ -1801,6 +1804,8 @@ ldelf_before_allocation (char *audit, char *depaudit, |
| 31 | rpath = command_line.rpath; |
| 32 | if (rpath == NULL) |
| 33 | rpath = (const char *) getenv ("LD_RUN_PATH"); |
| 34 | + if ((rpath) && (strlen (rpath) == 0)) |
| 35 | + rpath = NULL; |
| 36 | |
| 37 | for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next) |
| 38 | if (bfd_get_flavour (abfd) == bfd_target_elf_flavour) |