blob: 1871fbc79946a761ce06e6a62a06b00b41ffc63b [file] [log] [blame]
Andrew Geisslerc5535c92023-01-27 16:10:19 -06001From 9a296e537708296d32c07c1dc681f59de3d1acf9 Mon Sep 17 00:00:00 2001
Patrick Williams92b42cb2022-09-03 06:53:57 -05002From: Khem Raj <raj.khem@gmail.com>
3Date: Thu, 10 Mar 2022 21:21:33 -0800
4Subject: [PATCH] Only generate an RPATH entry if LD_RUN_PATH is not empty
5
6for cases where -rpath isn't specified. debian (#151024)
7
8Upstream-Status: Pending
9
10Signed-off-by: Chris Chimelis <chris@debian.org>
11Signed-off-by: Khem Raj <raj.khem@gmail.com>
12---
13 ld/ldelf.c | 5 +++++
14 1 file changed, 5 insertions(+)
15
16diff --git a/ld/ldelf.c b/ld/ldelf.c
Andrew Geisslerc5535c92023-01-27 16:10:19 -060017index 95787012b89..bc29909386f 100644
Patrick Williams92b42cb2022-09-03 06:53:57 -050018--- 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)