diff options
Diffstat (limited to 'usr/src')
121 files changed, 1272 insertions, 593 deletions
diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master index fa24c6a55f..8c477baa8d 100644 --- a/usr/src/Makefile.master +++ b/usr/src/Makefile.master @@ -465,10 +465,6 @@ CERRWARN += -_gcc=-Wno-missing-field-initializers # Unfortunately, this option can misfire very easily and unfixably. CERRWARN += -_gcc=-Wno-array-bounds -# DEBUG v. -nd make for frequent unused variables, empty conditions, etc. in -# -nd builds -$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused -$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-empty-body CERRWARN += -_smatch=-p=illumos_user include $(SRC)/Makefile.smatch diff --git a/usr/src/cmd/cmd-inet/usr.sbin/Makefile b/usr/src/cmd/cmd-inet/usr.sbin/Makefile index 88cf4c41aa..2b33026630 100644 --- a/usr/src/cmd/cmd-inet/usr.sbin/Makefile +++ b/usr/src/cmd/cmd-inet/usr.sbin/Makefile @@ -22,7 +22,7 @@ # # Copyright (c) 1990, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2014 Garrett D'Amore <garrett@damore.org> -# Copyright (c) 2018, Joyent, Inc. +# Copyright 2019, Joyent, Inc. # SYNCPROG= syncinit syncloop syncstat @@ -164,6 +164,7 @@ if_mpadm := LDLIBS += -linetutil -lipmp if_mpadm.po := XGETFLAGS += -a route := CPPFLAGS += -DNDEBUG ndd := LDLIBS += -ldladm -lipadm +$(RELEASE_BUILD)ndd := CERRWARN += -_gcc=-Wno-unused in.comsat := LDFLAGS += $(MAPFILE.NGB:%=-M%) route := LDLIBS += -lzonecfg -lcontract diff --git a/usr/src/cmd/file/Makefile b/usr/src/cmd/file/Makefile index 1446290a05..f6e0ba9e81 100644 --- a/usr/src/cmd/file/Makefile +++ b/usr/src/cmd/file/Makefile @@ -44,9 +44,6 @@ C99LMODE= -Xc99=%all CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-type-limits -# not linted -SMATCH=off - POFILE= file_all.po POFILES= $(SRCS:%.c=%.po) diff --git a/usr/src/cmd/file/elf_read.c b/usr/src/cmd/file/elf_read.c index 03c73f57a9..90faabfe49 100644 --- a/usr/src/cmd/file/elf_read.c +++ b/usr/src/cmd/file/elf_read.c @@ -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 @@ get_format(void) /* * file_xlatetom: translate different headers from file - * representation to memory representaion. + * representation to memory representaion. */ #define HDRSZ 512 static int @@ -141,7 +142,7 @@ file_xlatetom(Elf_Type type, char *hdr) /* 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 @@ file_xlatetom(Elf_Type type, char *hdr) /* * 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 @@ xlatetom_nhdr(Elf_Nhdr *nhdr) /* * 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 @@ get_shdr(Elf_Info *EI, int inx) /* * 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 @@ process_phdr(Elf_Info *EI) 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 @@ process_shdr(Elf_Info *EI) 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 @@ process_shdr(Elf_Info *EI) /* * 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 @@ process_shdr(Elf_Info *EI) (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; + } + } } /* diff --git a/usr/src/cmd/file/elf_read.h b/usr/src/cmd/file/elf_read.h index 90bf209abf..43198d6015 100644 --- a/usr/src/cmd/file/elf_read.h +++ b/usr/src/cmd/file/elf_read.h @@ -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 @@ typedef struct Elf_Info { 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 @@ typedef struct Elf_Info { #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 @@ extern int is_in_list(char *str); #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 @@ extern int is_in_list(char *str); #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 diff --git a/usr/src/cmd/file/file.c b/usr/src/cmd/file/file.c index 64379f3919..fa35a36406 100644 --- a/usr/src/cmd/file/file.c +++ b/usr/src/cmd/file/file.c @@ -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 @@ spcl: * 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 @@ notas: 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 @@ elf_check(char *file) 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 @@ ascom(void) 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') { diff --git a/usr/src/cmd/file/magicutils.c b/usr/src/cmd/file/magicutils.c index 8a9bb5a388..3dd23e92f8 100644 --- a/usr/src/cmd/file/magicutils.c +++ b/usr/src/cmd/file/magicutils.c @@ -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 @@ getstr(char *p, char *file) * 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 @@ f_mkmtab(char *magfile, int cflg, int first) /* 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 @@ f_mkmtab(char *magfile, int cflg, int first) case 'l': if (*(p+1) == 'l') { /* llong */ ep->e_type = LLONG; - } else { /* long */ + } else { /* long */ ep->e_type = LONG; } break; @@ -537,7 +535,7 @@ f_mkmtab(char *magfile, int cflg, int first) int f_ckmtab(char *buf, int bufsize, int first) { - int result; + int result; Entry *mtab; Entry *ep; char *p; @@ -849,7 +847,7 @@ f_ckmtab(char *buf, int bufsize, int first) #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 @@ f_ckmtab(char *buf, int bufsize, int first) #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 @@ f_ckmtab(char *buf, int bufsize, int first) #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 @@ f_ckmtab(char *buf, int bufsize, int first) #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 @@ f_prtmtab(void) 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; diff --git a/usr/src/cmd/fm/fmd/Makefile.fmd b/usr/src/cmd/fm/fmd/Makefile.fmd index 1a23743d95..7ad59e737a 100644 --- a/usr/src/cmd/fm/fmd/Makefile.fmd +++ b/usr/src/cmd/fm/fmd/Makefile.fmd @@ -21,7 +21,7 @@ # # Copyright (c) 2004, 2010, Oracle and/or its affiliates. All rights reserved. # Copyright 2015 RackTop Systems. -# Copyright (c) 2018, Joyent, Inc. +# Copyright 2019, Joyent, Inc. # .KEEP_STATE: @@ -121,8 +121,9 @@ LINTFLAGS += -mu CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized -CERRWARN += -_gcc=-Wno-unused-variable CERRWARN += -_gcc=-Wno-clobbered +$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused-but-set-variable +CERRWARN += -_gcc=-Wno-unused-variable # not linted SMATCH=off diff --git a/usr/src/cmd/mdb/intel/Makefile.kmdb b/usr/src/cmd/mdb/intel/Makefile.kmdb index b9ec60dffa..fea041a6dc 100644 --- a/usr/src/cmd/mdb/intel/Makefile.kmdb +++ b/usr/src/cmd/mdb/intel/Makefile.kmdb @@ -22,7 +22,7 @@ # Copyright 2009 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# Copyright 2019 Joyent, Inc. +# Copyright 2019, Joyent, Inc. # PROMSRCS += \ @@ -56,6 +56,8 @@ $(CTXOFFUSERS) $(CTXOFFUSERS:%.o=%.ln): kmdb_context_off.h kaif_activate.o kaif_activate.ln := CPPFLAGS += -D_MACHDEP -D_KMEMUSER +$(RELEASE_BUILD)kaif.o := CERRWARN += -_gcc=-Wno-unused + STANDLIBS += \ ../libstandctf/libstandctf.so \ $(SRC)/lib/libumem/$(MACHDIR)/libstandumem.so \ diff --git a/usr/src/cmd/sgs/dump/common/dump.c b/usr/src/cmd/sgs/dump/common/dump.c index 3795978646..204c0d52f1 100644 --- a/usr/src/cmd/sgs/dump/common/dump.c +++ b/usr/src/cmd/sgs/dump/common/dump.c @@ -1225,6 +1225,7 @@ dump_dynamic(Elf *elf_file, SCNTAB *p_scns, int num_scns, char *filename) 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; diff --git a/usr/src/cmd/sgs/include/_libelf.h b/usr/src/cmd/sgs/include/_libelf.h index 790cc03627..30aca75b3a 100644 --- a/usr/src/cmd/sgs/include/_libelf.h +++ b/usr/src/cmd/sgs/include/_libelf.h @@ -47,6 +47,7 @@ extern off_t _elf_getarhdrbase(Elf *); 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); diff --git a/usr/src/cmd/sgs/include/libld.h b/usr/src/cmd/sgs/include/libld.h index dfcc1e78ef..dc125ec90b 100644 --- a/usr/src/cmd/sgs/include/libld.h +++ b/usr/src/cmd/sgs/include/libld.h @@ -105,7 +105,7 @@ typedef enum { */ struct rel_cache { APlist *rc_list; /* list of Rel_cachebuf */ - Word rc_cnt; /* and count */ + Word rc_cnt; /* and count */ }; /* @@ -147,7 +147,7 @@ typedef enum { 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 @@ struct ofl_desc { 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 @@ struct ofl_desc { 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 @@ struct ofl_desc { #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 @@ struct ofl_desc { #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 @@ struct ifl_desc { /* input file descriptor */ #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 @@ struct is_desc { /* input section descriptor */ 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 @@ struct os_desc { /* Output section descriptor */ /* 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 @@ struct sg_desc { /* output segment descriptor */ #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 @@ typedef struct { 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 @@ struct sym_desc { * 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 @@ struct sym_aux { 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 @@ struct sym_avlnode { * 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 @@ struct sym_avlnode { #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 @@ struct sym_avlnode { #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 */ diff --git a/usr/src/cmd/sgs/include/sgs.h b/usr/src/cmd/sgs/include/sgs.h index fc6248107a..bca19e8dd2 100644 --- a/usr/src/cmd/sgs/include/sgs.h +++ b/usr/src/cmd/sgs/include/sgs.h @@ -194,7 +194,8 @@ typedef struct { #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 */ diff --git a/usr/src/cmd/sgs/libconv/common/dynamic.c b/usr/src/cmd/sgs/libconv/common/dynamic.c index 8b15ba075e..cd00a98ddc 100644 --- a/usr/src/cmd/sgs/libconv/common/dynamic.c +++ b/usr/src/cmd/sgs/libconv/common/dynamic.c @@ -114,7 +114,7 @@ conv_dyn_flag_strings(Conv_fmt_flags_t fmt_flags) 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 @@ conv_dyn_tag_strings(conv_iter_osabi_t osabi, Half mach, 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 @@ conv_dyn_tag_strings(conv_iter_osabi_t osabi, Half mach, 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 @@ conv_dyn_tag_strings(conv_iter_osabi_t osabi, Half mach, 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) }; diff --git a/usr/src/cmd/sgs/libconv/common/dynamic.msg b/usr/src/cmd/sgs/libconv/common/dynamic.msg index 1c0a51516b..f28b93e52a 100644 --- a/usr/src/cmd/sgs/libconv/common/dynamic.msg +++ b/usr/src/cmd/sgs/libconv/common/dynamic.msg @@ -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" diff --git a/usr/src/cmd/sgs/libconv/common/elf.c b/usr/src/cmd/sgs/libconv/common/elf.c index 4808b887b2..2ef1f55963 100644 --- a/usr/src/cmd/sgs/libconv/common/elf.c +++ b/usr/src/cmd/sgs/libconv/common/elf.c @@ -1211,6 +1211,7 @@ conv_reject_desc(Rej_desc * rej, Conv_reject_desc_buf_t *reject_desc_buf, &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: diff --git a/usr/src/cmd/sgs/libelf/common/gelf.c b/usr/src/cmd/sgs/libelf/common/gelf.c index 9483826d90..c50f5cd79a 100644 --- a/usr/src/cmd/sgs/libelf/common/gelf.c +++ b/usr/src/cmd/sgs/libelf/common/gelf.c @@ -698,7 +698,7 @@ gelf_update_dyn(Elf_Data *dst, int ndx, GElf_Dyn *src) 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 @@ gelf_getsymshndx(Elf_Data *symdata, Elf_Data *shndxdata, 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 @@ gelf_update_cap(Elf_Data *dst, int ndx, GElf_Cap *src) * 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 @@ _gelf_getdyndtflags_1(Elf *elf) 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 @@ _gelf_getdyndtflags_1(Elf *elf) } return (0); } + +GElf_Xword +_gelf_getdyndtflags_1(Elf *elf) +{ + return (_gelf_getdynval(elf, DT_FLAGS_1)); +} diff --git a/usr/src/cmd/sgs/libelf/common/mapfile-vers b/usr/src/cmd/sgs/libelf/common/mapfile-vers index 35f397f126..a0ebab4d85 100644 --- a/usr/src/cmd/sgs/libelf/common/mapfile-vers +++ b/usr/src/cmd/sgs/libelf/common/mapfile-vers @@ -170,6 +170,7 @@ SYMBOL_VERSION SUNWprivate_1.1 { _elf_sys_encoding; _elf_swap_wrimage; _gelf_getdyndtflags_1; + _gelf_getdynval; $if _ELF32 elf_demangle; diff --git a/usr/src/cmd/sgs/libld/Makefile.com b/usr/src/cmd/sgs/libld/Makefile.com index 44f372d088..2119ecec29 100644 --- a/usr/src/cmd/sgs/libld/Makefile.com +++ b/usr/src/cmd/sgs/libld/Makefile.com @@ -92,6 +92,7 @@ CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-switch CERRWARN += -_gcc=-Wno-char-subscripts CERRWARN += -_gcc=-Wno-type-limits +$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused SMOFF += no_if_block diff --git a/usr/src/cmd/sgs/libld/common/_libld.h b/usr/src/cmd/sgs/libld/common/_libld.h index 146dd54b8c..d34bda5fa4 100644 --- a/usr/src/cmd/sgs/libld/common/_libld.h +++ b/usr/src/cmd/sgs/libld/common/_libld.h @@ -199,7 +199,7 @@ typedef struct { const Rel_entry *mr_reloc_table; Word (* mr_init_rel)(Rel_desc *, Word *, void *); - void (* mr_mach_eflags)(Ehdr *, Ofl_desc *); + void (* mr_mach_eflags)(Ehdr *, Ofl_desc *); void (* mr_mach_make_dynamic)(Ofl_desc *, size_t *); void (* mr_mach_update_odynamic)(Ofl_desc *, Dyn **); Xword (* mr_calc_plt_addr)(Sym_desc *, Ofl_desc *); @@ -754,6 +754,7 @@ extern Sdf_desc *sdf_find(const char *, APlist *); #define ld_sym_nodirect ld64_sym_nodirect #define ld_sym_process ld64_sym_process #define ld_sym_resolve ld64_sym_resolve +#define ld_sym_reducable ld64_sym_reducable #define ld_sym_spec ld64_sym_spec #define ld_targ ld64_targ #define ld_targ_init_sparc ld64_targ_init_sparc @@ -852,6 +853,7 @@ extern Sdf_desc *sdf_find(const char *, APlist *); #define ld_sym_nodirect ld32_sym_nodirect #define ld_sym_process ld32_sym_process #define ld_sym_resolve ld32_sym_resolve +#define ld_sym_reducable ld32_sym_reducable #define ld_sym_spec ld32_sym_spec #define ld_targ ld32_targ #define ld_targ_init_sparc ld32_targ_init_sparc @@ -878,8 +880,8 @@ extern int dbg_setup(Ofl_desc *, const char *, int); extern uintptr_t ld_add_actrel(Word, Rel_desc *, Ofl_desc *); extern uintptr_t ld_add_libdir(Ofl_desc *, const char *); -extern void ld_adj_movereloc(Ofl_desc *, Rel_desc *); -extern Sym_desc * ld_am_I_partial(Rel_desc *, Xword); +extern void ld_adj_movereloc(Ofl_desc *, Rel_desc *); +extern Sym_desc * ld_am_I_partial(Rel_desc *, Xword); extern void ld_ar_member(Ar_desc *, Elf_Arsym *, Ar_aux *, Ar_mem *); extern Ar_desc *ld_ar_setup(const char *, Elf *, Ofl_desc *); @@ -997,6 +999,7 @@ extern uintptr_t ld_sym_nodirect(Is_desc *, Ifl_desc *, Ofl_desc *); extern uintptr_t ld_sym_process(Is_desc *, Ifl_desc *, Ofl_desc *); extern uintptr_t ld_sym_resolve(Sym_desc *, Sym *, Ifl_desc *, Ofl_desc *, int, Word, sd_flag_t); +extern Boolean ld_sym_reducable(Ofl_desc *, Sym_desc *); extern uintptr_t ld_sym_spec(Ofl_desc *); extern Target ld_targ; diff --git a/usr/src/cmd/sgs/libld/common/args.c b/usr/src/cmd/sgs/libld/common/args.c index c737ea9065..93beb46c22 100644 --- a/usr/src/cmd/sgs/libld/common/args.c +++ b/usr/src/cmd/sgs/libld/common/args.c @@ -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 Setstate zfwflag = SET_UNKNOWN; 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 Blflag = FALSE; 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 @@ usage_mesg(Boolean detail) (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 @@ check_flags(Ofl_desc * ofl, int argc) 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 @@ check_flags(Ofl_desc * ofl, int argc) 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 @@ check_flags(Ofl_desc * ofl, int argc) 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 @@ check_flags(Ofl_desc * ofl, int argc) } } - if (!Gflag && !rflag) { + if (otype == OT_EXEC) { /* * Dynamically linked executable. */ @@ -493,7 +529,7 @@ check_flags(Ofl_desc * ofl, int argc) 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 @@ check_flags(Ofl_desc * ofl, int argc) 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 @@ check_flags(Ofl_desc * ofl, int argc) 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 @@ createargv(Ofl_desc *ofl, int *usage) /* * The argument being examined is either: - * ld32= or + * ld32= or * ld64= */ #if defined(_LP64) @@ -917,8 +956,8 @@ guidance_parse(Ofl_desc *ofl, char *optarg) /* * 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 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *usage) 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 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *usage) 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 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *usage) case 'G': DBG_CALL(Dbg_args_option(ofl->ofl_lml, ndx, c, NULL)); - Gflag = TRUE; + otype = OT_SHARED; break; case 'L': diff --git a/usr/src/cmd/sgs/libld/common/files.c b/usr/src/cmd/sgs/libld/common/files.c index d731e935d4..dae6463012 100644 --- a/usr/src/cmd/sgs/libld/common/files.c +++ b/usr/src/cmd/sgs/libld/common/files.c @@ -2356,7 +2356,7 @@ process_group(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, 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; @@ -3197,6 +3197,21 @@ ld_process_ifl(const char *name, const char *soname, int fd, Elf *elf, 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); + } + /* * Determine if we've already come across this file. */ diff --git a/usr/src/cmd/sgs/libld/common/globals.c b/usr/src/cmd/sgs/libld/common/globals.c index 8d3f89c5d5..eee3b9b8cb 100644 --- a/usr/src/cmd/sgs/libld/common/globals.c +++ b/usr/src/cmd/sgs/libld/common/globals.c @@ -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 @@ reject[SGS_REJ_NUM] = { 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 diff --git a/usr/src/cmd/sgs/libld/common/libld.msg b/usr/src/cmd/sgs/libld/common/libld.msg index 45a90b0e82..ee0a45dce8 100644 --- a/usr/src/cmd/sgs/libld/common/libld.msg +++ b/usr/src/cmd/sgs/libld/common/libld.msg @@ -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" diff --git a/usr/src/cmd/sgs/libld/common/relocate.c b/usr/src/cmd/sgs/libld/common/relocate.c index 8348f5493e..a1c30c5d56 100644 --- a/usr/src/cmd/sgs/libld/common/relocate.c +++ b/usr/src/cmd/sgs/libld/common/relocate.c @@ -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 @@ get_move_entry(Is_desc *rsect, Xword roffset) Shdr *rshdr = rsect->is_shdr; Is_desc *misp; Shdr *mshdr; - Xword midx; + Xword midx; Move *mvp; /* @@ -2296,8 +2296,8 @@ process_movereloc(Ofl_desc *ofl, Is_desc *rsect) { 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 @@ Sym_desc * 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; diff --git a/usr/src/cmd/sgs/libld/common/sections.c b/usr/src/cmd/sgs/libld/common/sections.c index 86d19a4120..696a18ec40 100644 --- a/usr/src/cmd/sgs/libld/common/sections.c +++ b/usr/src/cmd/sgs/libld/common/sections.c @@ -1274,6 +1274,10 @@ make_dynamic(Ofl_desc *ofl) cnt++; } + /* DT_SUNW_KMOD */ + if (ofl->ofl_flags & FLG_OF_KMOD) + cnt++; + /* * Account for Architecture dependent .dynamic entries, and defaults. */ @@ -2432,7 +2436,7 @@ make_reloc(Ofl_desc *ofl, Os_desc *osp) 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 @@ ld_make_sunwmove(Ofl_desc *ofl, int mv_nums) 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), diff --git a/usr/src/cmd/sgs/libld/common/syms.c b/usr/src/cmd/sgs/libld/common/syms.c index 3d2e361037..ed2191761b 100644 --- a/usr/src/cmd/sgs/libld/common/syms.c +++ b/usr/src/cmd/sgs/libld/common/syms.c @@ -636,7 +636,7 @@ sym_add_spec(const char *name, const char *uname, Word sdaux_id, 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 @@ sym_add_spec(const char *name, const char *uname, Word sdaux_id, 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 @@ sym_add_spec(const char *name, const char *uname, Word sdaux_id, * * - 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 @@ sym_undef_entry(Ofl_desc *ofl, Sym_desc *sdp, Type type, ofl_flag_t ofl_flag, } /* + * 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 @@ uintptr_t 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) @@ -991,6 +1086,9 @@ sym_cap_vis(const char *name, Word hash, Sym *sym, Ofl_desc *ofl) case STV_SINGLETON: sdflags |= FLG_SY_SINGLE; break; + case STV_HIDDEN: + sdflags |= FLG_SY_HIDDEN; + break; } /* @@ -1133,7 +1231,7 @@ ensure_array_local(Ofl_desc *ofl, APlist *apl, const char *str) * 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 +1239,7 @@ ensure_array_local(Ofl_desc *ofl, APlist *apl, const char *str) * 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 @@ -1516,7 +1614,7 @@ ld_sym_validate(Ofl_desc *ofl) */ if ((sym->st_shndx == SHN_COMMON) && (((oflags & FLG_OF_RELOBJ) == 0) || - (SYM_IS_HIDDEN(sdp) && (oflags & FLG_OF_PROCRED)))) { + ld_sym_reducable(ofl, sdp))) { if ((sdp->sd_move == NULL) || ((sdp->sd_flags & FLG_SY_PAREXPN) == 0)) { if (type != STT_TLS) { @@ -1568,7 +1666,7 @@ ld_sym_validate(Ofl_desc *ofl) * hidden requirement and ensures the symbol isn't made globally * available at runtime. */ - if (SYM_IS_HIDDEN(sdp) && (oflags & FLG_OF_PROCRED)) { + if (ld_sym_reducable(ofl, sdp)) { /* * If any reductions are being processed, keep a count * of eliminated symbols, and if the symbol is being @@ -1890,7 +1988,7 @@ typedef struct { * 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 @@ -3133,3 +3231,26 @@ ld_stt_section_sym_name(Is_desc *isp) return (isp->is_sym_name); } + +/* + * If we're producing a relocatable object and the symbol is eligible for + * COMDAT section, it shouldn't be reduced in scope as that will break the + * COMDAT matching when the output object is later consumed. Leave it alone, + * and any reduction (and COMDAT) processing will occur then. + * + * Otherwise, any hidden symbol is reduced when reductions are being processed. + */ +Boolean +ld_sym_reducable(Ofl_desc *ofl, Sym_desc *sdp) +{ + Is_desc *isc = sdp->sd_isc; + + if (((ofl->ofl_flags & FLG_OF_RELOBJ) != 0) && + (isc != NULL) && + ((isc->is_flags & FLG_IS_COMDAT) != 0)) { + return (FALSE); + } else { + return (SYM_IS_HIDDEN(sdp) && + (ofl->ofl_flags & FLG_OF_PROCRED)); + } +} diff --git a/usr/src/cmd/sgs/libld/common/update.c b/usr/src/cmd/sgs/libld/common/update.c index 19352782d0..ccd26beb5e 100644 --- a/usr/src/cmd/sgs/libld/common/update.c +++ b/usr/src/cmd/sgs/libld/common/update.c @@ -184,7 +184,7 @@ update_osym(Ofl_desc *ofl) #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; @@ -1013,7 +1013,7 @@ update_osym(Ofl_desc *ofl) if (sdp->sd_ref == REF_DYN_SEEN) continue; - if (SYM_IS_HIDDEN(sdp) && (flags & FLG_OF_PROCRED)) + if (ld_sym_reducable(ofl, sdp)) local = 1; else local = 0; @@ -1224,7 +1224,7 @@ update_osym(Ofl_desc *ofl) * of the .symtab. Retain the appropriate index for use in * version symbol indexing and relocation. */ - if (SYM_IS_HIDDEN(sdp) && (flags & FLG_OF_PROCRED)) { + if (ld_sym_reducable(ofl, sdp)) { local = 1; if (!(sdp->sd_flags & FLG_SY_ELIM) && !dynsym) sdp->sd_symndx = scopesym_ndx; @@ -1333,7 +1333,7 @@ update_osym(Ofl_desc *ofl) * 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 @@ update_osym(Ofl_desc *ofl) 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 */ ; @@ -1889,7 +1902,7 @@ update_osym(Ofl_desc *ofl) * to maintain the binding of the original reference. */ if (SYM_IS_HIDDEN(sdp)) { - if (flags & FLG_OF_PROCRED) + if (ld_sym_reducable(ofl, sdp)) bind = STB_LOCAL; else bind = STB_WEAK; @@ -2579,6 +2592,12 @@ update_odynamic(Ofl_desc *ofl) 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 @@ update_move(Ofl_desc *ofl) 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 @@ ld_update_outfile(Ofl_desc *ofl) 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 @@ ld_update_outfile(Ofl_desc *ofl) * 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; diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README index 7e549775e0..2df3146d03 100644 --- a/usr/src/cmd/sgs/packages/common/SUNWonld-README +++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README @@ -1663,3 +1663,7 @@ Bugid Risk Synopsis 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 +10346 ld(1) should not reduce symbol visibility of COMDAT symbols when + producing relocatable objects +10366 ld(1) should support GNU-style linker sets +10581 ld(1) should know kernel modules are a thing diff --git a/usr/src/cmd/sgs/rtld/common/globals.c b/usr/src/cmd/sgs/rtld/common/globals.c index 2e98768551..45c08f8286 100644 --- a/usr/src/cmd/sgs/rtld/common/globals.c +++ b/usr/src/cmd/sgs/rtld/common/globals.c @@ -118,7 +118,7 @@ Interp *interp = NULL; /* ELF interpreter info */ 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 */ @@ -234,9 +234,10 @@ ldd_reject[SGS_REJ_NUM] = { 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 @@ -261,8 +262,9 @@ err_reject[SGS_REJ_NUM] = { 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 @@ -286,8 +288,9 @@ ldd_warn[SGS_REJ_NUM] = { 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 diff --git a/usr/src/cmd/sgs/rtld/common/rtld.msg b/usr/src/cmd/sgs/rtld/common/rtld.msg index 9309d0c62e..add19eaf80 100644 --- a/usr/src/cmd/sgs/rtld/common/rtld.msg +++ b/usr/src/cmd/sgs/rtld/common/rtld.msg @@ -200,6 +200,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) \ @@ -233,6 +234,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 @@ -242,7 +244,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" diff --git a/usr/src/common/iscsi/base64.c b/usr/src/common/iscsi/base64.c index f4f336480e..3ee84e4055 100644 --- a/usr/src/common/iscsi/base64.c +++ b/usr/src/common/iscsi/base64.c @@ -72,7 +72,7 @@ outdec64(unsigned char *out, unsigned char *chr, int num) switch (num) { case 0: - case 1: /* these are impossible */ + case 1: /* these are impossible */ default: break; case 2: /* 2 base64 bytes == 1 decoded byte */ @@ -132,7 +132,7 @@ iscsi_base64_str_to_binary(char *hstr, int hstr_len, *out_len = 0; iptr = hstr; - while (((curchr = *(iptr++)) != NULL) && + while (((curchr = *(iptr++)) != '\0') && (((uintptr_t)iptr - (uintptr_t)hstr) <= hstr_len)) { /* decode chars */ if (curchr == '=') /* if end */ @@ -186,7 +186,7 @@ int iscsi_binary_to_base64_str(uint8_t *in_buf, int in_buf_len, char *base64_str_buf, int base64_buf_len) { - uint8_t *iptr; + uint8_t *iptr; char *optr; int in_bytes_remaining; diff --git a/usr/src/lib/libc/amd64/Makefile b/usr/src/lib/libc/amd64/Makefile index 9888b3c02c..579a2b0de7 100644 --- a/usr/src/lib/libc/amd64/Makefile +++ b/usr/src/lib/libc/amd64/Makefile @@ -1037,6 +1037,8 @@ CERRWARN += -_gcc=-Wno-clobbered CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-address +$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused + # not linted SMATCH=off diff --git a/usr/src/lib/libc/i386/Makefile.com b/usr/src/lib/libc/i386/Makefile.com index be3a2fb6a4..afc7110369 100644 --- a/usr/src/lib/libc/i386/Makefile.com +++ b/usr/src/lib/libc/i386/Makefile.com @@ -1086,6 +1086,8 @@ CERRWARN += -_gcc=-Wno-clobbered CERRWARN += -_gcc=-Wno-unused-function CERRWARN += -_gcc=-Wno-address +$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused + # not linted SMATCH=off diff --git a/usr/src/lib/udapl/udapl_tavor/Makefile.com b/usr/src/lib/udapl/udapl_tavor/Makefile.com index a2b1711a4c..60ff446a17 100644 --- a/usr/src/lib/udapl/udapl_tavor/Makefile.com +++ b/usr/src/lib/udapl/udapl_tavor/Makefile.com @@ -22,7 +22,7 @@ # # Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. # -# Copyright (c) 2018, Joyent, Inc. +# Copyright 2019, Joyent, Inc. LIBRARY= udapl_tavor.a VERS= .1 @@ -153,11 +153,12 @@ CERRWARN += -_gcc=-Wno-parentheses CERRWARN += -_gcc=-Wno-uninitialized CERRWARN += -_gcc=-Wno-switch +$(NOT_RELEASE_BUILD)CPPFLAGS += -DDAPL_DBG +$(RELEASE_BUILD)CERRWARN += -_gcc=-Wno-unused + # not linted SMATCH=off -$(NOT_RELEASE_BUILD)CPPFLAGS += -DDAPL_DBG - .KEEP_STATE: all: $(LIBS) diff --git a/usr/src/man/man1/ld.1 b/usr/src/man/man1/ld.1 index d44c1e1139..0da768b1bb 100644 --- a/usr/src/man/man1/ld.1 +++ b/usr/src/man/man1/ld.1 @@ -35,6 +35,7 @@ ld \- link-editor for object files [\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 @@ -1583,6 +1584,56 @@ executable. .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 .ad .sp .6 diff --git a/usr/src/pkg/manifests/developer-debug-mdb.mf b/usr/src/pkg/manifests/developer-debug-mdb.mf index bd64e89854..d3151794a6 100644 --- a/usr/src/pkg/manifests/developer-debug-mdb.mf +++ b/usr/src/pkg/manifests/developer-debug-mdb.mf @@ -21,6 +21,7 @@ # # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. +# Copyright (c) 2019, Joyent, Inc. # set name=pkg.fmri value=pkg:/developer/debug/mdb@$(PKGVERS) @@ -67,6 +68,7 @@ dir path=usr/lib/mdb/proc group=sys $(sparc_ONLY)dir path=usr/lib/mdb/proc/$(ARCH64) group=sys $(i386_ONLY)dir path=usr/lib/mdb/proc/$(ARCH64) dir path=usr/lib/mdb/raw group=sys +dir path=usr/lib/mdb/raw/$(ARCH64) group=sys dir path=usr/platform group=sys $(i386_ONLY)dir path=usr/platform/i86pc group=sys $(i386_ONLY)dir path=usr/platform/i86pc/lib @@ -234,6 +236,8 @@ file path=usr/lib/mdb/proc/libuutil.so group=sys mode=0555 file path=usr/lib/mdb/proc/mdb_ds.so group=sys mode=0555 file path=usr/lib/mdb/proc/svc.configd.so group=sys mode=0555 file path=usr/lib/mdb/proc/svc.startd.so group=sys mode=0555 +file path=usr/lib/mdb/raw/$(ARCH64)/disk_label.so group=sys mode=0555 +file path=usr/lib/mdb/raw/disk_label.so group=sys mode=0555 $(i386_ONLY)file path=usr/platform/i86pc/lib/mdb/kvm/$(ARCH64)/apix.so \ group=sys mode=0555 $(i386_ONLY)file path=usr/platform/i86pc/lib/mdb/kvm/$(ARCH64)/pcplusmp.so \ diff --git a/usr/src/pkg/manifests/system-test-elftest.mf b/usr/src/pkg/manifests/system-test-elftest.mf index 696fd56652..ef3f45b5fc 100644 --- a/usr/src/pkg/manifests/system-test-elftest.mf +++ b/usr/src/pkg/manifests/system-test-elftest.mf @@ -24,6 +24,7 @@ dir path=opt/elf-tests/bin 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/bin/elftest mode=0555 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 @@ -52,6 +57,8 @@ file path=opt/elf-tests/tests/tls/i386/ld/Makefile.test mode=0444 file path=opt/elf-tests/tests/tls/i386/ld/half-ldm.s mode=0444 file path=opt/elf-tests/tests/tls/i386/ld/i386-ld-test mode=0555 license lic_CDDL license=lic_CDDL +license usr/src/test/elf-tests/THIRDPARTYLICENSE \ + license=usr/src/test/elf-tests/THIRDPARTYLICENSE depend fmri=developer/linker type=require depend fmri=developer/object-file type=require depend fmri=system/test/testrunner type=require diff --git a/usr/src/test/elf-tests/THIRDPARTYLICENSE b/usr/src/test/elf-tests/THIRDPARTYLICENSE new file mode 100644 index 0000000000..a65dbe8960 --- /dev/null +++ b/usr/src/test/elf-tests/THIRDPARTYLICENSE @@ -0,0 +1,26 @@ +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. diff --git a/usr/src/test/elf-tests/THIRDPARTYLICENSE.descrip b/usr/src/test/elf-tests/THIRDPARTYLICENSE.descrip new file mode 100644 index 0000000000..00e2a1c3d9 --- /dev/null +++ b/usr/src/test/elf-tests/THIRDPARTYLICENSE.descrip @@ -0,0 +1 @@ +Portions of linker-set tests diff --git a/usr/src/test/elf-tests/runfiles/default.run b/usr/src/test/elf-tests/runfiles/default.run index f1b0c8980a..780b36a0e2 100644 --- a/usr/src/test/elf-tests/runfiles/default.run +++ b/usr/src/test/elf-tests/runfiles/default.run @@ -20,10 +20,12 @@ timeout = 60 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'] diff --git a/usr/src/test/elf-tests/tests/Makefile b/usr/src/test/elf-tests/tests/Makefile index e3894ac07d..5da70cc241 100644 --- a/usr/src/test/elf-tests/tests/Makefile +++ b/usr/src/test/elf-tests/tests/Makefile @@ -16,6 +16,7 @@ SUBDIRS = \ assert-deflib \ + linker-sets \ tls include $(SRC)/test/Makefile.com diff --git a/usr/src/test/elf-tests/tests/linker-sets/Makefile b/usr/src/test/elf-tests/tests/linker-sets/Makefile new file mode 100644 index 0000000000..34a9d1368a --- /dev/null +++ b/usr/src/test/elf-tests/tests/linker-sets/Makefile @@ -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) diff --git a/usr/src/test/elf-tests/tests/linker-sets/in-use-check.sh b/usr/src/test/elf-tests/tests/linker-sets/in-use-check.sh new file mode 100644 index 0000000000..dee9dca9fa --- /dev/null +++ b/usr/src/test/elf-tests/tests/linker-sets/in-use-check.sh @@ -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 diff --git a/usr/src/test/elf-tests/tests/linker-sets/simple-src.c b/usr/src/test/elf-tests/tests/linker-sets/simple-src.c new file mode 100644 index 0000000000..af0c62687f --- /dev/null +++ b/usr/src/test/elf-tests/tests/linker-sets/simple-src.c @@ -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++; + } +} diff --git a/usr/src/test/elf-tests/tests/linker-sets/simple.out b/usr/src/test/elf-tests/tests/linker-sets/simple.out new file mode 100644 index 0000000000..3d2962a265 --- /dev/null +++ b/usr/src/test/elf-tests/tests/linker-sets/simple.out @@ -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 diff --git a/usr/src/test/elf-tests/tests/linker-sets/simple.sh b/usr/src/test/elf-tests/tests/linker-sets/simple.sh new file mode 100644 index 0000000000..0b4a15e3d1 --- /dev/null +++ b/usr/src/test/elf-tests/tests/linker-sets/simple.sh @@ -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 diff --git a/usr/src/uts/common/io/avintr.c b/usr/src/uts/common/io/avintr.c index 71c2ce6dfb..05afc12055 100644 --- a/usr/src/uts/common/io/avintr.c +++ b/usr/src/uts/common/io/avintr.c @@ -91,19 +91,19 @@ kmutex_t av_lock; * must not be used there. */ ddi_softint_hdl_impl_t softlevel_hdl[DDI_IPL_10] = { - {0, NULL, NULL, NULL, 0, NULL, NULL, NULL}, /* level 1 */ - {0, NULL, NULL, NULL, 0, NULL, NULL, NULL}, /* level 2 */ - {0, NULL, NULL, NULL, 0, NULL, NULL, NULL}, /* level 3 */ - {0, NULL, NULL, NULL, 0, NULL, NULL, NULL}, /* level 4 */ - {0, NULL, NULL, NULL, 0, NULL, NULL, NULL}, /* level 5 */ - {0, NULL, NULL, NULL, 0, NULL, NULL, NULL}, /* level 6 */ - {0, NULL, NULL, NULL, 0, NULL, NULL, NULL}, /* level 7 */ - {0, NULL, NULL, NULL, 0, NULL, NULL, NULL}, /* level 8 */ - {0, NULL, NULL, NULL, 0, NULL, NULL, NULL}, /* level 9 */ - {0, NULL, NULL, NULL, 0, NULL, NULL, NULL}, /* level 10 */ + {0, 0, NULL, NULL, 0, NULL, NULL, NULL}, /* level 1 */ + {0, 0, NULL, NULL, 0, NULL, NULL, NULL}, /* level 2 */ + {0, 0, NULL, NULL, 0, NULL, NULL, NULL}, /* level 3 */ + {0, 0, NULL, NULL, 0, NULL, NULL, NULL}, /* level 4 */ + {0, 0, NULL, NULL, 0, NULL, NULL, NULL}, /* level 5 */ + {0, 0, NULL, NULL, 0, NULL, NULL, NULL}, /* level 6 */ + {0, 0, NULL, NULL, 0, NULL, NULL, NULL}, /* level 7 */ + {0, 0, NULL, NULL, 0, NULL, NULL, NULL}, /* level 8 */ + {0, 0, NULL, NULL, 0, NULL, NULL, NULL}, /* level 9 */ + {0, 0, NULL, NULL, 0, NULL, NULL, NULL}, /* level 10 */ }; ddi_softint_hdl_impl_t softlevel1_hdl = - {0, NULL, NULL, NULL, 0, NULL, NULL, NULL}; + {0, 0, NULL, NULL, 0, NULL, NULL, NULL}; /* * clear/check softint pending flag corresponding for @@ -541,7 +541,7 @@ static uint64_t dummy_tick; /* remove an interrupt vector from the chain */ static void remove_av(void *intr_id, struct av_head *vectp, avfunc f, int pri_level, - int vect) + int vect) { struct autovec *p, *target; int lo_pri, hi_pri; diff --git a/usr/src/uts/common/io/idm/idm.c b/usr/src/uts/common/io/idm/idm.c index 9951a74684..877a0e6f20 100644 --- a/usr/src/uts/common/io/idm/idm.c +++ b/usr/src/uts/common/io/idm/idm.c @@ -293,7 +293,7 @@ idm_ini_conn_connect(idm_conn_t *ic) idm_conn_hold(ic); /* Kick state machine */ - idm_conn_event(ic, CE_CONNECT_REQ, NULL); + idm_conn_event(ic, CE_CONNECT_REQ, (uintptr_t)NULL); /* Wait for login flag */ mutex_enter(&ic->ic_state_mutex); @@ -332,7 +332,7 @@ idm_ini_conn_connect(idm_conn_t *ic) void idm_ini_conn_disconnect(idm_conn_t *ic) { - idm_conn_event(ic, CE_TRANSPORT_FAIL, NULL); + idm_conn_event(ic, CE_TRANSPORT_FAIL, (uintptr_t)NULL); } /* @@ -351,7 +351,8 @@ idm_ini_conn_disconnect_sync(idm_conn_t *ic) mutex_enter(&ic->ic_state_mutex); if ((ic->ic_state != CS_S9_INIT_ERROR) && (ic->ic_state != CS_S11_COMPLETE)) { - idm_conn_event_locked(ic, CE_TRANSPORT_FAIL, NULL, CT_NONE); + idm_conn_event_locked(ic, CE_TRANSPORT_FAIL, (uintptr_t)NULL, + CT_NONE); while ((ic->ic_state != CS_S9_INIT_ERROR) && (ic->ic_state != CS_S11_COMPLETE)) cv_wait(&ic->ic_state_cv, &ic->ic_state_mutex); @@ -995,7 +996,7 @@ idm_buf_alloc(idm_conn_t *ic, void *bufptr, uint64_t buflen) buf->idb_buflen = buflen; buf->idb_exp_offset = 0; buf->idb_bufoffset = 0; - buf->idb_xfer_len = 0; + buf->idb_xfer_len = 0; buf->idb_magic = IDM_BUF_MAGIC; buf->idb_in_transport = B_FALSE; buf->idb_bufbcopy = B_FALSE; @@ -1280,7 +1281,7 @@ idm_task_alloc(idm_conn_t *ic) idt->idt_state = TASK_IDLE; idt->idt_ic = ic; - idt->idt_private = NULL; + idt->idt_private = NULL; idt->idt_exp_datasn = 0; idt->idt_exp_rttsn = 0; idt->idt_flags = 0; @@ -2209,7 +2210,8 @@ idm_refcnt_rele_and_destroy(idm_refcnt_t *refcnt, idm_refcnt_cb_t *cb_func) refcnt->ir_cb = cb_func; refcnt->ir_waiting = REF_WAIT_ASYNC; if (taskq_dispatch(idm.idm_global_taskq, - &idm_refcnt_unref_task, refcnt, TQ_SLEEP) == TASKQID_INVALID) { + &idm_refcnt_unref_task, refcnt, TQ_SLEEP) == + TASKQID_INVALID) { cmn_err(CE_WARN, "idm_refcnt_rele: Couldn't dispatch task"); } diff --git a/usr/src/uts/common/io/idm/idm_conn_sm.c b/usr/src/uts/common/io/idm/idm_conn_sm.c index bb750a2f31..52e515a983 100644 --- a/usr/src/uts/common/io/idm/idm_conn_sm.c +++ b/usr/src/uts/common/io/idm/idm_conn_sm.c @@ -494,7 +494,7 @@ idm_login_timeout(void *arg) idm_conn_t *ic = arg; ic->ic_state_timeout = 0; - idm_conn_event(ic, CE_LOGIN_TIMEOUT, NULL); + idm_conn_event(ic, CE_LOGIN_TIMEOUT, (uintptr_t)NULL); } static void @@ -512,7 +512,7 @@ idm_state_s3_xpt_up(idm_conn_t *ic, idm_conn_event_ctx_t *event_ctx) * Don't need to cancel login timer since the timer is * presumed to be the source of this event. */ - (void) idm_notify_client(ic, CN_LOGIN_FAIL, NULL); + (void) idm_notify_client(ic, CN_LOGIN_FAIL, (uintptr_t)NULL); idm_update_state(ic, CS_S9_INIT_ERROR, event_ctx); break; case CE_CONNECT_REJECT: @@ -530,7 +530,7 @@ idm_state_s3_xpt_up(idm_conn_t *ic, idm_conn_event_ctx_t *event_ctx) case CE_LOGOUT_OTHER_CONN_SND: /* T6 */ IDM_SM_TIMER_CLEAR(ic); - (void) idm_notify_client(ic, CN_LOGIN_FAIL, NULL); + (void) idm_notify_client(ic, CN_LOGIN_FAIL, (uintptr_t)NULL); idm_update_state(ic, CS_S9_INIT_ERROR, event_ctx); break; case CE_TX_PROTOCOL_ERROR: @@ -569,7 +569,7 @@ idm_state_s4_in_login(idm_conn_t *ic, idm_conn_event_ctx_t *event_ctx) break; case CE_LOGIN_TIMEOUT: /* T7 */ - (void) idm_notify_client(ic, CN_LOGIN_FAIL, NULL); + (void) idm_notify_client(ic, CN_LOGIN_FAIL, (uintptr_t)NULL); idm_update_state(ic, CS_S9_INIT_ERROR, event_ctx); break; case CE_LOGIN_FAIL_SND: @@ -603,7 +603,7 @@ idm_state_s4_in_login(idm_conn_t *ic, idm_conn_event_ctx_t *event_ctx) case CE_LOGOUT_OTHER_CONN_RCV: /* T7 */ IDM_SM_TIMER_CLEAR(ic); - (void) idm_notify_client(ic, CN_LOGIN_FAIL, NULL); + (void) idm_notify_client(ic, CN_LOGIN_FAIL, (uintptr_t)NULL); idm_update_state(ic, CS_S9_INIT_ERROR, event_ctx); break; case CE_LOGOUT_SESSION_SUCCESS: @@ -831,7 +831,7 @@ idm_logout_req_timeout(void *arg) idm_conn_t *ic = arg; ic->ic_state_timeout = 0; - idm_conn_event(ic, CE_LOGOUT_TIMEOUT, NULL); + idm_conn_event(ic, CE_LOGOUT_TIMEOUT, (uintptr_t)NULL); } static void @@ -912,7 +912,7 @@ idm_cleanup_timeout(void *arg) idm_conn_t *ic = arg; ic->ic_state_timeout = 0; - idm_conn_event(ic, CE_CLEANUP_TIMEOUT, NULL); + idm_conn_event(ic, CE_CLEANUP_TIMEOUT, (uintptr_t)NULL); } static void @@ -1166,9 +1166,9 @@ idm_update_state(idm_conn_t *ic, idm_conn_state_t new_state, break; case CS_S2_XPT_WAIT: if ((rc = idm_ini_conn_finish(ic)) != 0) { - idm_conn_event(ic, CE_CONNECT_FAIL, NULL); + idm_conn_event(ic, CE_CONNECT_FAIL, (uintptr_t)NULL); } else { - idm_conn_event(ic, CE_CONNECT_SUCCESS, NULL); + idm_conn_event(ic, CE_CONNECT_SUCCESS, (uintptr_t)NULL); } break; case CS_S3_XPT_UP: @@ -1181,10 +1181,12 @@ idm_update_state(idm_conn_t *ic, idm_conn_state_t new_state, if ((rc = idm_tgt_conn_finish(ic)) != IDM_STATUS_SUCCESS) { switch (rc) { case IDM_STATUS_REJECT: - idm_conn_event(ic, CE_CONNECT_REJECT, NULL); + idm_conn_event(ic, CE_CONNECT_REJECT, + (uintptr_t)NULL); break; default: - idm_conn_event(ic, CE_CONNECT_FAIL, NULL); + idm_conn_event(ic, CE_CONNECT_FAIL, + (uintptr_t)NULL); break; } } @@ -1195,11 +1197,12 @@ idm_update_state(idm_conn_t *ic, idm_conn_state_t new_state, */ IDM_SM_TIMER_CHECK(ic); ic->ic_state_timeout = timeout(idm_login_timeout, ic, - drv_usectohz(IDM_LOGIN_SECONDS*1000000)); + drv_usectohz(IDM_LOGIN_SECONDS * 1000000)); break; case CS_S4_IN_LOGIN: if (ic->ic_conn_type == CONN_TYPE_INI) { - (void) idm_notify_client(ic, CN_READY_FOR_LOGIN, NULL); + (void) idm_notify_client(ic, CN_READY_FOR_LOGIN, + (uintptr_t)NULL); mutex_enter(&ic->ic_state_mutex); ic->ic_state_flags |= CF_LOGIN_READY; cv_signal(&ic->ic_state_cv); @@ -1215,13 +1218,13 @@ idm_update_state(idm_conn_t *ic, idm_conn_state_t new_state, */ idm_status = idm_ffp_enable(ic); if (idm_status != IDM_STATUS_SUCCESS) { - idm_conn_event(ic, CE_TRANSPORT_FAIL, NULL); + idm_conn_event(ic, CE_TRANSPORT_FAIL, (uintptr_t)NULL); } if (ic->ic_reinstate_conn) { /* Connection reinstatement is complete */ idm_conn_event(ic->ic_reinstate_conn, - CE_CONN_REINSTATE_SUCCESS, NULL); + CE_CONN_REINSTATE_SUCCESS, (uintptr_t)NULL); } break; case CS_S6_IN_LOGOUT: @@ -1278,7 +1281,7 @@ idm_update_state(idm_conn_t *ic, idm_conn_state_t new_state, ic); } else { (void) idm_notify_client(ic, CN_CONNECT_FAIL, - NULL); + (uintptr_t)NULL); } } /*FALLTHROUGH*/ @@ -1320,9 +1323,10 @@ idm_update_state(idm_conn_t *ic, idm_conn_state_t new_state, ic->ic_transport_ops->it_tgt_enable_datamover(ic); if (idm_status == IDM_STATUS_SUCCESS) { - idm_conn_event(ic, CE_ENABLE_DM_SUCCESS, NULL); + idm_conn_event(ic, CE_ENABLE_DM_SUCCESS, + (uintptr_t)NULL); } else { - idm_conn_event(ic, CE_ENABLE_DM_FAIL, NULL); + idm_conn_event(ic, CE_ENABLE_DM_FAIL, (uintptr_t)NULL); } break; @@ -1349,11 +1353,13 @@ idm_conn_unref(void *ic_void) * IDM connection). */ if (IDM_CONN_ISTGT(ic)) { - (void) idm_notify_client(ic, CN_CONNECT_DESTROY, NULL); + (void) idm_notify_client(ic, CN_CONNECT_DESTROY, + (uintptr_t)NULL); idm_svc_conn_destroy(ic); } else { /* Initiator may destroy connection during this call */ - (void) idm_notify_client(ic, CN_CONNECT_DESTROY, NULL); + (void) idm_notify_client(ic, CN_CONNECT_DESTROY, + (uintptr_t)NULL); } } @@ -1372,7 +1378,7 @@ idm_conn_reject_unref(void *ic_void) static idm_pdu_event_action_t idm_conn_sm_validate_pdu(idm_conn_t *ic, idm_conn_event_ctx_t *event_ctx, - idm_pdu_t *pdu) + idm_pdu_t *pdu) { char *reason_string; idm_pdu_event_action_t action; @@ -1609,7 +1615,7 @@ idm_ffp_enable(idm_conn_t *ic) ic->ic_ffp = B_TRUE; mutex_exit(&ic->ic_state_mutex); - rc = idm_notify_client(ic, CN_FFP_ENABLED, NULL); + rc = idm_notify_client(ic, CN_FFP_ENABLED, (uintptr_t)NULL); if (rc != IDM_STATUS_SUCCESS) { mutex_enter(&ic->ic_state_mutex); ic->ic_ffp = B_FALSE; diff --git a/usr/src/uts/common/io/idm/idm_impl.c b/usr/src/uts/common/io/idm/idm_impl.c index 0ebf6edda7..76a2ad0525 100644 --- a/usr/src/uts/common/io/idm/idm_impl.c +++ b/usr/src/uts/common/io/idm/idm_impl.c @@ -297,7 +297,7 @@ idm_parse_login_rsp(idm_conn_t *ic, idm_pdu_t *login_rsp_pdu, boolean_t rx) void idm_parse_logout_req(idm_conn_t *ic, idm_pdu_t *logout_req_pdu, boolean_t rx) { - iscsi_logout_hdr_t *logout_req = + iscsi_logout_hdr_t *logout_req = (iscsi_logout_hdr_t *)logout_req_pdu->isp_hdr; idm_conn_event_t new_event; uint8_t reason = @@ -514,7 +514,7 @@ idm_tgt_conn_finish(idm_conn_t *ic) { idm_status_t rc; - rc = idm_notify_client(ic, CN_CONNECT_ACCEPT, NULL); + rc = idm_notify_client(ic, CN_CONNECT_ACCEPT, (uintptr_t)NULL); if (rc != IDM_STATUS_SUCCESS) { return (IDM_STATUS_REJECT); } @@ -1170,7 +1170,8 @@ idm_wd_thread(void *arg) "conn %p idle for %d seconds, " "sending CE_TRANSPORT_FAIL", (void *)ic, (int)idle_time); - idm_conn_event(ic, CE_TRANSPORT_FAIL, NULL); + idm_conn_event(ic, CE_TRANSPORT_FAIL, + (uintptr_t)NULL); mutex_enter(&idm.idm_global_mutex); mutex_enter(&ic->ic_state_mutex); } diff --git a/usr/src/uts/common/io/idm/idm_so.c b/usr/src/uts/common/io/idm/idm_so.c index e2d29e55ef..345483eeba 100644 --- a/usr/src/uts/common/io/idm/idm_so.c +++ b/usr/src/uts/common/io/idm/idm_so.c @@ -388,7 +388,7 @@ idm_v6_addr_okay(struct in6_addr *addr6) int idm_get_ipaddr(idm_addr_list_t **ipaddr_p) { - ksocket_t so4, so6; + ksocket_t so4, so6; struct lifnum lifn; struct lifconf lifc; struct lifreq *lp; @@ -622,7 +622,7 @@ idm_iov_sosend(ksocket_t so, iovec_t *iop, int iovlen, size_t total_len) { struct msghdr msg; int error; - size_t sent = 0; + size_t sent = 0; ASSERT(iop != NULL); @@ -663,7 +663,7 @@ idm_iov_sorecv(ksocket_t so, iovec_t *iop, int iovlen, size_t total_len) struct msghdr msg; int error; size_t recv; - int flags; + int flags; ASSERT(iop != NULL); @@ -981,7 +981,7 @@ idm_so_ini_conn_connect(idm_conn_t *ic) { idm_so_conn_t *so_conn; struct sonode *node = NULL; - int rc; + int rc; clock_t lbolt, conn_login_max, conn_login_interval; boolean_t nonblock; @@ -1324,7 +1324,7 @@ idm_so_svc_port_watcher(void *arg) idm_so_svc_t *so_svc; int rc; const uint32_t off = 0; - struct sockaddr_in6 t_addr; + struct sockaddr_in6 t_addr; socklen_t t_addrlen; bzero(&t_addr, sizeof (struct sockaddr_in6)); @@ -1386,7 +1386,7 @@ idm_so_svc_port_watcher(void *arg) * Kick the state machine. At CS_S3_XPT_UP the state machine * will notify the client (target) about the new connection. */ - idm_conn_event(ic, CE_CONNECT_ACCEPT, NULL); + idm_conn_event(ic, CE_CONNECT_ACCEPT, (uintptr_t)NULL); mutex_enter(&svc->is_mutex); } @@ -2618,7 +2618,7 @@ idm_so_send_rtt_data(idm_conn_t *ic, idm_task_t *idt, idm_buf_t *idb, mutex_enter(&ic->ic_state_mutex); if (ic->ic_ffp) idm_conn_event_locked(ic, CE_TRANSPORT_FAIL, - NULL, CT_NONE); + (uintptr_t)NULL, CT_NONE); mutex_exit(&ic->ic_state_mutex); mutex_exit(&idt->idt_mutex); return; diff --git a/usr/src/uts/common/io/mac/mac.c b/usr/src/uts/common/io/mac/mac.c index 0192e2d0d1..f258aad701 100644 --- a/usr/src/uts/common/io/mac/mac.c +++ b/usr/src/uts/common/io/mac/mac.c @@ -6680,7 +6680,7 @@ i_mac_group_allocate_rings(mac_impl_t *mip, mac_ring_type_t ring_type, /* * First find the rings to allocate to the group. */ - if (share != NULL) { + if (share != 0) { /* get rings through ms_squery() */ mip->mi_share_capab.ms_squery(share, ring_type, NULL, &nrings); ASSERT(nrings != 0); @@ -6789,7 +6789,7 @@ i_mac_group_allocate_rings(mac_impl_t *mip, mac_ring_type_t ring_type, } /* add group to share */ - if (share != NULL) + if (share != 0) mip->mi_share_capab.ms_sadd(share, new_group->mrg_driver); bail: @@ -7040,7 +7040,7 @@ mac_reserve_rx_group(mac_client_impl_t *mcip, uint8_t *mac_addr, boolean_t move) * the rings from the driver, let's populate * the property for the client now. */ - if (share != NULL) { + if (share != 0) { mac_client_set_rings( (mac_client_handle_t)mcip, grp->mrg_cur_count, -1); @@ -7127,7 +7127,7 @@ mac_reserve_rx_group(mac_client_impl_t *mcip, uint8_t *mac_addr, boolean_t move) * the rings from the driver, let's populate * the property for the client now. */ - if (share != NULL) { + if (share != 0) { mac_client_set_rings( (mac_client_handle_t)mcip, grp->mrg_cur_count, -1); @@ -7191,7 +7191,7 @@ mac_release_rx_group(mac_client_impl_t *mcip, mac_group_t *group) } /* remove group from share */ - if (mcip->mci_share != NULL) { + if (mcip->mci_share != 0) { mip->mi_share_capab.ms_sremove(mcip->mci_share, group->mrg_driver); } @@ -7534,7 +7534,7 @@ mac_reserve_tx_group(mac_client_impl_t *mcip, boolean_t move) gclient = MAC_GROUP_ONLY_CLIENT(grp); VERIFY3P(gclient, !=, NULL); gmrp = MCIP_RESOURCE_PROPS(gclient); - if (gclient->mci_share == NULL && + if (gclient->mci_share == 0 && (gmrp->mrp_mask & MRP_TX_RINGS) == 0 && (unspec || (grp->mrg_cur_count + defnrings) >= @@ -7603,7 +7603,7 @@ mac_reserve_tx_group(mac_client_impl_t *mcip, boolean_t move) * the rings from the driver, let's populate * the property for the client now. */ - if (share != NULL) { + if (share != 0) { mac_client_set_rings( (mac_client_handle_t)mcip, -1, grp->mrg_cur_count); @@ -7637,7 +7637,7 @@ mac_reserve_tx_group(mac_client_impl_t *mcip, boolean_t move) * For a share i_mac_group_allocate_rings gets the rings from the * driver, let's populate the property for the client now. */ - if (share != NULL) { + if (share != 0) { mac_client_set_rings((mac_client_handle_t)mcip, -1, grp->mrg_cur_count); } @@ -7671,7 +7671,7 @@ mac_release_tx_group(mac_client_impl_t *mcip, mac_group_t *grp) mac_srs_stat_delete(srs); } } - if (share != NULL) + if (share != 0) mip->mi_share_capab.ms_sremove(share, grp->mrg_driver); /* move the ring back to the pool */ diff --git a/usr/src/uts/common/io/mac/mac_client.c b/usr/src/uts/common/io/mac/mac_client.c index 88b29c0e8f..50316bb81e 100644 --- a/usr/src/uts/common/io/mac/mac_client.c +++ b/usr/src/uts/common/io/mac/mac_client.c @@ -1452,7 +1452,7 @@ mac_client_open(mac_handle_t mh, mac_client_handle_t *mchp, char *name, */ mac_client_add(mcip); - mcip->mci_share = NULL; + mcip->mci_share = 0; if (share_desired) i_mac_share_alloc(mcip); @@ -1734,7 +1734,7 @@ mac_client_set_rings_prop(mac_client_impl_t *mcip, mac_resource_props_t *mrp, uint_t ringcnt; boolean_t unspec; - if (mcip->mci_share != NULL) + if (mcip->mci_share != 0) return (EINVAL); if (mrp->mrp_mask & MRP_RX_RINGS) { @@ -3521,7 +3521,7 @@ mac_tx_cookie_t mac_tx(mac_client_handle_t mch, mblk_t *mp_chain, uintptr_t hint, uint16_t flag, mblk_t **ret_mp) { - mac_tx_cookie_t cookie = NULL; + mac_tx_cookie_t cookie = 0; int error; mac_tx_percpu_t *mytx; mac_soft_ring_set_t *srs; @@ -3538,7 +3538,7 @@ mac_tx(mac_client_handle_t mch, mblk_t *mp_chain, uintptr_t hint, MAC_TX_TRY_HOLD(mcip, mytx, error); if (error != 0) { freemsgchain(mp_chain); - return (NULL); + return (0); } } @@ -3626,7 +3626,7 @@ mac_tx(mac_client_handle_t mch, mblk_t *mp_chain, uintptr_t hint, MAC_TX(mip, srs_tx->st_arg2, mp_chain, mcip); if (mp_chain == NULL) { - cookie = NULL; + cookie = 0; SRS_TX_STAT_UPDATE(srs, opackets, 1); SRS_TX_STAT_UPDATE(srs, obytes, obytes); } else { @@ -3696,7 +3696,7 @@ mac_tx_is_flow_blocked(mac_client_handle_t mch, mac_tx_cookie_t cookie) */ if (mac_srs->srs_tx.st_mode == SRS_TX_FANOUT || mac_srs->srs_tx.st_mode == SRS_TX_AGGR) { - if (cookie != NULL) { + if (cookie != 0) { sringp = (mac_soft_ring_t *)cookie; mutex_enter(&sringp->s_ring_lock); if (sringp->s_ring_state & S_RING_TX_HIWAT) diff --git a/usr/src/uts/common/io/mac/mac_datapath_setup.c b/usr/src/uts/common/io/mac/mac_datapath_setup.c index 70585df698..3697d888e7 100644 --- a/usr/src/uts/common/io/mac/mac_datapath_setup.c +++ b/usr/src/uts/common/io/mac/mac_datapath_setup.c @@ -550,7 +550,7 @@ mac_next_bind_cpu(cpupart_t *cpupart) } while ((cp = cp->cpu_next_onln) != cp_start); - return (NULL); + return (-1); /* No matching CPU found online */ } /* ARGSUSED */ @@ -2082,7 +2082,7 @@ mac_srs_create(mac_client_impl_t *mcip, flow_entry_t *flent, uint32_t srs_type, mac_direct_rx_t rx_func, void *x_arg1, mac_resource_handle_t x_arg2, mac_ring_t *ring) { - mac_soft_ring_set_t *mac_srs; + mac_soft_ring_set_t *mac_srs; mac_srs_rx_t *srs_rx; mac_srs_tx_t *srs_tx; mac_bw_ctl_t *mac_bw; @@ -2396,7 +2396,7 @@ mac_rx_srs_group_setup(mac_client_impl_t *mcip, flow_entry_t *flent, { mac_impl_t *mip = mcip->mci_mip; mac_soft_ring_set_t *mac_srs; - mac_ring_t *ring; + mac_ring_t *ring; uint32_t fanout_type; mac_group_t *rx_group = flent->fe_rx_ring_group; boolean_t no_unicast; @@ -3016,7 +3016,7 @@ mac_datapath_setup(mac_client_impl_t *mcip, flow_entry_t *flent, if (rgroup != NULL) { if (rgroup != default_rgroup && MAC_GROUP_NO_CLIENT(rgroup) && - (rxhw || mcip->mci_share != NULL)) { + (rxhw || mcip->mci_share != 0)) { MAC_RX_GRP_RESERVED(mip); if (mip->mi_rx_group_type == MAC_GROUP_TYPE_DYNAMIC) { @@ -3045,7 +3045,7 @@ mac_datapath_setup(mac_client_impl_t *mcip, flow_entry_t *flent, if (tgroup != NULL) { if (tgroup != default_tgroup && MAC_GROUP_NO_CLIENT(tgroup) && - (txhw || mcip->mci_share != NULL)) { + (txhw || mcip->mci_share != 0)) { MAC_TX_GRP_RESERVED(mip); if (mip->mi_tx_group_type == MAC_GROUP_TYPE_DYNAMIC) { diff --git a/usr/src/uts/common/io/mac/mac_hio.c b/usr/src/uts/common/io/mac/mac_hio.c index 703c42b4cc..100f071220 100644 --- a/usr/src/uts/common/io/mac/mac_hio.c +++ b/usr/src/uts/common/io/mac/mac_hio.c @@ -94,7 +94,7 @@ i_mac_share_free(mac_client_impl_t *mcip) /* MAC clients are required to unbind they shares before freeing them */ ASSERT((mcip->mci_state_flags & MCIS_SHARE_BOUND) == 0); - if (mcip->mci_share == NULL) { + if (mcip->mci_share == 0) { i_mac_perim_exit(mip); return; } @@ -118,7 +118,7 @@ mac_share_bind(mac_client_handle_t mch, uint64_t cookie, uint64_t *rcookie) i_mac_perim_enter(mip); - if (mcip->mci_share == NULL) { + if (mcip->mci_share == 0) { i_mac_perim_exit(mip); return (ENOTSUP); } @@ -168,7 +168,7 @@ mac_share_unbind(mac_client_handle_t mch) i_mac_perim_enter(mip); - if (mcip->mci_share == NULL) { + if (mcip->mci_share == 0) { i_mac_perim_exit(mip); return; } diff --git a/usr/src/uts/common/io/mac/mac_sched.c b/usr/src/uts/common/io/mac/mac_sched.c index e42cbd1320..0e62f828a9 100644 --- a/usr/src/uts/common/io/mac/mac_sched.c +++ b/usr/src/uts/common/io/mac/mac_sched.c @@ -42,157 +42,157 @@ * * MAC * - * This driver. It interfaces with device drivers and provides abstractions - * that the rest of the system consumes. All data links -- things managed - * with dladm(1M), are accessed through MAC. + * This driver. It interfaces with device drivers and provides abstractions + * that the rest of the system consumes. All data links -- things managed + * with dladm(1M), are accessed through MAC. * * GLDv3 DEVICE DRIVER * - * A GLDv3 device driver refers to a driver, both for pseudo-devices and - * real devices, which implement the GLDv3 driver API. Common examples of - * these are igb and ixgbe, which are drivers for various Intel networking - * cards. These devices may or may not have various features, such as - * hardware rings and checksum offloading. For MAC, a GLDv3 device is the - * final point for the transmission of a packet and the starting point for - * the receipt of a packet. + * A GLDv3 device driver refers to a driver, both for pseudo-devices and + * real devices, which implement the GLDv3 driver API. Common examples of + * these are igb and ixgbe, which are drivers for various Intel networking + * cards. These devices may or may not have various features, such as + * hardware rings and checksum offloading. For MAC, a GLDv3 device is the + * final point for the transmission of a packet and the starting point for + * the receipt of a packet. * * FLOWS * - * At a high level, a flow refers to a series of packets that are related. - * Often times the term is used in the context of TCP to indicate a unique - * TCP connection and the traffic over it. However, a flow can exist at - * other levels of the system as well. MAC has a notion of a default flow - * which is used for all unicast traffic addressed to the address of a MAC - * device. For example, when a VNIC is created, a default flow is created - * for the VNIC's MAC address. In addition, flows are created for broadcast - * groups and a user may create a flow with flowadm(1M). + * At a high level, a flow refers to a series of packets that are related. + * Often times the term is used in the context of TCP to indicate a unique + * TCP connection and the traffic over it. However, a flow can exist at + * other levels of the system as well. MAC has a notion of a default flow + * which is used for all unicast traffic addressed to the address of a MAC + * device. For example, when a VNIC is created, a default flow is created + * for the VNIC's MAC address. In addition, flows are created for broadcast + * groups and a user may create a flow with flowadm(1M). * * CLASSIFICATION * - * Classification refers to the notion of identifying an incoming frame - * based on its destination address and optionally its source addresses and - * doing different processing based on that information. Classification can - * be done in both hardware and software. In general, we usually only - * classify based on the layer two destination, eg. for Ethernet, the - * destination MAC address. + * Classification refers to the notion of identifying an incoming frame + * based on its destination address and optionally its source addresses and + * doing different processing based on that information. Classification can + * be done in both hardware and software. In general, we usually only + * classify based on the layer two destination, eg. for Ethernet, the + * destination MAC address. * - * The system also will do classification based on layer three and layer - * four properties. This is used to support things like flowadm(1M), which - * allows setting QoS and other properties on a per-flow basis. + * The system also will do classification based on layer three and layer + * four properties. This is used to support things like flowadm(1M), which + * allows setting QoS and other properties on a per-flow basis. * * RING * - * Conceptually, a ring represents a series of framed messages, often in a - * contiguous chunk of memory that acts as a circular buffer. Rings come in - * a couple of forms. Generally they are either a hardware construct (hw - * ring) or they are a software construct (sw ring) maintained by MAC. + * Conceptually, a ring represents a series of framed messages, often in a + * contiguous chunk of memory that acts as a circular buffer. Rings come in + * a couple of forms. Generally they are either a hardware construct (hw + * ring) or they are a software construct (sw ring) maintained by MAC. * * HW RING * - * A hardware ring is a set of resources provided by a GLDv3 device driver - * (even if it is a pseudo-device). A hardware ring comes in two different - * forms: receive (rx) rings and transmit (tx) rings. An rx hw ring is - * something that has a unique DMA (direct memory access) region and - * generally supports some form of classification (though it isn't always - * used), as well as a means of generating an interrupt specific to that - * ring. For example, the device may generate a specific MSI-X for a PCI - * express device. A tx ring is similar, except that it is dedicated to - * transmission. It may also be a vector for enabling features such as VLAN - * tagging and large transmit offloading. It usually has its own dedicated - * interrupts for transmit being completed. + * A hardware ring is a set of resources provided by a GLDv3 device driver + * (even if it is a pseudo-device). A hardware ring comes in two different + * forms: receive (rx) rings and transmit (tx) rings. An rx hw ring is + * something that has a unique DMA (direct memory access) region and + * generally supports some form of classification (though it isn't always + * used), as well as a means of generating an interrupt specific to that + * ring. For example, the device may generate a specific MSI-X for a PCI + * express device. A tx ring is similar, except that it is dedicated to + * transmission. It may also be a vector for enabling features such as VLAN + * tagging and large transmit offloading. It usually has its own dedicated + * interrupts for transmit being completed. * * SW RING * - * A software ring is a construction of MAC. It represents the same thing - * that a hardware ring generally does, a collection of frames. However, - * instead of being in a contiguous ring of memory, they're instead linked - * by using the mblk_t's b_next pointer. Each frame may itself be multiple - * mblk_t's linked together by the b_cont pointer. A software ring always - * represents a collection of classified packets; however, it varies as to - * whether it uses only layer two information, or a combination of that and - * additional layer three and layer four data. + * A software ring is a construction of MAC. It represents the same thing + * that a hardware ring generally does, a collection of frames. However, + * instead of being in a contiguous ring of memory, they're instead linked + * by using the mblk_t's b_next pointer. Each frame may itself be multiple + * mblk_t's linked together by the b_cont pointer. A software ring always + * represents a collection of classified packets; however, it varies as to + * whether it uses only layer two information, or a combination of that and + * additional layer three and layer four data. * * FANOUT * - * Fanout is the idea of spreading out the load of processing frames based - * on the source and destination information contained in the layer two, - * three, and four headers, such that the data can then be processed in - * parallel using multiple hardware threads. + * Fanout is the idea of spreading out the load of processing frames based + * on the source and destination information contained in the layer two, + * three, and four headers, such that the data can then be processed in + * parallel using multiple hardware threads. * - * A fanout algorithm hashes the headers and uses that to place different - * flows into a bucket. The most important thing is that packets that are - * in the same flow end up in the same bucket. If they do not, performance - * can be adversely affected. Consider the case of TCP. TCP severely - * penalizes a connection if the data arrives out of order. If a given flow - * is processed on different CPUs, then the data will appear out of order, - * hence the invariant that fanout always hash a given flow to the same - * bucket and thus get processed on the same CPU. + * A fanout algorithm hashes the headers and uses that to place different + * flows into a bucket. The most important thing is that packets that are + * in the same flow end up in the same bucket. If they do not, performance + * can be adversely affected. Consider the case of TCP. TCP severely + * penalizes a connection if the data arrives out of order. If a given flow + * is processed on different CPUs, then the data will appear out of order, + * hence the invariant that fanout always hash a given flow to the same + * bucket and thus get processed on the same CPU. * * RECEIVE SIDE SCALING (RSS) * * - * Receive side scaling is a term that isn't common in illumos, but is used - * by vendors and was popularized by Microsoft. It refers to the idea of - * spreading the incoming receive load out across multiple interrupts which - * can be directed to different CPUs. This allows a device to leverage - * hardware rings even when it doesn't support hardware classification. The - * hardware uses an algorithm to perform fanout that ensures the flow - * invariant is maintained. + * Receive side scaling is a term that isn't common in illumos, but is used + * by vendors and was popularized by Microsoft. It refers to the idea of + * spreading the incoming receive load out across multiple interrupts which + * can be directed to different CPUs. This allows a device to leverage + * hardware rings even when it doesn't support hardware classification. The + * hardware uses an algorithm to perform fanout that ensures the flow + * invariant is maintained. * * SOFT RING SET * - * A soft ring set, commonly abbreviated SRS, is a collection of rings and - * is used for both transmitting and receiving. It is maintained in the - * structure mac_soft_ring_set_t. A soft ring set is usually associated - * with flows, and coordinates both the use of hardware and software rings. - * Because the use of hardware rings can change as devices such as VNICs - * come and go, we always ensure that the set has software classification - * rules that correspond to the hardware classification rules from rings. + * A soft ring set, commonly abbreviated SRS, is a collection of rings and + * is used for both transmitting and receiving. It is maintained in the + * structure mac_soft_ring_set_t. A soft ring set is usually associated + * with flows, and coordinates both the use of hardware and software rings. + * Because the use of hardware rings can change as devices such as VNICs + * come and go, we always ensure that the set has software classification + * rules that correspond to the hardware classification rules from rings. * - * Soft ring sets are also used for the enforcement of various QoS - * properties. For example, if a bandwidth limit has been placed on a - * specific flow or device, then that will be enforced by the soft ring - * set. + * Soft ring sets are also used for the enforcement of various QoS + * properties. For example, if a bandwidth limit has been placed on a + * specific flow or device, then that will be enforced by the soft ring + * set. * * SERVICE ATTACHMENT POINT (SAP) * - * The service attachment point is a DLPI (Data Link Provider Interface) - * concept; however, it comes up quite often in MAC. Most MAC devices speak - * a protocol that has some notion of different channels or message type - * identifiers. For example, Ethernet defines an EtherType which is a part - * of the Ethernet header and defines the particular protocol of the data - * payload. If the EtherType is set to 0x0800, then it defines that the - * contents of that Ethernet frame is IPv4 traffic. For Ethernet, the - * EtherType is the SAP. - * - * In DLPI, a given consumer attaches to a specific SAP. In illumos, the ip - * and arp drivers attach to the EtherTypes for IPv4, IPv6, and ARP. Using - * libdlpi(3LIB) user software can attach to arbitrary SAPs. With the - * exception of 802.1Q VLAN tagged traffic, MAC itself does not directly - * consume the SAP; however, it uses that information as part of hashing - * and it may be used as part of the construction of flows. + * The service attachment point is a DLPI (Data Link Provider Interface) + * concept; however, it comes up quite often in MAC. Most MAC devices speak + * a protocol that has some notion of different channels or message type + * identifiers. For example, Ethernet defines an EtherType which is a part + * of the Ethernet header and defines the particular protocol of the data + * payload. If the EtherType is set to 0x0800, then it defines that the + * contents of that Ethernet frame is IPv4 traffic. For Ethernet, the + * EtherType is the SAP. + * + * In DLPI, a given consumer attaches to a specific SAP. In illumos, the ip + * and arp drivers attach to the EtherTypes for IPv4, IPv6, and ARP. Using + * libdlpi(3LIB) user software can attach to arbitrary SAPs. With the + * exception of 802.1Q VLAN tagged traffic, MAC itself does not directly + * consume the SAP; however, it uses that information as part of hashing + * and it may be used as part of the construction of flows. * * PRIMARY MAC CLIENT * - * The primary mac client refers to a mac client whose unicast address - * matches the address of the device itself. For example, if the system has - * instance of the e1000g driver such as e1000g0, e1000g1, etc., the - * primary mac client is the one named after the device itself. VNICs that - * are created on top of such devices are not the primary client. + * The primary mac client refers to a mac client whose unicast address + * matches the address of the device itself. For example, if the system has + * instance of the e1000g driver such as e1000g0, e1000g1, etc., the + * primary mac client is the one named after the device itself. VNICs that + * are created on top of such devices are not the primary client. * * TRANSMIT DESCRIPTORS * - * Transmit descriptors are a resource that most GLDv3 device drivers have. - * Generally, a GLDv3 device driver takes a frame that's meant to be output - * and puts a copy of it into a region of memory. Each region of memory - * usually has an associated descriptor that the device uses to manage - * properties of the frames. Devices have a limited number of such - * descriptors. They get reclaimed once the device finishes putting the - * frame on the wire. + * Transmit descriptors are a resource that most GLDv3 device drivers have. + * Generally, a GLDv3 device driver takes a frame that's meant to be output + * and puts a copy of it into a region of memory. Each region of memory + * usually has an associated descriptor that the device uses to manage + * properties of the frames. Devices have a limited number of such + * descriptors. They get reclaimed once the device finishes putting the + * frame on the wire. * - * If the driver runs out of transmit descriptors, for example, the OS is - * generating more frames than it can put on the wire, then it will return - * them back to the MAC layer. + * If the driver runs out of transmit descriptors, for example, the OS is + * generating more frames than it can put on the wire, then it will return + * them back to the MAC layer. * * --------------------------------- * Rings, Classification, and Fanout @@ -1194,7 +1194,7 @@ boolean_t mac_latency_optimize = B_TRUE; #define MAC_SRS_WORKER_POLLING_ON(mac_srs) { \ ASSERT(MUTEX_HELD(&(mac_srs)->srs_lock)); \ if (((mac_srs)->srs_state & \ - (SRS_POLLING_CAPAB|SRS_WORKER|SRS_POLLING)) == \ + (SRS_POLLING_CAPAB|SRS_WORKER|SRS_POLLING)) == \ (SRS_POLLING_CAPAB|SRS_WORKER)) { \ (mac_srs)->srs_state |= SRS_POLLING; \ (void) mac_hwring_disable_intr((mac_ring_handle_t) \ @@ -1217,11 +1217,11 @@ boolean_t mac_latency_optimize = B_TRUE; \ ASSERT(MUTEX_HELD(&(mac_srs)->srs_lock)); \ srs_rx->sr_poll_thr_sig++; \ - if (((mac_srs)->srs_state & \ + if (((mac_srs)->srs_state & \ (SRS_POLLING_CAPAB|SRS_WORKER|SRS_GET_PKTS)) == \ (SRS_WORKER|SRS_POLLING_CAPAB)) { \ (mac_srs)->srs_state |= SRS_GET_PKTS; \ - cv_signal(&(mac_srs)->srs_cv); \ + cv_signal(&(mac_srs)->srs_cv); \ } else { \ srs_rx->sr_poll_thr_busy++; \ } \ @@ -1241,7 +1241,7 @@ boolean_t mac_latency_optimize = B_TRUE; clock_t now = ddi_get_lbolt(); \ if ((mac_srs)->srs_bw->mac_bw_curr_time != now) { \ (mac_srs)->srs_bw->mac_bw_curr_time = now; \ - (mac_srs)->srs_bw->mac_bw_used = 0; \ + (mac_srs)->srs_bw->mac_bw_used = 0; \ if ((mac_srs)->srs_bw->mac_bw_state & SRS_BW_ENFORCED) \ (mac_srs)->srs_bw->mac_bw_state &= ~SRS_BW_ENFORCED; \ } \ @@ -2216,13 +2216,13 @@ ssize_t max_bytes_to_pickup = SRS_BYTES_TO_PICKUP; void mac_rx_srs_poll_ring(mac_soft_ring_set_t *mac_srs) { - kmutex_t *lock = &mac_srs->srs_lock; - kcondvar_t *async = &mac_srs->srs_cv; + kmutex_t *lock = &mac_srs->srs_lock; + kcondvar_t *async = &mac_srs->srs_cv; mac_srs_rx_t *srs_rx = &mac_srs->srs_rx; - mblk_t *head, *tail, *mp; - callb_cpr_t cprinfo; - ssize_t bytes_to_pickup; - size_t sz; + mblk_t *head, *tail, *mp; + callb_cpr_t cprinfo; + ssize_t bytes_to_pickup; + size_t sz; int count; mac_client_impl_t *smcip; @@ -2489,12 +2489,12 @@ static mblk_t * mac_srs_pick_chain(mac_soft_ring_set_t *mac_srs, mblk_t **chain_tail, size_t *chain_sz, int *chain_cnt) { - mblk_t *head = NULL; - mblk_t *tail = NULL; + mblk_t *head = NULL; + mblk_t *tail = NULL; size_t sz; - size_t tsz = 0; + size_t tsz = 0; int cnt = 0; - mblk_t *mp; + mblk_t *mp; ASSERT(MUTEX_HELD(&mac_srs->srs_lock)); mutex_enter(&mac_srs->srs_bw->mac_bw_lock); @@ -2575,9 +2575,9 @@ mac_srs_pick_chain(mac_soft_ring_set_t *mac_srs, mblk_t **chain_tail, void mac_rx_srs_drain(mac_soft_ring_set_t *mac_srs, uint_t proc_type) { - mblk_t *head; + mblk_t *head; mblk_t *tail; - timeout_id_t tid; + timeout_id_t tid; int cnt = 0; mac_client_impl_t *mcip = mac_srs->srs_mcip; mac_srs_rx_t *srs_rx = &mac_srs->srs_rx; @@ -2812,9 +2812,9 @@ out: void mac_rx_srs_drain_bw(mac_soft_ring_set_t *mac_srs, uint_t proc_type) { - mblk_t *head; + mblk_t *head; mblk_t *tail; - timeout_id_t tid; + timeout_id_t tid; size_t sz = 0; int cnt = 0; mac_client_impl_t *mcip = mac_srs->srs_mcip; @@ -3079,8 +3079,8 @@ leave_poll: void mac_srs_worker(mac_soft_ring_set_t *mac_srs) { - kmutex_t *lock = &mac_srs->srs_lock; - kcondvar_t *async = &mac_srs->srs_async; + kmutex_t *lock = &mac_srs->srs_lock; + kcondvar_t *async = &mac_srs->srs_async; callb_cpr_t cprinfo; boolean_t bw_ctl_flag; @@ -3452,7 +3452,7 @@ mac_tx_cookie_t mac_tx_srs_no_desc(mac_soft_ring_set_t *mac_srs, mblk_t *mp_chain, uint16_t flag, mblk_t **ret_mp) { - mac_tx_cookie_t cookie = NULL; + mac_tx_cookie_t cookie = 0; mac_srs_tx_t *srs_tx = &mac_srs->srs_tx; boolean_t wakeup_worker = B_TRUE; uint32_t tx_mode = srs_tx->st_mode; @@ -3509,7 +3509,7 @@ static mac_tx_cookie_t mac_tx_srs_enqueue(mac_soft_ring_set_t *mac_srs, mblk_t *mp_chain, uint16_t flag, uintptr_t fanout_hint, mblk_t **ret_mp) { - mac_tx_cookie_t cookie = NULL; + mac_tx_cookie_t cookie = 0; int cnt, sz; mblk_t *tail; boolean_t wakeup_worker = B_TRUE; @@ -3652,7 +3652,7 @@ mac_tx_single_ring_mode(mac_soft_ring_set_t *mac_srs, mblk_t *mp_chain, { mac_srs_tx_t *srs_tx = &mac_srs->srs_tx; mac_tx_stats_t stats; - mac_tx_cookie_t cookie = NULL; + mac_tx_cookie_t cookie = 0; ASSERT(srs_tx->st_mode == SRS_TX_DEFAULT); @@ -3701,7 +3701,7 @@ mac_tx_single_ring_mode(mac_soft_ring_set_t *mac_srs, mblk_t *mp_chain, } SRS_TX_STATS_UPDATE(mac_srs, &stats); - return (NULL); + return (0); } /* @@ -3718,7 +3718,7 @@ mac_tx_serializer_mode(mac_soft_ring_set_t *mac_srs, mblk_t *mp_chain, uintptr_t fanout_hint, uint16_t flag, mblk_t **ret_mp) { mac_tx_stats_t stats; - mac_tx_cookie_t cookie = NULL; + mac_tx_cookie_t cookie = 0; mac_srs_tx_t *srs_tx = &mac_srs->srs_tx; /* Single ring, serialize below */ @@ -3734,7 +3734,7 @@ mac_tx_serializer_mode(mac_soft_ring_set_t *mac_srs, mblk_t *mp_chain, * is set and return mblks after TX_HIWAT is set. */ cookie = mac_tx_srs_enqueue(mac_srs, mp_chain, - flag, NULL, ret_mp); + flag, 0, ret_mp); mutex_exit(&mac_srs->srs_lock); return (cookie); } @@ -3753,7 +3753,7 @@ mac_tx_serializer_mode(mac_soft_ring_set_t *mac_srs, mblk_t *mp_chain, mac_srs->srs_state &= ~SRS_PROC; if (mp_chain != NULL) { cookie = mac_tx_srs_enqueue(mac_srs, - mp_chain, flag, NULL, ret_mp); + mp_chain, flag, 0, ret_mp); } if (mac_srs->srs_first != NULL) { /* @@ -3765,7 +3765,7 @@ mac_tx_serializer_mode(mac_soft_ring_set_t *mac_srs, mblk_t *mp_chain, } mutex_exit(&mac_srs->srs_lock); - if (cookie == NULL) + if (cookie == 0) SRS_TX_STATS_UPDATE(mac_srs, &stats); return (cookie); @@ -3783,7 +3783,7 @@ mac_tx_serializer_mode(mac_soft_ring_set_t *mac_srs, mblk_t *mp_chain, * queue any packets. */ -#define MAC_TX_SOFT_RING_PROCESS(chain) { \ +#define MAC_TX_SOFT_RING_PROCESS(chain) { \ index = COMPUTE_INDEX(hash, mac_srs->srs_tx_ring_count), \ softring = mac_srs->srs_tx_soft_rings[index]; \ cookie = mac_tx_soft_ring_process(softring, chain, flag, ret_mp); \ @@ -3797,7 +3797,7 @@ mac_tx_fanout_mode(mac_soft_ring_set_t *mac_srs, mblk_t *mp_chain, mac_soft_ring_t *softring; uint64_t hash; uint_t index; - mac_tx_cookie_t cookie = NULL; + mac_tx_cookie_t cookie = 0; ASSERT(mac_srs->srs_tx.st_mode == SRS_TX_FANOUT || mac_srs->srs_tx.st_mode == SRS_TX_BW_FANOUT); @@ -3862,7 +3862,7 @@ mac_tx_fanout_mode(mac_soft_ring_set_t *mac_srs, mblk_t *mp_chain, MAC_TX_SOFT_RING_PROCESS(sub_chain); } - cookie = NULL; + cookie = 0; } return (cookie); @@ -3882,7 +3882,7 @@ mac_tx_bw_mode(mac_soft_ring_set_t *mac_srs, mblk_t *mp_chain, { int cnt, sz; mblk_t *tail; - mac_tx_cookie_t cookie = NULL; + mac_tx_cookie_t cookie = 0; mac_srs_tx_t *srs_tx = &mac_srs->srs_tx; clock_t now; @@ -3973,7 +3973,7 @@ mac_tx_bw_mode(mac_soft_ring_set_t *mac_srs, mblk_t *mp_chain, } SRS_TX_STATS_UPDATE(mac_srs, &stats); - return (NULL); + return (0); } } @@ -4011,7 +4011,7 @@ mac_tx_aggr_mode(mac_soft_ring_set_t *mac_srs, mblk_t *mp_chain, find_tx_ring_fn = srs_tx->st_capab_aggr.mca_find_tx_ring_fn; arg = srs_tx->st_capab_aggr.mca_arg; if (find_tx_ring_fn(arg, mp_chain, fanout_hint, &ring) == NULL) - return (NULL); + return (0); sringp = srs_tx->st_soft_rings[((mac_ring_t *)ring)->mr_index]; return (mac_tx_soft_ring_process(sringp, mp_chain, flag, ret_mp)); } @@ -4609,7 +4609,7 @@ mac_tx_notify(mac_impl_t *mip) * a short period. */ -#define SOFT_RING_ENQUEUE_CHAIN(ringp, mp, tail, cnt, sz) { \ +#define SOFT_RING_ENQUEUE_CHAIN(ringp, mp, tail, cnt, sz) { \ /* \ * Enqueue our mblk chain. \ */ \ @@ -4787,7 +4787,7 @@ mac_rx_soft_ring_process(mac_client_impl_t *mcip, mac_soft_ring_t *ringp, * a short period. */ -#define TX_SOFT_RING_ENQUEUE_CHAIN(ringp, mp, tail, cnt, sz) { \ +#define TX_SOFT_RING_ENQUEUE_CHAIN(ringp, mp, tail, cnt, sz) { \ ASSERT(MUTEX_HELD(&ringp->s_ring_lock)); \ ringp->s_ring_state |= S_RING_ENQUEUED; \ SOFT_RING_ENQUEUE_CHAIN(ringp, mp_chain, tail, cnt, sz); \ @@ -4810,7 +4810,7 @@ mac_tx_sring_enqueue(mac_soft_ring_t *ringp, mblk_t *mp_chain, uint16_t flag, size_t sz; mblk_t *tail; mac_soft_ring_set_t *mac_srs = ringp->s_ring_set; - mac_tx_cookie_t cookie = NULL; + mac_tx_cookie_t cookie = 0; boolean_t wakeup_worker = B_TRUE; ASSERT(MUTEX_HELD(&ringp->s_ring_lock)); @@ -4894,7 +4894,7 @@ mac_tx_soft_ring_process(mac_soft_ring_t *ringp, mblk_t *mp_chain, int cnt; size_t sz; mblk_t *tail; - mac_tx_cookie_t cookie = NULL; + mac_tx_cookie_t cookie = 0; ASSERT(ringp != NULL); ASSERT(mp_chain != NULL); @@ -4984,6 +4984,6 @@ mac_tx_soft_ring_process(mac_soft_ring_t *ringp, mblk_t *mp_chain, SRS_TX_STATS_UPDATE(mac_srs, &stats); SOFTRING_TX_STATS_UPDATE(ringp, &stats); - return (NULL); + return (0); } } diff --git a/usr/src/uts/common/krtld/kobj.c b/usr/src/uts/common/krtld/kobj.c index 4f8997adfc..1038875bbc 100644 --- a/usr/src/uts/common/krtld/kobj.c +++ b/usr/src/uts/common/krtld/kobj.c @@ -3102,7 +3102,7 @@ do_symbols(struct module *mp, Elf64_Addr bss_base) } if (err) return (err); - if (assign == 0 && mp->bss == NULL) { + if (assign == 0 && mp->bss == 0) { mp->bss_align = bss_align; mp->bss_size = bss_ptr; } else if (resolved) { @@ -4155,7 +4155,7 @@ kobj_segbrk(caddr_t *spp, size_t size, size_t align, caddr_t limit) npva = (uintptr_t)BOP_ALLOC(ops, (caddr_t)pva, alloc_size, alloc_align); - if (npva == NULL) { + if (npva == 0) { _kobj_printf(ops, "BOP_ALLOC failed, 0x%lx bytes", alloc_size); _kobj_printf(ops, " aligned %lx", alloc_align); diff --git a/usr/src/uts/common/os/brand.c b/usr/src/uts/common/os/brand.c index 60e8150a0d..ecf396f926 100644 --- a/usr/src/uts/common/os/brand.c +++ b/usr/src/uts/common/os/brand.c @@ -910,19 +910,19 @@ brand_solaris_elfexec(vnode_t *vp, execa_t *uap, uarg_t *args, */ sedp->sed_ldentry = ehdr.e_entry; sedp->sed_entry = ehdr.e_entry; - sedp->sed_lddata = NULL; - sedp->sed_base = NULL; + sedp->sed_lddata = 0; + sedp->sed_base = 0; } else { /* * A shared object with no interpreter, we use * the calculated address from above. */ sedp->sed_ldentry = sedp->sed_entry; - sedp->sed_entry = NULL; - sedp->sed_phdr = NULL; - sedp->sed_phent = NULL; - sedp->sed_phnum = NULL; - sedp->sed_lddata = NULL; + sedp->sed_entry = 0; + sedp->sed_phdr = 0; + sedp->sed_phent = 0; + sedp->sed_phnum = 0; + sedp->sed_lddata = 0; sedp->sed_base = voffset; if (ehdr.e_type == ET_DYN) { @@ -1056,7 +1056,7 @@ brand_solaris_elfexec(vnode_t *vp, execa_t *uap, uarg_t *args, } up->u_auxv[i].a_un.a_val = val; - if (val == NULL) { + if (val == 0) { /* Hide the entry for static binaries */ up->u_auxv[i].a_type = AT_IGNORE; } diff --git a/usr/src/uts/common/os/panic.c b/usr/src/uts/common/os/panic.c index 09dc058fd8..62be47e843 100644 --- a/usr/src/uts/common/os/panic.c +++ b/usr/src/uts/common/os/panic.c @@ -178,7 +178,7 @@ char panic_preempt; /* t_preempt for panic_thread */ */ char *panic_bootstr = NULL; /* mdboot string to use after panic */ int panic_bootfcn = AD_BOOT; /* mdboot function to use after panic */ -int halt_on_panic = 0; /* halt after dump instead of reboot? */ +int halt_on_panic = 0; /* halt after dump instead of reboot? */ int nopanicdebug = 0; /* reboot instead of call debugger? */ int in_sync = 0; /* skip vfs_syncall() and just dump? */ @@ -311,7 +311,7 @@ panicsys(const char *format, va_list alist, struct regs *rp, int on_panic_stack) splx(ipltospl(CLOCK_LEVEL)); panic_quiesce_hw(pdp); (void) FTRACE_STOP(); - (void) callb_execute_class(CB_CL_PANIC, NULL); + (void) callb_execute_class(CB_CL_PANIC, 0); if (log_intrq != NULL) log_flushq(log_intrq); diff --git a/usr/src/uts/common/sys/link.h b/usr/src/uts/common/sys/link.h index 2b7a1e910a..78a679f8c3 100644 --- a/usr/src/uts/common/sys/link.h +++ b/usr/src/uts/common/sys/link.h @@ -161,6 +161,7 @@ typedef struct { #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 @@ typedef struct { #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 @@ typedef struct { /* Verneed Auxiliary Structure. */ 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 @@ typedef struct { #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 @@ typedef struct { #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 @@ typedef struct link_map Link_map; 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 diff --git a/usr/src/uts/i86pc/dboot/dboot_startkern.c b/usr/src/uts/i86pc/dboot/dboot_startkern.c index 74e3504d11..c3aafcc6e5 100644 --- a/usr/src/uts/i86pc/dboot/dboot_startkern.c +++ b/usr/src/uts/i86pc/dboot/dboot_startkern.c @@ -1733,7 +1733,7 @@ process_efi32(EFI_SYSTEM_TABLE32 *efi) bi->bi_smbios = (native_ptr_t)(uintptr_t) config[i].VendorTable; } - if (bi->bi_smbios == NULL && + if (bi->bi_smbios == 0 && dboot_same_guids(&config[i].VendorGuid, &smbios)) { bi->bi_smbios = (native_ptr_t)(uintptr_t) config[i].VendorTable; @@ -1742,7 +1742,7 @@ process_efi32(EFI_SYSTEM_TABLE32 *efi) bi->bi_acpi_rsdp = (native_ptr_t)(uintptr_t) config[i].VendorTable; } - if (bi->bi_acpi_rsdp == NULL && + if (bi->bi_acpi_rsdp == 0 && dboot_same_guids(&config[i].VendorGuid, &acpi1)) { bi->bi_acpi_rsdp = (native_ptr_t)(uintptr_t) config[i].VendorTable; @@ -1766,7 +1766,7 @@ process_efi64(EFI_SYSTEM_TABLE64 *efi) bi->bi_smbios = (native_ptr_t)(uintptr_t) config[i].VendorTable; } - if (bi->bi_smbios == NULL && + if (bi->bi_smbios == 0 && dboot_same_guids(&config[i].VendorGuid, &smbios)) { bi->bi_smbios = (native_ptr_t)(uintptr_t) config[i].VendorTable; @@ -1776,7 +1776,7 @@ process_efi64(EFI_SYSTEM_TABLE64 *efi) bi->bi_acpi_rsdp = (native_ptr_t)(uintptr_t) config[i].VendorTable; } - if (bi->bi_acpi_rsdp == NULL && + if (bi->bi_acpi_rsdp == 0 && dboot_same_guids(&config[i].VendorGuid, &acpi1)) { bi->bi_acpi_rsdp = (native_ptr_t)(uintptr_t) config[i].VendorTable; diff --git a/usr/src/uts/i86pc/io/amd_iommu/amd_iommu_impl.c b/usr/src/uts/i86pc/io/amd_iommu/amd_iommu_impl.c index b5ab7d9cf6..4287c37bb6 100644 --- a/usr/src/uts/i86pc/io/amd_iommu/amd_iommu_impl.c +++ b/usr/src/uts/i86pc/io/amd_iommu/amd_iommu_impl.c @@ -1211,13 +1211,13 @@ amd_iommu_fini(amd_iommu_t *iommu, int type) if (type == AMD_IOMMU_QUIESCE) return (DDI_SUCCESS); - if (iommu->aiomt_va != NULL) { + if (iommu->aiomt_va != 0) { hat_unload(kas.a_hat, (void *)(uintptr_t)iommu->aiomt_va, iommu->aiomt_reg_size, HAT_UNLOAD_UNLOCK); device_arena_free((void *)(uintptr_t)iommu->aiomt_va, ptob(iommu->aiomt_reg_pages)); - iommu->aiomt_va = NULL; - iommu->aiomt_reg_va = NULL; + iommu->aiomt_va = 0; + iommu->aiomt_reg_va = 0; } mutex_destroy(&iommu->aiomt_eventlock); mutex_destroy(&iommu->aiomt_cmdlock); diff --git a/usr/src/uts/i86pc/io/cbe.c b/usr/src/uts/i86pc/io/cbe.c index 87ec248717..030f667925 100644 --- a/usr/src/uts/i86pc/io/cbe.c +++ b/usr/src/uts/i86pc/io/cbe.c @@ -56,9 +56,9 @@ static void *cbe_xcall_farg; static cpuset_t cbe_enabled; static ddi_softint_hdl_impl_t cbe_low_hdl = - {0, NULL, NULL, NULL, 0, NULL, NULL, NULL}; + {0, 0, NULL, NULL, 0, NULL, NULL, NULL}; static ddi_softint_hdl_impl_t cbe_clock_hdl = - {0, NULL, NULL, NULL, 0, NULL, NULL, NULL}; + {0, 0, NULL, NULL, 0, NULL, NULL, NULL}; cyclic_id_t cbe_hres_cyclic; int cbe_psm_timer_mode = TIMER_ONESHOT; diff --git a/usr/src/uts/i86pc/os/cmi.c b/usr/src/uts/i86pc/os/cmi.c index b3d52c1726..6433407eee 100644 --- a/usr/src/uts/i86pc/os/cmi.c +++ b/usr/src/uts/i86pc/os/cmi.c @@ -216,7 +216,7 @@ cmi_load_modctl(modctl_t *modp) return (cmi); } - if ((ver = modlookup_by_modctl(modp, "_cmi_api_version")) == NULL) { + if ((ver = modlookup_by_modctl(modp, "_cmi_api_version")) == 0) { /* * Apparently a cpu module before versioning was introduced - * we call this version 0. diff --git a/usr/src/uts/i86pc/os/cmi_hw.c b/usr/src/uts/i86pc/os/cmi_hw.c index 290231b487..aa549569b0 100644 --- a/usr/src/uts/i86pc/os/cmi_hw.c +++ b/usr/src/uts/i86pc/os/cmi_hw.c @@ -717,7 +717,7 @@ ntv_getcr4(cmi_hdl_impl_t *hdl) cpu_t *cp = HDLPRIV(hdl); ulong_t val; - (void) call_func_ntv(cp->cpu_id, ntv_getcr4_xc, (xc_arg_t)&val, NULL); + (void) call_func_ntv(cp->cpu_id, ntv_getcr4_xc, (xc_arg_t)&val, 0); return (val); } @@ -740,7 +740,7 @@ ntv_setcr4(cmi_hdl_impl_t *hdl, ulong_t val) { cpu_t *cp = HDLPRIV(hdl); - (void) call_func_ntv(cp->cpu_id, ntv_setcr4_xc, (xc_arg_t)val, NULL); + (void) call_func_ntv(cp->cpu_id, ntv_setcr4_xc, (xc_arg_t)val, 0); } volatile uint32_t cmi_trapped_rdmsr; @@ -847,7 +847,7 @@ ntv_int(cmi_hdl_impl_t *hdl, int int_no) { cpu_t *cp = HDLPRIV(hdl); - (void) call_func_ntv(cp->cpu_id, ntv_int_xc, (xc_arg_t)int_no, NULL); + (void) call_func_ntv(cp->cpu_id, ntv_int_xc, (xc_arg_t)int_no, 0); } static int @@ -1728,7 +1728,7 @@ cmi_ntv_hwdisable_mce(cmi_hdl_t hdl) cmi_ntv_hwdisable_mce_xc(); } else { CPUSET_ONLY(set, cp->cpu_id); - xc_call(NULL, NULL, NULL, CPUSET2BV(set), + xc_call(0, 0, 0, CPUSET2BV(set), (xc_func_t)cmi_ntv_hwdisable_mce_xc); } } diff --git a/usr/src/uts/i86pc/os/cms.c b/usr/src/uts/i86pc/os/cms.c index 0433aeabfd..cb686c27d2 100644 --- a/usr/src/uts/i86pc/os/cms.c +++ b/usr/src/uts/i86pc/os/cms.c @@ -209,7 +209,7 @@ cms_load_modctl(modctl_t *modp) return (cms); } - if ((ver = modlookup_by_modctl(modp, "_cms_api_version")) == NULL) { + if ((ver = modlookup_by_modctl(modp, "_cms_api_version")) == 0) { cmn_err(CE_WARN, "cpu model-specific module '%s' is invalid: " "no _cms_api_version", modp->mod_modname); return (NULL); diff --git a/usr/src/uts/i86pc/os/cpupm/cpupm_throttle.c b/usr/src/uts/i86pc/os/cpupm/cpupm_throttle.c index 63ced2b9b1..b8c37a22c2 100644 --- a/usr/src/uts/i86pc/os/cpupm/cpupm_throttle.c +++ b/usr/src/uts/i86pc/os/cpupm/cpupm_throttle.c @@ -213,7 +213,7 @@ cpupm_throttle(cpuset_t set, uint32_t throtl_lvl) CPUSET_DEL(set, CPU->cpu_id); } if (!CPUSET_ISNULL(set)) { - xc_call((xc_arg_t)throtl_lvl, NULL, NULL, + xc_call((xc_arg_t)throtl_lvl, 0, 0, CPUSET2BV(set), (xc_func_t)cpupm_tstate_transition); } kpreempt_enable(); @@ -290,7 +290,7 @@ static int cpupm_throttle_get_max(processorid_t cpu_id) { cpu_t *cp = cpu[cpu_id]; - cpupm_mach_state_t *mach_state = + cpupm_mach_state_t *mach_state = (cpupm_mach_state_t *)(cp->cpu_m.mcpu_pm_mach_state); cpu_acpi_handle_t handle; int throtl_level; diff --git a/usr/src/uts/i86pc/os/cpupm/pwrnow.c b/usr/src/uts/i86pc/os/cpupm/pwrnow.c index a58e85256a..437019542a 100644 --- a/usr/src/uts/i86pc/os/cpupm/pwrnow.c +++ b/usr/src/uts/i86pc/os/cpupm/pwrnow.c @@ -153,7 +153,7 @@ pwrnow_power(cpuset_t set, uint32_t req_state) CPUSET_DEL(set, CPU->cpu_id); } if (!CPUSET_ISNULL(set)) { - xc_call((xc_arg_t)req_state, NULL, NULL, + xc_call((xc_arg_t)req_state, 0, 0, CPUSET2BV(set), (xc_func_t)pwrnow_pstate_transition); } kpreempt_enable(); diff --git a/usr/src/uts/i86pc/os/cpupm/speedstep.c b/usr/src/uts/i86pc/os/cpupm/speedstep.c index 021eab7e41..6f3dfab61c 100644 --- a/usr/src/uts/i86pc/os/cpupm/speedstep.c +++ b/usr/src/uts/i86pc/os/cpupm/speedstep.c @@ -168,7 +168,7 @@ speedstep_power(cpuset_t set, uint32_t req_state) CPUSET_DEL(set, CPU->cpu_id); } if (!CPUSET_ISNULL(set)) { - xc_call((xc_arg_t)req_state, NULL, NULL, CPUSET2BV(set), + xc_call((xc_arg_t)req_state, 0, 0, CPUSET2BV(set), (xc_func_t)speedstep_pstate_transition); } kpreempt_enable(); diff --git a/usr/src/uts/i86pc/os/fakebop.c b/usr/src/uts/i86pc/os/fakebop.c index 7227ce3473..128f75f0c5 100644 --- a/usr/src/uts/i86pc/os/fakebop.c +++ b/usr/src/uts/i86pc/os/fakebop.c @@ -1259,7 +1259,7 @@ save_boot_info(struct xboot_info *xbi) } } else { saved_mbi.drives_length = 0; - saved_mbi.drives_addr = NULL; + saved_mbi.drives_addr = 0; } /* diff --git a/usr/src/uts/i86pc/os/fastboot.c b/usr/src/uts/i86pc/os/fastboot.c index 1520a6653c..9dbcd456df 100644 --- a/usr/src/uts/i86pc/os/fastboot.c +++ b/usr/src/uts/i86pc/os/fastboot.c @@ -497,7 +497,7 @@ fastboot_build_mbi(char *mdep, fastboot_info_t *nk) if (nk->fi_mbi_size == 0) { if ((nk->fi_new_mbi_va = (uintptr_t)contig_alloc(size, &fastboot_below_1G_dma_attr, - PAGESIZE, 0)) == NULL) { + PAGESIZE, 0)) == 0) { cmn_err(CE_NOTE, fastboot_enomem_msg, (uint64_t)size, "1G"); return (-1); @@ -705,7 +705,7 @@ fastboot_reserve_mem(fastboot_info_t *nk) */ if ((nk->fi_pagetable_va = (uintptr_t)contig_alloc(fastboot_pagetable_size, - &fastboot_below_1G_dma_attr, PAGESIZE, 0)) == NULL) { + &fastboot_below_1G_dma_attr, PAGESIZE, 0)) == 0) { return; } nk->fi_pagetable_size = fastboot_pagetable_size; @@ -714,7 +714,7 @@ fastboot_reserve_mem(fastboot_info_t *nk) * Reserve memory under PA 1G for multiboot structure. */ if ((nk->fi_new_mbi_va = (uintptr_t)contig_alloc(fastboot_mbi_size, - &fastboot_below_1G_dma_attr, PAGESIZE, 0)) == NULL) { + &fastboot_below_1G_dma_attr, PAGESIZE, 0)) == 0) { return; } nk->fi_mbi_size = fastboot_mbi_size; @@ -745,7 +745,7 @@ fastboot_free_file(fastboot_file_t *fb) fsize_roundup = P2ROUNDUP_TYPED(fb->fb_size, PAGESIZE, size_t); if (fsize_roundup) { contig_free((void *)fb->fb_va, fsize_roundup); - fb->fb_va = NULL; + fb->fb_va = 0; fb->fb_size = 0; } } @@ -1243,7 +1243,7 @@ load_kernel_retry: if (newkernel.fi_pagetable_size == 0) { if ((newkernel.fi_pagetable_va = (uintptr_t) contig_alloc(size, &fastboot_below_1G_dma_attr, - MMU_PAGESIZE, 0)) == NULL) { + MMU_PAGESIZE, 0)) == 0) { cmn_err(CE_NOTE, fastboot_enomem_msg, (uint64_t)size, "1G"); goto err_out; diff --git a/usr/src/uts/i86pc/os/graphics.c b/usr/src/uts/i86pc/os/graphics.c index 03e3199ff4..9fbbc38fb5 100644 --- a/usr/src/uts/i86pc/os/graphics.c +++ b/usr/src/uts/i86pc/os/graphics.c @@ -219,7 +219,7 @@ progressbar_key_abort(ldi_ident_t li) != 0) cmn_err(CE_NOTE, "!ldi_ioctl for KD_RESETTEXT failed"); - (void) ldi_close(hdl, NULL, kcred); + (void) ldi_close(hdl, 0, kcred); } #endif } diff --git a/usr/src/uts/i86pc/os/intr.c b/usr/src/uts/i86pc/os/intr.c index 0634df1a94..4d24cf74c0 100644 --- a/usr/src/uts/i86pc/os/intr.c +++ b/usr/src/uts/i86pc/os/intr.c @@ -1162,7 +1162,7 @@ cpu_create_intrstat(cpu_t *cp) zoneid = ALL_ZONES; intr_ksp = kstat_create_zone("cpu", cp->cpu_id, "intrstat", "misc", - KSTAT_TYPE_NAMED, PIL_MAX * 2, NULL, zoneid); + KSTAT_TYPE_NAMED, PIL_MAX * 2, 0, zoneid); /* * Initialize each PIL's named kstat diff --git a/usr/src/uts/i86pc/os/machdep.c b/usr/src/uts/i86pc/os/machdep.c index 97b1bf3f45..e3c03dbe02 100644 --- a/usr/src/uts/i86pc/os/machdep.c +++ b/usr/src/uts/i86pc/os/machdep.c @@ -262,7 +262,7 @@ mdboot(int cmd, int fcn, char *mdep, boolean_t invoke_cb) devtree_freeze(); if (invoke_cb) - (void) callb_execute_class(CB_CL_MDBOOT, NULL); + (void) callb_execute_class(CB_CL_MDBOOT, 0); /* * Clear any unresolved UEs from memory. @@ -1417,7 +1417,7 @@ dtrace_linear_pc(struct regs *rp, proc_t *p, caddr_t *linearp) * and posts the softint for x86. */ static ddi_softint_hdl_impl_t lbolt_softint_hdl = - {0, NULL, NULL, NULL, 0, NULL, NULL, NULL}; + {0, 0, NULL, NULL, 0, NULL, NULL, NULL}; void lbolt_softint_add(void) diff --git a/usr/src/uts/i86pc/os/mp_implfuncs.c b/usr/src/uts/i86pc/os/mp_implfuncs.c index 3bded8f124..2d0bd3eb53 100644 --- a/usr/src/uts/i86pc/os/mp_implfuncs.c +++ b/usr/src/uts/i86pc/os/mp_implfuncs.c @@ -70,11 +70,11 @@ struct mod_ops mod_psmops = { }; static struct psm_sw psm_swtab = { - &psm_swtab, &psm_swtab, NULL, NULL + &psm_swtab, &psm_swtab, NULL, 0 }; -kmutex_t psmsw_lock; /* lock accesses to psmsw */ -struct psm_sw *psmsw = &psm_swtab; /* start of all psm_sw */ +kmutex_t psmsw_lock; /* lock accesses to psmsw */ +struct psm_sw *psmsw = &psm_swtab; /* start of all psm_sw */ static struct modlinkage * psm_modlinkage_alloc(struct psm_info *infop) @@ -167,7 +167,7 @@ psm_mod_info(void **handlepp, struct psm_info *infop, struct modinfo *modinfop) if (!*modlpp) { mlinkp = psm_modlinkage_alloc(infop); if (!mlinkp) - return ((int)NULL); + return (0); } else mlinkp = *modlpp; diff --git a/usr/src/uts/i86pc/os/pci_cfgacc_x86.c b/usr/src/uts/i86pc/os/pci_cfgacc_x86.c index b48a4c0703..8fc919f484 100644 --- a/usr/src/uts/i86pc/os/pci_cfgacc_x86.c +++ b/usr/src/uts/i86pc/os/pci_cfgacc_x86.c @@ -217,7 +217,7 @@ pci_cfgacc_check_io(pci_cfgacc_req_t *req) bus = PCI_BDF_BUS(req->bdf); - if (pci_cfgacc_force_io || (mcfg_mem_base == NULL) || + if (pci_cfgacc_force_io || (mcfg_mem_base == 0) || (bus < mcfg_bus_start) || (bus > mcfg_bus_end) || pci_cfgacc_find_workaround(req->bdf)) req->ioacc = B_TRUE; diff --git a/usr/src/uts/i86pc/os/startup.c b/usr/src/uts/i86pc/os/startup.c index f63973f092..9d9765cb2c 100644 --- a/usr/src/uts/i86pc/os/startup.c +++ b/usr/src/uts/i86pc/os/startup.c @@ -633,9 +633,9 @@ static char *prm_dbg_str[] = { int prom_debug; -#define PRM_DEBUG(q) if (prom_debug) \ +#define PRM_DEBUG(q) if (prom_debug) \ prom_printf(prm_dbg_str[sizeof (q) >> 3], "startup.c", __LINE__, #q, q); -#define PRM_POINT(q) if (prom_debug) \ +#define PRM_POINT(q) if (prom_debug) \ prom_printf("%s:%d: %s\n", "startup.c", __LINE__, q); /* @@ -653,13 +653,13 @@ size_t valloc_sz = 0; uintptr_t valloc_base; #define ADD_TO_ALLOCATIONS(ptr, size) { \ - size = ROUND_UP_PAGE(size); \ + size = ROUND_UP_PAGE(size); \ if (num_allocations == NUM_ALLOCATIONS) \ panic("too many ADD_TO_ALLOCATIONS()"); \ allocations[num_allocations].al_ptr = (void**)&ptr; \ allocations[num_allocations].al_size = size; \ valloc_sz += size; \ - ++num_allocations; \ + ++num_allocations; \ } /* @@ -3087,7 +3087,7 @@ get_system_configuration(void) if (BOP_GETPROPLEN(bootops, "kernelbase") > sizeof (prop) || BOP_GETPROP(bootops, "kernelbase", prop) < 0 || kobj_getvalue(prop, &lvalue) == -1) - eprom_kernelbase = NULL; + eprom_kernelbase = 0; else eprom_kernelbase = (uintptr_t)lvalue; diff --git a/usr/src/uts/intel/amd64/krtld/kobj_boot.c b/usr/src/uts/intel/amd64/krtld/kobj_boot.c index b63486fd69..524b6632b4 100644 --- a/usr/src/uts/intel/amd64/krtld/kobj_boot.c +++ b/usr/src/uts/intel/amd64/krtld/kobj_boot.c @@ -23,8 +23,6 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - /* * Bootstrap the linker/loader. */ @@ -59,7 +57,7 @@ _kobj_boot( int i; for (i = 0; i < BA_NUM; i++) - bootaux[i].ba_val = NULL; + bootaux[i].ba_val = 0; bootaux[BA_ENTRY].ba_ptr = (void *)_locore_start; bootaux[BA_PAGESZ].ba_val = PAGESIZE; diff --git a/usr/src/uts/intel/genunix/Makefile b/usr/src/uts/intel/genunix/Makefile index 3603bce20a..04a0279b01 100644 --- a/usr/src/uts/intel/genunix/Makefile +++ b/usr/src/uts/intel/genunix/Makefile @@ -156,8 +156,19 @@ clean.lint: $(CLEAN_LINT_DEPS) 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) diff --git a/usr/src/uts/sun4u/blade/platmod/Makefile b/usr/src/uts/sun4u/blade/platmod/Makefile index 0b88f628b6..623d5d1da6 100644 --- a/usr/src/uts/sun4u/blade/platmod/Makefile +++ b/usr/src/uts/sun4u/blade/platmod/Makefile @@ -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 @@ check: 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" diff --git a/usr/src/uts/sun4u/boston/platmod/Makefile b/usr/src/uts/sun4u/boston/platmod/Makefile index ac2ae7f5ea..df85dff684 100644 --- a/usr/src/uts/sun4u/boston/platmod/Makefile +++ b/usr/src/uts/sun4u/boston/platmod/Makefile @@ -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 @@ check: 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" diff --git a/usr/src/uts/sun4u/cheetah/Makefile b/usr/src/uts/sun4u/cheetah/Makefile index 974ea75d75..09e23457b4 100644 --- a/usr/src/uts/sun4u/cheetah/Makefile +++ b/usr/src/uts/sun4u/cheetah/Makefile @@ -97,8 +97,8 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(CPULIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(CPULIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) $(SYM_MOD): $(UNIX_O) $(CPULIB) @echo "resolving symbols against unix.o" diff --git a/usr/src/uts/sun4u/cheetahplus/Makefile b/usr/src/uts/sun4u/cheetahplus/Makefile index 7d68335ee4..0e92f69cb6 100644 --- a/usr/src/uts/sun4u/cheetahplus/Makefile +++ b/usr/src/uts/sun4u/cheetahplus/Makefile @@ -103,8 +103,8 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(CPULIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(CPULIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) $(SYM_MOD): $(UNIX_O) $(CPULIB) @echo "resolving symbols against unix.o" diff --git a/usr/src/uts/sun4u/cherrystone/platmod/Makefile b/usr/src/uts/sun4u/cherrystone/platmod/Makefile index 0ed52a75dd..68ff3e184a 100644 --- a/usr/src/uts/sun4u/cherrystone/platmod/Makefile +++ b/usr/src/uts/sun4u/cherrystone/platmod/Makefile @@ -98,8 +98,8 @@ check: 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" diff --git a/usr/src/uts/sun4u/chicago/platmod/Makefile b/usr/src/uts/sun4u/chicago/platmod/Makefile index 4d151c7075..854c8d087b 100644 --- a/usr/src/uts/sun4u/chicago/platmod/Makefile +++ b/usr/src/uts/sun4u/chicago/platmod/Makefile @@ -94,8 +94,8 @@ check: 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" diff --git a/usr/src/uts/sun4u/daktari/platmod/Makefile b/usr/src/uts/sun4u/daktari/platmod/Makefile index 32a7654012..4bff868623 100644 --- a/usr/src/uts/sun4u/daktari/platmod/Makefile +++ b/usr/src/uts/sun4u/daktari/platmod/Makefile @@ -97,10 +97,10 @@ install: $(INSTALL_DEPS) 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" diff --git a/usr/src/uts/sun4u/darwin/platmod/Makefile b/usr/src/uts/sun4u/darwin/platmod/Makefile index d6fd83d432..aaacda5c3e 100644 --- a/usr/src/uts/sun4u/darwin/platmod/Makefile +++ b/usr/src/uts/sun4u/darwin/platmod/Makefile @@ -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 @@ check: 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" diff --git a/usr/src/uts/sun4u/enchilada/platmod/Makefile b/usr/src/uts/sun4u/enchilada/platmod/Makefile index f309441857..37a38a2ca3 100644 --- a/usr/src/uts/sun4u/enchilada/platmod/Makefile +++ b/usr/src/uts/sun4u/enchilada/platmod/Makefile @@ -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 @@ check: 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" diff --git a/usr/src/uts/sun4u/excalibur/platmod/Makefile b/usr/src/uts/sun4u/excalibur/platmod/Makefile index 0c3530c15a..dca804a517 100644 --- a/usr/src/uts/sun4u/excalibur/platmod/Makefile +++ b/usr/src/uts/sun4u/excalibur/platmod/Makefile @@ -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 @@ check: 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" diff --git a/usr/src/uts/sun4u/fjlite/platmod/Makefile b/usr/src/uts/sun4u/fjlite/platmod/Makefile index 1013ac69d3..60b29fe7ee 100644 --- a/usr/src/uts/sun4u/fjlite/platmod/Makefile +++ b/usr/src/uts/sun4u/fjlite/platmod/Makefile @@ -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 @@ check: 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" diff --git a/usr/src/uts/sun4u/genunix/Makefile b/usr/src/uts/sun4u/genunix/Makefile index dd72737d12..f617c121c7 100644 --- a/usr/src/uts/sun4u/genunix/Makefile +++ b/usr/src/uts/sun4u/genunix/Makefile @@ -89,9 +89,9 @@ CLOBBERFILES += $(GENUNIX) 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 @@ modlintlib: $(MODLINTLIB_DEPS) 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) diff --git a/usr/src/uts/sun4u/grover/platmod/Makefile b/usr/src/uts/sun4u/grover/platmod/Makefile index 480a9bff20..c217de09a7 100644 --- a/usr/src/uts/sun4u/grover/platmod/Makefile +++ b/usr/src/uts/sun4u/grover/platmod/Makefile @@ -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 @@ check: 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" diff --git a/usr/src/uts/sun4u/hummingbird/Makefile b/usr/src/uts/sun4u/hummingbird/Makefile index d6eca49e54..ce2dcf25f8 100644 --- a/usr/src/uts/sun4u/hummingbird/Makefile +++ b/usr/src/uts/sun4u/hummingbird/Makefile @@ -97,8 +97,8 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(CPULIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(CPULIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) $(SYM_MOD): $(UNIX_O) $(CPULIB) @echo "resolving symbols against unix.o" diff --git a/usr/src/uts/sun4u/jalapeno/Makefile b/usr/src/uts/sun4u/jalapeno/Makefile index a3c45ab0c6..83eccaaffd 100644 --- a/usr/src/uts/sun4u/jalapeno/Makefile +++ b/usr/src/uts/sun4u/jalapeno/Makefile @@ -102,8 +102,8 @@ clean.lint: $(CLEAN_LINT_DEPS) 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_STATIC_UNUSED 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 diff --git a/usr/src/uts/sun4u/javelin/platmod/Makefile b/usr/src/uts/sun4u/javelin/platmod/Makefile index d83d9464cb..7c0cec4937 100644 --- a/usr/src/uts/sun4u/javelin/platmod/Makefile +++ b/usr/src/uts/sun4u/javelin/platmod/Makefile @@ -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 @@ check: 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" diff --git a/usr/src/uts/sun4u/littleneck/platmod/Makefile b/usr/src/uts/sun4u/littleneck/platmod/Makefile index 1837fff861..f867e8a660 100644 --- a/usr/src/uts/sun4u/littleneck/platmod/Makefile +++ b/usr/src/uts/sun4u/littleneck/platmod/Makefile @@ -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 @@ check: 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" diff --git a/usr/src/uts/sun4u/lw8/platmod/Makefile b/usr/src/uts/sun4u/lw8/platmod/Makefile index 3fd0e01760..3c2c2e27b3 100644 --- a/usr/src/uts/sun4u/lw8/platmod/Makefile +++ b/usr/src/uts/sun4u/lw8/platmod/Makefile @@ -102,8 +102,8 @@ check: 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" diff --git a/usr/src/uts/sun4u/opl/olympus_c/Makefile b/usr/src/uts/sun4u/opl/olympus_c/Makefile index 764bad7594..b79f790cee 100644 --- a/usr/src/uts/sun4u/opl/olympus_c/Makefile +++ b/usr/src/uts/sun4u/opl/olympus_c/Makefile @@ -101,8 +101,8 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(CPULIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(CPULIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) $(SYM_MOD): $(UNIX_O) $(CPULIB) @$(ECHO) "resolving symbols against unix.o" diff --git a/usr/src/uts/sun4u/platmod/Makefile b/usr/src/uts/sun4u/platmod/Makefile index c94753c310..8b624bb35e 100644 --- a/usr/src/uts/sun4u/platmod/Makefile +++ b/usr/src/uts/sun4u/platmod/Makefile @@ -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: $(INSTALL_DEPS) install_h: -$(PLATLIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(PLATLIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) # # Include common targets. diff --git a/usr/src/uts/sun4u/seattle/platmod/Makefile b/usr/src/uts/sun4u/seattle/platmod/Makefile index e2fd8674c7..7dec4b8dc0 100644 --- a/usr/src/uts/sun4u/seattle/platmod/Makefile +++ b/usr/src/uts/sun4u/seattle/platmod/Makefile @@ -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 @@ check: 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" diff --git a/usr/src/uts/sun4u/serengeti/cheetah/Makefile b/usr/src/uts/sun4u/serengeti/cheetah/Makefile index 48e8935947..e28743a9f7 100644 --- a/usr/src/uts/sun4u/serengeti/cheetah/Makefile +++ b/usr/src/uts/sun4u/serengeti/cheetah/Makefile @@ -110,8 +110,8 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(CPULIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(CPULIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) $(SYM_MOD): $(UNIX_O) $(CPULIB) @echo "resolving symbols against unix.o" diff --git a/usr/src/uts/sun4u/serengeti/cheetahplus/Makefile b/usr/src/uts/sun4u/serengeti/cheetahplus/Makefile index aa9be6d905..e95048de85 100644 --- a/usr/src/uts/sun4u/serengeti/cheetahplus/Makefile +++ b/usr/src/uts/sun4u/serengeti/cheetahplus/Makefile @@ -116,8 +116,8 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(CPULIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(CPULIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) $(SYM_MOD): $(UNIX_O) $(CPULIB) @echo "resolving symbols against unix.o" diff --git a/usr/src/uts/sun4u/serengeti/platmod/Makefile b/usr/src/uts/sun4u/serengeti/platmod/Makefile index d4187406bb..eeb965a2a8 100644 --- a/usr/src/uts/sun4u/serengeti/platmod/Makefile +++ b/usr/src/uts/sun4u/serengeti/platmod/Makefile @@ -101,10 +101,10 @@ install: $(INSTALL_DEPS) 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" diff --git a/usr/src/uts/sun4u/serrano/Makefile b/usr/src/uts/sun4u/serrano/Makefile index 89be816d89..e5327b5a74 100644 --- a/usr/src/uts/sun4u/serrano/Makefile +++ b/usr/src/uts/sun4u/serrano/Makefile @@ -102,8 +102,8 @@ clean.lint: $(CLEAN_LINT_DEPS) 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_STATIC_UNUSED 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 diff --git a/usr/src/uts/sun4u/snowbird/platmod/Makefile b/usr/src/uts/sun4u/snowbird/platmod/Makefile index f5b97a1ffd..60340b2180 100644 --- a/usr/src/uts/sun4u/snowbird/platmod/Makefile +++ b/usr/src/uts/sun4u/snowbird/platmod/Makefile @@ -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 @@ check: 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" diff --git a/usr/src/uts/sun4u/spitfire/Makefile b/usr/src/uts/sun4u/spitfire/Makefile index b586ea1002..0b2df11653 100644 --- a/usr/src/uts/sun4u/spitfire/Makefile +++ b/usr/src/uts/sun4u/spitfire/Makefile @@ -109,8 +109,8 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(CPULIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(CPULIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) $(SYM_MOD): $(UNIX_O) $(CPULIB) @echo "resolving symbols against unix.o" diff --git a/usr/src/uts/sun4u/starcat/cheetah/Makefile b/usr/src/uts/sun4u/starcat/cheetah/Makefile index 1cc9fbd598..a5df75acd3 100644 --- a/usr/src/uts/sun4u/starcat/cheetah/Makefile +++ b/usr/src/uts/sun4u/starcat/cheetah/Makefile @@ -107,8 +107,8 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(CPULIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(CPULIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) $(SYM_MOD): $(UNIX_O) $(CPULIB) @echo "resolving symbols against unix.o" diff --git a/usr/src/uts/sun4u/starcat/cheetahplus/Makefile b/usr/src/uts/sun4u/starcat/cheetahplus/Makefile index 4137226115..37d8deb62b 100644 --- a/usr/src/uts/sun4u/starcat/cheetahplus/Makefile +++ b/usr/src/uts/sun4u/starcat/cheetahplus/Makefile @@ -114,8 +114,8 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(CPULIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(CPULIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) $(SYM_MOD): $(UNIX_O) $(CPULIB) @echo "resolving symbols against unix.o" diff --git a/usr/src/uts/sun4u/starcat/platmod/Makefile b/usr/src/uts/sun4u/starcat/platmod/Makefile index 39272993dd..b451e7e09a 100644 --- a/usr/src/uts/sun4u/starcat/platmod/Makefile +++ b/usr/src/uts/sun4u/starcat/platmod/Makefile @@ -89,8 +89,8 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(PLATLIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(PLATLIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) # # Include common targets. diff --git a/usr/src/uts/sun4u/taco/platmod/Makefile b/usr/src/uts/sun4u/taco/platmod/Makefile index 06837433a8..328ee26896 100644 --- a/usr/src/uts/sun4u/taco/platmod/Makefile +++ b/usr/src/uts/sun4u/taco/platmod/Makefile @@ -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 @@ check: 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" diff --git a/usr/src/uts/sun4u/tazmo/platmod/Makefile b/usr/src/uts/sun4u/tazmo/platmod/Makefile index 09a084a363..02d5ab522c 100644 --- a/usr/src/uts/sun4u/tazmo/platmod/Makefile +++ b/usr/src/uts/sun4u/tazmo/platmod/Makefile @@ -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 @@ check: 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" diff --git a/usr/src/uts/sun4v/generic/Makefile b/usr/src/uts/sun4v/generic/Makefile index 53b1f453d9..f1b348c336 100644 --- a/usr/src/uts/sun4v/generic/Makefile +++ b/usr/src/uts/sun4v/generic/Makefile @@ -113,8 +113,8 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(CPULIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(CPULIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) $(SYM_MOD): $(UNIX_O) $(CPULIB) @echo "resolving symbols against unix.o" diff --git a/usr/src/uts/sun4v/genunix/Makefile b/usr/src/uts/sun4v/genunix/Makefile index 905d426dcc..3efad8b2e4 100644 --- a/usr/src/uts/sun4v/genunix/Makefile +++ b/usr/src/uts/sun4v/genunix/Makefile @@ -97,9 +97,9 @@ CLOBBERFILES += $(GENUNIX) 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 @@ modlintlib: $(MODLINTLIB_DEPS) 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 diff --git a/usr/src/uts/sun4v/kt/Makefile b/usr/src/uts/sun4v/kt/Makefile index 2ad3e409b0..f4721ae345 100644 --- a/usr/src/uts/sun4v/kt/Makefile +++ b/usr/src/uts/sun4v/kt/Makefile @@ -103,8 +103,8 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(CPULIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(CPULIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) $(SYM_MOD): $(UNIX_O) $(CPULIB) @echo "resolving symbols against unix.o" diff --git a/usr/src/uts/sun4v/montoya/platmod/Makefile b/usr/src/uts/sun4v/montoya/platmod/Makefile index 71a36dae5b..cb92f7feda 100644 --- a/usr/src/uts/sun4v/montoya/platmod/Makefile +++ b/usr/src/uts/sun4v/montoya/platmod/Makefile @@ -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 @@ install: $(INSTALL_DEPS) 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" diff --git a/usr/src/uts/sun4v/niagara/Makefile b/usr/src/uts/sun4v/niagara/Makefile index d802e9bf64..713198a991 100644 --- a/usr/src/uts/sun4v/niagara/Makefile +++ b/usr/src/uts/sun4v/niagara/Makefile @@ -96,8 +96,8 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(CPULIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(CPULIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) $(SYM_MOD): $(UNIX_O) $(CPULIB) @echo "resolving symbols against unix.o" diff --git a/usr/src/uts/sun4v/niagara2/Makefile b/usr/src/uts/sun4v/niagara2/Makefile index 2be0bcbcfd..39a01ef025 100644 --- a/usr/src/uts/sun4v/niagara2/Makefile +++ b/usr/src/uts/sun4v/niagara2/Makefile @@ -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 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(CPULIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(CPULIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) $(SYM_MOD): $(UNIX_O) $(CPULIB) @echo "resolving symbols against unix.o" diff --git a/usr/src/uts/sun4v/ontario/platmod/Makefile b/usr/src/uts/sun4v/ontario/platmod/Makefile index cbdf058686..e4c2f30b46 100644 --- a/usr/src/uts/sun4v/ontario/platmod/Makefile +++ b/usr/src/uts/sun4v/ontario/platmod/Makefile @@ -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 @@ check: 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" diff --git a/usr/src/uts/sun4v/platmod/Makefile b/usr/src/uts/sun4v/platmod/Makefile index 98f274aaa0..149000cfb0 100644 --- a/usr/src/uts/sun4v/platmod/Makefile +++ b/usr/src/uts/sun4v/platmod/Makefile @@ -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 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(PLATLIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(PLATLIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) # # Include common targets. diff --git a/usr/src/uts/sun4v/vfalls/Makefile b/usr/src/uts/sun4v/vfalls/Makefile index f2305550fd..001654791b 100644 --- a/usr/src/uts/sun4v/vfalls/Makefile +++ b/usr/src/uts/sun4v/vfalls/Makefile @@ -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 @@ clean.lint: $(CLEAN_LINT_DEPS) install: $(INSTALL_DEPS) -$(CPULIB): $(BINARY) - $(BUILD.SO) $(BINARY) +$(CPULIB): $(OBJECTS) + $(BUILD.SO) $(OBJECTS) $(SYM_MOD): $(UNIX_O) $(CPULIB) @echo "resolving symbols against unix.o" |