Blame SOURCES/glibc-rh1505492-bounded-1.patch

c6d234
commit c2d549290d24aeae30a328a6b4061f60f095dea2
c6d234
Author: Joseph Myers <joseph@codesourcery.com>
c6d234
Date:   Thu Jan 31 22:57:06 2013 +0000
c6d234
c6d234
    Remove bp-thunks code.
c6d234
c6d234
Conflicts:
c6d234
	sysdeps/generic/bp-thunks.h
c6d234
c6d234
Copyright header change; file removed manually.
c6d234
c6d234
diff --git a/Makerules b/Makerules
c6d234
index 9e572f48728b0f56..9bd7d603fc28a4de 100644
c6d234
--- a/Makerules
c6d234
+++ b/Makerules
c6d234
@@ -419,19 +419,15 @@ static-only-routines =
c6d234
 endif
c6d234
 endif
c6d234
 
c6d234
-# Bounded pointer thunks are only built for *.ob
c6d234
-elide-bp-thunks = $(addprefix $(bppfx),$(bp-thunks))
c6d234
-
c6d234
 elide-routines.oS += $(filter-out $(static-only-routines),\
c6d234
-				  $(routines) $(aux) $(sysdep_routines)) \
c6d234
-		     $(elide-bp-thunks)
c6d234
-elide-routines.os += $(static-only-routines) $(elide-bp-thunks)
c6d234
+				  $(routines) $(aux) $(sysdep_routines))
c6d234
+elide-routines.os += $(static-only-routines)
c6d234
 
c6d234
 # If we have versioned code we don't need the old versions in any of the
c6d234
 # static libraries.
c6d234
-elide-routines.o  += $(shared-only-routines) $(elide-bp-thunks)
c6d234
-elide-routines.op += $(shared-only-routines) $(elide-bp-thunks)
c6d234
-elide-routines.og += $(shared-only-routines) $(elide-bp-thunks)
c6d234
+elide-routines.o  += $(shared-only-routines)
c6d234
+elide-routines.op += $(shared-only-routines)
c6d234
+elide-routines.og += $(shared-only-routines)
c6d234
 elide-routines.ob += $(shared-only-routines)
c6d234
 
c6d234
 # Shared library building.
c6d234
@@ -639,11 +635,7 @@ headers := $(headers) $(sysdep_headers)
c6d234
 
c6d234
 # This is the list of all object files, gotten by
c6d234
 # replacing every ".c" in `sources' with a ".o".
c6d234
-# We also add bounded-pointer thunks, which are later
c6d234
-# elided for all suffixes except for `.ob'.
c6d234
-override objects := $(addprefix $(objpfx),$(sources:.c=.o) \
c6d234
-		      $(patsubst %,$(bppfx)%.o,\
c6d234
-			$(filter $(routines) $(sysdep_routines),$(bp-thunks))))
c6d234
+override objects := $(addprefix $(objpfx),$(sources:.c=.o))
c6d234
 
c6d234
 
c6d234
 # The makefile may define $(extra-libs) with `libfoo libbar'
c6d234
diff --git a/sysdeps/generic/bp-thunks.h b/sysdeps/generic/bp-thunks.h
c6d234
deleted file mode 100644
c6d234
index 1c9bba21c80387a5..0000000000000000
c6d234
--- a/sysdeps/generic/bp-thunks.h
c6d234
+++ /dev/null
c6d234
@@ -1,69 +0,0 @@
c6d234
-/* Bounded-pointer syscall thunk support.
c6d234
-   Copyright (C) 2000, 2003 Free Software Foundation, Inc.
c6d234
-   This file is part of the GNU C Library.
c6d234
-   Contributed by Greg McGary <greg@mcgary.org>
c6d234
-
c6d234
-   The GNU C Library is free software; you can redistribute it and/or
c6d234
-   modify it under the terms of the GNU Lesser General Public
c6d234
-   License as published by the Free Software Foundation; either
c6d234
-   version 2.1 of the License, or (at your option) any later version.
c6d234
-
c6d234
-   The GNU C Library is distributed in the hope that it will be useful,
c6d234
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
c6d234
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
c6d234
-   Lesser General Public License for more details.
c6d234
-
c6d234
-   You should have received a copy of the GNU Lesser General Public
c6d234
-   License along with the GNU C Library; if not, see
c6d234
-   <http://www.gnu.org/licenses/>.  */
c6d234
-
c6d234
-#ifndef _bpthunks_h_
c6d234
-#define _bpthunks_h_
c6d234
-
c6d234
-#ifndef __ASSEMBLER__
c6d234
-
c6d234
-/* This header is included by the syscall BP thunks defined in
c6d234
-   sysd-syscalls, as created by sysdeps/unix/make-syscalls.sh.  It
c6d234
-   includes all headers that contain prototype declarations for system
c6d234
-   call functions.  */
c6d234
-
c6d234
-#include <libc-symbols.h>
c6d234
-#include <bp-sym.h>
c6d234
-#include <bp-checks.h>
c6d234
-
c6d234
-/* Get `struct timeval' definition for select.  */
c6d234
-#define __need_timeval
c6d234
-#include <bits/time.h>
c6d234
-
c6d234
-#include <stddef.h>
c6d234
-#include <unistd.h>
c6d234
-#include <sched.h>
c6d234
-#include <signal.h>
c6d234
-#include <fcntl.h>
c6d234
-#include <time.h>
c6d234
-#include <utime.h>
c6d234
-#include <stdio.h>
c6d234
-
c6d234
-#include <sys/types.h>
c6d234
-#include <sys/ioctl.h>
c6d234
-#include <sys/klog.h>
c6d234
-#include <sys/mman.h>
c6d234
-#include <sys/mount.h>
c6d234
-#include <sys/quota.h>
c6d234
-#include <sys/resource.h>
c6d234
-#include <sys/select.h>
c6d234
-#include <io/sys/sendfile.h>
c6d234
-#include <sys/socket.h>
c6d234
-#include <sys/stat.h>
c6d234
-#include <sys/statfs.h>
c6d234
-#include <sys/swap.h>
c6d234
-#include <sys/sysinfo.h>
c6d234
-#include <sys/time.h>
c6d234
-#include <sys/times.h>
c6d234
-#include <sys/timex.h>
c6d234
-#include <sys/utsname.h>
c6d234
-#include <sys/wait.h>
c6d234
-
c6d234
-#endif /* Not __ASSEMBLER__.  */
c6d234
-
c6d234
-#endif /* _bpthunks_h_ */
c6d234
diff --git a/sysdeps/unix/Makefile b/sysdeps/unix/Makefile
c6d234
index 0ba5dcbcac323bb0..b369128d0cb6c2e7 100644
c6d234
--- a/sysdeps/unix/Makefile
c6d234
+++ b/sysdeps/unix/Makefile
c6d234
@@ -89,21 +89,10 @@ $(common-objpfx)sysd-syscalls: $(..)sysdeps/unix/make-syscalls.sh \
c6d234
 	mv -f $@T $@
c6d234
 endif
c6d234
 
c6d234
-# The $(bppfx)syscall.ob objects depend on s-proto-bp.d, which are
c6d234
-# generated to specify dependencies generated BP stubs have on headers.
c6d234
-# These deps use file names relative to a subdir, so don't
c6d234
-# include them in the parent directory.
c6d234
-ifneq (,$(filter $(unix-syscalls),$(routines) $(sysdep_routines) $(aux)))
c6d234
-ifndef no_deps
c6d234
--include $(common-objpfx)s-proto-bp.d
c6d234
-endif
c6d234
-endif
c6d234
-
c6d234
 $(common-objpfx)s-%.d: $(..)sysdeps/unix/s-%.S \
c6d234
 		       $(wildcard $(+sysdep_dirs:%=%/syscalls.list))
c6d234
 	$(+make-deps)
c6d234
 
c6d234
-common-generated += s-proto-bp.d
c6d234
 postclean-generated += sysd-syscalls
c6d234
 
c6d234
 endif
c6d234
diff --git a/sysdeps/unix/make-syscalls.sh b/sysdeps/unix/make-syscalls.sh
c6d234
index 2c701a2bf59183b2..4ec17c99bc16eaee 100644
c6d234
--- a/sysdeps/unix/make-syscalls.sh
c6d234
+++ b/sysdeps/unix/make-syscalls.sh
c6d234
@@ -36,10 +36,6 @@
c6d234
 # W: wait status, optionally-NULL pointer to int (e.g., 2nd arg of wait4)
c6d234
 #
c6d234
 
c6d234
-ptr='[abBfFINpPsSWV]'	# all pointer keyletters
c6d234
-int='[inv]'		# all scalar keyletters
c6d234
-typ='[ifnNpP]'		# typed-arg keyletters: we capture type for use in thunk
c6d234
-
c6d234
 ##############################################################################
c6d234
 
c6d234
 thisdir=$1; shift
c6d234
@@ -313,114 +309,4 @@ while read file srcfile caller syscall args strong weak; do
c6d234
  ;;
c6d234
  esac
c6d234
 
c6d234
-  case x"$callnum",$srcfile,$args in
c6d234
-  x[_-],-,* | x*,*.[sS],*V*) ;;
c6d234
-  x*,-,*$ptr* | x*,*.[sS],*$ptr*)
c6d234
-
c6d234
-    nv_weak=`for name in $weak; do
c6d234
-		case $name in
c6d234
-		*@*) ;;
c6d234
-		*) echo $name;;
c6d234
-	        esac; done`
c6d234
-
c6d234
-    # choose the name with the fewest leading underscores, preferably none
c6d234
-    set `echo $strong $nv_weak |tr '@ \t' ' \n\n' |sort -r`
c6d234
-    callname=$1
c6d234
-
c6d234
-    # convert signature string to individual numbered arg names
c6d234
-    # e.g., i:ipbN -> i0 i1 p2 b3 N4
c6d234
-    set `echo $args |
c6d234
-	sed -e 's/^\(.\):\(.*\)/\2 <\10>/' \
c6d234
-	    -e 's/^\([^ ]\)\(.*\)/\2 <\11>/' \
c6d234
-	    -e 's/^\([^ ]\)\(.*\)/\2 <\12>/' \
c6d234
-	    -e 's/^\([^ ]\)\(.*\)/\2 <\13>/' \
c6d234
-	    -e 's/^\([^ ]\)\(.*\)/\2 <\14>/' \
c6d234
-	    -e 's/^\([^ ]\)\(.*\)/\2 <\15>/' \
c6d234
-	    -e 's/^\([^ ]\)\(.*\)/\2 <\16>/' \
c6d234
-	    -e 's/^\([^ ]\)\(.*\)/\2 <\17>/' \
c6d234
-	    -e 's/^\([^ ]\)\(.*\)/\2 <\18>/' \
c6d234
-	    -e 's/^\([^ ]\)\(.*\)/\2 <\19>/'`
c6d234
-    rtn=$1; shift
c6d234
-    args=$*
c6d234
-    arglist=`echo $* |sed 's/ /, /g'`
c6d234
-
c6d234
-    # The best way to understand what's going on here is to examine
c6d234
-    # the output in BUILDDIR/sysd-syscalls.
c6d234
-
c6d234
-    # generate makefile envelope & rule head
c6d234
-    echo "ifeq (,\$(filter $file,\$(bp-thunks)))"
c6d234
-    echo "bp-thunks += $file"
c6d234
-    echo "\$(objpfx)\$(bppfx)$file.ob: \$(common-objpfx)s-proto-bp.d"
c6d234
-
c6d234
-    # generate macro head
c6d234
-    echo "	(echo '#define $callname(`echo $arglist | \
c6d234
-	    sed -e 's/[<>]//g'`) `echo $rtn | \
c6d234
-	    sed -e 's/<\('$typ'0\)>/\1v;/g' \
c6d234
-		-e 's/<\(b0\)>/x0; extern char \1v;/g'` \\'; \\"
c6d234
-
c6d234
-    # generate extern decls of dummy variables for each arg
c6d234
-    echo "	 echo '`echo $args | \
c6d234
-	    sed -e 's/<\('$typ'[1-9]\)>/extern \1, \1v;/g' \
c6d234
-		-e 's/<\([abBFIsSV][1-9]\)>/extern char \1v;/g' \
c6d234
-		-e 's/<\([Wv][1-9]\)>/extern int \1v;/g'` \\'; \\"
c6d234
-
c6d234
-    # generate bounded-pointer thunk declarator
c6d234
-    echo "	 echo '`echo $rtn | \
c6d234
-	    sed -e 's/<\('$ptr'0\)>/__typeof (\1v) *__bounded/g' \
c6d234
-		-e 's/<\('$int'0\)>/__typeof (\1v)/g'` BP_SYM ($strong) (`echo $arglist | \
c6d234
-	    sed -e 's/<\('$ptr'[1-9]\)>/__typeof (\1v) *__bounded \1a/g' \
c6d234
-		-e 's/<\('$int'[1-9]\)>/__typeof (\1v) \1a/g'`) { \\'; \\"
c6d234
-
c6d234
-    # generate extern primitive syscall declaration
c6d234
-    echo "	 echo '  extern `echo $rtn | \
c6d234
-	    sed -e 's/<\('$ptr'0\)>/__typeof (\1v) *__unbounded/g' \
c6d234
-		-e 's/<\('$int'0\)>/__typeof (\1v)/g'` ($callname) (`echo $arglist | \
c6d234
-	    sed -e 's/<\('$ptr'[1-9]\)>/__typeof (\1v) *__unbounded/g' \
c6d234
-		-e 's/<\('$int'[1-9]\)>/__typeof (\1v)/g'`); \\'; \\"
c6d234
-
c6d234
-    # generate call the primtive system call, optionally wrapping bounds
c6d234
-    # around the result if the signature's return keyletter is `b'.
c6d234
-    echo "	 echo '  return `echo $rtn |
c6d234
-	    sed -e 's/<b0>/BOUNDED_N (/' \
c6d234
-		-e 's/<.0>//'`($callname) (`echo $arglist | \
c6d234
-	    sed -e 's/<\(a[1-9]\)>/__ptrvalue (\1a)/g' \
c6d234
-		-e 's/<\(n[1-9]\)>, <\(V[1-9]\)>/\1a, CHECK_N_PAGES (\2a, \1a)/g' \
c6d234
-		-e 's/<\(b[1-9]\)>, <\(n[1-9]\)>/CHECK_N (\1a, \2a), \2a/g' \
c6d234
-		-e 's/<\(b[1-9]\)>, <\(N[1-9]\)>/CHECK_N (\1a, *CHECK_1 (\2a)), __ptrvalue (\2a)/g' \
c6d234
-		-e 's/<\(B[1-9]\)>, <\(n[1-9]\)>/CHECK_N_NULL_OK (\1a, \2a), \2a/g' \
c6d234
-		-e 's/<\(B[1-9]\)>, <\(N[1-9]\)>/CHECK_N_NULL_OK (\1a, *CHECK_1 (\2a)), __ptrvalue (\2a)/g' \
c6d234
-		-e 's/<\(f[1-9]\)>/CHECK_N (\1a, 2)/g' \
c6d234
-		-e 's/<\(i[1-9]\)>, <\(F[1-9]\)>/\1a, CHECK_FCNTL (\2a, \1a)/g' \
c6d234
-		-e 's/<\(i[1-9]\)>, <\(I[1-9]\)>/\1a, CHECK_IOCTL (\2a, \1a)/g' \
c6d234
-		-e 's/<\(p[1-9]\)>/CHECK_1 (\1a)/g' \
c6d234
-		-e 's/<\([PW][1-9]\)>/CHECK_1_NULL_OK (\1a)/g' \
c6d234
-		-e 's/<\(s[1-9]\)>/CHECK_STRING (\1a)/g' \
c6d234
-		-e 's/<\(S[1-9]\)>/CHECK_STRING_NULL_OK (\1a)/g' \
c6d234
-		-e 's/<\([ivn][1-9]\)>/\1a/g'`)`echo $rtn $args |
c6d234
-	    sed -e 's/<b0>.*<\(n[1-9]\)>.*/, \1a)/' \
c6d234
-		-e 's/<.0>.*//'`; \\'; \\"
c6d234
-
c6d234
-    echo "	 echo '} \\'; \\"
c6d234
-
c6d234
-    echo "	 echo 'libc_hidden_def (BP_SYM ($strong)) \\'; \\"
c6d234
-
c6d234
-    # generate thunk aliases
c6d234
-    for name in $nv_weak; do
c6d234
-      echo "	 echo 'weak_alias (BP_SYM ($strong), BP_SYM ($name)) \\'; \\"
c6d234
-      echo "	 echo 'libc_hidden_weak (BP_SYM ($name)) \\'; \\"
c6d234
-    done
c6d234
-
c6d234
-    # wrap up
c6d234
-    echo "\
c6d234
-	 echo ''; \\
c6d234
-	 echo '#include <bp-thunks.h>'; \\
c6d234
-	) | \$(COMPILE.c) -x c -o \$@ -"
c6d234
-### Use this for debugging intermediate output:
c6d234
-### 	) >\$(@:.ob=.c)
c6d234
-### 	\$(subst -c,-E,\$(COMPILE.c)) -o \$(@:.ob=.ib) \$(@:.ob=.c)
c6d234
-### 	\$(COMPILE.c) -x cpp-output -o \$@ \$(@:.ob=.ib)"
c6d234
-    echo endif
c6d234
-    ;;
c6d234
-  esac
c6d234
-
c6d234
 done
c6d234
diff --git a/sysdeps/unix/s-proto-bp.S b/sysdeps/unix/s-proto-bp.S
c6d234
deleted file mode 100644
c6d234
index ba0363e16ffc4bd8..0000000000000000
c6d234
--- a/sysdeps/unix/s-proto-bp.S
c6d234
+++ /dev/null
c6d234
@@ -1,4 +0,0 @@
c6d234
-/* This file exists just to have its dependencies determined.
c6d234
-   Those dependencies are then used for the bp thunk objects.  */
c6d234
-
c6d234
-#include <bp-thunks.h>
c6d234
diff --git a/sysdeps/unix/sysv/linux/i386/bp-thunks.h b/sysdeps/unix/sysv/linux/i386/bp-thunks.h
c6d234
deleted file mode 100644
c6d234
index 59a42ddefe8ed33e..0000000000000000
c6d234
--- a/sysdeps/unix/sysv/linux/i386/bp-thunks.h
c6d234
+++ /dev/null
c6d234
@@ -1,4 +0,0 @@
c6d234
-#ifndef __ASSEMBLER__
c6d234
-# include <sysdeps/generic/bp-thunks.h>
c6d234
-# include <sys/vm86.h>
c6d234
-#endif