public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 0/5] More features cleanups
@ 2022-08-02 14:59 Adhemerval Zanella
  2022-08-02 14:59 ` [PATCH 1/5] Remove missing LD_LIBRARY_VERSION usages Adhemerval Zanella
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Adhemerval Zanella @ 2022-08-02 14:59 UTC (permalink / raw)
  To: libc-alpha

This patchset continue the old features cleanup started on previous
releases, like libc4/libc5 and prelink support.

Adhemerval Zanella (4):
  Remove missing LD_LIBRARY_VERSION usages
  Remove ldd libc4 support
  arm: Remove RELA support
  i386: Remove RELA support

Lucas A. M. Magalhaes (1):
  Assume only FLAG_ELF_LIBC6 suport

 Makeconfig                                    |   4 +-
 elf/cache.c                                   |   6 +-
 elf/ldconfig.c                                |  63 +-----
 elf/readelflib.c                              |  46 +----
 elf/readlib.c                                 |  25 +--
 sysdeps/arm/dl-machine-rel.h                  |   7 +-
 sysdeps/arm/dl-machine.h                      | 100 ---------
 sysdeps/i386/dl-machine-rel.h                 |   7 +-
 sysdeps/i386/dl-machine.h                     | 191 ------------------
 sysdeps/unix/sysv/linux/Makefile              |   2 -
 sysdeps/unix/sysv/linux/aarch64/ldconfig.h    |  30 ---
 sysdeps/unix/sysv/linux/arc/ldconfig.h        |  27 ---
 sysdeps/unix/sysv/linux/arm/ldconfig.h        |  25 ---
 sysdeps/unix/sysv/linux/csky/configure        |   1 -
 sysdeps/unix/sysv/linux/csky/configure.ac     |   1 -
 sysdeps/unix/sysv/linux/csky/ldconfig.h       |  34 ----
 sysdeps/unix/sysv/linux/i386/Makefile         |   5 -
 sysdeps/unix/sysv/linux/i386/configure        |   1 -
 sysdeps/unix/sysv/linux/i386/configure.ac     |   1 -
 sysdeps/unix/sysv/linux/i386/ldconfig.h       |   6 -
 sysdeps/unix/sysv/linux/ia64/ldconfig.h       |  24 ---
 sysdeps/unix/sysv/linux/ldd-rewrite.sed       |  11 -
 sysdeps/unix/sysv/linux/lddlibc4.c            | 104 ----------
 sysdeps/unix/sysv/linux/m68k/Makefile         |   4 -
 sysdeps/unix/sysv/linux/m68k/configure        |   1 -
 sysdeps/unix/sysv/linux/m68k/configure.ac     |   1 -
 sysdeps/unix/sysv/linux/m68k/ldconfig.h       |   1 -
 .../unix/sysv/linux/mips/mips64/ldconfig.h    |  25 ---
 sysdeps/unix/sysv/linux/powerpc/ldconfig.h    |  27 ---
 .../unix/sysv/linux/powerpc/ldd-rewrite.sed   |   3 -
 sysdeps/unix/sysv/linux/riscv/ldconfig.h      |  36 ----
 sysdeps/unix/sysv/linux/s390/ldconfig.h       |   7 -
 sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed  |   3 -
 sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed |   2 -
 .../unix/sysv/linux/sparc/sparc32/Makefile    |   2 -
 sysdeps/unix/sysv/linux/x86_64/ldconfig.h     |  26 ---
 .../unix/sysv/linux/x86_64/ldd-rewrite.sed    |   2 -
 37 files changed, 18 insertions(+), 843 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/arc/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/arm/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/csky/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/ia64/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/ldd-rewrite.sed
 delete mode 100644 sysdeps/unix/sysv/linux/lddlibc4.c
 delete mode 100644 sysdeps/unix/sysv/linux/m68k/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/riscv/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/x86_64/ldconfig.h

-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/5] Remove missing LD_LIBRARY_VERSION usages
  2022-08-02 14:59 [PATCH 0/5] More features cleanups Adhemerval Zanella
@ 2022-08-02 14:59 ` Adhemerval Zanella
  2022-08-02 15:11   ` Andreas Schwab
  2022-08-02 14:59 ` [PATCH 2/5] Assume only FLAG_ELF_LIBC6 suport Adhemerval Zanella
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Adhemerval Zanella @ 2022-08-02 14:59 UTC (permalink / raw)
  To: libc-alpha

The environment variable was removed by
d2db60d8d830ef68c8d20a77ac3572d610aa40b1.
---
 sysdeps/unix/sysv/linux/ldd-rewrite.sed         | 1 -
 sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed | 3 ---
 sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed    | 3 ---
 sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed   | 2 --
 sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed  | 2 --
 5 files changed, 11 deletions(-)

diff --git a/sysdeps/unix/sysv/linux/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/ldd-rewrite.sed
index 7b8b6bdee0..1faa90fbc8 100644
--- a/sysdeps/unix/sysv/linux/ldd-rewrite.sed
+++ b/sysdeps/unix/sysv/linux/ldd-rewrite.sed
@@ -8,4 +8,3 @@
   fi\
   # In case of an error punt.
 /LD_TRACE_LOADED_OBJECTS=1/a\
-add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out"
diff --git a/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed
index 9039b69548..74bdbd9659 100644
--- a/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed
+++ b/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed
@@ -1,6 +1,3 @@
-/LD_TRACE_LOADED_OBJECTS=1/a\
-add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out"
-
 # ldd is generated from elf/ldd.bash.in with the name
 # of ld.so as generated in Makeconfig
 
diff --git a/sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed
index 6b4f1bfcad..ea2b5a05cf 100644
--- a/sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed
+++ b/sysdeps/unix/sysv/linux/s390/ldd-rewrite.sed
@@ -1,6 +1,3 @@
-/LD_TRACE_LOADED_OBJECTS=1/a\
-add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out"
-
 # ldd is generated from elf/ldd.bash.in with the name
 # of ld.so as generated in Makeconfig
 
diff --git a/sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed
index 7dc2698fa8..3ec8f49f42 100644
--- a/sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed
+++ b/sysdeps/unix/sysv/linux/sparc/ldd-rewrite.sed
@@ -1,3 +1 @@
-/LD_TRACE_LOADED_OBJECTS=1/a\
-add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out"
 s_^\(RTLDLIST=\)\(.*lib\)\(\|64\)\(/[^/]*\.so\.[0-9.]*\)[ 	]*$_\1"\2\4 \264\4"_
diff --git a/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
index 44d76e8aa1..49c0c7a3a8 100644
--- a/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
+++ b/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed
@@ -1,3 +1 @@
-/LD_TRACE_LOADED_OBJECTS=1/a\
-add_env="$add_env LD_LIBRARY_VERSION=\\$verify_out"
 s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|x32\)\(/[^/]*\)\(-x86-64\|-x32\)\(\.so\.[0-9.]*\)[ 	]*$_\1"\2\4\6 \264\4-x86-64\6 \2x32\4-x32\6"_
-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 2/5] Assume only FLAG_ELF_LIBC6 suport
  2022-08-02 14:59 [PATCH 0/5] More features cleanups Adhemerval Zanella
  2022-08-02 14:59 ` [PATCH 1/5] Remove missing LD_LIBRARY_VERSION usages Adhemerval Zanella
@ 2022-08-02 14:59 ` Adhemerval Zanella
  2023-12-07 13:14   ` Alexander Monakov
  2022-08-02 14:59 ` [PATCH 3/5] Remove ldd libc4 support Adhemerval Zanella
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 14+ messages in thread
From: Adhemerval Zanella @ 2022-08-02 14:59 UTC (permalink / raw)
  To: libc-alpha

From: "Lucas A. M. Magalhaes" <lamm@linux.ibm.com>

The older libc versions are obsolete for over twenty years now.
This patch removes the special flags for libc5 and libc4 and assumes
that all libraries cached are libc6 compatible and use FLAG_ELF_LIBC6.

Checked with a build for all affected architectures.

Co-authored-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
---
 elf/cache.c                                   |  6 +-
 elf/ldconfig.c                                | 63 ++-----------------
 elf/readelflib.c                              | 46 ++------------
 elf/readlib.c                                 | 25 +-------
 sysdeps/unix/sysv/linux/aarch64/ldconfig.h    | 30 ---------
 sysdeps/unix/sysv/linux/arc/ldconfig.h        | 27 --------
 sysdeps/unix/sysv/linux/arm/ldconfig.h        | 25 --------
 sysdeps/unix/sysv/linux/csky/ldconfig.h       | 34 ----------
 sysdeps/unix/sysv/linux/i386/ldconfig.h       |  6 --
 sysdeps/unix/sysv/linux/ia64/ldconfig.h       | 24 -------
 sysdeps/unix/sysv/linux/m68k/ldconfig.h       |  1 -
 .../unix/sysv/linux/mips/mips64/ldconfig.h    | 25 --------
 sysdeps/unix/sysv/linux/powerpc/ldconfig.h    | 27 --------
 sysdeps/unix/sysv/linux/riscv/ldconfig.h      | 36 -----------
 sysdeps/unix/sysv/linux/s390/ldconfig.h       |  7 ---
 sysdeps/unix/sysv/linux/x86_64/ldconfig.h     | 26 --------
 16 files changed, 14 insertions(+), 394 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/aarch64/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/arc/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/arm/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/csky/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/ia64/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/m68k/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/powerpc/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/riscv/ldconfig.h
 delete mode 100644 sysdeps/unix/sysv/linux/x86_64/ldconfig.h

diff --git a/elf/cache.c b/elf/cache.c
index 3d7d3a67bf..f5f3ef8c4d 100644
--- a/elf/cache.c
+++ b/elf/cache.c
@@ -157,6 +157,7 @@ struct cache_entry
 /* List of all cache entries.  */
 static struct cache_entry *entries;
 
+/* libc4, ELF and libc5 are unsupported.  */
 static const char *flag_descr[] =
 { "libc4", "ELF", "libc5", "libc6"};
 
@@ -168,14 +169,11 @@ print_entry (const char *lib, int flag, uint64_t hwcap,
   printf ("\t%s (", lib);
   switch (flag & FLAG_TYPE_MASK)
     {
-    case FLAG_LIBC4:
-    case FLAG_ELF:
-    case FLAG_ELF_LIBC5:
     case FLAG_ELF_LIBC6:
       fputs (flag_descr[flag & FLAG_TYPE_MASK], stdout);
       break;
     default:
-      fputs (_("unknown"), stdout);
+      fputs (_("unknown or unsupported flag"), stdout);
       break;
     }
   switch (flag & FLAG_REQUIRED_MASK)
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 9394ac6438..6f37f38f35 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -65,19 +65,6 @@
 
 #define PACKAGE _libc_intl_domainname
 
-static const struct
-{
-  const char *name;
-  int flag;
-} lib_types[] =
-{
-  {"libc4", FLAG_LIBC4},
-  {"libc5", FLAG_ELF_LIBC5},
-  {"libc6", FLAG_ELF_LIBC6},
-  {"glibc2", FLAG_ELF_LIBC6}
-};
-
-
 /* List of directories to handle.  */
 struct dir_entry
 {
@@ -469,27 +456,8 @@ add_dir_1 (const char *line, const char *from_file, int from_line)
   entry->from_file = strdup (from_file);
   entry->from_line = from_line;
 
-  /* Search for an '=' sign.  */
   entry->path = xstrdup (line);
-  char *equal_sign = strchr (entry->path, '=');
-  if (equal_sign)
-    {
-      *equal_sign = '\0';
-      ++equal_sign;
-      entry->flag = FLAG_ANY;
-      for (i = 0; i < sizeof (lib_types) / sizeof (lib_types[0]); ++i)
-	if (strcmp (equal_sign, lib_types[i].name) == 0)
-	  {
-	    entry->flag = lib_types[i].flag;
-	    break;
-	  }
-      if (entry->flag == FLAG_ANY)
-	error (0, 0, _("%s is not a known library type"), equal_sign);
-    }
-  else
-    {
-      entry->flag = FLAG_ANY;
-    }
+  entry->flag = FLAG_ELF_LIBC6;
 
   /* Canonify path: for now only remove leading and trailing
      whitespace and the trailing slashes.  */
@@ -1054,23 +1022,11 @@ search_dir (const struct dir_entry *entry)
 	  soname = xstrdup (direntry->d_name);
 	}
 
-      if (flag == FLAG_ELF
-	  && (entry->flag == FLAG_ELF_LIBC5
-	      || entry->flag == FLAG_ELF_LIBC6))
-	flag = entry->flag;
-
       /* Some sanity checks to print warnings.  */
       if (opt_verbose)
 	{
-	  if (flag == FLAG_ELF_LIBC5 && entry->flag != FLAG_ELF_LIBC5
-	      && entry->flag != FLAG_ANY)
-	    error (0, 0, _("libc5 library %s in wrong directory"), file_name);
-	  if (flag == FLAG_ELF_LIBC6 && entry->flag != FLAG_ELF_LIBC6
-	      && entry->flag != FLAG_ANY)
+	  if (flag == FLAG_ELF_LIBC6 && entry->flag != FLAG_ELF_LIBC6)
 	    error (0, 0, _("libc6 library %s in wrong directory"), file_name);
-	  if (flag == FLAG_LIBC4 && entry->flag != FLAG_LIBC4
-	      && entry->flag != FLAG_ANY)
-	    error (0, 0, _("libc4 library %s in wrong directory"), file_name);
 	}
 
       /* Add library to list.  */
@@ -1089,19 +1045,8 @@ search_dir (const struct dir_entry *entry)
 		  /* It's newer - add it.  */
 		  /* Flag should be the same - sanity check.  */
 		  if (dlib_ptr->flag != flag)
-		    {
-		      if (dlib_ptr->flag == FLAG_ELF
-			  && (flag == FLAG_ELF_LIBC5 || flag == FLAG_ELF_LIBC6))
-			dlib_ptr->flag = flag;
-		      else if ((dlib_ptr->flag == FLAG_ELF_LIBC5
-				|| dlib_ptr->flag == FLAG_ELF_LIBC6)
-			       && flag == FLAG_ELF)
-			dlib_ptr->flag = flag;
-		      else
-			error (0, 0, _("libraries %s and %s in directory %s have same soname but different type."),
-			       dlib_ptr->name, direntry->d_name,
-			       entry->path);
-		    }
+		    error (0, 0, _("libraries %s and %s in directory %s have same soname but different type."),
+			   dlib_ptr->name, direntry->d_name, entry->path);
 		  free (dlib_ptr->name);
 		  dlib_ptr->name = xstrdup (direntry->d_name);
 		  dlib_ptr->is_link = is_link;
diff --git a/elf/readelflib.c b/elf/readelflib.c
index 771182b5d0..5f43e0230d 100644
--- a/elf/readelflib.c
+++ b/elf/readelflib.c
@@ -44,7 +44,6 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 		  size_t file_length)
 {
   int i;
-  unsigned int j;
   unsigned int dynamic_addr;
   size_t dynamic_size;
   char *program_interpreter;
@@ -81,9 +80,8 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
   elf_pheader = (ElfW(Phdr) *) (elf_header->e_phoff + file_contents);
   check_ptr (elf_pheader);
 
-  /* The library is an elf library, now search for soname and
-     libc5/libc6.  */
-  *flag = FLAG_ELF;
+  /* The library is an elf library.  */
+  *flag = FLAG_ELF_LIBC6;
 
   /* The default ISA level is 0.  */
   *isa_level = 0;
@@ -110,16 +108,6 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
 	  program_interpreter = (char *) (file_contents + segment->p_offset);
 	  check_ptr (program_interpreter);
 
-	  /* Check if this is enough to classify the binary.  */
-	  for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]);
-	       ++j)
-	    if (strcmp (program_interpreter, interpreters[j].soname) == 0)
-	      {
-		*flag = interpreters[j].flag;
-		break;
-	      }
-	  break;
-
 	case PT_GNU_PROPERTY:
 	  /* The NT_GNU_PROPERTY_TYPE_0 note must be aligned to 4 bytes
 	     in 32-bit objects and to 8 bytes in 64-bit objects.  Skip
@@ -244,38 +232,16 @@ done:
   if (dynamic_strings == NULL)
     return 1;
 
-  /* Now read the DT_NEEDED and DT_SONAME entries.  */
+  /* Now read the DT_SONAME entries.  */
   for (dyn_entry = dynamic_segment; dyn_entry->d_tag != DT_NULL;
        ++dyn_entry)
     {
-      if (dyn_entry->d_tag == DT_NEEDED || dyn_entry->d_tag == DT_SONAME)
+      if (dyn_entry->d_tag == DT_SONAME)
 	{
 	  char *name = dynamic_strings + dyn_entry->d_un.d_val;
 	  check_ptr (name);
-
-	  if (dyn_entry->d_tag == DT_NEEDED)
-	    {
-
-	      if (*flag == FLAG_ELF)
-		{
-		  /* Check if this is enough to classify the binary.  */
-		  for (j = 0;
-		       j < sizeof (known_libs) / sizeof (known_libs [0]);
-		       ++j)
-		    if (strcmp (name, known_libs [j].soname) == 0)
-		      {
-			*flag = known_libs [j].flag;
-			break;
-		      }
-		}
-	    }
-
-	  else if (dyn_entry->d_tag == DT_SONAME)
-	    *soname = xstrdup (name);
-
-	  /* Do we have everything we need?  */
-	  if (*soname && *flag != FLAG_ELF)
-	    return 0;
+          *soname = xstrdup (name);
+          return 0;
 	}
     }
 
diff --git a/elf/readlib.c b/elf/readlib.c
index ed42fbd48e..be65e3d0e9 100644
--- a/elf/readlib.c
+++ b/elf/readlib.c
@@ -43,24 +43,6 @@ struct known_names
   int flag;
 };
 
-static struct known_names interpreters[] =
-{
-  { "/lib/" LD_SO, FLAG_ELF_LIBC6 },
-#ifdef SYSDEP_KNOWN_INTERPRETER_NAMES
-  SYSDEP_KNOWN_INTERPRETER_NAMES
-#endif
-};
-
-static struct known_names known_libs[] =
-{
-  { LIBC_SO, FLAG_ELF_LIBC6 },
-  { LIBM_SO, FLAG_ELF_LIBC6 },
-#ifdef SYSDEP_KNOWN_LIBRARY_NAMES
-  SYSDEP_KNOWN_LIBRARY_NAMES
-#endif
-};
-
-
 /* Check if string corresponds to a GDB Python file.  */
 static bool
 is_gdb_python_file (const char *name)
@@ -83,7 +65,8 @@ process_file (const char *real_file_name, const char *file_name,
   struct exec *aout_header;
 
   ret = 0;
-  *flag = FLAG_ANY;
+  /* Just set FLAG_ELF_LIBC6 as old formats are not supported anymore.  */
+  *flag = FLAG_ELF_LIBC6;
   *soname = NULL;
 
   file = fopen (real_file_name, "rb");
@@ -150,7 +133,6 @@ process_file (const char *real_file_name, const char *file_name,
 	    *dot = '\0';
 	}
       *soname = copy;
-      *flag = FLAG_LIBC4;
       goto done;
     }
 
@@ -191,9 +173,6 @@ implicit_soname (const char *lib, int flag)
 {
   char *soname = xstrdup (lib);
 
-  if ((flag & FLAG_TYPE_MASK) != FLAG_LIBC4)
-    return soname;
-
   /* Aout files don't have a soname, just return the name
      including the major number.  */
   char *major = strstr (soname, ".so.");
diff --git a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h b/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
deleted file mode 100644
index 5cbfb32714..0000000000
--- a/sysdeps/unix/sysv/linux/aarch64/ldconfig.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 2009-2022 Free Software Foundation, Inc.
-
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public License as
-   published by the Free Software Foundation; either version 2.1 of the
-   License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib/ld-linux-aarch64.so.1", FLAG_ELF_LIBC6 }, \
-  { "/lib/ld-linux-aarch64_be.so.1", FLAG_ELF_LIBC6 }, \
-  { "/lib/ld-linux-aarch64_ilp32.so.1", FLAG_ELF_LIBC6 }, \
-  { "/lib/ld-linux-aarch64_be_ilp32.so.1", FLAG_ELF_LIBC6 }, \
-  { "/lib/ld-linux.so.3", FLAG_ELF_LIBC6 }, \
-  { "/lib/ld-linux-armhf.so.3", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/arc/ldconfig.h b/sysdeps/unix/sysv/linux/arc/ldconfig.h
deleted file mode 100644
index f673170e59..0000000000
--- a/sysdeps/unix/sysv/linux/arc/ldconfig.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* ldconfig default paths and libraries.  Linux/RISC-V version.
-   Copyright (C) 2020-2022 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES 		\
-  { "/lib/ld-linux-arc.so.2", FLAG_ELF_LIBC6 },	\
-  { "/lib/ld-linux-arceb.so.2", FLAG_ELF_LIBC6 },
-
-#define SYSDEP_KNOWN_LIBRARY_NAMES 	\
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/arm/ldconfig.h b/sysdeps/unix/sysv/linux/arm/ldconfig.h
deleted file mode 100644
index d1253993ea..0000000000
--- a/sysdeps/unix/sysv/linux/arm/ldconfig.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib/ld-linux.so.3", FLAG_ELF_LIBC6 }, \
-  { "/lib/ld-linux-armhf.so.3", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/csky/ldconfig.h b/sysdeps/unix/sysv/linux/csky/ldconfig.h
deleted file mode 100644
index fbe17e3dc8..0000000000
--- a/sysdeps/unix/sysv/linux/csky/ldconfig.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* ldconfig default paths and libraries.  Linux/C-SKY version.
-   Copyright (C) 2018-2022 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#define LD_SO_PREFIX "/lib/ld-linux-"
-#define LD_SO_SUFFIX ".so.1"
-
-#ifdef __CSKY_HARD_FLOAT__
-# define LD_SO_ABI "cskyv2-hf"
-#else
-# define LD_SO_ABI "cskyv2"
-#endif
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES	\
-  { LD_SO_PREFIX LD_SO_ABI LD_SO_SUFFIX, FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES	\
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/i386/ldconfig.h b/sysdeps/unix/sysv/linux/i386/ldconfig.h
index bafbec1231..9afda09cca 100644
--- a/sysdeps/unix/sysv/linux/i386/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/i386/ldconfig.h
@@ -16,9 +16,3 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib/ld-linux.so.1", FLAG_ELF_LIBC5 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.5", FLAG_ELF_LIBC5 },	\
-  { "libm.so.5", FLAG_ELF_LIBC5 },
diff --git a/sysdeps/unix/sysv/linux/ia64/ldconfig.h b/sysdeps/unix/sysv/linux/ia64/ldconfig.h
deleted file mode 100644
index 4731419bf8..0000000000
--- a/sysdeps/unix/sysv/linux/ia64/ldconfig.h
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/m68k/ldconfig.h b/sysdeps/unix/sysv/linux/m68k/ldconfig.h
deleted file mode 100644
index 953f192bcd..0000000000
--- a/sysdeps/unix/sysv/linux/m68k/ldconfig.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <sysdeps/unix/sysv/linux/i386/ldconfig.h>
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h b/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
deleted file mode 100644
index ac82941aff..0000000000
--- a/sysdeps/unix/sysv/linux/mips/mips64/ldconfig.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib32/ld.so.1", FLAG_ELF_LIBC6 }, \
-  { "/lib64/ld.so.1", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/powerpc/ldconfig.h b/sysdeps/unix/sysv/linux/powerpc/ldconfig.h
deleted file mode 100644
index 1d70657838..0000000000
--- a/sysdeps/unix/sysv/linux/powerpc/ldconfig.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* ldconfig default paths and libraries.  Linux/PowerPC version.
-   Copyright (C) 2002-2022 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib/ld.so.1", FLAG_ELF_LIBC6 },	\
-  { "/lib64/ld64.so.1", FLAG_ELF_LIBC6 }, \
-  { "/lib64/ld64.so.2", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/riscv/ldconfig.h b/sysdeps/unix/sysv/linux/riscv/ldconfig.h
deleted file mode 100644
index e3847f116e..0000000000
--- a/sysdeps/unix/sysv/linux/riscv/ldconfig.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* ldconfig default paths and libraries.  Linux/RISC-V version.
-   Copyright (C) 2001-2022 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library.  If not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#define LD_SO_PREFIX "/lib/ld-linux-"
-#define LD_SO_SUFFIX ".so.1"
-
-#if __riscv_xlen == 64
-# define LD_SO_ABI "riscv64-lp64"
-#else
-# define LD_SO_ABI "riscv32-ilp32"
-#endif
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES				\
-  { LD_SO_PREFIX LD_SO_ABI "d" LD_SO_SUFFIX, FLAG_ELF_LIBC6 },	\
-  { LD_SO_PREFIX LD_SO_ABI     LD_SO_SUFFIX, FLAG_ELF_LIBC6 },
-
-#define SYSDEP_KNOWN_LIBRARY_NAMES	\
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/s390/ldconfig.h b/sysdeps/unix/sysv/linux/s390/ldconfig.h
index f564a6eaf6..9afda09cca 100644
--- a/sysdeps/unix/sysv/linux/s390/ldconfig.h
+++ b/sysdeps/unix/sysv/linux/s390/ldconfig.h
@@ -16,10 +16,3 @@
    <https://www.gnu.org/licenses/>.  */
 
 #include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib/ld.so.1", FLAG_ELF_LIBC6 },	\
-  { "/lib/ld64.so.1", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
diff --git a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h b/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
deleted file mode 100644
index b67203e017..0000000000
--- a/sysdeps/unix/sysv/linux/x86_64/ldconfig.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/* Copyright (C) 2001-2022 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-#include <sysdeps/generic/ldconfig.h>
-
-#define SYSDEP_KNOWN_INTERPRETER_NAMES \
-  { "/lib/ld-linux.so.2", FLAG_ELF_LIBC6 }, \
-  { "/libx32/ld-linux-x32.so.2", FLAG_ELF_LIBC6 }, \
-  { "/lib64/ld-linux-x86-64.so.2", FLAG_ELF_LIBC6 },
-#define SYSDEP_KNOWN_LIBRARY_NAMES \
-  { "libc.so.6", FLAG_ELF_LIBC6 },	\
-  { "libm.so.6", FLAG_ELF_LIBC6 },
-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 3/5] Remove ldd libc4 support
  2022-08-02 14:59 [PATCH 0/5] More features cleanups Adhemerval Zanella
  2022-08-02 14:59 ` [PATCH 1/5] Remove missing LD_LIBRARY_VERSION usages Adhemerval Zanella
  2022-08-02 14:59 ` [PATCH 2/5] Assume only FLAG_ELF_LIBC6 suport Adhemerval Zanella
@ 2022-08-02 14:59 ` Adhemerval Zanella
  2022-08-02 23:35   ` H.J. Lu
  2022-08-02 14:59 ` [PATCH 4/5] arm: Remove RELA support Adhemerval Zanella
  2022-08-02 14:59 ` [PATCH 5/5] i386: " Adhemerval Zanella
  4 siblings, 1 reply; 14+ messages in thread
From: Adhemerval Zanella @ 2022-08-02 14:59 UTC (permalink / raw)
  To: libc-alpha

The older libc versions are obsolete for over twenty years now.
---
 Makeconfig                                    |   4 +-
 sysdeps/unix/sysv/linux/Makefile              |   2 -
 sysdeps/unix/sysv/linux/csky/configure        |   1 -
 sysdeps/unix/sysv/linux/csky/configure.ac     |   1 -
 sysdeps/unix/sysv/linux/i386/Makefile         |   5 -
 sysdeps/unix/sysv/linux/i386/configure        |   1 -
 sysdeps/unix/sysv/linux/i386/configure.ac     |   1 -
 sysdeps/unix/sysv/linux/ldd-rewrite.sed       |  10 --
 sysdeps/unix/sysv/linux/lddlibc4.c            | 104 ------------------
 sysdeps/unix/sysv/linux/m68k/Makefile         |   4 -
 sysdeps/unix/sysv/linux/m68k/configure        |   1 -
 sysdeps/unix/sysv/linux/m68k/configure.ac     |   1 -
 .../unix/sysv/linux/sparc/sparc32/Makefile    |   2 -
 13 files changed, 2 insertions(+), 135 deletions(-)
 delete mode 100644 sysdeps/unix/sysv/linux/ldd-rewrite.sed
 delete mode 100644 sysdeps/unix/sysv/linux/lddlibc4.c

diff --git a/Makeconfig b/Makeconfig
index ba70321af1..e78cf220af 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -866,7 +866,7 @@ endif
 +extra-math-flags = $(if $(filter libm,$(in-module)),-fno-math-errno,-fmath-errno)
 
 # Use 64 bit time_t support for installed programs
-installed-modules = nonlib nscd lddlibc4 ldconfig locale_programs \
+installed-modules = nonlib nscd ldconfig locale_programs \
 		    iconvprogs libnss_files libnss_compat libnss_db libnss_hesiod \
 		    libutil libpcprofile libSegFault
 +extra-time-flags = $(if $(filter $(installed-modules),\
@@ -966,7 +966,7 @@ endif	# $(+cflags) == ""
 libio-include = -I$(..)libio
 
 # List of non-library modules that we build.
-built-modules = iconvprogs iconvdata ldconfig lddlibc4 libmemusage \
+built-modules = iconvprogs iconvdata ldconfig libmemusage \
 		libSegFault libpcprofile librpcsvc locale-programs \
 		memusagestat nonlib nscd extramodules libnldbl libsupport \
 		testsuite testsuite-internal
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index a139a16532..3f31c19e4a 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -393,8 +393,6 @@ endif
 ifeq ($(subdir),elf)
 sysdep-rtld-routines += dl-brk dl-sbrk dl-getcwd dl-openat64 dl-opendir
 
-libof-lddlibc4 = lddlibc4
-
 others += pldd
 install-bin += pldd
 $(objpfx)pldd: $(objpfx)xmalloc.o
diff --git a/sysdeps/unix/sysv/linux/csky/configure b/sysdeps/unix/sysv/linux/csky/configure
index 20dc0df8e6..b36cee5b7b 100644
--- a/sysdeps/unix/sysv/linux/csky/configure
+++ b/sysdeps/unix/sysv/linux/csky/configure
@@ -2,4 +2,3 @@
  # Local configure fragment for sysdeps/unix/sysv/linux/csky
 
 arch_minimum_kernel=4.20.0
-ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
diff --git a/sysdeps/unix/sysv/linux/csky/configure.ac b/sysdeps/unix/sysv/linux/csky/configure.ac
index 89448969d4..efcd375cd2 100644
--- a/sysdeps/unix/sysv/linux/csky/configure.ac
+++ b/sysdeps/unix/sysv/linux/csky/configure.ac
@@ -2,4 +2,3 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 # Local configure fragment for sysdeps/unix/sysv/linux/csky
 
 arch_minimum_kernel=4.20.0
-ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
index 598e27dcda..f1f8c3f44c 100644
--- a/sysdeps/unix/sysv/linux/i386/Makefile
+++ b/sysdeps/unix/sysv/linux/i386/Makefile
@@ -7,11 +7,6 @@ sysdep_routines += ioperm iopl vm86
 tests += tst-bz21269
 endif
 
-ifeq ($(subdir),elf)
-sysdep-others += lddlibc4
-install-bin += lddlibc4
-endif
-
 ifeq ($(subdir),io)
 sysdep_routines += libc-do-syscall libc-do-syscall-int80
 endif
diff --git a/sysdeps/unix/sysv/linux/i386/configure b/sysdeps/unix/sysv/linux/i386/configure
index f119e62fc3..351d82355a 100644
--- a/sysdeps/unix/sysv/linux/i386/configure
+++ b/sysdeps/unix/sysv/linux/i386/configure
@@ -2,4 +2,3 @@
  # Local configure fragment for sysdeps/unix/sysv/linux/i386.
 
 libc_cv_gcc_unwind_find_fde=yes
-ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
diff --git a/sysdeps/unix/sysv/linux/i386/configure.ac b/sysdeps/unix/sysv/linux/i386/configure.ac
index 64ab2cc2c8..61c04f2f49 100644
--- a/sysdeps/unix/sysv/linux/i386/configure.ac
+++ b/sysdeps/unix/sysv/linux/i386/configure.ac
@@ -2,4 +2,3 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
 # Local configure fragment for sysdeps/unix/sysv/linux/i386.
 
 libc_cv_gcc_unwind_find_fde=yes
-ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
diff --git a/sysdeps/unix/sysv/linux/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/ldd-rewrite.sed
deleted file mode 100644
index 1faa90fbc8..0000000000
--- a/sysdeps/unix/sysv/linux/ldd-rewrite.sed
+++ /dev/null
@@ -1,10 +0,0 @@
-/Maybe extra code for non-ELF binaries/a\
-  file=$1\
-  # Run the ldd stub.\
-  lddlibc4 "$file"\
-  # Test the result.\
-  if test $? -lt 3; then\
-    return 0;\
-  fi\
-  # In case of an error punt.
-/LD_TRACE_LOADED_OBJECTS=1/a\
diff --git a/sysdeps/unix/sysv/linux/lddlibc4.c b/sysdeps/unix/sysv/linux/lddlibc4.c
deleted file mode 100644
index 153d2ad183..0000000000
--- a/sysdeps/unix/sysv/linux/lddlibc4.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* Stub for ldd script to print Linux libc4 dependencies.
-   Copyright (C) 1998-2022 Free Software Foundation, Inc.
-   This file is part of the GNU C Library.
-
-   The GNU C Library is free software; you can redistribute it and/or
-   modify it under the terms of the GNU Lesser General Public
-   License as published by the Free Software Foundation; either
-   version 2.1 of the License, or (at your option) any later version.
-
-   The GNU C Library is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public
-   License along with the GNU C Library; if not, see
-   <https://www.gnu.org/licenses/>.  */
-
-/* This code is based on the `ldd' program code from the Linux ld.so
-   package.  */
-
-#include <a.out.h>
-#include <errno.h>
-#include <error.h>
-#include <libintl.h>
-#include <locale.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-/* Get libc version number.  */
-#include "../version.h"
-
-#define PACKAGE _libc_intl_domainname
-
-
-int
-main (int argc, char *argv[])
-{
-  const char *filename;
-  size_t filename_len;
-  struct exec exec;
-  char *buf;
-  FILE *fp;
-
-  /* Set locale via LC_ALL.  */
-  setlocale (LC_ALL, "");
-
-  /* Set the text message domain.  */
-  textdomain (PACKAGE);
-
-  /* We expect exactly one argument.  */
-  if (argc != 2)
-    return 1;
-
-  if (strcmp (argv[1], "--help") == 0)
-    {
-      printf (gettext ("Usage: lddlibc4 FILE\n\n"));
-      printf (gettext ("For bug reporting instructions, please see:\n\
-%s.\n"), REPORT_BUGS_TO);
-      return 0;
-    }
-  else if (strcmp (argv[1], "--version") == 0)
-    {
-      printf ("lddlibc4 %s%s\n", PKGVERSION, VERSION);
-      printf (gettext ("\
-Copyright (C) %s Free Software Foundation, Inc.\n\
-This is free software; see the source for copying conditions.  There is NO\n\
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
-"), "2022");
-      return 0;
-    }
-
-  filename = argv[1];
-
-  /* First see whether this is really an a.out binary.  */
-  fp = fopen (filename, "rb");
-  if (fp == NULL)
-    error (2, errno, gettext ("cannot open `%s'"), filename);
-
-  /* Read the program header.  */
-  if (fread (&exec, sizeof exec, 1, fp) < 1)
-    error (2, errno, gettext ("cannot read header from `%s'"), filename);
-
-  /* Test for the magic numbers.  */
-  if (N_MAGIC (exec) != ZMAGIC && N_MAGIC (exec) != QMAGIC
-      && N_MAGIC (exec) != OMAGIC)
-    exit (3);
-
-  /* We don't need the file open anymore.  */
-  fclose (fp);
-
-  /* We must put `__LDD_ARGV0=<program-name>' in the environment.  */
-  filename_len = strlen (filename);
-  buf = (char *) alloca (sizeof "__LDD_ARGV0=" + filename_len);
-  mempcpy (mempcpy (buf, "__LDD_ARGV0=", sizeof "__LDD_ARGV0=" - 1),
-	   filename, filename_len + 1);
-  /* ...and put the value in the environment.  */
-  putenv (buf);
-
-  /* Now we can execute the binary.  */
-  return execv (filename, &argv[argc]) ? 4 : 0;
-}
diff --git a/sysdeps/unix/sysv/linux/m68k/Makefile b/sysdeps/unix/sysv/linux/m68k/Makefile
index 18ad2bf0ee..72d5bff992 100644
--- a/sysdeps/unix/sysv/linux/m68k/Makefile
+++ b/sysdeps/unix/sysv/linux/m68k/Makefile
@@ -16,7 +16,3 @@ sysdep_routines += mremap
 sysdep_headers += sys/reg.h
 endif
 
-ifeq ($(subdir),elf)
-sysdep-others += lddlibc4
-install-bin += lddlibc4
-endif
diff --git a/sysdeps/unix/sysv/linux/m68k/configure b/sysdeps/unix/sysv/linux/m68k/configure
index 8e955387b7..aa295f80cb 100644
--- a/sysdeps/unix/sysv/linux/m68k/configure
+++ b/sysdeps/unix/sysv/linux/m68k/configure
@@ -6,4 +6,3 @@ m68k/coldfire)
   libc_cv_gcc_unwind_find_fde=yes
   ;;
 esac
-ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
diff --git a/sysdeps/unix/sysv/linux/m68k/configure.ac b/sysdeps/unix/sysv/linux/m68k/configure.ac
index c21ca9dd47..0e547f2f2e 100644
--- a/sysdeps/unix/sysv/linux/m68k/configure.ac
+++ b/sysdeps/unix/sysv/linux/m68k/configure.ac
@@ -7,4 +7,3 @@ m68k/coldfire)
   libc_cv_gcc_unwind_find_fde=yes
   ;;
 esac
-ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
index 21c7dc1680..167307cc78 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
@@ -13,8 +13,6 @@ endif
 ifeq ($(subdir),elf)
 CFLAGS-rtld.c += -mcpu=v8
 #rtld-routines += dl-sysdepsparc
-sysdep-others += lddlibc4
-install-bin += lddlibc4
 endif   # elf
 
 ifeq ($(subdir),math)
-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 4/5] arm: Remove RELA support
  2022-08-02 14:59 [PATCH 0/5] More features cleanups Adhemerval Zanella
                   ` (2 preceding siblings ...)
  2022-08-02 14:59 ` [PATCH 3/5] Remove ldd libc4 support Adhemerval Zanella
@ 2022-08-02 14:59 ` Adhemerval Zanella
  2022-08-03 18:31   ` Adhemerval Zanella Netto
  2022-08-02 14:59 ` [PATCH 5/5] i386: " Adhemerval Zanella
  4 siblings, 1 reply; 14+ messages in thread
From: Adhemerval Zanella @ 2022-08-02 14:59 UTC (permalink / raw)
  To: libc-alpha

Now that prelink is not support, there is no need to keep supporting
rela for non bootstrap.
---
 sysdeps/arm/dl-machine-rel.h |   7 +--
 sysdeps/arm/dl-machine.h     | 100 -----------------------------------
 2 files changed, 1 insertion(+), 106 deletions(-)

diff --git a/sysdeps/arm/dl-machine-rel.h b/sysdeps/arm/dl-machine-rel.h
index 999967931b..9dfaf718f2 100644
--- a/sysdeps/arm/dl-machine-rel.h
+++ b/sysdeps/arm/dl-machine-rel.h
@@ -19,13 +19,8 @@
 #ifndef _DL_MACHINE_REL_H
 #define _DL_MACHINE_REL_H
 
-/* ARM never uses Elf32_Rela relocations for the dynamic linker.
-   Prelinked libraries may use Elf32_Rela though.  */
-#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
+#define ELF_MACHINE_NO_RELA 1
 #define ELF_MACHINE_NO_REL 0
-
-/* ARM never uses Elf32_Rela relocations for the dynamic linker.
-   Prelinked libraries may use Elf32_Rela though.  */
 #define ELF_MACHINE_PLT_REL 1
 
 #define PLTREL ElfW(Rel)
diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
index 6a422713bd..4e78d8fb0e 100644
--- a/sysdeps/arm/dl-machine.h
+++ b/sysdeps/arm/dl-machine.h
@@ -447,96 +447,6 @@ elf_machine_rel (struct link_map *map, struct r_scope_elem *scope[],
     }
 }
 
-# ifndef RTLD_BOOTSTRAP
-static inline void
-__attribute__ ((always_inline))
-elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
-                  const Elf32_Rela *reloc, const Elf32_Sym *sym,
-                  const struct r_found_version *version,
-		  void *const reloc_addr_arg, int skip_ifunc)
-{
-  Elf32_Addr *const reloc_addr = reloc_addr_arg;
-  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
-
-  if (__builtin_expect (r_type == R_ARM_RELATIVE, 0))
-    *reloc_addr = map->l_addr + reloc->r_addend;
-  else if (__builtin_expect (r_type == R_ARM_NONE, 0))
-    return;
-  else
-    {
-      const Elf32_Sym *const refsym = sym;
-      struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, r_type);
-      Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true);
-
-      if (sym != NULL
-	  && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0)
-	  && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1)
-	  && __builtin_expect (!skip_ifunc, 1))
-	value = elf_ifunc_invoke (value);
-
-      switch (r_type)
-	{
-	  /* Not needed for dl-conflict.c.  */
-	case R_ARM_COPY:
-	  if (sym == NULL)
-	    /* This can happen in trace mode if an object could not be
-	       found.  */
-	    break;
-	  if (sym->st_size > refsym->st_size
-	      || (GLRO(dl_verbose) && sym->st_size < refsym->st_size))
-	    {
-	      const char *strtab;
-
-	      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
-	      _dl_error_printf ("\
-%s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				RTLD_PROGNAME, strtab + refsym->st_name);
-	    }
-	  memcpy (reloc_addr_arg, (void *) value,
-		  MIN (sym->st_size, refsym->st_size));
-	  break;
-	case R_ARM_GLOB_DAT:
-	case R_ARM_JUMP_SLOT:
-	case R_ARM_ABS32:
-	  *reloc_addr = value + reloc->r_addend;
-	  break;
-	case R_ARM_PC24:
-          relocate_pc24 (map, value, reloc_addr, reloc->r_addend);
-	  break;
-#if !defined RTLD_BOOTSTRAP
-	case R_ARM_TLS_DTPMOD32:
-	  /* Get the information from the link map returned by the
-	     resolv function.  */
-	  if (sym_map != NULL)
-	    *reloc_addr = sym_map->l_tls_modid;
-	  break;
-
-	case R_ARM_TLS_DTPOFF32:
-	  *reloc_addr = (sym == NULL ? 0 : sym->st_value) + reloc->r_addend;
-	  break;
-
-	case R_ARM_TLS_TPOFF32:
-	  if (sym != NULL)
-	    {
-	      CHECK_STATIC_TLS (map, sym_map);
-	      *reloc_addr = (sym->st_value + sym_map->l_tls_offset
-			     + reloc->r_addend);
-	    }
-	  break;
-	case R_ARM_IRELATIVE:
-	  value = map->l_addr + reloc->r_addend;
-	  if (__glibc_likely (!skip_ifunc))
-	    value = ((Elf32_Addr (*) (int)) value) (GLRO(dl_hwcap));
-	  *reloc_addr = value;
-	  break;
-#endif
-	default:
-	  _dl_reloc_bad_type (map, r_type, 0);
-	  break;
-	}
-    }
-}
-# endif
 
 static inline void
 __attribute__ ((always_inline))
@@ -547,16 +457,6 @@ elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc,
   *reloc_addr += l_addr;
 }
 
-# ifndef RTLD_BOOTSTRAP
-static inline void
-__attribute__ ((always_inline))
-elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
-			   void *const reloc_addr_arg)
-{
-  Elf32_Addr *const reloc_addr = reloc_addr_arg;
-  *reloc_addr = l_addr + reloc->r_addend;
-}
-# endif
 
 static inline void
 __attribute__ ((always_inline))
-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 5/5] i386: Remove RELA support
  2022-08-02 14:59 [PATCH 0/5] More features cleanups Adhemerval Zanella
                   ` (3 preceding siblings ...)
  2022-08-02 14:59 ` [PATCH 4/5] arm: Remove RELA support Adhemerval Zanella
@ 2022-08-02 14:59 ` Adhemerval Zanella
  2022-08-02 15:13   ` H.J. Lu
  4 siblings, 1 reply; 14+ messages in thread
From: Adhemerval Zanella @ 2022-08-02 14:59 UTC (permalink / raw)
  To: libc-alpha

Now that prelink is not support, there is no need to keep supporting
rela for non bootstrap.
---
 sysdeps/i386/dl-machine-rel.h |   7 +-
 sysdeps/i386/dl-machine.h     | 191 ----------------------------------
 2 files changed, 1 insertion(+), 197 deletions(-)

diff --git a/sysdeps/i386/dl-machine-rel.h b/sysdeps/i386/dl-machine-rel.h
index b98273aead..9dfaf718f2 100644
--- a/sysdeps/i386/dl-machine-rel.h
+++ b/sysdeps/i386/dl-machine-rel.h
@@ -19,13 +19,8 @@
 #ifndef _DL_MACHINE_REL_H
 #define _DL_MACHINE_REL_H
 
-/* The i386 never uses Elf32_Rela relocations for the dynamic linker.
-   Prelinked libraries may use Elf32_Rela though.  */
-#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
+#define ELF_MACHINE_NO_RELA 1
 #define ELF_MACHINE_NO_REL 0
-
-/* The i386 never uses Elf32_Rela relocations for the dynamic linker.
-   Prelinked libraries may use Elf32_Rela though.  */
 #define ELF_MACHINE_PLT_REL 1
 
 #define PLTREL ElfW(Rel)
diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
index 56a189fda2..64aad6e787 100644
--- a/sysdeps/i386/dl-machine.h
+++ b/sysdeps/i386/dl-machine.h
@@ -437,153 +437,6 @@ and creates an unsatisfiable circular dependency.\n",
     }
 }
 
-# ifndef RTLD_BOOTSTRAP
-static inline void
-__attribute__ ((always_inline))
-elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
-		  const Elf32_Rela *reloc, const Elf32_Sym *sym,
-		  const struct r_found_version *version,
-		  void *const reloc_addr_arg, int skip_ifunc)
-{
-  Elf32_Addr *const reloc_addr = reloc_addr_arg;
-  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
-
-  if (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE)
-    *reloc_addr = map->l_addr + reloc->r_addend;
-  else if (r_type != R_386_NONE)
-    {
-      const Elf32_Sym *const refsym = sym;
-      struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version,
-					      r_type);
-      Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true);
-
-      if (sym != NULL
-	  && __glibc_likely (sym->st_shndx != SHN_UNDEF)
-	  && __glibc_unlikely (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC)
-	  && __glibc_likely (!skip_ifunc))
-	value = ((Elf32_Addr (*) (void)) value) ();
-
-      switch (ELF32_R_TYPE (reloc->r_info))
-	{
-	case R_386_SIZE32:
-	  /* Set to symbol size plus addend.  */
-	  value = sym->st_size;
-	  /* Fall through.  */
-	case R_386_GLOB_DAT:
-	case R_386_JMP_SLOT:
-	case R_386_32:
-	  *reloc_addr = value + reloc->r_addend;
-	  break;
-	  /* Not needed for dl-conflict.c.  */
-	case R_386_PC32:
-	  *reloc_addr = (value + reloc->r_addend - (Elf32_Addr) reloc_addr);
-	  break;
-
-	case R_386_TLS_DTPMOD32:
-	  /* Get the information from the link map returned by the
-	     resolv function.  */
-	  if (sym_map != NULL)
-	    *reloc_addr = sym_map->l_tls_modid;
-	  break;
-	case R_386_TLS_DTPOFF32:
-	  /* During relocation all TLS symbols are defined and used.
-	     Therefore the offset is already correct.  */
-	  *reloc_addr = (sym == NULL ? 0 : sym->st_value) + reloc->r_addend;
-	  break;
-	case R_386_TLS_DESC:
-	  {
-	    struct tlsdesc volatile *td =
-	      (struct tlsdesc volatile *)reloc_addr;
-
-#  ifndef RTLD_BOOTSTRAP
-	    if (!sym)
-	      {
-		td->arg = (void*)reloc->r_addend;
-		td->entry = _dl_tlsdesc_undefweak;
-	      }
-	    else
-#  endif
-	      {
-#  ifndef RTLD_BOOTSTRAP
-#   ifndef SHARED
-		CHECK_STATIC_TLS (map, sym_map);
-#   else
-		if (!TRY_STATIC_TLS (map, sym_map))
-		  {
-		    td->arg = _dl_make_tlsdesc_dynamic
-		      (sym_map, sym->st_value + reloc->r_addend);
-		    td->entry = _dl_tlsdesc_dynamic;
-		  }
-		else
-#   endif
-#  endif
-		  {
-		    td->arg = (void*)(sym->st_value - sym_map->l_tls_offset
-				      + reloc->r_addend);
-		    td->entry = _dl_tlsdesc_return;
-		  }
-	      }
-	  }
-	  break;
-	case R_386_TLS_TPOFF32:
-	  /* The offset is positive, backward from the thread pointer.  */
-	  /* We know the offset of object the symbol is contained in.
-	     It is a positive value which will be subtracted from the
-	     thread pointer.  To get the variable position in the TLS
-	     block we subtract the offset from that of the TLS block.  */
-	  if (sym != NULL)
-	    {
-	      CHECK_STATIC_TLS (map, sym_map);
-	      *reloc_addr = sym_map->l_tls_offset - sym->st_value
-			    + reloc->r_addend;
-	    }
-	  break;
-	case R_386_TLS_TPOFF:
-	  /* The offset is negative, forward from the thread pointer.  */
-	  /* We know the offset of object the symbol is contained in.
-	     It is a negative value which will be added to the
-	     thread pointer.  */
-	  if (sym != NULL)
-	    {
-	      CHECK_STATIC_TLS (map, sym_map);
-	      *reloc_addr = sym->st_value - sym_map->l_tls_offset
-			    + reloc->r_addend;
-	    }
-	  break;
-	case R_386_COPY:
-	  if (sym == NULL)
-	    /* This can happen in trace mode if an object could not be
-	       found.  */
-	    break;
-	  if (__glibc_unlikely (sym->st_size > refsym->st_size)
-	      || (__glibc_unlikely (sym->st_size < refsym->st_size)
-		  && GLRO(dl_verbose)))
-	    {
-	      const char *strtab;
-
-	      strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
-	      _dl_error_printf ("\
-%s: Symbol `%s' has different size in shared object, consider re-linking\n",
-				RTLD_PROGNAME, strtab + refsym->st_name);
-	    }
-	  memcpy (reloc_addr_arg, (void *) value,
-		  MIN (sym->st_size, refsym->st_size));
-	  break;
-	case R_386_IRELATIVE:
-	  value = map->l_addr + reloc->r_addend;
-	  if (__glibc_likely (!skip_ifunc))
-	    value = ((Elf32_Addr (*) (void)) value) ();
-	  *reloc_addr = value;
-	  break;
-	default:
-	  /* We add these checks in the version to relocate ld.so only
-	     if we are still debugging.  */
-	  _dl_reloc_bad_type (map, r_type, 0);
-	  break;
-	}
-    }
-}
-# endif	/* !RTLD_BOOTSTRAP */
 
 static inline void
 __attribute ((always_inline))
@@ -664,48 +517,4 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
     _dl_reloc_bad_type (map, r_type, 1);
 }
 
-# ifndef RTLD_BOOTSTRAP
-
-static inline void
-__attribute__ ((always_inline))
-elf_machine_lazy_rela (struct link_map *map, struct r_scope_elem *scope[],
-		       Elf32_Addr l_addr, const Elf32_Rela *reloc,
-		       int skip_ifunc)
-{
-  Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
-  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
-  if (__glibc_likely (r_type == R_386_JMP_SLOT))
-    ;
-  else if (__glibc_likely (r_type == R_386_TLS_DESC))
-    {
-      const Elf_Symndx symndx = ELFW (R_SYM) (reloc->r_info);
-      const ElfW (Sym) *symtab = (const void *)D_PTR (map, l_info[DT_SYMTAB]);
-      const ElfW (Sym) *sym = &symtab[symndx];
-      const struct r_found_version *version = NULL;
-
-      if (map->l_info[VERSYMIDX (DT_VERSYM)] != NULL)
-	{
-	  const ElfW (Half) *vernum =
-	    (const void *)D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]);
-	  version = &map->l_versions[vernum[symndx] & 0x7fff];
-	}
-
-      /* Always initialize TLS descriptors completely at load time, in
-	 case static TLS is allocated for it that requires locking.  */
-      elf_machine_rela (map, scope, reloc, sym, version, reloc_addr,
-			skip_ifunc);
-    }
-  else if (__glibc_unlikely (r_type == R_386_IRELATIVE))
-    {
-      Elf32_Addr value = map->l_addr + reloc->r_addend;
-      if (__glibc_likely (!skip_ifunc))
-	value = ((Elf32_Addr (*) (void)) value) ();
-      *reloc_addr = value;
-    }
-  else
-    _dl_reloc_bad_type (map, r_type, 1);
-}
-
-# endif	/* !RTLD_BOOTSTRAP */
-
 #endif /* RESOLVE_MAP */
-- 
2.34.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/5] Remove missing LD_LIBRARY_VERSION usages
  2022-08-02 14:59 ` [PATCH 1/5] Remove missing LD_LIBRARY_VERSION usages Adhemerval Zanella
@ 2022-08-02 15:11   ` Andreas Schwab
  0 siblings, 0 replies; 14+ messages in thread
From: Andreas Schwab @ 2022-08-02 15:11 UTC (permalink / raw)
  To: Adhemerval Zanella via Libc-alpha

s/missing/left over/

-- 
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE  1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/5] i386: Remove RELA support
  2022-08-02 14:59 ` [PATCH 5/5] i386: " Adhemerval Zanella
@ 2022-08-02 15:13   ` H.J. Lu
  2022-08-04  0:45     ` Fangrui Song
  0 siblings, 1 reply; 14+ messages in thread
From: H.J. Lu @ 2022-08-02 15:13 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: GNU C Library

On Tue, Aug 2, 2022 at 8:02 AM Adhemerval Zanella via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> Now that prelink is not support, there is no need to keep supporting
> rela for non bootstrap.
> ---
>  sysdeps/i386/dl-machine-rel.h |   7 +-
>  sysdeps/i386/dl-machine.h     | 191 ----------------------------------
>  2 files changed, 1 insertion(+), 197 deletions(-)
>
> diff --git a/sysdeps/i386/dl-machine-rel.h b/sysdeps/i386/dl-machine-rel.h
> index b98273aead..9dfaf718f2 100644
> --- a/sysdeps/i386/dl-machine-rel.h
> +++ b/sysdeps/i386/dl-machine-rel.h
> @@ -19,13 +19,8 @@
>  #ifndef _DL_MACHINE_REL_H
>  #define _DL_MACHINE_REL_H
>
> -/* The i386 never uses Elf32_Rela relocations for the dynamic linker.
> -   Prelinked libraries may use Elf32_Rela though.  */
> -#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
> +#define ELF_MACHINE_NO_RELA 1
>  #define ELF_MACHINE_NO_REL 0
> -
> -/* The i386 never uses Elf32_Rela relocations for the dynamic linker.
> -   Prelinked libraries may use Elf32_Rela though.  */
>  #define ELF_MACHINE_PLT_REL 1
>
>  #define PLTREL ElfW(Rel)
> diff --git a/sysdeps/i386/dl-machine.h b/sysdeps/i386/dl-machine.h
> index 56a189fda2..64aad6e787 100644
> --- a/sysdeps/i386/dl-machine.h
> +++ b/sysdeps/i386/dl-machine.h
> @@ -437,153 +437,6 @@ and creates an unsatisfiable circular dependency.\n",
>      }
>  }
>
> -# ifndef RTLD_BOOTSTRAP
> -static inline void
> -__attribute__ ((always_inline))
> -elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
> -                 const Elf32_Rela *reloc, const Elf32_Sym *sym,
> -                 const struct r_found_version *version,
> -                 void *const reloc_addr_arg, int skip_ifunc)
> -{
> -  Elf32_Addr *const reloc_addr = reloc_addr_arg;
> -  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
> -
> -  if (ELF32_R_TYPE (reloc->r_info) == R_386_RELATIVE)
> -    *reloc_addr = map->l_addr + reloc->r_addend;
> -  else if (r_type != R_386_NONE)
> -    {
> -      const Elf32_Sym *const refsym = sym;
> -      struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version,
> -                                             r_type);
> -      Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true);
> -
> -      if (sym != NULL
> -         && __glibc_likely (sym->st_shndx != SHN_UNDEF)
> -         && __glibc_unlikely (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC)
> -         && __glibc_likely (!skip_ifunc))
> -       value = ((Elf32_Addr (*) (void)) value) ();
> -
> -      switch (ELF32_R_TYPE (reloc->r_info))
> -       {
> -       case R_386_SIZE32:
> -         /* Set to symbol size plus addend.  */
> -         value = sym->st_size;
> -         /* Fall through.  */
> -       case R_386_GLOB_DAT:
> -       case R_386_JMP_SLOT:
> -       case R_386_32:
> -         *reloc_addr = value + reloc->r_addend;
> -         break;
> -         /* Not needed for dl-conflict.c.  */
> -       case R_386_PC32:
> -         *reloc_addr = (value + reloc->r_addend - (Elf32_Addr) reloc_addr);
> -         break;
> -
> -       case R_386_TLS_DTPMOD32:
> -         /* Get the information from the link map returned by the
> -            resolv function.  */
> -         if (sym_map != NULL)
> -           *reloc_addr = sym_map->l_tls_modid;
> -         break;
> -       case R_386_TLS_DTPOFF32:
> -         /* During relocation all TLS symbols are defined and used.
> -            Therefore the offset is already correct.  */
> -         *reloc_addr = (sym == NULL ? 0 : sym->st_value) + reloc->r_addend;
> -         break;
> -       case R_386_TLS_DESC:
> -         {
> -           struct tlsdesc volatile *td =
> -             (struct tlsdesc volatile *)reloc_addr;
> -
> -#  ifndef RTLD_BOOTSTRAP
> -           if (!sym)
> -             {
> -               td->arg = (void*)reloc->r_addend;
> -               td->entry = _dl_tlsdesc_undefweak;
> -             }
> -           else
> -#  endif
> -             {
> -#  ifndef RTLD_BOOTSTRAP
> -#   ifndef SHARED
> -               CHECK_STATIC_TLS (map, sym_map);
> -#   else
> -               if (!TRY_STATIC_TLS (map, sym_map))
> -                 {
> -                   td->arg = _dl_make_tlsdesc_dynamic
> -                     (sym_map, sym->st_value + reloc->r_addend);
> -                   td->entry = _dl_tlsdesc_dynamic;
> -                 }
> -               else
> -#   endif
> -#  endif
> -                 {
> -                   td->arg = (void*)(sym->st_value - sym_map->l_tls_offset
> -                                     + reloc->r_addend);
> -                   td->entry = _dl_tlsdesc_return;
> -                 }
> -             }
> -         }
> -         break;
> -       case R_386_TLS_TPOFF32:
> -         /* The offset is positive, backward from the thread pointer.  */
> -         /* We know the offset of object the symbol is contained in.
> -            It is a positive value which will be subtracted from the
> -            thread pointer.  To get the variable position in the TLS
> -            block we subtract the offset from that of the TLS block.  */
> -         if (sym != NULL)
> -           {
> -             CHECK_STATIC_TLS (map, sym_map);
> -             *reloc_addr = sym_map->l_tls_offset - sym->st_value
> -                           + reloc->r_addend;
> -           }
> -         break;
> -       case R_386_TLS_TPOFF:
> -         /* The offset is negative, forward from the thread pointer.  */
> -         /* We know the offset of object the symbol is contained in.
> -            It is a negative value which will be added to the
> -            thread pointer.  */
> -         if (sym != NULL)
> -           {
> -             CHECK_STATIC_TLS (map, sym_map);
> -             *reloc_addr = sym->st_value - sym_map->l_tls_offset
> -                           + reloc->r_addend;
> -           }
> -         break;
> -       case R_386_COPY:
> -         if (sym == NULL)
> -           /* This can happen in trace mode if an object could not be
> -              found.  */
> -           break;
> -         if (__glibc_unlikely (sym->st_size > refsym->st_size)
> -             || (__glibc_unlikely (sym->st_size < refsym->st_size)
> -                 && GLRO(dl_verbose)))
> -           {
> -             const char *strtab;
> -
> -             strtab = (const char *) D_PTR (map, l_info[DT_STRTAB]);
> -             _dl_error_printf ("\
> -%s: Symbol `%s' has different size in shared object, consider re-linking\n",
> -                               RTLD_PROGNAME, strtab + refsym->st_name);
> -           }
> -         memcpy (reloc_addr_arg, (void *) value,
> -                 MIN (sym->st_size, refsym->st_size));
> -         break;
> -       case R_386_IRELATIVE:
> -         value = map->l_addr + reloc->r_addend;
> -         if (__glibc_likely (!skip_ifunc))
> -           value = ((Elf32_Addr (*) (void)) value) ();
> -         *reloc_addr = value;
> -         break;
> -       default:
> -         /* We add these checks in the version to relocate ld.so only
> -            if we are still debugging.  */
> -         _dl_reloc_bad_type (map, r_type, 0);
> -         break;
> -       }
> -    }
> -}
> -# endif        /* !RTLD_BOOTSTRAP */
>
>  static inline void
>  __attribute ((always_inline))
> @@ -664,48 +517,4 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
>      _dl_reloc_bad_type (map, r_type, 1);
>  }
>
> -# ifndef RTLD_BOOTSTRAP
> -
> -static inline void
> -__attribute__ ((always_inline))
> -elf_machine_lazy_rela (struct link_map *map, struct r_scope_elem *scope[],
> -                      Elf32_Addr l_addr, const Elf32_Rela *reloc,
> -                      int skip_ifunc)
> -{
> -  Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset);
> -  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
> -  if (__glibc_likely (r_type == R_386_JMP_SLOT))
> -    ;
> -  else if (__glibc_likely (r_type == R_386_TLS_DESC))
> -    {
> -      const Elf_Symndx symndx = ELFW (R_SYM) (reloc->r_info);
> -      const ElfW (Sym) *symtab = (const void *)D_PTR (map, l_info[DT_SYMTAB]);
> -      const ElfW (Sym) *sym = &symtab[symndx];
> -      const struct r_found_version *version = NULL;
> -
> -      if (map->l_info[VERSYMIDX (DT_VERSYM)] != NULL)
> -       {
> -         const ElfW (Half) *vernum =
> -           (const void *)D_PTR (map, l_info[VERSYMIDX (DT_VERSYM)]);
> -         version = &map->l_versions[vernum[symndx] & 0x7fff];
> -       }
> -
> -      /* Always initialize TLS descriptors completely at load time, in
> -        case static TLS is allocated for it that requires locking.  */
> -      elf_machine_rela (map, scope, reloc, sym, version, reloc_addr,
> -                       skip_ifunc);
> -    }
> -  else if (__glibc_unlikely (r_type == R_386_IRELATIVE))
> -    {
> -      Elf32_Addr value = map->l_addr + reloc->r_addend;
> -      if (__glibc_likely (!skip_ifunc))
> -       value = ((Elf32_Addr (*) (void)) value) ();
> -      *reloc_addr = value;
> -    }
> -  else
> -    _dl_reloc_bad_type (map, r_type, 1);
> -}
> -
> -# endif        /* !RTLD_BOOTSTRAP */
> -
>  #endif /* RESOLVE_MAP */
> --
> 2.34.1
>

LGTM.

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 3/5] Remove ldd libc4 support
  2022-08-02 14:59 ` [PATCH 3/5] Remove ldd libc4 support Adhemerval Zanella
@ 2022-08-02 23:35   ` H.J. Lu
  0 siblings, 0 replies; 14+ messages in thread
From: H.J. Lu @ 2022-08-02 23:35 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: GNU C Library

On Tue, Aug 2, 2022 at 8:00 AM Adhemerval Zanella via Libc-alpha
<libc-alpha@sourceware.org> wrote:
>
> The older libc versions are obsolete for over twenty years now.
> ---
>  Makeconfig                                    |   4 +-
>  sysdeps/unix/sysv/linux/Makefile              |   2 -
>  sysdeps/unix/sysv/linux/csky/configure        |   1 -
>  sysdeps/unix/sysv/linux/csky/configure.ac     |   1 -
>  sysdeps/unix/sysv/linux/i386/Makefile         |   5 -
>  sysdeps/unix/sysv/linux/i386/configure        |   1 -
>  sysdeps/unix/sysv/linux/i386/configure.ac     |   1 -
>  sysdeps/unix/sysv/linux/ldd-rewrite.sed       |  10 --
>  sysdeps/unix/sysv/linux/lddlibc4.c            | 104 ------------------
>  sysdeps/unix/sysv/linux/m68k/Makefile         |   4 -
>  sysdeps/unix/sysv/linux/m68k/configure        |   1 -
>  sysdeps/unix/sysv/linux/m68k/configure.ac     |   1 -
>  .../unix/sysv/linux/sparc/sparc32/Makefile    |   2 -
>  13 files changed, 2 insertions(+), 135 deletions(-)
>  delete mode 100644 sysdeps/unix/sysv/linux/ldd-rewrite.sed
>  delete mode 100644 sysdeps/unix/sysv/linux/lddlibc4.c
>
> diff --git a/Makeconfig b/Makeconfig
> index ba70321af1..e78cf220af 100644
> --- a/Makeconfig
> +++ b/Makeconfig
> @@ -866,7 +866,7 @@ endif
>  +extra-math-flags = $(if $(filter libm,$(in-module)),-fno-math-errno,-fmath-errno)
>
>  # Use 64 bit time_t support for installed programs
> -installed-modules = nonlib nscd lddlibc4 ldconfig locale_programs \
> +installed-modules = nonlib nscd ldconfig locale_programs \
>                     iconvprogs libnss_files libnss_compat libnss_db libnss_hesiod \
>                     libutil libpcprofile libSegFault
>  +extra-time-flags = $(if $(filter $(installed-modules),\
> @@ -966,7 +966,7 @@ endif       # $(+cflags) == ""
>  libio-include = -I$(..)libio
>
>  # List of non-library modules that we build.
> -built-modules = iconvprogs iconvdata ldconfig lddlibc4 libmemusage \
> +built-modules = iconvprogs iconvdata ldconfig libmemusage \
>                 libSegFault libpcprofile librpcsvc locale-programs \
>                 memusagestat nonlib nscd extramodules libnldbl libsupport \
>                 testsuite testsuite-internal
> diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
> index a139a16532..3f31c19e4a 100644
> --- a/sysdeps/unix/sysv/linux/Makefile
> +++ b/sysdeps/unix/sysv/linux/Makefile
> @@ -393,8 +393,6 @@ endif
>  ifeq ($(subdir),elf)
>  sysdep-rtld-routines += dl-brk dl-sbrk dl-getcwd dl-openat64 dl-opendir
>
> -libof-lddlibc4 = lddlibc4
> -
>  others += pldd
>  install-bin += pldd
>  $(objpfx)pldd: $(objpfx)xmalloc.o
> diff --git a/sysdeps/unix/sysv/linux/csky/configure b/sysdeps/unix/sysv/linux/csky/configure
> index 20dc0df8e6..b36cee5b7b 100644
> --- a/sysdeps/unix/sysv/linux/csky/configure
> +++ b/sysdeps/unix/sysv/linux/csky/configure
> @@ -2,4 +2,3 @@
>   # Local configure fragment for sysdeps/unix/sysv/linux/csky
>
>  arch_minimum_kernel=4.20.0
> -ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
> diff --git a/sysdeps/unix/sysv/linux/csky/configure.ac b/sysdeps/unix/sysv/linux/csky/configure.ac
> index 89448969d4..efcd375cd2 100644
> --- a/sysdeps/unix/sysv/linux/csky/configure.ac
> +++ b/sysdeps/unix/sysv/linux/csky/configure.ac
> @@ -2,4 +2,3 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/unix/sysv/linux/csky
>
>  arch_minimum_kernel=4.20.0
> -ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
> diff --git a/sysdeps/unix/sysv/linux/i386/Makefile b/sysdeps/unix/sysv/linux/i386/Makefile
> index 598e27dcda..f1f8c3f44c 100644
> --- a/sysdeps/unix/sysv/linux/i386/Makefile
> +++ b/sysdeps/unix/sysv/linux/i386/Makefile
> @@ -7,11 +7,6 @@ sysdep_routines += ioperm iopl vm86
>  tests += tst-bz21269
>  endif
>
> -ifeq ($(subdir),elf)
> -sysdep-others += lddlibc4
> -install-bin += lddlibc4
> -endif
> -
>  ifeq ($(subdir),io)
>  sysdep_routines += libc-do-syscall libc-do-syscall-int80
>  endif
> diff --git a/sysdeps/unix/sysv/linux/i386/configure b/sysdeps/unix/sysv/linux/i386/configure
> index f119e62fc3..351d82355a 100644
> --- a/sysdeps/unix/sysv/linux/i386/configure
> +++ b/sysdeps/unix/sysv/linux/i386/configure
> @@ -2,4 +2,3 @@
>   # Local configure fragment for sysdeps/unix/sysv/linux/i386.
>
>  libc_cv_gcc_unwind_find_fde=yes
> -ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
> diff --git a/sysdeps/unix/sysv/linux/i386/configure.ac b/sysdeps/unix/sysv/linux/i386/configure.ac
> index 64ab2cc2c8..61c04f2f49 100644
> --- a/sysdeps/unix/sysv/linux/i386/configure.ac
> +++ b/sysdeps/unix/sysv/linux/i386/configure.ac
> @@ -2,4 +2,3 @@ GLIBC_PROVIDES dnl See aclocal.m4 in the top level source directory.
>  # Local configure fragment for sysdeps/unix/sysv/linux/i386.
>
>  libc_cv_gcc_unwind_find_fde=yes
> -ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
> diff --git a/sysdeps/unix/sysv/linux/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/ldd-rewrite.sed
> deleted file mode 100644
> index 1faa90fbc8..0000000000
> --- a/sysdeps/unix/sysv/linux/ldd-rewrite.sed
> +++ /dev/null
> @@ -1,10 +0,0 @@
> -/Maybe extra code for non-ELF binaries/a\
> -  file=$1\
> -  # Run the ldd stub.\
> -  lddlibc4 "$file"\
> -  # Test the result.\
> -  if test $? -lt 3; then\
> -    return 0;\
> -  fi\
> -  # In case of an error punt.
> -/LD_TRACE_LOADED_OBJECTS=1/a\
> diff --git a/sysdeps/unix/sysv/linux/lddlibc4.c b/sysdeps/unix/sysv/linux/lddlibc4.c
> deleted file mode 100644
> index 153d2ad183..0000000000
> --- a/sysdeps/unix/sysv/linux/lddlibc4.c
> +++ /dev/null
> @@ -1,104 +0,0 @@
> -/* Stub for ldd script to print Linux libc4 dependencies.
> -   Copyright (C) 1998-2022 Free Software Foundation, Inc.
> -   This file is part of the GNU C Library.
> -
> -   The GNU C Library is free software; you can redistribute it and/or
> -   modify it under the terms of the GNU Lesser General Public
> -   License as published by the Free Software Foundation; either
> -   version 2.1 of the License, or (at your option) any later version.
> -
> -   The GNU C Library is distributed in the hope that it will be useful,
> -   but WITHOUT ANY WARRANTY; without even the implied warranty of
> -   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> -   Lesser General Public License for more details.
> -
> -   You should have received a copy of the GNU Lesser General Public
> -   License along with the GNU C Library; if not, see
> -   <https://www.gnu.org/licenses/>.  */
> -
> -/* This code is based on the `ldd' program code from the Linux ld.so
> -   package.  */
> -
> -#include <a.out.h>
> -#include <errno.h>
> -#include <error.h>
> -#include <libintl.h>
> -#include <locale.h>
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include <string.h>
> -#include <unistd.h>
> -
> -/* Get libc version number.  */
> -#include "../version.h"
> -
> -#define PACKAGE _libc_intl_domainname
> -
> -
> -int
> -main (int argc, char *argv[])
> -{
> -  const char *filename;
> -  size_t filename_len;
> -  struct exec exec;
> -  char *buf;
> -  FILE *fp;
> -
> -  /* Set locale via LC_ALL.  */
> -  setlocale (LC_ALL, "");
> -
> -  /* Set the text message domain.  */
> -  textdomain (PACKAGE);
> -
> -  /* We expect exactly one argument.  */
> -  if (argc != 2)
> -    return 1;
> -
> -  if (strcmp (argv[1], "--help") == 0)
> -    {
> -      printf (gettext ("Usage: lddlibc4 FILE\n\n"));
> -      printf (gettext ("For bug reporting instructions, please see:\n\
> -%s.\n"), REPORT_BUGS_TO);
> -      return 0;
> -    }
> -  else if (strcmp (argv[1], "--version") == 0)
> -    {
> -      printf ("lddlibc4 %s%s\n", PKGVERSION, VERSION);
> -      printf (gettext ("\
> -Copyright (C) %s Free Software Foundation, Inc.\n\
> -This is free software; see the source for copying conditions.  There is NO\n\
> -warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
> -"), "2022");
> -      return 0;
> -    }
> -
> -  filename = argv[1];
> -
> -  /* First see whether this is really an a.out binary.  */
> -  fp = fopen (filename, "rb");
> -  if (fp == NULL)
> -    error (2, errno, gettext ("cannot open `%s'"), filename);
> -
> -  /* Read the program header.  */
> -  if (fread (&exec, sizeof exec, 1, fp) < 1)
> -    error (2, errno, gettext ("cannot read header from `%s'"), filename);
> -
> -  /* Test for the magic numbers.  */
> -  if (N_MAGIC (exec) != ZMAGIC && N_MAGIC (exec) != QMAGIC
> -      && N_MAGIC (exec) != OMAGIC)
> -    exit (3);
> -
> -  /* We don't need the file open anymore.  */
> -  fclose (fp);
> -
> -  /* We must put `__LDD_ARGV0=<program-name>' in the environment.  */
> -  filename_len = strlen (filename);
> -  buf = (char *) alloca (sizeof "__LDD_ARGV0=" + filename_len);
> -  mempcpy (mempcpy (buf, "__LDD_ARGV0=", sizeof "__LDD_ARGV0=" - 1),
> -          filename, filename_len + 1);
> -  /* ...and put the value in the environment.  */
> -  putenv (buf);
> -
> -  /* Now we can execute the binary.  */
> -  return execv (filename, &argv[argc]) ? 4 : 0;
> -}
> diff --git a/sysdeps/unix/sysv/linux/m68k/Makefile b/sysdeps/unix/sysv/linux/m68k/Makefile
> index 18ad2bf0ee..72d5bff992 100644
> --- a/sysdeps/unix/sysv/linux/m68k/Makefile
> +++ b/sysdeps/unix/sysv/linux/m68k/Makefile
> @@ -16,7 +16,3 @@ sysdep_routines += mremap
>  sysdep_headers += sys/reg.h
>  endif
>
> -ifeq ($(subdir),elf)
> -sysdep-others += lddlibc4
> -install-bin += lddlibc4
> -endif
> diff --git a/sysdeps/unix/sysv/linux/m68k/configure b/sysdeps/unix/sysv/linux/m68k/configure
> index 8e955387b7..aa295f80cb 100644
> --- a/sysdeps/unix/sysv/linux/m68k/configure
> +++ b/sysdeps/unix/sysv/linux/m68k/configure
> @@ -6,4 +6,3 @@ m68k/coldfire)
>    libc_cv_gcc_unwind_find_fde=yes
>    ;;
>  esac
> -ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
> diff --git a/sysdeps/unix/sysv/linux/m68k/configure.ac b/sysdeps/unix/sysv/linux/m68k/configure.ac
> index c21ca9dd47..0e547f2f2e 100644
> --- a/sysdeps/unix/sysv/linux/m68k/configure.ac
> +++ b/sysdeps/unix/sysv/linux/m68k/configure.ac
> @@ -7,4 +7,3 @@ m68k/coldfire)
>    libc_cv_gcc_unwind_find_fde=yes
>    ;;
>  esac
> -ldd_rewrite_script=sysdeps/unix/sysv/linux/ldd-rewrite.sed
> diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
> index 21c7dc1680..167307cc78 100644
> --- a/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
> +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/Makefile
> @@ -13,8 +13,6 @@ endif
>  ifeq ($(subdir),elf)
>  CFLAGS-rtld.c += -mcpu=v8
>  #rtld-routines += dl-sysdepsparc
> -sysdep-others += lddlibc4
> -install-bin += lddlibc4
>  endif   # elf
>
>  ifeq ($(subdir),math)
> --
> 2.34.1
>

LGTM.

Thanks.

-- 
H.J.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] arm: Remove RELA support
  2022-08-02 14:59 ` [PATCH 4/5] arm: Remove RELA support Adhemerval Zanella
@ 2022-08-03 18:31   ` Adhemerval Zanella Netto
  2022-08-03 19:59     ` Phil Blundell
  0 siblings, 1 reply; 14+ messages in thread
From: Adhemerval Zanella Netto @ 2022-08-03 18:31 UTC (permalink / raw)
  To: libc-alpha

Since i386 was approved, it does not make sense to keep arm as the unique architecture
with lingering RELA support for prelink.  I will commit this shortly if no one opposes
it. 

On 02/08/22 11:59, Adhemerval Zanella wrote:
> Now that prelink is not support, there is no need to keep supporting
> rela for non bootstrap.
> ---
>  sysdeps/arm/dl-machine-rel.h |   7 +--
>  sysdeps/arm/dl-machine.h     | 100 -----------------------------------
>  2 files changed, 1 insertion(+), 106 deletions(-)
> 
> diff --git a/sysdeps/arm/dl-machine-rel.h b/sysdeps/arm/dl-machine-rel.h
> index 999967931b..9dfaf718f2 100644
> --- a/sysdeps/arm/dl-machine-rel.h
> +++ b/sysdeps/arm/dl-machine-rel.h
> @@ -19,13 +19,8 @@
>  #ifndef _DL_MACHINE_REL_H
>  #define _DL_MACHINE_REL_H
>  
> -/* ARM never uses Elf32_Rela relocations for the dynamic linker.
> -   Prelinked libraries may use Elf32_Rela though.  */
> -#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
> +#define ELF_MACHINE_NO_RELA 1
>  #define ELF_MACHINE_NO_REL 0
> -
> -/* ARM never uses Elf32_Rela relocations for the dynamic linker.
> -   Prelinked libraries may use Elf32_Rela though.  */
>  #define ELF_MACHINE_PLT_REL 1
>  
>  #define PLTREL ElfW(Rel)
> diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
> index 6a422713bd..4e78d8fb0e 100644
> --- a/sysdeps/arm/dl-machine.h
> +++ b/sysdeps/arm/dl-machine.h
> @@ -447,96 +447,6 @@ elf_machine_rel (struct link_map *map, struct r_scope_elem *scope[],
>      }
>  }
>  
> -# ifndef RTLD_BOOTSTRAP
> -static inline void
> -__attribute__ ((always_inline))
> -elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
> -                  const Elf32_Rela *reloc, const Elf32_Sym *sym,
> -                  const struct r_found_version *version,
> -		  void *const reloc_addr_arg, int skip_ifunc)
> -{
> -  Elf32_Addr *const reloc_addr = reloc_addr_arg;
> -  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
> -
> -  if (__builtin_expect (r_type == R_ARM_RELATIVE, 0))
> -    *reloc_addr = map->l_addr + reloc->r_addend;
> -  else if (__builtin_expect (r_type == R_ARM_NONE, 0))
> -    return;
> -  else
> -    {
> -      const Elf32_Sym *const refsym = sym;
> -      struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, r_type);
> -      Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true);
> -
> -      if (sym != NULL
> -	  && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0)
> -	  && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1)
> -	  && __builtin_expect (!skip_ifunc, 1))
> -	value = elf_ifunc_invoke (value);
> -
> -      switch (r_type)
> -	{
> -	  /* Not needed for dl-conflict.c.  */
> -	case R_ARM_COPY:
> -	  if (sym == NULL)
> -	    /* This can happen in trace mode if an object could not be
> -	       found.  */
> -	    break;
> -	  if (sym->st_size > refsym->st_size
> -	      || (GLRO(dl_verbose) && sym->st_size < refsym->st_size))
> -	    {
> -	      const char *strtab;
> -
> -	      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
> -	      _dl_error_printf ("\
> -%s: Symbol `%s' has different size in shared object, consider re-linking\n",
> -				RTLD_PROGNAME, strtab + refsym->st_name);
> -	    }
> -	  memcpy (reloc_addr_arg, (void *) value,
> -		  MIN (sym->st_size, refsym->st_size));
> -	  break;
> -	case R_ARM_GLOB_DAT:
> -	case R_ARM_JUMP_SLOT:
> -	case R_ARM_ABS32:
> -	  *reloc_addr = value + reloc->r_addend;
> -	  break;
> -	case R_ARM_PC24:
> -          relocate_pc24 (map, value, reloc_addr, reloc->r_addend);
> -	  break;
> -#if !defined RTLD_BOOTSTRAP
> -	case R_ARM_TLS_DTPMOD32:
> -	  /* Get the information from the link map returned by the
> -	     resolv function.  */
> -	  if (sym_map != NULL)
> -	    *reloc_addr = sym_map->l_tls_modid;
> -	  break;
> -
> -	case R_ARM_TLS_DTPOFF32:
> -	  *reloc_addr = (sym == NULL ? 0 : sym->st_value) + reloc->r_addend;
> -	  break;
> -
> -	case R_ARM_TLS_TPOFF32:
> -	  if (sym != NULL)
> -	    {
> -	      CHECK_STATIC_TLS (map, sym_map);
> -	      *reloc_addr = (sym->st_value + sym_map->l_tls_offset
> -			     + reloc->r_addend);
> -	    }
> -	  break;
> -	case R_ARM_IRELATIVE:
> -	  value = map->l_addr + reloc->r_addend;
> -	  if (__glibc_likely (!skip_ifunc))
> -	    value = ((Elf32_Addr (*) (int)) value) (GLRO(dl_hwcap));
> -	  *reloc_addr = value;
> -	  break;
> -#endif
> -	default:
> -	  _dl_reloc_bad_type (map, r_type, 0);
> -	  break;
> -	}
> -    }
> -}
> -# endif
>  
>  static inline void
>  __attribute__ ((always_inline))
> @@ -547,16 +457,6 @@ elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc,
>    *reloc_addr += l_addr;
>  }
>  
> -# ifndef RTLD_BOOTSTRAP
> -static inline void
> -__attribute__ ((always_inline))
> -elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
> -			   void *const reloc_addr_arg)
> -{
> -  Elf32_Addr *const reloc_addr = reloc_addr_arg;
> -  *reloc_addr = l_addr + reloc->r_addend;
> -}
> -# endif
>  
>  static inline void
>  __attribute__ ((always_inline))

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 4/5] arm: Remove RELA support
  2022-08-03 18:31   ` Adhemerval Zanella Netto
@ 2022-08-03 19:59     ` Phil Blundell
  0 siblings, 0 replies; 14+ messages in thread
From: Phil Blundell @ 2022-08-03 19:59 UTC (permalink / raw)
  To: Adhemerval Zanella Netto; +Cc: libc-alpha

Agreed, this looks ok.

Phil

On Wed, Aug 03, 2022 at 03:31:25PM -0300, Adhemerval Zanella Netto via Libc-alpha wrote:
> Since i386 was approved, it does not make sense to keep arm as the unique architecture
> with lingering RELA support for prelink.  I will commit this shortly if no one opposes
> it. 
> 
> On 02/08/22 11:59, Adhemerval Zanella wrote:
> > Now that prelink is not support, there is no need to keep supporting
> > rela for non bootstrap.
> > ---
> >  sysdeps/arm/dl-machine-rel.h |   7 +--
> >  sysdeps/arm/dl-machine.h     | 100 -----------------------------------
> >  2 files changed, 1 insertion(+), 106 deletions(-)
> > 
> > diff --git a/sysdeps/arm/dl-machine-rel.h b/sysdeps/arm/dl-machine-rel.h
> > index 999967931b..9dfaf718f2 100644
> > --- a/sysdeps/arm/dl-machine-rel.h
> > +++ b/sysdeps/arm/dl-machine-rel.h
> > @@ -19,13 +19,8 @@
> >  #ifndef _DL_MACHINE_REL_H
> >  #define _DL_MACHINE_REL_H
> >  
> > -/* ARM never uses Elf32_Rela relocations for the dynamic linker.
> > -   Prelinked libraries may use Elf32_Rela though.  */
> > -#define ELF_MACHINE_NO_RELA defined RTLD_BOOTSTRAP
> > +#define ELF_MACHINE_NO_RELA 1
> >  #define ELF_MACHINE_NO_REL 0
> > -
> > -/* ARM never uses Elf32_Rela relocations for the dynamic linker.
> > -   Prelinked libraries may use Elf32_Rela though.  */
> >  #define ELF_MACHINE_PLT_REL 1
> >  
> >  #define PLTREL ElfW(Rel)
> > diff --git a/sysdeps/arm/dl-machine.h b/sysdeps/arm/dl-machine.h
> > index 6a422713bd..4e78d8fb0e 100644
> > --- a/sysdeps/arm/dl-machine.h
> > +++ b/sysdeps/arm/dl-machine.h
> > @@ -447,96 +447,6 @@ elf_machine_rel (struct link_map *map, struct r_scope_elem *scope[],
> >      }
> >  }
> >  
> > -# ifndef RTLD_BOOTSTRAP
> > -static inline void
> > -__attribute__ ((always_inline))
> > -elf_machine_rela (struct link_map *map, struct r_scope_elem *scope[],
> > -                  const Elf32_Rela *reloc, const Elf32_Sym *sym,
> > -                  const struct r_found_version *version,
> > -		  void *const reloc_addr_arg, int skip_ifunc)
> > -{
> > -  Elf32_Addr *const reloc_addr = reloc_addr_arg;
> > -  const unsigned int r_type = ELF32_R_TYPE (reloc->r_info);
> > -
> > -  if (__builtin_expect (r_type == R_ARM_RELATIVE, 0))
> > -    *reloc_addr = map->l_addr + reloc->r_addend;
> > -  else if (__builtin_expect (r_type == R_ARM_NONE, 0))
> > -    return;
> > -  else
> > -    {
> > -      const Elf32_Sym *const refsym = sym;
> > -      struct link_map *sym_map = RESOLVE_MAP (map, scope, &sym, version, r_type);
> > -      Elf32_Addr value = SYMBOL_ADDRESS (sym_map, sym, true);
> > -
> > -      if (sym != NULL
> > -	  && __builtin_expect (ELFW(ST_TYPE) (sym->st_info) == STT_GNU_IFUNC, 0)
> > -	  && __builtin_expect (sym->st_shndx != SHN_UNDEF, 1)
> > -	  && __builtin_expect (!skip_ifunc, 1))
> > -	value = elf_ifunc_invoke (value);
> > -
> > -      switch (r_type)
> > -	{
> > -	  /* Not needed for dl-conflict.c.  */
> > -	case R_ARM_COPY:
> > -	  if (sym == NULL)
> > -	    /* This can happen in trace mode if an object could not be
> > -	       found.  */
> > -	    break;
> > -	  if (sym->st_size > refsym->st_size
> > -	      || (GLRO(dl_verbose) && sym->st_size < refsym->st_size))
> > -	    {
> > -	      const char *strtab;
> > -
> > -	      strtab = (const void *) D_PTR (map, l_info[DT_STRTAB]);
> > -	      _dl_error_printf ("\
> > -%s: Symbol `%s' has different size in shared object, consider re-linking\n",
> > -				RTLD_PROGNAME, strtab + refsym->st_name);
> > -	    }
> > -	  memcpy (reloc_addr_arg, (void *) value,
> > -		  MIN (sym->st_size, refsym->st_size));
> > -	  break;
> > -	case R_ARM_GLOB_DAT:
> > -	case R_ARM_JUMP_SLOT:
> > -	case R_ARM_ABS32:
> > -	  *reloc_addr = value + reloc->r_addend;
> > -	  break;
> > -	case R_ARM_PC24:
> > -          relocate_pc24 (map, value, reloc_addr, reloc->r_addend);
> > -	  break;
> > -#if !defined RTLD_BOOTSTRAP
> > -	case R_ARM_TLS_DTPMOD32:
> > -	  /* Get the information from the link map returned by the
> > -	     resolv function.  */
> > -	  if (sym_map != NULL)
> > -	    *reloc_addr = sym_map->l_tls_modid;
> > -	  break;
> > -
> > -	case R_ARM_TLS_DTPOFF32:
> > -	  *reloc_addr = (sym == NULL ? 0 : sym->st_value) + reloc->r_addend;
> > -	  break;
> > -
> > -	case R_ARM_TLS_TPOFF32:
> > -	  if (sym != NULL)
> > -	    {
> > -	      CHECK_STATIC_TLS (map, sym_map);
> > -	      *reloc_addr = (sym->st_value + sym_map->l_tls_offset
> > -			     + reloc->r_addend);
> > -	    }
> > -	  break;
> > -	case R_ARM_IRELATIVE:
> > -	  value = map->l_addr + reloc->r_addend;
> > -	  if (__glibc_likely (!skip_ifunc))
> > -	    value = ((Elf32_Addr (*) (int)) value) (GLRO(dl_hwcap));
> > -	  *reloc_addr = value;
> > -	  break;
> > -#endif
> > -	default:
> > -	  _dl_reloc_bad_type (map, r_type, 0);
> > -	  break;
> > -	}
> > -    }
> > -}
> > -# endif
> >  
> >  static inline void
> >  __attribute__ ((always_inline))
> > @@ -547,16 +457,6 @@ elf_machine_rel_relative (Elf32_Addr l_addr, const Elf32_Rel *reloc,
> >    *reloc_addr += l_addr;
> >  }
> >  
> > -# ifndef RTLD_BOOTSTRAP
> > -static inline void
> > -__attribute__ ((always_inline))
> > -elf_machine_rela_relative (Elf32_Addr l_addr, const Elf32_Rela *reloc,
> > -			   void *const reloc_addr_arg)
> > -{
> > -  Elf32_Addr *const reloc_addr = reloc_addr_arg;
> > -  *reloc_addr = l_addr + reloc->r_addend;
> > -}
> > -# endif
> >  
> >  static inline void
> >  __attribute__ ((always_inline))

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 5/5] i386: Remove RELA support
  2022-08-02 15:13   ` H.J. Lu
@ 2022-08-04  0:45     ` Fangrui Song
  0 siblings, 0 replies; 14+ messages in thread
From: Fangrui Song @ 2022-08-04  0:45 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: H.J. Lu, GNU C Library

On 2022-08-02, H.J. Lu via Libc-alpha wrote:
>On Tue, Aug 2, 2022 at 8:02 AM Adhemerval Zanella via Libc-alpha
><libc-alpha@sourceware.org> wrote:
>>
>> Now that prelink is not support, there is no need to keep supporting
>> rela for non bootstrap.
>> ---
>>  sysdeps/i386/dl-machine-rel.h |   7 +-
>>  sysdeps/i386/dl-machine.h     | 191 ----------------------------------
>>  2 files changed, 1 insertion(+), 197 deletions(-)

Thanks for cleaning up RELA on REL-dominant architectures.
Note that there is some value in using REL on RELA-dominant
architectures as REL for dynamic relocations can decrease code size.

ld.lld -z rel produces .rel.dyn for RELA-dominant architectures.

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] Assume only FLAG_ELF_LIBC6 suport
  2022-08-02 14:59 ` [PATCH 2/5] Assume only FLAG_ELF_LIBC6 suport Adhemerval Zanella
@ 2023-12-07 13:14   ` Alexander Monakov
  2023-12-07 14:40     ` Adhemerval Zanella Netto
  0 siblings, 1 reply; 14+ messages in thread
From: Alexander Monakov @ 2023-12-07 13:14 UTC (permalink / raw)
  To: Adhemerval Zanella; +Cc: libc-alpha


On Tue, 2 Aug 2022, Adhemerval Zanella via Libc-alpha wrote:

> From: "Lucas A. M. Magalhaes" <lamm@linux.ibm.com>
> 
> The older libc versions are obsolete for over twenty years now.
> This patch removes the special flags for libc5 and libc4 and assumes
> that all libraries cached are libc6 compatible and use FLAG_ELF_LIBC6.
> 
> Checked with a build for all affected architectures.
> 
> Co-authored-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>

> --- a/elf/readelflib.c
> +++ b/elf/readelflib.c
> @@ -110,16 +108,6 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
>  	  program_interpreter = (char *) (file_contents + segment->p_offset);
>  	  check_ptr (program_interpreter);
>  
> -	  /* Check if this is enough to classify the binary.  */
> -	  for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]);
> -	       ++j)
> -	    if (strcmp (program_interpreter, interpreters[j].soname) == 0)
> -	      {
> -		*flag = interpreters[j].flag;
> -		break;
> -	      }
> -	  break;
> -
>  	case PT_GNU_PROPERTY:
>  	  /* The NT_GNU_PROPERTY_TYPE_0 note must be aligned to 4 bytes
>  	     in 32-bit objects and to 8 bytes in 64-bit objects.  Skip

This hunk removes a 'break', resulting in a nonsensical
fall-through from 'case PT_INTERP' to 'case PT_GNU_PROPERTY'.

Alexander

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/5] Assume only FLAG_ELF_LIBC6 suport
  2023-12-07 13:14   ` Alexander Monakov
@ 2023-12-07 14:40     ` Adhemerval Zanella Netto
  0 siblings, 0 replies; 14+ messages in thread
From: Adhemerval Zanella Netto @ 2023-12-07 14:40 UTC (permalink / raw)
  To: Alexander Monakov; +Cc: libc-alpha



On 07/12/23 10:14, Alexander Monakov wrote:
> 
> On Tue, 2 Aug 2022, Adhemerval Zanella via Libc-alpha wrote:
> 
>> From: "Lucas A. M. Magalhaes" <lamm@linux.ibm.com>
>>
>> The older libc versions are obsolete for over twenty years now.
>> This patch removes the special flags for libc5 and libc4 and assumes
>> that all libraries cached are libc6 compatible and use FLAG_ELF_LIBC6.
>>
>> Checked with a build for all affected architectures.
>>
>> Co-authored-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
>> Reviewed-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
> 
>> --- a/elf/readelflib.c
>> +++ b/elf/readelflib.c
>> @@ -110,16 +108,6 @@ process_elf_file (const char *file_name, const char *lib, int *flag,
>>  	  program_interpreter = (char *) (file_contents + segment->p_offset);
>>  	  check_ptr (program_interpreter);
>>  
>> -	  /* Check if this is enough to classify the binary.  */
>> -	  for (j = 0; j < sizeof (interpreters) / sizeof (interpreters [0]);
>> -	       ++j)
>> -	    if (strcmp (program_interpreter, interpreters[j].soname) == 0)
>> -	      {
>> -		*flag = interpreters[j].flag;
>> -		break;
>> -	      }
>> -	  break;
>> -
>>  	case PT_GNU_PROPERTY:
>>  	  /* The NT_GNU_PROPERTY_TYPE_0 note must be aligned to 4 bytes
>>  	     in 32-bit objects and to 8 bytes in 64-bit objects.  Skip
> 
> This hunk removes a 'break', resulting in a nonsensical
> fall-through from 'case PT_INTERP' to 'case PT_GNU_PROPERTY'.

Fixed, thanks for reporting it.

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-12-07 14:40 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-02 14:59 [PATCH 0/5] More features cleanups Adhemerval Zanella
2022-08-02 14:59 ` [PATCH 1/5] Remove missing LD_LIBRARY_VERSION usages Adhemerval Zanella
2022-08-02 15:11   ` Andreas Schwab
2022-08-02 14:59 ` [PATCH 2/5] Assume only FLAG_ELF_LIBC6 suport Adhemerval Zanella
2023-12-07 13:14   ` Alexander Monakov
2023-12-07 14:40     ` Adhemerval Zanella Netto
2022-08-02 14:59 ` [PATCH 3/5] Remove ldd libc4 support Adhemerval Zanella
2022-08-02 23:35   ` H.J. Lu
2022-08-02 14:59 ` [PATCH 4/5] arm: Remove RELA support Adhemerval Zanella
2022-08-03 18:31   ` Adhemerval Zanella Netto
2022-08-03 19:59     ` Phil Blundell
2022-08-02 14:59 ` [PATCH 5/5] i386: " Adhemerval Zanella
2022-08-02 15:13   ` H.J. Lu
2022-08-04  0:45     ` Fangrui Song

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).