blob: caa5f0bdd3b748fb0ea01b93c614aee3b0499fe1 [file] [log] [blame]
Andrew Geisslerd1e89492021-02-12 15:35:20 -06001From 8ad249270414a23a3e65c74fd67a8e4adaebec78 Mon Sep 17 00:00:00 2001
Andrew Geissler82c905d2020-04-13 13:39:40 -05002From: Khem Raj <raj.khem@gmail.com>
3Date: Mon, 2 Mar 2015 01:27:17 +0000
Andrew Geisslerd1e89492021-02-12 15:35:20 -06004Subject: [PATCH] Only generate an RPATH entry if LD_RUN_PATH is not empty
Andrew Geissler82c905d2020-04-13 13:39:40 -05005
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 | 4 ++++
14 1 file changed, 4 insertions(+)
15
16diff --git a/ld/ldelf.c b/ld/ldelf.c
Andrew Geisslerd1e89492021-02-12 15:35:20 -060017index b25781cc0c4..77d7fb8ff03 100644
Andrew Geissler82c905d2020-04-13 13:39:40 -050018--- a/ld/ldelf.c
19+++ b/ld/ldelf.c
Andrew Geisslerd1e89492021-02-12 15:35:20 -060020@@ -1248,6 +1248,8 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd,
Andrew Geissler82c905d2020-04-13 13:39:40 -050021 && command_line.rpath == NULL)
22 {
23 path = (const char *) getenv ("LD_RUN_PATH");
24+ if ((path) && (strlen (path) == 0))
25+ path = NULL;
26 if (path
27 && ldelf_search_needed (path, &n, force,
28 is_linux, elfsize))
Andrew Geisslerd1e89492021-02-12 15:35:20 -060029@@ -1608,6 +1610,8 @@ ldelf_before_allocation (char *audit, char *depaudit,
Andrew Geissler82c905d2020-04-13 13:39:40 -050030 rpath = command_line.rpath;
31 if (rpath == NULL)
32 rpath = (const char *) getenv ("LD_RUN_PATH");
33+ if ((rpath) && (strlen (rpath) == 0))
34+ rpath = NULL;
35
36 for (abfd = link_info.input_bfds; abfd; abfd = abfd->link.next)
37 if (bfd_get_flavour (abfd) == bfd_target_elf_flavour)