--- old/usr/src/cmd/sgs/include/libld.h	2019-02-24 19:19:07.228505750 +0000
+++ new/usr/src/cmd/sgs/include/libld.h	2019-02-24 19:19:07.244336268 +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 */
