svn commit: r216827 - in projects/binutils-2.17: . bin/sh
contrib/top etc etc/rc.d gnu/lib/libgcc lib/libc/locale
lib/libc/rpc lib/libcompiler_rt lib/libkvm lib/libthr/thread
libexec/rtld-elf libex...
Dimitry Andric
dim at FreeBSD.org
Thu Dec 30 23:35:24 UTC 2010
Author: dim
Date: Thu Dec 30 23:35:23 2010
New Revision: 216827
URL: http://svn.freebsd.org/changeset/base/216827
Log:
Sync: merge r216683 through r216826 from ^/head.
Added:
projects/binutils-2.17/tools/regression/bin/sh/expansion/cmdsubst10.0
- copied unchanged from r216826, head/tools/regression/bin/sh/expansion/cmdsubst10.0
projects/binutils-2.17/tools/regression/bin/sh/expansion/cmdsubst4.0
- copied unchanged from r216826, head/tools/regression/bin/sh/expansion/cmdsubst4.0
projects/binutils-2.17/tools/regression/bin/sh/expansion/cmdsubst5.0
- copied unchanged from r216826, head/tools/regression/bin/sh/expansion/cmdsubst5.0
projects/binutils-2.17/tools/regression/bin/sh/expansion/cmdsubst6.0
- copied unchanged from r216826, head/tools/regression/bin/sh/expansion/cmdsubst6.0
projects/binutils-2.17/tools/regression/bin/sh/expansion/cmdsubst7.0
- copied unchanged from r216826, head/tools/regression/bin/sh/expansion/cmdsubst7.0
projects/binutils-2.17/tools/regression/bin/sh/expansion/cmdsubst8.0
- copied unchanged from r216826, head/tools/regression/bin/sh/expansion/cmdsubst8.0
projects/binutils-2.17/tools/regression/bin/sh/expansion/cmdsubst9.0
- copied unchanged from r216826, head/tools/regression/bin/sh/expansion/cmdsubst9.0
projects/binutils-2.17/tools/regression/bin/sh/expansion/plus-minus7.0
- copied unchanged from r216826, head/tools/regression/bin/sh/expansion/plus-minus7.0
Deleted:
projects/binutils-2.17/sys/dev/cxgb/ulp/tom/cxgb_vm.c
projects/binutils-2.17/sys/dev/cxgb/ulp/tom/cxgb_vm.h
Modified:
projects/binutils-2.17/Makefile
projects/binutils-2.17/UPDATING
projects/binutils-2.17/bin/sh/eval.c
projects/binutils-2.17/bin/sh/exec.c
projects/binutils-2.17/bin/sh/expand.c
projects/binutils-2.17/bin/sh/expand.h
projects/binutils-2.17/bin/sh/histedit.c
projects/binutils-2.17/bin/sh/memalloc.c
projects/binutils-2.17/bin/sh/memalloc.h
projects/binutils-2.17/bin/sh/parser.c
projects/binutils-2.17/etc/portsnap.conf
projects/binutils-2.17/etc/rc.d/devd
projects/binutils-2.17/gnu/lib/libgcc/Makefile
projects/binutils-2.17/lib/libc/locale/mbrtowc.3
projects/binutils-2.17/lib/libc/rpc/publickey.3
projects/binutils-2.17/lib/libcompiler_rt/Makefile
projects/binutils-2.17/lib/libkvm/kvm_getloadavg.3
projects/binutils-2.17/lib/libthr/thread/thr_mutex.c
projects/binutils-2.17/libexec/rtld-elf/Makefile
projects/binutils-2.17/libexec/rtld-elf/amd64/reloc.c
projects/binutils-2.17/libexec/rtld-elf/arm/reloc.c
projects/binutils-2.17/libexec/rtld-elf/i386/reloc.c
projects/binutils-2.17/libexec/rtld-elf/ia64/reloc.c
projects/binutils-2.17/libexec/rtld-elf/mips/reloc.c
projects/binutils-2.17/libexec/rtld-elf/powerpc/reloc.c
projects/binutils-2.17/libexec/rtld-elf/powerpc64/reloc.c
projects/binutils-2.17/libexec/rtld-elf/powerpc64/rtld_start.S
projects/binutils-2.17/libexec/rtld-elf/rtld.1
projects/binutils-2.17/libexec/rtld-elf/rtld.c
projects/binutils-2.17/libexec/rtld-elf/rtld.h
projects/binutils-2.17/libexec/rtld-elf/rtld_lock.c
projects/binutils-2.17/libexec/rtld-elf/rtld_lock.h
projects/binutils-2.17/libexec/rtld-elf/sparc64/reloc.c
projects/binutils-2.17/sbin/dumpfs/dumpfs.c
projects/binutils-2.17/sbin/hastd/parse.y
projects/binutils-2.17/sbin/mount_nfs/mount_nfs.c
projects/binutils-2.17/sbin/newfs/mkfs.c
projects/binutils-2.17/sbin/newfs/newfs.8
projects/binutils-2.17/sbin/newfs/newfs.c
projects/binutils-2.17/sbin/newfs/newfs.h
projects/binutils-2.17/sbin/shutdown/Makefile
projects/binutils-2.17/sbin/shutdown/shutdown.8
projects/binutils-2.17/sbin/shutdown/shutdown.c
projects/binutils-2.17/sbin/tunefs/tunefs.8
projects/binutils-2.17/sbin/tunefs/tunefs.c
projects/binutils-2.17/share/examples/etc/make.conf
projects/binutils-2.17/share/mk/bsd.cpu.mk
projects/binutils-2.17/sys/compat/linux/linux_ioctl.c
projects/binutils-2.17/sys/compat/linux/linux_ioctl.h
projects/binutils-2.17/sys/conf/kern.pre.mk
projects/binutils-2.17/sys/conf/makeLINT.mk
projects/binutils-2.17/sys/dev/cxgb/ulp/tom/cxgb_cpl_socket.c
projects/binutils-2.17/sys/dev/cxgb/ulp/tom/cxgb_ddp.c
projects/binutils-2.17/sys/dev/drm/via_dmablit.c
projects/binutils-2.17/sys/dev/md/md.c
projects/binutils-2.17/sys/dev/mpt/mpt_pci.c
projects/binutils-2.17/sys/dev/sound/pci/hda/hdac.c
projects/binutils-2.17/sys/dev/wpi/if_wpi.c
projects/binutils-2.17/sys/dev/xen/console/console.c
projects/binutils-2.17/sys/fs/nfs/nfs.h
projects/binutils-2.17/sys/fs/nfs/nfs_commonsubs.c
projects/binutils-2.17/sys/fs/nfs/nfs_var.h
projects/binutils-2.17/sys/fs/nfsserver/nfs_nfsdport.c
projects/binutils-2.17/sys/fs/nfsserver/nfs_nfsdserv.c
projects/binutils-2.17/sys/fs/nfsserver/nfs_nfsdsocket.c
projects/binutils-2.17/sys/geom/geom_disk.c
projects/binutils-2.17/sys/geom/part/g_part_ebr.c
projects/binutils-2.17/sys/i386/conf/XBOX
projects/binutils-2.17/sys/i386/conf/XEN
projects/binutils-2.17/sys/i386/xen/pmap.c
projects/binutils-2.17/sys/kern/kern_resource.c
projects/binutils-2.17/sys/kern/kern_timeout.c
projects/binutils-2.17/sys/kern/kern_umtx.c
projects/binutils-2.17/sys/kern/sched_4bsd.c
projects/binutils-2.17/sys/kern/sched_ule.c
projects/binutils-2.17/sys/kern/sys_pipe.c
projects/binutils-2.17/sys/kern/uipc_cow.c
projects/binutils-2.17/sys/kern/vfs_bio.c
projects/binutils-2.17/sys/kern/vfs_subr.c
projects/binutils-2.17/sys/mips/cavium/octeon_machdep.c
projects/binutils-2.17/sys/net/bpf_zerocopy.c
projects/binutils-2.17/sys/netinet/in_pcb.c
projects/binutils-2.17/sys/netinet/sctp_asconf.c
projects/binutils-2.17/sys/netinet/sctp_bsd_addr.c
projects/binutils-2.17/sys/netinet/sctp_constants.h
projects/binutils-2.17/sys/netinet/sctp_indata.c
projects/binutils-2.17/sys/netinet/sctp_input.c
projects/binutils-2.17/sys/netinet/sctp_output.c
projects/binutils-2.17/sys/netinet/sctp_pcb.c
projects/binutils-2.17/sys/netinet/sctp_timer.c
projects/binutils-2.17/sys/netinet/sctp_usrreq.c
projects/binutils-2.17/sys/netinet/sctputil.c
projects/binutils-2.17/sys/netinet/tcp_input.c
projects/binutils-2.17/sys/netinet/tcp_output.c
projects/binutils-2.17/sys/netinet/tcp_sack.c
projects/binutils-2.17/sys/netinet/tcp_subr.c
projects/binutils-2.17/sys/netinet/tcp_var.h
projects/binutils-2.17/sys/nfsserver/nfs_serv.c
projects/binutils-2.17/sys/powerpc/aim/moea64_native.c
projects/binutils-2.17/sys/sparc64/include/asmacros.h
projects/binutils-2.17/sys/sparc64/include/cpufunc.h
projects/binutils-2.17/sys/sparc64/include/pmap.h
projects/binutils-2.17/sys/sparc64/include/tsb.h
projects/binutils-2.17/sys/sparc64/sparc64/exception.S
projects/binutils-2.17/sys/sparc64/sparc64/genassym.c
projects/binutils-2.17/sys/sparc64/sparc64/mp_machdep.c
projects/binutils-2.17/sys/sparc64/sparc64/pmap.c
projects/binutils-2.17/sys/sparc64/sparc64/support.S
projects/binutils-2.17/sys/sparc64/sparc64/tsb.c
projects/binutils-2.17/sys/sys/param.h
projects/binutils-2.17/sys/sys/sched.h
projects/binutils-2.17/sys/ufs/ffs/ffs_alloc.c
projects/binutils-2.17/sys/ufs/ffs/ffs_softdep.c
projects/binutils-2.17/sys/ufs/ffs/ffs_vfsops.c
projects/binutils-2.17/sys/ufs/ffs/fs.h
projects/binutils-2.17/sys/ufs/ffs/softdep.h
projects/binutils-2.17/sys/ufs/ufs/ufs_inode.c
projects/binutils-2.17/sys/ufs/ufs/ufs_vnops.c
projects/binutils-2.17/sys/ufs/ufs/ufsmount.h
projects/binutils-2.17/sys/vm/vm_contig.c
projects/binutils-2.17/sys/vm/vm_extern.h
projects/binutils-2.17/sys/vm/vm_fault.c
projects/binutils-2.17/sys/vm/vm_object.c
projects/binutils-2.17/sys/vm/vm_object.h
projects/binutils-2.17/sys/vm/vm_page.c
projects/binutils-2.17/sys/xen/evtchn/evtchn.c
projects/binutils-2.17/tools/regression/bin/sh/expansion/plus-minus1.0
projects/binutils-2.17/usr.bin/ar/ar.1
projects/binutils-2.17/usr.bin/c89/c89.1
projects/binutils-2.17/usr.bin/c99/c99.1
projects/binutils-2.17/usr.bin/calendar/calendar.1
projects/binutils-2.17/usr.bin/calendar/calendar.h
projects/binutils-2.17/usr.bin/calendar/parsedata.c
projects/binutils-2.17/usr.bin/gcore/gcore.1
projects/binutils-2.17/usr.bin/lock/lock.c
projects/binutils-2.17/usr.bin/mail/mail.1
projects/binutils-2.17/usr.bin/printf/printf.c
projects/binutils-2.17/usr.bin/tar/bsdtar.1
projects/binutils-2.17/usr.sbin/ancontrol/ancontrol.8
Directory Properties:
projects/binutils-2.17/ (props changed)
projects/binutils-2.17/cddl/contrib/opensolaris/ (props changed)
projects/binutils-2.17/contrib/bind9/ (props changed)
projects/binutils-2.17/contrib/binutils/ (props changed)
projects/binutils-2.17/contrib/bzip2/ (props changed)
projects/binutils-2.17/contrib/ee/ (props changed)
projects/binutils-2.17/contrib/expat/ (props changed)
projects/binutils-2.17/contrib/file/ (props changed)
projects/binutils-2.17/contrib/gdb/ (props changed)
projects/binutils-2.17/contrib/gdtoa/ (props changed)
projects/binutils-2.17/contrib/gnu-sort/ (props changed)
projects/binutils-2.17/contrib/groff/ (props changed)
projects/binutils-2.17/contrib/less/ (props changed)
projects/binutils-2.17/contrib/libpcap/ (props changed)
projects/binutils-2.17/contrib/llvm/ (props changed)
projects/binutils-2.17/contrib/llvm/tools/clang/ (props changed)
projects/binutils-2.17/contrib/ncurses/ (props changed)
projects/binutils-2.17/contrib/netcat/ (props changed)
projects/binutils-2.17/contrib/ntp/ (props changed)
projects/binutils-2.17/contrib/one-true-awk/ (props changed)
projects/binutils-2.17/contrib/openbsm/ (props changed)
projects/binutils-2.17/contrib/openpam/ (props changed)
projects/binutils-2.17/contrib/pf/ (props changed)
projects/binutils-2.17/contrib/sendmail/ (props changed)
projects/binutils-2.17/contrib/tcpdump/ (props changed)
projects/binutils-2.17/contrib/tcsh/ (props changed)
projects/binutils-2.17/contrib/top/ (props changed)
projects/binutils-2.17/contrib/top/install-sh (props changed)
projects/binutils-2.17/contrib/tzcode/stdtime/ (props changed)
projects/binutils-2.17/contrib/tzcode/zic/ (props changed)
projects/binutils-2.17/contrib/tzdata/ (props changed)
projects/binutils-2.17/contrib/wpa/ (props changed)
projects/binutils-2.17/contrib/xz/ (props changed)
projects/binutils-2.17/crypto/openssh/ (props changed)
projects/binutils-2.17/crypto/openssl/ (props changed)
projects/binutils-2.17/lib/libc/ (props changed)
projects/binutils-2.17/lib/libc/stdtime/ (props changed)
projects/binutils-2.17/lib/libutil/ (props changed)
projects/binutils-2.17/lib/libz/ (props changed)
projects/binutils-2.17/sbin/ (props changed)
projects/binutils-2.17/sbin/ipfw/ (props changed)
projects/binutils-2.17/share/mk/bsd.arch.inc.mk (props changed)
projects/binutils-2.17/share/zoneinfo/ (props changed)
projects/binutils-2.17/sys/ (props changed)
projects/binutils-2.17/sys/amd64/include/xen/ (props changed)
projects/binutils-2.17/sys/cddl/contrib/opensolaris/ (props changed)
projects/binutils-2.17/sys/contrib/dev/acpica/ (props changed)
projects/binutils-2.17/sys/contrib/octeon-sdk/ (props changed)
projects/binutils-2.17/sys/contrib/pf/ (props changed)
projects/binutils-2.17/sys/contrib/x86emu/ (props changed)
projects/binutils-2.17/usr.bin/calendar/ (props changed)
projects/binutils-2.17/usr.bin/csup/ (props changed)
projects/binutils-2.17/usr.bin/procstat/ (props changed)
projects/binutils-2.17/usr.sbin/zic/ (props changed)
Modified: projects/binutils-2.17/Makefile
==============================================================================
--- projects/binutils-2.17/Makefile Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/Makefile Thu Dec 30 23:35:23 2010 (r216827)
@@ -350,8 +350,8 @@ KERNCONFS!= cd ${.CURDIR}/sys/${TARGET}/
universe_kernconfs:
.for kernel in ${KERNCONFS}
TARGET_ARCH_${kernel}!= cd ${.CURDIR}/sys/${TARGET}/conf && \
- config -m ${.CURDIR}/sys/${TARGET}/conf/${kernel} | \
- cut -f 2
+ config -m ${.CURDIR}/sys/${TARGET}/conf/${kernel} 2> /dev/null | \
+ cut -f 2
universe_kernconfs: universe_kernconf_${TARGET}_${kernel}
universe_kernconf_${TARGET}_${kernel}:
@(cd ${.CURDIR} && env __MAKE_CONF=/dev/null \
Modified: projects/binutils-2.17/UPDATING
==============================================================================
--- projects/binutils-2.17/UPDATING Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/UPDATING Thu Dec 30 23:35:23 2010 (r216827)
@@ -22,6 +22,13 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.
machines to maximize performance. (To disable malloc debugging, run
ln -s aj /etc/malloc.conf.)
+20101228:
+ The TCP stack has been modified to allow Khelp modules to interact with
+ it via helper hook points and store per-connection data in the TCP
+ control block. Bump __FreeBSD_version to 900029. User space tools that
+ rely on the size of struct tcpcb in tcp_var.h (e.g. sockstat) need to
+ be recompiled.
+
20101114:
Generic IEEE 802.3 annex 31B full duplex flow control support has been
added to mii(4) and bge(4), bce(4), msk(4), nfe(4) and stge(4) along
Modified: projects/binutils-2.17/bin/sh/eval.c
==============================================================================
--- projects/binutils-2.17/bin/sh/eval.c Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/bin/sh/eval.c Thu Dec 30 23:35:23 2010 (r216827)
@@ -94,6 +94,7 @@ static void evalsubshell(union node *, i
static void evalredir(union node *, int);
static void expredir(union node *);
static void evalpipe(union node *);
+static int is_valid_fast_cmdsubst(union node *n);
static void evalcommand(union node *, int, struct backcmd *);
static void prehash(union node *);
@@ -565,6 +566,19 @@ evalpipe(union node *n)
+static int
+is_valid_fast_cmdsubst(union node *n)
+{
+ union node *argp;
+
+ if (n->type != NCMD)
+ return 0;
+ for (argp = n->ncmd.args ; argp ; argp = argp->narg.next)
+ if (expandhassideeffects(argp->narg.text))
+ return 0;
+ return 1;
+}
+
/*
* Execute a command inside back quotes. If it's a builtin command, we
* want to save its output in a block obtained from malloc. Otherwise
@@ -578,6 +592,8 @@ evalbackcmd(union node *n, struct backcm
int pip[2];
struct job *jp;
struct stackmark smark; /* unnecessary */
+ struct jmploc jmploc;
+ struct jmploc *savehandler;
setstackmark(&smark);
result->fd = -1;
@@ -588,9 +604,21 @@ evalbackcmd(union node *n, struct backcm
exitstatus = 0;
goto out;
}
- if (n->type == NCMD) {
+ if (is_valid_fast_cmdsubst(n)) {
exitstatus = oexitstatus;
- evalcommand(n, EV_BACKCMD, result);
+ savehandler = handler;
+ if (setjmp(jmploc.loc)) {
+ if (exception == EXERROR || exception == EXEXEC)
+ exitstatus = 2;
+ else if (exception != 0) {
+ handler = savehandler;
+ longjmp(handler->loc, 1);
+ }
+ } else {
+ handler = &jmploc;
+ evalcommand(n, EV_BACKCMD, result);
+ }
+ handler = savehandler;
} else {
exitstatus = 0;
if (pipe(pip) < 0)
@@ -615,7 +643,31 @@ out:
result->fd, result->buf, result->nleft, result->jp));
}
-
+/*
+ * Check if a builtin can safely be executed in the same process,
+ * even though it should be in a subshell (command substitution).
+ * Note that jobid, jobs, times and trap can show information not
+ * available in a child process; this is deliberate.
+ * The arguments should already have been expanded.
+ */
+static int
+safe_builtin(int idx, int argc, char **argv)
+{
+ if (idx == BLTINCMD || idx == COMMANDCMD || idx == ECHOCMD ||
+ idx == FALSECMD || idx == JOBIDCMD || idx == JOBSCMD ||
+ idx == KILLCMD || idx == PRINTFCMD || idx == PWDCMD ||
+ idx == TESTCMD || idx == TIMESCMD || idx == TRUECMD ||
+ idx == TYPECMD)
+ return (1);
+ if (idx == EXPORTCMD || idx == TRAPCMD || idx == ULIMITCMD ||
+ idx == UMASKCMD)
+ return (argc <= 1 || (argc == 2 && argv[1][0] == '-'));
+ if (idx == SETCMD)
+ return (argc <= 1 || (argc == 2 && (argv[1][0] == '-' ||
+ argv[1][0] == '+') && argv[1][1] == 'o' &&
+ argv[1][2] == '\0'));
+ return (0);
+}
/*
* Execute a simple command.
@@ -833,10 +885,8 @@ evalcommand(union node *cmd, int flags,
|| ((cmdentry.cmdtype == CMDNORMAL || cmdentry.cmdtype == CMDUNKNOWN)
&& ((flags & EV_EXIT) == 0 || have_traps()))
|| ((flags & EV_BACKCMD) != 0
- && (cmdentry.cmdtype != CMDBUILTIN
- || cmdentry.u.index == CDCMD
- || cmdentry.u.index == DOTCMD
- || cmdentry.u.index == EVALCMD))) {
+ && (cmdentry.cmdtype != CMDBUILTIN ||
+ !safe_builtin(cmdentry.u.index, argc, argv)))) {
jp = makejob(cmd, 1);
mode = cmd->ncmd.backgnd;
if (flags & EV_BACKCMD) {
Modified: projects/binutils-2.17/bin/sh/exec.c
==============================================================================
--- projects/binutils-2.17/bin/sh/exec.c Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/bin/sh/exec.c Thu Dec 30 23:35:23 2010 (r216827)
@@ -190,9 +190,8 @@ padvance(const char **path, const char *
for (p = start; *p && *p != ':' && *p != '%'; p++)
; /* nothing */
len = p - start + strlen(name) + 2; /* "2" is for '/' and '\0' */
- while (stackblocksize() < len)
- growstackblock();
- q = stackblock();
+ STARTSTACKSTR(q);
+ CHECKSTRSPACE(len, q);
if (p != start) {
memcpy(q, start, p - start);
q += p - start;
Modified: projects/binutils-2.17/bin/sh/expand.c
==============================================================================
--- projects/binutils-2.17/bin/sh/expand.c Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/bin/sh/expand.c Thu Dec 30 23:35:23 2010 (r216827)
@@ -502,13 +502,14 @@ expbackq(union node *cmd, int quoted, in
if (lastc == '\n') {
nnl++;
} else {
+ CHECKSTRSPACE(nnl + 2, dest);
while (nnl > 0) {
nnl--;
- STPUTC('\n', dest);
+ USTPUTC('\n', dest);
}
if (quotes && syntax[(int)lastc] == CCTL)
- STPUTC(CTLESC, dest);
- STPUTC(lastc, dest);
+ USTPUTC(CTLESC, dest);
+ USTPUTC(lastc, dest);
}
}
}
@@ -1569,6 +1570,78 @@ cvtnum(int num, char *buf)
}
/*
+ * Check statically if expanding a string may have side effects.
+ */
+int
+expandhassideeffects(const char *p)
+{
+ int c;
+ int arinest;
+
+ arinest = 0;
+ while ((c = *p++) != '\0') {
+ switch (c) {
+ case CTLESC:
+ p++;
+ break;
+ case CTLVAR:
+ c = *p++;
+ /* Expanding $! sets the job to remembered. */
+ if (*p == '!')
+ return 1;
+ if ((c & VSTYPE) == VSASSIGN)
+ return 1;
+ /*
+ * If we are in arithmetic, the parameter may contain
+ * '=' which may cause side effects. Exceptions are
+ * the length of a parameter and $$, $# and $? which
+ * are always numeric.
+ */
+ if ((c & VSTYPE) == VSLENGTH) {
+ while (*p != '=')
+ p++;
+ p++;
+ break;
+ }
+ if ((*p == '$' || *p == '#' || *p == '?') &&
+ p[1] == '=') {
+ p += 2;
+ break;
+ }
+ if (arinest > 0)
+ return 1;
+ break;
+ case CTLBACKQ:
+ case CTLBACKQ | CTLQUOTE:
+ if (arinest > 0)
+ return 1;
+ break;
+ case CTLARI:
+ arinest++;
+ break;
+ case CTLENDARI:
+ arinest--;
+ break;
+ case '=':
+ if (*p == '=') {
+ /* Allow '==' operator. */
+ p++;
+ continue;
+ }
+ if (arinest > 0)
+ return 1;
+ break;
+ case '!': case '<': case '>':
+ /* Allow '!=', '<=', '>=' operators. */
+ if (*p == '=')
+ p++;
+ break;
+ }
+ }
+ return 0;
+}
+
+/*
* Do most of the work for wordexp(3).
*/
Modified: projects/binutils-2.17/bin/sh/expand.h
==============================================================================
--- projects/binutils-2.17/bin/sh/expand.h Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/bin/sh/expand.h Thu Dec 30 23:35:23 2010 (r216827)
@@ -63,4 +63,5 @@ void expari(int);
int patmatch(const char *, const char *, int);
void rmescapes(char *);
int casematch(union node *, const char *);
+int expandhassideeffects(const char *);
int wordexpcmd(int, char **);
Modified: projects/binutils-2.17/bin/sh/histedit.c
==============================================================================
--- projects/binutils-2.17/bin/sh/histedit.c Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/bin/sh/histedit.c Thu Dec 30 23:35:23 2010 (r216827)
@@ -232,6 +232,7 @@ histcmd(int argc, char **argv)
}
argc -= optind, argv += optind;
+ savehandler = handler;
/*
* If executing...
*/
@@ -242,7 +243,6 @@ histcmd(int argc, char **argv)
* Catch interrupts to reset active counter and
* cleanup temp files.
*/
- savehandler = handler;
if (setjmp(jmploc.loc)) {
active = 0;
if (editfile)
@@ -399,6 +399,7 @@ histcmd(int argc, char **argv)
--active;
if (displayhist)
displayhist = 0;
+ handler = savehandler;
return 0;
}
Modified: projects/binutils-2.17/bin/sh/memalloc.c
==============================================================================
--- projects/binutils-2.17/bin/sh/memalloc.c Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/bin/sh/memalloc.c Thu Dec 30 23:35:23 2010 (r216827)
@@ -127,7 +127,7 @@ static struct stack_block *stackp;
static struct stackmark *markp;
char *stacknxt;
int stacknleft;
-int sstrnleft;
+char *sstrend;
static void
@@ -146,6 +146,7 @@ stnewblock(int nbytes)
sp->prev = stackp;
stacknxt = SPACE(sp);
stacknleft = allocsize - (stacknxt - (char*)sp);
+ sstrend = stacknxt + stacknleft;
stackp = sp;
INTON;
}
@@ -204,6 +205,7 @@ popstackmark(struct stackmark *mark)
}
stacknxt = mark->stacknxt;
stacknleft = mark->stacknleft;
+ sstrend = stacknxt + stacknleft;
INTON;
}
@@ -218,8 +220,8 @@ popstackmark(struct stackmark *mark)
* part of the block that has been used.
*/
-void
-growstackblock(void)
+static void
+growstackblock(int min)
{
char *p;
int newlen;
@@ -229,8 +231,15 @@ growstackblock(void)
struct stack_block *oldstackp;
struct stackmark *xmark;
- newlen = (stacknleft == 0) ? MINSIZE : stacknleft * 2 + 100;
- newlen = ALIGN(newlen);
+ if (min < stacknleft)
+ min = stacknleft;
+ if (min >= INT_MAX / 2 - ALIGN(sizeof(struct stack_block)))
+ error("Out of space");
+ min += stacknleft;
+ min += ALIGN(sizeof(struct stack_block));
+ newlen = 512;
+ while (newlen < min)
+ newlen <<= 1;
oldspace = stacknxt;
oldlen = stacknleft;
@@ -243,6 +252,7 @@ growstackblock(void)
stackp = sp;
stacknxt = SPACE(sp);
stacknleft = newlen - (stacknxt - (char*)sp);
+ sstrend = stacknxt + stacknleft;
/*
* Stack marks pointing to the start of the old block
@@ -257,6 +267,7 @@ growstackblock(void)
}
INTON;
} else {
+ newlen -= ALIGN(sizeof(struct stack_block));
p = stalloc(newlen);
if (oldlen != 0)
memcpy(p, oldspace, oldlen);
@@ -295,10 +306,9 @@ grabstackblock(int len)
*/
static char *
-growstrstackblock(int n)
+growstrstackblock(int n, int min)
{
- growstackblock();
- sstrnleft = stackblocksize() - n;
+ growstackblock(min);
return stackblock() + n;
}
@@ -308,7 +318,7 @@ growstackstr(void)
int len;
len = stackblocksize();
- return growstrstackblock(len);
+ return (growstrstackblock(len, 0));
}
@@ -317,33 +327,21 @@ growstackstr(void)
*/
char *
-makestrspace(void)
+makestrspace(int min, char *p)
{
int len;
- len = stackblocksize() - sstrnleft;
- return growstrstackblock(len);
-}
-
-
-
-void
-ungrabstackstr(char *s, char *p)
-{
- stacknleft += stacknxt - s;
- stacknxt = s;
- sstrnleft = stacknleft - (p - s);
+ len = p - stackblock();
+ return (growstrstackblock(len, min));
}
char *
stputbin(const char *data, int len, char *p)
{
- int i;
-
- for (i = 0; i < len; i++)
- STPUTC(data[i], p);
- return (p);
+ CHECKSTRSPACE(len, p);
+ memcpy(p, data, len);
+ return (p + len);
}
char *
Modified: projects/binutils-2.17/bin/sh/memalloc.h
==============================================================================
--- projects/binutils-2.17/bin/sh/memalloc.h Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/bin/sh/memalloc.h Thu Dec 30 23:35:23 2010 (r216827)
@@ -45,7 +45,7 @@ struct stackmark {
extern char *stacknxt;
extern int stacknleft;
-extern int sstrnleft;
+extern char *sstrend;
pointer ckmalloc(size_t);
pointer ckrealloc(pointer, int);
@@ -55,11 +55,9 @@ pointer stalloc(int);
void stunalloc(pointer);
void setstackmark(struct stackmark *);
void popstackmark(struct stackmark *);
-void growstackblock(void);
void grabstackblock(int);
char *growstackstr(void);
-char *makestrspace(void);
-void ungrabstackstr(char *, char *);
+char *makestrspace(int, char *);
char *stputbin(const char *data, int len, char *p);
char *stputs(const char *data, char *p);
@@ -67,10 +65,10 @@ char *stputs(const char *data, char *p);
#define stackblock() stacknxt
#define stackblocksize() stacknleft
-#define STARTSTACKSTR(p) p = stackblock(), sstrnleft = stackblocksize()
-#define STPUTC(c, p) (--sstrnleft >= 0? (*p++ = (c)) : (p = growstackstr(), --sstrnleft, *p++ = (c)))
-#define CHECKSTRSPACE(n, p) { if (sstrnleft < n) p = makestrspace(); }
-#define USTPUTC(c, p) (--sstrnleft, *p++ = (c))
+#define STARTSTACKSTR(p) p = stackblock()
+#define STPUTC(c, p) do { if (p == sstrend) p = growstackstr(); *p++ = (c); } while(0)
+#define CHECKSTRSPACE(n, p) { if (sstrend - p < n) p = makestrspace(n, p); }
+#define USTPUTC(c, p) (*p++ = (c))
/*
* STACKSTRNUL's use is where we want to be able to turn a stack
* (non-sentinel, character counting string) into a C string,
@@ -78,10 +76,11 @@ char *stputs(const char *data, char *p);
* Note: Because of STACKSTRNUL's semantics, STACKSTRNUL cannot be used
* on a stack that will grabstackstr()ed.
*/
-#define STACKSTRNUL(p) (sstrnleft == 0? (p = growstackstr(), *p = '\0') : (*p = '\0'))
-#define STUNPUTC(p) (++sstrnleft, --p)
+#define STACKSTRNUL(p) (p == sstrend ? (p = growstackstr(), *p = '\0') : (*p = '\0'))
+#define STUNPUTC(p) (--p)
#define STTOPC(p) p[-1]
-#define STADJUST(amount, p) (p += (amount), sstrnleft -= (amount))
-#define grabstackstr(p) stalloc(stackblocksize() - sstrnleft)
+#define STADJUST(amount, p) (p += (amount))
+#define grabstackstr(p) stalloc((char *)p - stackblock())
+#define ungrabstackstr(s, p) stunalloc((s))
#define STPUTBIN(s, len, p) p = stputbin((s), (len), p)
#define STPUTS(s, p) p = stputs((s), p)
Modified: projects/binutils-2.17/bin/sh/parser.c
==============================================================================
--- projects/binutils-2.17/bin/sh/parser.c Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/bin/sh/parser.c Thu Dec 30 23:35:23 2010 (r216827)
@@ -1093,9 +1093,8 @@ done:
popfile();
tokpushback = 0;
}
- while (stackblocksize() <= savelen)
- growstackblock();
STARTSTACKSTR(out);
+ CHECKSTRSPACE(savelen + 1, out);
INTOFF;
if (str) {
memcpy(out, str, savelen);
Modified: projects/binutils-2.17/etc/portsnap.conf
==============================================================================
--- projects/binutils-2.17/etc/portsnap.conf Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/etc/portsnap.conf Thu Dec 30 23:35:23 2010 (r216827)
@@ -30,6 +30,5 @@ KEYPRINT=9b5feee6d69f170e3dd0a2c8e469ddb
# REFUSE korean polish portuguese russian ukrainian vietnamese
# List of INDEX files to build and the DESCRIBE file to use for each
-INDEX INDEX-6 DESCRIBE.6
INDEX INDEX-7 DESCRIBE.7
INDEX INDEX-8 DESCRIBE.8
Modified: projects/binutils-2.17/etc/rc.d/devd
==============================================================================
--- projects/binutils-2.17/etc/rc.d/devd Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/etc/rc.d/devd Thu Dec 30 23:35:23 2010 (r216827)
@@ -13,11 +13,17 @@
name="devd"
rcvar=`set_rcvar`
command="/sbin/${name}"
+pidfile=/var/run/${name}.pid
+
+start_precmd=${name}_prestart
+
+devd_prestart ()
+{
+ # If devd is disabled, turn it off in the kernel to avoid memory leaks.
+ if ! checkyesno ${rcvar}; then
+ $SYSCTL hw.bus.devctl_disable=1
+ fi
+}
load_rc_config $name
run_rc_command "$1"
-
-# If devd is disabled, turn it off in the kernel to avoid memory leaks.
-if ! checkyesno ${rcvar}; then
- sysctl hw.bus.devctl_disable=1
-fi
Modified: projects/binutils-2.17/gnu/lib/libgcc/Makefile
==============================================================================
--- projects/binutils-2.17/gnu/lib/libgcc/Makefile Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/gnu/lib/libgcc/Makefile Thu Dec 30 23:35:23 2010 (r216827)
@@ -15,7 +15,7 @@ MK_SSP= no
.include "${.CURDIR}/../../usr.bin/cc/Makefile.tgt"
-.if ${TARGET_CPUARCH} == "sparc64"
+.if ${TARGET_CPUARCH} == "sparc64" || ${TARGET_CPUARCH} == "mips"
LIB= gcc
.endif
Modified: projects/binutils-2.17/lib/libc/locale/mbrtowc.3
==============================================================================
--- projects/binutils-2.17/lib/libc/locale/mbrtowc.3 Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/lib/libc/locale/mbrtowc.3 Thu Dec 30 23:35:23 2010 (r216827)
@@ -69,7 +69,7 @@ was
.Dv NULL ,
.Fa s
was an empty string
-.Pq Qq \&
+.Pq Qq
and
.Fa n
was 1.
Modified: projects/binutils-2.17/lib/libc/rpc/publickey.3
==============================================================================
--- projects/binutils-2.17/lib/libc/rpc/publickey.3 Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/lib/libc/rpc/publickey.3 Thu Dec 30 23:35:23 2010 (r216827)
@@ -44,7 +44,7 @@ fails to decrypt the secret key, the rou
argument will be a
.Dv NULL
string
-.Pq Dq \& .
+.Pq Dq .
.Sh SEE ALSO
.Xr publickey 5
.Pp
Modified: projects/binutils-2.17/lib/libcompiler_rt/Makefile
==============================================================================
--- projects/binutils-2.17/lib/libcompiler_rt/Makefile Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/lib/libcompiler_rt/Makefile Thu Dec 30 23:35:23 2010 (r216827)
@@ -147,7 +147,7 @@ SRCS+= ${file}.c
. endif
.endfor
-.if ${MACHINE_CPUARCH} != "sparc64"
+.if ${MACHINE_CPUARCH} != "sparc64" && ${MACHINE_CPUARCH} != "mips"
. if ${MK_INSTALLLIB} != "no"
SYMLINKS+=libcompiler_rt.a ${LIBDIR}/libgcc.a
. endif
Modified: projects/binutils-2.17/lib/libkvm/kvm_getloadavg.3
==============================================================================
--- projects/binutils-2.17/lib/libkvm/kvm_getloadavg.3 Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/lib/libkvm/kvm_getloadavg.3 Thu Dec 30 23:35:23 2010 (r216827)
@@ -50,7 +50,7 @@ averaged over various periods of time.
Up to
.Fa nelem
samples are retrieved and assigned to successive elements of
-.Fa loadavg Ns Bq \& .
+.Fa loadavg Ns Bq .
The system imposes a maximum of 3 samples, representing averages
over the last 1, 5, and 15 minutes, respectively.
.Sh DIAGNOSTICS
Modified: projects/binutils-2.17/lib/libthr/thread/thr_mutex.c
==============================================================================
--- projects/binutils-2.17/lib/libthr/thread/thr_mutex.c Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/lib/libthr/thread/thr_mutex.c Thu Dec 30 23:35:23 2010 (r216827)
@@ -653,7 +653,7 @@ mutex_unlock_common(struct pthread_mutex
m->m_count > 0)) {
m->m_count--;
} else {
- if (curthread->will_sleep == 0 && (m->m_flags & PMUTEX_FLAG_DEFERED) != 0) {
+ if ((m->m_flags & PMUTEX_FLAG_DEFERED) != 0) {
defered = 1;
m->m_flags &= ~PMUTEX_FLAG_DEFERED;
} else
@@ -662,7 +662,7 @@ mutex_unlock_common(struct pthread_mutex
DEQUEUE_MUTEX(curthread, m);
_thr_umutex_unlock(&m->m_lock, id);
- if (defered) {
+ if (curthread->will_sleep == 0 && defered) {
_thr_wake_all(curthread->defer_waiters,
curthread->nwaiter_defer);
curthread->nwaiter_defer = 0;
Modified: projects/binutils-2.17/libexec/rtld-elf/Makefile
==============================================================================
--- projects/binutils-2.17/libexec/rtld-elf/Makefile Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/libexec/rtld-elf/Makefile Thu Dec 30 23:35:23 2010 (r216827)
@@ -34,7 +34,7 @@ CFLAGS+= -fPIC
.else
CFLAGS+= -fpic
.endif
-CFLAGS+= -DPIC
+CFLAGS+= -DPIC $(DEBUG)
LDFLAGS+= -shared -Wl,-Bsymbolic
DPADD= ${LIBC_PIC}
LDADD= -lc_pic -lssp_nonshared
Modified: projects/binutils-2.17/libexec/rtld-elf/amd64/reloc.c
==============================================================================
--- projects/binutils-2.17/libexec/rtld-elf/amd64/reloc.c Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/libexec/rtld-elf/amd64/reloc.c Thu Dec 30 23:35:23 2010 (r216827)
@@ -69,23 +69,28 @@ do_copy_relocations(Obj_Entry *dstobj)
void *dstaddr;
const Elf_Sym *dstsym;
const char *name;
- unsigned long hash;
size_t size;
const void *srcaddr;
const Elf_Sym *srcsym;
- Obj_Entry *srcobj;
- const Ver_Entry *ve;
+ const Obj_Entry *srcobj, *defobj;
+ SymLook req;
+ int res;
dstaddr = (void *) (dstobj->relocbase + rela->r_offset);
dstsym = dstobj->symtab + ELF_R_SYM(rela->r_info);
name = dstobj->strtab + dstsym->st_name;
- hash = elf_hash(name);
size = dstsym->st_size;
- ve = fetch_ventry(dstobj, ELF_R_SYM(rela->r_info));
+ symlook_init(&req, name);
+ req.ventry = fetch_ventry(dstobj, ELF_R_SYM(rela->r_info));
- for (srcobj = dstobj->next; srcobj != NULL; srcobj = srcobj->next)
- if ((srcsym = symlook_obj(name, hash, srcobj, ve, 0)) != NULL)
+ for (srcobj = dstobj->next; srcobj != NULL; srcobj = srcobj->next) {
+ res = symlook_obj(&req, srcobj);
+ if (res == 0) {
+ srcsym = req.sym_out;
+ defobj = req.defobj_out;
break;
+ }
+ }
if (srcobj == NULL) {
_rtld_error("Undefined symbol \"%s\" referenced from COPY"
@@ -93,7 +98,7 @@ do_copy_relocations(Obj_Entry *dstobj)
return -1;
}
- srcaddr = (const void *) (srcobj->relocbase + srcsym->st_value);
+ srcaddr = (const void *) (defobj->relocbase + srcsym->st_value);
memcpy(dstaddr, srcaddr, size);
}
}
@@ -113,7 +118,7 @@ init_pltgot(Obj_Entry *obj)
/* Process the non-PLT relocations. */
int
-reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld)
+reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, RtldLockState *lockstate)
{
const Elf_Rela *relalim;
const Elf_Rela *rela;
@@ -146,7 +151,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry
const Obj_Entry *defobj;
def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj,
- false, cache);
+ false, cache, lockstate);
if (def == NULL)
goto done;
@@ -165,7 +170,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry
const Obj_Entry *defobj;
def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj,
- false, cache);
+ false, cache, lockstate);
if (def == NULL)
goto done;
@@ -195,7 +200,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry
const Obj_Entry *defobj;
def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj,
- false, cache);
+ false, cache, lockstate);
if (def == NULL)
goto done;
@@ -209,7 +214,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry
const Obj_Entry *defobj;
def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj,
- false, cache);
+ false, cache, lockstate);
if (def == NULL)
goto done;
@@ -240,7 +245,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry
const Obj_Entry *defobj;
def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj,
- false, cache);
+ false, cache, lockstate);
if (def == NULL)
goto done;
@@ -272,7 +277,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry
const Obj_Entry *defobj;
def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj,
- false, cache);
+ false, cache, lockstate);
if (def == NULL)
goto done;
@@ -286,7 +291,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry
const Obj_Entry *defobj;
def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj,
- false, cache);
+ false, cache, lockstate);
if (def == NULL)
goto done;
@@ -300,7 +305,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry
const Obj_Entry *defobj;
def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj,
- false, cache);
+ false, cache, lockstate);
if (def == NULL)
goto done;
@@ -350,7 +355,7 @@ reloc_plt(Obj_Entry *obj)
/* Relocate the jump slots in an object. */
int
-reloc_jmpslots(Obj_Entry *obj)
+reloc_jmpslots(Obj_Entry *obj, RtldLockState *lockstate)
{
const Elf_Rela *relalim;
const Elf_Rela *rela;
@@ -365,7 +370,8 @@ reloc_jmpslots(Obj_Entry *obj)
assert(ELF_R_TYPE(rela->r_info) == R_X86_64_JMP_SLOT);
where = (Elf_Addr *)(obj->relocbase + rela->r_offset);
- def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, true, NULL);
+ def = find_symdef(ELF_R_SYM(rela->r_info), obj, &defobj, true, NULL,
+ lockstate);
if (def == NULL)
return -1;
target = (Elf_Addr)(defobj->relocbase + def->st_value + rela->r_addend);
Modified: projects/binutils-2.17/libexec/rtld-elf/arm/reloc.c
==============================================================================
--- projects/binutils-2.17/libexec/rtld-elf/arm/reloc.c Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/libexec/rtld-elf/arm/reloc.c Thu Dec 30 23:35:23 2010 (r216827)
@@ -36,31 +36,39 @@ do_copy_relocations(Obj_Entry *dstobj)
void *dstaddr;
const Elf_Sym *dstsym;
const char *name;
- unsigned long hash;
size_t size;
const void *srcaddr;
const Elf_Sym *srcsym;
- Obj_Entry *srcobj;
- const Ver_Entry *ve;
+ const Obj_Entry *srcobj, *defobj;
+ SymLook req;
+ int res;
dstaddr = (void *) (dstobj->relocbase + rel->r_offset);
dstsym = dstobj->symtab + ELF_R_SYM(rel->r_info);
name = dstobj->strtab + dstsym->st_name;
- hash = elf_hash(name);
size = dstsym->st_size;
- ve = fetch_ventry(dstobj, ELF_R_SYM(rel->r_info));
-
- for (srcobj = dstobj->next; srcobj != NULL; srcobj = srcobj->next)
- if ((srcsym = symlook_obj(name, hash, srcobj, ve, 0)) != NULL)
+
+ symlook_init(&req, name);
+ req.ventry = fetch_ventry(dstobj,
+ ELF_R_SYM(rel->r_info));
+ for (srcobj = dstobj->next; srcobj != NULL;
+ srcobj = srcobj->next) {
+ res = symlook_obj(&req, srcobj);
+ if (res == 0) {
+ srcsym = req.sym_out;
+ defobj = req.defobj_out;
break;
-
+ }
+ }
if (srcobj == NULL) {
- _rtld_error("Undefined symbol \"%s\" referenced from COPY"
- " relocation in %s", name, dstobj->path);
- return -1;
+ _rtld_error(
+"Undefined symbol \"%s\" referenced from COPY relocation in %s",
+ name, dstobj->path);
+ return (-1);
}
- srcaddr = (const void *) (srcobj->relocbase + srcsym->st_value);
+ srcaddr = (const void *)(defobj->relocbase +
+ srcsym->st_value);
memcpy(dstaddr, srcaddr, size);
}
}
@@ -123,7 +131,8 @@ store_ptr(void *where, Elf_Addr val)
}
static int
-reloc_nonplt_object(Obj_Entry *obj, const Elf_Rel *rel, SymCache *cache)
+reloc_nonplt_object(Obj_Entry *obj, const Elf_Rel *rel, SymCache *cache,
+ RtldLockState *lockstate)
{
Elf_Addr *where;
const Elf_Sym *def;
@@ -149,7 +158,8 @@ reloc_nonplt_object(Obj_Entry *obj, cons
if (addend & 0x00800000)
addend |= 0xff000000;
- def = find_symdef(symnum, obj, &defobj, false, cache);
+ def = find_symdef(symnum, obj, &defobj, false, cache,
+ lockstate);
if (def == NULL)
return -1;
tmp = (Elf_Addr)obj->relocbase + def->st_value
@@ -175,7 +185,8 @@ reloc_nonplt_object(Obj_Entry *obj, cons
case R_ARM_ABS32: /* word32 B + S + A */
case R_ARM_GLOB_DAT: /* word32 B + S */
- def = find_symdef(symnum, obj, &defobj, false, cache);
+ def = find_symdef(symnum, obj, &defobj, false, cache,
+ lockstate);
if (def == NULL)
return -1;
if (__predict_true(RELOC_ALIGNED_P(where))) {
@@ -240,7 +251,7 @@ reloc_nonplt_object(Obj_Entry *obj, cons
* * Process non-PLT relocations
* */
int
-reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld)
+reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, RtldLockState *lockstate)
{
const Elf_Rel *rellim;
const Elf_Rel *rel;
@@ -259,7 +270,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry
rellim = (const Elf_Rel *)((caddr_t)obj->rel + obj->relsize);
for (rel = obj->rel; rel < rellim; rel++) {
- if (reloc_nonplt_object(obj, rel, cache) < 0)
+ if (reloc_nonplt_object(obj, rel, cache, lockstate) < 0)
goto done;
}
r = 0;
@@ -296,7 +307,7 @@ reloc_plt(Obj_Entry *obj)
* * LD_BIND_NOW was set - force relocation for all jump slots
* */
int
-reloc_jmpslots(Obj_Entry *obj)
+reloc_jmpslots(Obj_Entry *obj, RtldLockState *lockstate)
{
const Obj_Entry *defobj;
const Elf_Rel *rellim;
@@ -310,7 +321,7 @@ reloc_jmpslots(Obj_Entry *obj)
assert(ELF_R_TYPE(rel->r_info) == R_ARM_JUMP_SLOT);
where = (Elf_Addr *)(obj->relocbase + rel->r_offset);
def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj,
- true, NULL);
+ true, NULL, lockstate);
if (def == NULL) {
dbg("reloc_jmpslots: sym not found");
return (-1);
Modified: projects/binutils-2.17/libexec/rtld-elf/i386/reloc.c
==============================================================================
--- projects/binutils-2.17/libexec/rtld-elf/i386/reloc.c Thu Dec 30 22:33:55 2010 (r216826)
+++ projects/binutils-2.17/libexec/rtld-elf/i386/reloc.c Thu Dec 30 23:35:23 2010 (r216827)
@@ -70,23 +70,28 @@ do_copy_relocations(Obj_Entry *dstobj)
void *dstaddr;
const Elf_Sym *dstsym;
const char *name;
- unsigned long hash;
size_t size;
const void *srcaddr;
const Elf_Sym *srcsym;
- const Ver_Entry *ve;
- Obj_Entry *srcobj;
+ const Obj_Entry *srcobj, *defobj;
+ SymLook req;
+ int res;
dstaddr = (void *) (dstobj->relocbase + rel->r_offset);
dstsym = dstobj->symtab + ELF_R_SYM(rel->r_info);
name = dstobj->strtab + dstsym->st_name;
- hash = elf_hash(name);
size = dstsym->st_size;
- ve = fetch_ventry(dstobj, ELF_R_SYM(rel->r_info));
+ symlook_init(&req, name);
+ req.ventry = fetch_ventry(dstobj, ELF_R_SYM(rel->r_info));
- for (srcobj = dstobj->next; srcobj != NULL; srcobj = srcobj->next)
- if ((srcsym = symlook_obj(name, hash, srcobj, ve, 0)) != NULL)
+ for (srcobj = dstobj->next; srcobj != NULL; srcobj = srcobj->next) {
+ res = symlook_obj(&req, srcobj);
+ if (res == 0) {
+ srcsym = req.sym_out;
+ defobj = req.defobj_out;
break;
+ }
+ }
if (srcobj == NULL) {
_rtld_error("Undefined symbol \"%s\" referenced from COPY"
@@ -94,7 +99,7 @@ do_copy_relocations(Obj_Entry *dstobj)
return -1;
}
- srcaddr = (const void *) (srcobj->relocbase + srcsym->st_value);
+ srcaddr = (const void *) (defobj->relocbase + srcsym->st_value);
memcpy(dstaddr, srcaddr, size);
}
}
@@ -114,7 +119,7 @@ init_pltgot(Obj_Entry *obj)
/* Process the non-PLT relocations. */
int
-reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld)
+reloc_non_plt(Obj_Entry *obj, Obj_Entry *obj_rtld, RtldLockState *lockstate)
{
const Elf_Rel *rellim;
const Elf_Rel *rel;
@@ -146,7 +151,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry
const Obj_Entry *defobj;
def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj,
- false, cache);
+ false, cache, lockstate);
if (def == NULL)
goto done;
@@ -165,7 +170,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry
const Obj_Entry *defobj;
def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj,
- false, cache);
+ false, cache, lockstate);
if (def == NULL)
goto done;
@@ -195,7 +200,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry
const Obj_Entry *defobj;
def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj,
- false, cache);
+ false, cache, lockstate);
if (def == NULL)
goto done;
@@ -213,7 +218,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry
const Obj_Entry *defobj;
def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj,
- false, cache);
+ false, cache, lockstate);
if (def == NULL)
goto done;
@@ -243,7 +248,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry
const Obj_Entry *defobj;
def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj,
- false, cache);
+ false, cache, lockstate);
if (def == NULL)
goto done;
@@ -257,7 +262,7 @@ reloc_non_plt(Obj_Entry *obj, Obj_Entry
const Obj_Entry *defobj;
def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj,
- false, cache);
+ false, cache, lockstate);
if (def == NULL)
goto done;
@@ -301,7 +306,7 @@ reloc_plt(Obj_Entry *obj)
/* Relocate the jump slots in an object. */
int
-reloc_jmpslots(Obj_Entry *obj)
+reloc_jmpslots(Obj_Entry *obj, RtldLockState *lockstate)
{
const Elf_Rel *rellim;
const Elf_Rel *rel;
@@ -316,7 +321,8 @@ reloc_jmpslots(Obj_Entry *obj)
assert(ELF_R_TYPE(rel->r_info) == R_386_JMP_SLOT);
where = (Elf_Addr *)(obj->relocbase + rel->r_offset);
- def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, true, NULL);
+ def = find_symdef(ELF_R_SYM(rel->r_info), obj, &defobj, true, NULL,
*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
More information about the svn-src-projects
mailing list