--- old/usr/src/cmd/file/Makefile	2019-04-08 18:51:01.117236264 +0000
+++ new/usr/src/cmd/file/Makefile	2019-04-08 18:51:01.136175695 +0000
@@ -44,9 +44,6 @@
 CERRWARN += -_gcc=-Wno-uninitialized
 CERRWARN += -_gcc=-Wno-type-limits
 
-# not linted
-SMATCH=off
-
 POFILE= file_all.po
 POFILES= $(SRCS:%.c=%.po)
 
--- old/usr/src/cmd/file/elf_read.c	2019-04-08 18:51:01.618541627 +0000
+++ new/usr/src/cmd/file/elf_read.c	2019-04-08 18:51:01.636515948 +0000
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
-/*	  All Rights Reserved  	*/
+/*	  All Rights Reserved	*/
 
 
 /*	Copyright (c) 1987, 1988 Microsoft Corporation	*/
@@ -79,6 +79,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/elf.h>
+#include <sys/link.h>
 #include <elfcap.h>
 #include "file.h"
 #include "elf_read.h"
@@ -125,7 +126,7 @@
 
 /*
  * file_xlatetom:	translate different headers from file
- * 			representation to memory representaion.
+ *			representation to memory representaion.
  */
 #define	HDRSZ 512
 static int
@@ -141,7 +142,7 @@
 	/* will convert only these types */
 	if (type != ELF_T_EHDR && type != ELF_T_PHDR &&
 	    type != ELF_T_SHDR && type != ELF_T_WORD &&
-	    type != ELF_T_CAP)
+	    type != ELF_T_CAP && type != ELF_T_DYN)
 		return (ELF_READ_FAIL);
 
 	src.d_buf = (Elf_Void *)hdr;
@@ -162,7 +163,7 @@
 
 /*
  * xlatetom_nhdr:	There is no routine to convert Note header
- * 			so we convert each field of this header.
+ *			so we convert each field of this header.
  */
 static int
 xlatetom_nhdr(Elf_Nhdr *nhdr)
@@ -177,7 +178,7 @@
 
 /*
  * elf_read:	reads elf header, program, section headers to
- * 		collect all information needed for file(1)
+ *		collect all information needed for file(1)
  *		output and stores them in Elf_Info.
  */
 int
@@ -300,7 +301,7 @@
 /*
  * process_phdr:	Read Program Headers and see if it is a core
  *			file of either new or (pre-restructured /proc)
- * 			type, read the name of the file that dumped this
+ *			type, read the name of the file that dumped this
  *			core, else see if this is a dynamically linked.
  */
 static int
@@ -415,17 +416,13 @@
 static int
 process_shdr(Elf_Info *EI)
 {
-	int 		capn, mac;
-	int 		i, j, idx;
-	FILE_ELF_OFF_T	cap_off;
-	FILE_ELF_SIZE_T	csize;
+	int		mac;
+	int		i, idx;
 	char		*strtab;
 	size_t		strtab_sz;
-	Elf_Cap 	Chdr;
+	uint64_t	j;
 	Elf_Shdr	*shdr = &EI_Shdr;
 
-
-	csize = sizeof (Elf_Cap);
 	mac = EI_Ehdr.e_machine;
 
 	/* if there are no sections, return success anyway */
@@ -457,9 +454,15 @@
 			continue;
 		}
 
-		cap_off = shdr->sh_offset;
 		if (shdr->sh_type == SHT_SUNW_cap) {
-			char capstr[128];
+			char		capstr[128];
+			Elf_Cap		Chdr;
+			FILE_ELF_OFF_T	cap_off;
+			FILE_ELF_SIZE_T	csize;
+			uint64_t capn;
+
+			cap_off = shdr->sh_offset;
+			csize = sizeof (Elf_Cap);
 
 			if (shdr->sh_size == 0 || shdr->sh_entsize == 0) {
 				(void) fprintf(stderr, ELF_ERR_ELFCAP1,
@@ -471,8 +474,8 @@
 				/*
 				 * read cap and xlate the values
 				 */
-				if (pread64(EI->elffd, &Chdr, csize, cap_off)
-				    != csize ||
+				if ((pread64(EI->elffd, &Chdr, csize, cap_off)
+				    != csize) ||
 				    file_xlatetom(ELF_T_CAP, (char *)&Chdr)
 				    == 0) {
 					(void) fprintf(stderr, ELF_ERR_ELFCAP2,
@@ -503,6 +506,39 @@
 				(void) strlcat(EI->cap_str, capstr,
 				    sizeof (EI->cap_str));
 			}
+		} else if (shdr->sh_type == SHT_DYNAMIC) {
+			Elf_Dyn dyn;
+			FILE_ELF_SIZE_T dsize;
+			FILE_ELF_OFF_T doff;
+			uint64_t dynn;
+
+			doff = shdr->sh_offset;
+			dsize = sizeof (Elf_Dyn);
+
+			if (shdr->sh_size == 0 || shdr->sh_entsize == 0) {
+				(void) fprintf(stderr, ELF_ERR_DYNAMIC1,
+				    File, EI->file);
+				return (ELF_READ_FAIL);
+			}
+
+			dynn = (shdr->sh_size / shdr->sh_entsize);
+			for (j = 0; j < dynn; j++) {
+				if (pread64(EI->elffd, &dyn, dsize, doff)
+				    != dsize ||
+				    file_xlatetom(ELF_T_DYN, (char *)&dyn)
+				    == 0) {
+					(void) fprintf(stderr, ELF_ERR_DYNAMIC2,
+					    File, EI->file);
+					return (ELF_READ_FAIL);
+				}
+
+				doff += dsize;
+
+				if ((dyn.d_tag == DT_SUNW_KMOD) &&
+				    (dyn.d_un.d_val == 1)) {
+					EI->kmod = B_TRUE;
+				}
+			}
 		}
 
 		/*
--- old/usr/src/cmd/file/elf_read.h	2019-04-08 18:51:02.102308742 +0000
+++ new/usr/src/cmd/file/elf_read.h	2019-04-08 18:51:02.118803787 +0000
@@ -26,8 +26,6 @@
 #ifndef _ELF_READ_H
 #define	_ELF_READ_H
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #define	BUFSZ 128
 typedef struct Elf_Info {
 	boolean_t	dynamic;	/* dymanically linked? */
@@ -40,6 +38,7 @@
 	char		fname[PRFNSZ];	/* name of process that dumped core */
 	char		cap_str[BUFSZ];	/* hw/sw capabilities */
 	char		*file;		/* file being processed */
+	boolean_t	kmod;
 } Elf_Info;
 
 /* values for Elf_Info.stripped */
@@ -53,10 +52,14 @@
 #define	EC_NEWCORE	0x2
 
 /* elf file processing errors */
-#define	ELF_ERR_ELFCAP1	gettext("%s: %s zero size or zero entry ELF " \
-			    "section - ELF capabilities ignored\n")
-#define	ELF_ERR_ELFCAP2	gettext("%s: %s: can't read ELF capabilities " \
-			    "data - ELF capabilities ignored\n")
+#define	ELF_ERR_ELFCAP1		gettext("%s: %s zero size or zero entry ELF " \
+	"section - ELF capabilities ignored\n")
+#define	ELF_ERR_ELFCAP2		gettext("%s: %s: can't read ELF capabilities " \
+	"data - ELF capabilities ignored\n")
+#define	ELF_ERR_DYNAMIC1	gettext("%s: %s zero size or zero entry ELF " \
+	"section - ELF dynamic tags ignored\n")
+#define	ELF_ERR_DYNAMIC2	gettext("%s: %s: can't read ELF dynamic " \
+	"data - ELF dynamic tags ignored\n")
 
 extern int is_in_list(char *str);
 
@@ -72,6 +75,7 @@
 #define	Elf_Cap		Elf64_Cap
 #define	Elf_Nhdr	Elf64_Nhdr
 #define	Elf_Word	Elf64_Word
+#define	Elf_Dyn		Elf64_Dyn
 
 #define	elf_read	elf_read64
 #define	elf_xlatetom	elf64_xlatetom
@@ -88,6 +92,7 @@
 #define	Elf_Cap		Elf32_Cap
 #define	Elf_Nhdr	Elf32_Nhdr
 #define	Elf_Word	Elf32_Word
+#define	Elf_Dyn		Elf32_Dyn
 
 #define	elf_read	elf_read32
 #define	elf_xlatetom	elf32_xlatetom
--- old/usr/src/cmd/file/file.c	2019-04-08 18:51:02.558948132 +0000
+++ new/usr/src/cmd/file/file.c	2019-04-08 18:51:02.572611023 +0000
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
-/*	  All Rights Reserved  	*/
+/*	  All Rights Reserved	*/
 
 
 /*	Copyright (c) 1987, 1988 Microsoft Corporation	*/
@@ -614,7 +614,7 @@
  *	be applied before context-sensitive tests, to avoid
  *	false context-sensitive matches.
  *
- * 	Returns -1 on error which should result in error (non-zero)
+ *	Returns -1 on error which should result in error (non-zero)
  *	exit status for the file utility.
  *	Returns 0 if no matching file type found.
  *	Returns 1 if matching file type found.
@@ -853,7 +853,8 @@
 	for (i = 0; i < Max; /* null */)
 		if (fbuf[i] & 0200) {
 			IS_ascii = 0;
-			if (fbuf[0] == '\100' && fbuf[1] == '\357') {
+			if ((fbuf[0] == '\100') &&
+			    ((uchar_t)fbuf[1] == (uchar_t)'\357')) {
 				(void) printf(gettext("troff output\n"));
 				return;
 			}
@@ -1330,6 +1331,10 @@
 	if (version == 1)
 		(void) printf(" %s %d", gettext("Version"), version);
 
+	if (EInfo.kmod) {
+		(void) printf(", %s", gettext("kernel module"));
+	}
+
 	/* Print Flags */
 	print_elf_flags(EInfo);
 
@@ -1483,9 +1488,10 @@
 	return (1);
 }
 
+/* look for "1hddddd" where d is a digit */
 static int
 sccs(void)
-{				/* look for "1hddddd" where d is a digit */
+{
 	register int j;
 
 	if (fbuf[0] == 1 && fbuf[1] == 'h') {
--- old/usr/src/cmd/file/magicutils.c	2019-04-08 18:51:03.158878374 +0000
+++ new/usr/src/cmd/file/magicutils.c	2019-04-08 18:51:03.175986180 +0000
@@ -24,13 +24,11 @@
  */
 
 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
-/*	  All Rights Reserved  	*/
+/*	  All Rights Reserved	*/
 
 /*	Copyright (c) 1987, 1988 Microsoft Corporation	*/
 /*	  All Rights Reserved	*/
 
-#pragma ident	"%Z%%M%	%I%	%E% SMI"
-
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -193,7 +191,7 @@
  * f_mkmtab - fills mtab array of magic table entries with
  *	values from the file magfile.
  *	May be called more than once if multiple magic
- * 	files were specified.
+ *	files were specified.
  *	Stores entries sequentially in one of two magic
  *	tables: mtab1, if first = 1; mtab2 otherwise.
  *
@@ -243,7 +241,7 @@
 
 	/* mtab may have been allocated on a previous f_mkmtab call */
 	if (mtab == (Entry *)NULL) {
-		if ((mtab = calloc(sizeof (Entry), NENT)) == NULL) {
+		if ((mtab = calloc(NENT, sizeof (Entry))) == NULL) {
 			int err = errno;
 			(void) fprintf(stderr, gettext("%s: malloc "
 			    "failed: %s\n"), File, strerror(err));
@@ -365,7 +363,7 @@
 			case 'l':
 				if (*(p+1) == 'l') {	/* llong */
 					ep->e_type = LLONG;
-				} else { 		/* long */
+				} else {		/* long */
 					ep->e_type = LONG;
 				}
 				break;
@@ -537,7 +535,7 @@
 int
 f_ckmtab(char *buf, int bufsize, int first)
 {
-	int 		result;
+	int		result;
 	Entry		*mtab;
 	Entry		*ep;
 	char		*p;
@@ -849,7 +847,7 @@
 #ifdef XPG4
 				if (ep->e_mask == 0) {
 					(void) printf(ep->e_str,
-						(int64_t)u64_val);
+					    (int64_t)u64_val);
 					break;
 				}
 #endif	/* XPG4 */
@@ -861,7 +859,7 @@
 #ifdef XPG4
 				if (ep->e_mask == 0) {
 					(void) printf(ep->e_str,
-						(int32_t)u64_val);
+					    (int32_t)u64_val);
 					break;
 				}
 #endif	/* XPG4 */
@@ -874,7 +872,7 @@
 #ifdef XPG4
 				if (ep->e_mask == 0) {
 					(void) printf(ep->e_str,
-						(int16_t)u64_val);
+					    (int16_t)u64_val);
 					break;
 				}
 #endif	/* XPG4 */
@@ -887,7 +885,7 @@
 #ifdef XPG4
 				if (ep->e_mask == 0) {
 					(void) printf(ep->e_str,
-						(int8_t)u64_val);
+					    (int8_t)u64_val);
 					break;
 				}
 #endif	/* XPG4 */
@@ -1071,7 +1069,7 @@
 	int	count;
 
 	(void) printf("%-7s %-7s %-10s %-7s %-11s %s\n",
-		"level", "off", "type", "opcode", "value", "string");
+	    "level", "off", "type", "opcode", "value", "string");
 	for (mtab = mtab1, count = 1; count <= 2; count++, mtab = mtab2) {
 		if (mtab == (Entry *)NULL) {
 			continue;
--- old/usr/src/cmd/sgs/dump/common/dump.c	2019-04-08 18:51:03.661791915 +0000
+++ new/usr/src/cmd/sgs/dump/common/dump.c	2019-04-08 18:51:03.679772178 +0000
@@ -1225,6 +1225,7 @@
 			case DT_SUNW_CAPCHAINENT:
 			case DT_SUNW_CAPCHAINSZ:
 			case DT_SUNW_ASLR:
+			case DT_SUNW_KMOD:
 				(void) printf(pdyn_Fmtptr,
 				    EC_XWORD(p_dyn.d_un.d_val));
 				break;
--- old/usr/src/cmd/sgs/include/_libelf.h	2019-04-08 18:51:04.240076886 +0000
+++ new/usr/src/cmd/sgs/include/_libelf.h	2019-04-08 18:51:04.260612734 +0000
@@ -47,6 +47,7 @@
 extern size_t		_elf_getarsymwordsize(Elf *);
 extern Elf64_Off	_elf_getxoff(Elf_Data *);
 extern GElf_Xword	_gelf_getdyndtflags_1(Elf *);
+extern GElf_Xword	_gelf_getdynval(Elf *, GElf_Sxword);
 extern int		_elf_swap_wrimage(Elf *);
 extern uint_t		_elf_sys_encoding(void);
 
--- old/usr/src/cmd/sgs/include/libld.h	2019-04-08 18:51:04.686775845 +0000
+++ new/usr/src/cmd/sgs/include/libld.h	2019-04-08 18:51:04.705394506 +0000
@@ -105,7 +105,7 @@
  */
 struct rel_cache {
 	APlist		*rc_list;	/* list of Rel_cachebuf */
-	Word		rc_cnt;		/* 	and count */
+	Word		rc_cnt;		/*	and count */
 };
 
 /*
@@ -147,7 +147,7 @@
 	RLXREL_REJ_NONE = 0,	/* Replacement symbol was found */
 	RLXREL_REJ_TARGET,	/* Target sec disallows relaxed relocations */
 	RLXREL_REJ_SECTION,	/* Either there is no replacement section, */
-				/* 	or its attributes are incompatible */
+				/*	or its attributes are incompatible */
 	RLXREL_REJ_SYMBOL,	/* Replacement symbol not found */
 } Rlxrel_rej;
 
@@ -261,15 +261,15 @@
 	APlist		*ofl_ents;	/* list of entrance descriptors */
 	avl_tree_t	ofl_ents_avl;	/* O(log N) access to named ent. desc */
 	APlist		*ofl_objs;	/* relocatable object file list */
-	Word		ofl_objscnt;	/* 	and count */
+	Word		ofl_objscnt;	/*	and count */
 	APlist		*ofl_ars;	/* archive library list */
-	Word		ofl_arscnt;	/* 	and count */
+	Word		ofl_arscnt;	/*	and count */
 	int		ofl_ars_gsandx; /* archive group argv index. 0 means */
 					/*	no current group, < 0 means */
 					/*	error reported. >0 is cur ndx */
 	Word		ofl_ars_gsndx;	/* current -zrescan-start ofl_ars ndx */
 	APlist		*ofl_sos;	/* shared object list */
-	Word		ofl_soscnt;	/* 	and count */
+	Word		ofl_soscnt;	/*	and count */
 	APlist		*ofl_soneed;	/* list of implicitly required .so's */
 	APlist		*ofl_socntl;	/* list of .so control definitions */
 	Rel_cache	ofl_outrels;	/* list of output relocations */
@@ -283,7 +283,7 @@
 	APlist		*ofl_ismove;	/* list of .SUNW_move sections */
 	APlist		*ofl_ismoverel;	/* list of relocation input section */
 					/* targeting to expanded area */
-	APlist		*ofl_parsyms; 	/* list of partially initialized */
+	APlist		*ofl_parsyms;	/* list of partially initialized */
 					/*	symbols (ie. move symbols) */
 	APlist		*ofl_extrarels;	/* relocation sections which have */
 					/*    a NULL sh_info */
@@ -467,6 +467,8 @@
 #define	FLG_OF_FATWARN	0x400000000000	/* make warnings fatal */
 #define	FLG_OF_ADEFLIB	0x800000000000	/* no libraries in default path */
 
+#define	FLG_OF_KMOD	0x1000000000000	/* output is a kernel module */
+
 /*
  * In the flags1 arena, establish any options that are applicable to archive
  * extraction first, and associate a mask.  These values are recorded with any
@@ -536,6 +538,7 @@
 #define	FLG_OFG_NO_MF		0x00000008	/* use v2 mapfile syntax */
 #define	FLG_OFG_NO_TEXT		0x00000010	/* verify pure text segment */
 #define	FLG_OFG_NO_UNUSED	0x00000020	/* remove unused dependency */
+#define	FLG_OFG_NO_KMOD		0x00000040	/* use -z type=kmod */
 
 /*
  * Test to see if a guidance should be given for a given category
@@ -879,7 +882,7 @@
 #define	FLG_IF_DISPPEND 0x00000800	/* displacement relocation done */
 					/*	in the ld time. */
 #define	FLG_IF_DISPDONE 0x00001000	/* displacement relocation done */
-					/* 	at the run time */
+					/*	at the run time */
 #define	FLG_IF_MAPFILE	0x00002000	/* file is a mapfile */
 #define	FLG_IF_HSTRTAB	0x00004000	/* file has a string section */
 #define	FLG_IF_FILEREF	0x00008000	/* file contains a section which */
@@ -916,11 +919,11 @@
 	Elf_Data	*is_indata;	/* input sections raw data */
 	Is_desc		*is_symshndx;	/* related SHT_SYM_SHNDX section */
 	Is_desc		*is_comdatkeep;	/* If COMDAT section is discarded, */
-					/* 	this is section that was kept */
+					/*	this is section that was kept */
 	Word		is_scnndx;	/* original section index in file */
 	Word		is_ordndx;	/* index for section.  Used to decide */
 					/*	where to insert section when */
-					/* 	reordering sections */
+					/*	reordering sections */
 	Word		is_keyident;	/* key for SHF_{ORDERED|LINK_ORDER} */
 					/*	processing and ident used for */
 					/*	 placing/ordering sections */
@@ -990,7 +993,7 @@
 					/*	by section symbol index */
 	Word		os_ordndx;	/* index for section.  Used to decide */
 					/*	where to insert section when */
-					/* 	reordering sections */
+					/*	reordering sections */
 	Xword		os_szoutrels;	/* size of output relocation section */
 	uint_t		os_namehash;	/* hash on section name */
 	uchar_t		os_flags;	/* various flags */
@@ -1067,7 +1070,7 @@
 #define	FLG_SG_P_FLAGS		0x0020	/* p_flags segment attribute set */
 #define	FLG_SG_P_TYPE		0x0040	/* p_type segment attribute set */
 #define	FLG_SG_IS_ORDER		0x0080	/* input section ordering is required */
-					/* 	for this segment. */
+					/*	for this segment. */
 #define	FLG_SG_NOHDR		0x0100	/* don't map ELF or phdrs into */
 					/*	this segment */
 #define	FLG_SG_EMPTY		0x0200	/* an empty segment specification */
@@ -1141,7 +1144,7 @@
 	Move		*md_move;	/* original Move entry */
 	Xword		md_start;	/* start position */
 	Xword		md_len;		/* length of initialization */
-	Word 		md_oidx;	/* output Move entry index */
+	Word		md_oidx;	/* output Move entry index */
 } Mv_desc;
 
 /*
@@ -1172,7 +1175,7 @@
  * important for performance.
  */
 struct sym_aux {
-	APlist 		*sa_dfiles;	/* files where symbol is defined */
+	APlist		*sa_dfiles;	/* files where symbol is defined */
 	Sym		sa_sym;		/* copy of symtab entry */
 	const char	*sa_vfile;	/* first unavailable definition */
 	const char	*sa_rfile;	/* file with first symbol referenced */
@@ -1184,6 +1187,7 @@
 	Half		sa_symspec;	/* special symbol ids */
 	Half		sa_overndx;	/* output file versioning index */
 	Half		sa_dverndx;	/* dependency versioning index */
+	Os_desc		*sa_boundsec;	/* output section of SECBOUND_ syms */
 };
 
 /*
@@ -1200,13 +1204,15 @@
  * These are the ids for processing of `Special symbols'.  They are used
  * to set the sym->sd_aux->sa_symspec field.
  */
-#define	SDAUX_ID_ETEXT	1		/* etext && _etext symbol */
-#define	SDAUX_ID_EDATA	2		/* edata && _edata symbol */
-#define	SDAUX_ID_END	3		/* end, _end, && _END_ symbol */
-#define	SDAUX_ID_DYN	4		/* DYNAMIC && _DYNAMIC symbol */
-#define	SDAUX_ID_PLT	5		/* _PROCEDURE_LINKAGE_TABLE_ symbol */
-#define	SDAUX_ID_GOT	6		/* _GLOBAL_OFFSET_TABLE_ symbol */
-#define	SDAUX_ID_START	7		/* START_ && _START_ symbol */
+#define	SDAUX_ID_ETEXT		1	/* etext && _etext symbol */
+#define	SDAUX_ID_EDATA		2	/* edata && _edata symbol */
+#define	SDAUX_ID_END		3	/* end, _end, && _END_ symbol */
+#define	SDAUX_ID_DYN		4	/* DYNAMIC && _DYNAMIC symbol */
+#define	SDAUX_ID_PLT		5	/* _PROCEDURE_LINKAGE_TABLE_ symbol */
+#define	SDAUX_ID_GOT		6	/* _GLOBAL_OFFSET_TABLE_ symbol */
+#define	SDAUX_ID_START		7	/* START_ && _START_ symbol */
+#define	SDAUX_ID_SECBOUND_START	8	/* __start_<section> symbols */
+#define	SDAUX_ID_SECBOUND_STOP	9	/* __stop_<section> symbols */
 
 /*
  * Flags for sym_desc.sd_flags
@@ -1226,7 +1232,7 @@
 #define	FLG_SY_NOTAVAIL	0x00000020	/* symbol is not available to the */
 					/*	application either because it */
 					/*	originates from an implicitly */
-					/* 	referenced shared object, or */
+					/*	referenced shared object, or */
 					/*	because it is not part of a */
 					/*	specified version. */
 #define	FLG_SY_REDUCED	0x00000040	/* a global is reduced to local */
@@ -1236,7 +1242,7 @@
 #define	FLG_SY_MAPREF	0x00000200	/* symbol reference generated by user */
 					/*	from mapfile */
 #define	FLG_SY_REFRSD	0x00000400	/* symbols sd_ref has been raised */
-					/* 	due to a copy-relocs */
+					/*	due to a copy-relocs */
 					/*	weak-strong pairing */
 #define	FLG_SY_INTPOSE	0x00000800	/* symbol defines an interposer */
 #define	FLG_SY_INVALID	0x00001000	/* unwanted/erroneous symbol */
--- old/usr/src/cmd/sgs/include/sgs.h	2019-04-08 18:51:05.304963169 +0000
+++ new/usr/src/cmd/sgs/include/sgs.h	2019-04-08 18:51:05.323403491 +0000
@@ -194,7 +194,8 @@
 #define	SGS_REJ_PLATCAP		16	/* platform capability mismatch */
 #define	SGS_REJ_HWCAP_2		17	/* hardware capabilities mismatch */
 #define	SGS_REJ_ARCHIVE		18	/* archive used in invalid context */
-#define	SGS_REJ_NUM		19
+#define	SGS_REJ_KMOD		19	/* object is a kernel module */
+#define	SGS_REJ_NUM		20
 
 #define	FLG_REJ_ALTER		0x01	/* object name is an alternative */
 
--- old/usr/src/cmd/sgs/libconv/common/dynamic.c	2019-04-08 18:51:05.782524403 +0000
+++ new/usr/src/cmd/sgs/libconv/common/dynamic.c	2019-04-08 18:51:05.799673826 +0000
@@ -114,7 +114,7 @@
 	MSG_DF_SYMBOLIC_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
 	MSG_DF_TEXTREL_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
 	MSG_DF_BIND_NOW_CF_SIZE		+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
-	MSG_DF_STATIC_TLS_CF_SIZE 	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
+	MSG_DF_STATIC_TLS_CF_SIZE	+ CONV_EXPN_FIELD_DEF_SEP_SIZE + \
 	CONV_INV_BUFSIZE + CONV_EXPN_FIELD_DEF_SUFFIX_SIZE
 
 	/*
@@ -557,8 +557,10 @@
 		MSG_DT_SUNW_LDMACH_CF,		0,
 		MSG_DT_SUNW_CAPCHAINENT_CF,	0,
 		MSG_DT_SUNW_CAPCHAINSZ_CF,	0,
-		0, 				0,
-		MSG_DT_SUNW_ASLR_CF
+		0,				0,
+		MSG_DT_SUNW_ASLR_CF,		0,
+		0,				0,
+		MSG_DT_SUNW_KMOD_CF
 	};
 	static const Msg	tags_sunw_auxiliary_cfnp[] = {
 		MSG_DT_SUNW_AUXILIARY_CFNP,	MSG_DT_SUNW_RTLDINF_CFNP,
@@ -572,7 +574,9 @@
 		MSG_DT_SUNW_CAPCHAINENT_CFNP,	0,
 		MSG_DT_SUNW_CAPCHAINSZ_CFNP,	0,
 		0,				0,
-		MSG_DT_SUNW_ASLR_CFNP
+		MSG_DT_SUNW_ASLR_CFNP,		0,
+		0,				0,
+		MSG_DT_SUNW_KMOD_CFNP
 	};
 	static const Msg	tags_sunw_auxiliary_nf[] = {
 		MSG_DT_SUNW_AUXILIARY_NF,	MSG_DT_SUNW_RTLDINF_NF,
@@ -586,7 +590,9 @@
 		MSG_DT_SUNW_CAPCHAINENT_NF,	0,
 		MSG_DT_SUNW_CAPCHAINSZ_NF,	0,
 		0,				0,
-		MSG_DT_SUNW_ASLR_NF
+		MSG_DT_SUNW_ASLR_NF,		0,
+		0,				0,
+		MSG_DT_SUNW_KMOD_NF
 	};
 	static const conv_ds_msg_t ds_sunw_auxiliary_cf = {
 	    CONV_DS_MSG_INIT(DT_SUNW_AUXILIARY, tags_sunw_auxiliary_cf) };
--- old/usr/src/cmd/sgs/libconv/common/dynamic.msg	2019-04-08 18:51:06.322176565 +0000
+++ new/usr/src/cmd/sgs/libconv/common/dynamic.msg	2019-04-08 18:51:06.337530061 +0000
@@ -175,12 +175,15 @@
 @ MSG_DT_SUNW_CAPCHAINENT_CF	"DT_SUNW_CAPCHAINENT"		# 0x6000001d
 @ MSG_DT_SUNW_CAPCHAINENT_CFNP		"SUNW_CAPCHAINENT"
 @ MSG_DT_SUNW_CAPCHAINENT_NF		"sunw_capchainent"
-@ MSG_DT_SUNW_CAPCHAINSZ_CF	"DT_SUNW_CAPCHAINSZ"		# 0x6000001d
+@ MSG_DT_SUNW_CAPCHAINSZ_CF	"DT_SUNW_CAPCHAINSZ"		# 0x6000001f
 @ MSG_DT_SUNW_CAPCHAINSZ_CFNP		"SUNW_CAPCHAINSZ"
 @ MSG_DT_SUNW_CAPCHAINSZ_NF		"sunw_capchainsz"
 @ MSG_DT_SUNW_ASLR_CF		"DT_SUNW_ASLR"			# 0x60000023
 @ MSG_DT_SUNW_ASLR_CFNP			"SUNW_ASLR"
 @ MSG_DT_SUNW_ASLR_NF			"sunw_aslr"
+@ MSG_DT_SUNW_KMOD_CF		"DT_SUNW_KMOD"			# 0x60000027
+@ MSG_DT_SUNW_KMOD_CFNP			"SUNW_KMOD"
+@ MSG_DT_SUNW_KMOD_NF			"sunw_kmod"
 
 @ MSG_DT_GNU_PRELINKED_CF	"DT_GNU_PRELINKED"		# 0x6ffffdf5
 @ MSG_DT_GNU_PRELINKED_CFNP		"GNU_PRELINKED"
--- old/usr/src/cmd/sgs/libconv/common/elf.c	2019-04-08 18:51:06.844289739 +0000
+++ new/usr/src/cmd/sgs/libconv/common/elf.c	2019-04-08 18:51:06.862931439 +0000
@@ -1211,6 +1211,7 @@
 		    &reject_desc_buf->flags_buf));
 	case SGS_REJ_UNKFILE:
 	case SGS_REJ_ARCHIVE:
+	case SGS_REJ_KMOD:
 		return (NULL);
 	case SGS_REJ_STR:
 	case SGS_REJ_HWCAP_1:
--- old/usr/src/cmd/sgs/libelf/common/gelf.c	2019-04-08 18:51:07.402301103 +0000
+++ new/usr/src/cmd/sgs/libelf/common/gelf.c	2019-04-08 18:51:07.421493105 +0000
@@ -698,7 +698,7 @@
 
 GElf_Sym *
 gelf_getsymshndx(Elf_Data *symdata, Elf_Data *shndxdata,
-	int ndx, GElf_Sym *symptr, Elf32_Word *xshndx)
+    int ndx, GElf_Sym *symptr, Elf32_Word *xshndx)
 {
 	if (gelf_getsym(symdata, ndx, symptr) == 0)
 		return (NULL);
@@ -719,7 +719,7 @@
 
 int
 gelf_update_symshndx(Elf_Data *symdata, Elf_Data *shndxdata,
-	int ndx, GElf_Sym *symptr, Elf32_Word xshndx)
+    int ndx, GElf_Sym *symptr, Elf32_Word xshndx)
 {
 	if (gelf_update_sym(symdata, ndx, symptr) == 0)
 		return (0);
@@ -1091,7 +1091,7 @@
  * Otherwise, return 0.
  */
 GElf_Xword
-_gelf_getdyndtflags_1(Elf *elf)
+_gelf_getdynval(Elf *elf, GElf_Sxword tag)
 {
 	Elf_Scn *scn = NULL;
 	Elf_Data *data;
@@ -1108,7 +1108,7 @@
 			n = shdr.sh_size / shdr.sh_entsize;
 			for (i = 0; i < n; i++) {
 				(void) gelf_getdyn(data, i, &dyn);
-				if (dyn.d_tag == DT_FLAGS_1) {
+				if (dyn.d_tag == tag) {
 					return (dyn.d_un.d_val);
 				}
 			}
@@ -1117,3 +1117,9 @@
 	}
 	return (0);
 }
+
+GElf_Xword
+_gelf_getdyndtflags_1(Elf *elf)
+{
+	return (_gelf_getdynval(elf, DT_FLAGS_1));
+}
--- old/usr/src/cmd/sgs/libelf/common/mapfile-vers	2019-04-08 18:51:07.962168086 +0000
+++ new/usr/src/cmd/sgs/libelf/common/mapfile-vers	2019-04-08 18:51:07.981092619 +0000
@@ -170,6 +170,7 @@
 	_elf_sys_encoding;
 	_elf_swap_wrimage;
 	_gelf_getdyndtflags_1;
+	_gelf_getdynval;
 
 $if _ELF32
 	elf_demangle;
--- old/usr/src/cmd/sgs/libld/common/args.c	2019-04-08 18:51:08.480950142 +0000
+++ new/usr/src/cmd/sgs/libld/common/args.c	2019-04-08 18:51:08.499755107 +0000
@@ -37,7 +37,7 @@
  *    OPTION			MEANING
  *
  *    -z dtrace=symbol		assigns symbol to PT_SUNWDTRACE segment,
- *    				providing scratch area for dtrace processing.
+ *				providing scratch area for dtrace processing.
  *
  *    -z noreloc		suppress relocation processing.  This provides
  *				a mechanism for validating kernel module symbol
@@ -103,7 +103,6 @@
 
 static Boolean	aflag	= FALSE;
 static Boolean	bflag	= FALSE;
-static Boolean	rflag	= FALSE;
 static Boolean	sflag	= FALSE;
 static Boolean	zinflag = FALSE;
 static Boolean	zlflag	= FALSE;
@@ -112,9 +111,17 @@
 static Boolean	Beflag	= FALSE;
 static Boolean	Bsflag	= FALSE;
 static Boolean	Dflag	= FALSE;
-static Boolean	Gflag	= FALSE;
 static Boolean	Vflag	= FALSE;
 
+enum output_type {
+	OT_RELOC,		/* relocatable object */
+	OT_SHARED,		/* shared object */
+	OT_EXEC,		/* dynamic executable */
+	OT_KMOD,		/* kernel module */
+};
+
+static enum output_type	otype = OT_EXEC;
+
 /*
  * ztflag's state is set by pointing it to the matching string:
  *	text | textoff | textwarn
@@ -228,6 +235,7 @@
 	(void) fprintf(stderr, MSG_INTL(MSG_ARG_DETAIL_ZT));
 	(void) fprintf(stderr, MSG_INTL(MSG_ARG_DETAIL_ZTO));
 	(void) fprintf(stderr, MSG_INTL(MSG_ARG_DETAIL_ZTW));
+	(void) fprintf(stderr, MSG_INTL(MSG_ARG_DETAIL_ZTY));
 	(void) fprintf(stderr, MSG_INTL(MSG_ARG_DETAIL_ZWRAP));
 	(void) fprintf(stderr, MSG_INTL(MSG_ARG_DETAIL_ZVER));
 }
@@ -313,18 +321,46 @@
 		ld_eprintf(ofl, ERR_FATAL, MSG_INTL(MSG_ARG_YP),
 		    Llibdir ? 'L' : 'U');
 
-	if (rflag) {
-		if (dflag == SET_UNKNOWN)
-			dflag = SET_FALSE;
+	if ((otype == OT_RELOC) || (otype == OT_KMOD)) {
+		if (otype == OT_RELOC) {
+			if (dflag == SET_UNKNOWN)
+				dflag = SET_FALSE;
+			if ((dflag == SET_TRUE) &&
+			    OFL_GUIDANCE(ofl, FLG_OFG_NO_KMOD)) {
+				ld_eprintf(ofl, ERR_GUIDANCE,
+				    MSG_INTL(MSG_GUIDE_KMOD));
+			}
+		} else if (otype == OT_KMOD) {
+			if (dflag != SET_UNKNOWN) {
+				ld_eprintf(ofl, ERR_FATAL,
+				    MSG_INTL(MSG_MARG_INCOMP),
+				    MSG_INTL(MSG_MARG_TYPE_KMOD),
+				    MSG_ORIG(MSG_ARG_D));
+			}
+
+			dflag = SET_TRUE;
+		}
+
 		/*
 		 * Combining relocations when building a relocatable
 		 * object isn't allowed.  Warn the user, but proceed.
 		 */
-		if (ofl->ofl_flags & FLG_OF_COMREL)
+		if (ofl->ofl_flags & FLG_OF_COMREL) {
+			const char *msg;
+
+			if (otype == OT_RELOC) {
+				msg = MSG_INTL(MSG_MARG_REL);
+			} else {
+				msg = MSG_INTL(MSG_MARG_TYPE_KMOD);
+			}
 			ld_eprintf(ofl, ERR_WARNING, MSG_INTL(MSG_MARG_INCOMP),
-			    MSG_INTL(MSG_MARG_REL),
+			    msg,
 			    MSG_ORIG(MSG_ARG_ZCOMBRELOC));
+		}
 		ofl->ofl_flags |= FLG_OF_RELOBJ;
+
+		if (otype == OT_KMOD)
+			ofl->ofl_flags |= FLG_OF_KMOD;
 	} else {
 		/*
 		 * Translating object capabilities to symbol capabilities is
@@ -375,7 +411,7 @@
 		    MSG_ORIG(MSG_ARG_ZRELAXRELOC),
 		    MSG_ORIG(MSG_ARG_ZNORELAXRELOC));
 
-	if (ofl->ofl_filtees && !Gflag)
+	if (ofl->ofl_filtees && (otype != OT_SHARED))
 		ld_eprintf(ofl, ERR_FATAL, MSG_INTL(MSG_MARG_ST_ONLYAVL),
 		    ((ofl->ofl_flags & FLG_OF_AUX) ?
 		    MSG_INTL(MSG_MARG_FILTER_AUX) : MSG_INTL(MSG_MARG_FILTER)));
@@ -429,7 +465,7 @@
 			ofl->ofl_guideflags |= FLG_OFG_NO_TEXT;
 		}
 
-		if (Gflag || !rflag) {
+		if ((otype == OT_SHARED) || (otype == OT_EXEC)) {
 			/*
 			 * Create a dynamic object.  -Bdirect indicates that all
 			 * references should be bound directly.  This also
@@ -469,7 +505,7 @@
 			}
 		}
 
-		if (!Gflag && !rflag) {
+		if (otype == OT_EXEC) {
 			/*
 			 * Dynamically linked executable.
 			 */
@@ -493,7 +529,7 @@
 				ld_eprintf(ofl, ERR_FATAL,
 				    MSG_INTL(MSG_MARG_DY_INCOMP),
 				    MSG_INTL(MSG_MARG_SONAME));
-		} else if (!rflag) {
+		} else if (otype == OT_SHARED) {
 			/*
 			 * Shared library.
 			 */
@@ -543,6 +579,9 @@
 				    MSG_INTL(MSG_MARG_REL),
 				    MSG_ORIG(MSG_ARG_CI));
 		}
+
+		assert((ofl->ofl_flags & (FLG_OF_SHAROBJ|FLG_OF_EXEC)) !=
+		    (FLG_OF_SHAROBJ|FLG_OF_EXEC));
 	} else {
 		ofl->ofl_flags |= FLG_OF_STATIC;
 
@@ -564,14 +603,14 @@
 		if (ztflag)
 			ld_eprintf(ofl, ERR_FATAL, MSG_INTL(MSG_ARG_ST_INCOMP),
 			    MSG_ORIG(MSG_ARG_ZTEXTALL));
-		if (Gflag)
+		if (otype == OT_SHARED)
 			ld_eprintf(ofl, ERR_FATAL, MSG_INTL(MSG_MARG_ST_INCOMP),
 			    MSG_INTL(MSG_MARG_SO));
-		if (aflag && rflag)
+		if (aflag && (otype == OT_RELOC))
 			ld_eprintf(ofl, ERR_FATAL, MSG_INTL(MSG_MARG_INCOMP),
 			    MSG_ORIG(MSG_ARG_A), MSG_INTL(MSG_MARG_REL));
 
-		if (rflag) {
+		if (otype == OT_RELOC) {
 			/*
 			 * We can only strip the symbol table and string table
 			 * if no output relocations will refer to them.
@@ -717,7 +756,7 @@
 
 	/*
 	 * The argument being examined is either:
-	 *	ld32= 	or
+	 *	ld32=	or
 	 *	ld64=
 	 */
 #if	defined(_LP64)
@@ -917,8 +956,8 @@
 /*
  * Parse the -z assert-deflib option. This option can appear in two different
  * forms:
- * 	-z assert-deflib
- * 	-z assert-deflib=libfred.so
+ *	-z assert-deflib
+ *	-z assert-deflib=libfred.so
  *
  * Either form enables this option, the latter form marks libfred.so as an
  * exempt library from the check. It is valid to have multiple invocations of
@@ -1201,7 +1240,7 @@
 
 		case 'r':
 			DBG_CALL(Dbg_args_option(ofl->ofl_lml, ndx, c, NULL));
-			rflag = TRUE;
+			otype = OT_RELOC;
 			break;
 
 		case 'R':
@@ -1509,6 +1548,40 @@
 			    MSG_ARG_ASSDEFLIB_SIZE) == 0) {
 				if (assdeflib_parse(ofl, optarg) != TRUE)
 					return (S_ERROR);
+
+			/*
+			 * Process new-style output type specification, which
+			 * we'll use in pass 2 and throughout.
+			 */
+			} else if (strncmp(optarg, MSG_ORIG(MSG_ARG_TYPE),
+			    MSG_ARG_TYPE_SIZE) == 0) {
+				char *p = optarg + MSG_ARG_TYPE_SIZE;
+				if (*p != '=') {
+					ld_eprintf(ofl, ERR_FATAL,
+					    MSG_INTL(MSG_ARG_ILLEGAL),
+					    MSG_ORIG(MSG_ARG_Z), optarg);
+					return (S_ERROR);
+				}
+
+				p++;
+				if (strcmp(p,
+				    MSG_ORIG(MSG_ARG_TYPE_RELOC)) == 0) {
+					otype = OT_RELOC;
+				} else if (strcmp(p,
+				    MSG_ORIG(MSG_ARG_TYPE_EXEC)) == 0) {
+					otype = OT_EXEC;
+				} else if (strcmp(p,
+				    MSG_ORIG(MSG_ARG_TYPE_SHARED)) == 0) {
+					otype = OT_SHARED;
+				} else if (strcmp(p,
+				    MSG_ORIG(MSG_ARG_TYPE_KMOD)) == 0) {
+					otype = OT_KMOD;
+				} else {
+					ld_eprintf(ofl, ERR_FATAL,
+					    MSG_INTL(MSG_ARG_ILLEGAL),
+					    MSG_ORIG(MSG_ARG_Z), optarg);
+					return (S_ERROR);
+				}
 			/*
 			 * The following options just need validation as they
 			 * are interpreted on the second pass through the
@@ -1627,7 +1700,7 @@
 
 		case 'G':
 			DBG_CALL(Dbg_args_option(ofl->ofl_lml, ndx, c, NULL));
-			Gflag = TRUE;
+			otype = OT_SHARED;
 			break;
 
 		case 'L':
--- old/usr/src/cmd/sgs/libld/common/files.c	2019-04-08 18:51:09.317584356 +0000
+++ new/usr/src/cmd/sgs/libld/common/files.c	2019-04-08 18:51:09.351673880 +0000
@@ -2356,7 +2356,7 @@
 static uintptr_t
 rel_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl)
 {
-	Word 	rndx;
+	Word	rndx;
 	Is_desc	*risc;
 	Os_desc	*osp;
 	Shdr	*shdr = isc->is_shdr;
@@ -3193,6 +3193,21 @@
 			if (rej->rej_type == 0) {
 				*rej = _rej;
 				rej->rej_name = strdup(_rej.rej_name);
+			}
+			return (0);
+		}
+
+		if (_gelf_getdynval(elf, DT_SUNW_KMOD) > 0) {
+			_rej.rej_name = name;
+			DBG_CALL(Dbg_file_rejected(ofl->ofl_lml, &_rej,
+			    ld_targ.t_m.m_mach));
+			_rej.rej_type = SGS_REJ_KMOD;
+			_rej.rej_str = elf_errmsg(-1);
+			_rej.rej_name = name;
+
+			if (rej->rej_type == 0) {
+				*rej = _rej;
+				rej->rej_name = strdup(_rej.rej_name);
 			}
 			return (0);
 		}
--- old/usr/src/cmd/sgs/libld/common/globals.c	2019-04-08 18:51:13.561722455 +0000
+++ new/usr/src/cmd/sgs/libld/common/globals.c	2019-04-08 18:51:13.576936184 +0000
@@ -34,7 +34,7 @@
 #include	"_libld.h"
 
 Ld_heap		*ld_heap;	/* list of allocated blocks for */
-				/* 	link-edit dynamic allocations */
+				/*	link-edit dynamic allocations */
 APlist		*lib_support;	/* list of support libraries specified */
 				/*	(-S option) */
 int		demangle_flag;	/* symbol demangling required */
@@ -78,9 +78,10 @@
 		MSG_REJ_MACHCAP,	/* MSG_INTL(MSG_REJ_MACHCAP) */
 		MSG_REJ_PLATCAP,	/* MSG_INTL(MSG_REJ_PLATCAP) */
 		MSG_REJ_HWCAP_2,	/* MSG_INTL(MSG_REJ_HWCAP_2) */
-		MSG_REJ_ARCHIVE		/* MSG_INTL(MSG_REJ_ARCHIVE) */
+		MSG_REJ_ARCHIVE,	/* MSG_INTL(MSG_REJ_ARCHIVE) */
+		MSG_REJ_KMOD		/* MSG_INTL(MSG_REJ_KMOD) */
 	};
-#if SGS_REJ_NUM != (SGS_REJ_ARCHIVE + 1)
+#if SGS_REJ_NUM != (SGS_REJ_KMOD + 1)
 #error SGS_REJ_NUM has changed
 #endif
 
--- old/usr/src/cmd/sgs/libld/common/libld.msg	2019-04-08 18:51:19.263743436 +0000
+++ new/usr/src/cmd/sgs/libld/common/libld.msg	2019-04-08 18:51:19.312746927 +0000
@@ -36,7 +36,7 @@
 
 #
 # TRANSLATION_NOTE -- Beginning of USAGE message
-# 	The following messages are the usage messages for the ld command.
+#	The following messages are the usage messages for the ld command.
 #	Tab characters (\t) are used to align the messages.
 #
 #	Each usage message starts with \t, and if the message has more than one
@@ -54,9 +54,9 @@
 #	In C locale, the first 3 messages would look like the following:
 #
 #	usage: ld [-6:abc:.....] file(s)
-#        	[-a]            create an absolute file
-#        	[-b]            do not do special PIC relocations in a.out
-#        	[-c file]       record configuration 'file'
+#		[-a]		create an absolute file
+#		[-b]		do not do special PIC relocations in a.out
+#		[-c file]	record configuration 'file'
 #
 @ MSG_ARG_USAGE		"usage: ld [-%s] file(s)\n"
 @ MSG_ARG_DETAIL_3	"\t[-32]\t\tenforce a 32-bit link-edit\n"
@@ -251,6 +251,8 @@
 			 text\n"
 @ MSG_ARG_DETAIL_ZTW	"\t[-z textwarn]\twarn if there are relocations \
 			 against text\n"
+@ MSG_ARG_DETAIL_ZTY	"\t[-z type=type]\tspecify the type of object \
+			 (exec, kmod, reloc, shared)\n"
 @ MSG_ARG_DETAIL_ZWRAP	"\t[-z wrap=symbol], [-wrap=symbol], [--wrap=symbol]\n\
 			 \t\t\twrap symbol references\n"
 @ MSG_ARG_DETAIL_ZVER	"\t[-z verbose]\t\
@@ -353,13 +355,13 @@
 
 #
 # TRANSLATION_NOTE
-# 	The following 7 messages are the message to print the
+#	The following 7 messages are the message to print the
 #	following example messages.
 #
 #Text relocation remains		      referenced
 #    against symbol		    offset	in file
-#str                                 0x14      	main.o
-#printf                              0x1c      	main.o
+#str				     0x14	main.o
+#printf				     0x1c	main.o
 #
 #	The first two lines are the header, and the next msgid
 #	is the format string for the header.
@@ -476,7 +478,7 @@
 
 @ MSG_SCN_DWFOVRFLW	"%s: section %s: encoded DWARF data exceeds \
 			 section size"
-@ MSG_SCN_DWFBADENC	"%s: section %s: invalid DWARF encoding: %#x"                         
+@ MSG_SCN_DWFBADENC	"%s: section %s: invalid DWARF encoding: %#x"
 
 # Symbol processing errors
 
@@ -543,11 +545,11 @@
 
 #
 # TRANSLATION_NOTE
-# 	The following 7 messages are the message to print the
+#	The following 7 messages are the message to print the
 #	following example messages.
 #
 #Undefined			first referenced
-# symbol  			    in file
+# symbol			    in file
 #inquire                            halt_hold.o
 #
 @ MSG_SYM_FMT_UNDEF	"%s\t\t\t%s\
@@ -694,6 +696,7 @@
 @ MSG_REJ_HWCAP_2	"file %s: hardware capability (CA_SUNW_HW_2) \
 			 unsupported: %s"
 @ MSG_REJ_ARCHIVE	"file %s: invalid archive use"
+@ MSG_REJ_KMOD		"file %s: kernel modules can't be link-edit input"
 
 # Guidance messages
 @ MSG_GUIDE_SUMMARY	"see ld(1) -z guidance for more information"
@@ -706,6 +709,7 @@
 @ MSG_GUIDE_TEXT	"position independent (PIC) code recommended for \
 			 shared objects"
 @ MSG_GUIDE_UNUSED	"removal of unused dependency recommended: %s"
+@ MSG_GUIDE_KMOD	"use -z type=kmod, not -r -dy"
 
 @ _END_
 
@@ -879,6 +883,9 @@
 @ MSG_SYM_L_START	"START_"
 @ MSG_SYM_L_START_U	"_START_"
 
+@ MSG_SYM_SECBOUND_START "__start_"
+@ MSG_SYM_SECBOUND_STOP "__stop_"
+
 # Support functions
 
 @ MSG_SUP_VERSION	"ld_version"
@@ -898,10 +905,10 @@
 @ MSG_SUP_INSEC		"ld_input_section"
 @ MSG_SUP_SEC		"ld_section"
 
-# 
+#
 # Message previously in 'ld'
 #
-# 
+#
 @ _START_
 
 # System error messages
@@ -962,11 +969,13 @@
 @ MSG_MARG_FILTER_AUX	"auxiliary filter option (-f, --auxiliary)"
 @ MSG_MARG_FILTER	"filter option (-F, --filter)"
 @ MSG_MARG_OUTFILE	"output object option (-o, --output)"
-@ MSG_MARG_REL		"relocatable object option (-r, --relocatable)"
+@ MSG_MARG_REL		"relocatable object option (-r, --relocatable, \
+			-z type=reloc)"
 @ MSG_MARG_RPATH	"runpath option (-R, -rpath)"
-@ MSG_MARG_SO		"shared object option (-G, -shared)"
+@ MSG_MARG_SO		"shared object option (-G, -shared, -z type=shared)"
 @ MSG_MARG_SONAME	"soname option (-h, --soname)"
 @ MSG_MARG_STRIP	"strip option (-s, --strip-all)"
+@ MSG_MARG_TYPE_KMOD	"-z type=kmod"
 
 # Entrance criteria messages
 
@@ -979,7 +988,7 @@
 # The next message is a format string for a title. The title is composed of
 # two lines. In C locale, it would look like:
 #
-# 	output		input		new
+#	output		input		new
 #	section		section		displacement	size
 #
 # The \t characters are used for alignment.  (output section), (input section),
@@ -1307,7 +1316,7 @@
 @ MSG_STR_PATH		"%s/%s"
 @ MSG_STR_STRNL		"%s\n"
 @ MSG_STR_NL		"\n"
-@ MSG_STR_CAPGROUPID 	"CAP_GROUP_%d"
+@ MSG_STR_CAPGROUPID	"CAP_GROUP_%d"
 
 @ MSG_STR_LD_DYNAMIC	"dynamic"
 @ MSG_STR_SYMBOLIC	"symbolic"
@@ -1443,6 +1452,7 @@
 @ MSG_ARG_DEFERRED	"deferred"
 @ MSG_ARG_NODEFERRED	"nodeferred"
 @ MSG_ARG_ASSDEFLIB	"assert-deflib"
+@ MSG_ARG_TYPE		"type"
 
 @ MSG_ARG_LCOM		"L,"
 @ MSG_ARG_PCOM		"P,"
@@ -1492,6 +1502,12 @@
 @ MSG_ARG_GUIDE_NO_TEXT		"notext"
 @ MSG_ARG_GUIDE_NO_UNUSED	"nounused"
 
+# -z type= strings
+@ MSG_ARG_TYPE_RELOC	"reloc"
+@ MSG_ARG_TYPE_EXEC	"exec"
+@ MSG_ARG_TYPE_SHARED	"shared"
+@ MSG_ARG_TYPE_KMOD	"kmod"
+
 # Environment variable strings
 
 @ MSG_LD_RUN_PATH	"LD_RUN_PATH"
--- old/usr/src/cmd/sgs/libld/common/relocate.c	2019-04-08 18:51:24.770909016 +0000
+++ new/usr/src/cmd/sgs/libld/common/relocate.c	2019-04-08 18:51:24.785043295 +0000
@@ -76,12 +76,12 @@
  */
 typedef struct copy_rel {
 	Sym_desc	*c_sdp;		/* symbol descriptor to be copied */
-	Addr 		c_val;		/* original symbol value */
+	Addr		c_val;		/* original symbol value */
 } Copy_rel;
 
 /*
  * For each copy relocation symbol, determine if the symbol is:
- * 	1) to be *disp* relocated at runtime
+ *	1) to be *disp* relocated at runtime
  *	2) a reference symbol for *disp* relocation
  *	3) possibly *disp* relocated at ld time.
  *
@@ -2264,7 +2264,7 @@
 	Shdr		*rshdr = rsect->is_shdr;
 	Is_desc		*misp;
 	Shdr		*mshdr;
-	Xword 		midx;
+	Xword		midx;
 	Move		*mvp;
 
 	/*
@@ -2296,8 +2296,8 @@
 {
 	Ifl_desc	*file = rsect->is_file;
 	Rel		*rend, *reloc;
-	Xword 		rsize, entsize;
-	Rel_desc 	reld;
+	Xword		rsize, entsize;
+	Rel_desc	reld;
 	Rel_aux	rel_aux;
 
 	rsize = rsect->is_shdr->sh_size;
@@ -2961,7 +2961,7 @@
 ld_am_I_partial(Rel_desc *reld, Xword val)
 {
 	Ifl_desc	*ifile = reld->rel_sym->sd_isc->is_file;
-	int 		nlocs = ifile->ifl_locscnt, i;
+	int		nlocs = ifile->ifl_locscnt, i;
 
 	for (i = 1; i < nlocs; i++) {
 		Sym		*osym;
--- old/usr/src/cmd/sgs/libld/common/sections.c	2019-04-08 18:51:28.240474010 +0000
+++ new/usr/src/cmd/sgs/libld/common/sections.c	2019-04-08 18:51:28.311648352 +0000
@@ -1274,6 +1274,10 @@
 			cnt++;
 	}
 
+	/* DT_SUNW_KMOD */
+	if (ofl->ofl_flags & FLG_OF_KMOD)
+		cnt++;
+
 	/*
 	 * Account for Architecture dependent .dynamic entries, and defaults.
 	 */
@@ -2432,7 +2436,7 @@
 	Is_desc		*isec;
 	size_t		size;
 	Xword		sh_flags;
-	char 		*sectname;
+	char		*sectname;
 	Os_desc		*rosp;
 	Word		relsize;
 	const char	*rel_prefix;
@@ -2663,7 +2667,7 @@
 	Is_desc		*isec;
 	Aliste		idx;
 	Sym_desc	*sdp;
-	int 		cnt = 1;
+	int		cnt = 1;
 
 
 	if (new_section(ofl, SHT_SUNW_move, MSG_ORIG(MSG_SCN_SUNWMOVE),
--- old/usr/src/cmd/sgs/libld/common/syms.c	2019-04-08 18:51:31.015728533 +0000
+++ new/usr/src/cmd/sgs/libld/common/syms.c	2019-04-08 18:51:31.062181757 +0000
@@ -636,7 +636,7 @@
     sd_flag_t sdflags_u, sd_flag_t sdflags, Ofl_desc *ofl)
 {
 	Sym_desc	*sdp;
-	Sym_desc 	*usdp;
+	Sym_desc	*usdp;
 	Sym		*sym;
 	Word		hash;
 	avl_index_t	where;
@@ -692,9 +692,10 @@
 				usdp->sd_flags |= FLG_SY_MAPUSED;
 
 			DBG_CALL(Dbg_syms_updated(ofl, usdp, uname));
-		} else
+		} else {
 			ld_eprintf(ofl, ERR_WARNING, MSG_INTL(MSG_SYM_RESERVE),
 			    uname, usdp->sd_file->ifl_name);
+		}
 	} else {
 		/*
 		 * If the symbol does not exist create it.
@@ -795,7 +796,7 @@
  *
  *  -	the symbol has been defined by an implicitly supplied library, ie. one
  *	which was encounted because it was NEEDED by another library, rather
- * 	than from a command line supplied library which would become the only
+ *	than from a command line supplied library which would become the only
  *	dependency of the output file being produced.
  *
  *  -	the symbol has been defined by a version of a shared object that is
@@ -885,6 +886,72 @@
 }
 
 /*
+ * If an undef symbol exists naming a bound for the output section,
+ * turn it into a defined symbol with the correct value.
+ *
+ * We set an arbitrary 1KB limit on the resulting symbol names.
+ */
+static void
+sym_add_bounds(Ofl_desc *ofl, Os_desc *osp, Word bound)
+{
+	Sym_desc *bsdp;
+	char symn[1024];
+	size_t nsz;
+
+	switch (bound) {
+	case SDAUX_ID_SECBOUND_START:
+		nsz = snprintf(symn, sizeof (symn), "%s%s",
+		    MSG_ORIG(MSG_SYM_SECBOUND_START), osp->os_name);
+		if (nsz >= sizeof (symn))
+			return;
+		break;
+	case SDAUX_ID_SECBOUND_STOP:
+		nsz = snprintf(symn, sizeof (symn), "%s%s",
+		    MSG_ORIG(MSG_SYM_SECBOUND_STOP), osp->os_name);
+		if (nsz >= sizeof (symn))
+			return;
+		break;
+	default:
+		assert(0);
+	}
+
+	if ((bsdp = ld_sym_find(symn, SYM_NOHASH, NULL, ofl)) != NULL) {
+		if ((bsdp->sd_shndx != SHN_UNDEF) &&
+		    (bsdp->sd_ref == REF_REL_NEED)) {
+			ld_eprintf(ofl, ERR_WARNING, MSG_INTL(MSG_SYM_RESERVE),
+			    symn, bsdp->sd_file->ifl_name);
+			return;
+		}
+
+		DBG_CALL(Dbg_syms_updated(ofl, bsdp, symn));
+
+		bsdp->sd_aux->sa_symspec = bound;
+		bsdp->sd_aux->sa_boundsec = osp;
+		bsdp->sd_flags |= FLG_SY_SPECSEC;
+		bsdp->sd_ref = REF_REL_NEED;
+		bsdp->sd_sym->st_info = ELF_ST_INFO(STB_GLOBAL, STT_NOTYPE);
+		bsdp->sd_sym->st_other = STV_PROTECTED;
+		bsdp->sd_isc = NULL;
+		bsdp->sd_sym->st_size = 0;
+		bsdp->sd_sym->st_value = 0;
+		bsdp->sd_shndx = bsdp->sd_sym->st_shndx = SHN_ABS;
+	}
+}
+
+static Boolean
+is_cname(const char *name)
+{
+	if (strlen(name) == strspn(name,
+	    "abcdefghijklmnopqrstuvwxyz"
+	    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+	    "0123456789"
+	    "_"))
+		return (TRUE);
+	else
+		return (FALSE);
+}
+
+/*
  * At this point all symbol input processing has been completed, therefore
  * complete the symbol table entries by generating any necessary internal
  * symbols.
@@ -893,12 +960,40 @@
 ld_sym_spec(Ofl_desc *ofl)
 {
 	Sym_desc	*sdp;
+	Sg_desc		*sgp;
+
+	DBG_CALL(Dbg_syms_spec_title(ofl->ofl_lml));
+
+	/*
+	 * For each section in the output file, look for symbols named for the
+	 * __start/__stop patterns.  If references exist, flesh the symbols to
+	 * be defined.
+	 *
+	 * The symbols are given values at the same time as the other special
+	 * symbols.
+	 */
+	if (!(ofl->ofl_flags & FLG_OF_RELOBJ) ||
+	    (ofl->ofl_flags & FLG_OF_KMOD)) {
+		Aliste		idx1;
+
+		for (APLIST_TRAVERSE(ofl->ofl_segs, idx1, sgp)) {
+			Os_desc *osp;
+			Aliste idx2;
+
+			for (APLIST_TRAVERSE(sgp->sg_osdescs, idx2, osp)) {
+				if (is_cname(osp->os_name)) {
+					sym_add_bounds(ofl, osp,
+					    SDAUX_ID_SECBOUND_START);
+					sym_add_bounds(ofl, osp,
+					    SDAUX_ID_SECBOUND_STOP);
+				}
+			}
+		}
+	}
 
 	if (ofl->ofl_flags & FLG_OF_RELOBJ)
 		return (1);
 
-	DBG_CALL(Dbg_syms_spec_title(ofl->ofl_lml));
-
 	if (sym_add_spec(MSG_ORIG(MSG_SYM_ETEXT), MSG_ORIG(MSG_SYM_ETEXT_U),
 	    SDAUX_ID_ETEXT, 0, (FLG_SY_DEFAULT | FLG_SY_EXPDEF),
 	    ofl) == S_ERROR)
@@ -1133,7 +1228,7 @@
  * or modified), validate and count the relevant entries:
  *
  *  -	check and print any undefined symbols remaining.  Note that if a symbol
- *	has been defined by virtue of the inclusion of 	an implicit shared
+ *	has been defined by virtue of the inclusion of	an implicit shared
  *	library, it is still classed as undefined.
  *
  *  -	count the number of global needed symbols together with the size of
@@ -1141,7 +1236,7 @@
  *	symbols may be reduced to locals).
  *
  *  -	establish the size and alignment requirements for the global .bss
- *	section (the alignment of this section is based on the 	first symbol
+ *	section (the alignment of this section is based on the first symbol
  *	that it will contain).
  */
 uintptr_t
@@ -1890,7 +1985,7 @@
  * input sections from this input file have been assigned an input section
  * descriptor which is saved in the `ifl_isdesc' array.
  *
- *  -	local symbols are saved (as is) if the input file is a 	relocatable
+ *  -	local symbols are saved (as is) if the input file is a	relocatable
  *	object
  *
  *  -	global symbols are added to the linkers internal symbol table if they
--- old/usr/src/cmd/sgs/libld/common/update.c	2019-04-08 18:51:34.236823965 +0000
+++ new/usr/src/cmd/sgs/libld/common/update.c	2019-04-08 18:51:34.254291759 +0000
@@ -184,7 +184,7 @@
 #endif
 	Addr		bssaddr, etext = 0, edata = 0, end = 0, start = 0;
 	Addr		tlsbssaddr = 0;
-	Addr 		parexpnbase, parexpnaddr;
+	Addr		parexpnbase, parexpnaddr;
 	int		start_set = 0;
 	Sym		_sym = {0}, *sym, *symtab = NULL;
 	Sym		*dynsym = NULL, *ldynsym = NULL;
@@ -1333,7 +1333,7 @@
 				 *	keyword in a mapfile.
 				 *
 				 *  -	Symbol reference has been bound to a
-				 * 	dependency which was specified as
+				 *	dependency which was specified as
 				 *	requiring direct bindings with -zdirect.
 				 *
 				 *  -	All symbol references are required to
@@ -1768,6 +1768,19 @@
 				    ofl_osgot->os_scn);
 				sdp->sd_flags &= ~FLG_SY_SPECSEC;
 				break;
+			case SDAUX_ID_SECBOUND_START:
+				sym->st_value = sap->sa_boundsec->
+				    os_shdr->sh_addr;
+				sectndx = elf_ndxscn(sap->sa_boundsec->os_scn);
+				sdp->sd_flags &= ~FLG_SY_SPECSEC;
+				break;
+			case SDAUX_ID_SECBOUND_STOP:
+				sym->st_value = sap->sa_boundsec->
+				    os_shdr->sh_addr +
+				    sap->sa_boundsec->os_shdr->sh_size;
+				sectndx = elf_ndxscn(sap->sa_boundsec->os_scn);
+				sdp->sd_flags &= ~FLG_SY_SPECSEC;
+				break;
 			default:
 				/* NOTHING */
 				;
@@ -2579,6 +2592,12 @@
 	dyn->d_un.d_val = ld_sunw_ldmach();
 	dyn++;
 
+	if (ofl->ofl_flags & FLG_OF_KMOD) {
+		dyn->d_tag = DT_SUNW_KMOD;
+		dyn->d_un.d_val = 1;
+		dyn++;
+	}
+
 	(*ld_targ.t_mr.mr_mach_update_odynamic)(ofl, &dyn);
 
 	for (cnt = 1 + DYNAMIC_EXTRA_ELTS; cnt--; dyn++) {
@@ -3157,7 +3176,7 @@
 					    imvp->m_info);
 				}
 			} else {
-				Boolean 	isredloc = FALSE;
+				Boolean		isredloc = FALSE;
 
 				if ((ELF_ST_BIND(sym->st_info) == STB_LOCAL) &&
 				    (ofl->ofl_flags & FLG_OF_REDLSYM))
@@ -3652,7 +3671,7 @@
 	DBG_CALL(Dbg_seg_title(ofl->ofl_lml));
 	for (APLIST_TRAVERSE(ofl->ofl_segs, idx1, sgp)) {
 		Phdr		*phdr = &(sgp->sg_phdr);
-		Xword 		p_align;
+		Xword		p_align;
 		Aliste		idx2;
 		Sym_desc	*sdp;
 
@@ -3872,8 +3891,8 @@
 			 * Check overlaps
 			 */
 			for (i = 0; i < phdrndx - 1; i++) {
-				Addr 	p_s = (ofl->ofl_phdr[i]).p_vaddr;
-				Addr 	p_e;
+				Addr	p_s = (ofl->ofl_phdr[i]).p_vaddr;
+				Addr	p_e;
 
 				if ((ofl->ofl_phdr[i]).p_type != PT_LOAD)
 					continue;
--- old/usr/src/cmd/sgs/packages/common/SUNWonld-README	2019-04-08 18:51:37.016072921 +0000
+++ new/usr/src/cmd/sgs/packages/common/SUNWonld-README	2019-04-08 18:51:37.032145096 +0000
@@ -1663,3 +1663,5 @@
 8616	ld has trouble parsing -z options specified with -Wl
 10267	ld and GCC disagree about i386 local dynamic TLS
 10471	ld(1) amd64 LD->LE TLS transition causes memory corruption
+10366	ld(1) should support GNU-style linker sets
+10581	ld(1) should know kernel modules are a thing
--- old/usr/src/cmd/sgs/rtld/common/globals.c	2019-04-08 18:51:40.001379532 +0000
+++ new/usr/src/cmd/sgs/rtld/common/globals.c	2019-04-08 18:51:40.018322378 +0000
@@ -117,7 +117,7 @@
 APlist		*hdl_alp[HDLIST_SZ+2];	/* dlopen() handle list */
 size_t		syspagsz = 0;		/* system page size */
 ulong_t		at_flags = 0;		/* machine specific file flags */
-Uts_desc	*uts = NULL; 		/* utsname descriptor */
+Uts_desc	*uts = NULL;		/* utsname descriptor */
 Isa_desc	*isa = NULL;		/* isalist descriptor */
 
 uint_t		audit_argcnt = 64;	/* no. of stack args to copy (default */
@@ -231,9 +231,10 @@
 		MSG_LDD_REJ_MACHCAP,	/* MSG_INTL(MSG_LDD_REJ_MACHCAP) */
 		MSG_LDD_REJ_PLATCAP,	/* MSG_INTL(MSG_LDD_REJ_PLATCAP) */
 		MSG_LDD_REJ_HWCAP_2,	/* MSG_INTL(MSG_LDD_REJ_HWCAP_2) */
-		MSG_LDD_REJ_ARCHIVE	/* MSG_INTL(MSG_LDD_REJ_ARCHIVE) */
+		MSG_LDD_REJ_ARCHIVE,	/* MSG_INTL(MSG_LDD_REJ_ARCHIVE) */
+		MSG_LDD_REJ_KMOD	/* MSG_INTL(MSG_LDD_REJ_KMOD) */
 	};
-#if SGS_REJ_NUM != (SGS_REJ_ARCHIVE + 1)
+#if SGS_REJ_NUM != (SGS_REJ_KMOD + 1)
 #error SGS_REJ_NUM has changed
 #endif
 
@@ -258,8 +259,9 @@
 		MSG_ERR_REJ_PLATCAP,	/* MSG_INTL(MSG_ERR_REJ_PLATCAP) */
 		MSG_ERR_REJ_HWCAP_2,	/* MSG_INTL(MSG_ERR_REJ_HWCAP_2) */
 		MSG_ERR_REJ_ARCHIVE,	/* MSG_INTL(MSG_ERR_REJ_ARCHIVE) */
+		MSG_ERR_REJ_KMOD,	/* MSG_INTL(MSG_ERR_REJ_KMOD) */
 	};
-#if SGS_REJ_NUM != (SGS_REJ_ARCHIVE + 1)
+#if SGS_REJ_NUM != (SGS_REJ_KMOD + 1)
 #error SGS_REJ_NUM has changed
 #endif
 
@@ -283,8 +285,9 @@
 		MSG_LDD_WARN_MACHCAP,	/* MSG_INTL(MSG_LDD_WARN_MACHCAP) */
 		MSG_LDD_WARN_PLATCAP,	/* MSG_INTL(MSG_LDD_WARN_PLATCAP) */
 		MSG_LDD_WARN_HWCAP_2,	/* MSG_INTL(MSG_LDD_WARN_HWCAP_2) */
-		MSG_STR_EMPTY
+		MSG_STR_EMPTY,
+		MSG_STR_EMPTY,
 	};
-#if SGS_REJ_NUM != (SGS_REJ_ARCHIVE + 1)
+#if SGS_REJ_NUM != (SGS_REJ_KMOD + 1)
 #error SGS_REJ_NUM has changed
 #endif
--- old/usr/src/cmd/sgs/rtld/common/rtld.msg	2019-04-08 18:51:42.638961315 +0000
+++ new/usr/src/cmd/sgs/rtld/common/rtld.msg	2019-04-08 18:51:42.879993564 +0000
@@ -194,6 +194,7 @@
 @ MSG_LDD_REJ_PLATCAP	"  - platform capability (CA_SUNW_PLAT) unsupported: %s"
 @ MSG_LDD_REJ_HWCAP_2	"  - hardware capability (CA_SUNW_HW_2) unsupported: %s"
 @ MSG_LDD_REJ_ARCHIVE	"  - invalid archive use"
+@ MSG_LDD_REJ_KMOD	"  - invalid kernel module use"
 
 @ MSG_LDD_WARN_UNKCAP	"%s: unknown capability: %d"
 @ MSG_LDD_WARN_HWCAP_1	"%s: warning: hardware capability (CA_SUNW_HW_1) \
@@ -227,6 +228,7 @@
 @ MSG_ERR_REJ_PLATCAP	"%s: platform capability (CA_SUNW_PLAT) unsupported: %s"
 @ MSG_ERR_REJ_HWCAP_2	"%s: hardware capability (CA_SUNW_HW_2) unsupported: %s"
 @ MSG_ERR_REJ_ARCHIVE	"%s: invalid archive use"
+@ MSG_ERR_REJ_KMOD	"%s: invalid kernel module use"
 
 # Error TLS failures
 
@@ -236,7 +238,7 @@
 			 link-map list"
 @ MSG_TLS_STATSIZE	"%s: static TLS failure: object loaded after process \
 			 initialization: size (%#llx) exceeds available backup \
-			 reservation (%#llx)"  
+			 reservation (%#llx)"
 @ MSG_TLS_STATINIT	"%s: static TLS failure: object loaded after process \
 			 initialization: can not accommodate initialized data"
 
--- old/usr/src/man/man1/ld.1	2019-04-08 18:51:46.042306710 +0000
+++ new/usr/src/man/man1/ld.1	2019-04-08 18:51:46.063171411 +0000
@@ -24,7 +24,7 @@
 [\fB-z\fR combreloc | nocombreloc ] [\fB-z\fR defs | nodefs]
 [\fB-z\fR direct | nodirect] [\fB-z\fR endfiltee]
 [\fB-z\fR fatal-warnings | nofatal-warnings ] [\fB-z\fR finiarray=\fIfunction\fR]
-[\fB-z\fR globalaudit] [\fB-z\fR groupperm | nogroupperm] 
+[\fB-z\fR globalaudit] [\fB-z\fR groupperm | nogroupperm]
 [\fB-z\fR guidance[=\fIid1\fR,\fIid2\fR...] [\fB-z\fR help ]
 [\fB-z\fR ignore | record] [\fB-z\fR initarray=\fIfunction\fR] [\fB-z\fR initfirst]
 [\fB-z\fR interpose] [\fB-z\fR lazyload | nolazyload]
@@ -35,6 +35,7 @@
 [\fB-z\fR preinitarray=\fIfunction\fR] [\fB-z\fR redlocsym] [\fB-z\fR relaxreloc]
 [\fB-z\fR rescan-now] [\fB-z\fR recan] [\fB-z\fR rescan-start \fI\&...\fR \fB-z\fR rescan-end]]
 [\fB-z\fR target=sparc|x86] [\fB-z\fR text | textwarn | textoff]
+[\fB-z\fR type=\fIexec\fR|\fIkmod\fR|\fIreloc\fR|\fIshared\fR]
 [\fB-z\fR verbose] [\fB-z\fR wrap=\fIsymbol\fR] \fIfilename\fR...
 .fi
 
@@ -1581,6 +1582,56 @@
 .RE
 
 .sp
+.ne 2
+.na
+\fB-z\fR \fBtype=exec|kmod|reloc|shared\fR
+.ad
+.sp .6
+.RS 4n
+Specifies the type of object to create.
+
+.sp
+.ne 2
+.na
+exec
+.ad
+.sp .6
+.RS 4n
+Dynamic executable
+.RE
+
+.sp
+.ne 2
+.na
+reloc
+.ad
+.sp .6
+.RS 4n
+Relocatable object
+.RE
+
+.sp
+.ne 2
+.na
+shared
+.ad
+.sp .6
+.RS 4n
+Dynamic shared object
+.RE
+
+.sp
+.ne 2
+.na
+kmod
+.ad
+.sp .6
+.RS 4n
+illumos kernel module
+.RE
+.RE
+
+.sp
 .ne 2
 .na
 \fB\fB-z\fR \fBverbose\fR\fR
--- old/usr/src/pkg/manifests/system-test-elftest.mf	2019-04-08 18:51:50.901613995 +0000
+++ new/usr/src/pkg/manifests/system-test-elftest.mf	2019-04-08 18:51:50.932848370 +0000
@@ -24,6 +24,7 @@
 dir path=opt/elf-tests/runfiles
 dir path=opt/elf-tests/tests
 dir path=opt/elf-tests/tests/assert-deflib
+dir path=opt/elf-tests/tests/linker-sets
 dir path=opt/elf-tests/tests/tls
 dir path=opt/elf-tests/tests/tls/amd64
 dir path=opt/elf-tests/tests/tls/amd64/ie
@@ -35,6 +36,10 @@
 file path=opt/elf-tests/runfiles/default.run mode=0444
 file path=opt/elf-tests/tests/assert-deflib/link.c mode=0444
 file path=opt/elf-tests/tests/assert-deflib/test-deflib mode=0555
+file path=opt/elf-tests/tests/linker-sets/in-use-check mode=0555
+file path=opt/elf-tests/tests/linker-sets/simple mode=0555
+file path=opt/elf-tests/tests/linker-sets/simple-src.c mode=0444
+file path=opt/elf-tests/tests/linker-sets/simple.out 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
--- old/usr/src/test/elf-tests/runfiles/default.run	2019-04-08 18:51:53.587832674 +0000
+++ new/usr/src/test/elf-tests/runfiles/default.run	2019-04-08 18:51:53.618107698 +0000
@@ -20,10 +20,12 @@
 post =
 outputdir = /var/tmp/test_results
 
+[/opt/elf-tests/tests/linker-sets]
+tests = ['simple', 'in-use-check']
+
 [/opt/elf-tests/tests/assert-deflib]
 tests = ['test-deflib']
 
-
 [/opt/elf-tests/tests/tls/amd64/ie]
 arch = i86pc
 tests = ['amd64-ie-test']
--- old/usr/src/test/elf-tests/tests/Makefile	2019-04-08 18:51:56.164874691 +0000
+++ new/usr/src/test/elf-tests/tests/Makefile	2019-04-08 18:51:56.413084252 +0000
@@ -16,6 +16,7 @@
 
 SUBDIRS =		\
 	assert-deflib	\
+	linker-sets	\
 	tls
 
 include $(SRC)/test/Makefile.com
--- /dev/null	2019-04-08 18:51:58.000000000 +0000
+++ new/usr/src/test/elf-tests/tests/linker-sets/Makefile	2019-04-08 18:51:58.813729959 +0000
@@ -0,0 +1,50 @@
+#
+# 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 2018, Richard Lowe.
+
+include $(SRC)/cmd/Makefile.cmd
+include $(SRC)/test/Makefile.com
+
+PROG =	simple in-use-check
+
+DATAFILES =	simple-src.c \
+		simple.out
+
+ROOTOPTPKG = $(ROOT)/opt/elf-tests
+TESTDIR = $(ROOTOPTPKG)/tests/linker-sets
+
+CMDS = $(PROG:%=$(TESTDIR)/%)
+$(CMDS) := FILEMODE = 0555
+
+
+DATA = $(DATAFILES:%=$(TESTDIR)/%)
+$(DATA) := FILEMODE = 0444
+
+all: $(PROG)
+
+install: all $(CMDS) $(DATA)
+
+lint:
+
+clobber: clean
+	-$(RM) $(PROG)
+
+clean:
+	-$(RM) $(CLEANFILES)
+
+$(CMDS): $(TESTDIR) $(PROG)
+
+$(TESTDIR):
+	$(INS.dir)
+
+$(TESTDIR)/%: %
+	$(INS.file)
--- /dev/null	2019-04-08 18:52:00.000000000 +0000
+++ new/usr/src/test/elf-tests/tests/linker-sets/in-use-check.sh	2019-04-08 18:51:59.983726174 +0000
@@ -0,0 +1,53 @@
+#!/usr/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 2018, Richard Lowe.
+#
+
+# Test that existing definitions of the start/stop symbols are reported
+# as conflicting with internal symbols.
+
+tmpdir=/tmp/test.$$
+mkdir $tmpdir
+cd $tmpdir
+
+cleanup() {
+    cd /
+    rm -fr $tmpdir
+}
+
+trap 'cleanup' EXIT
+
+cat > broken.c <<EOF
+char foo[1024] __attribute__((section("set_foo")));
+void *__start_set_foo;
+
+int
+main()
+{
+	return (0);
+}
+EOF
+
+# We expect any alternate linker to be in LD_ALTEXEC for us already
+gcc -o broken broken.c -Wall -Wextra -Wl,-zfatal-warnings > in-use.$$.out 2>&1
+if (( $? == 0 )); then
+    print -u2 "use of a reserved symbol didn't fail"
+    exit 1;
+fi
+
+grep -q "^ld: warning: reserved symbol '__start_set_foo' already defined in file" in-use.$$.out
+if (( $? != 0 )); then
+    print -u2 "use of a reserved symbol failed for the wrong reason"
+    exit 1;
+fi
--- /dev/null	2019-04-08 18:52:01.000000000 +0000
+++ new/usr/src/test/elf-tests/tests/linker-sets/simple-src.c	2019-04-08 18:52:01.637010054 +0000
@@ -0,0 +1,105 @@
+/* The meat of this file is a copy of the FreeBSD sys/link_set.h */
+/*
+ * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
+ *
+ * Copyright (c) 1999 John D. Polstra
+ * Copyright (c) 1999,2001 Peter Wemm <peter@FreeBSD.org>
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * $FreeBSD$
+ */
+
+#include <stdio.h>
+
+#define	MAKE_SET(set, sym)					\
+	__asm__(".globl __start_set_" #set);			\
+	__asm__(".globl __stop_set_" #set);			\
+	static __attribute__((section("set_" #set), used))	\
+	void const *__set_##set##_sym_##sym = &(sym)
+
+/*
+ * Initialize before referring to a given linker set.
+ */
+#define	SET_DECLARE(set, ptype)						\
+	extern  __attribute__((weak)) ptype *__start_set_ ## set;	\
+	extern __attribute__((weak)) ptype *__stop_set_ ## set
+
+#define	SET_BEGIN(set)	(&__start_set_ ## set)
+#define	SET_LIMIT(set)	(&__stop_set_ ## set)
+
+/*
+ * Iterate over all the elements of a set.
+ *
+ * Sets always contain addresses of things, and "pvar" points to words
+ * containing those addresses.  Thus is must be declared as "type **pvar",
+ * and the address of each set item is obtained inside the loop by "*pvar".
+ */
+#define	SET_FOREACH(pvar, set)						\
+	for (pvar = SET_BEGIN(set); pvar < SET_LIMIT(set); pvar++)
+
+#define	SET_ITEM(set, i)						\
+	((SET_BEGIN(set))[i])
+
+/*
+ * Provide a count of the items in a set.
+ */
+#define	SET_COUNT(set)							\
+	(SET_LIMIT(set) - SET_BEGIN(set))
+
+struct foo {
+	char buf[128];
+};
+
+SET_DECLARE(foo, struct foo);
+
+struct foo a = { "foo" };
+struct foo b = { "bar" };
+struct foo c = { "baz" };
+
+MAKE_SET(foo, a);
+MAKE_SET(foo, b);
+MAKE_SET(foo, c);
+
+int
+main(int __attribute__((unused)) argc, char __attribute__((unused)) **argv)
+{
+	struct foo **c;
+	int i = 0;
+
+	printf("Set count: %d\n", SET_COUNT(foo));
+
+
+	printf("a: %s\n", ((struct foo *)__set_foo_sym_a)->buf);
+	printf("b: %s\n", ((struct foo *)__set_foo_sym_b)->buf);
+	printf("c: %s\n", ((struct foo *)__set_foo_sym_c)->buf);
+
+	printf("item(foo, 0): %s\n", SET_ITEM(foo, 0)->buf);
+	printf("item(foo, 1): %s\n", SET_ITEM(foo, 1)->buf);
+	printf("item(foo, 2): %s\n", SET_ITEM(foo, 2)->buf);
+
+	SET_FOREACH(c, foo) {
+		printf("foo[%d]: %s\n", i, (*c)->buf);
+		i++;
+	}
+}
--- /dev/null	2019-04-08 18:52:03.000000000 +0000
+++ new/usr/src/test/elf-tests/tests/linker-sets/simple.out	2019-04-08 18:52:03.172788375 +0000
@@ -0,0 +1,10 @@
+Set count: 3
+a: foo
+b: bar
+c: baz
+item(foo, 0): foo
+item(foo, 1): bar
+item(foo, 2): baz
+foo[0]: foo
+foo[1]: bar
+foo[2]: baz
--- /dev/null	2019-04-08 18:52:05.000000000 +0000
+++ new/usr/src/test/elf-tests/tests/linker-sets/simple.sh	2019-04-08 18:52:04.923782533 +0000
@@ -0,0 +1,51 @@
+#!/usr/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 2018, Richard Lowe.
+#
+
+# Test that a simple use of linker-sets, that is, automatically generated start
+# and end symbols for sections can be generated and used.
+
+TESTDIR=$(dirname $0)
+
+tmpdir=/tmp/test.$$
+mkdir $tmpdir
+cd $tmpdir
+
+cleanup() {
+    cd /
+    rm -fr $tmpdir
+}
+
+trap 'cleanup' EXIT
+
+# We expect any alternate linker to be in LD_ALTEXEC for us already
+gcc -o simple ${TESTDIR}/simple-src.c -Wall -Wextra
+if (( $? != 0 )); then
+    print -u2 "compilation of ${TESTDIR}/simple-src.c failed";
+    exit 1;
+fi
+
+./simple > simple.$$.out 2>&1
+
+if (( $? != 0 )); then
+    print -u2 "execution of ${TESTDIR}/simple-src.c failed";
+    exit 1;
+fi
+
+diff -u ${TESTDIR}/simple.out simple.$$.out
+if (( $? != 0 )); then
+    print -u2 "${TESTDIR}/simple-src.c output mismatch"
+    exit 1;
+fi
--- old/usr/src/uts/common/sys/link.h	2019-04-08 18:52:06.875297077 +0000
+++ new/usr/src/uts/common/sys/link.h	2019-04-08 18:52:06.946795836 +0000
@@ -161,6 +161,7 @@
 #define	DT_SUNW_CAPCHAINSZ	0x6000001f	/* capabilities chain size */
 /* 0x60000021 would be DT_SUNW_PARENT */
 #define	DT_SUNW_ASLR		0x60000023	/* executable ASLR desire */
+#define	DT_SUNW_KMOD		0x60000027	/* object is a kernel module */
 
 /*
  * DT_* encoding rules do not apply between DT_HIOS and DT_LOPROC
@@ -230,7 +231,7 @@
 #define	DT_VERDEF	0x6ffffffc	/* version definition table and */
 #define	DT_VERDEFNUM	0x6ffffffd	/*	associated no. of entries */
 #define	DT_VERNEED	0x6ffffffe	/* version needed table and */
-#define	DT_VERNEEDNUM	0x6fffffff	/* 	associated no. of entries */
+#define	DT_VERNEEDNUM	0x6fffffff	/*	associated no. of entries */
 
 /*
  * DT_* entries between DT_HIPROC and DT_LOPROC are reserved for processor
@@ -366,7 +367,7 @@
 	Elf32_Word	vna_next;	/* no. of bytes from start of this */
 } Elf32_Vernaux;			/*	vernaux to next vernaux entry */
 
-typedef	Elf32_Half 	Elf32_Versym;	/* Version symbol index array */
+typedef	Elf32_Half	Elf32_Versym;	/* Version symbol index array */
 
 typedef struct {
 	Elf32_Half	si_boundto;	/* direct bindings - symbol bound to */
@@ -464,7 +465,7 @@
 #define	SYMINFO_FLG_DIRECT	0x0001	/* symbol ref has direct association */
 					/*	to object containing defn. */
 #define	SYMINFO_FLG_FILTER	0x0002	/* symbol ref is associated to a */
-					/* 	standard filter */
+					/*	standard filter */
 #define	SYMINFO_FLG_PASSTHRU	SYMINFO_FLG_FILTER /* unused obsolete name */
 #define	SYMINFO_FLG_COPY	0x0004	/* symbol is a copy-reloc */
 #define	SYMINFO_FLG_LAZYLOAD	0x0008	/* object containing defn. should be */
@@ -474,7 +475,7 @@
 #define	SYMINFO_FLG_NOEXTDIRECT	0x0020	/* don't let an external reference */
 					/*	directly bind to this symbol */
 #define	SYMINFO_FLG_AUXILIARY	0x0040	/* symbol ref is associated to a */
-					/* 	auxiliary filter */
+					/*	auxiliary filter */
 #define	SYMINFO_FLG_INTERPOSE	0x0080	/* symbol defines an interposer */
 #define	SYMINFO_FLG_CAP		0x0100	/* symbol is capabilities specific */
 #define	SYMINFO_FLG_DEFERRED	0x0200	/* symbol should not be included in */
@@ -506,7 +507,7 @@
 
 struct link_map {
 	unsigned long	l_addr;		/* address at which object is mapped */
-	char 		*l_name;	/* full name of loaded object */
+	char		*l_name;	/* full name of loaded object */
 #ifdef _LP64
 	Elf64_Dyn	*l_ld;		/* dynamic structure of object */
 #else
--- old/usr/src/uts/intel/genunix/Makefile	2019-04-08 18:52:09.508288550 +0000
+++ new/usr/src/uts/intel/genunix/Makefile	2019-04-08 18:52:09.518656462 +0000
@@ -156,8 +156,19 @@
 
 install:	$(INSTALL_DEPS)
 
-$(LIBGEN):	$(GENUNIX) $(LIBSTUBS)
-	$(BUILD.SO) $(GENUNIX) $(LIBSTUBS)
+# Due to what seems to be an issue in GCC 4 generated DWARF containing
+# symbolic relocations against non-allocatable .debug sections, libgenunix.so
+# must be built from a stripped object, thus we create an intermediary
+# libgenunix.o we can safely strip.
+LIBGENUNIX_O = $(OBJS_DIR)/libgenunix.o
+CLEANFILES += $(LIBGENUNIX_O)
+
+$(LIBGENUNIX_O): $(OBJECTS)
+	$(LD) -r -o $(OBJS_DIR)/libgenunix.o $(OBJECTS)
+	$(STRIP) -x $(OBJS_DIR)/libgenunix.o
+
+$(LIBGEN):	$(LIBGENUNIX_O) $(LIBSTUBS)
+	$(BUILD.SO) $(LIBGENUNIX_O) $(LIBSTUBS)
 
 $(IPCTF_TARGET) ipctf_target: FRC
 	@cd $(IPDRV_DIR); pwd; $(MAKE) ipctf.$(OBJS_DIR)
--- old/usr/src/uts/sun4u/blade/platmod/Makefile	2019-04-08 18:52:10.831025608 +0000
+++ new/usr/src/uts/sun4u/blade/platmod/Makefile	2019-04-08 18:52:10.846550740 +0000
@@ -23,8 +23,6 @@
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
 #	This makefile drives the production of the sun4u blade platform module.
@@ -95,8 +93,8 @@
 
 LINT_LIB_DIR	= $(BLADE_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/boston/platmod/Makefile	2019-04-08 18:52:12.575468955 +0000
+++ new/usr/src/uts/sun4u/boston/platmod/Makefile	2019-04-08 18:52:12.606895078 +0000
@@ -23,9 +23,7 @@
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
-# uts/sun4u/boston/platmod/Makefile
+
 #
 # This makefile drives the production of the sun4u boston platform module.
 #
@@ -95,8 +93,8 @@
 
 LINT_LIB_DIR	= $(BOSTON_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/cheetah/Makefile	2019-04-08 18:52:13.932410803 +0000
+++ new/usr/src/uts/sun4u/cheetah/Makefile	2019-04-08 18:52:13.944549277 +0000
@@ -97,8 +97,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/cheetahplus/Makefile	2019-04-08 18:52:15.332967345 +0000
+++ new/usr/src/uts/sun4u/cheetahplus/Makefile	2019-04-08 18:52:15.352255466 +0000
@@ -103,8 +103,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/cherrystone/platmod/Makefile	2019-04-08 18:52:16.745885273 +0000
+++ new/usr/src/uts/sun4u/cherrystone/platmod/Makefile	2019-04-08 18:52:16.759416157 +0000
@@ -98,8 +98,8 @@
 
 LINT_LIB_DIR	= $(CHERRYSTONE_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/chicago/platmod/Makefile	2019-04-08 18:52:17.661198766 +0000
+++ new/usr/src/uts/sun4u/chicago/platmod/Makefile	2019-04-08 18:52:17.679845312 +0000
@@ -94,8 +94,8 @@
 
 LINT_LIB_DIR	= $(CHICAGO_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/daktari/platmod/Makefile	2019-04-08 18:52:18.498403460 +0000
+++ new/usr/src/uts/sun4u/daktari/platmod/Makefile	2019-04-08 18:52:18.506791468 +0000
@@ -97,10 +97,10 @@
 
 check:
 
-LINT_LIB_DIR	=$(DAKTARI_LINT_LIB_DIR)
+LINT_LIB_DIR	= $(DAKTARI_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/darwin/platmod/Makefile	2019-04-08 18:52:20.066549685 +0000
+++ new/usr/src/uts/sun4u/darwin/platmod/Makefile	2019-04-08 18:52:20.084318172 +0000
@@ -23,8 +23,6 @@
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
 #	This makefile drives the production of the sun4u darwin platform module.
@@ -95,8 +93,8 @@
 
 LINT_LIB_DIR	= $(DARWIN_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/enchilada/platmod/Makefile	2019-04-08 18:52:20.871496963 +0000
+++ new/usr/src/uts/sun4u/enchilada/platmod/Makefile	2019-04-08 18:52:20.891242046 +0000
@@ -23,8 +23,6 @@
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
 # This makefile drives the production of the sun4u enchilada platform module.
@@ -95,8 +93,8 @@
 
 LINT_LIB_DIR	= $(ENCHILADA_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/excalibur/platmod/Makefile	2019-04-08 18:52:21.659801412 +0000
+++ new/usr/src/uts/sun4u/excalibur/platmod/Makefile	2019-04-08 18:52:21.778734610 +0000
@@ -23,8 +23,6 @@
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
 #	This makefile drives the production of the sun4u excalibur platform
@@ -96,8 +94,8 @@
 
 LINT_LIB_DIR	= $(EXCALIBUR_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/fjlite/platmod/Makefile	2019-04-08 18:52:22.728210801 +0000
+++ new/usr/src/uts/sun4u/fjlite/platmod/Makefile	2019-04-08 18:52:22.744331331 +0000
@@ -23,8 +23,6 @@
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
 #	This makefile drives the production of the sun4u fjlite platform module.
@@ -95,8 +93,8 @@
 
 LINT_LIB_DIR	= $(FJLITE_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/genunix/Makefile	2019-04-08 18:52:23.570661894 +0000
+++ new/usr/src/uts/sun4u/genunix/Makefile	2019-04-08 18:52:23.620130813 +0000
@@ -89,9 +89,9 @@
 IPCTF_TARGET	= $(IPCTF)
 $(PATCH_BUILD)IPCTF_TARGET =
 
-# 
-# lint pass one enforcement 
-# 
+#
+# lint pass one enforcement
+#
 CFLAGS += $(CCVERBOSE)
 CPPFLAGS += -I$(SRC)/common
 CPPFLAGS += -I$(SRC)/uts/common/fs/zfs
@@ -147,13 +147,13 @@
 
 clean.lint:	$(CLEAN_LINT_DEPS)
 
-install:  	$(INSTALL_DEPS)
+install:	$(INSTALL_DEPS)
 
 install_h:
 
 
-$(LIBGEN):	$(GENUNIX) $(LIBSTUBS)
-	$(BUILD.SO) $(GENUNIX) $(LIBSTUBS)
+$(LIBGEN):	$(OBJECTS) $(LIBSTUBS)
+	$(BUILD.SO) $(OBJECTS) $(LIBSTUBS)
 
 $(IPCTF_TARGET) ipctf_target: FRC
 	@cd $(IPDRV_DIR); pwd; $(MAKE) ipctf.$(OBJS_DIR)
--- old/usr/src/uts/sun4u/grover/platmod/Makefile	2019-04-08 18:52:24.073717644 +0000
+++ new/usr/src/uts/sun4u/grover/platmod/Makefile	2019-04-08 18:52:24.094740346 +0000
@@ -23,8 +23,6 @@
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
 #	This makefile drives the production of the sun4u grover platform module.
@@ -95,8 +93,8 @@
 
 LINT_LIB_DIR	= $(GROVER_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/hummingbird/Makefile	2019-04-08 18:52:24.490618784 +0000
+++ new/usr/src/uts/sun4u/hummingbird/Makefile	2019-04-08 18:52:24.508923897 +0000
@@ -97,8 +97,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/jalapeno/Makefile	2019-04-08 18:52:25.631817531 +0000
+++ new/usr/src/uts/sun4u/jalapeno/Makefile	2019-04-08 18:52:25.644010647 +0000
@@ -102,8 +102,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@echo "resolving symbols against unix.o"
@@ -128,7 +128,7 @@
 LINTTAGS	+= -erroff=E_PTRDIFF_OVERFLOW
 LINTTAGS	+= -erroff=E_ASSIGN_NARROW_CONV
 
-CERRWARN 	+= -_gcc=-Wno-parentheses
-CERRWARN 	+= -_gcc=-Wno-uninitialized
-CERRWARN 	+= -_gcc=-Wno-type-limits
-CERRWARN 	+= -_gcc=-Wno-clobbered
+CERRWARN	+= -_gcc=-Wno-parentheses
+CERRWARN	+= -_gcc=-Wno-uninitialized
+CERRWARN	+= -_gcc=-Wno-type-limits
+CERRWARN	+= -_gcc=-Wno-clobbered
--- old/usr/src/uts/sun4u/javelin/platmod/Makefile	2019-04-08 18:52:26.238118876 +0000
+++ new/usr/src/uts/sun4u/javelin/platmod/Makefile	2019-04-08 18:52:26.278990160 +0000
@@ -23,8 +23,6 @@
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
 #	This makefile drives the production of the sun4u javelin platmod module
@@ -93,8 +91,8 @@
 
 LINT_LIB_DIR	=$(JAVELIN_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/littleneck/platmod/Makefile	2019-04-08 18:52:27.710240004 +0000
+++ new/usr/src/uts/sun4u/littleneck/platmod/Makefile	2019-04-08 18:52:27.735942553 +0000
@@ -23,8 +23,6 @@
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
 #	This makefile drives the production of the sun4u lneck platform module.
@@ -99,8 +97,8 @@
 
 LINT_LIB_DIR	= $(LITTLENECK_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/lw8/platmod/Makefile	2019-04-08 18:52:28.504944860 +0000
+++ new/usr/src/uts/sun4u/lw8/platmod/Makefile	2019-04-08 18:52:28.513491722 +0000
@@ -102,8 +102,8 @@
 
 LINT_LIB_DIR	=$(LW8_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/opl/olympus_c/Makefile	2019-04-08 18:52:29.164380999 +0000
+++ new/usr/src/uts/sun4u/opl/olympus_c/Makefile	2019-04-08 18:52:29.176340022 +0000
@@ -101,8 +101,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@$(ECHO) "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/platmod/Makefile	2019-04-08 18:52:30.311397480 +0000
+++ new/usr/src/uts/sun4u/platmod/Makefile	2019-04-08 18:52:30.332308310 +0000
@@ -23,8 +23,6 @@
 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
 #	This makefile drives the production of the sun4u default platform
@@ -93,8 +91,8 @@
 
 install_h:
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 #
 #	Include common targets.
--- old/usr/src/uts/sun4u/seattle/platmod/Makefile	2019-04-08 18:52:30.909298808 +0000
+++ new/usr/src/uts/sun4u/seattle/platmod/Makefile	2019-04-08 18:52:30.949980399 +0000
@@ -23,9 +23,7 @@
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
-# uts/sun4u/seattle/platmod/Makefile
+
 #
 # This makefile drives the production of the sun4u seattle platform module.
 #
@@ -95,8 +93,8 @@
 
 LINT_LIB_DIR	= $(SEATTLE_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/serengeti/cheetah/Makefile	2019-04-08 18:52:31.781272505 +0000
+++ new/usr/src/uts/sun4u/serengeti/cheetah/Makefile	2019-04-08 18:52:31.796006716 +0000
@@ -110,8 +110,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/serengeti/cheetahplus/Makefile	2019-04-08 18:52:32.680224930 +0000
+++ new/usr/src/uts/sun4u/serengeti/cheetahplus/Makefile	2019-04-08 18:52:32.688806770 +0000
@@ -116,8 +116,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/serengeti/platmod/Makefile	2019-04-08 18:52:33.362728505 +0000
+++ new/usr/src/uts/sun4u/serengeti/platmod/Makefile	2019-04-08 18:52:33.378964189 +0000
@@ -101,10 +101,10 @@
 
 check:
 
-LINT_LIB_DIR	=$(SERENGETI_LINT_LIB_DIR)
+LINT_LIB_DIR	= $(SERENGETI_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/serrano/Makefile	2019-04-08 18:52:34.477737758 +0000
+++ new/usr/src/uts/sun4u/serrano/Makefile	2019-04-08 18:52:34.542908662 +0000
@@ -102,8 +102,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@echo "resolving symbols against unix.o"
@@ -128,7 +128,7 @@
 LINTTAGS	+= -erroff=E_PTRDIFF_OVERFLOW
 LINTTAGS	+= -erroff=E_ASSIGN_NARROW_CONV
 
-CERRWARN 	+= -_gcc=-Wno-parentheses
-CERRWARN 	+= -_gcc=-Wno-uninitialized
-CERRWARN 	+= -_gcc=-Wno-type-limits
-CERRWARN 	+= -_gcc=-Wno-clobbered
+CERRWARN	+= -_gcc=-Wno-parentheses
+CERRWARN	+= -_gcc=-Wno-uninitialized
+CERRWARN	+= -_gcc=-Wno-type-limits
+CERRWARN	+= -_gcc=-Wno-clobbered
--- old/usr/src/uts/sun4u/snowbird/platmod/Makefile	2019-04-08 18:52:35.681984647 +0000
+++ new/usr/src/uts/sun4u/snowbird/platmod/Makefile	2019-04-08 18:52:35.692906194 +0000
@@ -23,8 +23,6 @@
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
 #	This makefile drives the production of the sun4u snowbird platform
@@ -96,8 +94,8 @@
 
 LINT_LIB_DIR	= $(SNOWBIRD_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/spitfire/Makefile	2019-04-08 18:52:37.076848104 +0000
+++ new/usr/src/uts/sun4u/spitfire/Makefile	2019-04-08 18:52:37.092846351 +0000
@@ -109,8 +109,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/starcat/cheetah/Makefile	2019-04-08 18:52:38.477058509 +0000
+++ new/usr/src/uts/sun4u/starcat/cheetah/Makefile	2019-04-08 18:52:38.622590225 +0000
@@ -107,8 +107,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/starcat/cheetahplus/Makefile	2019-04-08 18:52:39.958896011 +0000
+++ new/usr/src/uts/sun4u/starcat/cheetahplus/Makefile	2019-04-08 18:52:39.989762883 +0000
@@ -114,8 +114,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/starcat/platmod/Makefile	2019-04-08 18:52:41.926575909 +0000
+++ new/usr/src/uts/sun4u/starcat/platmod/Makefile	2019-04-08 18:52:41.986465222 +0000
@@ -89,8 +89,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 #
 #	Include common targets.
--- old/usr/src/uts/sun4u/taco/platmod/Makefile	2019-04-08 18:52:43.196718504 +0000
+++ new/usr/src/uts/sun4u/taco/platmod/Makefile	2019-04-08 18:52:43.244476570 +0000
@@ -23,8 +23,6 @@
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
 #	This makefile drives the production of the sun4u taco platform module.
@@ -95,8 +93,8 @@
 
 LINT_LIB_DIR	= $(TACO_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4u/tazmo/platmod/Makefile	2019-04-08 18:52:44.545417779 +0000
+++ new/usr/src/uts/sun4u/tazmo/platmod/Makefile	2019-04-08 18:52:44.573420173 +0000
@@ -23,8 +23,6 @@
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
 #	This makefile drives the production of the sun4u tazmo platform module.
@@ -95,8 +93,8 @@
 
 LINT_LIB_DIR	= $(TAZMO_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4v/generic/Makefile	2019-04-08 18:52:45.816778009 +0000
+++ new/usr/src/uts/sun4v/generic/Makefile	2019-04-08 18:52:45.833545286 +0000
@@ -113,8 +113,8 @@
 
 install:		$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4v/genunix/Makefile	2019-04-08 18:52:46.955159639 +0000
+++ new/usr/src/uts/sun4v/genunix/Makefile	2019-04-08 18:52:46.971489817 +0000
@@ -97,9 +97,9 @@
 IPCTF_TARGET	= $(IPCTF)
 $(PATCH_BUILD)IPCTF_TARGET =
 
-# 
-# lint pass one enforcement 
-# 
+#
+# lint pass one enforcement
+#
 CFLAGS += $(CCVERBOSE)
 CPPFLAGS += -I$(SRC)/common
 CPPFLAGS += -I$(SRC)/uts/common/fs/zfs
@@ -156,10 +156,10 @@
 
 clean.lint:	$(CLEAN_LINT_DEPS)
 
-install:  	$(INSTALL_DEPS)
+install:	$(INSTALL_DEPS)
 
-$(LIBGEN):	$(GENUNIX) $(LIBSTUBS)
-	$(BUILD.SO) $(GENUNIX) $(LIBSTUBS)
+$(LIBGEN):	$(OBJECTS) $(LIBSTUBS)
+	$(BUILD.SO) $(OBJECTS) $(LIBSTUBS)
 
 $(GENUNIX): $(IPCTF_TARGET) $(OBJECTS)
 	@pwd
--- old/usr/src/uts/sun4v/kt/Makefile	2019-04-08 18:52:48.043687400 +0000
+++ new/usr/src/uts/sun4v/kt/Makefile	2019-04-08 18:52:48.052337180 +0000
@@ -103,8 +103,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4v/montoya/platmod/Makefile	2019-04-08 18:52:49.367350761 +0000
+++ new/usr/src/uts/sun4v/montoya/platmod/Makefile	2019-04-08 18:52:49.375224070 +0000
@@ -23,11 +23,9 @@
 # Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
-#	This makefile drives the production of the sun4v montoya default 
+#	This makefile drives the production of the sun4v montoya default
 #	platform module.
 #
 #	sun4v implementation architecture dependent
@@ -101,10 +99,10 @@
 
 check:
 
-LINT_LIB_DIR	=$(MONTOYA_LINT_LIB_DIR)
+LINT_LIB_DIR	= $(MONTOYA_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4v/niagara/Makefile	2019-04-08 18:52:50.121334756 +0000
+++ new/usr/src/uts/sun4v/niagara/Makefile	2019-04-08 18:52:50.133061487 +0000
@@ -96,8 +96,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4v/niagara2/Makefile	2019-04-08 18:52:50.534108880 +0000
+++ new/usr/src/uts/sun4v/niagara2/Makefile	2019-04-08 18:52:50.553289119 +0000
@@ -19,11 +19,10 @@
 # CDDL HEADER END
 #
 #
-# uts/sun4v/niagara2/Makefile
 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
+
 #
 #	This makefile drives the production of the UltraSPARC-T2 cpu module.
 #
@@ -106,8 +105,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4v/ontario/platmod/Makefile	2019-04-08 18:52:51.044743799 +0000
+++ new/usr/src/uts/sun4v/ontario/platmod/Makefile	2019-04-08 18:52:51.055680150 +0000
@@ -23,11 +23,9 @@
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
-#	This makefile drives the production of the sun4v ontario default 
+#	This makefile drives the production of the sun4v ontario default
 #	platform module.
 #
 #	sun4v implementation architecture dependent
@@ -103,8 +101,8 @@
 
 LINT_LIB_DIR	=$(ONTARIO_LINT_LIB_DIR)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(PLATLIB)
 	@echo "resolving symbols against unix.o"
--- old/usr/src/uts/sun4v/platmod/Makefile	2019-04-08 18:52:51.567579772 +0000
+++ new/usr/src/uts/sun4v/platmod/Makefile	2019-04-08 18:52:51.584525462 +0000
@@ -23,8 +23,6 @@
 # Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
 #
-# ident	"%Z%%M%	%I%	%E% SMI"
-#
 
 #
 #	This makefile drives the production of the sun4v default platform module.
@@ -90,8 +88,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(PLATLIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(PLATLIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 #
 #	Include common targets.
--- old/usr/src/uts/sun4v/vfalls/Makefile	2019-04-08 18:52:52.097035287 +0000
+++ new/usr/src/uts/sun4v/vfalls/Makefile	2019-04-08 18:52:52.109649362 +0000
@@ -19,11 +19,10 @@
 # CDDL HEADER END
 #
 #
-# uts/sun4v/vfalls/Makefile
 # Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
 # Use is subject to license terms.
+
 #
-#ident	"%Z%%M%	%I%	%E% SMI"
 #
 #	This makefile drives the production of the UltraSPARC-T2+ cpu module.
 #
@@ -106,8 +105,8 @@
 
 install:	$(INSTALL_DEPS)
 
-$(CPULIB):	$(BINARY)
-	$(BUILD.SO) $(BINARY)
+$(CPULIB):	$(OBJECTS)
+	$(BUILD.SO) $(OBJECTS)
 
 $(SYM_MOD):	$(UNIX_O) $(CPULIB)
 	@echo "resolving symbols against unix.o"
