summaryrefslogtreecommitdiff
path: root/usr/src
diff options
context:
space:
mode:
Diffstat (limited to 'usr/src')
-rw-r--r--usr/src/Makefile.master52
-rw-r--r--usr/src/Makefile.master.644
-rw-r--r--usr/src/boot/Makefile.version2
-rw-r--r--usr/src/boot/lib/libstand/nfs.c4
-rw-r--r--usr/src/boot/lib/libstand/tftp.c7
-rw-r--r--usr/src/boot/sys/boot/common/dev_net.c8
-rw-r--r--usr/src/cmd/ast/ksh/builtins/Makefile1
-rw-r--r--usr/src/cmd/ast/ksh/builtins/alias.c1
-rw-r--r--usr/src/cmd/cmd-inet/usr.bin/rdist/server.c8
-rw-r--r--usr/src/cmd/ctfdump/Makefile3
-rw-r--r--usr/src/cmd/dd/dd.c150
-rw-r--r--usr/src/cmd/file/Makefile3
-rw-r--r--usr/src/cmd/fs.d/ufs/fsck/Makefile24
-rw-r--r--usr/src/cmd/mdb/Makefile.libstandctf1
-rw-r--r--usr/src/cmd/mdb/Makefile.mdb34
-rw-r--r--usr/src/cmd/mdb/intel/amd64/libfksmbsrv/Makefile4
-rw-r--r--usr/src/cmd/mdb/intel/amd64/libmlsvc/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/amd64/libzpool/Makefile4
-rw-r--r--usr/src/cmd/mdb/intel/amd64/qlc/Makefile4
-rw-r--r--usr/src/cmd/mdb/intel/amd64/srpt/Makefile1
-rw-r--r--usr/src/cmd/mdb/intel/amd64/zfs/Makefile1
-rw-r--r--usr/src/cmd/mdb/intel/ia32/libfksmbsrv/Makefile4
-rw-r--r--usr/src/cmd/mdb/intel/ia32/libmlsvc/Makefile2
-rw-r--r--usr/src/cmd/mdb/intel/ia32/libzpool/Makefile4
-rw-r--r--usr/src/cmd/mdb/intel/modules/mdb_kb/amd64/Makefile1
-rw-r--r--usr/src/cmd/mdb/sparc/v7/libfksmbsrv/Makefile4
-rw-r--r--usr/src/cmd/mdb/sparc/v7/libmlsvc/Makefile2
-rw-r--r--usr/src/cmd/mdb/sparc/v7/libzpool/Makefile4
-rw-r--r--usr/src/cmd/mdb/sparc/v9/libfksmbsrv/Makefile4
-rw-r--r--usr/src/cmd/mdb/sparc/v9/libmlsvc/Makefile2
-rw-r--r--usr/src/cmd/mdb/sparc/v9/libzpool/Makefile4
-rw-r--r--usr/src/cmd/mdb/sparc/v9/qlc/Makefile4
-rw-r--r--usr/src/cmd/mdb/sparc/v9/srpt/Makefile1
-rw-r--r--usr/src/cmd/mdb/sparc/v9/stmf_sbd/Makefile1
-rw-r--r--usr/src/cmd/mdb/sparc/v9/zfs/Makefile1
-rw-r--r--usr/src/cmd/od/Makefile9
-rw-r--r--usr/src/cmd/sgs/common/string_table.c179
-rw-r--r--usr/src/cmd/sgs/include/libld.h3
-rw-r--r--usr/src/cmd/sgs/include/string_table.h4
-rw-r--r--usr/src/cmd/sgs/libld/common/sections.c449
-rw-r--r--usr/src/cmd/sgs/tools/SUNWonld-README2
-rw-r--r--usr/src/cmd/smbsrv/Makefile.smbsrv.defs3
-rw-r--r--usr/src/cmd/smbsrv/fksmbd/Makefile8
-rw-r--r--usr/src/cmd/smbsrv/smbd/Makefile6
-rw-r--r--usr/src/cmd/smbsrv/test-msgbuf/Makefile8
-rw-r--r--usr/src/cmd/tail/Makefile4
-rw-r--r--usr/src/cmd/tr/Makefile4
-rwxr-xr-xusr/src/cmd/vscan/vscanadm/Makefile3
-rw-r--r--usr/src/cmd/vscan/vscand/Makefile4
-rw-r--r--usr/src/cmd/zstreamdump/Makefile7
-rw-r--r--usr/src/lib/libidspace/Makefile5
-rw-r--r--usr/src/lib/libidspace/Makefile.com2
-rw-r--r--usr/src/lib/libidspace/amd64/Makefile2
-rw-r--r--usr/src/lib/libidspace/common/llib-lidspace19
-rw-r--r--usr/src/lib/libidspace/i386/Makefile2
-rw-r--r--usr/src/lib/libidspace/sparc/Makefile18
-rw-r--r--usr/src/lib/libidspace/sparcv9/Makefile19
-rw-r--r--usr/src/lib/libppt/Makefile.com1
-rw-r--r--usr/src/man/man1m/dd.1m32
-rw-r--r--usr/src/pkg/manifests/system-library.mf2
-rw-r--r--usr/src/pkg/manifests/system-test-elftest.mf8
-rw-r--r--usr/src/test/elf-tests/runfiles/default.run5
-rw-r--r--usr/src/test/elf-tests/tests/Makefile1
-rw-r--r--usr/src/test/elf-tests/tests/string-merge/Makefile47
-rw-r--r--usr/src/test/elf-tests/tests/string-merge/simple.sh56
-rw-r--r--usr/src/test/elf-tests/tests/string-merge/str1.s6
-rw-r--r--usr/src/test/elf-tests/tests/string-merge/str2.s4
-rw-r--r--usr/src/tools/ctf/ctfdump/Makefile.com3
-rw-r--r--usr/src/tools/ctf/libctf/Makefile.com1
-rw-r--r--usr/src/tools/sgs/sgsmsg/Makefile1
-rw-r--r--usr/src/uts/common/Makefile.files3
-rw-r--r--usr/src/uts/common/Makefile.rules8
-rw-r--r--usr/src/uts/common/exec/java/java.c1
-rw-r--r--usr/src/uts/common/exec/shbin/shbin.c7
-rw-r--r--usr/src/uts/common/refhash/refhash.c208
-rw-r--r--usr/src/uts/i86pc/acpi_drv/Makefile5
-rw-r--r--usr/src/uts/intel/bnx/Makefile3
-rw-r--r--usr/src/uts/intel/bnxe/Makefile2
-rw-r--r--usr/src/uts/intel/ctf/Makefile2
-rw-r--r--usr/src/uts/intel/fct/Makefile2
-rw-r--r--usr/src/uts/intel/iscsit/Makefile2
-rw-r--r--usr/src/uts/intel/pppt/Makefile2
-rw-r--r--usr/src/uts/intel/qlge/Makefile2
-rw-r--r--usr/src/uts/intel/qlt/Makefile2
-rw-r--r--usr/src/uts/intel/srpt/Makefile2
-rw-r--r--usr/src/uts/intel/stmf/Makefile2
-rw-r--r--usr/src/uts/intel/stmf_sbd/Makefile2
-rw-r--r--usr/src/uts/intel/zfs/Makefile2
-rw-r--r--usr/src/uts/intel/zut/Makefile2
-rw-r--r--usr/src/uts/sparc/bnxe/Makefile2
-rw-r--r--usr/src/uts/sparc/ctf/Makefile2
-rw-r--r--usr/src/uts/sparc/fct/Makefile2
-rw-r--r--usr/src/uts/sparc/iscsit/Makefile2
-rw-r--r--usr/src/uts/sparc/pppt/Makefile2
-rw-r--r--usr/src/uts/sparc/qlge/Makefile2
-rw-r--r--usr/src/uts/sparc/qlt/Makefile2
-rw-r--r--usr/src/uts/sparc/srpt/Makefile2
-rw-r--r--usr/src/uts/sparc/stmf/Makefile2
-rw-r--r--usr/src/uts/sparc/stmf_sbd/Makefile2
-rw-r--r--usr/src/uts/sparc/zfs/Makefile2
-rw-r--r--usr/src/uts/sparc/zut/Makefile2
101 files changed, 936 insertions, 630 deletions
diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master
index 0be396e61d..e89263cab1 100644
--- a/usr/src/Makefile.master
+++ b/usr/src/Makefile.master
@@ -524,11 +524,10 @@ CCERRWARN += -_gcc=-Wno-unknown-pragmas
CCERRWARN += -_gcc=-Wno-unused-parameter
CCERRWARN += -_gcc=-Wno-missing-field-initializers
-# C standard. Keep Studio flags until we get rid of lint.
+# C standard
CSTD_GNU89= -xc99=%none
CSTD_GNU99= -xc99=%all
CSTD= $(CSTD_GNU89)
-C99LMODE= $(CSTD:-xc99%=-Xc99%)
# In most places, assignments to these macros should be appended with +=
# (CPPFLAGS.first allows values to be prepended to CPPFLAGS).
@@ -880,41 +879,6 @@ LINK.cc= $(CCC) $(CCFLAGS) $(CPPFLAGS) $(NORUNPATH) \
LINK64.cc= $(CCC) $(CCFLAGS64) $(CPPFLAGS) $(NORUNPATH) \
$(LDFLAGS) $(CCNEEDED64) $(LDCHECKS)
-#
-# lint macros
-#
-# Note that the undefine of __PRAGMA_REDEFINE_EXTNAME can be removed once
-# ON is built with a version of lint that has the fix for 4484186.
-#
-ALWAYS_LINT_DEFS = -errtags=yes -s
-ALWAYS_LINT_DEFS += -erroff=E_PTRDIFF_OVERFLOW
-ALWAYS_LINT_DEFS += -erroff=E_ASSIGN_NARROW_CONV
-ALWAYS_LINT_DEFS += -U__PRAGMA_REDEFINE_EXTNAME
-ALWAYS_LINT_DEFS += $(C99LMODE)
-ALWAYS_LINT_DEFS += -errsecurity=$(SECLEVEL)
-ALWAYS_LINT_DEFS += -erroff=E_SEC_CREAT_WITHOUT_EXCL
-ALWAYS_LINT_DEFS += -erroff=E_SEC_FORBIDDEN_WARN_CREAT
-# XX64 -- really only needed for amd64 lint
-ALWAYS_LINT_DEFS += -erroff=E_ASSIGN_INT_TO_SMALL_INT
-ALWAYS_LINT_DEFS += -erroff=E_CAST_INT_CONST_TO_SMALL_INT
-ALWAYS_LINT_DEFS += -erroff=E_CAST_INT_TO_SMALL_INT
-ALWAYS_LINT_DEFS += -erroff=E_CAST_TO_PTR_FROM_INT
-ALWAYS_LINT_DEFS += -erroff=E_COMP_INT_WITH_LARGE_INT
-ALWAYS_LINT_DEFS += -erroff=E_INTEGRAL_CONST_EXP_EXPECTED
-ALWAYS_LINT_DEFS += -erroff=E_PASS_INT_TO_SMALL_INT
-ALWAYS_LINT_DEFS += -erroff=E_PTR_CONV_LOSES_BITS
-
-# This forces lint to pick up note.h and sys/note.h from Devpro rather than
-# from the proto area. The note.h that ON delivers would disable NOTE().
-ONLY_LINT_DEFS = -I$(SPRO_VROOT)/prod/include/lint
-
-SECLEVEL= core
-LINT.c= $(LINT) $(ONLY_LINT_DEFS) $(LINTFLAGS) $(CPPFLAGS) \
- $(ALWAYS_LINT_DEFS)
-LINT64.c= $(LINT) $(ONLY_LINT_DEFS) $(LINTFLAGS64) $(CPPFLAGS) \
- $(ALWAYS_LINT_DEFS)
-LINT.s= $(LINT.c)
-
# For some future builds, NATIVE_MACH and MACH might be different.
# Therefore, NATIVE_MACH needs to be redefined in the
# environment as `uname -p` to override this macro.
@@ -943,13 +907,6 @@ CW_CCC_COMPILERS= $(PRIMARY_CCC:%=--primary %) $(SHADOW_CCCS:%=--shadow %)
CW_LINKER= --linker $(LD)
-# Till SS12u1 formally becomes the NV CBE, LINT is hard
-# coded to be picked up from the $SPRO_ROOT/sunstudio12.1/
-# location. Impacted variables are sparc_LINT, sparcv9_LINT,
-# i386_LINT, amd64_LINT.
-# Reset them when SS12u1 is rolled out.
-#
-
# Specify platform compiler versions for languages
# that we use (currently only c and c++).
#
@@ -959,18 +916,15 @@ BUILD_CC= $(CW) $(CW_LINKER) $(CW_CC_COMPILERS) --
BUILD_CCC= $(CW) -C $(CW_LINKER) $(CW_CCC_COMPILERS) --
BUILD_CPP= /usr/ccs/lib/cpp
BUILD_LD= $(ONBLD_TOOLS)/bin/$(MACH)/ld
-BUILD_LINT= $(SPRO_ROOT)/sunstudio12.1/bin/lint
$(MACH)_CC= $(BUILD_CC)
$(MACH)_CCC= $(BUILD_CCC)
$(MACH)_CPP= $(BUILD_CPP)
$(MACH)_LD= $(BUILD_LD)
-$(MACH)_LINT= $(BUILD_LINT)
$(MACH64)_CC= $(BUILD_CC)
$(MACH64)_CCC= $(BUILD_CCC)
$(MACH64)_CPP= $(BUILD_CPP)
$(MACH64)_LD= $(BUILD_LD)
-$(MACH64)_LINT= $(BUILD_LINT)
sparc_AS= /usr/ccs/bin/as -xregsym=no
sparcv9_AS= $($(MACH)_AS)
@@ -984,14 +938,12 @@ NATIVECCC= $($(NATIVE_MACH)_CCC)
NATIVECPP= $($(NATIVE_MACH)_CPP)
NATIVEAS= $($(NATIVE_MACH)_AS)
NATIVELD= $($(NATIVE_MACH)_LD)
-NATIVELINT= $($(NATIVE_MACH)_LINT)
NATIVECC64= $($(NATIVE_MACH64)_CC)
NATIVECCC64= $($(NATIVE_MACH64)_CCC)
NATIVECPP64= $($(NATIVE_MACH64)_CPP)
NATIVEAS64= $($(NATIVE_MACH64)_AS)
NATIVELD64= $($(NATIVE_MACH64)_LD)
-NATIVELINT64= $($(NATIVE_MACH64)_LINT)
#
# Makefile.master.64 overrides these settings
@@ -1001,14 +953,12 @@ CCC= $(NATIVECCC)
CPP= $(NATIVECPP)
AS= $(NATIVEAS)
LD= $(NATIVELD)
-LINT= $(NATIVELINT)
CC64= $(NATIVECC64)
CCC64= $(NATIVECCC64)
CPP64= $(NATIVECPP64)
AS64= $(NATIVEAS64)
LD64= $(NATIVELD64)
-LINT64= $(NATIVELINT64)
# Pass -Y flag to cpp (method of which is release-dependent)
CCYFLAG= -Y I,
diff --git a/usr/src/Makefile.master.64 b/usr/src/Makefile.master.64
index 497370b1c7..37d6d288a3 100644
--- a/usr/src/Makefile.master.64
+++ b/usr/src/Makefile.master.64
@@ -39,7 +39,6 @@ COMPILE.d= $(COMPILE64.d)
COMPILE.b= $(COMPILE64.b)
LINK.c= $(LINK64.c)
LINK.cc= $(LINK64.cc)
-LINT.c= $(LINT64.c)
NATIVE_CFLAGS= $(NATIVE_CFLAGS64)
NATIVE_CCFLAGS= $(NATIVE_CCFLAGS64)
@@ -59,14 +58,13 @@ LDLIBS.lib = $(LDLIBS64)
GCCLIBDIR= $(GCCLIBDIR64)
#
-# Override Makefile.master's settings of CC, CCC, AS and LINT
+# Override Makefile.master's settings
#
CC= $(CC64)
CCC= $(CCC64)
CPP= $(CPP64)
AS= $(AS64)
LD= $(LD64)
-LINT= $(LINT64)
NATIVECC= $(NATIVECC64)
NATIVECCC= $(NATIVECCC64)
NATIVECPP= $(NATIVECPP64)
diff --git a/usr/src/boot/Makefile.version b/usr/src/boot/Makefile.version
index 426b2d6d50..73a7b3138f 100644
--- a/usr/src/boot/Makefile.version
+++ b/usr/src/boot/Makefile.version
@@ -34,4 +34,4 @@ LOADER_VERSION = 1.1
# Use date like formatting here, YYYY.MM.DD.XX, without leading zeroes.
# The version is processed from left to right, the version number can only
# be increased.
-BOOT_VERSION = $(LOADER_VERSION)-2021.09.25.1
+BOOT_VERSION = $(LOADER_VERSION)-2021.09.29.1
diff --git a/usr/src/boot/lib/libstand/nfs.c b/usr/src/boot/lib/libstand/nfs.c
index a31f449da8..f10abf1e26 100644
--- a/usr/src/boot/lib/libstand/nfs.c
+++ b/usr/src/boot/lib/libstand/nfs.c
@@ -461,6 +461,7 @@ nfs_readdata(struct nfs_iodesc *d, off_t off, void *addr, size_t len)
int
nfs_open(const char *upath, struct open_file *f)
{
+ struct devdesc *dev;
struct iodesc *desc;
struct nfs_iodesc *currfd = NULL;
char buf[2 * NFS_V3MAXFHSIZE + 3];
@@ -479,6 +480,7 @@ nfs_open(const char *upath, struct open_file *f)
if (netproto != NET_NFS)
return (EINVAL);
+ dev = f->f_devdata;
#ifdef NFS_DEBUG
if (debug)
printf("nfs_open: %s (rootpath=%s)\n", upath, rootpath);
@@ -491,7 +493,7 @@ nfs_open(const char *upath, struct open_file *f)
if (f->f_dev->dv_type != DEVT_NET)
return (EINVAL);
- if (!(desc = socktodesc(*(int *)(f->f_devdata))))
+ if (!(desc = socktodesc(*(int *)(dev->d_opendata))))
return (EINVAL);
/* Bind to a reserved port. */
diff --git a/usr/src/boot/lib/libstand/tftp.c b/usr/src/boot/lib/libstand/tftp.c
index 33b1e1a1ed..f324bf20e7 100644
--- a/usr/src/boot/lib/libstand/tftp.c
+++ b/usr/src/boot/lib/libstand/tftp.c
@@ -36,7 +36,8 @@
/*
* Simple TFTP implementation for libsa.
* Assumes:
- * - socket descriptor (int) at open_file->f_devdata
+ * - socket descriptor (int) at dev->d_opendata, dev stored at
+ * open_file->f_devdata
* - server host IP in global rootip
* Restrictions:
* - read only
@@ -429,6 +430,7 @@ tftp_getnextblock(struct tftp_handle *h)
static int
tftp_open(const char *path, struct open_file *f)
{
+ struct devdesc *dev;
struct tftp_handle *tftpfile;
struct iodesc *io;
int res;
@@ -449,7 +451,8 @@ tftp_open(const char *path, struct open_file *f)
return (ENOMEM);
tftpfile->tftp_blksize = TFTP_REQUESTED_BLKSIZE;
- tftpfile->iodesc = io = socktodesc(*(int *)(f->f_devdata));
+ dev = f->f_devdata;
+ tftpfile->iodesc = io = socktodesc(*(int *)(dev->d_opendata));
if (io == NULL) {
free(tftpfile);
return (EINVAL);
diff --git a/usr/src/boot/sys/boot/common/dev_net.c b/usr/src/boot/sys/boot/common/dev_net.c
index 44d0d67719..a71127c641 100644
--- a/usr/src/boot/sys/boot/common/dev_net.c
+++ b/usr/src/boot/sys/boot/common/dev_net.c
@@ -115,7 +115,7 @@ net_init(void)
/*
* Called by devopen after it sets f->f_dev to our devsw entry.
- * This opens the low-level device and sets f->f_devdata.
+ * This opens the low-level device and sets dev->d_opendata.
* This is declared with variable arguments...
*/
static int
@@ -193,20 +193,22 @@ net_open(struct open_file *f, ...)
}
}
netdev_opens++;
- f->f_devdata = &netdev_sock;
+ dev->d_opendata = &netdev_sock;
return (error);
}
static int
net_close(struct open_file *f)
{
+ struct devdesc *dev;
#ifdef NETIF_DEBUG
if (debug)
printf("%s: opens=%d\n", __func__, netdev_opens);
#endif
- f->f_devdata = NULL;
+ dev = f->f_devdata;
+ dev->d_opendata = NULL;
return (0);
}
diff --git a/usr/src/cmd/ast/ksh/builtins/Makefile b/usr/src/cmd/ast/ksh/builtins/Makefile
index db529aef57..69dc0eeb3d 100644
--- a/usr/src/cmd/ast/ksh/builtins/Makefile
+++ b/usr/src/cmd/ast/ksh/builtins/Makefile
@@ -44,7 +44,6 @@ ALIASPROG= \
jobs \
join \
kill \
- logname \
paste \
print \
read \
diff --git a/usr/src/cmd/ast/ksh/builtins/alias.c b/usr/src/cmd/ast/ksh/builtins/alias.c
index 1516a0bf1c..d0ed480e12 100644
--- a/usr/src/cmd/ast/ksh/builtins/alias.c
+++ b/usr/src/cmd/ast/ksh/builtins/alias.c
@@ -96,7 +96,6 @@ bfastpathrec fastpath_builtins[] =
{ "id", b_id },
{ "join", b_join },
{ "ln", b_ln },
- { "logname", b_logname },
{ "md5sum", b_md5sum },
{ "mkdir", b_mkdir },
{ "mkfifo", b_mkfifo },
diff --git a/usr/src/cmd/cmd-inet/usr.bin/rdist/server.c b/usr/src/cmd/cmd-inet/usr.bin/rdist/server.c
index 70002fb628..1ea30cf3c6 100644
--- a/usr/src/cmd/cmd-inet/usr.bin/rdist/server.c
+++ b/usr/src/cmd/cmd-inet/usr.bin/rdist/server.c
@@ -1523,9 +1523,9 @@ error(char *fmt, ...)
static FILE *fp;
nerrs++;
- if (!fp && !(fp = fdopen(rem, "w")))
- return;
if (iamremote) {
+ if (!fp && !(fp = fdopen(rem, "w")))
+ return;
va_start(ap, fmt);
(void) fprintf(fp, "%crdist: ", 0x01);
(void) vfprintf(fp, fmt, ap);
@@ -1555,9 +1555,9 @@ fatal(char *fmt, ...)
static FILE *fp;
nerrs++;
- if (!fp && !(fp = fdopen(rem, "w")))
- return;
if (iamremote) {
+ if (!fp && !(fp = fdopen(rem, "w")))
+ return;
va_start(ap, fmt);
(void) fprintf(fp, "%crdist: ", 0x02);
(void) vfprintf(fp, fmt, ap);
diff --git a/usr/src/cmd/ctfdump/Makefile b/usr/src/cmd/ctfdump/Makefile
index 37a1ef4cc8..9d76d6675e 100644
--- a/usr/src/cmd/ctfdump/Makefile
+++ b/usr/src/cmd/ctfdump/Makefile
@@ -21,7 +21,6 @@ CFLAGS += $(CCVERBOSE)
LDLIBS += -lctf
CSTD = $(CSTD_GNU99)
-C99LMODE = -Xc99=%all
.KEEP_STATE:
@@ -31,6 +30,4 @@ install: all $(ROOTPROG)
clean:
-lint: lint_PROG
-
include ../Makefile.targ
diff --git a/usr/src/cmd/dd/dd.c b/usr/src/cmd/dd/dd.c
index 3431548a91..2bfb3794d2 100644
--- a/usr/src/cmd/dd/dd.c
+++ b/usr/src/cmd/dd/dd.c
@@ -26,6 +26,7 @@
* Copyright 2012, Josef 'Jeff' Sipek <jeffpc@31bits.net>. All rights reserved.
* Copyright (c) 2014, Joyent, Inc. All rights reserved.
* Copyright (c) 2014 by Delphix. All rights reserved.
+ * Copyright 2021 Oxide Computer Company
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
@@ -117,10 +118,10 @@
/* Local routine declarations */
static int match(char *);
-static void term();
-static unsigned long long number();
-static unsigned char *flsh();
-static void stats();
+static void term(int);
+static unsigned long long number(long long);
+static unsigned char *flsh(void);
+static void stats(boolean_t);
/* Local data definitions */
@@ -166,9 +167,21 @@ static unsigned char *ibuf; /* input buffer pointer */
static unsigned char *obuf; /* output buffer pointer */
static hrtime_t startt; /* hrtime copy started */
+static uint64_t prog_secs; /* number of seconds of progress */
static unsigned long long obytes; /* output bytes */
static sig_atomic_t nstats; /* do we need to output stats */
+typedef enum dd_status {
+ DD_STATUS_DEFAULT = 0,
+ DD_STATUS_NONE = 1 << 0,
+ DD_STATUS_PROGRESS = 1 << 1,
+ DD_STATUS_NOXFER = 1 << 2
+} dd_status_t;
+
+static dd_status_t status_arg = DD_STATUS_DEFAULT;
+static boolean_t stderr_tty = B_FALSE;
+static boolean_t progress_printed = B_FALSE;
+
/* This is an EBCDIC to ASCII conversion table */
/* from a proposed BTL standard April 16, 1979 */
@@ -726,6 +739,18 @@ main(int argc, char **argv)
}
continue;
}
+ if (match("status=")) {
+ if (match("none")) {
+ status_arg = DD_STATUS_NONE;
+ } else if (match("noxfer")) {
+ status_arg = DD_STATUS_NOXFER;
+ } else if (match("progress")) {
+ status_arg = DD_STATUS_PROGRESS;
+ } else {
+ goto badarg;
+ }
+ continue;
+ }
badarg:
(void) fprintf(stderr, "dd: %s \"%s\"\n",
gettext("bad argument:"), string);
@@ -958,6 +983,14 @@ main(int argc, char **argv)
exit(2);
}
+ /*
+ * Determine if stderr is a tty in case someone has invoked
+ * status=progress
+ */
+ if (isatty(STDERR_FILENO) == 1) {
+ stderr_tty = B_TRUE;
+ }
+
/* Skip input blocks */
while (skip) {
@@ -1010,10 +1043,11 @@ main(int argc, char **argv)
startt = gethrtime();
for (;;) {
- if (nstats != 0) {
- stats();
- nstats = 0;
- }
+ /*
+ * Always call into the stats function which will check for
+ * siginfo and related processing that needs to happen.
+ */
+ stats(B_TRUE);
if ((count == 0 && ecount == B_FALSE) || (nifr+nipr < count)) {
/* If proceed on error is enabled, zero the input buffer */
@@ -1055,7 +1089,7 @@ main(int argc, char **argv)
}
term(2);
} else {
- stats();
+ stats(B_FALSE);
ibc = ibs; /* assume a full block */
}
} else {
@@ -1802,7 +1836,7 @@ flsh(void)
static void
term(int c)
{
- stats();
+ stats(B_FALSE);
exit(c);
}
@@ -1810,7 +1844,9 @@ term(int c)
/* */
/* Write record statistics onto standard error */
/* */
-/* Args: none */
+/* Args: main_loop - whether or not we were called from the main */
+/* loop and need to consider the siginfo */
+/* handler or status=progress output */
/* Global args: nifr, nipr, nofr, nopr, ntrunc, obytes */
/* */
/* Return: void */
@@ -1818,28 +1854,98 @@ term(int c)
/* ******************************************************************** */
static void
-stats(void)
+stats(boolean_t main_loop)
{
hrtime_t delta = gethrtime() - startt;
double secs = delta * 1e-9;
- char nnum[NN_NUMBUF_SZ];
+ char bps[NN_NUMBUF_SZ], hobytes[NN_NUMBUF_SZ];
+ boolean_t is_progress = B_FALSE;
+ const char *head = "";
+ const char *tail = "\n";
- (void) fprintf(stderr, gettext("%llu+%llu records in\n"), nifr, nipr);
- (void) fprintf(stderr, gettext("%llu+%llu records out\n"), nofr, nopr);
- if (ntrunc) {
- (void) fprintf(stderr,
- gettext("%llu truncated record(s)\n"), ntrunc);
+ /*
+ * If we've been asked to not print this, then never do.
+ */
+ if (status_arg == DD_STATUS_NONE) {
+ return;
+ }
+
+ /*
+ * If we came here from the main loop, then we need to go through and
+ * determine if we need to do anything at all. There are two cases that
+ * we will have to do something:
+ *
+ * 1) We were asked to by the siginfo handler
+ * 2) We are here from the status=progress handler and enough time has
+ * elapsed since the last time we printed (e.g. 1s)
+ *
+ * We always let the siginfo handler take priority here.
+ */
+ if (main_loop) {
+ if (nstats == 0 && status_arg != DD_STATUS_PROGRESS) {
+ return;
+ }
+
+ if (nstats == 0 && status_arg == DD_STATUS_PROGRESS) {
+ uint64_t num_secs = delta / NANOSEC;
+
+ if (num_secs <= prog_secs) {
+ return;
+ }
+
+ prog_secs = num_secs;
+ is_progress = B_TRUE;
+ if (stderr_tty) {
+ head = "\r";
+ tail = "";
+ }
+ }
+
+ if (nstats == 1) {
+ nstats = 0;
+ }
+ }
+
+ /*
+ * When we output to a tty with status=progress we do so by only
+ * emitting carriage returns and overwriting. This means that when we
+ * come in here for any other reason we need to emit a new line so we
+ * don't end up clobbering anything.
+ *
+ * The progress_printed boolean is basically here to make sure we have
+ * actually printed out a status line that would cause us to need a new
+ * line. If we finished say after a SIGINFO output but before the next
+ * progress output this would result in an extraneous newline.
+ */
+ if (!is_progress && status_arg == DD_STATUS_PROGRESS && stderr_tty &&
+ progress_printed) {
+ (void) fputc('\n', stderr);
+ }
+
+ if (!is_progress) {
+ (void) fprintf(stderr, gettext("%llu+%llu records in\n"),
+ nifr, nipr);
+ (void) fprintf(stderr, gettext("%llu+%llu records out\n"),
+ nofr, nopr);
+ if (ntrunc) {
+ (void) fprintf(stderr,
+ gettext("%llu truncated record(s)\n"), ntrunc);
+ }
}
/*
* If we got here before we started copying somehow, don't bother
* printing the rest.
*/
- if (startt == 0)
+ if (startt == 0 || status_arg == DD_STATUS_NOXFER)
return;
- nicenum((uint64_t)obytes / secs, nnum, sizeof (nnum));
+ nicenum_scale((uint64_t)obytes / secs, 1, bps, sizeof (bps),
+ NN_UNIT_SPACE);
+ nicenum_scale(obytes, 1, hobytes, sizeof (hobytes), NN_UNIT_SPACE);
(void) fprintf(stderr,
- gettext("%llu bytes transferred in %.6f secs (%sB/sec)\n"),
- obytes, secs, nnum);
+ gettext("%s%llu bytes (%siB) transferred in %.6f secs "
+ "(%siB/sec)%s"), head, obytes, hobytes, secs, bps, tail);
+
+ progress_printed = is_progress;
}
diff --git a/usr/src/cmd/file/Makefile b/usr/src/cmd/file/Makefile
index e11a4c0259..7236967e91 100644
--- a/usr/src/cmd/file/Makefile
+++ b/usr/src/cmd/file/Makefile
@@ -39,7 +39,6 @@ SRCS= file.c elf_read.c magicutils.c $(ELFCAP)/elfcap.c
include ../Makefile.cmd
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
CERRWARN += $(CNOWARN_UNINIT)
CERRWARN += -_gcc=-Wno-type-limits
@@ -107,6 +106,4 @@ install: all $(ROOTPROG) $(ROOTXPG4PROG) $(ROOTETCMAGIC)
clean:
$(RM) $(OBJS) $(XPG4OBJS)
-lint: lint_SRCS
-
include ../Makefile.targ
diff --git a/usr/src/cmd/fs.d/ufs/fsck/Makefile b/usr/src/cmd/fs.d/ufs/fsck/Makefile
index 3c3724644c..bdeaf8e616 100644
--- a/usr/src/cmd/fs.d/ufs/fsck/Makefile
+++ b/usr/src/cmd/fs.d/ufs/fsck/Makefile
@@ -62,29 +62,7 @@ $(LIBPROG): $(OBJS)
%.o: $(UFSDIR)/%.c
$(COMPILE.c) $< $(CTFCONVERT_HOOK)
-# Use DEVLINTFLAGS and the definition of LINT.c below for development
-# checking. Prior to putback, increase Nlevel to 4 for extra sanity.
-# Nlevel=2 is the default applied by lint.
-#
-# Remember to comment LINT.c out before doing the putback, as we shouldn't
-# be overriding the top-level settings under normal circumstances.
-#
-# Note that you have to have a proto area with populated usr/include and
-# usr/include/sys (or the parent workspace needs it). Otherwise lint gets
-# very confused. Unfortunately, we also have to tell it where its own
-# include directory is, or it gets the wrong version of note.h.
-
-SECLEVEL=core
-DEVLINTFLAGS = -errtags=yes -U__PRAGMA_REDEFINE_EXTNAME \
- $(C99LMODE) -errsecurity=$(SECLEVEL) \
- -x -Nlevel=2 \
- -I/net/tools-sparc/export/tools.sparc/on10-tools/SUNWspro/SOS8/prod/include/lint
-
-#LINT.c= $(LINT) $(DEVLINTFLAGS) $(CPPFLAGS)
-
-lint: lint_SRCS
-
-clean:
+clean:
$(RM) $(FSCKOBJS) $(UFSOBJS)
cscope.out tags: FRC
diff --git a/usr/src/cmd/mdb/Makefile.libstandctf b/usr/src/cmd/mdb/Makefile.libstandctf
index bab6231894..29803862a4 100644
--- a/usr/src/cmd/mdb/Makefile.libstandctf
+++ b/usr/src/cmd/mdb/Makefile.libstandctf
@@ -48,7 +48,6 @@ CPPFLAGS += -I$(SRC)/common/ctf -I../../../common -DCTF_OLD_VERSIONS -D_MDB \
-Dvsnprintf=ctf_vsnprintf -Dassfail=kmdb_prom_assfail
CSTD = $(CSTD_GNU99)
-C99LMODE = -Xc99=%all
#
# We cannot currently use the stack protector in the kmdb standalone
diff --git a/usr/src/cmd/mdb/Makefile.mdb b/usr/src/cmd/mdb/Makefile.mdb
index 5772bed1fd..18770e87e0 100644
--- a/usr/src/cmd/mdb/Makefile.mdb
+++ b/usr/src/cmd/mdb/Makefile.mdb
@@ -99,7 +99,6 @@ $(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
CPPFLAGS += -D_MDB -I. -I../.. -I../../../common
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
LDLIBS += -lcurses -lkvm -lproc -lrtld_db -lctf -lumem -ldisasm -lscf
LDLIBS += -ldemangle-sys
@@ -111,14 +110,6 @@ CERRWARN += -_gcc=-Wno-parentheses
CERRWARN += -_gcc=-Wno-unused-label
CERRWARN += -_gcc=-Wno-unused-variable
-#
-# -erroff=E_INCONS_ARG_DECL2 works around a problem where lint gets confused
-# about how struct mdb_tgt_gregset is used in mdb_tgt_stack_f() and
-# mdb_tgt_stack_iter_f(). Will be resolved as part of fix for CR 6749868.
-#
-LINTFLAGS += -n -errtags=yes -erroff=E_INCONS_ARG_DECL2
-LINTFILES = $(SRCS:%.c=%.ln)
-
PROG = mdb
OBJS = $(SRCS:%.c=%.o) mdb_lex.o mdb_grammar.o
@@ -128,7 +119,7 @@ ROOTLINK32 = $(LINK:%=$(ROOTBIN32)/%)
ROOTLINK64 = $(LINK:%=$(ROOTBIN64)/%)
.NO_PARALLEL:
-.PARALLEL: $(OBJS) $(LINTFILES)
+.PARALLEL: $(OBJS)
all: $(PROG)
@@ -181,32 +172,11 @@ ffs.o ffs.ln := CPPFLAGS += -Dffs=mdb_ffs
$(COMPILE.c) $<
$(CTFCONVERT_O)
-clean.lint:
- $(RM) $(LINTFILES)
-
clean:
$(RM) $(OBJS)
$(RM) mdb_lex.c mdb_grammar.c mdb_grammar.h y.tab.h y.tab.c y.output
-clobber: clean clean.lint
+clobber: clean
$(RM) $(PROG)
-%.ln: ../../../common/mdb/%.c
- $(LINT.c) -c $<
-
-%.ln: ../../mdb/%.c
- $(LINT.c) -c $<
-
-%.ln: %.c
- $(LINT.c) -c $<
-
-%.ln: $(SRC)/common/net/util/%.c
- $(LINT.c) -c $<
-
-%.ln: $(SRC)/common/util/%.c
- $(LINT.c) -c $<
-
-lint: $(LINTFILES)
- $(LINT) $(LINTFLAGS) $(LINTFILES)
-
dmods:
diff --git a/usr/src/cmd/mdb/intel/amd64/libfksmbsrv/Makefile b/usr/src/cmd/mdb/intel/amd64/libfksmbsrv/Makefile
index e22390b335..2d71c1c626 100644
--- a/usr/src/cmd/mdb/intel/amd64/libfksmbsrv/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/libfksmbsrv/Makefile
@@ -46,11 +46,7 @@ CPPFLAGS.first += -I../../../../../lib/libfakekernel/common
CPPFLAGS += -I../../../../../uts/common
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
dmod/%.o: $(GENUNIX_DIR)/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
-
-dmod/%.ln: $(GENUNIX_DIR)/%.c
- $(LINT.c) -c $<
diff --git a/usr/src/cmd/mdb/intel/amd64/libmlsvc/Makefile b/usr/src/cmd/mdb/intel/amd64/libmlsvc/Makefile
index 33157930f7..ed27cc29bd 100644
--- a/usr/src/cmd/mdb/intel/amd64/libmlsvc/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/libmlsvc/Makefile
@@ -42,5 +42,3 @@ MODSRCS_DIR = ../../../common/modules/libmlsvc
CPPFLAGS += -I$(SRC)/uts/common
CSTD= $(CSTD_GNU99)
-C99MODE= -xc99=%all
-C99LMODE= -Xc99=%all
diff --git a/usr/src/cmd/mdb/intel/amd64/libzpool/Makefile b/usr/src/cmd/mdb/intel/amd64/libzpool/Makefile
index b5bbd8467b..4f0c91b550 100644
--- a/usr/src/cmd/mdb/intel/amd64/libzpool/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/libzpool/Makefile
@@ -46,13 +46,9 @@ CPPFLAGS += -I../../../../../lib/libzpool/common \
-I../../../../../common/zfs
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-type-limits
dmod/%.o: $(GENUNIX_DIR)/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
-
-dmod/%.ln: $(GENUNIX_DIR)/%.c
- $(LINT.c) -c $<
diff --git a/usr/src/cmd/mdb/intel/amd64/qlc/Makefile b/usr/src/cmd/mdb/intel/amd64/qlc/Makefile
index d83124d648..1e1ab1beec 100644
--- a/usr/src/cmd/mdb/intel/amd64/qlc/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/qlc/Makefile
@@ -38,10 +38,6 @@ CPPFLAGS += -I$(SRC)/uts/common/sys/fibre-channel
CPPFLAGS += -I$(SRC)/uts/common/sys/fibre-channel/fca/qlc
CPPFLAGS += -I$(SRC)/uts/common/sys/fibre-channel/impl
-LINTFLAGS64 += -erroff=E_STATIC_UNUSED -erroff=E_FUNC_SET_NOT_USED
-LINTFLAGS64 += -erroff=E_STATIC_UNUSED -erroff=E_FUNC_ARG_UNUSED
-
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-address
diff --git a/usr/src/cmd/mdb/intel/amd64/srpt/Makefile b/usr/src/cmd/mdb/intel/amd64/srpt/Makefile
index 94ea5e7130..4f3a088937 100644
--- a/usr/src/cmd/mdb/intel/amd64/srpt/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/srpt/Makefile
@@ -40,4 +40,3 @@ include ../../../Makefile.module
CPPFLAGS += -I$(UTSBASE)/common -I$(UTSBASE)/common/sys -I$(SRPTBASE)
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
diff --git a/usr/src/cmd/mdb/intel/amd64/zfs/Makefile b/usr/src/cmd/mdb/intel/amd64/zfs/Makefile
index 4ffa954410..e9a9985b28 100644
--- a/usr/src/cmd/mdb/intel/amd64/zfs/Makefile
+++ b/usr/src/cmd/mdb/intel/amd64/zfs/Makefile
@@ -42,6 +42,5 @@ CPPFLAGS += -I../../../../../uts/common/fs/zfs/lua
CPPFLAGS += -I../../../../../common/zfs
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-type-limits
diff --git a/usr/src/cmd/mdb/intel/ia32/libfksmbsrv/Makefile b/usr/src/cmd/mdb/intel/ia32/libfksmbsrv/Makefile
index cdc9c5d335..0cc681c694 100644
--- a/usr/src/cmd/mdb/intel/ia32/libfksmbsrv/Makefile
+++ b/usr/src/cmd/mdb/intel/ia32/libfksmbsrv/Makefile
@@ -45,11 +45,7 @@ CPPFLAGS.first += -I../../../../../lib/libfakekernel/common
CPPFLAGS += -I../../../../../uts/common
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
dmod/%.o: $(GENUNIX_DIR)/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
-
-dmod/%.ln: $(GENUNIX_DIR)/%.c
- $(LINT.c) -c $<
diff --git a/usr/src/cmd/mdb/intel/ia32/libmlsvc/Makefile b/usr/src/cmd/mdb/intel/ia32/libmlsvc/Makefile
index 0d889ab4ab..a3d4e11e1f 100644
--- a/usr/src/cmd/mdb/intel/ia32/libmlsvc/Makefile
+++ b/usr/src/cmd/mdb/intel/ia32/libmlsvc/Makefile
@@ -41,5 +41,3 @@ MODSRCS_DIR = ../../../common/modules/libmlsvc
CPPFLAGS += -I$(SRC)/uts/common
CSTD= $(CSTD_GNU99)
-C99MODE= -xc99=%all
-C99LMODE= -Xc99=%all
diff --git a/usr/src/cmd/mdb/intel/ia32/libzpool/Makefile b/usr/src/cmd/mdb/intel/ia32/libzpool/Makefile
index c19d9c56a5..1507bd38d9 100644
--- a/usr/src/cmd/mdb/intel/ia32/libzpool/Makefile
+++ b/usr/src/cmd/mdb/intel/ia32/libzpool/Makefile
@@ -47,13 +47,9 @@ CPPFLAGS += -I../../../../../lib/libzpool/common \
-I../../../../../common/zfs
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-type-limits
dmod/%.o: $(GENUNIX_DIR)/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
-
-dmod/%.ln: $(GENUNIX_DIR)/%.c
- $(LINT.c) -c $<
diff --git a/usr/src/cmd/mdb/intel/modules/mdb_kb/amd64/Makefile b/usr/src/cmd/mdb/intel/modules/mdb_kb/amd64/Makefile
index bae116d95e..c184013fef 100644
--- a/usr/src/cmd/mdb/intel/modules/mdb_kb/amd64/Makefile
+++ b/usr/src/cmd/mdb/intel/modules/mdb_kb/amd64/Makefile
@@ -35,7 +35,6 @@ include ../../../../intel/Makefile.amd64
include ../../../../Makefile.module
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
CPPFLAGS += -DMP -D_MACHDEP -D_MDB -D__xpv
CPPFLAGS += -U_KERNEL -D_KMEMUSER
diff --git a/usr/src/cmd/mdb/sparc/v7/libfksmbsrv/Makefile b/usr/src/cmd/mdb/sparc/v7/libfksmbsrv/Makefile
index 1ff6f2bca4..a7d454669d 100644
--- a/usr/src/cmd/mdb/sparc/v7/libfksmbsrv/Makefile
+++ b/usr/src/cmd/mdb/sparc/v7/libfksmbsrv/Makefile
@@ -47,11 +47,7 @@ CPPFLAGS.first += -I../../../../../lib/libfakekernel/common
CPPFLAGS += -I../../../../../uts/common
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
dmod/%.o: $(GENUNIX_DIR)/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
-
-dmod/%.ln: $(GENUNIX_DIR)/%.c
- $(LINT.c) -c $<
diff --git a/usr/src/cmd/mdb/sparc/v7/libmlsvc/Makefile b/usr/src/cmd/mdb/sparc/v7/libmlsvc/Makefile
index 047773589a..715093e443 100644
--- a/usr/src/cmd/mdb/sparc/v7/libmlsvc/Makefile
+++ b/usr/src/cmd/mdb/sparc/v7/libmlsvc/Makefile
@@ -42,5 +42,3 @@ MODSRCS_DIR = ../../../common/modules/libmlsvc
CPPFLAGS += -I$(SRC)/uts/common
CSTD= $(CSTD_GNU99)
-C99MODE= -xc99=%all
-C99LMODE= -Xc99=%all
diff --git a/usr/src/cmd/mdb/sparc/v7/libzpool/Makefile b/usr/src/cmd/mdb/sparc/v7/libzpool/Makefile
index 5b24c538e4..0e94002bd0 100644
--- a/usr/src/cmd/mdb/sparc/v7/libzpool/Makefile
+++ b/usr/src/cmd/mdb/sparc/v7/libzpool/Makefile
@@ -45,13 +45,9 @@ CPPFLAGS += -I../../../../../lib/libzpool/common \
-I../../../../../common/zfs
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-type-limits
dmod/%.o: $(GENUNIX_DIR)/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
-
-dmod/%.ln: $(GENUNIX_DIR)/%.c
- $(LINT.c) -c $<
diff --git a/usr/src/cmd/mdb/sparc/v9/libfksmbsrv/Makefile b/usr/src/cmd/mdb/sparc/v9/libfksmbsrv/Makefile
index 2c3589005e..4be3d997e0 100644
--- a/usr/src/cmd/mdb/sparc/v9/libfksmbsrv/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/libfksmbsrv/Makefile
@@ -48,11 +48,7 @@ CPPFLAGS.first += -I../../../../../lib/libfakekernel/common
CPPFLAGS += -I../../../../../uts/common
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
dmod/%.o: $(GENUNIX_DIR)/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
-
-dmod/%.ln: $(GENUNIX_DIR)/%.c
- $(LINT.c) -c $<
diff --git a/usr/src/cmd/mdb/sparc/v9/libmlsvc/Makefile b/usr/src/cmd/mdb/sparc/v9/libmlsvc/Makefile
index 0144f56208..01d5ede4eb 100644
--- a/usr/src/cmd/mdb/sparc/v9/libmlsvc/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/libmlsvc/Makefile
@@ -43,5 +43,3 @@ MODSRCS_DIR = ../../../common/modules/libmlsvc
CPPFLAGS += -I$(SRC)/uts/common
CSTD= $(CSTD_GNU99)
-C99MODE= -xc99=%all
-C99LMODE= -Xc99=%all
diff --git a/usr/src/cmd/mdb/sparc/v9/libzpool/Makefile b/usr/src/cmd/mdb/sparc/v9/libzpool/Makefile
index f512dc4c10..eba6fbfd5b 100644
--- a/usr/src/cmd/mdb/sparc/v9/libzpool/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/libzpool/Makefile
@@ -46,13 +46,9 @@ CPPFLAGS += -I../../../../../lib/libzpool/common \
-I../../../../../common/zfs
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-type-limits
dmod/%.o: $(GENUNIX_DIR)/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
-
-dmod/%.ln: $(GENUNIX_DIR)/%.c
- $(LINT.c) -c $<
diff --git a/usr/src/cmd/mdb/sparc/v9/qlc/Makefile b/usr/src/cmd/mdb/sparc/v9/qlc/Makefile
index 926d1a809a..9bfb4fe5b4 100644
--- a/usr/src/cmd/mdb/sparc/v9/qlc/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/qlc/Makefile
@@ -38,10 +38,6 @@ CPPFLAGS += -I$(SRC)/uts/common/sys/fibre-channel
CPPFLAGS += -I$(SRC)/uts/common/sys/fibre-channel/fca/qlc
CPPFLAGS += -I$(SRC)/uts/common/sys/fibre-channel/impl
-LINTFLAGS64 += -erroff=E_STATIC_UNUSED -erroff=E_FUNC_SET_NOT_USED
-LINTFLAGS64 += -erroff=E_STATIC_UNUSED -erroff=E_FUNC_ARG_UNUSED
-
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-address
diff --git a/usr/src/cmd/mdb/sparc/v9/srpt/Makefile b/usr/src/cmd/mdb/sparc/v9/srpt/Makefile
index 75448c947d..987cdbf5b4 100644
--- a/usr/src/cmd/mdb/sparc/v9/srpt/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/srpt/Makefile
@@ -40,4 +40,3 @@ include ../../../Makefile.module
CPPFLAGS += -I$(UTSBASE)/common -I$(UTSBASE)/common/sys -I$(SRPTBASE)
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
diff --git a/usr/src/cmd/mdb/sparc/v9/stmf_sbd/Makefile b/usr/src/cmd/mdb/sparc/v9/stmf_sbd/Makefile
index 7a15e833f6..d7fa4d8769 100644
--- a/usr/src/cmd/mdb/sparc/v9/stmf_sbd/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/stmf_sbd/Makefile
@@ -39,4 +39,3 @@ include ../../../Makefile.module
CPPFLAGS += -I$(UTSBASE)/common -I$(UTSBASE)/common/sys -I$(STMFSBDBASE)
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
diff --git a/usr/src/cmd/mdb/sparc/v9/zfs/Makefile b/usr/src/cmd/mdb/sparc/v9/zfs/Makefile
index e2407effa9..b105a86b4f 100644
--- a/usr/src/cmd/mdb/sparc/v9/zfs/Makefile
+++ b/usr/src/cmd/mdb/sparc/v9/zfs/Makefile
@@ -42,6 +42,5 @@ CPPFLAGS += -I../../../../../uts/common/fs/zfs/lua
CPPFLAGS += -I../../../../../common/zfs
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
CERRWARN += -_gcc=-Wno-type-limits
diff --git a/usr/src/cmd/od/Makefile b/usr/src/cmd/od/Makefile
index 6f449c96d1..62799f2962 100644
--- a/usr/src/cmd/od/Makefile
+++ b/usr/src/cmd/od/Makefile
@@ -12,6 +12,7 @@
#
# Copyright 2010 Nexenta Systems, Inc. All rights reserved.
#
+
PROG= od
XPG4PROG= $(PROG)
@@ -22,11 +23,9 @@ include ../Makefile.cmd
CLOBBERFILES= $(PROG)
-
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
+
CPPFLAGS += -D__EXTENSIONS__ -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
-LINTFLAGS += -D__EXTENSIONS__
# install rules
$(ROOTINC)/% : %
@@ -36,7 +35,7 @@ $(ROOTINC)/% : %
.PARALLEL: $(OBJS)
-all: $(PROG)
+all: $(PROG)
$(PROG): $(OBJS)
$(LINK.c) $(OBJS) -o $@ $(LDLIBS)
@@ -48,8 +47,6 @@ $(ROOTXPG4PROG):
-$(RM) $@
-$(LN) -s ../../bin/$(PROG) $@
-lint: lint_SRCS
-
clean:
$(RM) $(OBJS)
diff --git a/usr/src/cmd/sgs/common/string_table.c b/usr/src/cmd/sgs/common/string_table.c
index c15473150e..9cbf23e54b 100644
--- a/usr/src/cmd/sgs/common/string_table.c
+++ b/usr/src/cmd/sgs/common/string_table.c
@@ -227,12 +227,15 @@ st_insert(Str_tbl *stp, const char *str)
if ((lnp = avl_find(stp->st_lentree, &ln, &where)) == NULL) {
if ((lnp = calloc(sizeof (*lnp), 1)) == NULL)
return (-1);
- lnp->ln_strlen = len;
- avl_insert(stp->st_lentree, lnp, where);
if ((lnp->ln_strtree = calloc(sizeof (*lnp->ln_strtree), 1)) ==
- NULL)
- return (0);
+ NULL) {
+ free(lnp);
+ return (-1);
+ }
+
+ lnp->ln_strlen = len;
+ avl_insert(stp->st_lentree, lnp, where);
avl_create(lnp->ln_strtree, &avl_str_compare, sizeof (StrNode),
SGSOFFSETOF(StrNode, sn_avlnode));
@@ -337,10 +340,47 @@ st_destroy(Str_tbl *stp)
free(stp);
}
+/*
+ * Hash a single additional character into hashval, separately so we can
+ * iteratively get suffix hashes. See st_string_hash and st_hash_insert
+ */
+static inline uint_t
+st_string_hashround(uint_t hashval, char c)
+{
+ /* h = ((h * 33) + c) */
+ return (((hashval << 5) + hashval) + c);
+}
/*
- * For a given string - copy it into the buffer associated with
- * the string table - and return the offset it has been assigned.
+ * We use a classic 'Bernstein k=33' hash function. But
+ * instead of hashing from the start of the string to the
+ * end, we do it in reverse.
+ *
+ * This way we are essentially building all of the
+ * suffix hashvalues as we go. We can check to see if
+ * any suffixes already exist in the tree as we generate
+ * the hash.
+ */
+static inline uint_t
+st_string_hash(const char *str)
+{
+ uint_t hashval = HASHSEED;
+ size_t stlen = strlen(str);
+
+ /* We should never be hashing the NUL string */
+ assert(stlen > 0);
+
+ for (int i = stlen; i >= 0; i--) {
+ assert(i <= stlen); /* not unsigned->signed truncated */
+ hashval = st_string_hashround(hashval, str[i]);
+ }
+
+ return (hashval);
+}
+
+/*
+ * For a given string - copy it into the buffer associated with the string
+ * table - and return the offset it has been assigned in stoff.
*
* If a value of '-1' is returned - the string was not found in
* the Str_tbl.
@@ -352,12 +392,11 @@ st_setstring(Str_tbl *stp, const char *str, size_t *stoff)
uint_t hashval;
Str_hash *sthash;
Str_master *mstr;
- int i;
/*
* String table *must* have been previously cooked
*/
- assert(stp->st_strbuf);
+ assert(stp->st_strbuf != NULL);
assert(stp->st_flags & FLG_STTAB_COOKED);
stlen = strlen(str);
@@ -365,7 +404,8 @@ st_setstring(Str_tbl *stp, const char *str, size_t *stoff)
* Null string always points to head of string table
*/
if (stlen == 0) {
- *stoff = 0;
+ if (stoff != NULL)
+ *stoff = 0;
return (0);
}
@@ -380,7 +420,8 @@ st_setstring(Str_tbl *stp, const char *str, size_t *stoff)
if ((_stoff + stlen) > stp->st_fullstrsize)
return (-1);
memcpy(stp->st_strbuf + _stoff, str, stlen);
- *stoff = _stoff;
+ if (stoff != NULL)
+ *stoff = _stoff;
stp->st_nextoff += stlen;
return (0);
}
@@ -388,11 +429,7 @@ st_setstring(Str_tbl *stp, const char *str, size_t *stoff)
/*
* Calculate reverse hash for string.
*/
- hashval = HASHSEED;
- for (i = stlen; i >= 0; i--) {
- hashval = ((hashval << 5) + hashval) +
- str[i]; /* h = ((h * 33) + c) */
- }
+ hashval = st_string_hash(str);
for (sthash = stp->st_hashbcks[hashval % stp->st_hbckcnt]; sthash;
sthash = sthash->hi_next) {
@@ -436,12 +473,12 @@ st_setstring(Str_tbl *stp, const char *str, size_t *stoff)
/*
* Calculate offset of (sub)string.
*/
- *stoff = mstr->sm_stroff + mstr->sm_strlen - sthash->hi_strlen;
+ if (stoff != NULL)
+ *stoff = mstr->sm_stroff + mstr->sm_strlen - sthash->hi_strlen;
return (0);
}
-
static int
st_hash_insert(Str_tbl *stp, const char *str, size_t len)
{
@@ -452,19 +489,12 @@ st_hash_insert(Str_tbl *stp, const char *str, size_t len)
Str_hash *sthash;
Str_master *mstr = 0;
- /*
- * We use a classic 'Bernstein k=33' hash function. But
- * instead of hashing from the start of the string to the
- * end, we do it in reverse.
- *
- * This way - we are essentially building all of the
- * suffix hashvalues as we go. We can check to see if
- * any suffixes already exist in the tree as we generate
- * the hash.
- */
for (i = len; i >= 0; i--) {
- hashval = ((hashval << 5) + hashval) +
- str[i]; /* h = ((h * 33) + c) */
+ /*
+ * Build up 'hashval' character by character, so we always
+ * have the hash of the current string suffix
+ */
+ hashval = st_string_hashround(hashval, str[i]);
for (sthash = hashbcks[hashval % bckcnt];
sthash; sthash = sthash->hi_next) {
@@ -646,15 +676,16 @@ st_getstrtab_sz(Str_tbl *stp)
return (stp->st_strsize);
}
-/*
- * Associate a buffer with a string table.
- */
const char *
st_getstrbuf(Str_tbl *stp)
{
return (stp->st_strbuf);
}
+
+/*
+ * Associate a buffer with a string table.
+ */
int
st_setstrbuf(Str_tbl *stp, char *stbuf, size_t bufsize)
{
@@ -682,3 +713,87 @@ st_setstrbuf(Str_tbl *stp, char *stbuf, size_t bufsize)
#endif
return (0);
}
+
+/*
+ * Populate the buffer with all strings from stp.
+ * The table must be compressed and cooked
+ */
+void
+st_setallstrings(Str_tbl *stp)
+{
+ assert(stp->st_strbuf != NULL);
+ assert((stp->st_flags & FLG_STTAB_COOKED));
+ assert((stp->st_flags & FLG_STTAB_COMPRESS));
+
+ for (Str_master *str = stp->st_mstrlist; str != NULL;
+ str = str->sm_next) {
+ int res = 0;
+
+ res = st_setstring(stp, str->sm_str, NULL);
+ assert(res == 0);
+ }
+}
+
+/*
+ * Find str in the given table
+ * return it's offset, or -1
+ */
+off_t
+st_findstring(Str_tbl *stp, const char *needle)
+{
+ uint_t hashval;
+ Str_hash *sthash;
+ Str_master *mstr;
+
+ assert(stp->st_strbuf != NULL);
+ assert((stp->st_flags & FLG_STTAB_COOKED));
+
+ /* The NUL string is always first */
+ if (needle[0] == '\0')
+ return (0);
+
+ /* In the uncompressed case we must linear search */
+ if ((stp->st_flags & FLG_STTAB_COMPRESS) == 0) {
+ const char *str, *end;
+
+ end = stp->st_strbuf + stp->st_fullstrsize;
+
+ for (str = stp->st_strbuf; str < end;
+ str += strlen(str) + 1) {
+ if (strcmp(str, needle) == 0)
+ return (str - stp->st_strbuf);
+ }
+
+ return (-1);
+ }
+
+ hashval = st_string_hash(needle);
+
+ for (sthash = stp->st_hashbcks[hashval % stp->st_hbckcnt];
+ sthash != NULL;
+ sthash = sthash->hi_next) {
+ const char *hstr;
+
+ if (sthash->hi_hashval != hashval)
+ continue;
+
+ hstr = &sthash->hi_mstr->sm_str[sthash->hi_mstr->sm_strlen -
+ sthash->hi_strlen];
+ if (strcmp(needle, hstr) == 0)
+ break;
+ }
+
+ /*
+ * Did we find the string?
+ */
+ if (sthash == NULL)
+ return (-1);
+
+ mstr = sthash->hi_mstr;
+ assert(mstr->sm_stroff != 0);
+
+ /*
+ * Calculate offset of (sub)string.
+ */
+ return (mstr->sm_stroff + mstr->sm_strlen - sthash->hi_strlen);
+}
diff --git a/usr/src/cmd/sgs/include/libld.h b/usr/src/cmd/sgs/include/libld.h
index 11a73d949a..01734885f0 100644
--- a/usr/src/cmd/sgs/include/libld.h
+++ b/usr/src/cmd/sgs/include/libld.h
@@ -999,6 +999,9 @@ struct os_desc { /* Output section descriptor */
Xword os_szoutrels; /* size of output relocation section */
uint_t os_namehash; /* hash on section name */
uchar_t os_flags; /* various flags */
+ APlist *os_mstrsyms; /* symbols affected by string merge */
+ APlist *os_mstrrels; /* section relocs affected by... */
+ Str_tbl *os_mstrtab; /* merged string table */
};
#define FLG_OS_KEY 0x01 /* section requires sort keys */
diff --git a/usr/src/cmd/sgs/include/string_table.h b/usr/src/cmd/sgs/include/string_table.h
index e42f81779f..951df25c6f 100644
--- a/usr/src/cmd/sgs/include/string_table.h
+++ b/usr/src/cmd/sgs/include/string_table.h
@@ -26,8 +26,6 @@
#ifndef _STRING_TABLE_DOT_H
#define _STRING_TABLE_DOT_H
-#pragma ident "%Z%%M% %I% %E% SMI"
-
#include <sys/types.h>
#ifdef __cplusplus
@@ -50,6 +48,8 @@ extern int st_insert(Str_tbl *, const char *);
extern Str_tbl *st_new(uint_t);
extern int st_setstrbuf(Str_tbl *, char *, size_t);
extern int st_setstring(Str_tbl *, const char *, size_t *);
+extern void st_setallstrings(Str_tbl *);
+extern off_t st_findstring(Str_tbl *, const char *);
/*
* Exported flags values for st_new().
diff --git a/usr/src/cmd/sgs/libld/common/sections.c b/usr/src/cmd/sgs/libld/common/sections.c
index 22b2655105..ec147c69b1 100644
--- a/usr/src/cmd/sgs/libld/common/sections.c
+++ b/usr/src/cmd/sgs/libld/common/sections.c
@@ -32,6 +32,8 @@
#define ELF_TARGET_AMD64
+#include <sys/debug.h>
+
#include <string.h>
#include <strings.h>
#include <stdio.h>
@@ -2742,47 +2744,48 @@ strmerge_get_reloc_str(Ofl_desc *ofl, Rel_desc *rsp)
/*
* First pass over the relocation records for string table merging.
* Build lists of relocations and symbols that will need modification,
- * and insert the strings they reference into the mstrtab string table.
+ * and insert the strings they reference into the output string table.
*
* entry:
- * ofl, osp - As passed to ld_make_strmerge().
- * mstrtab - String table to receive input strings. This table
- * must be in its first (initialization) pass and not
- * yet cooked (st_getstrtab_sz() not yet called).
- * rel_alpp - APlist to receive pointer to any relocation
- * descriptors with STT_SECTION symbols that reference
- * one of the input sections being merged.
- * sym_alpp - APlist to receive pointer to any symbols that reference
- * one of the input sections being merged.
- * rcp - Pointer to cache of relocation descriptors to examine.
- * Either &ofl->ofl_actrels (active relocations)
- * or &ofl->ofl_outrels (output relocations).
+ * ofl - Output file descriptor
*
- * exit:
- * On success, rel_alpp and sym_alpp are updated, and
- * any strings in the mergeable input sections referenced by
- * a relocation has been entered into mstrtab. True (1) is returned.
+ * exit: On success, the string merging specific members of each output
+ * section descriptor in ofl are updated based on information from the
+ * relocation entries, and 0 is returned.
*
- * On failure, False (0) is returned.
+ * On error, S_ERROR is returned.
*/
-static int
-strmerge_pass1(Ofl_desc *ofl, Os_desc *osp, Str_tbl *mstrtab,
- APlist **rel_alpp, APlist **sym_alpp, Rel_cache *rcp)
+static uintptr_t
+ld_gather_strmerge(Ofl_desc *ofl, Rel_cache *cache)
{
- Aliste idx;
- Rel_cachebuf *rcbp;
- Sym_desc *sdp;
- Sym_desc *last_sdp = NULL;
- Rel_desc *rsp;
- const char *name;
+ Rel_cachebuf *rbcp;
+ Rel_desc *rsp;
+ Sym_desc *last_sdp = NULL;
+ Aliste idx1;
- REL_CACHE_TRAVERSE(rcp, idx, rcbp, rsp) {
- sdp = rsp->rel_sym;
+ /*
+ * Pass 1:
+ *
+ * Build lists of relocations and symbols that will need
+ * modification, and insert the strings they reference into
+ * the output string table.
+ */
+ REL_CACHE_TRAVERSE(cache, idx1, rbcp, rsp) {
+ Sym_desc *sdp = rsp->rel_sym;
+ Os_desc *osp;
+ const char *name;
+
+ /*
+ * If there's no input section, or the input section is
+ * discarded or does not contain mergable strings, we have
+ * nothing to do.
+ */
if ((sdp->sd_isc == NULL) || ((sdp->sd_isc->is_flags &
- (FLG_IS_DISCARD | FLG_IS_INSTRMRG)) != FLG_IS_INSTRMRG) ||
- (sdp->sd_isc->is_osdesc != osp))
+ (FLG_IS_DISCARD | FLG_IS_INSTRMRG)) != FLG_IS_INSTRMRG))
continue;
+ osp = sdp->sd_isc->is_osdesc;
+
/*
* Remember symbol for use in the third pass. There is no
* reason to save a given symbol more than once, so we take
@@ -2791,78 +2794,108 @@ strmerge_pass1(Ofl_desc *ofl, Os_desc *osp, Str_tbl *mstrtab,
* we saved last time, don't bother.
*/
if (last_sdp != sdp) {
- if (aplist_append(sym_alpp, sdp, AL_CNT_STRMRGSYM) ==
- NULL)
- return (0);
+ if (aplist_append(&osp->os_mstrsyms, sdp,
+ AL_CNT_STRMRGSYM) == NULL)
+ return (S_ERROR);
last_sdp = sdp;
}
+ if ((osp->os_mstrtab == NULL) &&
+ (osp->os_mstrtab = st_new(FLG_STNEW_COMPRESS)) == NULL)
+ return (S_ERROR);
+
/* Enter the string into our new string table */
name = strmerge_get_reloc_str(ofl, rsp);
- if (st_insert(mstrtab, name) == -1)
- return (0);
+ if (st_insert(osp->os_mstrtab, name) == -1)
+ return (S_ERROR);
/*
* If this is an STT_SECTION symbol, then the second pass
* will need to modify this relocation, so hang on to it.
*/
if ((ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION) &&
- (aplist_append(rel_alpp, rsp, AL_CNT_STRMRGREL) == NULL))
- return (0);
+ (aplist_append(&osp->os_mstrrels, rsp,
+ AL_CNT_STRMRGREL) == NULL)) {
+ return (S_ERROR);
+ }
}
- return (1);
+ return (0);
}
/*
- * If the output section has any SHF_MERGE|SHF_STRINGS input sections,
- * replace them with a single merged/compressed input section.
+ * If any an output section has more than one SHF_MERGE|SHF_STRINGS input
+ * section, replace them with a single merged/compressed input section.
+ *
+ * This is done by making a Str_tbl (as we use for managing SHT_STRTAB
+ * sections) per output section with compression enabled to manage all strings
+ * in the mergeable input sections. We then discard all inputs which
+ * contributed to this table and replace them with an input section we create
+ * taking data from this Str_tbl. References to the now discarded sections
+ * are then updated to refer to our new merged input section, and the string
+ * table and other metadata are freed.
+ *
+ * This process is done in 3 passes. For efficiency reasons half of pass 1 is
+ * done by ld_strmerge_gather() so relocations only need to be processed once.
+ * Steps 1.5 onward are performed here. The steps are:
+ *
+ * 1) In ld_strmerge_gather() examine all relocations, insert strings
+ * from relocations to the mergeable input sections into the string
+ * table.
+ * 1.5) Gather every string from the mergeable input sections, regardless
+ * of whether it is referenced from a relocation. All strings
+ * must be processed, and relocations may point into the middle
+ * of an actual NUL-terminated string, so we must enter both the
+ * precise strings referenced by relocations and full strings
+ * within the section.
+ * 2) Modify the relocation values to be correct for the
+ * new merged section.
+ * 3) Modify the symbols used by the relocations to reference
+ * the new section.
+ *
+ * These passes cannot be combined:
+ * - The string table code works in two passes, and all
+ * strings have to be loaded in pass one before the
+ * offset of any strings can be determined.
+ * - Multiple relocations reference a single symbol, so the
+ * symbol cannot be modified until all relocations are
+ * fixed.
*
* entry:
* ofl - Output file descriptor
- * osp - Output section descriptor
- * rel_alpp, sym_alpp, - Address of 2 APlists, to be used
- * for internal processing. On the initial call to
- * ld_make_strmerge, these list pointers must be NULL.
- * The caller is encouraged to pass the same lists back for
- * successive calls to this function without freeing
- * them in between calls. This causes a single pair of
- * memory allocations to be reused multiple times.
+ * osp - Outputs section descriptor
*
* exit:
- * If section merging is possible, it is done. If no errors are
- * encountered, True (1) is returned. On error, S_ERROR.
+ * If section merging is possible for this output section, it is done.
+ * If no errors are encountered, 0 is returned. On error, S_ERROR is
+ * returned.
*
- * The contents of rel_alpp and sym_alpp on exit are
- * undefined. The caller can free them, or pass them back to a subsequent
- * call to this routine, but should not examine their contents.
+ * The contents of the string-merging specific members of this output
+ * section descriptor are undefined after this function returns.
*/
static uintptr_t
-ld_make_strmerge(Ofl_desc *ofl, Os_desc *osp, APlist **rel_alpp,
- APlist **sym_alpp)
+ld_strmerge_sec(Ofl_desc *ofl, Os_desc *osp)
{
- Str_tbl *mstrtab; /* string table for string merge secs */
- Is_desc *mstrsec; /* Generated string merge section */
- Is_desc *isp;
- Shdr *mstr_shdr;
- Elf_Data *mstr_data;
+ Is_desc *isp = NULL;
Sym_desc *sdp;
Rel_desc *rsp;
- Aliste idx;
+ Is_desc *mstrsec = NULL; /* Generated string merge section */
+ Shdr *mstr_shdr = NULL;
+ Elf_Data *mstr_data = NULL;
size_t data_size;
- int st_setstring_status;
- size_t stoff;
-
- /* If string table compression is disabled, there's nothing to do */
- if ((ofl->ofl_flags1 & FLG_OF1_NCSTTAB) != 0)
- return (1);
+ Aliste idx;
+ uintptr_t ret = 0;
+ Boolean placed = FALSE;
/*
- * Pass over the mergeable input sections, and if they haven't
- * all been discarded, create a string table.
+ * Pass 1.5: Add all strings from all mergeable input sections.
+ *
+ * The last section we find also serves as the template for our
+ * replacement merged section, providing the section attributes, etc.
*/
- mstrtab = NULL;
for (APLIST_TRAVERSE(osp->os_mstrisdescs, idx, isp)) {
+ const char *str, *end;
+
if (isdesc_discarded(isp))
continue;
@@ -2873,93 +2906,66 @@ ld_make_strmerge(Ofl_desc *ofl, Os_desc *osp, APlist **rel_alpp,
if (isp->is_shdr->sh_size == 0)
continue;
- /*
- * We have at least one non-discarded section.
- * Create a string table descriptor.
- */
- if ((mstrtab = st_new(FLG_STNEW_COMPRESS)) == NULL)
- return (S_ERROR);
- break;
- }
-
- /* If no string table was created, we have no mergeable sections */
- if (mstrtab == NULL)
- return (1);
+ if ((osp->os_mstrtab == NULL) &&
+ (osp->os_mstrtab = st_new(FLG_STNEW_COMPRESS)) == NULL) {
+ ret = S_ERROR;
+ goto out;
+ }
- /*
- * This routine has to make 3 passes:
- *
- * 1) Examine all relocations, insert strings from relocations
- * to the mergeable input sections into the string table.
- * 2) Modify the relocation values to be correct for the
- * new merged section.
- * 3) Modify the symbols used by the relocations to reference
- * the new section.
- *
- * These passes cannot be combined:
- * - The string table code works in two passes, and all
- * strings have to be loaded in pass one before the
- * offset of any strings can be determined.
- * - Multiple relocations reference a single symbol, so the
- * symbol cannot be modified until all relocations are
- * fixed.
- *
- * The number of relocations related to section merging is usually
- * a mere fraction of the overall active and output relocation lists,
- * and the number of symbols is usually a fraction of the number
- * of related relocations. We therefore build APlists for the
- * relocations and symbols in the first pass, and then use those
- * lists to accelerate the operation of pass 2 and 3.
- *
- * Reinitialize the lists to a completely empty state.
- */
- aplist_reset(*rel_alpp);
- aplist_reset(*sym_alpp);
+ end = isp->is_indata->d_buf + isp->is_indata->d_size;
+ for (str = isp->is_indata->d_buf; str < end;
+ str += strlen(str) + 1) {
+ if (st_insert(osp->os_mstrtab, str) != 0) {
+ ret = S_ERROR;
+ goto out;
+ }
+ }
+ }
- /*
- * Pass 1:
- *
- * Every relocation related to this output section (and the input
- * sections that make it up) is found in either the active, or the
- * output relocation list, depending on whether the relocation is to
- * be processed by this invocation of the linker, or inserted into the
- * output object.
- *
- * Build lists of relocations and symbols that will need modification,
- * and insert the strings they reference into the mstrtab string table.
- */
- if (strmerge_pass1(ofl, osp, mstrtab, rel_alpp, sym_alpp,
- &ofl->ofl_actrels) == 0)
- goto return_s_error;
- if (strmerge_pass1(ofl, osp, mstrtab, rel_alpp, sym_alpp,
- &ofl->ofl_outrels) == 0)
- goto return_s_error;
+ IMPLY(osp->os_mstrtab != NULL, isp != NULL);
+ if (osp->os_mstrtab == NULL) {
+ ret = 0;
+ goto out;
+ }
/*
- * Get the size of the new input section. Requesting the
- * string table size "cooks" the table, and finalizes its contents.
+ * Get the size of the new input section. Requesting the string
+ * table size "cooks" the table, and finalizes its contents.
*/
- data_size = st_getstrtab_sz(mstrtab);
+ data_size = st_getstrtab_sz(osp->os_mstrtab);
/* Create a new input section to hold the merged strings */
if (new_section_from_template(ofl, isp, data_size,
- &mstrsec, &mstr_shdr, &mstr_data) == S_ERROR)
- goto return_s_error;
+ &mstrsec, &mstr_shdr, &mstr_data) == S_ERROR) {
+ ret = S_ERROR;
+ goto out;
+ }
mstrsec->is_flags |= FLG_IS_GNSTRMRG;
/*
- * Allocate a data buffer for the new input section.
- * Then, associate the buffer with the string table descriptor.
+ * Allocate a data buffer for the new input section, associate the
+ * buffer with the string table descriptor, and fill it from the
+ * string table.
*/
- if ((mstr_data->d_buf = libld_malloc(data_size)) == NULL)
- goto return_s_error;
- if (st_setstrbuf(mstrtab, mstr_data->d_buf, data_size) == -1)
- goto return_s_error;
+ if ((mstr_data->d_buf = libld_malloc(data_size)) == NULL) {
+ ret = S_ERROR;
+ goto out;
+ }
+ if ((st_setstrbuf(osp->os_mstrtab, mstr_data->d_buf,
+ data_size) == -1)) {
+ ret = S_ERROR;
+ goto out;
+ }
+
+ st_setallstrings(osp->os_mstrtab);
/* Add the new section to the output image */
if (ld_place_section(ofl, mstrsec, NULL, osp->os_identndx, NULL) ==
- (Os_desc *)S_ERROR)
- goto return_s_error;
+ (Os_desc *)S_ERROR) {
+ ret = S_ERROR;
+ goto out;
+ }
+ placed = TRUE;
/*
* Pass 2:
@@ -2969,20 +2975,17 @@ ld_make_strmerge(Ofl_desc *ofl, Os_desc *osp, APlist **rel_alpp,
* record so that the offset it contains is for the new section
* instead of the original.
*/
- for (APLIST_TRAVERSE(*rel_alpp, idx, rsp)) {
+ for (APLIST_TRAVERSE(osp->os_mstrrels, idx, rsp)) {
const char *name;
+ size_t stoff;
- /* Put the string into the merged string table */
+ /*
+ * Find the string to the merged table's buffer and get its
+ * offset.
+ */
name = strmerge_get_reloc_str(ofl, rsp);
- st_setstring_status = st_setstring(mstrtab, name, &stoff);
- if (st_setstring_status == -1) {
- /*
- * A failure to insert at this point means that
- * something is corrupt. This isn't a resource issue.
- */
- assert(st_setstring_status != -1);
- goto return_s_error;
- }
+ stoff = st_findstring(osp->os_mstrtab, name);
+ VERIFY3S(stoff, !=, -1);
/*
* Alter the relocation to access the string at the
@@ -3002,18 +3005,23 @@ ld_make_strmerge(Ofl_desc *ofl, Os_desc *osp, APlist **rel_alpp,
* ld_do_activerelocs(). The FLG_REL_NADDEND flag
* tells them that this is the case.
*/
- if ((rsp->rel_flags & FLG_REL_RELA) == 0) /* REL */
+ if ((rsp->rel_flags & FLG_REL_RELA) == 0) {
+ /* REL */
rsp->rel_flags |= FLG_REL_NADDEND;
+ }
rsp->rel_raddend = (Sxword)stoff;
/*
* Generate a symbol name string for STT_SECTION symbols
* that might reference our merged section. This shows up
* in debug output and helps show how the relocation has
- * changed from its original input section to our merged one.
+ * changed from its original input section to our merged
+ * one.
*/
- if (ld_stt_section_sym_name(mstrsec) == NULL)
- goto return_s_error;
+ if (ld_stt_section_sym_name(mstrsec) == NULL) {
+ ret = S_ERROR;
+ goto out;
+ }
}
/*
@@ -3023,13 +3031,13 @@ ld_make_strmerge(Ofl_desc *ofl, Os_desc *osp, APlist **rel_alpp,
* so that they reference the new input section containing the
* merged strings instead of the original input sections.
*/
- for (APLIST_TRAVERSE(*sym_alpp, idx, sdp)) {
+ for (APLIST_TRAVERSE(osp->os_mstrsyms, idx, sdp)) {
/*
- * If we've already processed this symbol, don't do it
- * twice. strmerge_pass1() uses a heuristic (relocations to
- * the same symbol clump together) to avoid inserting a
- * given symbol more than once, but repeat symbols in
- * the list can occur.
+ * If we've already redirected this symbol to the merged data,
+ * don't do it again. ld_gather_strmerge() uses a heuristic
+ * (relocations to the same symbol clump together) to avoid
+ * inserting a given symbol more than once, but repeat symbols
+ * in the list can occur.
*/
if ((sdp->sd_isc->is_flags & FLG_IS_INSTRMRG) == 0)
continue;
@@ -3041,23 +3049,22 @@ ld_make_strmerge(Ofl_desc *ofl, Os_desc *osp, APlist **rel_alpp,
* input section. Update the address to reflect
* the address in our new merged section.
*/
- const char *name = sdp->sd_sym->st_value +
+ const char *name;
+ size_t stoff;
+
+ /*
+ * Find the string in the merged table's buffer and get
+ * its offset.
+ */
+ name = sdp->sd_sym->st_value +
(char *)sdp->sd_isc->is_indata->d_buf;
+ stoff = st_findstring(osp->os_mstrtab, name);
+ VERIFY3S(stoff, !=, -1);
- st_setstring_status =
- st_setstring(mstrtab, name, &stoff);
- if (st_setstring_status == -1) {
- /*
- * A failure to insert at this point means
- * something is corrupt. This isn't a
- * resource issue.
- */
- assert(st_setstring_status != -1);
- goto return_s_error;
+ if (ld_sym_copy(sdp) == S_ERROR) {
+ ret = S_ERROR;
+ goto out;
}
-
- if (ld_sym_copy(sdp) == S_ERROR)
- goto return_s_error;
sdp->sd_sym->st_value = (Word)stoff;
}
@@ -3085,12 +3092,64 @@ ld_make_strmerge(Ofl_desc *ofl, Os_desc *osp, APlist **rel_alpp,
DBG_CALL(Dbg_sec_genstr_compress(ofl->ofl_lml, osp->os_name, data_size,
mstr_data->d_size));
- st_destroy(mstrtab);
- return (1);
+out:
+ if ((ret == S_ERROR) && !placed) {
+ libld_free(mstrsec);
+ if (mstr_data != NULL)
+ libld_free(mstr_data->d_buf);
+ libld_free(mstr_data);
+ libld_free(mstr_shdr);
+ }
+
+ libld_free(osp->os_mstrsyms);
+ osp->os_mstrsyms = NULL;
+ libld_free(osp->os_mstrrels);
+ osp->os_mstrrels = NULL;
+
+ if (osp->os_mstrtab != NULL) {
+ st_destroy(osp->os_mstrtab);
+ osp->os_mstrtab = NULL;
+ }
+
+ return (ret);
+}
+
+/*
+ * If any output section has SHF_MERGE|SHF_STRINGS input sections,
+ * replace them with a single merged/compressed input section.
+ *
+ * entry:
+ * ofl - Output file descriptor
+ *
+ * exit:
+ * If section merging is possible, it is done. If no errors are
+ * encountered, 0 is returned. On error, S_ERROR is returned.
+ *
+ * The contents of the string-merging specific members of any output
+ * section descriptor are undefined after this function returns.
+ */
+static uintptr_t
+ld_make_strmerge(Ofl_desc *ofl)
+{
+ Sg_desc *sgp;
+ Aliste idx1;
+
+ if (ld_gather_strmerge(ofl, &ofl->ofl_actrels) == S_ERROR)
+ return (S_ERROR);
+ if (ld_gather_strmerge(ofl, &ofl->ofl_outrels) == S_ERROR)
+ return (S_ERROR);
-return_s_error:
- st_destroy(mstrtab);
- return (S_ERROR);
+ for (APLIST_TRAVERSE(ofl->ofl_segs, idx1, sgp)) {
+ Os_desc *osp;
+ Aliste idx2;
+
+ for (APLIST_TRAVERSE(sgp->sg_osdescs, idx2, osp)) {
+ if (ld_strmerge_sec(ofl, osp) == S_ERROR)
+ return (S_ERROR);
+ }
+ }
+
+ return (0);
}
/*
@@ -3197,29 +3256,7 @@ ld_make_sections(Ofl_desc *ofl)
* for this processing, for all the output sections.
*/
if ((ofl->ofl_flags1 & FLG_OF1_NCSTTAB) == 0) {
- int error_seen = 0;
- APlist *rel_alpp = NULL;
- APlist *sym_alpp = NULL;
- Aliste idx1;
-
- for (APLIST_TRAVERSE(ofl->ofl_segs, idx1, sgp)) {
- Os_desc *osp;
- Aliste idx2;
-
- for (APLIST_TRAVERSE(sgp->sg_osdescs, idx2, osp))
- if ((osp->os_mstrisdescs != NULL) &&
- (ld_make_strmerge(ofl, osp,
- &rel_alpp, &sym_alpp) ==
- S_ERROR)) {
- error_seen = 1;
- break;
- }
- }
- if (rel_alpp != NULL)
- libld_free(rel_alpp);
- if (sym_alpp != NULL)
- libld_free(sym_alpp);
- if (error_seen != 0)
+ if (ld_make_strmerge(ofl) == S_ERROR)
return (S_ERROR);
}
diff --git a/usr/src/cmd/sgs/tools/SUNWonld-README b/usr/src/cmd/sgs/tools/SUNWonld-README
index c0f2b139d1..da5af4dba8 100644
--- a/usr/src/cmd/sgs/tools/SUNWonld-README
+++ b/usr/src/cmd/sgs/tools/SUNWonld-README
@@ -1677,3 +1677,5 @@ Bugid Risk Synopsis
14090 backout: turns over big rocks, discovers big bugs
14152 ld(1) should be more careful about empty alists
14127 ld(1) can double free when cleaning up
+14155 ld(1) string table merging could be much faster
+14157 ld(1) string table merging should follow gABI more closely
diff --git a/usr/src/cmd/smbsrv/Makefile.smbsrv.defs b/usr/src/cmd/smbsrv/Makefile.smbsrv.defs
index 050a8e6255..f6da533cfc 100644
--- a/usr/src/cmd/smbsrv/Makefile.smbsrv.defs
+++ b/usr/src/cmd/smbsrv/Makefile.smbsrv.defs
@@ -29,10 +29,7 @@
OBJS= $(SRCS:%.c=%.o)
-LINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
-
CFLAGS += $(CCVERBOSE)
$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
CSTD = $(CSTD_GNU99)
-C99LMODE = -Xc99=%all
diff --git a/usr/src/cmd/smbsrv/fksmbd/Makefile b/usr/src/cmd/smbsrv/fksmbd/Makefile
index 61b8758011..b6ba5d1938 100644
--- a/usr/src/cmd/smbsrv/fksmbd/Makefile
+++ b/usr/src/cmd/smbsrv/fksmbd/Makefile
@@ -67,7 +67,6 @@ INCS += -I../../../common/smbsrv
INCS += -I $(ROOT)/usr/include/kerberosv5
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
CFLAGS += $(CCVERBOSE)
CFLAGS64 += $(CCVERBOSE)
@@ -88,11 +87,6 @@ LDLIBS += -lmlsvc -lmlrpc -lsmbns -lsmb -lsmbfs -lgss
LDLIBS += -lzfs -lbsm -lscf -lcmdutils -lsocket -lnsl -lumem
$(PROG) := LDLIBS += -lkrb5
-LINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
-LINTFLAGS += -xerroff=E_NAME_USED_NOT_DEF2
-LINTFLAGS += -xerroff=E_INCONS_ARG_DECL2
-LINTFLAGS += -xerroff=E_INCONS_VAL_TYPE_DECL2
-
ROOTSMBDDIR = $(ROOTLIB)/smbsrv
ROOTSMBDFILE = $(PROG:%=$(ROOTSMBDDIR)/%)
@@ -107,8 +101,6 @@ $(PROG): $(OBJS)
clean:
-$(RM) $(OBJS)
-lint: lint_SRCS
-
include ../../Makefile.targ
install: all $(ROOTSMBDFILE)
diff --git a/usr/src/cmd/smbsrv/smbd/Makefile b/usr/src/cmd/smbsrv/smbd/Makefile
index 32585574e3..cd351db2e3 100644
--- a/usr/src/cmd/smbsrv/smbd/Makefile
+++ b/usr/src/cmd/smbsrv/smbd/Makefile
@@ -59,9 +59,6 @@ $(ROOTMANIFEST):= FILEMODE = 0444
$(ROOTSVCMETHOD):= FILEMODE = 0555
$(ROOTVARSMBDLL):= FILEMODE = 0755
-LINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
-LINTFLAGS += -xerroff=E_NAME_USED_NOT_DEF2
-
CFLAGS += $(CCVERBOSE)
CPPFLAGS += -D_IPP_PRIVATE_STRUCTURES
CPPFLAGS += -D_REENTRANT
@@ -75,7 +72,6 @@ CPPFLAGS += -I $(ROOT)/usr/include/kerberosv5
SMOFF += all_func_returns,deref_check
CSTD = $(CSTD_GNU99)
-C99LMODE = -Xc99=%all
LDFLAGS += -R/usr/lib/smbsrv
LDLIBS += -L$(ROOT)/usr/lib/smbsrv
@@ -103,8 +99,6 @@ all: $(PROG)
clean:
$(RM) $(OBJS)
-lint: lint_SRCS
-
$(PROG): $(OBJS)
$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
$(POST_PROCESS)
diff --git a/usr/src/cmd/smbsrv/test-msgbuf/Makefile b/usr/src/cmd/smbsrv/test-msgbuf/Makefile
index 96ab0292d1..04496a42ed 100644
--- a/usr/src/cmd/smbsrv/test-msgbuf/Makefile
+++ b/usr/src/cmd/smbsrv/test-msgbuf/Makefile
@@ -52,7 +52,6 @@ INCS += -I../../../uts/common/smbsrv
INCS += -I../../../common/smbsrv
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
CFLAGS += $(CCVERBOSE)
CFLAGS64 += $(CCVERBOSE)
@@ -71,11 +70,6 @@ LDFLAGS += $(ZNOLAZYLOAD)
LDFLAGS += '-R$$ORIGIN/..'
LDLIBS += -lfakekernel -lcmdutils
-LINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
-LINTFLAGS += -xerroff=E_NAME_USED_NOT_DEF2
-LINTFLAGS += -xerroff=E_INCONS_ARG_DECL2
-LINTFLAGS += -xerroff=E_INCONS_VAL_TYPE_DECL2
-
ROOTSMBDDIR = $(ROOTLIB)/smbsrv
ROOTSMBDFILE = $(PROG:%=$(ROOTSMBDDIR)/%)
@@ -90,8 +84,6 @@ $(PROG): $(OBJS)
clean:
-$(RM) $(OBJS)
-lint: # lint_SRCS
-
include ../../Makefile.targ
install: all $(ROOTSMBDFILE)
diff --git a/usr/src/cmd/tail/Makefile b/usr/src/cmd/tail/Makefile
index 7afc25b187..c93a9d32b9 100644
--- a/usr/src/cmd/tail/Makefile
+++ b/usr/src/cmd/tail/Makefile
@@ -28,8 +28,6 @@ CLOBBERFILES= $(PROG)
CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
-LINTFLAGS += -I. -erroff=E_CONSTANT_CONDITION
SMOFF += leaks
@@ -57,8 +55,6 @@ $(ROOTXPG4PROG):
-$(RM) $@
-$(LN) -s ../../bin/$(PROG) $@
-lint: lint_SRCS
-
clean:
$(RM) $(OBJS)
diff --git a/usr/src/cmd/tr/Makefile b/usr/src/cmd/tr/Makefile
index 0da9ab2094..26bbcca052 100644
--- a/usr/src/cmd/tr/Makefile
+++ b/usr/src/cmd/tr/Makefile
@@ -27,9 +27,7 @@ CLOBBERFILES= $(PROG)
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
CPPFLAGS += -D_ILLUMOS_PRIVATE -I.
-LINTFLAGS += -D_ILLUMOS_PRIVATE -I.
# install rules
$(ROOTINC)/% : %
@@ -51,8 +49,6 @@ $(ROOTXPG4PROG) $(ROOTXPG6PROG):
-$(RM) $@
-$(LN) -s ../../bin/$(PROG) $@
-lint: lint_SRCS
-
clean:
$(RM) $(OBJS)
diff --git a/usr/src/cmd/vscan/vscanadm/Makefile b/usr/src/cmd/vscan/vscanadm/Makefile
index f27f4a22e4..5cf9fb1e78 100755
--- a/usr/src/cmd/vscan/vscanadm/Makefile
+++ b/usr/src/cmd/vscan/vscanadm/Makefile
@@ -34,7 +34,6 @@ LDFLAGS += -R/usr/lib/vscan
CFLAGS += $(CCVERBOSE)
CSTD = $(CSTD_GNU99)
-C99LMODE = -Xc99=%all
.KEEP_STATE:
@@ -43,8 +42,6 @@ all: $(PROG)
clean:
$(RM) $(OBJS)
-lint: lint_SRCS
-
$(PROG): $(OBJS)
$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
$(POST_PROCESS)
diff --git a/usr/src/cmd/vscan/vscand/Makefile b/usr/src/cmd/vscan/vscand/Makefile
index 6b4e85550d..4446ed400e 100644
--- a/usr/src/cmd/vscan/vscand/Makefile
+++ b/usr/src/cmd/vscan/vscand/Makefile
@@ -50,9 +50,7 @@ CERRWARN += -_gcc=-Wno-switch
# not linted
SMATCH=off
-LINTFLAGS += -mu
CSTD = $(CSTD_GNU99)
-C99LMODE = -Xc99=%all
MANIFEST = vscan.xml
ROOTMANIFESTDIR= $(ROOTSVCSYSTEM)/filesystem
@@ -76,8 +74,6 @@ all: $(PROG)
clean:
$(RM) $(OBJS)
-lint: lint_SRCS
-
$(PROG): $(OBJS)
$(LINK.c) -o $@ $(OBJS) $(LDLIBS)
$(POST_PROCESS)
diff --git a/usr/src/cmd/zstreamdump/Makefile b/usr/src/cmd/zstreamdump/Makefile
index 92d7ed4da3..2019ccc031 100644
--- a/usr/src/cmd/zstreamdump/Makefile
+++ b/usr/src/cmd/zstreamdump/Makefile
@@ -37,15 +37,10 @@ INCS += -I../../common/zfs
LDLIBS += -lzfs -lnvpair
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT $(INCS)
$(NOT_RELEASE_BUILD)CPPFLAGS += -DDEBUG
-# lint complains about unused _umem_* functions
-LINTFLAGS += -xerroff=E_NAME_DEF_NOT_USED2
-LINTFLAGS64 += -xerroff=E_NAME_DEF_NOT_USED2
-
CERRWARN += -_gcc=-Wno-switch
# not linted
@@ -66,8 +61,6 @@ install: all $(ROOTUSRSBINPROG)
clean:
$(RM) $(OBJS)
-lint: lint_SRCS
-
FRC:
include ../Makefile.targ
diff --git a/usr/src/lib/libidspace/Makefile b/usr/src/lib/libidspace/Makefile
index 44640eeddc..feeca43d3a 100644
--- a/usr/src/lib/libidspace/Makefile
+++ b/usr/src/lib/libidspace/Makefile
@@ -18,18 +18,17 @@ include ../Makefile.lib
HDRS = libidspace.h
HDRDIR = common
-SUBDIRS = $(MACH)
+SUBDIRS = $(MACH)
$(BUILD64)SUBDIRS += $(MACH64)
all := TARGET = all
clean := TARGET = clean
clobber := TARGET = clobber
install := TARGET = install
-lint := TARGET = lint
.KEEP_STATE:
-all clean clobber install lint: $(SUBDIRS)
+all clean clobber install: $(SUBDIRS)
install: install_h $(SUBDIRS)
diff --git a/usr/src/lib/libidspace/Makefile.com b/usr/src/lib/libidspace/Makefile.com
index ef259c3d2f..8a0f0c402e 100644
--- a/usr/src/lib/libidspace/Makefile.com
+++ b/usr/src/lib/libidspace/Makefile.com
@@ -25,7 +25,7 @@ SRCDIR = ../common
SRCS = ../../../common/idspace/id_space.c
LIBS = $(DYNLIB)
-LDLIBS += -lumem
+LDLIBS += -lumem
.KEEP_STATE:
diff --git a/usr/src/lib/libidspace/amd64/Makefile b/usr/src/lib/libidspace/amd64/Makefile
index 15d904c616..e03ee6aac6 100644
--- a/usr/src/lib/libidspace/amd64/Makefile
+++ b/usr/src/lib/libidspace/amd64/Makefile
@@ -16,4 +16,4 @@
include ../Makefile.com
include ../../Makefile.lib.64
-install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64)
+install: all $(ROOTLIBS64) $(ROOTLINKS64)
diff --git a/usr/src/lib/libidspace/common/llib-lidspace b/usr/src/lib/libidspace/common/llib-lidspace
deleted file mode 100644
index 39c628da47..0000000000
--- a/usr/src/lib/libidspace/common/llib-lidspace
+++ /dev/null
@@ -1,19 +0,0 @@
-/*
- * This file and its contents are supplied under the terms of the
- * Common Development and Distribution License ("CDDL"), version 1.0.
- * You may only use this file in accordance with the terms of version
- * 1.0 of the CDDL.
- *
- * A full copy of the text of the CDDL should have accompanied this
- * source. A copy of the CDDL is also available via the Internet at
- * http://www.illumos.org/license/CDDL.
- */
-
-/*
- * Copyright (c) 2014 Joyent, Inc. All rights reserved.
- */
-
-/* LINTLIBRARY */
-/* PROTOLIB1 */
-
-#include <libidspace.h>
diff --git a/usr/src/lib/libidspace/i386/Makefile b/usr/src/lib/libidspace/i386/Makefile
index 41e699e8f8..73fc6a2070 100644
--- a/usr/src/lib/libidspace/i386/Makefile
+++ b/usr/src/lib/libidspace/i386/Makefile
@@ -15,4 +15,4 @@
include ../Makefile.com
-install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
+install: all $(ROOTLIBS) $(ROOTLINKS)
diff --git a/usr/src/lib/libidspace/sparc/Makefile b/usr/src/lib/libidspace/sparc/Makefile
deleted file mode 100644
index 41e699e8f8..0000000000
--- a/usr/src/lib/libidspace/sparc/Makefile
+++ /dev/null
@@ -1,18 +0,0 @@
-#
-# This file and its contents are supplied under the terms of the
-# Common Development and Distribution License ("CDDL"), version 1.0.
-# You may only use this file in accordance with the terms of version
-# 1.0 of the CDDL.
-#
-# A full copy of the text of the CDDL should have accompanied this
-# source. A copy of the CDDL is also available via the Internet at
-# http://www.illumos.org/license/CDDL.
-#
-
-#
-# Copyright (c) 2014 Joyent, Inc. All rights reserved.
-#
-
-include ../Makefile.com
-
-install: all $(ROOTLIBS) $(ROOTLINKS) $(ROOTLINT)
diff --git a/usr/src/lib/libidspace/sparcv9/Makefile b/usr/src/lib/libidspace/sparcv9/Makefile
deleted file mode 100644
index 15d904c616..0000000000
--- a/usr/src/lib/libidspace/sparcv9/Makefile
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# This file and its contents are supplied under the terms of the
-# Common Development and Distribution License ("CDDL"), version 1.0.
-# You may only use this file in accordance with the terms of version
-# 1.0 of the CDDL.
-#
-# A full copy of the text of the CDDL should have accompanied this
-# source. A copy of the CDDL is also available via the Internet at
-# http://www.illumos.org/license/CDDL.
-#
-
-#
-# Copyright (c) 2014 Joyent, Inc. All rights reserved.
-#
-
-include ../Makefile.com
-include ../../Makefile.lib.64
-
-install: all $(ROOTLIBS64) $(ROOTLINKS64) $(ROOTLINT64)
diff --git a/usr/src/lib/libppt/Makefile.com b/usr/src/lib/libppt/Makefile.com
index 3d5e96f436..4f4551232f 100644
--- a/usr/src/lib/libppt/Makefile.com
+++ b/usr/src/lib/libppt/Makefile.com
@@ -26,7 +26,6 @@ LIBS = $(DYNLIB)
SRCS = $(SRCDIR)/libppt.c
CSTD= $(CSTD_GNU99)
-C99LMODE= -Xc99=%all
LDLIBS += -lpcidb -ldevinfo -lcmdutils -lnvpair -lc
diff --git a/usr/src/man/man1m/dd.1m b/usr/src/man/man1m/dd.1m
index 237f816c52..b2daaf1409 100644
--- a/usr/src/man/man1m/dd.1m
+++ b/usr/src/man/man1m/dd.1m
@@ -45,8 +45,9 @@
.\" Portions Copyright (c) 1995, Sun Microsystems, Inc. All Rights Reserved
.\" Copyright (c) 2014, Joyent, Inc. All rights Reserved.
.\" Copyright (c) 2014 by Delphix. All rights reserved.
+.\" Copyright 2021 Oxide Computer Company
.\"
-.Dd May 4, 2019
+.Dd October 24, 2021
.Dt DD 1M
.Os
.Sh NAME
@@ -532,6 +533,35 @@ For more information on
see
.Xr fcntl.h 3HEAD .
.El
+.It Cm status Ns = Ns Ar type
+Changes the way that
+.Nm
+outputs information about transfers.
+Only one
+.Ar type may be specified.
+The following are valid values for
+.Ar type :
+.Bl -hang
+.It Cm none
+The program will not output any information and statistics about the transfer.
+This includes when
+.Nm
+receives a signal such as
+.Dv SIGINFO
+and
+.Dv SIGUSR1 .
+Only errors will be emitted.
+.It Cm noxfer
+When printing statistical information such as when the program terminates or in
+response to a signal, only print information about the number of records and
+none of the statistics about the transfer
+.Pq total bytes, total time, and throughput .
+.It Cm progress
+Once a second, output the normal
+.Nm
+transfer statistics that include the total number of bytes transferred, time
+elapsed, and average throughput.
+.El
.El
.Pp
If operands other than
diff --git a/usr/src/pkg/manifests/system-library.mf b/usr/src/pkg/manifests/system-library.mf
index d7abc4228b..4c50a4dd9c 100644
--- a/usr/src/pkg/manifests/system-library.mf
+++ b/usr/src/pkg/manifests/system-library.mf
@@ -357,6 +357,7 @@ file path=usr/lib/$(ARCH64)/libform.so.1
file path=usr/lib/$(ARCH64)/libfstyp.so.1
file path=usr/lib/$(ARCH64)/libhotplug.so.1
file path=usr/lib/$(ARCH64)/libidmap.so.1
+file path=usr/lib/$(ARCH64)/libidspace.so.1
file path=usr/lib/$(ARCH64)/libike.so.1
file path=usr/lib/$(ARCH64)/libipmi.so.1
file path=usr/lib/$(ARCH64)/libipp.so.1
@@ -430,6 +431,7 @@ file path=usr/lib/libform.so.1
file path=usr/lib/libfstyp.so.1
file path=usr/lib/libhotplug.so.1
file path=usr/lib/libidmap.so.1
+file path=usr/lib/libidspace.so.1
file path=usr/lib/libike.so.1
file path=usr/lib/libinetsvc.so.1
file path=usr/lib/libipmi.so.1
diff --git a/usr/src/pkg/manifests/system-test-elftest.mf b/usr/src/pkg/manifests/system-test-elftest.mf
index c6300add29..92bb6c1148 100644
--- a/usr/src/pkg/manifests/system-test-elftest.mf
+++ b/usr/src/pkg/manifests/system-test-elftest.mf
@@ -9,9 +9,7 @@
# http://www.illumos.org/license/CDDL.
#
-#
-# Copyright 2018, Richard Lowe.
-#
+# Copyright 2021, Richard Lowe.
set name=pkg.fmri value=pkg:/system/test/elftest@$(PKGVERS)
set name=pkg.description value="ELF Unit Tests"
@@ -28,6 +26,7 @@ dir path=opt/elf-tests/tests/linker-sets
dir path=opt/elf-tests/tests/mapfiles
dir path=opt/elf-tests/tests/mapfiles/assert
dir path=opt/elf-tests/tests/mapfiles/parser
+dir path=opt/elf-tests/tests/string-merge
dir path=opt/elf-tests/tests/tls
dir path=opt/elf-tests/tests/tls/amd64
dir path=opt/elf-tests/tests/tls/amd64/ie
@@ -84,6 +83,9 @@ file path=opt/elf-tests/tests/mapfiles/parser/mapfile.sizemult.twobegin \
file path=opt/elf-tests/tests/mapfiles/parser/mapfile.sizemult.wrong mode=0444
file path=opt/elf-tests/tests/mapfiles/parser/object.c mode=0444
file path=opt/elf-tests/tests/mapfiles/parser/test-parser mode=0555
+file path=opt/elf-tests/tests/string-merge/simple mode=0555
+file path=opt/elf-tests/tests/string-merge/str1.s mode=0444
+file path=opt/elf-tests/tests/string-merge/str2.s mode=0444
file path=opt/elf-tests/tests/tls/amd64/ie/Makefile.test mode=0444
file path=opt/elf-tests/tests/tls/amd64/ie/amd64-ie-test mode=0555
file path=opt/elf-tests/tests/tls/amd64/ie/style1-func-with-r12.s mode=0444
diff --git a/usr/src/test/elf-tests/runfiles/default.run b/usr/src/test/elf-tests/runfiles/default.run
index 87b7cd352e..d5010ef2bc 100644
--- a/usr/src/test/elf-tests/runfiles/default.run
+++ b/usr/src/test/elf-tests/runfiles/default.run
@@ -10,7 +10,7 @@
# http://www.illumos.org/license/CDDL.
#
-# Copyright 2018, Richard Lowe.
+# Copyright 2021, Richard Lowe.
[DEFAULT]
pre =
@@ -32,6 +32,9 @@ tests = ['test-parser']
[/opt/elf-tests/tests/mapfiles/assert]
tests = ['test-assert']
+[/opt/elf-tests/tests/string-merge/]
+tests = ['simple']
+
[/opt/elf-tests/tests/tls/amd64/ie]
arch = i86pc
tests = ['amd64-ie-test']
diff --git a/usr/src/test/elf-tests/tests/Makefile b/usr/src/test/elf-tests/tests/Makefile
index 060d1c2e3e..47f18e8093 100644
--- a/usr/src/test/elf-tests/tests/Makefile
+++ b/usr/src/test/elf-tests/tests/Makefile
@@ -18,6 +18,7 @@ SUBDIRS = \
assert-deflib \
linker-sets \
mapfiles \
+ string-merge \
tls
include $(SRC)/test/Makefile.com
diff --git a/usr/src/test/elf-tests/tests/string-merge/Makefile b/usr/src/test/elf-tests/tests/string-merge/Makefile
new file mode 100644
index 0000000000..809eac39bf
--- /dev/null
+++ b/usr/src/test/elf-tests/tests/string-merge/Makefile
@@ -0,0 +1,47 @@
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+# Copyright 2021, Richard Lowe.
+
+include $(SRC)/cmd/Makefile.cmd
+include $(SRC)/test/Makefile.com
+
+PROG = simple
+
+DATAFILES = str1.s str2.s
+
+ROOTOPTPKG = $(ROOT)/opt/elf-tests
+TESTDIR = $(ROOTOPTPKG)/tests/string-merge
+
+CMDS = $(PROG:%=$(TESTDIR)/%)
+$(CMDS) := FILEMODE = 0555
+
+
+DATA = $(DATAFILES:%=$(TESTDIR)/%)
+$(DATA) := FILEMODE = 0444
+
+all: $(PROG)
+
+install: all $(CMDS) $(DATA)
+
+clobber: clean
+ -$(RM) $(PROG)
+
+clean:
+ -$(RM) $(CLEANFILES)
+
+$(CMDS): $(TESTDIR) $(PROG)
+
+$(TESTDIR):
+ $(INS.dir)
+
+$(TESTDIR)/%: %
+ $(INS.file)
diff --git a/usr/src/test/elf-tests/tests/string-merge/simple.sh b/usr/src/test/elf-tests/tests/string-merge/simple.sh
new file mode 100644
index 0000000000..5715fa5a97
--- /dev/null
+++ b/usr/src/test/elf-tests/tests/string-merge/simple.sh
@@ -0,0 +1,56 @@
+#!/bin/ksh
+#
+# This file and its contents are supplied under the terms of the
+# Common Development and Distribution License ("CDDL"), version 1.0.
+# You may only use this file in accordance with the terms of version
+# 1.0 of the CDDL.
+#
+# A full copy of the text of the CDDL should have accompanied this
+# source. A copy of the CDDL is also available via the Internet at
+# http://www.illumos.org/license/CDDL.
+#
+
+# Copyright 2021, Richard Lowe.
+
+TESTDIR=$(dirname $0)
+
+tmpdir=/tmp/test.$$
+mkdir $tmpdir
+cd $tmpdir
+
+cleanup() {
+ cd /
+ rm -fr $tmpdir
+}
+
+trap 'cleanup' EXIT
+
+if [[ $PWD != $tmpdir ]]; then
+ print -u2 "Failed to create temporary directory: $tmpdir"
+ exit 1;
+fi
+
+assemble() {
+ gcc -c -o $2 $1
+ if (( $? != 0 )); then
+ print -u2 "assembly of ${1} failed";
+ exit 1;
+ fi
+}
+
+# We expect any alternate linker to be in LD_ALTEXEC for us already
+assemble ${TESTDIR}/str1.s str1.o
+assemble ${TESTDIR}/str2.s str2.o
+
+gcc -shared -o strmerge.so str1.o str2.o
+if (( $? != 0 )); then
+ print -u2 "link of ${TESTDIR}/str[12].o failed";
+ exit 1;
+fi
+
+elfdump -N.test -w /dev/stdout strmerge.so | tr '\0' ' ' | grep -q '^ buffalo bills $'
+if (( $? != 0 )); then
+ print -u2 "Merged section contains unexpected data";
+ elfdump -N.test -w /dev/stdout strmerge.so | tr '\0' ' ' >&2
+ exit 1;
+fi
diff --git a/usr/src/test/elf-tests/tests/string-merge/str1.s b/usr/src/test/elf-tests/tests/string-merge/str1.s
new file mode 100644
index 0000000000..69c5e462e5
--- /dev/null
+++ b/usr/src/test/elf-tests/tests/string-merge/str1.s
@@ -0,0 +1,6 @@
+ .section .test,"aSM",@progbits,1
+ .asciz "buffalo"
+ .asciz "buffalo"
+ .asciz "buffalo"
+ .asciz "buffalo"
+ .asciz "buffalo"
diff --git a/usr/src/test/elf-tests/tests/string-merge/str2.s b/usr/src/test/elf-tests/tests/string-merge/str2.s
new file mode 100644
index 0000000000..d143d1c10a
--- /dev/null
+++ b/usr/src/test/elf-tests/tests/string-merge/str2.s
@@ -0,0 +1,4 @@
+ .section .test,"aSM",@progbits,1
+ .asciz "bills"
+ .asciz "uffalo"
+ .asciz "ills"
diff --git a/usr/src/tools/ctf/ctfdump/Makefile.com b/usr/src/tools/ctf/ctfdump/Makefile.com
index 3efd986e16..a9ca87b5c9 100644
--- a/usr/src/tools/ctf/ctfdump/Makefile.com
+++ b/usr/src/tools/ctf/ctfdump/Makefile.com
@@ -16,7 +16,6 @@ SRCS = ctfdump.c
include ../../Makefile.ctf
CSTD = $(CSTD_GNU99)
-C99LMODE = -Xc99=%all
CFLAGS += $(CCVERBOSE)
LDLIBS += -lctf
NATIVE_LIBS += libctf.so libc.so
@@ -44,6 +43,6 @@ $(ROOTONBLDMACHPROG): $(PROG)
install: $(ROOTONBLDMACHPROG)
clean:
- $(RM) $(OBJS) $(LINTFILES)
+ $(RM) $(OBJS)
include $(SRC)/tools/Makefile.targ
diff --git a/usr/src/tools/ctf/libctf/Makefile.com b/usr/src/tools/ctf/libctf/Makefile.com
index f132031de5..60fd36ee9c 100644
--- a/usr/src/tools/ctf/libctf/Makefile.com
+++ b/usr/src/tools/ctf/libctf/Makefile.com
@@ -17,7 +17,6 @@ include $(SRC)/lib/libctf/Makefile.shared.com
include ../../Makefile.ctf
CSTD = $(CSTD_GNU99)
-C99LMODE = -Xc99=%all
CPPFLAGS += -I$(SRC)/lib/libctf/common/ \
-I$(SRC)/lib/libdwarf/common/ \
diff --git a/usr/src/tools/sgs/sgsmsg/Makefile b/usr/src/tools/sgs/sgsmsg/Makefile
index ecde42eb3c..6231dc552f 100644
--- a/usr/src/tools/sgs/sgsmsg/Makefile
+++ b/usr/src/tools/sgs/sgsmsg/Makefile
@@ -55,6 +55,7 @@ FILEMODE= 0755
CPPFLAGS = $(NATIVE_CPPFLAGS)
CFLAGS = $(NATIVE_CFLAGS)
NATIVE_LIBS += libc.so
+CSTD = $(CSTD_GNU99)
CW_LINKER =
# not linted
diff --git a/usr/src/uts/common/Makefile.files b/usr/src/uts/common/Makefile.files
index c0d1b69f57..7d32a690da 100644
--- a/usr/src/uts/common/Makefile.files
+++ b/usr/src/uts/common/Makefile.files
@@ -1942,8 +1942,7 @@ ZYD_OBJS += zyd.o zyd_usb.o zyd_hw.o zyd_fw.o
MXFE_OBJS += mxfe.o
-MPTSAS_OBJS += mptsas.o mptsas_impl.o mptsas_init.o \
- mptsas_raid.o mptsas_smhba.o
+MPTSAS_OBJS += mptsas.o mptsas_impl.o mptsas_init.o mptsas_raid.o mptsas_smhba.o
SFE_OBJS += sfe.o sfe_util.o
diff --git a/usr/src/uts/common/Makefile.rules b/usr/src/uts/common/Makefile.rules
index 01745dbe1d..5c5f783c0c 100644
--- a/usr/src/uts/common/Makefile.rules
+++ b/usr/src/uts/common/Makefile.rules
@@ -1544,6 +1544,10 @@ $(OBJS_DIR)/%.o: $(UTSBASE)/common/io/vioif/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
+$(OBJS_DIR)/%.o: $(COMMONBASE)/idspace/%.c
+ $(COMPILE.c) -o $@ $<
+ $(CTFCONVERT_O)
+
#
# krtld must refer to its own bzero/bcopy until the kernel is fully linked
#
@@ -1623,6 +1627,10 @@ $(OBJS_DIR)/%.o: $(UTSBASE)/common/pcmcia/pcs/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
+$(OBJS_DIR)/%.o: $(UTSBASE)/common/refhash/%.c
+ $(COMPILE.c) -o $@ $<
+ $(CTFCONVERT_O)
+
$(OBJS_DIR)/%.o: $(UTSBASE)/common/rpc/%.c
$(COMPILE.c) -o $@ $<
$(CTFCONVERT_O)
diff --git a/usr/src/uts/common/exec/java/java.c b/usr/src/uts/common/exec/java/java.c
index d24000ec83..7e9029fa55 100644
--- a/usr/src/uts/common/exec/java/java.c
+++ b/usr/src/uts/common/exec/java/java.c
@@ -145,6 +145,7 @@ javaexec(vnode_t *vp, struct execa *uap, struct uarg *args,
/*
* Find and invoke the Java runtime environment on the file
*/
+ bzero(&idata, sizeof (intpdata_t));
idata.intp = NULL;
idata.intp_name[0] = jexec;
idata.intp_arg[0] = jexec_arg;
diff --git a/usr/src/uts/common/exec/shbin/shbin.c b/usr/src/uts/common/exec/shbin/shbin.c
index a1313381f6..c1f69ed4b1 100644
--- a/usr/src/uts/common/exec/shbin/shbin.c
+++ b/usr/src/uts/common/exec/shbin/shbin.c
@@ -214,11 +214,12 @@ shbinexec(
}
/*
- * Setup interpreter data
+ * Set up interpreter data
* "--" is passed to mark the end-of-arguments before adding
- * the scripts file name, preventing problems when a
- * a script's name starts with a '-' character.
+ * the script's file name, preventing problems when a
+ * script's name starts with a '-' character.
*/
+ bzero(&idata, sizeof (intpdata_t));
idata.intp = NULL;
idata.intp_name[0] = shell_list[i];
idata.intp_arg[0] = "--";
diff --git a/usr/src/uts/common/refhash/refhash.c b/usr/src/uts/common/refhash/refhash.c
new file mode 100644
index 0000000000..19c5baebe5
--- /dev/null
+++ b/usr/src/uts/common/refhash/refhash.c
@@ -0,0 +1,208 @@
+/*
+ * This file and its contents are supplied under the terms of the
+ * Common Development and Distribution License ("CDDL"), version 1.0.
+ * You may only use this file in accordance with the terms of version
+ * 1.0 of the CDDL.
+ *
+ * A full copy of the text of the CDDL should have accompanied this
+ * source. A copy of the CDDL is also available via the Internet at
+ * http://www.illumos.org/license/CDDL.
+ */
+
+/*
+ * Copyright 2015 Joyent, Inc.
+ */
+
+#include <sys/refhash.h>
+#include <sys/sysmacros.h>
+#include <sys/types.h>
+#include <sys/kmem.h>
+#include <sys/list.h>
+#include <sys/ddi.h>
+
+#define obj_to_link(_h, _o) \
+ ((refhash_link_t *)(((char *)(_o)) + (_h)->rh_link_off))
+#define link_to_obj(_h, _l) \
+ ((void *)(((char *)(_l)) - (_h)->rh_link_off))
+#define obj_to_tag(_h, _o) \
+ ((void *)(((char *)(_o)) + (_h)->rh_tag_off))
+
+refhash_t *
+refhash_create(uint_t bucket_count, refhash_hash_f hash,
+ refhash_cmp_f cmp, refhash_dtor_f dtor, size_t obj_size, size_t link_off,
+ size_t tag_off, int km_flags)
+{
+ refhash_t *hp;
+ uint_t i;
+
+ hp = kmem_alloc(sizeof (refhash_t), km_flags);
+ if (hp == NULL)
+ return (NULL);
+ hp->rh_buckets = kmem_zalloc(bucket_count * sizeof (list_t), km_flags);
+ if (hp->rh_buckets == NULL) {
+ kmem_free(hp, sizeof (refhash_t));
+ return (NULL);
+ }
+ hp->rh_bucket_count = bucket_count;
+
+ for (i = 0; i < bucket_count; i++) {
+ list_create(&hp->rh_buckets[i], sizeof (refhash_link_t),
+ offsetof(refhash_link_t, rhl_chain_link));
+ }
+ list_create(&hp->rh_objs, sizeof (refhash_link_t),
+ offsetof(refhash_link_t, rhl_global_link));
+
+ hp->rh_obj_size = obj_size;
+ hp->rh_link_off = link_off;
+ hp->rh_tag_off = tag_off;
+ hp->rh_hash = hash;
+ hp->rh_cmp = cmp;
+ hp->rh_dtor = dtor;
+
+ return (hp);
+}
+
+void
+refhash_destroy(refhash_t *hp)
+{
+ ASSERT(list_is_empty(&hp->rh_objs));
+
+ kmem_free(hp->rh_buckets, hp->rh_bucket_count * sizeof (list_t));
+ kmem_free(hp, sizeof (refhash_t));
+}
+
+void
+refhash_insert(refhash_t *hp, void *op)
+{
+ uint_t bucket;
+ refhash_link_t *lp = obj_to_link(hp, op);
+
+ bucket = hp->rh_hash(obj_to_tag(hp, op)) % hp->rh_bucket_count;
+ list_link_init(&lp->rhl_chain_link);
+ list_link_init(&lp->rhl_global_link);
+ lp->rhl_flags = 0;
+ lp->rhl_refcnt = 0;
+ list_insert_tail(&hp->rh_buckets[bucket], lp);
+ list_insert_tail(&hp->rh_objs, lp);
+}
+
+static void
+refhash_delete(refhash_t *hp, void *op)
+{
+ refhash_link_t *lp = obj_to_link(hp, op);
+ uint_t bucket;
+
+ bucket = hp->rh_hash(obj_to_tag(hp, op)) % hp->rh_bucket_count;
+ list_remove(&hp->rh_buckets[bucket], lp);
+ list_remove(&hp->rh_objs, lp);
+ hp->rh_dtor(op);
+}
+
+void
+refhash_remove(refhash_t *hp, void *op)
+{
+ refhash_link_t *lp = obj_to_link(hp, op);
+
+ if (lp->rhl_refcnt > 0) {
+ lp->rhl_flags |= RHL_F_DEAD;
+ } else {
+ refhash_delete(hp, op);
+ }
+}
+
+void *
+refhash_lookup(refhash_t *hp, const void *tp)
+{
+ uint_t bucket;
+ refhash_link_t *lp;
+ void *op;
+
+ bucket = hp->rh_hash(tp) % hp->rh_bucket_count;
+ for (lp = list_head(&hp->rh_buckets[bucket]); lp != NULL;
+ lp = list_next(&hp->rh_buckets[bucket], lp)) {
+ op = link_to_obj(hp, lp);
+ if (hp->rh_cmp(obj_to_tag(hp, op), tp) == 0 &&
+ !(lp->rhl_flags & RHL_F_DEAD)) {
+ return (op);
+ }
+ }
+
+ return (NULL);
+}
+
+void *
+refhash_linear_search(refhash_t *hp, refhash_eval_f eval, void *arg)
+{
+ void *op;
+ refhash_link_t *lp;
+
+ for (lp = list_head(&hp->rh_objs); lp != NULL;
+ lp = list_next(&hp->rh_objs, lp)) {
+ op = link_to_obj(hp, lp);
+ if (eval(op, arg) == 0)
+ return (op);
+ }
+
+ return (NULL);
+}
+
+void
+refhash_hold(refhash_t *hp, void *op)
+{
+ refhash_link_t *lp = obj_to_link(hp, op);
+
+ ++lp->rhl_refcnt;
+}
+
+void
+refhash_rele(refhash_t *hp, void *op)
+{
+ refhash_link_t *lp = obj_to_link(hp, op);
+
+ ASSERT(lp->rhl_refcnt > 0);
+
+ if (--lp->rhl_refcnt == 0 && (lp->rhl_flags & RHL_F_DEAD))
+ refhash_remove(hp, op);
+}
+
+void *
+refhash_first(refhash_t *hp)
+{
+ refhash_link_t *lp;
+
+ lp = list_head(&hp->rh_objs);
+ if (lp == NULL)
+ return (NULL);
+
+ ++lp->rhl_refcnt;
+
+ return (link_to_obj(hp, lp));
+}
+
+void *
+refhash_next(refhash_t *hp, void *op)
+{
+ refhash_link_t *lp;
+
+ lp = obj_to_link(hp, op);
+ while ((lp = list_next(&hp->rh_objs, lp)) != NULL) {
+ if (!(lp->rhl_flags & RHL_F_DEAD))
+ break;
+ }
+
+ refhash_rele(hp, op);
+ if (lp == NULL)
+ return (NULL);
+
+ ++lp->rhl_refcnt;
+
+ return (link_to_obj(hp, lp));
+}
+
+boolean_t
+refhash_obj_valid(refhash_t *hp, const void *op)
+{
+ const refhash_link_t *lp = obj_to_link(hp, op);
+
+ return ((lp->rhl_flags & RHL_F_DEAD) != 0);
+}
diff --git a/usr/src/uts/i86pc/acpi_drv/Makefile b/usr/src/uts/i86pc/acpi_drv/Makefile
index d5d60fdc72..6f8228c666 100644
--- a/usr/src/uts/i86pc/acpi_drv/Makefile
+++ b/usr/src/uts/i86pc/acpi_drv/Makefile
@@ -70,11 +70,6 @@ $(OBJS_DIR)/acpi_video.o := SMOFF += all_func_returns
LDFLAGS += -dy -N misc/acpica
#
-# Overrides
-#
-C99LMODE= -Xc99=%all
-
-#
# Default build targets.
#
.KEEP_STATE:
diff --git a/usr/src/uts/intel/bnx/Makefile b/usr/src/uts/intel/bnx/Makefile
index 46eeadef7a..b4bb3f18fd 100644
--- a/usr/src/uts/intel/bnx/Makefile
+++ b/usr/src/uts/intel/bnx/Makefile
@@ -47,9 +47,6 @@ include $(UTSBASE)/intel/Makefile.intel
ALL_TARGET = $(BINARY) $(CONFMOD)
INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
-C99MODE= -xc99=%all
-C99LMODE= -Xc99=%all
-
#
# Driver-specific flags
#
diff --git a/usr/src/uts/intel/bnxe/Makefile b/usr/src/uts/intel/bnxe/Makefile
index e084215302..3f6034b38a 100644
--- a/usr/src/uts/intel/bnxe/Makefile
+++ b/usr/src/uts/intel/bnxe/Makefile
@@ -47,8 +47,6 @@ include $(UTSBASE)/intel/Makefile.intel
ALL_TARGET = $(BINARY) $(CONFMOD)
INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
-C99LMODE= -Xc99=%all
-
#
# Driver-specific flags
# XXX inline bits were originally set to inline
diff --git a/usr/src/uts/intel/ctf/Makefile b/usr/src/uts/intel/ctf/Makefile
index 52968662ff..5a91c2cd66 100644
--- a/usr/src/uts/intel/ctf/Makefile
+++ b/usr/src/uts/intel/ctf/Makefile
@@ -36,8 +36,6 @@ include $(UTSBASE)/intel/Makefile.intel
ALL_TARGET = $(BINARY)
INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
-C99LMODE= -Xc99=%all
-
CPPFLAGS += -I$(SRC)/common/ctf -DCTF_OLD_VERSIONS
LDFLAGS += $(BREDUCE) -M$(UTSBASE)/common/ctf/mapfile -dy
diff --git a/usr/src/uts/intel/fct/Makefile b/usr/src/uts/intel/fct/Makefile
index adfd7e4cc0..bf6e9946c1 100644
--- a/usr/src/uts/intel/fct/Makefile
+++ b/usr/src/uts/intel/fct/Makefile
@@ -57,8 +57,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf
-C99LMODE= -Xc99=%all
-
#
# For now, disable these warnings; maintainers should endeavor
# to investigate and remove these for maximum coverage.
diff --git a/usr/src/uts/intel/iscsit/Makefile b/usr/src/uts/intel/iscsit/Makefile
index b92aaf3e0a..8db8d8742b 100644
--- a/usr/src/uts/intel/iscsit/Makefile
+++ b/usr/src/uts/intel/iscsit/Makefile
@@ -55,8 +55,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf -Nmisc/idm -Nfs/sockfs -Nmisc/md5 -Nmisc/ksocket
-C99LMODE= -Xc99=%all
-
CERRWARN += -_gcc=-Wno-switch
CERRWARN += $(CNOWARN_UNINIT)
CERRWARN += -_gcc=-Wno-unused-label
diff --git a/usr/src/uts/intel/pppt/Makefile b/usr/src/uts/intel/pppt/Makefile
index fd2e3d3aec..55b149c18b 100644
--- a/usr/src/uts/intel/pppt/Makefile
+++ b/usr/src/uts/intel/pppt/Makefile
@@ -58,8 +58,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf
-C99LMODE= -Xc99=%all
-
CERRWARN += -_gcc=-Wno-switch
CERRWARN += $(CNOWARN_UNINIT)
diff --git a/usr/src/uts/intel/qlge/Makefile b/usr/src/uts/intel/qlge/Makefile
index 1121b9d596..97811f922a 100644
--- a/usr/src/uts/intel/qlge/Makefile
+++ b/usr/src/uts/intel/qlge/Makefile
@@ -60,8 +60,6 @@ INC_PATH += -I$(UTSBASE)/common/sys/fibre-channel/fca/qlge
LDFLAGS += -dy -Nmisc/mac -Ndrv/ip
-C99LMODE= -Xc99=%all
-
CERRWARN += -_gcc=-Wno-switch
CERRWARN += $(CNOWARN_UNINIT)
diff --git a/usr/src/uts/intel/qlt/Makefile b/usr/src/uts/intel/qlt/Makefile
index cd5989db35..9543155cb5 100644
--- a/usr/src/uts/intel/qlt/Makefile
+++ b/usr/src/uts/intel/qlt/Makefile
@@ -57,8 +57,6 @@ MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/fct -Ndrv/stmf
CFLAGS += -DUNIQUE_FW_NAME
-C99LMODE= -Xc99=%all
-
#
# For now, disable these warnings; maintainers should endeavor
# to investigate and remove these for maximum coverage.
diff --git a/usr/src/uts/intel/srpt/Makefile b/usr/src/uts/intel/srpt/Makefile
index 3a030aa82f..11b94f103f 100644
--- a/usr/src/uts/intel/srpt/Makefile
+++ b/usr/src/uts/intel/srpt/Makefile
@@ -57,8 +57,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf -Nmisc/ibtl -Nmisc/ibcm
-C99LMODE= -Xc99=%all
-
CERRWARN += -_gcc=-Wno-unused-label
# needs work
diff --git a/usr/src/uts/intel/stmf/Makefile b/usr/src/uts/intel/stmf/Makefile
index 2ef50bc67a..8c34d1cd10 100644
--- a/usr/src/uts/intel/stmf/Makefile
+++ b/usr/src/uts/intel/stmf/Makefile
@@ -58,8 +58,6 @@ CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
# needs work
SMATCH=off
-C99LMODE= -Xc99=%all
-
#
# For now, disable these warnings; maintainers should endeavor
# to investigate and remove these for maximum coverage.
diff --git a/usr/src/uts/intel/stmf_sbd/Makefile b/usr/src/uts/intel/stmf_sbd/Makefile
index cd6f841ccd..2cdb872f4b 100644
--- a/usr/src/uts/intel/stmf_sbd/Makefile
+++ b/usr/src/uts/intel/stmf_sbd/Makefile
@@ -59,8 +59,6 @@ LDFLAGS += -dy -Ndrv/stmf -Nfs/zfs
INC_PATH += -I$(UTSBASE)/common/fs/zfs
-C99LMODE= -Xc99=%all
-
#
# For now, disable these warnings; maintainers should endeavor
# to investigate and remove these for maximum coverage.
diff --git a/usr/src/uts/intel/zfs/Makefile b/usr/src/uts/intel/zfs/Makefile
index 0ead0381dc..7cf93d6f2b 100644
--- a/usr/src/uts/intel/zfs/Makefile
+++ b/usr/src/uts/intel/zfs/Makefile
@@ -71,8 +71,6 @@ INC_PATH += -I$(SRC)/common
INC_PATH += -I$(COMMONBASE)/zfs
INC_PATH += -I$(UTSBASE)/i86pc
-C99LMODE= -Xc99=%all
-
#
# For now, disable these warnings; maintainers should endeavor
# to investigate and remove these for maximum coverage.
diff --git a/usr/src/uts/intel/zut/Makefile b/usr/src/uts/intel/zut/Makefile
index 1d1ee7d054..f3fcc5630d 100644
--- a/usr/src/uts/intel/zut/Makefile
+++ b/usr/src/uts/intel/zut/Makefile
@@ -60,8 +60,6 @@ INC_PATH += -I$(UTSBASE)/common/fs/zut
INC_PATH += -I$(SRC)/common
INC_PATH += -I$(COMMONBASE)/zut
-C99LMODE= -Xc99=%all
-
#
# For now, disable these warnings; maintainers should endeavor
# to investigate and remove these for maximum coverage.
diff --git a/usr/src/uts/sparc/bnxe/Makefile b/usr/src/uts/sparc/bnxe/Makefile
index 3071f4c145..76d2de96f4 100644
--- a/usr/src/uts/sparc/bnxe/Makefile
+++ b/usr/src/uts/sparc/bnxe/Makefile
@@ -47,8 +47,6 @@ include $(UTSBASE)/sparc/Makefile.sparc
ALL_TARGET = $(BINARY) $(CONFMOD)
INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
-C99LMODE= -Xc99=%all
-
#
# Driver-specific flags
# XXX inline bits were originally set to inline
diff --git a/usr/src/uts/sparc/ctf/Makefile b/usr/src/uts/sparc/ctf/Makefile
index 88982e1b9e..91ed878b82 100644
--- a/usr/src/uts/sparc/ctf/Makefile
+++ b/usr/src/uts/sparc/ctf/Makefile
@@ -36,8 +36,6 @@ include $(UTSBASE)/sparc/Makefile.sparc
ALL_TARGET = $(BINARY)
INSTALL_TARGET = $(BINARY) $(ROOTMODULE)
-C99LMODE= -Xc99=%all
-
CFLAGS += $(CCVERBOSE)
CPPFLAGS += -I$(SRC)/common/ctf -DCTF_OLD_VERSIONS
LDFLAGS += $(BREDUCE) -M$(UTSBASE)/common/ctf/mapfile -dy
diff --git a/usr/src/uts/sparc/fct/Makefile b/usr/src/uts/sparc/fct/Makefile
index 42ec698329..6660228946 100644
--- a/usr/src/uts/sparc/fct/Makefile
+++ b/usr/src/uts/sparc/fct/Makefile
@@ -58,8 +58,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf
-C99LMODE= -Xc99=%all
-
#
# For now, disable these warnings; maintainers should endeavor
# to investigate and remove these for maximum coverage.
diff --git a/usr/src/uts/sparc/iscsit/Makefile b/usr/src/uts/sparc/iscsit/Makefile
index 379ab9195f..0cd707d1e8 100644
--- a/usr/src/uts/sparc/iscsit/Makefile
+++ b/usr/src/uts/sparc/iscsit/Makefile
@@ -58,8 +58,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf -Nmisc/idm -Nfs/sockfs -Nmisc/md5 -Nmisc/ksocket
-C99LMODE= -Xc99=%all
-
CERRWARN += -_gcc=-Wno-switch
CERRWARN += $(CNOWARN_UNINIT)
CERRWARN += -_gcc=-Wno-unused-label
diff --git a/usr/src/uts/sparc/pppt/Makefile b/usr/src/uts/sparc/pppt/Makefile
index fd2e3d3aec..55b149c18b 100644
--- a/usr/src/uts/sparc/pppt/Makefile
+++ b/usr/src/uts/sparc/pppt/Makefile
@@ -58,8 +58,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf
-C99LMODE= -Xc99=%all
-
CERRWARN += -_gcc=-Wno-switch
CERRWARN += $(CNOWARN_UNINIT)
diff --git a/usr/src/uts/sparc/qlge/Makefile b/usr/src/uts/sparc/qlge/Makefile
index 3489a36dd4..703c290925 100644
--- a/usr/src/uts/sparc/qlge/Makefile
+++ b/usr/src/uts/sparc/qlge/Makefile
@@ -59,8 +59,6 @@ INC_PATH += -I$(UTSBASE)/common/sys/fibre-channel/fca/qlge
LDFLAGS += -dy -Nmisc/mac -Ndrv/ip
-C99LMODE= -Xc99=%all
-
CERRWARN += -_gcc=-Wno-switch
CERRWARN += $(CNOWARN_UNINIT)
diff --git a/usr/src/uts/sparc/qlt/Makefile b/usr/src/uts/sparc/qlt/Makefile
index cd5989db35..9543155cb5 100644
--- a/usr/src/uts/sparc/qlt/Makefile
+++ b/usr/src/uts/sparc/qlt/Makefile
@@ -57,8 +57,6 @@ MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/fct -Ndrv/stmf
CFLAGS += -DUNIQUE_FW_NAME
-C99LMODE= -Xc99=%all
-
#
# For now, disable these warnings; maintainers should endeavor
# to investigate and remove these for maximum coverage.
diff --git a/usr/src/uts/sparc/srpt/Makefile b/usr/src/uts/sparc/srpt/Makefile
index 4243dec8db..de423e3a32 100644
--- a/usr/src/uts/sparc/srpt/Makefile
+++ b/usr/src/uts/sparc/srpt/Makefile
@@ -58,8 +58,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
LDFLAGS += -dy -Ndrv/stmf -Nmisc/ibtl -Nmisc/ibcm
-C99LMODE= -Xc99=%all
-
CERRWARN += -_gcc=-Wno-unused-label
#
diff --git a/usr/src/uts/sparc/stmf/Makefile b/usr/src/uts/sparc/stmf/Makefile
index 21788784aa..d6261e67c8 100644
--- a/usr/src/uts/sparc/stmf/Makefile
+++ b/usr/src/uts/sparc/stmf/Makefile
@@ -56,8 +56,6 @@ INSTALL_TARGET = $(BINARY) $(ROOTMODULE) $(ROOT_CONFFILE)
MODSTUBS_DIR = $(OBJS_DIR)
CERRWARN += -erroff=E_STATEMENT_NOT_REACHED
-C99LMODE= -Xc99=%all
-
#
# For now, disable these warnings; maintainers should endeavor
# to investigate and remove these for maximum coverage.
diff --git a/usr/src/uts/sparc/stmf_sbd/Makefile b/usr/src/uts/sparc/stmf_sbd/Makefile
index cd6f841ccd..2cdb872f4b 100644
--- a/usr/src/uts/sparc/stmf_sbd/Makefile
+++ b/usr/src/uts/sparc/stmf_sbd/Makefile
@@ -59,8 +59,6 @@ LDFLAGS += -dy -Ndrv/stmf -Nfs/zfs
INC_PATH += -I$(UTSBASE)/common/fs/zfs
-C99LMODE= -Xc99=%all
-
#
# For now, disable these warnings; maintainers should endeavor
# to investigate and remove these for maximum coverage.
diff --git a/usr/src/uts/sparc/zfs/Makefile b/usr/src/uts/sparc/zfs/Makefile
index 1379e5e87d..f72e65fecf 100644
--- a/usr/src/uts/sparc/zfs/Makefile
+++ b/usr/src/uts/sparc/zfs/Makefile
@@ -75,8 +75,6 @@ INC_PATH += -I$(SRC)/common
INC_PATH += -I$(COMMONBASE)/zfs
INC_PATH += -I$(UTSBASE)/sun4
-C99LMODE= -Xc99=%all
-
#
# For now, disable these warnings; maintainers should endeavor
# to investigate and remove these for maximum coverage.
diff --git a/usr/src/uts/sparc/zut/Makefile b/usr/src/uts/sparc/zut/Makefile
index 1d1ee7d054..f3fcc5630d 100644
--- a/usr/src/uts/sparc/zut/Makefile
+++ b/usr/src/uts/sparc/zut/Makefile
@@ -60,8 +60,6 @@ INC_PATH += -I$(UTSBASE)/common/fs/zut
INC_PATH += -I$(SRC)/common
INC_PATH += -I$(COMMONBASE)/zut
-C99LMODE= -Xc99=%all
-
#
# For now, disable these warnings; maintainers should endeavor
# to investigate and remove these for maximum coverage.