ce426f
commit 02657da2cf4457804ed938ee08b8316249126444
ce426f
Author: Siddhesh Poyarekar <siddhesh@redhat.com>
ce426f
Date:   Tue Sep 16 22:19:22 2014 +0530
ce426f
ce426f
    Include .interp section only for libc.so
ce426f
    
ce426f
    Barring libc.so and libdl.so, none of the libraries have any entry
ce426f
    points, so it is pointless to add a .interp section for them.  The
ce426f
    libdl.so entry point (in dlfcn/eval.c) is also defunct, so remove that
ce426f
    file as well.
ce426f
    
ce426f
    Build tested for x86_64, ppc64 and s390x.  I have not moved
ce426f
    CFLAGS-interp.c to CPPFLAGS-interp.c isnce I'll be removing it
ce426f
    completely in a follow-up patch.
ce426f
    
ce426f
    Siddhesh
ce426f
    
ce426f
    	* Makerules (lib%.so): Don't include $(+interp) in
ce426f
    	prerequisites.
ce426f
    	* elf/Makefile (CFLAGS-interp.c): Don't define NOT_IN_libc.
ce426f
    	* dlfcn/eval.c: Remove file.
ce426f
ce426f
Index: glibc-2.17-c758a686/Makerules
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/Makerules
ce426f
+++ glibc-2.17-c758a686/Makerules
ce426f
@@ -461,7 +461,7 @@ link-libc-deps = $(common-objpfx)libc.so
ce426f
 # build shared libraries in place from the installed *_pic.a files.
ce426f
 # $(LDLIBS-%.so) may contain -l switches to generate run-time dependencies
ce426f
 # on other shared objects.
ce426f
-lib%.so: lib%_pic.a $(+preinit) $(+postinit) $(+interp)
ce426f
+lib%.so: lib%_pic.a $(+preinit) $(+postinit)
ce426f
 	$(build-shlib)
ce426f
 
ce426f
 define build-shlib-helper
ce426f
Index: glibc-2.17-c758a686/dlfcn/eval.c
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/dlfcn/eval.c
ce426f
+++ /dev/null
ce426f
@@ -1,200 +0,0 @@
ce426f
-/* You don't really want to know what this hack is for.
ce426f
-   Copyright (C) 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
ce426f
-   This file is part of the GNU C Library.
ce426f
-
ce426f
-   The GNU C Library is free software; you can redistribute it and/or
ce426f
-   modify it under the terms of the GNU Lesser General Public
ce426f
-   License as published by the Free Software Foundation; either
ce426f
-   version 2.1 of the License, or (at your option) any later version.
ce426f
-
ce426f
-   The GNU C Library is distributed in the hope that it will be useful,
ce426f
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
ce426f
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
ce426f
-   Lesser General Public License for more details.
ce426f
-
ce426f
-   You should have received a copy of the GNU Lesser General Public
ce426f
-   License along with the GNU C Library; if not, see
ce426f
-   <http://www.gnu.org/licenses/>.  */
ce426f
-
ce426f
-#include <assert.h>
ce426f
-#include <ctype.h>
ce426f
-#include <dlfcn.h>
ce426f
-#include <errno.h>
ce426f
-#include <limits.h>
ce426f
-#include <stdio.h>
ce426f
-#include <stdlib.h>
ce426f
-#include <string.h>
ce426f
-#include <unistd.h>
ce426f
-
ce426f
-static void *funcall (char **stringp) __attribute_noinline__;
ce426f
-static void *eval (char **stringp);
ce426f
-
ce426f
-
ce426f
-long int weak_function
ce426f
-__strtol_internal (const char *nptr, char **endptr, int base, int group)
ce426f
-{
ce426f
-  unsigned long int result = 0;
ce426f
-  long int sign = 1;
ce426f
-
ce426f
-  while (*nptr == ' ' || *nptr == '\t')
ce426f
-    ++nptr;
ce426f
-
ce426f
-  if (*nptr == '-')
ce426f
-    {
ce426f
-      sign = -1;
ce426f
-      ++nptr;
ce426f
-    }
ce426f
-  else if (*nptr == '+')
ce426f
-    ++nptr;
ce426f
-
ce426f
-  if (*nptr < '0' || *nptr > '9')
ce426f
-    {
ce426f
-      if (endptr != NULL)
ce426f
-	*endptr = (char *) nptr;
ce426f
-      return 0L;
ce426f
-    }
ce426f
-
ce426f
-  assert (base == 0);
ce426f
-  base = 10;
ce426f
-  if (*nptr == '0')
ce426f
-    {
ce426f
-      if (nptr[1] == 'x' || nptr[1] == 'X')
ce426f
-	{
ce426f
-	  base = 16;
ce426f
-	  nptr += 2;
ce426f
-	}
ce426f
-      else
ce426f
-	base = 8;
ce426f
-    }
ce426f
-
ce426f
-  while (*nptr >= '0' && *nptr <= '9')
ce426f
-    {
ce426f
-      unsigned long int digval = *nptr - '0';
ce426f
-      if (result > LONG_MAX / 10
ce426f
-	  || (sign > 0 ? result == LONG_MAX / 10 && digval > LONG_MAX % 10
ce426f
-	      : (result == ((unsigned long int) LONG_MAX + 1) / 10
ce426f
-		 && digval > ((unsigned long int) LONG_MAX + 1) % 10)))
ce426f
-	{
ce426f
-	  errno = ERANGE;
ce426f
-	  return sign > 0 ? LONG_MAX : LONG_MIN;
ce426f
-	}
ce426f
-      result *= base;
ce426f
-      result += digval;
ce426f
-      ++nptr;
ce426f
-    }
ce426f
-
ce426f
-  return (long int) result * sign;
ce426f
-}
ce426f
-
ce426f
-
ce426f
-static void *
ce426f
-funcall (char **stringp)
ce426f
-{
ce426f
-  void *args[strlen (*stringp)], **ap = args;
ce426f
-  void *argcookie = &args[1];
ce426f
-
ce426f
-  do
ce426f
-    {
ce426f
-      /* Evaluate the next token.  */
ce426f
-      *ap++ = eval (stringp);
ce426f
-
ce426f
-      /* Whitespace is irrelevant.  */
ce426f
-      while (isspace (**stringp))
ce426f
-	++*stringp;
ce426f
-
ce426f
-      /* Terminate at closing paren or end of line.  */
ce426f
-    } while (**stringp != '\0' && **stringp != ')');
ce426f
-  if (**stringp != '\0')
ce426f
-    /* Swallow closing paren.  */
ce426f
-    ++*stringp;
ce426f
-
ce426f
-  if (args[0] == NULL)
ce426f
-    {
ce426f
-      static const char unknown[] = "Unknown function\n";
ce426f
-      write (1, unknown, sizeof unknown - 1);
ce426f
-      return NULL;
ce426f
-    }
ce426f
-
ce426f
-  /* Do it to it.  */
ce426f
-  __builtin_return (__builtin_apply (args[0],
ce426f
-				     &argcookie,
ce426f
-				     (char *) ap - (char *) &args[1]));
ce426f
-}
ce426f
-
ce426f
-static void *
ce426f
-eval (char **stringp)
ce426f
-{
ce426f
-  void *value;
ce426f
-  char *p = *stringp, c;
ce426f
-
ce426f
-  /* Whitespace is irrelevant.  */
ce426f
-  while (isspace (*p))
ce426f
-    ++p;
ce426f
-
ce426f
-  switch (*p)
ce426f
-    {
ce426f
-    case '"':
ce426f
-      /* String constant.  */
ce426f
-      value = ++p;
ce426f
-      do
ce426f
-	if (*p == '\\')
ce426f
-	  {
ce426f
-	    switch (*strcpy (p, p + 1))
ce426f
-	      {
ce426f
-	      case 't':
ce426f
-		*p = '\t';
ce426f
-		break;
ce426f
-	      case 'n':
ce426f
-		*p = '\n';
ce426f
-		break;
ce426f
-	      }
ce426f
-	    ++p;
ce426f
-	  }
ce426f
-      while (*p != '\0' && *p++ != '"');
ce426f
-      if (p[-1] == '"')
ce426f
-	p[-1] = '\0';
ce426f
-      break;
ce426f
-
ce426f
-    case '(':
ce426f
-      *stringp = ++p;
ce426f
-      return funcall (stringp);
ce426f
-
ce426f
-    default:
ce426f
-      /* Try to parse it as a number.  */
ce426f
-      value = (void *) __strtol_internal (p, stringp, 0, 0);
ce426f
-      if (*stringp != p)
ce426f
-	return value;
ce426f
-
ce426f
-      /* Anything else is a symbol that produces its address.  */
ce426f
-      value = p;
ce426f
-      do
ce426f
-	++p;
ce426f
-      while (*p != '\0' && !isspace (*p) && (!ispunct (*p) || *p == '_'));
ce426f
-      c = *p;
ce426f
-      *p = '\0';
ce426f
-      value = dlsym (NULL, value);
ce426f
-      *p = c;
ce426f
-      break;
ce426f
-    }
ce426f
-
ce426f
-  *stringp = p;
ce426f
-  return value;
ce426f
-}
ce426f
-
ce426f
-
ce426f
-extern void _start (void) __attribute__ ((noreturn));
ce426f
-void
ce426f
-__attribute__ ((noreturn))
ce426f
-_start (void)
ce426f
-{
ce426f
-  char *buf = NULL;
ce426f
-  size_t bufsz = 0;
ce426f
-
ce426f
-  while (__getdelim (&buf, &bufsz, '\n', stdin) > 0)
ce426f
-    {
ce426f
-      char *p = buf;
ce426f
-      eval (&p);
ce426f
-    }
ce426f
-
ce426f
-  exit (0);
ce426f
-}
ce426f
Index: glibc-2.17-c758a686/elf/Makefile
ce426f
===================================================================
ce426f
--- glibc-2.17-c758a686.orig/elf/Makefile
ce426f
+++ glibc-2.17-c758a686/elf/Makefile
ce426f
@@ -345,8 +345,7 @@ $(objpfx)ld.so: $(objpfx)librtld.os $(ld
ce426f
 	  | $(AWK) '($$7 ~ /^UND(|EF)$$/ && $$1 != "0:" && $$4 != "REGISTER") { print; p=1 } END { exit p != 0 }'
ce426f
 
ce426f
 # interp.c exists just to get this string into the libraries.
ce426f
-CFLAGS-interp.c = -D'RUNTIME_LINKER="$(rtlddir)/$(rtld-installed-name)"' \
ce426f
-		  -DNOT_IN_libc=1
ce426f
+CFLAGS-interp.c = -D'RUNTIME_LINKER="$(rtlddir)/$(rtld-installed-name)"'
ce426f
 $(objpfx)interp.os: $(common-objpfx)config.make
ce426f
 
ce426f
 ifneq (ld.so,$(rtld-installed-name))