Merge from HEAD

This commit is contained in:
Baptiste Daroussin 2015-02-08 15:41:27 +00:00
commit 9f3d45b6d4
882 changed files with 54478 additions and 20477 deletions

View File

@ -1292,12 +1292,16 @@ _clang_tblgen= \
usr.bin/clang/clang-tblgen
.endif
# ELF Tool Chain libraries are needed for ELF tools and dtrace tools.
# dtrace tools are required for older bootstrap env and cross-build
# pre libdwarf
.if ${MK_CDDL} != "no" && (${BOOTSTRAPPING} < 1100006 \
|| (${MACHINE} != ${TARGET} || ${MACHINE_ARCH} != ${TARGET_ARCH}))
_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf lib/libelf \
lib/libdwarf cddl/usr.bin/ctfconvert cddl/usr.bin/ctfmerge
.if ${BOOTSTRAPPING} < 1100006 || (${MACHINE} != ${TARGET} || \
${MACHINE_ARCH} != ${TARGET_ARCH})
_elftoolchain_libs= lib/libelf lib/libdwarf
.if ${MK_CDDL} != "no"
_dtrace_tools= cddl/usr.bin/sgsmsg cddl/lib/libctf cddl/usr.bin/ctfconvert \
cddl/usr.bin/ctfmerge
.endif
.endif
# Default to building the GPL DTC, but build the BSDL one if users explicitly
@ -1324,6 +1328,7 @@ bootstrap-tools: .MAKE
.for _tool in \
${_clang_tblgen} \
${_kerberos5_bootstrap_tools} \
${_elftoolchain_libs} \
${_dtrace_tools} \
${_strfile} \
${_gperf} \
@ -1428,11 +1433,13 @@ _binutils= gnu/usr.bin/binutils
.endif
.if ${MK_ELFTOOLCHAIN_TOOLS} != "no"
_elftctools= lib/libelftc \
usr.bin/addr2line \
usr.bin/elfcopy \
usr.bin/nm \
usr.bin/size \
usr.bin/strings
# These are not required by the build, but can be useful for developers who
# cross-build on a FreeBSD 10 host:
_elftctools+= usr.bin/addr2line
.endif
.endif
@ -1627,7 +1634,7 @@ _prebuild_libs= ${_kerberos5_lib_libasn1} \
${_lib_libcapsicum} \
lib/ncurses/ncurses lib/ncurses/ncursesw \
lib/libopie lib/libpam ${_lib_libthr} \
lib/libradius lib/libsbuf lib/libtacplus \
${_lib_libradius} lib/libsbuf lib/libtacplus \
lib/libgeom \
${_cddl_lib_libumem} ${_cddl_lib_libnvpair} \
${_cddl_lib_libuutil} \
@ -1650,6 +1657,10 @@ lib/libgeom__L: lib/libexpat__L
_lib_libthr= lib/libthr
.endif
.if ${MK_RADIUS_SUPPORT} != "no"
_lib_libradius= lib/libradius
.endif
.if ${MK_OFED} != "no"
_ofed_lib= contrib/ofed/usr.lib/
.endif

View File

@ -38,6 +38,20 @@
# xargs -n1 | sort | uniq -d;
# done
# 20150124: spl.9 and friends
OLD_FILES+=usr/share/man/man9/spl.9
OLD_FILES+=usr/share/man/man9/spl0.9
OLD_FILES+=usr/share/man/man9/splbio.9
OLD_FILES+=usr/share/man/man9/splclock.9
OLD_FILES+=usr/share/man/man9/splhigh.9
OLD_FILES+=usr/share/man/man9/splimp.9
OLD_FILES+=usr/share/man/man9/splnet.9
OLD_FILES+=usr/share/man/man9/splsoftclock.9
OLD_FILES+=usr/share/man/man9/splsofttty.9
OLD_FILES+=usr/share/man/man9/splstatclock.9
OLD_FILES+=usr/share/man/man9/spltty.9
OLD_FILES+=usr/share/man/man9/splvm.9
OLD_FILES+=usr/share/man/man9/splx.9
# 20150118: new clang import which bumps version from 3.5.0 to 3.5.1.
OLD_FILES+=usr/include/clang/3.5.0/__wmmintrin_aes.h
OLD_FILES+=usr/include/clang/3.5.0/__wmmintrin_pclmul.h

View File

@ -31,6 +31,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11.x IS SLOW:
disable the most expensive debugging functionality run
"ln -s 'abort:false,junk:false' /etc/malloc.conf".)
20150131:
The powerpc64 kernel has been changed to a position-independent
executable. This can only be booted with a new version of loader(8),
so make sure to update both world and kernel before rebooting.
20150118:
Clang and llvm have been upgraded to 3.5.1 release. This is a bugfix
only release, no new features have been added. Please see the 20141231

View File

@ -330,7 +330,7 @@ copy_special(struct stat *from_stat, int exists)
int
setfile(struct stat *fs, int fd)
{
static struct timeval tv[2];
static struct timespec tspec[2];
struct stat ts;
int rval, gotstat, islink, fdval;
@ -340,10 +340,11 @@ setfile(struct stat *fs, int fd)
fs->st_mode &= S_ISUID | S_ISGID | S_ISVTX |
S_IRWXU | S_IRWXG | S_IRWXO;
TIMESPEC_TO_TIMEVAL(&tv[0], &fs->st_atim);
TIMESPEC_TO_TIMEVAL(&tv[1], &fs->st_mtim);
if (islink ? lutimes(to.p_path, tv) : utimes(to.p_path, tv)) {
warn("%sutimes: %s", islink ? "l" : "", to.p_path);
tspec[0] = fs->st_atim;
tspec[1] = fs->st_mtim;
if (utimensat(AT_FDCWD, to.p_path, tspec,
islink ? AT_SYMLINK_NOFOLLOW : 0)) {
warn("utimensat: %s", to.p_path);
rval = 1;
}
if (fdval ? fstat(fd, &ts) :

View File

@ -444,14 +444,26 @@ op_minus(struct val *a, struct val *b)
return (r);
}
/*
* We depend on undefined behaviour giving a result (in r).
* To test this result, pass it as volatile. This prevents
* optimizing away of the test based on the undefined behaviour.
*/
void
assert_times(intmax_t a, intmax_t b, intmax_t r)
assert_times(intmax_t a, intmax_t b, volatile intmax_t r)
{
/*
* if first operand is 0, no overflow is possible,
* else result of division test must match second operand
* If the first operand is 0, no overflow is possible,
* else the result of the division test must match the
* second operand.
*
* Be careful to avoid overflow in the overflow test, as
* in assert_div(). Overflow in division would kill us
* with a SIGFPE before getting the test wrong. In old
* buggy versions, optimization used to give a null test
* instead of a SIGFPE.
*/
if (a != 0 && r / a != b)
if ((a == -1 && b == INTMAX_MIN) || (a != 0 && r / a != b))
errx(ERR_EXIT, "overflow");
}

View File

@ -11,7 +11,7 @@ freebsd-version.sh: ${.CURDIR}/freebsd-version.sh.in ${NEWVERS}
s/@@TYPE@@/$${TYPE}/g; \
s/@@REVISION@@/$${REVISION}/g; \
s/@@BRANCH@@/$${BRANCH}/g; \
" ${.ALLSRC} >${.TARGET} ; then \
" ${.CURDIR}/freebsd-version.sh.in >${.TARGET} ; then \
rm -f ${.TARGET} ; \
exit 1 ; \
fi

View File

@ -29,7 +29,7 @@
.\" @(#)symlink.7 8.3 (Berkeley) 3/31/94
.\" $FreeBSD$
.\"
.Dd December 29, 2014
.Dd January 23, 2015
.Dt SYMLINK 7
.Os
.Sh NAME
@ -147,9 +147,10 @@ unless given the
.Dv AT_SYMLINK_NOFOLLOW
flag:
.Xr fchmodat 2 ,
.Xr fchownat 2
.Xr fchownat 2 ,
.Xr fstatat 2
and
.Xr fstatat 2 .
.Xr utimensat 2 .
.Pp
The owner and group of an existing symbolic link can be changed by
means of the

View File

@ -273,7 +273,7 @@ do_move(const char *from, const char *to)
static int
fastcopy(const char *from, const char *to, struct stat *sbp)
{
struct timeval tval[2];
struct timespec ts[2];
static u_int blen = MAXPHYS;
static char *bp = NULL;
mode_t oldmode;
@ -350,10 +350,9 @@ err: if (unlink(to))
} else
warn("%s: cannot stat", to);
tval[0].tv_sec = sbp->st_atime;
tval[1].tv_sec = sbp->st_mtime;
tval[0].tv_usec = tval[1].tv_usec = 0;
if (utimes(to, tval))
ts[0] = sbp->st_atim;
ts[1] = sbp->st_mtim;
if (utimensat(AT_FDCWD, to, ts, 0))
warn("%s: set times", to);
if (close(to_fd)) {

View File

@ -178,7 +178,7 @@ main(int argc, char *argv[])
KINFO *kinfo = NULL, *next_KINFO;
KINFO_STR *ks;
struct varent *vent;
struct winsize ws;
struct winsize ws = { .ws_row = 0 };
const char *nlistf, *memf, *fmtstr, *str;
char *cols;
int all, ch, elem, flag, _fmt, i, lineno, linelen, left;

View File

@ -87,8 +87,8 @@ static int ttyfd = -1;
/* mode flags for dowait */
#define DOWAIT_BLOCK 0x1 /* wait until a child exits */
#define DOWAIT_SIG 0x2 /* if DOWAIT_BLOCK, abort on SIGINT/SIGQUIT */
#define DOWAIT_SIG_ANY 0x4 /* if DOWAIT_SIG, abort on any signal */
#define DOWAIT_SIG 0x2 /* if DOWAIT_BLOCK, abort on signal */
#define DOWAIT_SIG_TRAP 0x4 /* if DOWAIT_SIG, abort on trapped signal only */
#if JOBS
static void restartjob(struct job *);
@ -1028,7 +1028,7 @@ waitforjob(struct job *jp, int *origstatus)
TRACE(("waitforjob(%%%td) called\n", jp - jobtab + 1));
while (jp->state == 0)
if (dowait(DOWAIT_BLOCK | (Tflag ? DOWAIT_SIG |
DOWAIT_SIG_ANY : 0), jp) == -1)
DOWAIT_SIG_TRAP : 0), jp) == -1)
dotrap();
#if JOBS
if (jp->jobctl) {
@ -1120,7 +1120,7 @@ dowait(int mode, struct job *job)
TRACE(("wait returns %d, status=%d\n", (int)pid, status));
if (pid == 0 && (mode & DOWAIT_SIG) != 0) {
pid = -1;
if (((mode & DOWAIT_SIG_ANY) != 0 ?
if (((mode & DOWAIT_SIG_TRAP) != 0 ?
pendingsig : pendingsig_waitcmd) != 0) {
errno = EINTR;
break;

View File

@ -74,7 +74,7 @@ __FBSDID("$FreeBSD$");
static char sigmode[NSIG]; /* current value of signal */
volatile sig_atomic_t pendingsig; /* indicates some signal received */
volatile sig_atomic_t pendingsig_waitcmd; /* indicates SIGINT/SIGQUIT received */
volatile sig_atomic_t pendingsig_waitcmd; /* indicates wait builtin should be interrupted */
static int in_dotrap; /* do we execute in a trap handler? */
static char *volatile trap[NSIG]; /* trap handler commands */
static volatile sig_atomic_t gotsig[NSIG];
@ -400,6 +400,7 @@ onsig(int signo)
(signo != SIGCHLD || !ignore_sigchld)) {
gotsig[signo] = 1;
pendingsig = signo;
pendingsig_waitcmd = signo;
}
}

View File

@ -273,7 +273,7 @@ sub run_tests {
}
$fullname = "$dir/$name";
$exe = "./$base.exe";
$exe = "$dir/$base.exe";
$exe_pid = -1;
if ($opt_a && ($status != 0 || $tag != 0 || $droptag != 0 ||

View File

@ -38,4 +38,4 @@
*
*/
inline cyc_func_t i = "i am a cyclic function";
inline dtrace_trap_func_t i = "i am a dtrace trap function";

View File

@ -38,4 +38,4 @@
*
*/
inline vfs_t *invalid = xlate<psinfo_t>(curthread->t_procp);
inline struct vnode *invalid = xlate<psinfo_t>(curthread->td_proc);

View File

@ -14,6 +14,8 @@
*/
#include <sys/sdt.h>
#include <stdio.h>
#include <stdlib.h>
#include "usdt.h"
#define FMT "{" \

View File

@ -36,8 +36,10 @@
BEGIN
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-pp-token"
h = '
';
#pragma clang diagnostic pop
exit(0);
}

View File

@ -36,7 +36,9 @@
BEGIN
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-pp-token"
h = '';
exit(0);
#pragma clang diagnostic pop
}

View File

@ -36,9 +36,11 @@
BEGIN
{
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-pp-token"
h = "hello
there";
exit(0);
#pragma clang diagnostic pop
}

View File

@ -31,7 +31,6 @@ if [ $# != 1 ]; then
fi
dtrace=$1
CC=/usr/bin/gcc
CFLAGS=
doit()
@ -47,7 +46,7 @@ void
main()
{}
EOF
if $CC $CFLAGS -o $cofile $cfile >/dev/null 2>&1; then
if cc $CFLAGS -o $cofile $cfile >/dev/null 2>&1; then
$dtrace -xerrtags -C -s /dev/stdin \
>/dev/null 2>$errfile <<EOF
#include <sys/$file>
@ -67,11 +66,6 @@ EOF
rm -f $cofile $cfile 2>/dev/null
}
if [ ! -x $CC ]; then
echo "$0: bad compiler: $CC" >& 2
exit 1
fi
concurrency=`psrinfo | wc -l`
let concurrency=concurrency*4
let i=0

View File

@ -74,13 +74,13 @@ fbt:::return
(long long)curthread, pid, tid, (int)arg1, (int)arg0);
}
mutex_enter:adaptive-acquire
mtx_lock:adaptive-acquire
{
printf(" %u 0x%llX %d %d lock:0x%llX", timestamp,
(long long)curthread, pid, tid, arg0);
}
mutex_exit:adaptive-release
mtx_unlock:adaptive-release
{
printf(" %u 0x%llX %d %d lock:0x%llX", timestamp,
(long long) curthread, pid, tid, arg0);

View File

@ -28,6 +28,7 @@
#include <strings.h>
#include <rpc/rpc.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/param.h>
#include <rpcsvc/mount.h>

View File

@ -40,5 +40,5 @@
BEGIN
{
trace(offsetof(vnode_t, v_no_such_member));
trace(offsetof(struct vnode, v_no_such_member));
}

View File

@ -1,4 +1,4 @@
#!/bin/ksh
#!/usr/bin/env ksh
#
# CDDL HEADER START
#

View File

@ -1,4 +1,4 @@
#!/bin/ksh
#!/usr/bin/env ksh
#
# CDDL HEADER START
#

View File

@ -1,4 +1,4 @@
#!/bin/ksh
#!/usr/bin/env ksh
#
# CDDL HEADER START
#

View File

@ -1,4 +1,4 @@
#!/bin/ksh
#!/usr/bin/env ksh
#
# CDDL HEADER START
#

View File

@ -1,4 +1,4 @@
#!/bin/ksh
#!/usr/bin/env ksh
#
# CDDL HEADER START
#

View File

@ -1,4 +1,4 @@
#!/bin/ksh
#!/usr/bin/env ksh
#
# CDDL HEADER START
#

View File

@ -1,4 +1,4 @@
#!/bin/ksh
#!/usr/bin/env ksh
#
# CDDL HEADER START
#

View File

@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
int

View File

@ -1,4 +1,4 @@
#!/usr/bin/ksh
#!/usr/bin/env ksh
#
# CDDL HEADER START
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/ksh
#!/usr/bin/env ksh
#
# CDDL HEADER START
#

View File

@ -44,7 +44,7 @@ pid$1:a.out:waiting:entry
proc:::create
/pid == $1/
{
child = args[0]->pr_pid;
child = args[0]->p_pid;
trace(pid);
}

View File

@ -26,6 +26,8 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/wait.h>
#include <spawn.h>
#include <signal.h>
#include <stdio.h>

View File

@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
/*

View File

@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
/*

View File

@ -44,7 +44,7 @@ pid$1:a.out:waiting:entry
proc:::create
/pid == $1/
{
child = args[0]->pr_pid;
child = args[0]->p_pid;
}
pid$1:a.out:go:
@ -54,7 +54,7 @@ pid$1:a.out:go:
exit(1);
}
syscall::rexit:entry
syscall::exit:entry
/pid == $1/
{
exit(0);

View File

@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
/*

View File

@ -27,6 +27,7 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <signal.h>
#include <stdlib.h>
#include <unistd.h>
/*

View File

@ -1,4 +1,4 @@
#!/usr/bin/ksh
#!/usr/bin/env ksh
#
# CDDL HEADER START
#

View File

@ -1,4 +1,4 @@
#!/usr/bin/ksh
#!/usr/bin/env ksh
#
# CDDL HEADER START
#

View File

@ -25,7 +25,7 @@
BEGIN
{
print((void)`p0);
print((void)`proc0);
}
BEGIN

View File

@ -22,13 +22,13 @@
typedef struct pancakes {
int i;
string s;
timespec_t t;
struct timespec t;
} pancakes_t;
translator pancakes_t < void *V > {
i = 2 * 10;
s = strjoin("I like ", "pancakes");
t = *(timespec_t *)`dtrace_zero;
t = *(struct timespec *)`dtrace_zero;
};
BEGIN

View File

@ -1,7 +1,7 @@
pancakes_t {
int i = 0x14
string s = [ "I like pancakes" ]
timespec_t t = {
struct timespec t = {
time_t tv_sec = 0
long tv_nsec = 0
}

View File

@ -44,7 +44,7 @@ BEGIN
i = 0;
}
syscall::*lwp*:entry
syscall::*wait*:entry
{
exit(0);
}

View File

@ -36,8 +36,9 @@ script()
{
$dtrace -s /dev/stdin <<EOF
proc:::signal-discard
/args[1]->pr_pid == $child &&
args[1]->pr_psargs == "$longsleep" && args[2] == SIGHUP/
/args[1]->p_pid == $child &&
xlate<psinfo_t *>(args[1])->pr_psargs == "$longsleep" &&
args[2] == SIGHUP/
{
exit(0);
}
@ -48,7 +49,7 @@ killer()
{
while true; do
sleep 1
/usr/bin/kill -HUP $child
kill -HUP $child
done
}
@ -58,7 +59,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
longsleep="/usr/bin/sleep 10000"
longsleep="/bin/sleep 10000"
/usr/bin/nohup $longsleep &
child=$!

View File

@ -48,7 +48,7 @@ sleeper()
{
while true; do
$longsleep &
/usr/bin/sleep 1
sleep 1
kill -9 $!
done
}
@ -59,7 +59,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
longsleep="/usr/bin/sleep 10000"
longsleep="/bin/sleep 10000"
sleeper &
child=$!
@ -67,9 +67,9 @@ child=$!
script
status=$?
pstop $child
kill -STOP $child
pkill -P $child
kill $child
prun $child
kill -CONT $child
exit $status

View File

@ -37,12 +37,13 @@ script()
$dtrace -s /dev/stdin <<EOF
proc:::signal-send
/execname == "kill" && curpsinfo->pr_ppid == $child &&
args[1]->pr_psargs == "$longsleep" && args[2] == SIGUSR1/
xlate<psinfo_t *>(args[1])->pr_psargs == "$longsleep" &&
args[2] == SIGUSR1/
{
/*
* This is guaranteed to not race with signal-handle.
*/
target = args[1]->pr_pid;
target = args[1]->p_pid;
}
proc:::signal-handle
@ -58,7 +59,7 @@ sleeper()
while true; do
$longsleep &
sleep 1
/usr/bin/kill -USR1 $!
kill -USR1 $!
done
}
@ -68,7 +69,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
longsleep="/usr/bin/sleep 10000"
longsleep="/bin/sleep 10000"
sleeper &
child=$!
@ -76,9 +77,9 @@ child=$!
script
status=$?
pstop $child
kill -STOP $child
pkill -P $child
kill $child
prun $child
kill -CONT $child
exit $status

View File

@ -60,14 +60,14 @@ spinny &
child=$!
#
# This is gutsy -- we're assuming that mutex_enter(9F) will show up in the
# This is gutsy -- we're assuming that mtx_lock(9) will show up in the
# output. This is most likely _not_ to show up in the output if the
# platform does not support arbitrary resolution interval timers -- but
# the above script was stress-tested down to 100 hertz and still ran
# successfully on all platforms, so one is hopeful that this test will pass
# even in that case.
#
script | tee /dev/fd/2 | grep mutex_enter > /dev/null
script | tee /dev/fd/2 | grep mtx_lock > /dev/null
status=$?
kill $child

View File

@ -63,7 +63,7 @@ child=$!
# The only thing we can be sure of is that some module named "unix" (or
# "genunix") did some work -- so that's all we'll check.
#
script | tee /dev/fd/2 | grep unix > /dev/null
script | tee /dev/fd/2 | grep kernel > /dev/null
status=$?
kill $child

View File

@ -63,7 +63,7 @@ child=$!
# This is the same gutsy test as that found in the func() test; see that
# test for the rationale.
#
script | tee /dev/fd/2 | grep mutex_enter > /dev/null
script | tee /dev/fd/2 | grep mtx_lock > /dev/null
status=$?
kill $child

View File

@ -31,8 +31,8 @@
#pragma D option dynvarsize=1m
struct bar {
int pid;
kthread_t *curthread;
pid_t pid;
struct thread *curthread;
};
self struct bar foo[int];

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file

View File

@ -42,7 +42,7 @@ fi
dtrace=$1
bname=`/usr/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$

View File

@ -43,7 +43,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/usr/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file
@ -77,7 +77,7 @@ fi
#Get the groupid of the calling process using ps
groupid=`ps -o pid,pgid | grep "$$ " | awk '{print $2}' 2>/dev/null`
groupid=`ps -x -o pid,egid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@ -93,5 +93,5 @@ fi
#Cleanup leftovers
/bin/rm -f $dfilename
rm -f $dfilename
exit 0

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
userid=`ps -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
userid=`ps -x -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
#/bin/rm -f $dfilename
rm -f $dfilename
exit 0

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
groupid=`ps -o pid,gid | grep "$$ " | awk '{print $2}' 2>/dev/null`
groupid=`ps -x -o pid,gid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
#/bin/rm -f $dfilename
rm -f $dfilename
exit 0

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file
@ -75,12 +75,12 @@ fi
#Pass current pid (I mean parent pid for .d script).
$dfilename $$ >/dev/null 2>&1
$dfilename $$ #>/dev/null 2>&1
if [ $? -ne 0 ]; then
print -u2 "Error in executing $dfilename"
exit 1
fi
#/bin/rm -f $dfilename
rm -f $dfilename
exit 0

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
projectid=`ps -o pid,projid | grep "$$ " | awk '{print $2}' 2>/dev/null`
projectid=`ps -x -o pid,projid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
#/bin/rm -f $dfilename
rm -f $dfilename
exit 0

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
sessionid=`ps -o pid,sid | grep "$$ " | awk '{print $2}' 2>/dev/null`
sessionid=`ps -x -o pid,sid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get sid of the current process with pid = $$"
exit 1
@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
#/bin/rm -f $dfilename
rm -f $dfilename
exit 0

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$.d
## Create .d file

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
taskidval=`ps -o pid,taskid | grep "$$ " | awk '{print $2}' 2>/dev/null`
taskidval=`ps -x -o pid,taskid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
#/bin/rm -f $dfilename
rm -f $dfilename
exit 0

View File

@ -41,7 +41,7 @@ if [ $# != 1 ]; then
fi
dtrace=$1
bname=`/bin/basename $0`
bname=`basename $0`
dfilename=/var/tmp/$bname.$$
## Create .d file
@ -69,7 +69,7 @@ EOF
chmod 555 $dfilename
userid=`ps -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
userid=`ps -x -o pid,uid | grep "$$ " | awk '{print $2}' 2>/dev/null`
if [ $? -ne 0 ]; then
print -u2 "unable to get uid of the current process with pid = $$"
exit 1
@ -82,5 +82,5 @@ if [ $? -ne 0 ]; then
exit 1
fi
#/bin/rm -f $dfilename
rm -f $dfilename
exit 0

View File

@ -28,6 +28,7 @@
#include <stdio.h>
#include <sys/syscall.h>
#include <unistd.h>
/*ARGSUSED*/
int

View File

@ -1,13 +0,0 @@
all: main
main: main.o prov.o
$(CC) -o main main.o prov.o
main.o: main.c prov.h
$(CC) -c main.c
prov.h: prov.d
/usr/sbin/dtrace -h -s prov.d
prov.o: prov.d main.o
/usr/sbin/dtrace -G -32 -s prov.d main.o

View File

@ -48,7 +48,7 @@ fi
dtrace="$1"
startdir="$PWD"
dir=$(mktemp -td drtiXXXXXX)
dir=$(mktemp -d -t drtiXXXXXX)
if (( $? != 0 )); then
print -u2 'Could not create safe temporary directory'
exit 2

View File

@ -106,11 +106,13 @@ cat > main.c <<EOF
#include <dlfcn.h>
#include <unistd.h>
#include <stdio.h>
#include <signal.h>
int
main(int argc, char **argv)
{
void *live;
sigset_t mask;
if ((live = dlopen("./livelib.so", RTLD_LAZY | RTLD_LOCAL)) == NULL) {
printf("dlopen of livelib.so failed: %s\n", dlerror());
@ -119,7 +121,8 @@ main(int argc, char **argv)
(void) dlclose(live);
pause();
(void) sigemptyset(&mask);
(void) sigsuspend(&mask);
return (0);
}
@ -133,7 +136,7 @@ fi
script() {
$dtrace -w -x bufsize=1k -c ./main -qs /dev/stdin <<EOF
syscall::pause:entry
syscall::sigsuspend:entry
/pid == \$target/
{
system("$dtrace -l -P test_prov*");

View File

@ -26,6 +26,10 @@
#pragma ident "%Z%%M% %I% %E% SMI"
#include <sys/types.h>
#include <sys/wait.h>
#include <stdlib.h>
#include <unistd.h>
#include "forker.h"

View File

@ -51,7 +51,7 @@ provider test_prov {
};
EOF
gcc -c test.c
cc -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
gcc -o test test.o prov.o
cc -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1

View File

@ -51,7 +51,7 @@ provider test_prov {
};
EOF
gcc -c test.c
cc -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
gcc -o test test.o prov.o
cc -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1

View File

@ -51,7 +51,7 @@ provider test_prov {
};
EOF
gcc -c test.c
cc -c test.c
if [ $? -ne 0 ]; then
print -u2 "failed to compile test.c"
exit 1
@ -61,7 +61,7 @@ if [ $? -ne 0 ]; then
print -u2 "failed to create DOF"
exit 1
fi
gcc -o test test.o prov.o
cc -o test test.o prov.o
if [ $? -ne 0 ]; then
print -u2 "failed to link final executable"
exit 1

View File

@ -382,6 +382,9 @@ dt_stddev(uint64_t *data, uint64_t normal)
int64_t norm_avg;
uint64_t diff[2];
if (data[0] == 0)
return (0);
/*
* The standard approximation for standard deviation is
* sqrt(average(x**2) - average(x)**2), i.e. the square root

View File

@ -18,10 +18,11 @@
*
* CDDL HEADER END
*/
/*
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013 by Delphix. All rights reserved.
* Copyright 2014 Nexenta Systems, Inc. All rights reserved.
*/
/*
@ -198,8 +199,10 @@ fix_paths(nvlist_t *nv, name_entry_t *names)
if ((devid = get_devid(best->ne_name)) == NULL) {
(void) nvlist_remove_all(nv, ZPOOL_CONFIG_DEVID);
} else {
if (nvlist_add_string(nv, ZPOOL_CONFIG_DEVID, devid) != 0)
if (nvlist_add_string(nv, ZPOOL_CONFIG_DEVID, devid) != 0) {
devid_str_free(devid);
return (-1);
}
devid_str_free(devid);
}
@ -665,8 +668,10 @@ get_configs(libzfs_handle_t *hdl, pool_list_t *pl, boolean_t active_ok)
nvlist_add_uint64(holey,
ZPOOL_CONFIG_ID, c) != 0 ||
nvlist_add_uint64(holey,
ZPOOL_CONFIG_GUID, 0ULL) != 0)
ZPOOL_CONFIG_GUID, 0ULL) != 0) {
nvlist_free(holey);
goto nomem;
}
child[c] = holey;
}
}
@ -1118,8 +1123,10 @@ zpool_clear_label(int fd)
for (l = 0; l < VDEV_LABELS; l++) {
if (pwrite64(fd, label, sizeof (vdev_label_t),
label_offset(size, l)) != sizeof (vdev_label_t))
label_offset(size, l)) != sizeof (vdev_label_t)) {
free(label);
return (-1);
}
}
free(label);
@ -1137,7 +1144,6 @@ static nvlist_t *
zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
{
int i, dirs = iarg->paths;
DIR *dirp = NULL;
struct dirent64 *dp;
char path[MAXPATHLEN];
char *end, **dir = iarg->path;
@ -1167,6 +1173,8 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
tpool_t *t;
char *rdsk;
int dfd;
boolean_t config_failed = B_FALSE;
DIR *dirp;
/* use realpath to normalize the path */
if (realpath(dir[i], path) == 0) {
@ -1191,6 +1199,8 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
if ((dfd = open64(rdsk, O_RDONLY)) < 0 ||
(dirp = fdopendir(dfd)) == NULL) {
if (dfd >= 0)
(void) close(dfd);
zfs_error_aux(hdl, strerror(errno));
(void) zfs_error_fmt(hdl, EZFS_BADPATH,
dgettext(TEXT_DOMAIN, "cannot open '%s'"),
@ -1272,7 +1282,7 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
cookie = NULL;
while ((slice = avl_destroy_nodes(&slice_cache,
&cookie)) != NULL) {
if (slice->rn_config != NULL) {
if (slice->rn_config != NULL && !config_failed) {
nvlist_t *config = slice->rn_config;
boolean_t matched = B_TRUE;
@ -1293,13 +1303,16 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
}
if (!matched) {
nvlist_free(config);
config = NULL;
continue;
} else {
/*
* use the non-raw path for the config
*/
(void) strlcpy(end, slice->rn_name,
pathleft);
if (add_config(hdl, &pools, path,
config) != 0)
config_failed = B_TRUE;
}
/* use the non-raw path for the config */
(void) strlcpy(end, slice->rn_name, pathleft);
if (add_config(hdl, &pools, path, config) != 0)
goto error;
}
free(slice->rn_name);
free(slice);
@ -1307,7 +1320,9 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
avl_destroy(&slice_cache);
(void) closedir(dirp);
dirp = NULL;
if (config_failed)
goto error;
}
ret = get_configs(hdl, &pools, iarg->can_be_active);
@ -1330,14 +1345,10 @@ zpool_find_import_impl(libzfs_handle_t *hdl, importargs_t *iarg)
for (ne = pools.names; ne != NULL; ne = nenext) {
nenext = ne->ne_next;
if (ne->ne_name)
free(ne->ne_name);
free(ne->ne_name);
free(ne);
}
if (dirp)
(void) closedir(dirp);
return (ret);
}
@ -1695,9 +1706,9 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
cb.cb_type = ZPOOL_CONFIG_SPARES;
if (zpool_iter(hdl, find_aux, &cb) == 1) {
name = (char *)zpool_get_name(cb.cb_zhp);
ret = TRUE;
ret = B_TRUE;
} else {
ret = FALSE;
ret = B_FALSE;
}
break;
@ -1711,9 +1722,9 @@ zpool_in_use(libzfs_handle_t *hdl, int fd, pool_state_t *state, char **namestr,
cb.cb_type = ZPOOL_CONFIG_L2CACHE;
if (zpool_iter(hdl, find_aux, &cb) == 1) {
name = (char *)zpool_get_name(cb.cb_zhp);
ret = TRUE;
ret = B_TRUE;
} else {
ret = FALSE;
ret = B_FALSE;
}
break;

View File

@ -20,8 +20,8 @@
*/
/*
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
* Copyright 2011 Nexenta Systems, Inc. All rights reserved.
* Copyright (c) 2011, 2014 by Delphix. All rights reserved.
* Copyright (c) 2013, Joyent, Inc. All rights reserved.
*/
@ -1715,7 +1715,7 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
thename = origname;
}
if (props) {
if (props != NULL) {
uint64_t version;
prop_flags_t flags = { .create = B_FALSE, .import = B_TRUE };
@ -1723,12 +1723,13 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
&version) == 0);
if ((props = zpool_valid_proplist(hdl, origname,
props, version, flags, errbuf)) == NULL) {
props, version, flags, errbuf)) == NULL)
return (-1);
} else if (zcmd_write_src_nvlist(hdl, &zc, props) != 0) {
if (zcmd_write_src_nvlist(hdl, &zc, props) != 0) {
nvlist_free(props);
return (-1);
}
nvlist_free(props);
}
(void) strlcpy(zc.zc_name, thename, sizeof (zc.zc_name));
@ -1737,11 +1738,11 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
&zc.zc_guid) == 0);
if (zcmd_write_conf_nvlist(hdl, &zc, config) != 0) {
nvlist_free(props);
zcmd_free_nvlists(&zc);
return (-1);
}
if (zcmd_alloc_dst_nvlist(hdl, &zc, zc.zc_nvlist_conf_size * 2) != 0) {
nvlist_free(props);
zcmd_free_nvlists(&zc);
return (-1);
}
@ -1757,6 +1758,9 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
error = errno;
(void) zcmd_read_dst_nvlist(hdl, &zc, &nv);
zcmd_free_nvlists(&zc);
zpool_get_rewind_policy(config, &policy);
if (error) {
@ -1862,9 +1866,6 @@ zpool_import_props(libzfs_handle_t *hdl, nvlist_t *config, const char *newname,
return (0);
}
zcmd_free_nvlists(&zc);
nvlist_free(props);
return (ret);
}
@ -3332,8 +3333,10 @@ devid_to_path(char *devid_str)
if (ret != 0)
return (NULL);
if ((path = strdup(list[0].devname)) == NULL)
return (NULL);
/*
* In a case the strdup() fails, we will just return NULL below.
*/
path = strdup(list[0].devname);
devid_free_nmlist(list);

View File

@ -535,7 +535,7 @@ extern vnode_t *rootdir;
extern void delay(clock_t ticks);
#define SEC_TO_TICK(sec) ((sec) * hz)
#define NSEC_TO_TICK(usec) ((usec) / (NANOSEC / hz))
#define NSEC_TO_TICK(nsec) ((nsec) / (NANOSEC / hz))
#define gethrestime_sec() time(NULL)
#define gethrestime(t) \

View File

@ -1113,7 +1113,7 @@ amfs_generic_mount_child(am_node *new_mp, int *error_return)
new_mp->am_transp = (SVCXPRT *) xmalloc(sizeof(SVCXPRT));
*(new_mp->am_transp) = *current_transp;
}
if (error && (new_mp->am_mnt->mf_ops == &amfs_error_ops))
if (error && new_mp->am_mnt && (new_mp->am_mnt->mf_ops == &amfs_error_ops))
new_mp->am_error = error;
if (new_mp->am_error > 0)

View File

@ -147,10 +147,12 @@ amfs_program_exec(char *info)
(void) fclose(stdout);
if (!logfp)
logfp = stderr; /* initialize before possible first use */
(void) dup(fileno(logfp));
if (dup(fileno(logfp)) == -1)
return errno;
if (fileno(logfp) != fileno(stderr)) {
(void) fclose(stderr);
(void) dup(fileno(logfp));
if (dup(fileno(logfp)) == -1)
return errno;
}
/*

View File

@ -63,6 +63,7 @@ static int key_already_in_chain(char *keyname, const nfsentry *chain);
static nfsentry *make_entry_chain(am_node *mp, const nfsentry *current_chain, int fully_browsable);
static int amfs_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count, int fully_browsable);
static const u_int dotdotcookie = DOT_DOT_COOKIE;
/****************************************************************************
*** FUNCTIONS ***
@ -178,8 +179,9 @@ make_entry_chain(am_node *mp, const nfsentry *current_chain, int fully_browsable
/* we have space. put entry in next cell */
++last_cookie;
chain[num_entries].ne_fileid = (u_int) last_cookie;
*(u_int *) chain[num_entries].ne_cookie = (u_int) last_cookie;
chain[num_entries].ne_fileid = last_cookie;
(void)memcpy(chain[num_entries].ne_cookie, &last_cookie,
sizeof(last_cookie));
chain[num_entries].ne_name = key;
if (num_entries < max_entries - 1) { /* link to next one */
chain[num_entries].ne_nextentry = &chain[num_entries + 1];
@ -253,7 +255,7 @@ amfs_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *
ep[0].ne_fileid = mp->am_gen;
ep[0].ne_name = ".";
ep[0].ne_nextentry = &ep[1];
*(u_int *) ep[0].ne_cookie = 0;
(void)memset(ep[0].ne_cookie, 0, sizeof(u_int));
/* construct ".." */
if (mp->am_parent)
@ -300,9 +302,12 @@ amfs_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *
nfsentry *ne;
for (j = 0, ne = te; ne; ne = ne->ne_nextentry)
plog(XLOG_DEBUG, "gen2 key %4d \"%s\"", j++, ne->ne_name);
for (j = 0, ne = ep; ne; ne = ne->ne_nextentry)
for (j = 0, ne = ep; ne; ne = ne->ne_nextentry) {
u_int cookie;
(void)memcpy(&cookie, ne->ne_cookie, sizeof(cookie));
plog(XLOG_DEBUG, "gen2+ key %4d \"%s\" fi=%d ck=%d",
j++, ne->ne_name, ne->ne_fileid, *(u_int *)ne->ne_cookie);
j++, ne->ne_name, ne->ne_fileid, cookie);
}
plog(XLOG_DEBUG, "EOF is %d", dp->dl_eof);
}
return 0;
@ -412,7 +417,7 @@ amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep
ep[0].ne_fileid = mp->am_gen;
ep[0].ne_name = ".";
ep[0].ne_nextentry = &ep[1];
*(u_int *) ep[0].ne_cookie = 0;
(void)memset(ep[0].ne_cookie, 0, sizeof(u_int));
/* construct ".." */
if (mp->am_parent)
@ -429,9 +434,12 @@ amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep
if (amuDebug(D_READDIR)) {
nfsentry *ne;
int j;
for (j = 0, ne = ep; ne; ne = ne->ne_nextentry)
for (j = 0, ne = ep; ne; ne = ne->ne_nextentry) {
u_int cookie;
(void)memcpy(&cookie, ne->ne_cookie, sizeof(cookie));
plog(XLOG_DEBUG, "gen1 key %4d \"%s\" fi=%d ck=%d",
j++, ne->ne_name, ne->ne_fileid, *(u_int *)ne->ne_cookie);
j++, ne->ne_name, ne->ne_fileid, cookie);
}
}
return 0;
}
@ -460,9 +468,9 @@ amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep
am_node *xp_next = next_nonerror_node(xp->am_osib);
if (xp_next) {
*(u_int *) ep->ne_cookie = xp_next->am_gen;
(void)memcpy(ep->ne_cookie, &xp_next->am_gen, sizeof(xp_next->am_gen));
} else {
*(u_int *) ep->ne_cookie = DOT_DOT_COOKIE;
(void)memcpy(ep->ne_cookie, &dotdotcookie, sizeof(dotdotcookie));
dp->dl_eof = TRUE;
}
@ -488,9 +496,12 @@ amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep
if (amuDebug(D_READDIR)) {
nfsentry *ne;
int j;
for (j=0,ne=ep; ne; ne=ne->ne_nextentry)
for (j=0,ne=ep; ne; ne=ne->ne_nextentry) {
u_int cookie;
(void)memcpy(&cookie, ne->ne_cookie, sizeof(cookie));
plog(XLOG_DEBUG, "gen2 key %4d \"%s\" fi=%d ck=%d",
j++, ne->ne_name, ne->ne_fileid, *(u_int *)ne->ne_cookie);
j++, ne->ne_name, ne->ne_fileid, cookie);
}
}
return 0;
}

View File

@ -492,9 +492,10 @@ hlfsd_getpwent(void)
/* read records */
buf[0] = '\0';
fgets(buf, 256, passwd_fp);
if (fgets(buf, 256, passwd_fp) == NULL)
return NULL;
passwd_line++;
if (!buf || buf[0] == '\0')
if (buf[0] == '\0')
goto readent;
/* read user name */

View File

@ -164,8 +164,7 @@ nfsproc_getattr_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
if (gid != hlfs_gid) {
res.ns_status = NFSERR_STALE;
} else {
memset((char *) &uid, 0, sizeof(int));
uid = *(u_int *) argp->fh_data;
(void)memcpy(&uid, argp->fh_data, sizeof(uid));
if (plt_search(uid) != (uid2home_t *) NULL) {
res.ns_status = NFS_OK;
un_fattr.na_fileid = uid;
@ -282,8 +281,8 @@ nfsproc_lookup_2_svc(nfsdiropargs *argp, struct svc_req *rqstp)
} else { /* entry found and gid is permitted */
un_fattr.na_fileid = untab[idx].uid;
res.dr_u.dr_drok_u.drok_attributes = un_fattr;
memset((char *) &un_fhandle, 0, sizeof(am_nfs_fh));
*(u_int *) un_fhandle.fh_data = (u_int) untab[idx].uid;
memset(&un_fhandle, 0, sizeof(un_fhandle));
memcpy(un_fhandle.fh_data, &untab[idx].uid, sizeof(untab[idx].uid));
xstrlcpy((char *) &un_fhandle.fh_data[sizeof(int)],
untab[idx].username,
sizeof(am_nfs_fh) - sizeof(int));
@ -338,8 +337,7 @@ nfsproc_readlink_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
}
if (groupid == hlfs_gid) {
memset((char *) &userid, 0, sizeof(int));
userid = *(u_int *) argp->fh_data;
memcpy(&userid, argp->fh_data, sizeof(userid));
username = (char *) &argp->fh_data[sizeof(int)];
if (!(res.rlr_u.rlr_data_u = mailbox(userid, username)))
return (nfsreadlinkres *) NULL;

View File

@ -1948,11 +1948,17 @@ _ELF_DEFINE_RELOC(R_X86_64_TPOFF32, 23) \
_ELF_DEFINE_RELOC(R_X86_64_PC64, 24) \
_ELF_DEFINE_RELOC(R_X86_64_GOTOFF64, 25) \
_ELF_DEFINE_RELOC(R_X86_64_GOTPC32, 26) \
_ELF_DEFINE_RELOC(R_X86_64_GOT64, 27) \
_ELF_DEFINE_RELOC(R_X86_64_GOTPCREL64, 28) \
_ELF_DEFINE_RELOC(R_X86_64_GOTPC64, 29) \
_ELF_DEFINE_RELOC(R_X86_64_GOTPLT64, 30) \
_ELF_DEFINE_RELOC(R_X86_64_PLTOFF64, 31) \
_ELF_DEFINE_RELOC(R_X86_64_SIZE32, 32) \
_ELF_DEFINE_RELOC(R_X86_64_SIZE64, 33) \
_ELF_DEFINE_RELOC(R_X86_64_GOTPC32_TLSDESC, 34) \
_ELF_DEFINE_RELOC(R_X86_64_TLSDESC_CALL, 35) \
_ELF_DEFINE_RELOC(R_X86_64_TLSDESC, 36)
_ELF_DEFINE_RELOC(R_X86_64_TLSDESC, 36) \
_ELF_DEFINE_RELOC(R_X86_64_IRELATIVE, 37)
#define _ELF_DEFINE_RELOCATIONS() \
_ELF_DEFINE_386_RELOCATIONS() \

View File

@ -210,7 +210,7 @@ static struct {
};
static int copy_from_tempfile(const char *src, const char *dst,
int infd, int *outfd);
int infd, int *outfd, int in_place);
static void create_file(struct elfcopy *ecp, const char *src,
const char *dst);
static void elfcopy_main(struct elfcopy *ecp, int argc, char **argv);
@ -523,33 +523,39 @@ create_tempfile(char **fn, int *fd)
#undef _TEMPFILEPATH
}
/*
* Copy temporary file with path src and file descriptor infd to path dst.
* If in_place is set act as if editing the file in place, avoiding rename()
* to preserve hard and symbolic links. Output file remains open, with file
* descriptor returned in outfd.
*/
static int
copy_from_tempfile(const char *src, const char *dst, int infd, int *outfd)
copy_from_tempfile(const char *src, const char *dst, int infd, int *outfd,
int in_place)
{
int tmpfd;
/*
* First, check if we can use rename().
*/
if (rename(src, dst) >= 0) {
*outfd = infd;
return (0);
} else if (errno != EXDEV)
return (-1);
if (in_place == 0) {
if (rename(src, dst) >= 0) {
*outfd = infd;
return (0);
} else if (errno != EXDEV)
return (-1);
/*
* If the rename() failed due to 'src' and 'dst' residing in
* two different file systems, invoke a helper function in
* libelftc to do the copy.
*/
/*
* If the rename() failed due to 'src' and 'dst' residing in
* two different file systems, invoke a helper function in
* libelftc to do the copy.
*/
if (unlink(dst) < 0)
return (-1);
}
if (unlink(dst) < 0)
return (-1);
if ((tmpfd = open(dst, O_CREAT | O_WRONLY, 0755)) < 0)
return (-1);
if (lseek(infd, 0, SEEK_SET) < 0)
if ((tmpfd = open(dst, O_CREAT | O_TRUNC | O_WRONLY, 0755)) < 0)
return (-1);
if (elftc_copyfile(infd, tmpfd) < 0)
@ -578,6 +584,7 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst)
struct stat sb;
char *tempfile, *elftemp;
int efd, ifd, ofd, ofd0, tfd;
int in_place;
tempfile = NULL;
@ -718,10 +725,15 @@ create_file(struct elfcopy *ecp, const char *src, const char *dst)
#endif
if (tempfile != NULL) {
if (dst == NULL)
in_place = 0;
if (dst == NULL) {
dst = src;
if (lstat(dst, &sb) != -1 &&
(sb.st_nlink > 1 || S_ISLNK(sb.st_mode)))
in_place = 1;
}
if (copy_from_tempfile(tempfile, dst, ofd, &tfd) < 0)
if (copy_from_tempfile(tempfile, dst, ofd, &tfd, in_place) < 0)
err(EXIT_FAILURE, "creation of %s failed", dst);
free(tempfile);

View File

@ -1480,6 +1480,20 @@ r_type(unsigned int mach, unsigned int type)
case 21: return "R_X86_64_DTPOFF32";
case 22: return "R_X86_64_GOTTPOFF";
case 23: return "R_X86_64_TPOFF32";
case 24: return "R_X86_64_PC64";
case 25: return "R_X86_64_GOTOFF64";
case 26: return "R_X86_64_GOTPC32";
case 27: return "R_X86_64_GOT64";
case 28: return "R_X86_64_GOTPCREL64";
case 29: return "R_X86_64_GOTPC64";
case 30: return "R_X86_64_GOTPLT64";
case 31: return "R_X86_64_PLTOFF64";
case 32: return "R_X86_64_SIZE32";
case 33: return "R_X86_64_SIZE64";
case 34: return "R_X86_64_GOTPC32_TLSDESC";
case 35: return "R_X86_64_TLSDESC_CALL";
case 36: return "R_X86_64_TLSDESC";
case 37: return "R_X86_64_IRELATIVE";
default: return "";
}
default: return "";

View File

@ -25,6 +25,7 @@
along with this program; see the file COPYING. If not, write to
the Free Software Foundation, 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA. */
#define __ARM_STATIC_INLINE
#include "unwind.h"
/* We add a prototype for abort here to avoid creating a dependency on
@ -1089,4 +1090,11 @@ _Unwind_GetIPInfo (struct _Unwind_Context *context, int *ip_before_insn)
*ip_before_insn = 0;
return _Unwind_GetGR (context, 15) & ~(_Unwind_Word)1;
}
void
_Unwind_SetIP (struct _Unwind_Context *context, _Unwind_Ptr val)
{
_Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1));
}
#endif

View File

@ -34,6 +34,10 @@
#define __ARM_EABI_UNWINDER__ 1
#ifndef __ARM_STATIC_INLINE
#define __ARM_STATIC_INLINE static inline
#endif
#ifdef __cplusplus
extern "C" {
#endif
@ -245,7 +249,7 @@ extern "C" {
return tmp;
}
static inline _Unwind_Word
__ARM_STATIC_INLINE _Unwind_Word
_Unwind_GetGR (_Unwind_Context *context, int regno)
{
_uw val;
@ -253,6 +257,12 @@ extern "C" {
return val;
}
__ARM_STATIC_INLINE void
_Unwind_SetGR (_Unwind_Context *context, int regno, _Unwind_Word val)
{
_Unwind_VRS_Set (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val);
}
#ifndef __FreeBSD__
/* Return the address of the instruction, not the actual IP value. */
#define _Unwind_GetIP(context) \
@ -260,21 +270,16 @@ extern "C" {
#define _Unwind_GetIPInfo(context, ip_before_insn) \
(*ip_before_insn = 0, _Unwind_GetGR (context, 15) & ~(_Unwind_Word)1)
#else
_Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
_Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
#endif
static inline void
_Unwind_SetGR (_Unwind_Context *context, int regno, _Unwind_Word val)
{
_Unwind_VRS_Set (context, _UVRSC_CORE, regno, _UVRSD_UINT32, &val);
}
/* The dwarf unwinder doesn't understand arm/thumb state. We assume the
landing pad uses the same instruction set as the call site. */
#define _Unwind_SetIP(context, val) \
_Unwind_SetGR (context, 15, val | (_Unwind_GetGR (context, 15) & 1))
#else
_Unwind_Ptr _Unwind_GetIP (struct _Unwind_Context *);
_Unwind_Ptr _Unwind_GetIPInfo (struct _Unwind_Context *, int *);
void _Unwind_SetIP (struct _Unwind_Context *, _Unwind_Ptr);
#endif
#ifdef __cplusplus
} /* extern "C" */

View File

@ -432,15 +432,16 @@ get_core_register_section (char *name,
char *human_name,
int required)
{
char section_name[100];
static char *section_name = NULL;
struct bfd_section *section;
bfd_size_type size;
char *contents;
xfree (section_name);
if (PIDGET (inferior_ptid))
sprintf (section_name, "%s/%d", name, PIDGET (inferior_ptid));
section_name = xstrprintf ("%s/%d", name, PIDGET (inferior_ptid));
else
strcpy (section_name, name);
section_name = xstrdup (name);
section = bfd_get_section_by_name (core_bfd, section_name);
if (! section)

View File

@ -575,6 +575,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
break;
case DW_OP_div:
binop = BINOP_DIV;
break;
case DW_OP_minus:
binop = BINOP_SUB;
break;
@ -595,6 +596,7 @@ execute_stack_op (struct dwarf_expr_context *ctx, unsigned char *op_ptr,
break;
case DW_OP_shr:
binop = BINOP_RSH;
break;
case DW_OP_shra:
binop = BINOP_RSH;
val1 = value_from_longest (signed_address_type (), first);

View File

@ -3463,7 +3463,7 @@ remote_store_registers (int regnum)
{
int i;
regs = alloca (rs->sizeof_g_packet);
memset (regs, rs->sizeof_g_packet, 0);
memset (regs, 0, rs->sizeof_g_packet);
for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
{
struct packet_reg *r = &rs->regs[i];

View File

@ -61,7 +61,7 @@ value_of_builtin_frame_reg (struct frame_info *frame)
val = allocate_value (builtin_type_frame_reg);
VALUE_LVAL (val) = not_lval;
buf = VALUE_CONTENTS_RAW (val);
memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0);
memset (buf, 0, TYPE_LENGTH (VALUE_TYPE (val)));
/* frame.base. */
if (frame != NULL)
ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf,
@ -87,7 +87,7 @@ value_of_builtin_frame_fp_reg (struct frame_info *frame)
struct value *val = allocate_value (builtin_type_void_data_ptr);
char *buf = VALUE_CONTENTS_RAW (val);
if (frame == NULL)
memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0);
memset (buf, 0, TYPE_LENGTH (VALUE_TYPE (val)));
else
ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf,
get_frame_base_address (frame));
@ -105,7 +105,7 @@ value_of_builtin_frame_pc_reg (struct frame_info *frame)
struct value *val = allocate_value (builtin_type_void_data_ptr);
char *buf = VALUE_CONTENTS_RAW (val);
if (frame == NULL)
memset (buf, TYPE_LENGTH (VALUE_TYPE (val)), 0);
memset (buf, 0, TYPE_LENGTH (VALUE_TYPE (val)));
else
ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf,
get_frame_pc (frame));

View File

@ -673,7 +673,7 @@ static _Unwind_Reason_Code trace(struct _Unwind_Context *context, void *c)
* If the failure happened by falling off the end of the stack without finding
* a handler, prints a back trace before aborting.
*/
#if __GNUC__ > 3 && __GNUC_MINOR__ > 2
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
extern "C" void *__cxa_begin_catch(void *e) throw();
#else
extern "C" void *__cxa_begin_catch(void *e);
@ -1191,7 +1191,7 @@ BEGIN_PERSONALITY_FUNCTION(__gxx_personality_v0)
* pointer to the caught exception, which is either the adjusted pointer (for
* C++ exceptions) of the unadjusted pointer (for foreign exceptions).
*/
#if __GNUC__ > 3 && __GNUC_MINOR__ > 2
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 4)
extern "C" void *__cxa_begin_catch(void *e) throw()
#else
extern "C" void *__cxa_begin_catch(void *e)

View File

@ -82,19 +82,14 @@ const char* bad_typeid::what() const throw()
return "std::bad_typeid";
}
__attribute__((weak))
bad_array_new_length::bad_array_new_length() throw() {}
__attribute__((weak))
bad_array_new_length::~bad_array_new_length() {}
__attribute__((weak))
bad_array_new_length::bad_array_new_length(const bad_array_new_length&) throw() {}
__attribute__((weak))
bad_array_new_length& bad_array_new_length::operator=(const bad_array_new_length&) throw()
{
return *this;
}
__attribute__((weak))
const char* bad_array_new_length::what() const throw()
{
return "std::bad_array_new_length";

View File

@ -35,23 +35,15 @@ type_info::~type_info() {}
bool type_info::operator==(const type_info &other) const
{
#ifdef LIBCXXRT_MERGED_TYPEINFO
return __type_name == other.__type_name;
#else
return __type_name == other.__type_name || strcmp(__type_name, other.__type_name) == 0;
#endif
}
bool type_info::operator!=(const type_info &other) const
{
return !operator==(other);
return __type_name != other.__type_name;
}
bool type_info::before(const type_info &other) const
{
#ifdef LIBCXXRT_MERGED_TYPEINFO
return __type_name < other.__type_name;
#else
return strcmp(__type_name, other.__type_name) < 0;
#endif
}
const char* type_info::name() const
{

View File

@ -33,6 +33,10 @@ using namespace llvm;
#define GET_REGINFO_TARGET_DESC
#include "AArch64GenRegisterInfo.inc"
static cl::opt<bool>
ReserveX18("aarch64-reserve-x18", cl::Hidden,
cl::desc("Reserve X18, making it unavailable as GPR"));
AArch64RegisterInfo::AArch64RegisterInfo(const AArch64InstrInfo *tii,
const AArch64Subtarget *sti)
: AArch64GenRegisterInfo(AArch64::LR), TII(tii), STI(sti) {}
@ -90,7 +94,7 @@ AArch64RegisterInfo::getReservedRegs(const MachineFunction &MF) const {
Reserved.set(AArch64::W29);
}
if (STI->isTargetDarwin()) {
if (STI->isTargetDarwin() || ReserveX18) {
Reserved.set(AArch64::X18); // Platform register
Reserved.set(AArch64::W18);
}
@ -117,7 +121,7 @@ bool AArch64RegisterInfo::isReservedReg(const MachineFunction &MF,
return true;
case AArch64::X18:
case AArch64::W18:
return STI->isTargetDarwin();
return STI->isTargetDarwin() || ReserveX18;
case AArch64::FP:
case AArch64::W29:
return TFI->hasFP(MF) || STI->isTargetDarwin();
@ -379,7 +383,7 @@ unsigned AArch64RegisterInfo::getRegPressureLimit(const TargetRegisterClass *RC,
case AArch64::GPR64commonRegClassID:
return 32 - 1 // XZR/SP
- (TFI->hasFP(MF) || STI->isTargetDarwin()) // FP
- STI->isTargetDarwin() // X18 reserved as platform register
- (STI->isTargetDarwin() || ReserveX18) // X18 reserved as platform register
- hasBasePointer(MF); // X19
case AArch64::FPR8RegClassID:
case AArch64::FPR16RegClassID:

View File

@ -0,0 +1,33 @@
Allow clang to be built for mips/mips64 backend types by adding our mips
triple ids
This only allows testing and does not change the defaults for mips/mips64.
They still build/use gcc by default.
Differential Revision: https://reviews.freebsd.org/D1190
Reviewed by: dim
Introduced here: http://svnweb.freebsd.org/changeset/base/277423
Index: tools/clang/lib/Driver/Tools.cpp
===================================================================
--- tools/clang/lib/Driver/Tools.cpp
+++ tools/clang/lib/Driver/Tools.cpp
@@ -6592,6 +6592,17 @@ void freebsd::Link::ConstructJob(Compilation &C, c
CmdArgs.push_back("elf32ppc_fbsd");
}
+ if (Arg *A = Args.getLastArg(options::OPT_G)) {
+ if (ToolChain.getArch() == llvm::Triple::mips ||
+ ToolChain.getArch() == llvm::Triple::mipsel ||
+ ToolChain.getArch() == llvm::Triple::mips64 ||
+ ToolChain.getArch() == llvm::Triple::mips64el) {
+ StringRef v = A->getValue();
+ CmdArgs.push_back(Args.MakeArgString("-G" + v));
+ A->claim();
+ }
+ }
+
if (Output.isFilename()) {
CmdArgs.push_back("-o");
CmdArgs.push_back(Output.getFilename());

View File

@ -0,0 +1,83 @@
Pull in r226664 from upstream llvm trunk (by Tim Northover):
AArch64: add backend option to reserve x18 (platform register)
AAPCS64 says that it's up to the platform to specify whether x18 is
reserved, and a first step on that way is to add a flag controlling
it.
From: Andrew Turner <andrew@fubar.geek.nz>
Introduced here: http://svnweb.freebsd.org/changeset/base/277774
Index: lib/Target/AArch64/AArch64RegisterInfo.cpp
===================================================================
--- lib/Target/AArch64/AArch64RegisterInfo.cpp
+++ lib/Target/AArch64/AArch64RegisterInfo.cpp
@@ -33,6 +33,10 @@ using namespace llvm;
#define GET_REGINFO_TARGET_DESC
#include "AArch64GenRegisterInfo.inc"
+static cl::opt<bool>
+ReserveX18("aarch64-reserve-x18", cl::Hidden,
+ cl::desc("Reserve X18, making it unavailable as GPR"));
+
AArch64RegisterInfo::AArch64RegisterInfo(const AArch64InstrInfo *tii,
const AArch64Subtarget *sti)
: AArch64GenRegisterInfo(AArch64::LR), TII(tii), STI(sti) {}
@@ -90,7 +94,7 @@ AArch64RegisterInfo::getReservedRegs(const Machine
Reserved.set(AArch64::W29);
}
- if (STI->isTargetDarwin()) {
+ if (STI->isTargetDarwin() || ReserveX18) {
Reserved.set(AArch64::X18); // Platform register
Reserved.set(AArch64::W18);
}
@@ -117,7 +121,7 @@ bool AArch64RegisterInfo::isReservedReg(const Mach
return true;
case AArch64::X18:
case AArch64::W18:
- return STI->isTargetDarwin();
+ return STI->isTargetDarwin() || ReserveX18;
case AArch64::FP:
case AArch64::W29:
return TFI->hasFP(MF) || STI->isTargetDarwin();
@@ -379,7 +383,7 @@ unsigned AArch64RegisterInfo::getRegPressureLimit(
case AArch64::GPR64commonRegClassID:
return 32 - 1 // XZR/SP
- (TFI->hasFP(MF) || STI->isTargetDarwin()) // FP
- - STI->isTargetDarwin() // X18 reserved as platform register
+ - (STI->isTargetDarwin() || ReserveX18) // X18 reserved as platform register
- hasBasePointer(MF); // X19
case AArch64::FPR8RegClassID:
case AArch64::FPR16RegClassID:
Index: test/CodeGen/AArch64/arm64-platform-reg.ll
===================================================================
--- test/CodeGen/AArch64/arm64-platform-reg.ll
+++ test/CodeGen/AArch64/arm64-platform-reg.ll
@@ -1,4 +1,5 @@
-; RUN: llc -mtriple=arm64-apple-ios -o - %s | FileCheck %s --check-prefix=CHECK-DARWIN
+; RUN: llc -mtriple=arm64-apple-ios -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE-X18
+; RUN: llc -mtriple=arm64-freebsd-gnu -aarch64-reserve-x18 -o - %s | FileCheck %s --check-prefix=CHECK-RESERVE-X18
; RUN: llc -mtriple=arm64-linux-gnu -o - %s | FileCheck %s
; x18 is reserved as a platform register on Darwin but not on other
@@ -16,11 +17,11 @@ define void @keep_live() {
; CHECK: ldr x18
; CHECK: str x18
-; CHECK-DARWIN-NOT: ldr fp
-; CHECK-DARWIN-NOT: ldr x18
-; CHECK-DARWIN: Spill
-; CHECK-DARWIN-NOT: ldr fp
-; CHECK-DARWIN-NOT: ldr x18
-; CHECK-DARWIN: ret
+; CHECK-RESERVE-X18-NOT: ldr fp
+; CHECK-RESERVE-X18-NOT: ldr x18
+; CHECK-RESERVE-X18: Spill
+; CHECK-RESERVE-X18-NOT: ldr fp
+; CHECK-RESERVE-X18-NOT: ldr x18
+; CHECK-RESERVE-X18: ret
ret void
}

View File

@ -0,0 +1,54 @@
Pull in r227062 from upstream clang trunk (by Renato Golin):
Allows Clang to use LLVM's fixes-x18 option
This patch allows clang to have llvm reserve the x18
platform register on AArch64. FreeBSD will use this in the kernel for
per-cpu data but has no need to reserve this register in userland so
will need this flag to reserve it.
This uses llvm r226664 to allow this register to be reserved.
Patch by Andrew Turner.
Introduced here: http://svnweb.freebsd.org/changeset/base/277775
Index: tools/clang/include/clang/Driver/Options.td
===================================================================
--- tools/clang/include/clang/Driver/Options.td
+++ tools/clang/include/clang/Driver/Options.td
@@ -1141,6 +1141,9 @@ def mno_long_calls : Flag<["-"], "mno-long-calls">
def mgeneral_regs_only : Flag<["-"], "mgeneral-regs-only">, Group<m_aarch64_Features_Group>,
HelpText<"Generate code which only uses the general purpose registers (AArch64 only)">;
+def ffixed_x18 : Flag<["-"], "ffixed-x18">, Group<m_aarch64_Features_Group>,
+ HelpText<"Reserve the x18 register (AArch64 only)">;
+
def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>;
def mno_vsx : Flag<["-"], "mno-vsx">, Group<m_ppc_Features_Group>;
def mfprnd : Flag<["-"], "mfprnd">, Group<m_ppc_Features_Group>;
Index: tools/clang/lib/Driver/Tools.cpp
===================================================================
--- tools/clang/lib/Driver/Tools.cpp
+++ tools/clang/lib/Driver/Tools.cpp
@@ -887,6 +887,11 @@ void Clang::AddAArch64TargetArgs(const ArgList &Ar
if (A->getOption().matches(options::OPT_mno_global_merge))
CmdArgs.push_back("-mno-global-merge");
}
+
+ if (Args.hasArg(options::OPT_ffixed_x18)) {
+ CmdArgs.push_back("-backend-option");
+ CmdArgs.push_back("-aarch64-reserve-x18");
+ }
}
// Get CPU and ABI names. They are not independent
Index: tools/clang/test/Driver/aarch64-fixed-x18.c
===================================================================
--- tools/clang/test/Driver/aarch64-fixed-x18.c
+++ tools/clang/test/Driver/aarch64-fixed-x18.c
@@ -0,0 +1,4 @@
+// RUN: %clang -target aarch64-none-gnu -ffixed-x18 -### %s 2> %t
+// RUN: FileCheck --check-prefix=CHECK-FIXED-X18 < %t %s
+
+// CHECK-FIXED-X18: "-backend-option" "-aarch64-reserve-x18"

View File

@ -1141,6 +1141,9 @@ def mno_long_calls : Flag<["-"], "mno-long-calls">, Group<m_arm_Features_Group>,
def mgeneral_regs_only : Flag<["-"], "mgeneral-regs-only">, Group<m_aarch64_Features_Group>,
HelpText<"Generate code which only uses the general purpose registers (AArch64 only)">;
def ffixed_x18 : Flag<["-"], "ffixed-x18">, Group<m_aarch64_Features_Group>,
HelpText<"Reserve the x18 register (AArch64 only)">;
def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>;
def mno_vsx : Flag<["-"], "mno-vsx">, Group<m_ppc_Features_Group>;
def mfprnd : Flag<["-"], "mfprnd">, Group<m_ppc_Features_Group>;

View File

@ -887,6 +887,11 @@ void Clang::AddAArch64TargetArgs(const ArgList &Args,
if (A->getOption().matches(options::OPT_mno_global_merge))
CmdArgs.push_back("-mno-global-merge");
}
if (Args.hasArg(options::OPT_ffixed_x18)) {
CmdArgs.push_back("-backend-option");
CmdArgs.push_back("-aarch64-reserve-x18");
}
}
// Get CPU and ABI names. They are not independent
@ -6587,6 +6592,17 @@ void freebsd::Link::ConstructJob(Compilation &C, const JobAction &JA,
CmdArgs.push_back("elf32ppc_fbsd");
}
if (Arg *A = Args.getLastArg(options::OPT_G)) {
if (ToolChain.getArch() == llvm::Triple::mips ||
ToolChain.getArch() == llvm::Triple::mipsel ||
ToolChain.getArch() == llvm::Triple::mips64 ||
ToolChain.getArch() == llvm::Triple::mips64el) {
StringRef v = A->getValue();
CmdArgs.push_back(Args.MakeArgString("-G" + v));
A->claim();
}
}
if (Output.isFilename()) {
CmdArgs.push_back("-o");
CmdArgs.push_back(Output.getFilename());

View File

@ -41,6 +41,7 @@ LINE("libcrypt", "Crypt Library (libcrypt, \\-lcrypt)")
LINE("libcurses", "Curses Library (libcurses, \\-lcurses)")
LINE("libcuse", "Userland Character Device Library (libcuse, \\-lcuse)")
LINE("libdevattr", "Device attribute and event library (libdevattr, \\-ldevattr)")
LINE("libdevctl", "Device Control Library (libdevctl, \\-ldevctl)")
LINE("libdevinfo", "Device and Resource Information Utility Library (libdevinfo, \\-ldevinfo)")
LINE("libdevstat", "Device Statistics Library (libdevstat, \\-ldevstat)")
LINE("libdisk", "Interface to Slice and Partition Labels Library (libdisk, \\-ldisk)")

View File

@ -54,9 +54,6 @@ overflow_head() {
atf_set "descr" "Test overflow cases"
}
overflow_body() {
# Begin FreeBSD
atf_expect_fail "FreeBSD's expr does not check overflow to the same degree NetBSD's expr does; see bug 196867 for more details"
# End FreeBSD
test_expr '4611686018427387904 + 4611686018427387903' \
'9223372036854775807'
test_expr '4611686018427387904 + 4611686018427387904' \

Some files were not shown because too many files have changed in this diff Show More