diff options
author | wesolows <none@none> | 2006-03-30 16:06:07 -0800 |
---|---|---|
committer | wesolows <none@none> | 2006-03-30 16:06:07 -0800 |
commit | 80ab886d233f514d54c2a6bdeb9fdfd951bd6881 (patch) | |
tree | 0a7ee03b9e4951aa9aa2baa1d5479ac4bc92f070 /usr/src | |
parent | 52aacb450723e8271d37836e1b5861c2072a3981 (diff) | |
download | illumos-gate-80ab886d233f514d54c2a6bdeb9fdfd951bd6881.tar.gz |
6242262 ON should be buildable with gcc
6268345 fmd is insufficiently careful with alignment
6271070 gcc and cmd/fm don't get along
6272173 cpumem diag module writes to constant memory, crashing fmd
6273907 gcc and cmd/syseventd don't get along
6308057 gcc and sgs/dis don't get along on SPARC
6359863 the C preprocessor is still feeling abused by token pasting
6359868 gcc and cmd/stmsboot still don't get along
6359878 gcc and lib/smartcard don't get along on sparc
6361816 gcc and perl don't get along
6370832 kernel should agree on C99 mode for studio and gcc
6372728 gcc and sata don't get along
6390345 cw inserts garbage when used as a preprocessor
6397680 gcc and smbios are not getting along
6399113 meta_namespace.c uses worrisome construct and is not gcc friendly
6403999 cw is ugly and hairy and needs a man
Diffstat (limited to 'usr/src')
73 files changed, 1210 insertions, 582 deletions
diff --git a/usr/src/Makefile.master b/usr/src/Makefile.master index e09c244849..0a27a75bea 100644 --- a/usr/src/Makefile.master +++ b/usr/src/Makefile.master @@ -20,7 +20,7 @@ # # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -168,6 +168,11 @@ WC= /usr/bin/wc XARGS= /usr/bin/xargs ELFSIGN= /usr/bin/elfsign DTRACE= /usr/sbin/dtrace +CHECK_FNAMES= $(ONBLD_TOOLS)/bin/check_fnames + +# Due to 6367203, objects built with gcc will fail the namespace checks. +# Remove this override once the compiler bug is fixed. +$(__GNUC)CHECK_FNAMES= $(TRUE) FILEMODE= 644 DIRMODE= 755 diff --git a/usr/src/cmd/fm/eversholt/common/io.h b/usr/src/cmd/fm/eversholt/common/io.h index 8eeff87950..ae33aebe7d 100644 --- a/usr/src/cmd/fm/eversholt/common/io.h +++ b/usr/src/cmd/fm/eversholt/common/io.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * io -- input/output routines @@ -35,11 +35,11 @@ extern "C" { #endif -void io_abort(const char *buf); -void io_die(const char *buf); +void io_abort(const char *buf) __NORETURN; +void io_die(const char *buf) __NORETURN; void io_err(const char *buf); void io_out(const char *buf); -void io_exit(int code); +void io_exit(int code) __NORETURN; #ifdef __cplusplus } diff --git a/usr/src/cmd/fm/eversholt/common/out.h b/usr/src/cmd/fm/eversholt/common/out.h index 89d1c0b2e4..a83f2b6c8a 100644 --- a/usr/src/cmd/fm/eversholt/common/out.h +++ b/usr/src/cmd/fm/eversholt/common/out.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * out.h -- public definitions for output module @@ -45,7 +45,7 @@ void out_init(const char *myname); void out_fini(void); void out(int flags, const char *fmt, ...); void outfl(int flags, const char *fname, int line, const char *fmt, ...); -void out_exit(int code); +void out_exit(int code) __NORETURN; void out_altfp(FILE *fp); int out_errcount(void); int out_warncount(void); diff --git a/usr/src/cmd/fm/eversholt/eftinfo/common/eftinfo.c b/usr/src/cmd/fm/eversholt/eftinfo/common/eftinfo.c index 76cc249765..68332725d6 100644 --- a/usr/src/cmd/fm/eversholt/eftinfo/common/eftinfo.c +++ b/usr/src/cmd/fm/eversholt/eftinfo/common/eftinfo.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * eftinfo.c -- main routine for eftinfo command @@ -100,7 +100,7 @@ dictprint(const char *s, void *rhs, void *arg) sep = ":"; } -void +int main(int argc, char *argv[]) { int c; @@ -229,4 +229,5 @@ main(int argc, char *argv[]) out_exit(0); /*NOTREACHED*/ + return (0); } diff --git a/usr/src/cmd/fm/eversholt/esc/common/escmain.c b/usr/src/cmd/fm/eversholt/esc/common/escmain.c index 1b4567d459..eec47214ba 100644 --- a/usr/src/cmd/fm/eversholt/esc/common/escmain.c +++ b/usr/src/cmd/fm/eversholt/esc/common/escmain.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * escmain.c -- main routine for esc, the eversholt compiler @@ -92,7 +92,7 @@ char Args[MAXARGS]; #define MAXCPPARGS 4000 static char Cppargs[MAXCPPARGS]; -void +int main(int argc, char *argv[]) { char flagbuf[] = " -D"; @@ -228,4 +228,5 @@ main(int argc, char *argv[]) out_exit(0); /*NOTREACHED*/ + return (0); } diff --git a/usr/src/cmd/fm/fmd/common/fmd_api.c b/usr/src/cmd/fm/fmd/common/fmd_api.c index 9ff325de59..659d52f787 100644 --- a/usr/src/cmd/fm/fmd/common/fmd_api.c +++ b/usr/src/cmd/fm/fmd/common/fmd_api.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -77,6 +76,10 @@ static const fmd_conf_ops_t *const _fmd_prop_ops[] = { &fmd_conf_size, /* FMD_TYPE_SIZE */ }; +static void fmd_api_verror(fmd_module_t *, int, const char *, va_list) + __NORETURN; +static void fmd_api_error(fmd_module_t *, int, const char *, ...) __NORETURN; + /* * fmd_api_vxerror() provides the engine underlying the fmd_hdl_[v]error() API * calls and the fmd_api_[v]error() utility routine defined below. The routine diff --git a/usr/src/cmd/fm/fmd/common/fmd_api.h b/usr/src/cmd/fm/fmd/common/fmd_api.h index 1700c24bdb..556d5641e8 100644 --- a/usr/src/cmd/fm/fmd/common/fmd_api.h +++ b/usr/src/cmd/fm/fmd/common/fmd_api.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -146,8 +145,8 @@ extern void fmd_hdl_free(fmd_hdl_t *, void *, size_t); extern char *fmd_hdl_strdup(fmd_hdl_t *, const char *, int); extern void fmd_hdl_strfree(fmd_hdl_t *, char *); -extern void fmd_hdl_vabort(fmd_hdl_t *, const char *, va_list); -extern void fmd_hdl_abort(fmd_hdl_t *, const char *, ...); +extern void fmd_hdl_vabort(fmd_hdl_t *, const char *, va_list) __NORETURN; +extern void fmd_hdl_abort(fmd_hdl_t *, const char *, ...) __NORETURN; extern void fmd_hdl_verror(fmd_hdl_t *, const char *, va_list); extern void fmd_hdl_error(fmd_hdl_t *, const char *, ...); diff --git a/usr/src/cmd/fm/fmd/common/fmd_module.h b/usr/src/cmd/fm/fmd/common/fmd_module.h index 23586e0875..d7b4de3af1 100644 --- a/usr/src/cmd/fm/fmd/common/fmd_module.h +++ b/usr/src/cmd/fm/fmd/common/fmd_module.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -181,7 +180,7 @@ extern int fmd_module_locked(fmd_module_t *); extern void fmd_module_unregister(fmd_module_t *); extern int fmd_module_enter(fmd_module_t *, void (*)(fmd_hdl_t *)); extern void fmd_module_exit(fmd_module_t *); -extern void fmd_module_abort(fmd_module_t *, int); +extern void fmd_module_abort(fmd_module_t *, int) __NORETURN; extern void fmd_module_hold(fmd_module_t *); extern void fmd_module_rele(fmd_module_t *); diff --git a/usr/src/cmd/fm/fmd/common/fmd_trace.c b/usr/src/cmd/fm/fmd/common/fmd_trace.c index 14e39b34d7..2bb0187cd3 100644 --- a/usr/src/cmd/fm/fmd/common/fmd_trace.c +++ b/usr/src/cmd/fm/fmd/common/fmd_trace.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -53,11 +52,23 @@ fmd_trace_create(void) /* * We require 8-byte alignment of fmd_tracerec_t to store hrtime_t's. * Since the trailing flexible array member is of type uintptr_t, we - * must make it a multiple of 2 if we are compiling 32-bit; otherwise - * uintptr_t is 8 bytes so any value of tb_frames is acceptable. + * may need to allocate an additional element if we are compiling + * 32-bit; otherwise uintptr_t is 8 bytes so any value of tb_frames is + * acceptable. + * + * tb_frames includes the first element, whose size is reflected in + * sizeof (fmd_tracerec_t). Therefore, if fmd_tracerec_t's size is + * 0 mod 8, we must be sure the total number of frames is odd. + * Otherwise, we need at least one extra frame, so the total count + * must be even. This will continue to work even if the sizes or + * types of other fmd_tracerec_t members are changed. */ #ifdef _ILP32 - tbp->tb_frames = P2ROUNDUP(tbp->tb_frames, 2); + /*CONSTCOND*/ + if (sizeof (fmd_tracerec_t) % sizeof (hrtime_t) == 0) + tbp->tb_frames = (tbp->tb_frames & ~1UL) + 1; + else + tbp->tb_frames = P2ROUNDUP(tbp->tb_frames, 2); #endif tbp->tb_size = sizeof (fmd_tracerec_t) + sizeof (uintptr_t) * (MAX(tbp->tb_frames, 1) - 1); diff --git a/usr/src/cmd/fm/fminject/common/inj_decl.c b/usr/src/cmd/fm/fminject/common/inj_decl.c index 67b5f16ed2..bacbe375ee 100644 --- a/usr/src/cmd/fm/fminject/common/inj_decl.c +++ b/usr/src/cmd/fm/fminject/common/inj_decl.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,6 +18,7 @@ * * CDDL HEADER END */ + /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -158,7 +158,7 @@ inj_decl_create(inj_declmem_t *dlm) inj_list_append(&decl->decl_members, dlm); (void) inj_strhash_insert(&decl->decl_memhash, dlm->dlm_name, - (uintmax_t)dlm); + (uintptr_t)dlm); return (decl); } @@ -180,7 +180,7 @@ inj_decl_addmem(inj_decl_t *decl, inj_declmem_t *dlm) inj_list_append(&decl->decl_members, dlm); (void) inj_strhash_insert(&decl->decl_memhash, dlm->dlm_name, - (uintmax_t)dlm); + (uintptr_t)dlm); } /* @@ -261,5 +261,5 @@ inj_decl_finish(inj_decl_t *decl, const char *name, inj_itemtype_t type) return; } - (void) inj_strhash_insert(hash, name, (uintmax_t)decl); + (void) inj_strhash_insert(hash, name, (uintptr_t)decl); } diff --git a/usr/src/cmd/fm/fminject/common/inj_defn.c b/usr/src/cmd/fm/fminject/common/inj_defn.c index a521632e62..1411f0ebf8 100644 --- a/usr/src/cmd/fm/fminject/common/inj_defn.c +++ b/usr/src/cmd/fm/fminject/common/inj_defn.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,6 +18,7 @@ * * CDDL HEADER END */ + /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -833,5 +833,5 @@ inj_defn_finish(inj_defn_t *defn, const char *declnm, const char *name, return; } - (void) inj_strhash_insert(hash, name, (uintmax_t)defn); + (void) inj_strhash_insert(hash, name, (uintptr_t)defn); } diff --git a/usr/src/cmd/fm/fminject/common/inj_hash.c b/usr/src/cmd/fm/fminject/common/inj_hash.c index da1709a573..3791d1e2b2 100644 --- a/usr/src/cmd/fm/fminject/common/inj_hash.c +++ b/usr/src/cmd/fm/fminject/common/inj_hash.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -137,5 +137,5 @@ inj_hash_get_value(inj_var_t *v) void * inj_hash_get_cookie(inj_var_t *v) { - return ((void *)v->v_uvalue); + return ((void *)(uintptr_t)v->v_uvalue); } diff --git a/usr/src/cmd/fm/modules/common/eversholt/alloc.c b/usr/src/cmd/fm/modules/common/eversholt/alloc.c index e43ee543d9..06ea8146bf 100644 --- a/usr/src/cmd/fm/modules/common/eversholt/alloc.c +++ b/usr/src/cmd/fm/modules/common/eversholt/alloc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * alloc.c -- memory allocation wrapper functions, for eft.so FMD module @@ -40,8 +40,8 @@ extern fmd_hdl_t *Hdl; /* handle from eft.c */ -/* room to store size */ -#define HDRSIZ sizeof (size_t) +/* room to store size, possibly more to maintain alignment for long longs */ +#define HDRSIZ sizeof (long long) static struct stats *Malloctotal; static struct stats *Freetotal; diff --git a/usr/src/cmd/fm/modules/common/eversholt/config.c b/usr/src/cmd/fm/modules/common/eversholt/config.c index 5197c0f234..fb2246e50e 100644 --- a/usr/src/cmd/fm/modules/common/eversholt/config.c +++ b/usr/src/cmd/fm/modules/common/eversholt/config.c @@ -613,7 +613,7 @@ config_confprop(struct node *np, struct config *croot, struct evalue *valuep) return (1); valuep->t = STRING; - valuep->v = (unsigned long long)stable(s); + valuep->v = (uintptr_t)stable(s); return (0); } @@ -720,7 +720,7 @@ config_is_type(struct node *np, struct config *croot, struct evalue *valuep) for (i = 0; typestrings[i] != NULL; i++) { s = config_getprop(cp, stable(typestrings[i])); if (s != NULL) { - valuep->v = (unsigned long long)stable(s); + valuep->v = (uintptr_t)stable(s); break; } } diff --git a/usr/src/cmd/fm/modules/common/eversholt/eval.c b/usr/src/cmd/fm/modules/common/eversholt/eval.c index 35800b62b7..66d058e949 100644 --- a/usr/src/cmd/fm/modules/common/eversholt/eval.c +++ b/usr/src/cmd/fm/modules/common/eversholt/eval.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,6 +18,7 @@ * * CDDL HEADER END */ + /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -156,11 +156,11 @@ eval_func(struct node *funcnp, struct lut *ex, struct node *epnames[], if (funcname == L_fru) { valuep->t = NODEPTR; - valuep->v = (unsigned long long)eval_fru(np); + valuep->v = (uintptr_t)eval_fru(np); return (1); } else if (funcname == L_asru) { valuep->t = NODEPTR; - valuep->v = (unsigned long long)eval_asru(np); + valuep->v = (uintptr_t)eval_asru(np); return (1); } else if (funcname == L_defined) { ASSERTeq(np->t, T_GLOBID, ptree_nodetype2str); @@ -199,7 +199,7 @@ eval_func(struct node *funcnp, struct lut *ex, struct node *epnames[], break; case STRING: out(O_ALTFP|O_VERB2, "found: \"%s\"", - (char *)valuep->v); + (char *)(uintptr_t)valuep->v); break; default: out(O_ALTFP|O_VERB2, "found: undefined"); @@ -242,8 +242,8 @@ eval_func(struct node *funcnp, struct lut *ex, struct node *epnames[], out(O_ALTFP|O_VERB2, " (%llu)", payloadvalp->v); else - out(O_ALTFP|O_VERB2, - " (\"%s\")", (char *)payloadvalp->v); + out(O_ALTFP|O_VERB2, " (\"%s\")", + (char *)(uintptr_t)payloadvalp->v); } /* add to table of payload properties for current problem */ @@ -298,7 +298,7 @@ eval_func(struct node *funcnp, struct lut *ex, struct node *epnames[], "(%llu) ", cmpval.v); else out(O_ALTFP|O_VERB2, - "(\"%s\") ", (char *)cmpval.v); + "(\"%s\") ", (char *)(uintptr_t)cmpval.v); } /* get the payload values and check for a match */ @@ -329,8 +329,10 @@ eval_func(struct node *funcnp, struct lut *ex, struct node *epnames[], * original tree value. */ if (preval.t == NODEPTR && - ((struct node *)(preval.v))->t == T_NAME) { - tree_free((struct node *)preval.v); + ((struct node *)(uintptr_t)(preval.v))->t == + T_NAME) { + tree_free((struct node *)(uintptr_t) + preval.v); } if (vals[i].v == cmpval.v) { @@ -346,7 +348,8 @@ eval_func(struct node *funcnp, struct lut *ex, struct node *epnames[], for (i = 0; i < nvals; i++) { if (vals[i].t == NODEPTR) { - tree_free((struct node *)vals[i].v); + tree_free((struct node *)(uintptr_t) + vals[i].v); break; } } @@ -376,6 +379,7 @@ eval_func(struct node *funcnp, struct lut *ex, struct node *epnames[], outfl(O_DIE, np->file, np->line, "eval_func: unexpected func: %s", funcname); /*NOTREACHED*/ + return (0); } static struct node * @@ -603,6 +607,7 @@ eval_dup(struct node *np, struct lut *ex, struct node *epnames[]) ptree_nodetype2str(np->t)); } /*NOTREACHED*/ + return (0); } /* @@ -689,33 +694,37 @@ check_expr_args(struct evalue *lp, struct evalue *rp, enum datatype dtype, struct node *np) { /* auto-convert T_NAMES to strings */ - if (lp->t == NODEPTR && ((struct node *)(lp->v))->t == T_NAME) { - char *s = ipath2str(NULL, ipath((struct node *)lp->v)); + if (lp->t == NODEPTR && ((struct node *)(uintptr_t)(lp->v))->t == + T_NAME) { + char *s = ipath2str(NULL, + ipath((struct node *)(uintptr_t)lp->v)); lp->t = STRING; - lp->v = (unsigned long long)stable(s); + lp->v = (uintptr_t)stable(s); FREE(s); out(O_ALTFP|O_VERB2, "convert lhs path to \"%s\"", - (char *)lp->v); + (char *)(uintptr_t)lp->v); } if (rp != NULL && - rp->t == NODEPTR && ((struct node *)(rp->v))->t == T_NAME) { - char *s = ipath2str(NULL, ipath((struct node *)rp->v)); + rp->t == NODEPTR && ((struct node *)(uintptr_t)(rp->v))->t == + T_NAME) { + char *s = ipath2str(NULL, + ipath((struct node *)(uintptr_t)rp->v)); rp->t = STRING; - rp->v = (unsigned long long)stable(s); + rp->v = (uintptr_t)stable(s); FREE(s); out(O_ALTFP|O_VERB2, "convert rhs path to \"%s\"", - (char *)rp->v); + (char *)(uintptr_t)rp->v); } /* auto-convert strings to numbers */ if (dtype == UINT64) { if (lp->t == STRING) { lp->t = UINT64; - lp->v = strtoull((char *)lp->v, NULL, 0); + lp->v = strtoull((char *)(uintptr_t)lp->v, NULL, 0); } if (rp != NULL && rp->t == STRING) { rp->t = UINT64; - rp->v = strtoull((char *)rp->v, NULL, 0); + rp->v = strtoull((char *)(uintptr_t)rp->v, NULL, 0); } } @@ -821,7 +830,8 @@ eval_expr(struct node *np, struct lut *ex, struct node *epnames[], } else { out(O_ALTFP|O_VERB2, "assign $%s=\"%s\"", - np->u.expr.left->u.globid.s, (char *)gval->v); + np->u.expr.left->u.globid.s, + (char *)(uintptr_t)gval->v); } /* @@ -1230,12 +1240,12 @@ eval_expr(struct node *np, struct lut *ex, struct node *epnames[], /* return address of struct node */ valuep->t = NODEPTR; - valuep->v = (unsigned long long)np; + valuep->v = (uintptr_t)np; return (1); case T_QUOTE: valuep->t = STRING; - valuep->v = (unsigned long long)np->u.quote.s; + valuep->v = (uintptr_t)np->u.quote.s; return (1); case T_FUNC: @@ -1253,6 +1263,7 @@ eval_expr(struct node *np, struct lut *ex, struct node *epnames[], ptree_nodetype2str(np->t)); } /*NOTREACHED*/ + return (0); } /* diff --git a/usr/src/cmd/fm/modules/common/eversholt/fme.c b/usr/src/cmd/fm/modules/common/eversholt/fme.c index 3fefd6346c..10e658e486 100644 --- a/usr/src/cmd/fm/modules/common/eversholt/fme.c +++ b/usr/src/cmd/fm/modules/common/eversholt/fme.c @@ -656,7 +656,7 @@ globals_destructor(void *left, void *right, void *arg) { struct evalue *evp = (struct evalue *)right; if (evp->t == NODEPTR) - tree_free((struct node *)evp->v); + tree_free((struct node *)(uintptr_t)evp->v); evp->v = NULL; FREE(evp); } @@ -823,8 +823,8 @@ serd_eval(struct fme *fmep, fmd_hdl_t *hdl, fmd_event_t *ffep, (void) sprintf(suffixbuf, "%llu", gval->v); suffix = suffixbuf; } else { - out(O_ALTFP, " \"%s\"", (char *)gval->v); - suffix = (char *)gval->v; + out(O_ALTFP, " \"%s\"", (char *)(uintptr_t)gval->v); + suffix = (char *)(uintptr_t)gval->v; } nname = strlen(serdname) + strlen(suffix) + 2; @@ -1399,6 +1399,7 @@ boom: nvlist_free(f); out(O_DIE, "%s", failure); /*NOTREACHED*/ + return (NULL); } static uint_t @@ -1417,7 +1418,7 @@ percentof(uint_t part, uint_t whole) return ((p / whole / 10) + (((p / whole % 10) >= 5) ? 1 : 0)); } -static struct rsl { +struct rsl { struct event *suspect; nvlist_t *asru; nvlist_t *fru; @@ -1626,9 +1627,10 @@ addpayloadprop(const char *lhs, struct evalue *rhs, nvlist_t *fault) "cannot add payloadprop \"%s\" to fault", lhs); } else { out(O_ALTFP|O_VERB2, "addpayloadprop: %s=\"%s\"", - lhs, (char *)rhs->v); + lhs, (char *)(uintptr_t)rhs->v); - if (nvlist_add_string(fault, lhs, (char *)rhs->v) != 0) + if (nvlist_add_string(fault, lhs, (char *)(uintptr_t)rhs->v) != + 0) out(O_DIE, "cannot add payloadprop \"%s\" to fault", lhs); } diff --git a/usr/src/cmd/fm/modules/common/eversholt/iexpr.c b/usr/src/cmd/fm/modules/common/eversholt/iexpr.c index 2493516d84..897630a360 100644 --- a/usr/src/cmd/fm/modules/common/eversholt/iexpr.c +++ b/usr/src/cmd/fm/modules/common/eversholt/iexpr.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,6 +18,7 @@ * * CDDL HEADER END */ + /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -127,6 +127,7 @@ iexpr_hash(struct node *np) ptree_nodetype2str(np->t)); } /*NOTREACHED*/ + return (1); } /* @@ -219,6 +220,7 @@ iexpr_cmp(struct node *np1, struct node *np2) ptree_nodetype2str(np1->t)); } /*NOTREACHED*/ + return (0); } /* diff --git a/usr/src/cmd/fm/modules/common/eversholt/itree.c b/usr/src/cmd/fm/modules/common/eversholt/itree.c index ff3ebdcbd8..297129f6c0 100644 --- a/usr/src/cmd/fm/modules/common/eversholt/itree.c +++ b/usr/src/cmd/fm/modules/common/eversholt/itree.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,6 +18,7 @@ * * CDDL HEADER END */ + /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -748,6 +748,7 @@ itree_np2nork(struct node *norknp) "itree_np2nork: internal error type %s", ptree_nodetype2str(norknp->t)); /*NOTREACHED*/ + return (1); } static struct iterinfo * diff --git a/usr/src/cmd/fm/modules/common/eversholt/platform.c b/usr/src/cmd/fm/modules/common/eversholt/platform.c index 1fdd7f1a71..85ee7ad5c2 100644 --- a/usr/src/cmd/fm/modules/common/eversholt/platform.c +++ b/usr/src/cmd/fm/modules/common/eversholt/platform.c @@ -1057,10 +1057,10 @@ arglist2argv(struct node *np, struct lut **globals, struct config *croot, addthisarg = STRDUP(numstr); break; case STRING: - addthisarg = STRDUP((const char *)value.v); + addthisarg = STRDUP((const char *)(uintptr_t)value.v); break; case NODEPTR : - namep = (struct node *)value.v; + namep = (struct node *)(uintptr_t)value.v; addthisarg = ipath2str(NULL, ipath(namep)); break; default: @@ -1268,7 +1268,7 @@ platform_call(struct node *np, struct lut **globals, struct config *croot, break; } valuep->t = STRING; - valuep->v = (unsigned long long)stable(outbuf); + valuep->v = (uintptr_t)stable(outbuf); } if (errbuf[0] != '\0') { @@ -1614,7 +1614,7 @@ platform_payloadprop(struct node *np, struct evalue *valuep) if (nvlist_lookup_string(embnvp, FM_FMRI_SCHEME, &scheme) == 0) { if (strcmp(scheme, FM_FMRI_SCHEME_HC) == 0) { valuep->t = NODEPTR; - valuep->v = (unsigned long long)hc_fmri_nodeize(embnvp); + valuep->v = (uintptr_t)hc_fmri_nodeize(embnvp); return (0); } } @@ -1638,7 +1638,7 @@ platform_payloadprop(struct node *np, struct evalue *valuep) char *val; valuep->t = STRING; (void) nvpair_value_string(nvpair, &val); - valuep->v = (unsigned long long)stable(val); + valuep->v = (uintptr_t)stable(val); break; } @@ -1726,7 +1726,7 @@ platform_payloadprop(struct node *np, struct evalue *valuep) if (not_array == 1 || index >= nelem) goto invalid; valuep->t = STRING; - valuep->v = (unsigned long long)stable(val[index]); + valuep->v = (uintptr_t)stable(val[index]); break; } @@ -1866,7 +1866,7 @@ platform_payloadprop_values(const char *propstr, int *nvals) retvals = MALLOC(sizeof (struct evalue)); retvals->t = NODEPTR; retvals->v = - (unsigned long long)hc_fmri_nodeize(embnvp); + (uintptr_t)hc_fmri_nodeize(embnvp); return (retvals); } } @@ -1907,7 +1907,7 @@ platform_payloadprop_values(const char *propstr, int *nvals) &scheme) == 0 && strcmp(scheme, FM_FMRI_SCHEME_HC) == 0) { retvals[hccount].t = NODEPTR; - retvals[hccount].v = (unsigned long long) + retvals[hccount].v = (uintptr_t) hc_fmri_nodeize(nvap[i]); hccount++; } @@ -1942,7 +1942,7 @@ platform_payloadprop_values(const char *propstr, int *nvals) retvals = MALLOC(sizeof (struct evalue)); retvals->t = STRING; (void) nvpair_value_string(nvpair, &val); - retvals->v = (unsigned long long)stable(val); + retvals->v = (uintptr_t)stable(val); return (retvals); } @@ -2068,7 +2068,7 @@ platform_payloadprop_values(const char *propstr, int *nvals) retvals = MALLOC(sizeof (struct evalue) * nel); for (i = 0; i < nel; i++) { retvals[i].t = STRING; - retvals[i].v = (unsigned long long)stable(val[i]); + retvals[i].v = (uintptr_t)stable(val[i]); } return (retvals); } diff --git a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_main.c b/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_main.c index b8a2246a86..f017c96668 100644 --- a/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_main.c +++ b/usr/src/cmd/fm/modules/sun4/cpumem-diagnosis/cmd_main.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -239,7 +239,7 @@ cmd_gc(fmd_hdl_t *hdl) cmd_mem_gc(hdl); } -static const cmd_stat_t cmd_stats = { +static cmd_stat_t cmd_stats = { { "bad_det", FMD_TYPE_UINT64, "detector missing or malformed" }, { "bad_cpu_asru", FMD_TYPE_UINT64, "CPU ASRU missing or malformed" }, { "bad_mem_asru", FMD_TYPE_UINT64, "memory ASRU missing or malformed" }, diff --git a/usr/src/cmd/fm/schemes/cpu/cpu.c b/usr/src/cmd/fm/schemes/cpu/cpu.c index 03e32c6f95..40c0e79f13 100644 --- a/usr/src/cmd/fm/schemes/cpu/cpu.c +++ b/usr/src/cmd/fm/schemes/cpu/cpu.c @@ -169,7 +169,7 @@ cpu_phys2virt(uint32_t cpuid, uint32_t *cpuvidp) for (idx = 0, mcmp = cpu.cpu_mdesc_cpus; idx < cpu.cpu_mdesc_ncpus; idx++, mcmp++) { - if (mcmp->cpumap_pid == (uint64_t)-1) + if (mcmp->cpumap_pid == (uint32_t)-1) continue; /* ignore invalid value */ if (mcmp->cpumap_pid == cpuid) { *cpuvidp = mcmp->cpumap_id; diff --git a/usr/src/cmd/fm/schemes/mem/mem.c b/usr/src/cmd/fm/schemes/mem/mem.c index 9d05f818c4..53c86de99e 100644 --- a/usr/src/cmd/fm/schemes/mem/mem.c +++ b/usr/src/cmd/fm/schemes/mem/mem.c @@ -218,10 +218,10 @@ mem_get_serids_from_cache(const char *unum, char ***seridsp, size_t *nseridsp) return (rc); } -#else +#endif /* sparc */ + /*ARGSUSED*/ static int -#endif /* sparc */ mem_get_serids_by_unum(const char *unum, char ***seridsp, size_t *nseridsp) { /* diff --git a/usr/src/cmd/geniconvtbl/Makefile b/usr/src/cmd/geniconvtbl/Makefile index 0fa14ff086..d0b3c91b9d 100644 --- a/usr/src/cmd/geniconvtbl/Makefile +++ b/usr/src/cmd/geniconvtbl/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,17 +18,17 @@ # # CDDL HEADER END # -# Copyright (c) 1999,2001 by Sun Microsystems, Inc. -# All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" # # cmd/geniconvtbl/Makefile include ../Makefile.cmd -SUBDIRS= $(MACH) +SUBDIRS= native $(MACH) $(BUILD64)SUBDIRS += $(MACH64) SAMPLES = samples diff --git a/usr/src/cmd/geniconvtbl/Makefile.com b/usr/src/cmd/geniconvtbl/Makefile.com index ffef3b3c59..e3bc03ebe3 100644 --- a/usr/src/cmd/geniconvtbl/Makefile.com +++ b/usr/src/cmd/geniconvtbl/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,21 +18,17 @@ # # CDDL HEADER END # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# Use is subject to license terms. # ident "%Z%%M% %I% %E% SMI" # # cmd/geniconvtbl/Makefile.com +$(NOT_NATIVE)NATIVE_BUILD = $(POUND_SIGN) ITM = geniconvtbl.so PROG = geniconvtbl -NATIVEPROG= $(PROG).native -$(NATIVEPROG) := CC=$(NATIVECC) -$(NATIVEPROG) := CPPFLAGS= -I. -I.. -$(NATIVEPROG) := LDLIBS= -lgen SRCSH1 = iconv_tm.h hash.h SRCCH1 = itmcomp.h itm_util.h maptype.h @@ -87,7 +82,7 @@ OBJS = $(SRCSC1:%.c=%.o) $(YTABC:.c=.o) $(LEXYY:.c=.o) CHECKHDRS = $(HDRS%.h=%.check) -CLOBBERFILES= $(ITM) $(NATIVEPROG) +CLOBBERFILES= $(ITM) CLEANFILES = $(OBJS) $(YTABC) $(YTABH) $(LEXYY) $(YOUT) \ $(POFILES) $(POFILE) @@ -102,6 +97,10 @@ $(ITM) := sparcv9_CFLAGS += -xregs=no%appl LDLIBS += -lgen +MY_NATIVE_CPPFLAGS = -D_FILE_OFFSET_BITS=64 -I. -I.. +MY_NATIVE_LDFLAGS = $(NES_MAPFILE:%=-M%) $(PGA_MAPFILE:%=-M%) +MY_NATIVE_LDLIBS = -lgen + # # Message catalog # @@ -122,9 +121,6 @@ $(PROG): $(OBJS) $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(POST_PROCESS) -$(NATIVEPROG): $(SRCS) - $(LINK.c) $(SRCS) -o $@ $(LDLIBS) - $(ITM): $(SRCI) $(CC) $(CFLAGS) $(CPPFLAGS) -M$(MAPFILE) -o $@ $(SRCI) $(LDLIBS) $(POST_PROCESS_SO) diff --git a/usr/src/cmd/geniconvtbl/native/Makefile b/usr/src/cmd/geniconvtbl/native/Makefile new file mode 100644 index 0000000000..4f5960f0c0 --- /dev/null +++ b/usr/src/cmd/geniconvtbl/native/Makefile @@ -0,0 +1,45 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +.KEEP_STATE: + +NOT_NATIVE = $(POUND_SIGN) # tell Makefile.com we're native + +include ../Makefile.com + +CC = $(NATIVECC) +LD = $(NATIVELD) +CFLAGS = $(NATIVE_CFLAGS) +CPPFLAGS = $(MY_NATIVE_CPPFLAGS) +LDFLAGS = $(MY_NATIVE_LDFLAGS) +LDLIBS = $(MY_NATIVE_LDLIBS) +POST_PROCESS = + +all install: $(PROG) + +catalog: diff --git a/usr/src/cmd/geniconvtbl/samples/Makefile b/usr/src/cmd/geniconvtbl/samples/Makefile index 67afe8de60..85a33593d3 100644 --- a/usr/src/cmd/geniconvtbl/samples/Makefile +++ b/usr/src/cmd/geniconvtbl/samples/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,11 +18,10 @@ # # CDDL HEADER END # -# Copyright 1999, 2003 Sun Microsystems, Inc. -# All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" # # cmd/geniconvtbl/samples/Makefile @@ -41,7 +39,7 @@ OUTPUTFILES = ISO646%ISO8859-1.bt ISO8859-1%ISO646.bt # OUTPUTFILES = $(INPUTFILES:%.src=%.bt) NEVER USE ( WATCH OUT FILE NAME ) -GENICONVTBL= ../$(MACH)/geniconvtbl.native +GENICONVTBL= ../native/geniconvtbl # include ../../../lib/Makefile.lib diff --git a/usr/src/cmd/perl/5.6.1/Makefile b/usr/src/cmd/perl/5.6.1/Makefile index c384b77fb3..8f02d79790 100644 --- a/usr/src/cmd/perl/5.6.1/Makefile +++ b/usr/src/cmd/perl/5.6.1/Makefile @@ -20,7 +20,7 @@ # # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -55,7 +55,7 @@ clean := TARGET = clean test := TARGET = test # Compiler replacement rules -SED_CC = -e "s!'cc'!'$(CC)'!" +SED_CC = -e "s!'cc'!'$(CC) -_gcc=-w'!" SED_CC_E = -e "s!'cc -E'!'$(REAL_CC) -E'!" # distrib holds the perl source, contrib holds the SMI modules. diff --git a/usr/src/cmd/perl/5.6.1/distrib/Makefile b/usr/src/cmd/perl/5.6.1/distrib/Makefile index 5208905c51..7bc986b064 100644 --- a/usr/src/cmd/perl/5.6.1/distrib/Makefile +++ b/usr/src/cmd/perl/5.6.1/distrib/Makefile @@ -20,7 +20,7 @@ # # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -65,7 +65,7 @@ CPPFLAGS += $(PERL_COREFLAGS) $(PERL_LFFLAGS) LDLIBS += $(PERL_LDLIBS) # Compiler replacement rules -SED_UN_CC = -e "s!'$(CC)!'cc!" +SED_UN_CC = -e "s!'$(CC) -_gcc=-w!'cc!" SED_UN_CC_E = -e "s!'$(REAL_CC)!'cc!" all := TARGET = all diff --git a/usr/src/cmd/perl/5.6.1/extract_config.sh b/usr/src/cmd/perl/5.6.1/extract_config.sh index 9f78432203..80a3dfc2ac 100644 --- a/usr/src/cmd/perl/5.6.1/extract_config.sh +++ b/usr/src/cmd/perl/5.6.1/extract_config.sh @@ -1,7 +1,7 @@ #!/bin/ksh -p # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -43,6 +43,7 @@ printf 'sparc_C_PICFLAGS = %s\n' "$cccdlflags" printf 'i386_C_PICFLAGS = %s\n' "$cccdlflags" printf 'C_PICFLAGS = %s\n' "$cccdlflags" printf 'DYNFLAGS += $(ZIGNORE)\n' +printf 'CFLAGS += -_gcc=-w\n' # Global stuff. printf 'PERL_VERSION = %s\n' $version diff --git a/usr/src/cmd/perl/5.8.4/Makefile b/usr/src/cmd/perl/5.8.4/Makefile index 88a3092352..9e264cde48 100644 --- a/usr/src/cmd/perl/5.8.4/Makefile +++ b/usr/src/cmd/perl/5.8.4/Makefile @@ -20,7 +20,7 @@ # # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -55,7 +55,7 @@ clean := TARGET = clean test := TARGET = test # Compiler replacement rules -SED_CC = -e "s!'cc'!'$(CC)'!" +SED_CC = -e "s!'cc'!'$(CC) -_gcc=-w'!" SED_CC_E = -e "s!'cc -E'!'$(REAL_CC) -E'!" # distrib holds the perl source, contrib holds the SMI modules. diff --git a/usr/src/cmd/perl/5.8.4/distrib/Makefile b/usr/src/cmd/perl/5.8.4/distrib/Makefile index 1775f48491..d98545911b 100644 --- a/usr/src/cmd/perl/5.8.4/distrib/Makefile +++ b/usr/src/cmd/perl/5.8.4/distrib/Makefile @@ -20,7 +20,7 @@ # # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -71,7 +71,7 @@ CPPFLAGS += $(PERL_COREFLAGS) $(PERL_LFFLAGS) LDLIBS += $(PERL_LDLIBS) # Compiler replacement rules -SED_UN_CC = -e "s!'$(CC)!'cc!" +SED_UN_CC = -e "s!'$(CC) -_gcc=-w!'cc!" SED_UN_CC_E = -e "s!'$(REAL_CC)!'cc!" all := TARGET = all diff --git a/usr/src/cmd/perl/5.8.4/extract_config.sh b/usr/src/cmd/perl/5.8.4/extract_config.sh index 75c1771446..133b5d0a6e 100644 --- a/usr/src/cmd/perl/5.8.4/extract_config.sh +++ b/usr/src/cmd/perl/5.8.4/extract_config.sh @@ -1,7 +1,7 @@ #!/bin/ksh -p # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -43,6 +43,7 @@ printf 'sparc_C_PICFLAGS = %s\n' "$cccdlflags" printf 'i386_C_PICFLAGS = %s\n' "$cccdlflags" printf 'C_PICFLAGS = %s\n' "$cccdlflags" printf 'DYNFLAGS += $(ZIGNORE)\n' +printf 'CFLAGS += -_gcc=-w\n' # Global stuff. printf 'PERL_VERSION = %s\n' $version diff --git a/usr/src/cmd/picl/plugins/sun4u/lw8/frutree/piclfrutree.c b/usr/src/cmd/picl/plugins/sun4u/lw8/frutree/piclfrutree.c index 4f1c36a1f8..38747ae297 100644 --- a/usr/src/cmd/picl/plugins/sun4u/lw8/frutree/piclfrutree.c +++ b/usr/src/cmd/picl/plugins/sun4u/lw8/frutree/piclfrutree.c @@ -155,13 +155,13 @@ static picld_plugin_reg_t my_reg_info = { #define MEMORY_DEV "/platform/ssm@0,0/memory-controller@%x,400000" #define IO_DEV "/platform/ssm@0,0/pci@%s" #define DISK0_BASE_PATH "/ssm@0,0/pci@18,600000/scsi@2/sd@0,0" -#define DISK0_DEV "/platform"##DISK0_BASE_PATH +#define DISK0_DEV "/platform" DISK0_BASE_PATH #define DISK1_BASE_PATH "/ssm@0,0/pci@18,600000/scsi@2/sd@1,0" -#define DISK1_DEV "/platform"##DISK1_BASE_PATH +#define DISK1_DEV "/platform" DISK1_BASE_PATH #define DISK0_BASE_PATH_PCIX "/ssm@0,0/pci@18,700000/scsi@2/sd@0,0" -#define DISK0_DEV_PCIX "/platform"##DISK0_BASE_PATH_PCIX +#define DISK0_DEV_PCIX "/platform" DISK0_BASE_PATH_PCIX #define DISK1_BASE_PATH_PCIX "/ssm@0,0/pci@18,700000/scsi@2/sd@1,0" -#define DISK1_DEV_PCIX "/platform"##DISK1_BASE_PATH_PCIX +#define DISK1_DEV_PCIX "/platform" DISK1_BASE_PATH_PCIX #define TAPE_DEV "/platform/ssm@0,0/pci@18,600000/scsi@2/st@5,0" #define TAPE_DEV_PCIX "/platform/ssm@0,0/pci@18,700000/scsi@2/st@5,0" #define DVD_DEV "/platform/ssm@0,0/pci@18,700000/ide@3/sd@0,0" diff --git a/usr/src/cmd/savecore/Makefile.com b/usr/src/cmd/savecore/Makefile.com index 7d6eacaa32..35b473066e 100644 --- a/usr/src/cmd/savecore/Makefile.com +++ b/usr/src/cmd/savecore/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -20,14 +19,15 @@ # CDDL HEADER END # # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" # PROG= savecore SRCS= ../savecore.c ../../../uts/common/os/compress.c +OBJS= savecore.o compress.o include ../../Makefile.cmd @@ -40,13 +40,21 @@ CPPFLAGS += -D_LARGEFILE64_SOURCE=1 all: $(PROG) -$(PROG): $(SRCS) - $(LINK.c) -o $(PROG) $(SRCS) $(LDLIBS) +$(PROG): $(OBJS) + $(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS) $(POST_PROCESS) clean: - $(RM) $(PROG) + $(RM) $(OBJS) lint: lint_SRCS include ../../Makefile.targ + +%.o: ../%.c + $(COMPILE.c) $< + $(POST_PROCESS_O) + +%.o: ../../../uts/common/os/%.c + $(COMPILE.c) $< + $(POST_PROCESS_O) diff --git a/usr/src/cmd/sgs/rtld/i386/Makefile b/usr/src/cmd/sgs/rtld/i386/Makefile index 7862afeec0..fd26b2b396 100644 --- a/usr/src/cmd/sgs/rtld/i386/Makefile +++ b/usr/src/cmd/sgs/rtld/i386/Makefile @@ -57,10 +57,9 @@ CRTI= pics/crti.o CRTN= pics/crtn.o CRTS= $(CRTI) $(CRTN) -# __GNUC is overridden in the environment when building with gcc -__GNUC:sh= echo \\043 +include $(SRC)/Makefile.master -# We build 32-bit objects with cc by default +# This is safe because linking is done only with the primary compiler. MAPFILE-ORDER = ../common/mapfile-order-devpro $(__GNUC)MAPFILE-ORDER = ../common/mapfile-order-gcc diff --git a/usr/src/cmd/sgs/rtld/sparc/Makefile b/usr/src/cmd/sgs/rtld/sparc/Makefile index 96c5342885..6a706c9a22 100644 --- a/usr/src/cmd/sgs/rtld/sparc/Makefile +++ b/usr/src/cmd/sgs/rtld/sparc/Makefile @@ -60,10 +60,9 @@ CHKSRCS= $(SRCBASE)/uts/common/krtld/reloc.h BASEPLAT = sparc -# __GNUC is overridden in the environment when building with gcc -__GNUC:sh= echo \\043 +include $(SRC)/Makefile.master -# We build sparc objects with cc by default +# This is safe because linking is done only with the primary compiler. MAPFILE-ORDER = ../common/mapfile-order-devpro $(__GNUC)MAPFILE-ORDER = ../common/mapfile-order-gcc diff --git a/usr/src/cmd/sgs/rtld/sparcv9/Makefile b/usr/src/cmd/sgs/rtld/sparcv9/Makefile index 238cf8805a..c555d2c649 100644 --- a/usr/src/cmd/sgs/rtld/sparcv9/Makefile +++ b/usr/src/cmd/sgs/rtld/sparcv9/Makefile @@ -59,12 +59,11 @@ CHKSRCS= $(SRCBASE)/uts/common/krtld/reloc.h BASEPLAT = sparc -# __GNUC is overridden in the environment when building with gcc -__GNUC:sh= echo \\043 +include $(SRC)/Makefile.master # We build sparc objects with cc by default MAPFILE-ORDER = ../common/mapfile-order-devpro -$(__GNUC)MAPFILE-ORDER = ../common/mapfile-order-gcc +$(__GNUC64)MAPFILE-ORDER = ../common/mapfile-order-gcc include $(SRC)/cmd/sgs/rtld/Makefile.com include $(SRC)/lib/Makefile.lib.64 diff --git a/usr/src/cmd/stmsboot/stmsboot_util.c b/usr/src/cmd/stmsboot/stmsboot_util.c index 78ab8f6024..8076fc3652 100644 --- a/usr/src/cmd/stmsboot/stmsboot_util.c +++ b/usr/src/cmd/stmsboot/stmsboot_util.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -212,7 +212,7 @@ parse_args(int argc, char *argv[]) /*NOTREACHED*/ } -void +int main(int argc, char *argv[]) { char save_vfstab[SYS_FILENAME_LEN], tmp_vfstab[SYS_FILENAME_LEN]; diff --git a/usr/src/cmd/syseventd/daemons/syseventconfd/syseventconfd.c b/usr/src/cmd/syseventd/daemons/syseventconfd/syseventconfd.c index e3aa946454..8812c6d8ab 100644 --- a/usr/src/cmd/syseventd/daemons/syseventconfd/syseventconfd.c +++ b/usr/src/cmd/syseventd/daemons/syseventconfd/syseventconfd.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -115,7 +115,7 @@ set_root_dir(char *dir) } -void +int main(int argc, char **argv) { int c; @@ -229,6 +229,7 @@ main(int argc, char **argv) (void) mutex_lock(&cmd_list_lock); } /* NOTREACHED */ + return (0); } /* diff --git a/usr/src/cmd/syseventd/daemons/syseventconfd/syseventconfd.h b/usr/src/cmd/syseventd/daemons/syseventconfd/syseventconfd.h index 9eec33ee12..6f95ea9404 100644 --- a/usr/src/cmd/syseventd/daemons/syseventconfd/syseventconfd.h +++ b/usr/src/cmd/syseventd/daemons/syseventconfd/syseventconfd.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 2000-2001 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #ifndef _SYSEVENTCONFD_H @@ -74,7 +74,6 @@ typedef struct str { /* * Prototypes */ -void main(int argc, char **argv); static void event_handler(sysevent_t *event); static void exec_cmd(struct cmd *cmd); static void sigwait_thr(void); diff --git a/usr/src/cmd/syseventd/daemons/syseventd/syseventd.c b/usr/src/cmd/syseventd/daemons/syseventd/syseventd.c index 995ff1048f..72ca0ba808 100644 --- a/usr/src/cmd/syseventd/daemons/syseventd/syseventd.c +++ b/usr/src/cmd/syseventd/daemons/syseventd/syseventd.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -272,7 +272,7 @@ set_root_dir(char *dir) (void) strcpy(root_dir, dir); } -void +int main(int argc, char **argv) { int i, c; @@ -421,6 +421,7 @@ main(int argc, char **argv) (void) pause(); } /* NOTREACHED */ + return (0); } /* diff --git a/usr/src/cmd/zdb/Makefile.com b/usr/src/cmd/zdb/Makefile.com index e3156cdeb0..fa4a8a485e 100644 --- a/usr/src/cmd/zdb/Makefile.com +++ b/usr/src/cmd/zdb/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -28,6 +28,7 @@ PROG:sh= cd ..; basename `pwd` SRCS= ../$(PROG).c ../zdb_il.c +OBJS= $(PROG).o zdb_il.o include ../../Makefile.cmd @@ -51,8 +52,8 @@ LINTFLAGS64 += -xerroff=E_NAME_DEF_NOT_USED2 all: $(PROG) -$(PROG): $(SRCS) - $(LINK.c) -o $(PROG) $(SRCS) $(LDLIBS) +$(PROG): $(OBJS) + $(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS) $(POST_PROCESS) clean: @@ -60,3 +61,7 @@ clean: lint: lint_SRCS include ../../Makefile.targ + +%.o: ../%.c + $(COMPILE.c) $< + $(POST_PROCESS_O) diff --git a/usr/src/cmd/zinject/Makefile.com b/usr/src/cmd/zinject/Makefile.com index 40f1914729..14651a366c 100644 --- a/usr/src/cmd/zinject/Makefile.com +++ b/usr/src/cmd/zinject/Makefile.com @@ -26,7 +26,8 @@ # PROG:sh= cd ..; basename `pwd` -SRCS= ../$(PROG).c ../translate.c +OBJS= $(PROG).o translate.o +SRCS= $(OBJS:%.o=../%.c) include ../../Makefile.cmd @@ -44,12 +45,16 @@ CPPFLAGS += -D_LARGEFILE64_SOURCE=1 -D_REENTRANT $(INCS) all: $(PROG) -$(PROG): $(SRCS) - $(LINK.c) -o $(PROG) $(SRCS) $(LDLIBS) +$(PROG): $(OBJS) + $(LINK.c) -o $(PROG) $(OBJS) $(LDLIBS) $(POST_PROCESS) clean: lint: lint_SRCS +%.o: ../%.c + $(COMPILE.c) $< + $(POST_PROCESS_O) + include ../../Makefile.targ diff --git a/usr/src/lib/Makefile.targ b/usr/src/lib/Makefile.targ index 2ea6b7cb95..d8f38a337a 100644 --- a/usr/src/lib/Makefile.targ +++ b/usr/src/lib/Makefile.targ @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,6 +18,7 @@ # # CDDL HEADER END # + # # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. @@ -96,7 +96,7 @@ $(DYNLIBCCC): pics .WAIT $$(PICS) $$(ALTPICS) $(POST_PROCESS_SO) fnamecheck: $(DYNLIB) - check_fnames -s $(C_SYNONYMS_H) -l $(DYNLIB) $(PICS) $(ALTPICS) + $(CHECK_FNAMES) -s $(C_SYNONYMS_H) -l $(DYNLIB) $(PICS) $(ALTPICS) $(LINTLIB): $$(SRCS) $(LINT.c) -o $(LIBNAME) $(SRCS) > $(LINTOUT) 2>&1 diff --git a/usr/src/lib/fm/topo/libtopo/common/cpu.c b/usr/src/lib/fm/topo/libtopo/common/cpu.c index f7dffc2434..0e8d5e9f3a 100644 --- a/usr/src/lib/fm/topo/libtopo/common/cpu.c +++ b/usr/src/lib/fm/topo/libtopo/common/cpu.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,6 +18,7 @@ * * CDDL HEADER END */ + /* * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -298,7 +298,7 @@ cpu_str2nvl(topo_mod_t *mod, tnode_t *node, topo_version_t version, nvlist_t *in, nvlist_t **out) { int err; - uint32_t cpuid; + ulong_t cpuid; char *str, *s, *end; char *serial = NULL; nvlist_t *fmri; @@ -334,7 +334,7 @@ cpu_str2nvl(topo_mod_t *mod, tnode_t *node, topo_version_t version, err = nvlist_add_uint8(fmri, FM_VERSION, CPU_SCHEME_VERSION1); err |= nvlist_add_string(fmri, FM_FMRI_SCHEME, FM_FMRI_SCHEME_CPU); - err |= nvlist_add_uint32(fmri, FM_FMRI_CPU_ID, cpuid); + err |= nvlist_add_uint32(fmri, FM_FMRI_CPU_ID, (uint32_t)cpuid); err |= nvlist_add_uint8(fmri, FM_FMRI_CPU_MASK, 0); if (serial != NULL) err |= nvlist_add_string(fmri, FM_FMRI_CPU_SERIAL_ID, diff --git a/usr/src/lib/fm/topo/libtopo/common/topo_fmri.c b/usr/src/lib/fm/topo/libtopo/common/topo_fmri.c index 7be3f60dc0..3e29e0b3aa 100644 --- a/usr/src/lib/fm/topo/libtopo/common/topo_fmri.c +++ b/usr/src/lib/fm/topo/libtopo/common/topo_fmri.c @@ -241,7 +241,7 @@ topo_fmri_expand(topo_hdl_t *thp, nvlist_t *fmri, int *err) return (0); } -static struct rsrc { +struct rsrc { int rs_err; int rs_flag; nvlist_t **rs_fprop; diff --git a/usr/src/lib/fm/topo/modules/common/did_hash.c b/usr/src/lib/fm/topo/modules/common/did_hash.c index 16af34014f..ca0596a18f 100644 --- a/usr/src/lib/fm/topo/modules/common/did_hash.c +++ b/usr/src/lib/fm/topo/modules/common/did_hash.c @@ -66,7 +66,7 @@ did_dnhash(di_node_t key) if (key_divisor == 0) key_divisor = sizeof (*key); - keyn = (uint64_t)key; + keyn = (uintptr_t)key; return (keyn / key_divisor); } diff --git a/usr/src/lib/fm/topo/modules/common/did_props.c b/usr/src/lib/fm/topo/modules/common/did_props.c index 8a2f3875ca..1a635c2641 100644 --- a/usr/src/lib/fm/topo/modules/common/did_props.c +++ b/usr/src/lib/fm/topo/modules/common/did_props.c @@ -505,7 +505,8 @@ label_set(tnode_t *tn, did_t *pd, mp = did_mod(pd); if (topo_mod_nvalloc(mp, &in, NV_UNIQUE_NAME) != 0) return (topo_mod_seterrno(mp, EMOD_FMRI_NVL)); - if (nvlist_add_uint64(in, TOPO_METH_LABEL_ARG_NVL, (uint64_t)pd) != 0) { + if (nvlist_add_uint64(in, TOPO_METH_LABEL_ARG_NVL, (uintptr_t)pd) != + 0) { nvlist_free(in); return (topo_mod_seterrno(mp, EMOD_NOMEM)); } diff --git a/usr/src/lib/fm/topo/modules/common/pcibus_labels.c b/usr/src/lib/fm/topo/modules/common/pcibus_labels.c index 1933f8aa30..7c0e14d505 100644 --- a/usr/src/lib/fm/topo/modules/common/pcibus_labels.c +++ b/usr/src/lib/fm/topo/modules/common/pcibus_labels.c @@ -181,7 +181,7 @@ pci_label_cmn(tnode_t *node, nvlist_t *in, nvlist_t **out) "label method argument not found.\n"); return (-1); } - dp = (did_t *)ptr; + dp = (did_t *)(uintptr_t)ptr; /* * Is there a slotname associated with the device? diff --git a/usr/src/lib/libc/Makefile b/usr/src/lib/libc/Makefile index 4bf2ad6379..f232f2c11a 100644 --- a/usr/src/lib/libc/Makefile +++ b/usr/src/lib/libc/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License, (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,6 +18,7 @@ # # CDDL HEADER END # + # # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. @@ -122,18 +122,18 @@ etc: $($(MACH)_ETC) lib32: $(MACHLIBS) $(MACH)/$(LIB_PIC) $(VARIANTLIBS) mkdir -p $(MACH)/i18n_pics cd $(MACH)/i18n_pics ; $(AR) -x $(ROOTFS_LIBDIR)/libc_i18n.a - check_fnames -s $(C_SYNONYMS_H) -l $(MACH)/$(DYNLIB) \ + $(CHECK_FNAMES) -s $(C_SYNONYMS_H) -l $(MACH)/$(DYNLIB) \ $(MACH)/pics/*.o $(MACH)/i18n_pics/*.o lib64: $(MACHLIBS64) $(MACH64)/$(LIB_PIC) $(VARIANTLIBS) mkdir -p $(MACH64)/i18n_pics cd $(MACH64)/i18n_pics ; $(AR) -x $(ROOTFS_LIBDIR64)/libc_i18n.a - check_fnames -s $(C_SYNONYMS_H) -l $(MACH64)/$(DYNLIB) \ + $(CHECK_FNAMES) -s $(C_SYNONYMS_H) -l $(MACH64)/$(DYNLIB) \ $(MACH64)/pics/*.o $(MACH64)/i18n_pics/*.o $(VARIANTLIBS): FRC @cd $(@D); pwd; VERSION='$(VERSION)' $(MAKE) $(@F) - check_fnames -s $(C_SYNONYMS_H) -l $(@D)/$(@F) $(@D)/pics/*.o + $(CHECK_FNAMES) -s $(C_SYNONYMS_H) -l $(@D)/$(@F) $(@D)/pics/*.o $($(MACH)_ETC): FRC @cd $(@); pwd; $(MAKE) $(TARGET) diff --git a/usr/src/lib/libc/sparc/Makefile b/usr/src/lib/libc/sparc/Makefile index 7b5a74a3a3..49a76b04c6 100644 --- a/usr/src/lib/libc/sparc/Makefile +++ b/usr/src/lib/libc/sparc/Makefile @@ -18,6 +18,7 @@ # # CDDL HEADER END # + # # Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. @@ -98,9 +99,7 @@ FPASMOBJS= \ fpgetsticky.o \ fpsetmask.o \ fpsetrnd.o \ - fpsetsticky.o - -$(__GNUC)FPASMOBJS += \ + fpsetsticky.o \ __quad.o ATOMICOBJS= \ @@ -1067,8 +1066,8 @@ TIL= \ $(TIL:%=pics/%) := CFLAGS += $(LIBCBASE)/threads/sparc.il -# special kludge for gcc inlines with 'cas': -$(__GNUC)pics/synch.o pics/lwp.o := sparc_XARCH = -xarch=v8plus +# special kludge for inlines with 'cas': +pics/synch.o pics/lwp.o := sparc_CFLAGS += -_gcc=-Wa,-xarch=v8plus # Files in port/fp subdirectory that need base.il inline template IL= \ diff --git a/usr/src/lib/libdtrace_jni/common/dtj_util.c b/usr/src/lib/libdtrace_jni/common/dtj_util.c index 17463e0f0e..cb4578dc93 100644 --- a/usr/src/lib/libdtrace_jni/common/dtj_util.c +++ b/usr/src/lib/libdtrace_jni/common/dtj_util.c @@ -1186,8 +1186,8 @@ dtj_pointer_list_entry_cmp(const void *v1, const void *v2, void *arg) * It is not valid to compare pointers using the relational operators * unless they point to elements in the same array. */ - uint64_t x = (uint64_t)p1->dple_ptr; - uint64_t y = (uint64_t)p2->dple_ptr; + uint64_t x = (uintptr_t)p1->dple_ptr; + uint64_t y = (uintptr_t)p2->dple_ptr; int rc; rc = ((x > y) ? 1 : ((x < y) ? -1 : 0)); return (rc); diff --git a/usr/src/lib/libsysevent/libsysevent.c b/usr/src/lib/libsysevent/libsysevent.c index 3dd246babb..ba5451ef32 100644 --- a/usr/src/lib/libsysevent/libsysevent.c +++ b/usr/src/lib/libsysevent/libsysevent.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -202,7 +202,7 @@ sysevent_dup(sysevent_t *ev) return (NULL); bcopy(ev, copy, attr_offset); - nvl = (nvlist_t *)SE_ATTR_PTR(ev); + nvl = (nvlist_t *)(uintptr_t)SE_ATTR_PTR(ev); if (nvl && nvlist_dup(nvl, &cnvl, 0) != 0) { free(copy); return (NULL); @@ -219,7 +219,7 @@ sysevent_dup(sysevent_t *ev) void sysevent_free(sysevent_t *ev) { - nvlist_t *attr_list = (nvlist_t *)SE_ATTR_PTR(ev); + nvlist_t *attr_list = (nvlist_t *)(uintptr_t)SE_ATTR_PTR(ev); if (attr_list) nvlist_free(attr_list); @@ -248,7 +248,7 @@ sysevent_get_attr_list(sysevent_t *ev, nvlist_t **nvlist) /* Duplicate attribute for an unpacked sysevent buffer */ if (SE_FLAG(ev) != SE_PACKED_BUF) { - nvl = (nvlist_t *)SE_ATTR_PTR(ev); + nvl = (nvlist_t *)(uintptr_t)SE_ATTR_PTR(ev); if (nvl == NULL) { return (0); } @@ -373,7 +373,7 @@ sysevent_attr_next(sysevent_t *ev, sysevent_attr_t *attr) return (NULL); } - nvl = (nvlist_t *)SE_ATTR_PTR(ev); + nvl = (nvlist_t *)(uintptr_t)SE_ATTR_PTR(ev); return (nvlist_next_nvpair(nvl, nvp)); } @@ -398,7 +398,7 @@ sysevent_lookup_attr(sysevent_t *ev, char *name, int datatype, * nvlist_look mataches name only. So we walk * nvlist manually here. */ - nvl = (nvlist_t *)SE_ATTR_PTR(ev); + nvl = (nvlist_t *)(uintptr_t)SE_ATTR_PTR(ev); nvp = nvlist_next_nvpair(nvl, NULL); while (nvp) { if ((strcmp(name, nvpair_name(nvp)) == 0) && diff --git a/usr/src/lib/lvm/libmeta/common/meta_namespace.c b/usr/src/lib/lvm/libmeta/common/meta_namespace.c index ac0d7f1e2d..53c1b3e35c 100644 --- a/usr/src/lib/lvm/libmeta/common/meta_namespace.c +++ b/usr/src/lib/lvm/libmeta/common/meta_namespace.c @@ -108,7 +108,7 @@ meta_gethspnmentbyid( nm.hspid = hspid; nm.ret_hspid = MD_HSPID_WILD; nm.hspname_len = MAXPATHLEN; - nm.hspname = (uint64_t)device_name; + nm.hspname = (uintptr_t)device_name; if (metaioctl(MD_IOCGET_HSP_NM, &nm, &nm.mde, NULL) != 0) { (void) mdstealerror(ep, &nm.mde); @@ -148,7 +148,7 @@ meta_gethspnmentbyname( nm.hspid = MD_HSPID_WILD; nm.ret_hspid = MD_HSPID_WILD; nm.hspname_len = strlen(device_name) + 1; - nm.hspname = (uint64_t)device_name; + nm.hspname = (uintptr_t)device_name; /* * The ioctl expects the a hsp name and return its hsp_self_id. @@ -727,7 +727,10 @@ add_self_name( md_mnnode_desc *mnside; p = strrchr(uname, '/'); - p = (p == NULL? uname : ++p); + if (p == NULL) + p = uname; + else + p++; /* * The valid qualified name diff --git a/usr/src/tools/SUNWonbld/prototype_com b/usr/src/tools/SUNWonbld/prototype_com index 47441e2f54..1b55982243 100644 --- a/usr/src/tools/SUNWonbld/prototype_com +++ b/usr/src/tools/SUNWonbld/prototype_com @@ -114,6 +114,7 @@ f none opt/onbld/man/man1/check_rtime.1 644 root bin f none opt/onbld/man/man1/checkpaths.1 644 root bin f none opt/onbld/man/man1/codereview.1 644 root bin f none opt/onbld/man/man1/cstyle.1 644 root bin +f none opt/onbld/man/man1/cw.1 644 root bin f none opt/onbld/man/man1/flg.flp.1 644 root bin f none opt/onbld/man/man1/get_depend_info.1 644 root bin f none opt/onbld/man/man1/intf_check.1 644 root bin diff --git a/usr/src/tools/ctf/Makefile.ctf b/usr/src/tools/ctf/Makefile.ctf index f777b557df..7b42b93bb6 100644 --- a/usr/src/tools/ctf/Makefile.ctf +++ b/usr/src/tools/ctf/Makefile.ctf @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -39,16 +38,11 @@ include ../../../Makefile.tools # HDRDIRS= \ + -_gcc=-nostdinc \ -I../../common \ -I$(SRC) \ -I/usr/include \ -I$(SRC)/uts/common -$(__GNUC)HDRDIRS =\ - -I../../common \ - -I$(SRC) \ - -I$(SRC)/head \ - -I$(SRC)/uts/common - CPPFLAGS += $(HDRDIRS) CFLAGS += $(CCVERBOSE) diff --git a/usr/src/tools/cw/Makefile b/usr/src/tools/cw/Makefile index 0363f8fbe9..62b5522264 100644 --- a/usr/src/tools/cw/Makefile +++ b/usr/src/tools/cw/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -28,6 +27,8 @@ PROG = cw +MAN1FILES= cw.1 + include ../Makefile.tools # Bootstrap problem -- we have to build cw before we can use it @@ -51,11 +52,13 @@ CPPFLAGS += -DDEFAULT_GCC_DIR='"$(GNU_ROOT)/bin"' CPPFLAGS += -DDEFAULT_CPLUSPLUS_DIR='"$(SPRO_VROOT)/bin"' CPPFLAGS += -DDEFAULT_GPLUSPLUS_DIR='"$(GNU_ROOT)/bin"' +$(ROOTONBLDMAN1FILES) := FILEMODE= 644 + .KEEP_STATE: -all: $(PROG) +all: $(PROG) $(MAN1FILES) -install: all .WAIT $(ROOTONBLDMACHPROG) +install: all .WAIT $(ROOTONBLDMACHPROG) $(ROOTONBLDMAN1FILES) lint: lint_PROG diff --git a/usr/src/tools/cw/cw.1 b/usr/src/tools/cw/cw.1 new file mode 100644 index 0000000000..332deacf0c --- /dev/null +++ b/usr/src/tools/cw/cw.1 @@ -0,0 +1,243 @@ +.\" +.\" CDDL HEADER START +.\" +.\" The contents of this file are subject to the terms of the +.\" Common Development and Distribution License (the "License"). +.\" You may not use this file except in compliance with the License. +.\" +.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +.\" or http://www.opensolaris.org/os/licensing. +.\" See the License for the specific language governing permissions +.\" and limitations under the License. +.\" +.\" When distributing Covered Code, include this CDDL HEADER in each +.\" file and include the License file at usr/src/OPENSOLARIS.LICENSE. +.\" If applicable, add the following below this CDDL HEADER, with the +.\" fields enclosed by brackets "[]" replaced with your own identifying +.\" information: Portions Copyright [yyyy] [name of copyright owner] +.\" +.\" CDDL HEADER END +.\" +.\" Copyright 2006 Sun Microsystems, Inc. All rights reserved. +.\" Use is subject to license terms. +.\" +.\" ident "%Z%%M% %I% %E% SMI" +.TH cw 1 "24 March 2006" +.SH NAME +.I cw +\- invoke one or more compilers with argument translation +.SH SYNOPSIS +\fBcw {-_cc|-_gcc|-_CC|-_g++} [options] [compiler args...]\fP +.LP +.SH DESCRIPTION +.IX "OS-Net build tools" "cw" "" "\fBcw\fP" +.LP +.I cw +is a facility for invoking one or more compilers, providing +translation from Sun Studio arguments as appropriate. This allows +the use of arbitrary compilers without the need to alter large +numbers of makefiles. A mode called shadow compilation, the default, +invokes two different compilers so that warnings and errors may be +obtained from both. See SHADOW COMPILATION for details. This version +of cw supports Sun Studio 10 and 11 and gcc 3.4.3 as shipped in +Solaris. +.LP +.SH ARGUMENTS +.LP +Exactly one of the following arguments is required, and must appear +immediately following \fBcw\fP in the argument list: +.TP 4 +.B \-_cc +Select Sun Studio C (cc) as the primary compiler. +.TP 4 +.B \-_gcc +Select GNU C (gcc) as the primary compiler. +.TP 4 +.B \-_CC +Select Sun Studio C++ (CC) as the primary compiler. +.TP 4 +.B \-_g++ +Select GNU C++ (g++) as the primary compiler. +.LP +.SH OPTIONS +.LP +The following options are supported: +.TP 4 +.B \-_compiler +Do not invoke any compiler; instead, write to standard output the +full path to the primary compiler that would be invoked. If this +option is given, it must appear immediately following the compiler +selection argument, and all other options will be disregarded. +.LP +.TP 4 +.B \-_noecho +Normally, cw writes to standard error the actual compiler commands +invoked, each prefixed with '+'. This option suppresses these +messages. +.LP +.TP 4 +.B \-_cc=,\-_gcc=,\-_CC=,\-g++= +Pass compiler-dependent options. See ARGUMENT TRANSLATION. +.LP +.SH SHADOW COMPILATION +.LP +Unless otherwise directed by environment variables (see ENVIRONMENT), +\fBcw\fP will invoke both the compiler specified by its first argument +(primary) and a designated alternate compiler (shadow). The primary +compiler will be invoked with the arguments given to cw, translated +as described in ARGUMENT TRANSLATION. The secondary compiler will be +invoked in parallel with the primary (but see ENVIRONMENT); its +arguments will likewise be translated. However, the shadow compiler's +arguments will also be modified as follows: +.LP +.TP 4 +.B 1. +If none of \fI-c\fP, \fI-E\fP, \fI-P\fP, or \fI-S\fP appears in the +argument list (that is, linking is attempted), the shadow compiler +will not be invoked. This is because the objects built with that +compiler which would be linked have been previously discarded. +.LP +.TP 4 +.B 2. +If an option of the form \fI-ofilename\fP was provided, it will be +replaced by two options of the form \fI-o\fP \fItempfile\fP. +.LP +.TP 4 +.B 3. +If the option \fI-o\fP was provided, its following argument will be +replaced by \fItempfile\fP. +.LP +.TP 4 +.B 4. +If neither of the above options was provided, two options of the +form \fI-o\fP \fItempfile\fP will be added to the end of the argument +list used to invoke the shadow compiler. +.LP +In all three cases, \fItempfile\fP is the name of a temporary file +which will be removed by \fBcw\fP before it terminates. +.LP +When shadow compilation is in effect, \fBcw\fP writes to standard error +each compiler's standard error output following its argument list. +Messages from the two compilers will not be interleaved. If \fBcw\fP +is used to invoke the preprocessor and no output location is specified, +\fBcw\fP will write to standard output the primary compiler's +standard output, and the secondary compiler's standard output will +be discarded. +.LP +Because the Studio compilers write intermediate objects to fixed +filenames in the current directory when instructed to compile and +link multiple source files via a single command line, it would be +unsafe to invoke more than one compiler in this fashion. Therefore +\fBcw\fP does not accept multiple source files unless the +preprocessor is to be invoked. An attempt to invoke \fBcw\fP in +this manner will result in an error. +.LP +.SH ARGUMENT TRANSLATION +.LP +The arguments provided to \fBcw\fP will be passed through to each +compiler invoked, altered as follows: +.LP +.TP 4 +.B 1. +Options intended for \fBcw\fP itself are removed. +.LP +.TP 4 +.B 2. +The shadow compiler's arguments are modified as described in +SHADOW COMPILATION so that its output is discarded. +.LP +.TP 4 +.B 3. +If the compiler to be invoked is a GNU C or C++ compiler, a set of +default flags is added to the beginning of the argument list, and the +remaining arguments are translated to their closest appropriate +semantic equivalents and passed in the same order as their +counterparts given to \fBcw\fP. Arguments which begin with +\fI-_gcc=\fP or \fI-_g++=\fP will be passed in place with the +leading portion removed. Arguments which begin with \fI-_cc=\fP or +\fI-_CC=\fP will be discarded. See the comments at the head of +\fIusr/src/tools/cw/cw.c\fP for a detailed list of translations. +.LP +.TP 4 +.B 4. +If the compiler to be invoked is a Studio C or C++ compiler, the +remaining arguments are passed unmodified and in the same order as +given to \fBcw\fP. Arguments which begin with \fI-_cc=\fP or +\fI-_CC=\fP will be passed in place with the leading portion removed. +Arguments which begin with \fI-_gcc=\fP or \fI-_g++=\fP will be +discarded. +.LP +.SH ENVIRONMENT +.LP +.TP 4 +.B CW_NO_SHADOW +If this variable is set in the environment, invoke only the +primary compiler. +.LP +.TP 4 +.B CW_SHADOW_SERIAL +If this variable is set in the environment, invoke the primary compiler, +wait for it to complete, then invoke the shadow compiler. Normally +the two compilers are invoked in parallel. If CW_NO_SHADOW is set, +this has no effect. +.LP +.TP 4 +.B CW_NO_EXEC +If this variable is set in the environment, write the usual output to +standard error but do not actually invoke any compiler. This is +useful for debugging the translation engine. +.LP +.TP 4 +.B CW_CC_DIR, CW_CPLUSPLUS_DIR, SPRO_VROOT, SPRO_ROOT, BUILD_TOOLS +These variables define the search path for Studio compilers as +follows: +.B +If CW_CC_DIR is set, the Studio C compiler in \fI$CW_CC_DIR\fP +will be used. Likewise, if CW_CPLUSPLUS_DIR is set, the Studio C++ +compiler in \fI$CW_CPLUSPLUS_DIR\fP will be used. +Otherwise, if SPRO_VROOT is set, the Studio C and C++ compilers +in \fI$SPRO_VROOT/bin\fP will be used. +Otherwise, if SPRO_ROOT is set, the Studio C and C++ compilers +in \fI$SPRO_ROOT/SOS10/bin\fP will be used. +Otherwise, if BUILD_TOOLS is set, the Studio C and C++ compilers +in \fI$BUILD_TOOLS/SUNWspro/SOS10/bin\fP will be used. +Otherwise, the Studio compilers in a predefined default location +will be used. +.LP +.TP 4 +.B CW_GCC_DIR, CW_GPLUSPLUS_DIR, GNU_ROOT +These variables alter the search path for GNU compilers in a manner +similar to those described above. Specifically: +.B +If CW_GCC_DIR is set, the GNU C compiler in \fI$CW_GCC_DIR\fP +will be used. Likewise, if CW_GPLUSPLUS_DIR is set, the GNU C++ +compiler in \fI$CW_GPLUSPLUS_DIR\fP will be used. +Otherwise, if GNU_ROOT is set, the GNU C and C++ compilers +in \fI$GNU_ROOT/bin\fP will be used. +Otherwise, the GNU compilers in a predefined default location +will be used. +.LP +.SH EXIT STATUS +.LP +The following exit status values are returned: +.IP "\fB0\fR" 4 +.IX Item "0" +The primary compiler, and shadow compiler if invoked, both completed +successfully. +.IP "\fB>0\fR" 4 +.IX Item ">0" +A usage error occurred, or one or more compilers returned a nonzero +exit status. +.LP +.SH BUGS +.LP +The translations provided for gcc are not always exact and in some +cases reflect local ON policy rather than actual equivalence. +.LP +Additional compiler types should be supported. +.LP +The translation engine is hacky. +.LP +.SH SEE ALSO +.LP +cc(1), CC(1), gcc(1) diff --git a/usr/src/tools/cw/cw.c b/usr/src/tools/cw/cw.c index 218d2f9b9b..7cf7bcf15c 100644 --- a/usr/src/tools/cw/cw.c +++ b/usr/src/tools/cw/cw.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -288,19 +288,71 @@ #include <string.h> #include <stdlib.h> #include <ctype.h> +#include <fcntl.h> +#include <errno.h> +#include <stdarg.h> #include <sys/utsname.h> #include <sys/param.h> #include <sys/isa_defs.h> +#include <sys/wait.h> +#include <sys/stat.h> + +#define CW_F_CXX 0x01 +#define CW_F_SHADOW 0x02 +#define CW_F_EXEC 0x04 +#define CW_F_ECHO 0x08 +#define CW_F_XLATE 0x10 + +typedef enum cw_compiler { + CW_C_CC = 0, + CW_C_GCC +} cw_compiler_t; + +static const char *cmds[] = { + "cc", "CC", + "gcc", "g++" +}; -static int echo = 1; -static int newargc; -static const char *progname; +static const char *dirs[] = { + DEFAULT_CC_DIR, DEFAULT_CPLUSPLUS_DIR, + DEFAULT_GCC_DIR, DEFAULT_GPLUSPLUS_DIR +}; -static char *default_cc_dir; -static char *default_gcc_dir; +#define CC(ctx) \ + (((ctx)->i_flags & CW_F_SHADOW) ? \ + ((ctx)->i_compiler == CW_C_CC ? CW_C_GCC : CW_C_CC) : \ + (ctx)->i_compiler) -static char *default_cplusplus_dir; -static char *default_gplusplus_dir; +#define CIDX(compiler, flags) \ + ((int)(compiler) << 1) + ((flags) & CW_F_CXX ? 1 : 0) + +typedef enum cw_op { + CW_O_NONE = 0, + CW_O_PREPROCESS, + CW_O_COMPILE, + CW_O_LINK +} cw_op_t; + +struct aelist { + struct ae { + struct ae *ae_next; + char *ae_arg; + } *ael_head, *ael_tail; + int ael_argc; +}; + +typedef struct cw_ictx { + cw_compiler_t i_compiler; + struct aelist *i_ae; + uint32_t i_flags; + int i_oldargc; + char **i_oldargv; + pid_t i_pid; + int i_fd[2]; + char i_discard[MAXPATHLEN]; +} cw_ictx_t; + +static const char *progname; static const char *xarch_tbl[] = { #if defined(__x86) @@ -365,17 +417,26 @@ static const char *xregs_tbl[] = { NULL, NULL }; -struct aelist { - struct ae { - struct ae *ae_next; - char *ae_arg; - } *ael_head, *ael_tail; -}; +static void +nomem(void) +{ + (void) fprintf(stderr, "%s: error: out of memory\n", progname); + exit(1); +} -static struct aelist * -newael(void) +static void +cw_perror(const char *fmt, ...) { - return (calloc(sizeof (struct aelist), 1)); + va_list ap; + int saved_errno = errno; + + (void) fprintf(stderr, "%s: error: ", progname); + + va_start(ap, fmt); + (void) vfprintf(stderr, fmt, ap); + va_end(ap); + + (void) fprintf(stderr, " (%s)\n", strerror(saved_errno)); } static void @@ -383,21 +444,35 @@ newae(struct aelist *ael, const char *arg) { struct ae *ae; - ae = calloc(sizeof (*ae), 1); + if ((ae = calloc(sizeof (*ae), 1)) == NULL) + nomem(); ae->ae_arg = strdup(arg); if (ael->ael_tail == NULL) ael->ael_head = ae; else ael->ael_tail->ae_next = ae; ael->ael_tail = ae; - newargc++; + ael->ael_argc++; +} + +static cw_ictx_t * +newictx(void) +{ + cw_ictx_t *ctx = calloc(sizeof (cw_ictx_t), 1); + if (ctx) + if ((ctx->i_ae = calloc(sizeof (struct aelist), 1)) == NULL) { + free(ctx); + return (NULL); + } + + return (ctx); } static void error(const char *arg) { (void) fprintf(stderr, - "%s: mapping failed at or near arg '%s'\n", progname, arg); + "%s: error: mapping failed at or near arg '%s'\n", progname, arg); exit(2); } @@ -495,30 +570,20 @@ xlate(struct aelist *h, const char *xarg, const char **table) } static void -do_gcc(const char *dir, const char *cmd, int argc, char **argv, - struct aelist *h, int cplusplus) +do_gcc(cw_ictx_t *ctx) { int c; - int pic = 0; - int nolibc = 0; + int pic = 0, nolibc = 0; + int in_output = 0, seen_o = 0, c_files = 0; + cw_op_t op = CW_O_LINK; char *model = NULL; - char *program; - size_t len = strlen(dir) + strlen(cmd) + 2; - - program = malloc(len); - (void) snprintf(program, len, "%s/%s", dir, cmd); - - /* - * Basic defaults for ON compilation - */ - newae(h, program); - newae(h, "-fident"); - newae(h, "-finline"); - newae(h, "-fno-inline-functions"); - newae(h, "-fno-builtin"); - newae(h, "-fno-asm"); - newae(h, "-nodefaultlibs"); + newae(ctx->i_ae, "-fident"); + newae(ctx->i_ae, "-finline"); + newae(ctx->i_ae, "-fno-inline-functions"); + newae(ctx->i_ae, "-fno-builtin"); + newae(ctx->i_ae, "-fno-asm"); + newae(ctx->i_ae, "-nodefaultlibs"); #if defined(__sparc) /* @@ -528,7 +593,7 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, * pieces of buggy code that doesn't conform to the ABI. This * flag makes gcc work more like Studio with -xmemalign=4. */ - newae(h, "-mno-integer-ldd-std"); + newae(ctx->i_ae, "-mno-integer-ldd-std"); #endif /* @@ -539,66 +604,78 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, * * -Dunix is also missing in enhanced ANSI mode */ - newae(h, "-D__sun"); + newae(ctx->i_ae, "-D__sun"); /* * Walk the argument list, translating as we go .. */ - while (--argc > 0) { - char *arg = *++argv; + while (--ctx->i_oldargc > 0) { + char *arg = *++ctx->i_oldargv; size_t arglen = strlen(arg); - if (*arg == '-') + if (*arg == '-') { arglen--; - else { + } else { /* * Discard inline files that gcc doesn't grok */ - if (arglen > 3 && + if (!in_output && arglen > 3 && strcmp(arg + arglen - 3, ".il") == 0) continue; + if (!in_output && arglen > 2 && + arg[arglen - 2] == '.' && + (arg[arglen - 1] == 'S' || arg[arglen - 1] == 's' || + arg[arglen - 1] == 'c' || arg[arglen - 1] == 'i')) + c_files++; + /* - * Otherwise, filenames, and partial arguments - * are simply passed through for gcc to chew on. + * Otherwise, filenames and partial arguments + * are passed through for gcc to chew on. However, + * output is always discarded for the secondary + * compiler. */ - newae(h, arg); + if ((ctx->i_flags & CW_F_SHADOW) && in_output) + newae(ctx->i_ae, ctx->i_discard); + else + newae(ctx->i_ae, arg); + in_output = 0; continue; } - if (cplusplus) { + if (ctx->i_flags & CW_F_CXX) { if (strncmp(arg, "-compat=", 8) == 0) { /* discard -compat=4 and -compat=5 */ continue; } if (strcmp(arg, "-Qoption") == 0) { /* discard -Qoption and its two arguments */ - if (argc < 3) + if (ctx->i_oldargc < 3) error(arg); - argc -= 2; - argv += 2; + ctx->i_oldargc -= 2; + ctx->i_oldargv += 2; continue; } if (strcmp(arg, "-xwe") == 0) { /* turn warnings into errors */ - /* newae(h, "-Werror"); */ + newae(ctx->i_ae, "-Werror"); continue; } if (strcmp(arg, "-noex") == 0) { /* no exceptions */ - newae(h, "-fno-exceptions"); + newae(ctx->i_ae, "-fno-exceptions"); /* no run time type descriptor information */ - newae(h, "-fno-rtti"); + newae(ctx->i_ae, "-fno-rtti"); continue; } if (strcmp(arg, "-pic") == 0) { - newae(h, "-fpic"); + newae(ctx->i_ae, "-fpic"); pic = 1; continue; } if (strcmp(arg, "-PIC") == 0) { - newae(h, "-fPIC"); + newae(ctx->i_ae, "-fPIC"); pic = 1; continue; } @@ -613,8 +690,8 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, } #if defined(__sparc) if (strcmp(arg, "-cg92") == 0) { - xlate(h, "v8", xarch_tbl); - xlate(h, "super", xchip_tbl); + xlate(ctx->i_ae, "v8", xarch_tbl); + xlate(ctx->i_ae, "super", xchip_tbl); continue; } #endif /* __sparc */ @@ -623,33 +700,31 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, switch ((c = arg[1])) { case '_': if (strcmp(arg, "-_noecho") == 0) - echo = 0; + ctx->i_flags &= ~CW_F_ECHO; else if (strncmp(arg, "-_cc=", 5) == 0 || strncmp(arg, "-_CC=", 5) == 0) /* EMPTY */; else if (strncmp(arg, "-_gcc=", 6) == 0 || strncmp(arg, "-_g++=", 6) == 0) - newae(h, arg + 6); - else if (strcmp(arg, "-_compiler") == 0) { - (void) printf("%s\n", program); - exit(0); - } else + newae(ctx->i_ae, arg + 6); + else error(arg); break; case '#': if (arglen == 1) { - newae(h, "-v"); + newae(ctx->i_ae, "-v"); break; } error(arg); break; case 'g': - newae(h, "-gdwarf-2"); + newae(ctx->i_ae, "-gdwarf-2"); break; case 'E': if (arglen == 1) { - newae(h, "-xc"); - newae(h, arg); + newae(ctx->i_ae, "-xc"); + newae(ctx->i_ae, arg); + op = CW_O_PREPROCESS; nolibc = 1; break; } @@ -657,14 +732,16 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, break; case 'c': case 'S': - if (arglen == 1) + if (arglen == 1) { + op = CW_O_COMPILE; nolibc = 1; + } /* FALLTHROUGH */ case 'C': case 'H': case 'p': if (arglen == 1) { - newae(h, arg); + newae(ctx->i_ae, arg); break; } error(arg); @@ -675,30 +752,41 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, case 'i': case 'L': case 'l': - case 'o': case 'R': case 'U': case 'u': case 'w': - newae(h, arg); + newae(ctx->i_ae, arg); + break; + case 'o': + seen_o = 1; + if (arglen == 1) { + in_output = 1; + newae(ctx->i_ae, arg); + } else if (ctx->i_flags & CW_F_SHADOW) { + newae(ctx->i_ae, "-o"); + newae(ctx->i_ae, ctx->i_discard); + } else { + newae(ctx->i_ae, arg); + } break; case 'D': - newae(h, arg); + newae(ctx->i_ae, arg); /* * XXX Clearly a hack ... do we need _KADB too? */ if (strcmp(arg, "-D_KERNEL") == 0 || strcmp(arg, "-D_BOOT") == 0) - newae(h, "-ffreestanding"); + newae(ctx->i_ae, "-ffreestanding"); break; case 'd': if (arglen == 2) { if (strcmp(arg, "-dy") == 0) { - newae(h, "-Wl,-dy"); + newae(ctx->i_ae, "-Wl,-dy"); break; } if (strcmp(arg, "-dn") == 0) { - newae(h, "-Wl,-dn"); + newae(ctx->i_ae, "-Wl,-dn"); break; } } @@ -725,48 +813,49 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, if (strncmp(arg, "-erroff=", 8) == 0) break; if (strcmp(arg, "-errtags=yes") == 0) { - warnings(h); + warnings(ctx->i_ae); break; } if (strcmp(arg, "-errwarn=%all") == 0) { - newae(h, "-Werror"); + newae(ctx->i_ae, "-Werror"); break; } error(arg); break; case 'f': if (strcmp(arg, "-flags") == 0) { - newae(h, "--help"); + newae(ctx->i_ae, "--help"); break; } error(arg); break; case 'G': - newae(h, "-shared"); + newae(ctx->i_ae, "-shared"); nolibc = 1; break; case 'k': if (strcmp(arg, "-keeptmp") == 0) { - newae(h, "-save-temps"); + newae(ctx->i_ae, "-save-temps"); break; } error(arg); break; case 'K': if (arglen == 1) { - if ((arg = *++argv) == NULL || *arg == '\0') + if ((arg = *++ctx->i_oldargv) == NULL || + *arg == '\0') error("-K"); - argc--; + ctx->i_oldargc--; } else { arg += 2; } if (strcmp(arg, "pic") == 0) { - newae(h, "-fpic"); + newae(ctx->i_ae, "-fpic"); pic = 1; break; } if (strcmp(arg, "PIC") == 0) { - newae(h, "-fPIC"); + newae(ctx->i_ae, "-fPIC"); pic = 1; break; } @@ -774,7 +863,7 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, break; case 'm': if (strcmp(arg, "-mt") == 0) { - newae(h, "-D_REENTRANT"); + newae(ctx->i_ae, "-D_REENTRANT"); break; } error(arg); @@ -788,17 +877,18 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, char *s; if (arglen == 1) { - opt = *++argv; + opt = *++ctx->i_oldargv; if (opt == NULL || *opt == '\0') error(arg); - argc--; + ctx->i_oldargc--; } else { opt = arg + 2; } len = strlen(opt) + 7; - s = malloc(len); + if ((s = malloc(len)) == NULL) + nomem(); (void) snprintf(s, len, "-Wl,-%c%s", c, opt); - newae(h, s); + newae(ctx->i_ae, s); free(s); } break; @@ -813,7 +903,7 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, break; case 'O': if (arglen == 1) { - newae(h, "-O"); + newae(ctx->i_ae, "-O"); break; } error(arg); @@ -826,41 +916,42 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, * -o in the Makefile. If they don't they'll find out * in a hurry. */ - newae(h, "-E"); + newae(ctx->i_ae, "-E"); + op = CW_O_PREPROCESS; nolibc = 1; break; case 'q': if (strcmp(arg, "-qp") == 0) { - newae(h, "-p"); + newae(ctx->i_ae, "-p"); break; } error(arg); break; case 's': if (arglen == 1) { - newae(h, "-Wl,-s"); + newae(ctx->i_ae, "-Wl,-s"); break; } error(arg); break; case 't': if (arglen == 1) { - newae(h, "-Wl,-t"); + newae(ctx->i_ae, "-Wl,-t"); break; } error(arg); break; case 'V': if (arglen == 1) { - echo = 0; - newae(h, "--version"); + ctx->i_flags &= ~CW_F_ECHO; + newae(ctx->i_ae, "--version"); break; } error(arg); break; case 'v': if (arglen == 1) { - warnings(h); + warnings(ctx->i_ae); break; } error(arg); @@ -876,7 +967,7 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, if (strncmp(arg, "-Wa,", 4) == 0 || strncmp(arg, "-Wp,", 4) == 0 || strncmp(arg, "-Wl,", 4) == 0) { - newae(h, arg); + newae(ctx->i_ae, arg); break; } if (strcmp(arg, "-W0,-xc99=pragma") == 0) { @@ -906,8 +997,10 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, break; } if (strcmp(arg, "-W0,-xdbggen=no%usedonly") == 0) { - newae(h, "-fno-eliminate-unused-debug-symbols"); - newae(h, "-fno-eliminate-unused-debug-types"); + newae(ctx->i_ae, + "-fno-eliminate-unused-debug-symbols"); + newae(ctx->i_ae, + "-fno-eliminate-unused-debug-types"); break; } if (strcmp(arg, "-W2,-Rcond_elim") == 0) { @@ -926,7 +1019,7 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, break; } if (strncmp(arg, "-Wc,-xcode=", 11) == 0) { - xlate(h, arg + 11, xcode_tbl); + xlate(ctx->i_ae, arg + 11, xcode_tbl); if (strncmp(arg + 11, "pic", 3) == 0) pic = 1; break; @@ -940,19 +1033,19 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, } #if defined(__x86) if (strcmp(arg, "-Wu,-no_got_reloc") == 0) { - newae(h, "-fno-jump-tables"); - newae(h, "-fno-constant-pools"); + newae(ctx->i_ae, "-fno-jump-tables"); + newae(ctx->i_ae, "-fno-constant-pools"); break; } if (strcmp(arg, "-Wu,-xmodel=kernel") == 0) { - newae(h, "-ffreestanding"); - newae(h, "-mno-red-zone"); + newae(ctx->i_ae, "-ffreestanding"); + newae(ctx->i_ae, "-mno-red-zone"); model = "-mcmodel=kernel"; nolibc = 1; break; } if (strcmp(arg, "-Wu,-save_args") == 0) { - newae(h, "-msave-args"); + newae(ctx->i_ae, "-msave-args"); break; } #endif /* __x86 */ @@ -961,15 +1054,15 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, case 'X': if (strcmp(arg, "-Xa") == 0 || strcmp(arg, "-Xt") == 0) { - Xamode(h); + Xamode(ctx->i_ae); break; } if (strcmp(arg, "-Xc") == 0) { - Xcmode(h); + Xcmode(ctx->i_ae); break; } if (strcmp(arg, "-Xs") == 0) { - Xsmode(h); + Xsmode(ctx->i_ae); break; } error(arg); @@ -981,14 +1074,14 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, #if defined(__x86) case '3': if (strcmp(arg, "-x386") == 0) { - newae(h, "-march=i386"); + newae(ctx->i_ae, "-march=i386"); break; } error(arg); break; case '4': if (strcmp(arg, "-x486") == 0) { - newae(h, "-march=i486"); + newae(ctx->i_ae, "-march=i486"); break; } error(arg); @@ -996,7 +1089,7 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, #endif /* __x86 */ case 'a': if (strncmp(arg, "-xarch=", 7) == 0) { - xlate(h, arg + 7, xarch_tbl); + xlate(ctx->i_ae, arg + 7, xarch_tbl); break; } error(arg); @@ -1004,7 +1097,7 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, case 'b': if (strncmp(arg, "-xbuiltin=", 10) == 0) { if (strcmp(arg + 10, "%all")) - newae(h, "-fbuiltin"); + newae(ctx->i_ae, "-fbuiltin"); break; } error(arg); @@ -1017,19 +1110,19 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, break; case 'c': if (strncmp(arg, "-xc99=%all", 10) == 0) { - newae(h, "-std=gnu99"); + newae(ctx->i_ae, "-std=gnu99"); break; } if (strncmp(arg, "-xc99=%none", 11) == 0) { - newae(h, "-std=gnu89"); + newae(ctx->i_ae, "-std=gnu89"); break; } if (strncmp(arg, "-xchip=", 7) == 0) { - xlate(h, arg + 7, xchip_tbl); + xlate(ctx->i_ae, arg + 7, xchip_tbl); break; } if (strncmp(arg, "-xcode=", 7) == 0) { - xlate(h, arg + 7, xcode_tbl); + xlate(ctx->i_ae, arg + 7, xcode_tbl); if (strncmp(arg + 7, "pic", 3) == 0) pic = 1; break; @@ -1065,11 +1158,11 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, break; case 'M': if (strcmp(arg, "-xM") == 0) { - newae(h, "-M"); + newae(ctx->i_ae, "-M"); break; } if (strcmp(arg, "-xM1") == 0) { - newae(h, "-MM"); + newae(ctx->i_ae, "-MM"); break; } error(arg); @@ -1084,13 +1177,16 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, case 'O': if (strncmp(arg, "-xO", 3) == 0) { size_t len = strlen(arg); - char *s = malloc(len); + char *s; int c = *(arg + 3); int level; if (len != 4 || !isdigit(c)) error(arg); + if ((s = malloc(len)) == NULL) + nomem(); + level = atoi(arg + 3); if (level > 5) error(arg); @@ -1100,14 +1196,14 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, * need to disable optimizations * that break ON. */ - optim_disable(h, level); + optim_disable(ctx->i_ae, level); /* * limit -xO3 to -O2 as well. */ level = 2; } (void) snprintf(s, len, "-O%d", level); - newae(h, s); + newae(ctx->i_ae, s); free(s); break; } @@ -1115,18 +1211,18 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, break; case 'p': if (strcmp(arg, "-xpentium") == 0) { - newae(h, "-march=pentium"); + newae(ctx->i_ae, "-march=pentium"); break; } if (strcmp(arg, "-xpg") == 0) { - newae(h, "-pg"); + newae(ctx->i_ae, "-pg"); break; } error(arg); break; case 'r': if (strncmp(arg, "-xregs=", 7) == 0) { - xlate(h, arg + 7, xregs_tbl); + xlate(ctx->i_ae, arg + 7, xregs_tbl); break; } error(arg); @@ -1140,19 +1236,19 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, break; case 't': if (strcmp(arg, "-xtransition") == 0) { - newae(h, "-Wtransition"); + newae(ctx->i_ae, "-Wtransition"); break; } if (strcmp(arg, "-xtrigraphs=yes") == 0) { - newae(h, "-trigraphs"); + newae(ctx->i_ae, "-trigraphs"); break; } if (strcmp(arg, "-xtrigraphs=no") == 0) { - newae(h, "-notrigraphs"); + newae(ctx->i_ae, "-notrigraphs"); break; } if (strncmp(arg, "-xtarget=", 9) == 0) { - xlate(h, arg + 9, xtarget_tbl); + xlate(ctx->i_ae, arg + 9, xtarget_tbl); break; } error(arg); @@ -1167,9 +1263,10 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, break; case 'Y': if (arglen == 1) { - if ((arg = *++argv) == NULL || *arg == '\0') + if ((arg = *++ctx->i_oldargv) == NULL || + *arg == '\0') error("-Y"); - argc--; + ctx->i_oldargc--; arglen = strlen(arg + 1); } else { arg += 2; @@ -1181,7 +1278,7 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, char *s = strdup(arg); s[0] = '-'; s[1] = 'B'; - newae(h, s); + newae(ctx->i_ae, s); free(s); break; } @@ -1189,8 +1286,8 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, char *s = strdup(arg); s[0] = '-'; s[1] = 'I'; - newae(h, "-nostdinc"); - newae(h, s); + newae(ctx->i_ae, "-nostdinc"); + newae(ctx->i_ae, s); free(s); break; } @@ -1206,74 +1303,283 @@ do_gcc(const char *dir, const char *cmd, int argc, char **argv, } } + if (c_files > 1 && (ctx->i_flags & CW_F_SHADOW) && + op != CW_O_PREPROCESS) { + (void) fprintf(stderr, "%s: error: multiple source files are " + "allowed only with -E or -P\n", progname); + exit(2); + } + if (op == CW_O_LINK && (ctx->i_flags & CW_F_SHADOW)) + exit(0); + if (model && !pic) - newae(h, model); + newae(ctx->i_ae, model); if (!nolibc) - newae(h, "-lc"); + newae(ctx->i_ae, "-lc"); + if (!seen_o && (ctx->i_flags & CW_F_SHADOW)) { + newae(ctx->i_ae, "-o"); + newae(ctx->i_ae, ctx->i_discard); + } +} + +static void +do_cc(cw_ictx_t *ctx) +{ + int in_output = 0, seen_o = 0; + cw_op_t op = CW_O_LINK; + + while (--ctx->i_oldargc > 0) { + char *arg = *++ctx->i_oldargv; + + if (*arg != '-') { + if (in_output == 0 || !(ctx->i_flags & CW_F_SHADOW)) { + newae(ctx->i_ae, arg); + } else { + in_output = 0; + newae(ctx->i_ae, ctx->i_discard); + } + continue; + } + switch (*(arg + 1)) { + case '_': + if (strcmp(arg, "-_noecho") == 0) { + ctx->i_flags &= ~CW_F_ECHO; + } else if (strncmp(arg, "-_cc=", 5) == 0 || + strncmp(arg, "-_CC=", 5) == 0) { + newae(ctx->i_ae, arg + 5); + } else if (strncmp(arg, "-_gcc=", 6) != 0 && + strncmp(arg, "-_g++=", 6) != 0) { + (void) fprintf(stderr, + "%s: invalid argument '%s'\n", progname, + arg); + exit(2); + } + break; + case 'V': + ctx->i_flags &= ~CW_F_ECHO; + newae(ctx->i_ae, arg); + break; + case 'o': + seen_o = 1; + if (strlen(arg) == 2) { + in_output = 1; + newae(ctx->i_ae, arg); + } else if (ctx->i_flags & CW_F_SHADOW) { + newae(ctx->i_ae, "-o"); + newae(ctx->i_ae, ctx->i_discard); + } else { + newae(ctx->i_ae, arg); + } + break; + case 'c': + case 'S': + op = CW_O_COMPILE; + newae(ctx->i_ae, arg); + break; + case 'E': + case 'P': + op = CW_O_PREPROCESS; + /*FALLTHROUGH*/ + default: + newae(ctx->i_ae, arg); + } + } + + if ((op == CW_O_LINK || op == CW_O_PREPROCESS) && + (ctx->i_flags & CW_F_SHADOW)) + exit(0); + + if (!seen_o && (ctx->i_flags & CW_F_SHADOW)) { + newae(ctx->i_ae, "-o"); + newae(ctx->i_ae, ctx->i_discard); + } } -/* ARGSUSED4 */ static void -do_cc(const char *dir, const char *cmd, int argc, char **argv, - struct aelist *h, int cplusplus) +prepctx(cw_ictx_t *ctx) { + const char *dir, *cmd; char *program; - size_t len = strlen(dir) + strlen(cmd) + 2; + size_t len; - program = malloc(len); + dir = dirs[CIDX(CC(ctx), ctx->i_flags)]; + cmd = cmds[CIDX(CC(ctx), ctx->i_flags)]; + len = strlen(dir) + strlen(cmd) + 2; + if ((program = malloc(len)) == NULL) + nomem(); (void) snprintf(program, len, "%s/%s", dir, cmd); + newae(ctx->i_ae, program); + + if (!(ctx->i_flags & CW_F_XLATE)) + return; + + switch (CC(ctx)) { + case CW_C_CC: + do_cc(ctx); + break; + case CW_C_GCC: + do_gcc(ctx); + break; + } +} + +static int +invoke(cw_ictx_t *ctx) +{ + char **newargv; + int ac; + struct ae *a; + + if ((newargv = calloc(sizeof (*newargv), ctx->i_ae->ael_argc + 1)) == + NULL) + nomem(); + + if (ctx->i_flags & CW_F_ECHO) + (void) fprintf(stderr, "+ "); + + for (ac = 0, a = ctx->i_ae->ael_head; a; a = a->ae_next, ac++) { + newargv[ac] = a->ae_arg; + if (ctx->i_flags & CW_F_ECHO) + (void) fprintf(stderr, "%s ", a->ae_arg); + if (a == ctx->i_ae->ael_tail) + break; + } + + if (ctx->i_flags & CW_F_ECHO) { + (void) fprintf(stderr, "\n"); + (void) fflush(stderr); + } + + if (!(ctx->i_flags & CW_F_EXEC)) + return (0); + /* - * This is pretty simple. - * We just have to recognize -V, -_noecho, -_compiler, -_cc= and -_gcc= + * We must fix up the environment here so that the + * dependency files are not trampled by the shadow compiler. */ - newae(h, program); + if ((ctx->i_flags & CW_F_SHADOW) && + (unsetenv("SUNPRO_DEPENDENCIES") != 0 || + unsetenv("DEPENDENCIES_OUTPUT") != 0)) { + (void) fprintf(stderr, "error: environment setup failed: %s\n", + strerror(errno)); + return (-1); + } - while (--argc > 0) { - char *arg = *++argv; + (void) execv(newargv[0], newargv); + cw_perror("couldn't run %s", newargv[0]); - if (*arg != '-') { - newae(h, arg); - } else if (*(arg + 1) != '_') { - if (strcmp(arg, "-V") == 0) - echo = 0; - newae(h, arg); - } else if (strcmp(arg, "-_noecho") == 0) { - echo = 0; - } else if (strcmp(arg, "-_compiler") == 0) { - (void) printf("%s\n", program); - exit(0); - } else if (strncmp(arg, "-_cc=", 5) == 0 || - strncmp(arg, "-_CC=", 5) == 0) { - newae(h, arg + 5); - } else if (strncmp(arg, "-_gcc=", 6) != 0 && - strncmp(arg, "-_g++=", 6) != 0) { - (void) fprintf(stderr, - "%s: invalid argument '%s'\n", progname, arg); - exit(2); + return (-1); +} + +static int +reap(cw_ictx_t *ctx) +{ + int stat, ret = 0; + char buf[1024]; + struct stat s; + + do { + (void) waitpid(ctx->i_pid, &stat, 0); + if (stat != 0) { + if (WIFSIGNALED(stat)) { + ret = -WTERMSIG(stat); + break; + } else if (WIFEXITED(stat)) { + ret = WEXITSTATUS(stat); + break; + } } + } while (!WIFEXITED(stat) && !WIFSIGNALED(stat)); + + (void) unlink(ctx->i_discard); + + if (fstat(ctx->i_fd[0], &s) < 0) { + cw_perror("stat failed on child cleanup"); + return (-1); } + if (s.st_size != 0) { + FILE *f = fdopen(ctx->i_fd[0], "r"); + + while (fgets(buf, sizeof (buf), f)) + (void) fprintf(stderr, "%s", buf); + (void) fflush(stderr); + (void) fclose(f); + } + (void) close(ctx->i_fd[0]); + + return (ret); +} + +static int +exec_ctx(cw_ictx_t *ctx, int block) +{ + char *file; + + /* + * To avoid offending cc's sensibilities, the name of its output + * file must end in '.o'. + */ + if ((file = tempnam(NULL, ".cw")) == NULL) { + nomem(); + return (-1); + } + (void) strlcpy(ctx->i_discard, file, MAXPATHLEN); + (void) strlcat(ctx->i_discard, ".o", MAXPATHLEN); + free(file); + + if (pipe(ctx->i_fd) < 0) { + cw_perror("pipe creation failed"); + return (-1); + } + + if ((ctx->i_pid = fork()) == 0) { + (void) close(ctx->i_fd[0]); + (void) fclose(stderr); + if (dup2(ctx->i_fd[1], 2) < 0) { + cw_perror("dup2 failed for standard error"); + exit(1); + } + (void) close(ctx->i_fd[1]); + if (freopen("/dev/fd/2", "w", stderr) == NULL) { + cw_perror("freopen failed for /dev/fd/2"); + exit(1); + } + prepctx(ctx); + exit(invoke(ctx)); + } + + if (ctx->i_pid < 0) { + cw_perror("fork failed"); + return (1); + } + (void) close(ctx->i_fd[1]); + + if (block) + return (reap(ctx)); + + return (0); } int main(int argc, char **argv) { - struct aelist *h = newael(); + cw_ictx_t *ctx = newictx(); + cw_ictx_t *ctx_shadow = newictx(); const char *dir; - int ac; - char **newargv; - struct ae *a; char cc_buf[MAXPATHLEN], gcc_buf[MAXPATHLEN]; + int do_serial, do_shadow; + int ret = 0; if ((progname = strrchr(argv[0], '/')) == NULL) progname = argv[0]; else progname++; - default_cc_dir = DEFAULT_CC_DIR; - default_gcc_dir = DEFAULT_GCC_DIR; - default_cplusplus_dir = DEFAULT_CPLUSPLUS_DIR; - default_gplusplus_dir = DEFAULT_GPLUSPLUS_DIR; + if (ctx == NULL || ctx_shadow == NULL) + nomem(); + + ctx->i_flags = CW_F_ECHO|CW_F_XLATE; /* * Figure out where to get our tools from. This depends on @@ -1287,16 +1593,31 @@ main(int argc, char **argv) (void) snprintf(cc_buf, MAXPATHLEN, "%s/SUNWspro/SOS10/bin", dir); } - if (dir != NULL) - default_cc_dir = (char *)cc_buf; + if (dir != NULL) { + dirs[CIDX(CW_C_CC, 0)] = (const char *)cc_buf; + dirs[CIDX(CW_C_CC, CW_F_CXX)] = (const char *)cc_buf; + } if ((dir = getenv("GNU_ROOT")) != NULL) { (void) snprintf(gcc_buf, MAXPATHLEN, "%s/bin", dir); - default_gcc_dir = (char *)gcc_buf; + dirs[CIDX(CW_C_GCC, 0)] = (const char *)gcc_buf; + dirs[CIDX(CW_C_GCC, CW_F_CXX)] = (const char *)gcc_buf; } - default_cplusplus_dir = default_cc_dir; - default_gplusplus_dir = default_gcc_dir; + if ((dir = getenv("CW_CC_DIR")) != NULL) + dirs[CIDX(CW_C_CC, 0)] = dir; + if ((dir = getenv("CW_CPLUSPLUS_DIR")) != NULL) + dirs[CIDX(CW_C_CC, CW_F_CXX)] = dir; + if ((dir = getenv("CW_GCC_DIR")) != NULL) + dirs[CIDX(CW_C_GCC, 0)] = dir; + if ((dir = getenv("CW_GPLUSPLUS_DIR")) != NULL) + dirs[CIDX(CW_C_GCC, CW_F_CXX)] = dir; + + do_shadow = (getenv("CW_NO_SHADOW") ? 0 : 1); + do_serial = (getenv("CW_SHADOW_SERIAL") ? 1 : 0); + + if (getenv("CW_NO_EXEC") == NULL) + ctx->i_flags |= CW_F_EXEC; /* * The first argument must be one of "-_cc", "-_gcc", "-_CC", or "-_g++" @@ -1306,58 +1627,42 @@ main(int argc, char **argv) argc--; argv++; if (strcmp(argv[0], "-_cc") == 0) { - if ((dir = getenv("CW_CC_DIR")) == NULL) - dir = default_cc_dir; - do_cc(dir, "cc", argc, argv, h, 0); + ctx->i_compiler = CW_C_CC; } else if (strcmp(argv[0], "-_gcc") == 0) { - if ((dir = getenv("CW_GCC_DIR")) == NULL) - dir = default_gcc_dir; - do_gcc(dir, "gcc", argc, argv, h, 0); + ctx->i_compiler = CW_C_GCC; } else if (strcmp(argv[0], "-_CC") == 0) { - if ((dir = getenv("CW_CPLUSPLUS_DIR")) == NULL) - dir = default_cplusplus_dir; - do_cc(dir, "CC", argc, argv, h, 1); + ctx->i_compiler = CW_C_CC; + ctx->i_flags |= CW_F_CXX; } else if (strcmp(argv[0], "-_g++") == 0) { - if ((dir = getenv("CW_GPLUSPLUS_DIR")) == NULL) - dir = default_gplusplus_dir; - do_gcc(dir, "g++", argc, argv, h, 1); + ctx->i_compiler = CW_C_GCC; + ctx->i_flags |= CW_F_CXX; } else { /* assume "-_gcc" by default */ argc++; argv--; - if ((dir = getenv("CW_GCC_DIR")) == NULL) - dir = default_gcc_dir; - do_gcc(dir, "gcc", argc, argv, h, 0); + ctx->i_compiler = CW_C_GCC; } - newargv = calloc(sizeof (*newargv), newargc + 1); - - if (echo) - (void) printf("+ "); + ctx->i_oldargc = argc; + ctx->i_oldargv = argv; - for (ac = 0, a = h->ael_head; a; a = a->ae_next, ac++) { - newargv[ac] = a->ae_arg; - if (echo) - (void) printf("%s ", a->ae_arg); - if (a == h->ael_tail) - break; + if (argc > 1 && strcmp(argv[1], "-_compiler") == 0) { + ctx->i_flags &= ~CW_F_XLATE; + prepctx(ctx); + (void) printf("%s\n", ctx->i_ae->ael_head->ae_arg); + return (0); } - if (echo) { - (void) printf("\n"); - (void) fflush(stdout); + ret |= exec_ctx(ctx, do_serial); + + if (do_shadow) { + (void) memcpy(ctx_shadow, ctx, sizeof (cw_ictx_t)); + ctx_shadow->i_flags |= CW_F_SHADOW; + ret |= exec_ctx(ctx_shadow, 1); } - /* - * Here goes .. - */ - (void) execvp(newargv[0], newargv); + if (!do_serial) + ret |= reap(ctx); - /* - * execvp() returns only on error. - */ - perror("execvp"); - (void) fprintf(stderr, "%s: couldn't run %s\n", - progname, newargv[0]); - return (4); + return (ret); } diff --git a/usr/src/ucbcmd/stty/Makefile b/usr/src/ucbcmd/stty/Makefile index 9cb7427e2c..54925f1087 100644 --- a/usr/src/ucbcmd/stty/Makefile +++ b/usr/src/ucbcmd/stty/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -18,16 +17,18 @@ # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END + # +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1989 by Sun Microsystems, Inc. +# ident "%Z%%M% %I% %E% SMI" # PROG= stty PROGSRC= stty.c sttyparse.c sttytable.c +OBJS= $(PROGSRC:%.c=%.o) include ../Makefile.ucbcmd @@ -37,13 +38,14 @@ FILEMODE= 755 all: $(PROG) -$(PROG): $(PROGSRC) - $(LINK.c) $(PROGSRC) -o $@ $(LDLIBS) +$(PROG): $(OBJS) + $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(POST_PROCESS) install: all $(ROOTPROG) clean: + -$(RM) $(OBJS) lint: lint_PROG diff --git a/usr/src/uts/Makefile.uts b/usr/src/uts/Makefile.uts index 6ecce7e4f7..bad396afa3 100644 --- a/usr/src/uts/Makefile.uts +++ b/usr/src/uts/Makefile.uts @@ -20,7 +20,7 @@ # # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -227,21 +227,6 @@ AS_CPPFLAGS = $(ALWAYS_DEFS) $(ALL_DEFS) $(CONFIG_DEFS) $(AS_DEFS) \ # all kernel implementations. # -# -# XX64 Compiling with -xc99=%all on build 55 merge makes the -# kmem_alloc double map parts of the kernel data causing -# horrible overwriting and forces a hardware reset in -# segkp_create(). Until the origin of this problem can -# be tracked down (i.e. is it a deliberate C89 -> C99 semantic -# change for which the kernel needs repair, or is it just a -# bug in the x86 compiler?) disabling C99 for kernel compilation -# when using the Devpro compiler -# -i386_C99MODE = $(C99_DISABLE) -$(__GNUC)i386_C99MODE = $(C99_ENABLE) -sparc_C99MODE = $(C99_DISABLE) -C99MODE = $($(MACH)_C99MODE) - # Override the default, the kernel is squeaky clean CERRWARN = -errtags=yes -errwarn=%all @@ -252,7 +237,7 @@ CFLAGS_uts += $(ILDOFF) CFLAGS_uts += $(XAOPT) CFLAGS_uts += $(CTF_FLAGS) CFLAGS_uts += $(CERRWARN) -CFLAGS_uts += $(C99MODE) +CFLAGS_uts += $(C99_ENABLE) CFLAGS_uts += $(EXTRA_CFLAGS) # diff --git a/usr/src/uts/common/io/dld/dld_str.c b/usr/src/uts/common/io/dld/dld_str.c index 83bf92ac98..5421b7f7ce 100644 --- a/usr/src/uts/common/io/dld/dld_str.c +++ b/usr/src/uts/common/io/dld/dld_str.c @@ -176,7 +176,7 @@ dld_getinfo(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg, void **resp) break; case DDI_INFO_DEVT2INSTANCE: if (minor > 0 && minor <= DLD_MAX_PPA + 1) { - *resp = (void *)(minor - 1); + *resp = (void *)(uintptr_t)(minor - 1); rc = DDI_SUCCESS; } break; diff --git a/usr/src/uts/common/io/gld.c b/usr/src/uts/common/io/gld.c index 3cc4dbddc8..952ecc9922 100644 --- a/usr/src/uts/common/io/gld.c +++ b/usr/src/uts/common/io/gld.c @@ -1303,12 +1303,14 @@ gld_getinfo(dev_info_t *dip, ddi_info_cmd_t cmd, void *arg, void **resultp) rc = DDI_FAILURE; } else if (minor <= GLD_MAX_STYLE1_MINOR) { /* Style 1: calculate the PPA from the minor */ - *resultp = (void *)GLD_STYLE1_MINOR_TO_PPA(minor); + *resultp = (void *)(uintptr_t) + GLD_STYLE1_MINOR_TO_PPA(minor); rc = DDI_SUCCESS; } else { /* Clone: look for it. Not a static mapping */ if ((devinfo = gld_finddevinfo((dev_t)arg)) != NULL) { - *resultp = (void *)ddi_get_instance(devinfo); + *resultp = (void *)(uintptr_t) + ddi_get_instance(devinfo); rc = DDI_SUCCESS; } } diff --git a/usr/src/uts/common/io/mem.c b/usr/src/uts/common/io/mem.c index 74ebcb0479..1b0c925ff4 100644 --- a/usr/src/uts/common/io/mem.c +++ b/usr/src/uts/common/io/mem.c @@ -434,8 +434,8 @@ mmioctl_vtop(intptr_t data) else { if (copyin((void *)data, &vtop32, sizeof (mem_vtop32_t))) return (EFAULT); - mem_vtop.m_as = (struct as *)vtop32.m_as; - mem_vtop.m_va = (void *)vtop32.m_va; + mem_vtop.m_as = (struct as *)(uintptr_t)vtop32.m_as; + mem_vtop.m_va = (void *)(uintptr_t)vtop32.m_va; if (mem_vtop.m_as != NULL) return (EINVAL); diff --git a/usr/src/uts/common/io/sata/adapters/si3124/si3124.c b/usr/src/uts/common/io/sata/adapters/si3124/si3124.c index dc37280ec0..4a97140e0f 100644 --- a/usr/src/uts/common/io/sata/adapters/si3124/si3124.c +++ b/usr/src/uts/common/io/sata/adapters/si3124/si3124.c @@ -618,7 +618,7 @@ si_attach(dev_info_t *dip, ddi_attach_cmd_t cmd) /* Initialize the mutex. */ mutex_init(&si_ctlp->sictl_mutex, NULL, MUTEX_DRIVER, - (void *)(uint64_t)si_ctlp->sictl_intr_pri); + (void *)(uintptr_t)si_ctlp->sictl_intr_pri); attach_state |= ATTACH_PROGRESS_MUTEX_INIT; @@ -1860,9 +1860,9 @@ si_alloc_port_state(si_ctl_state_t *si_ctlp, int port) si_portp = si_ctlp->sictl_ports[port]; mutex_init(&si_portp->siport_mutex, NULL, MUTEX_DRIVER, - (void *)(uint64_t)si_ctlp->sictl_intr_pri); + (void *)(uintptr_t)si_ctlp->sictl_intr_pri); mutex_init(&si_portp->siport_mop_mutex, NULL, MUTEX_DRIVER, - (void *)(uint64_t)si_ctlp->sictl_intr_pri); + (void *)(uintptr_t)si_ctlp->sictl_intr_pri); mutex_enter(&si_portp->siport_mutex); /* allocate prb & sgt pkts for this port. */ diff --git a/usr/src/uts/common/os/ddi_intr.c b/usr/src/uts/common/os/ddi_intr.c index 3071fe27e9..e8556b2d33 100644 --- a/usr/src/uts/common/os/ddi_intr.c +++ b/usr/src/uts/common/os/ddi_intr.c @@ -277,7 +277,7 @@ ddi_intr_alloc(dev_info_t *dip, ddi_intr_handle_t *h_array, int type, int inum, tmp_hdl.ih_type = type; tmp_hdl.ih_inum = inum; tmp_hdl.ih_scratch1 = count; - tmp_hdl.ih_scratch2 = (void *)behavior; + tmp_hdl.ih_scratch2 = (void *)(uintptr_t)behavior; tmp_hdl.ih_dip = dip; if (i_ddi_intr_ops(dip, dip, DDI_INTROP_ALLOC, diff --git a/usr/src/uts/common/sys/smbios.h b/usr/src/uts/common/sys/smbios.h index a5faad034b..e615db09bd 100644 --- a/usr/src/uts/common/sys/smbios.h +++ b/usr/src/uts/common/sys/smbios.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -78,7 +77,7 @@ typedef struct smbios_entry { #define SMB_ENTRY_EANCHORLEN 4 /* length of entry point anchor */ #define SMB_ENTRY_IANCHOR "_DMI_" /* intermediate anchor string */ #define SMB_ENTRY_IANCHORLEN 5 /* length of intermediate anchor */ -#define SMB_ENTRY_MAXLEN 256 /* maximum length of entry point */ +#define SMB_ENTRY_MAXLEN 255 /* maximum length of entry point */ /* * Structure type codes. The comments next to each type include an (R) note to diff --git a/usr/src/uts/i86pc/io/pci/pci_common.c b/usr/src/uts/i86pc/io/pci/pci_common.c index 30c68fb896..a9d2ba69a7 100644 --- a/usr/src/uts/i86pc/io/pci/pci_common.c +++ b/usr/src/uts/i86pc/io/pci/pci_common.c @@ -281,7 +281,7 @@ pci_common_intr_ops(dev_info_t *pdip, dev_info_t *rdip, ddi_intr_op_t intr_op, pciepci = 1; } else hdlp->ih_pri = priority; - behavior = (int)hdlp->ih_scratch2; + behavior = (int)(uintptr_t)hdlp->ih_scratch2; (void) (*psm_intr_ops)(rdip, hdlp, PSM_INTR_OP_ALLOC_VECTORS, result); diff --git a/usr/src/uts/intel/sys/mca_amd.h b/usr/src/uts/intel/sys/mca_amd.h index 21524f8713..1b5b6b599f 100644 --- a/usr/src/uts/intel/sys/mca_amd.h +++ b/usr/src/uts/intel/sys/mca_amd.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -249,19 +248,20 @@ extern "C" { #define AMD_NB_CFG_GENCRCERRBYTE1 0x00020000 /* Generic bank status register bits */ -#define AMD_BANK_STAT_VALID 0x8000000000000000 -#define AMD_BANK_STAT_OVER 0x4000000000000000 -#define AMD_BANK_STAT_UC 0x2000000000000000 -#define AMD_BANK_STAT_EN 0x1000000000000000 -#define AMD_BANK_STAT_MISCV 0x0800000000000000 -#define AMD_BANK_STAT_ADDRV 0x0400000000000000 -#define AMD_BANK_STAT_PCC 0x0200000000000000 - -#define AMD_BANK_STAT_CECC 0x0000400000000000 -#define AMD_BANK_STAT_UECC 0x0000200000000000 -#define AMD_BANK_STAT_SCRUB 0x0000010000000000 - -#define AMD_BANK_STAT_SYND_MASK 0x007f800000000000 /* syndrome[7:0] */ +#define AMD_BANK_STAT_VALID 0x8000000000000000ULL +#define AMD_BANK_STAT_OVER 0x4000000000000000ULL +#define AMD_BANK_STAT_UC 0x2000000000000000ULL +#define AMD_BANK_STAT_EN 0x1000000000000000ULL +#define AMD_BANK_STAT_MISCV 0x0800000000000000ULL +#define AMD_BANK_STAT_ADDRV 0x0400000000000000ULL +#define AMD_BANK_STAT_PCC 0x0200000000000000ULL + +#define AMD_BANK_STAT_CECC 0x0000400000000000ULL +#define AMD_BANK_STAT_UECC 0x0000200000000000ULL +#define AMD_BANK_STAT_SCRUB 0x0000010000000000ULL + + /* syndrome[7:0] */ +#define AMD_BANK_STAT_SYND_MASK 0x007f800000000000ULL #define AMD_BANK_STAT_SYND_SHIFT 47 #define AMD_BANK_SYND(stat) \ diff --git a/usr/src/uts/sun4/io/px/px_intr.c b/usr/src/uts/sun4/io/px/px_intr.c index 1c31a75038..47a8d66772 100644 --- a/usr/src/uts/sun4/io/px/px_intr.c +++ b/usr/src/uts/sun4/io/px/px_intr.c @@ -632,8 +632,8 @@ px_msix_ops(dev_info_t *dip, dev_info_t *rdip, ddi_intr_op_t intr_op, * based on Resource Management policies. */ if ((ret = px_msi_alloc(px_p, rdip, hdlp->ih_inum, - hdlp->ih_scratch1, (int)hdlp->ih_scratch2, &msi_num, - (int *)result)) != DDI_SUCCESS) { + hdlp->ih_scratch1, (int)(uintptr_t)hdlp->ih_scratch2, + &msi_num, (int *)result)) != DDI_SUCCESS) { DBG(DBG_INTROPS, dip, "px_msix_ops: MSI allocation " "failed, rdip 0x%p inum 0x%x count 0x%x\n", rdip, hdlp->ih_inum, hdlp->ih_scratch1); diff --git a/usr/src/uts/sun4v/cpu/niagara.c b/usr/src/uts/sun4v/cpu/niagara.c index b1cb92d50c..d2413f773e 100644 --- a/usr/src/uts/sun4v/cpu/niagara.c +++ b/usr/src/uts/sun4v/cpu/niagara.c @@ -96,7 +96,7 @@ cpu_setup(void) status = hsvc_register(&niagara_hsvc, &niagara_sup_minor); if (status != 0) { cmn_err(CE_WARN, "%s: cannot negotiate hypervisor services " - "group: 0x%x major: 0x%x minor: 0x%x errno: %d\n", + "group: 0x%lx major: 0x%lx minor: 0x%lx errno: %d\n", niagara_hsvc.hsvc_modname, niagara_hsvc.hsvc_group, niagara_hsvc.hsvc_major, niagara_hsvc.hsvc_minor, status); niagara_hsvc_available = B_FALSE; diff --git a/usr/src/uts/sun4v/os/hsvc.c b/usr/src/uts/sun4v/os/hsvc.c index 4736ed42c8..16bd642617 100644 --- a/usr/src/uts/sun4v/os/hsvc.c +++ b/usr/src/uts/sun4v/os/hsvc.c @@ -185,7 +185,7 @@ hsvc_dump(void) hsvc_groups, hsvc_avail); for (hsvcp = hsvc_groups; hsvcp != NULL; hsvcp = hsvcp->next) { - prom_printf(" hsvcp: %p (0x%lx 0x%lx 0x%lx) ref: %d clients: " + prom_printf(" hsvcp: %p (0x%lx 0x%lx 0x%lx) ref: %ld clients: " "%p\n", hsvcp, hsvcp->group, hsvcp->major, hsvcp->minor, hsvcp->refcnt, hsvcp->clients); diff --git a/usr/src/uts/sun4v/sys/niagararegs.h b/usr/src/uts/sun4v/sys/niagararegs.h index 501564a627..3b629024aa 100644 --- a/usr/src/uts/sun4v/sys/niagararegs.h +++ b/usr/src/uts/sun4v/sys/niagararegs.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -153,33 +153,33 @@ extern uint64_t hv_niagara_mmustat_info(uint64_t *buf); * +---+---+---+---+---+---+---+---+---+---+---+-------+------+ * 45 44 43 42 41 40 39 38 37 36 35 34-32 31-0 */ -#define NI_L2AFSR_MEU 0x8000000000000000 -#define NI_L2AFSR_MEC 0x4000000000000000 -#define NI_L2AFSR_RW 0x2000000000000000 -#define NI_L2AFSR_RSVD0 0x1000000000000000 -#define NI_L2AFSR_MODA 0x0800000000000000 -#define NI_L2AFSR_VCID 0x07C0000000000000 -#define NI_L2AFSR_LDAC 0x0020000000000000 -#define NI_L2AFSR_LDAU 0x0010000000000000 -#define NI_L2AFSR_LDWC 0x0008000000000000 -#define NI_L2AFSR_LDWU 0x0004000000000000 -#define NI_L2AFSR_LDRC 0x0002000000000000 -#define NI_L2AFSR_LDRU 0x0001000000000000 -#define NI_L2AFSR_LDSC 0x0000800000000000 -#define NI_L2AFSR_LDSU 0x0000400000000000 -#define NI_L2AFSR_LTC 0x0000200000000000 -#define NI_L2AFSR_LRU 0x0000100000000000 -#define NI_L2AFSR_LVU 0x0000080000000000 -#define NI_L2AFSR_DAC 0x0000040000000000 -#define NI_L2AFSR_DAU 0x0000020000000000 -#define NI_L2AFSR_DRC 0x0000010000000000 -#define NI_L2AFSR_DRU 0x0000008000000000 -#define NI_L2AFSR_DSC 0x0000004000000000 -#define NI_L2AFSR_DSU 0x0000002000000000 -#define NI_L2AFSR_VEC 0x0000001000000000 -#define NI_L2AFSR_VEU 0x0000000800000000 -#define NI_L2AFSR_RSVD1 0x0000000700000000 -#define NI_L2AFSR_SYND 0x00000000FFFFFFFF +#define NI_L2AFSR_MEU 0x8000000000000000ULL +#define NI_L2AFSR_MEC 0x4000000000000000ULL +#define NI_L2AFSR_RW 0x2000000000000000ULL +#define NI_L2AFSR_RSVD0 0x1000000000000000ULL +#define NI_L2AFSR_MODA 0x0800000000000000ULL +#define NI_L2AFSR_VCID 0x07C0000000000000ULL +#define NI_L2AFSR_LDAC 0x0020000000000000ULL +#define NI_L2AFSR_LDAU 0x0010000000000000ULL +#define NI_L2AFSR_LDWC 0x0008000000000000ULL +#define NI_L2AFSR_LDWU 0x0004000000000000ULL +#define NI_L2AFSR_LDRC 0x0002000000000000ULL +#define NI_L2AFSR_LDRU 0x0001000000000000ULL +#define NI_L2AFSR_LDSC 0x0000800000000000ULL +#define NI_L2AFSR_LDSU 0x0000400000000000ULL +#define NI_L2AFSR_LTC 0x0000200000000000ULL +#define NI_L2AFSR_LRU 0x0000100000000000ULL +#define NI_L2AFSR_LVU 0x0000080000000000ULL +#define NI_L2AFSR_DAC 0x0000040000000000ULL +#define NI_L2AFSR_DAU 0x0000020000000000ULL +#define NI_L2AFSR_DRC 0x0000010000000000ULL +#define NI_L2AFSR_DRU 0x0000008000000000ULL +#define NI_L2AFSR_DSC 0x0000004000000000ULL +#define NI_L2AFSR_DSU 0x0000002000000000ULL +#define NI_L2AFSR_VEC 0x0000001000000000ULL +#define NI_L2AFSR_VEU 0x0000000800000000ULL +#define NI_L2AFSR_RSVD1 0x0000000700000000ULL +#define NI_L2AFSR_SYND 0x00000000FFFFFFFFULL /* * These L2 bit masks are used to determine if another bit of higher priority @@ -208,15 +208,15 @@ extern uint64_t hv_niagara_mmustat_info(uint64_t *buf); * 63 62 61 60 59 58 57 56-16 15-0 * */ -#define NI_DMAFSR_MEU 0x8000000000000000 -#define NI_DMAFSR_MEC 0x4000000000000000 -#define NI_DMAFSR_DAC 0x2000000000000000 -#define NI_DMAFSR_DAU 0x1000000000000000 -#define NI_DMAFSR_DSC 0x0800000000000000 -#define NI_DMAFSR_DSU 0x0400000000000000 -#define NI_DMAFSR_DBU 0x0200000000000000 -#define NI_DMAFSR_RSVD 0x01FFFFFFFFFF0000 -#define NI_DMAFSR_SYND 0x000000000000FFFF +#define NI_DMAFSR_MEU 0x8000000000000000ULL +#define NI_DMAFSR_MEC 0x4000000000000000ULL +#define NI_DMAFSR_DAC 0x2000000000000000ULL +#define NI_DMAFSR_DAU 0x1000000000000000ULL +#define NI_DMAFSR_DSC 0x0800000000000000ULL +#define NI_DMAFSR_DSU 0x0400000000000000ULL +#define NI_DMAFSR_DBU 0x0200000000000000ULL +#define NI_DMAFSR_RSVD 0x01FFFFFFFFFF0000ULL +#define NI_DMAFSR_SYND 0x000000000000FFFFULL /* Bit mask for DRAM priority determination */ #define NI_DMAFSR_P01 (NI_DMAFSR_DSU | NI_DMAFSR_DAU) |