Blame SOURCES/glibc-rh1256317-19.patch

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