[binutils-gdb/binutils-2_34-branch] PR25477, ld 2.34 tries to load ${prefix}/etc/ld.so.conf

Alan Modra amodra@sourceware.org
Wed Jan 29 10:50:00 GMT 2020


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=c75ee076d203f3755ccb4c48b255fc5920d9b430

commit c75ee076d203f3755ccb4c48b255fc5920d9b430
Author: Alan Modra <amodra@gmail.com>
Date:   Wed Jan 29 10:25:58 2020 +1030

    PR25477, ld 2.34 tries to load ${prefix}/etc/ld.so.conf
    
    	PR 25477
    	* ldelf.c (ldelf_check_ld_so_conf): Add prefix parameter and
    	correct concat.
    	(ldelf_after_open): Add prefix parameter.
    	* ldelf.h (ldelf_after_open): Update prototype.
    	* emultempl/elf.em (gld${EMULATION_NAME}_after_open): Pass $prefix
    	to ldelf_after_open.
    	* Makefile.am: Correct z80 dependencies.
    	* Makefile.in: Regenerate.
    
    (cherry picked from commit ef8f08ca13f6c111cc549a3e13be5c5e2d95ca82)

Diff:
---
 ld/ChangeLog        | 11 +++++++++++
 ld/Makefile.am      |  2 +-
 ld/Makefile.in      |  2 +-
 ld/emultempl/elf.em |  2 +-
 ld/ldelf.c          |  8 ++++----
 ld/ldelf.h          |  2 +-
 6 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/ld/ChangeLog b/ld/ChangeLog
index bcafc94..76df7b0 100644
--- a/ld/ChangeLog
+++ b/ld/ChangeLog
@@ -1,6 +1,17 @@
 2020-01-29  Alan Modra  <amodra@gmail.com>
 
 	Apply from master
+	2020-01-29  Alan Modra  <amodra@gmail.com>
+	PR 25477
+	* ldelf.c (ldelf_check_ld_so_conf): Add prefix parameter and
+	correct concat.
+	(ldelf_after_open): Add prefix parameter.
+	* ldelf.h (ldelf_after_open): Update prototype.
+	* emultempl/elf.em (gld${EMULATION_NAME}_after_open): Pass $prefix
+	to ldelf_after_open.
+	* Makefile.am: Correct z80 dependencies.
+	* Makefile.in: Regenerate.
+
 	2020-01-28  Alan Modra  <amodra@gmail.com>
 	* ldexp.c (fold_name): Don't print bfd_link_hash_lookup failed
 	in first phase.
diff --git a/ld/Makefile.am b/ld/Makefile.am
index 2ed13eb..4a9b840 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -775,6 +775,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xc16xs.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xstormy16.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xtensa.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32z80.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_be.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_fbsd.Pc@am__quote@
@@ -873,7 +874,6 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ez80.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ez8001.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ez8002.Pc@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ez80elf32.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elf.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elf32.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elfb.Pc@am__quote@
diff --git a/ld/Makefile.in b/ld/Makefile.in
index f635845..46d9b14 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -2379,6 +2379,7 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xc16xs.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xstormy16.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32xtensa.Pc@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf32z80.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_be.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_fbsd.Pc@am__quote@
@@ -2477,7 +2478,6 @@ $(ALL_EMULATION_SOURCES) $(ALL_64_EMULATION_SOURCES): $(GEN_DEPENDS)
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ez80.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ez8001.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ez8002.Pc@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ez80elf32.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elf.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elf32.Pc@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eaarch64elfb.Pc@am__quote@
diff --git a/ld/emultempl/elf.em b/ld/emultempl/elf.em
index 9c32397..42c552b 100644
--- a/ld/emultempl/elf.em
+++ b/ld/emultempl/elf.em
@@ -125,7 +125,7 @@ static void
 gld${EMULATION_NAME}_after_open (void)
 {
   ldelf_after_open ($IS_LIBPATH, $IS_NATIVE,
-		    $IS_LINUX_TARGET, $IS_FREEBSD_TARGET, $ELFSIZE);
+		    $IS_LINUX_TARGET, $IS_FREEBSD_TARGET, $ELFSIZE, "$prefix");
 }
 
 EOF
diff --git a/ld/ldelf.c b/ld/ldelf.c
index 6c20fbe..2e27cf4 100644
--- a/ld/ldelf.c
+++ b/ld/ldelf.c
@@ -894,7 +894,7 @@ ldelf_parse_ld_so_conf (struct ldelf_ld_so_conf *info, const char *filename)
 
 static bfd_boolean
 ldelf_check_ld_so_conf (const struct bfd_link_needed_list *l, int force,
-			int elfsize)
+			int elfsize, const char *prefix)
 {
   static bfd_boolean initialized;
   static const char *ld_so_conf;
@@ -907,7 +907,7 @@ ldelf_check_ld_so_conf (const struct bfd_link_needed_list *l, int force,
 
       info.path = NULL;
       info.len = info.alloc = 0;
-      tmppath = concat (ld_sysroot, "${prefix}/etc/ld.so.conf",
+      tmppath = concat (ld_sysroot, prefix, "/etc/ld.so.conf",
 			(const char *) NULL);
       if (!ldelf_parse_ld_so_conf (&info, tmppath))
 	{
@@ -986,7 +986,7 @@ ldelf_check_needed (lang_input_statement_type *s)
 
 void
 ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd,
-		  int elfsize)
+		  int elfsize, const char *prefix)
 {
   struct bfd_link_needed_list *needed, *l;
   struct elf_link_hash_table *htab;
@@ -1260,7 +1260,7 @@ ldelf_after_open (int use_libpath, int native, int is_linux, int is_freebsd,
 		break;
 
 	      if (is_linux
-		  && ldelf_check_ld_so_conf (l, force, elfsize))
+		  && ldelf_check_ld_so_conf (l, force, elfsize, prefix))
 		break;
 	    }
 
diff --git a/ld/ldelf.h b/ld/ldelf.h
index baf5183..492649b 100644
--- a/ld/ldelf.h
+++ b/ld/ldelf.h
@@ -22,7 +22,7 @@ extern const char *ldelf_emit_note_gnu_build_id;
 
 extern void ldelf_after_parse (void);
 extern bfd_boolean ldelf_load_symbols (lang_input_statement_type *);
-extern void ldelf_after_open (int, int, int, int, int);
+extern void ldelf_after_open (int, int, int, int, int, const char *);
 extern bfd_boolean ldelf_setup_build_id (bfd *);
 extern void ldelf_append_to_separated_string (char **, char *);
 extern void ldelf_before_allocation (char *, char *, const char *);



More information about the Binutils-cvs mailing list