diff options
Diffstat (limited to 'usr/src')
42 files changed, 368 insertions, 1060 deletions
diff --git a/usr/src/cmd/sgs/Makefile b/usr/src/cmd/sgs/Makefile index ca1a8805bf..50c8984d11 100644 --- a/usr/src/cmd/sgs/Makefile +++ b/usr/src/cmd/sgs/Makefile @@ -45,7 +45,6 @@ SUBDIRS-common= libconv \ libldstab \ librtld \ libcrle \ - sgsdemangler \ .WAIT \ 0@0 \ ld \ diff --git a/usr/src/cmd/sgs/ar/Makefile.com b/usr/src/cmd/sgs/ar/Makefile.com index 39aa0cf451..3d5a20c05d 100644 --- a/usr/src/cmd/sgs/ar/Makefile.com +++ b/usr/src/cmd/sgs/ar/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,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -55,7 +54,7 @@ $(XPG4) := CPPFLAGS += -DXPG4 SRCS= $(COMOBJS:%.o=../common/%.c) LINTSRCS= $(SRCS) -CLEANFILES += $(OBJS) $(XPG4OBJS) $(LINTOUTS) +CLEANFILES += $(OBJS) $(XPG4OBJS) $(LINTOUT) # Building SUNWonld results in a call to the `package' target. Requirements diff --git a/usr/src/cmd/sgs/dump/Makefile.com b/usr/src/cmd/sgs/dump/Makefile.com index 6da02c7a10..39891ab6e4 100644 --- a/usr/src/cmd/sgs/dump/Makefile.com +++ b/usr/src/cmd/sgs/dump/Makefile.com @@ -20,7 +20,7 @@ # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -43,11 +43,8 @@ LLDFLAGS = '$(LDPASS)-R$$ORIGIN/../../lib' LLDFLAGS64 = '$(LDPASS)-R$$ORIGIN/../../../lib/$(MACH64)' LDFLAGS += $(LLDFLAGS) -DEMLIB= -L../../sgsdemangler/$(MACH) -DEMLIB64= -L../../sgsdemangler/$(MACH64) -LDLIBS += $(DEMLIB) -ldemangle $(CONVLIBDIR) $(CONV_LIB) \ - $(ELFLIBDIR) -lelf - +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf +LINTFLAGS += -x LINTSRCS = $(SRCS) -CLEANFILES += $(LINTOUT) +CLEANFILES += $(LINTOUTS) diff --git a/usr/src/cmd/sgs/dump/amd64/Makefile b/usr/src/cmd/sgs/dump/amd64/Makefile index 145d0bdac5..57cd6b100e 100644 --- a/usr/src/cmd/sgs/dump/amd64/Makefile +++ b/usr/src/cmd/sgs/dump/amd64/Makefile @@ -20,7 +20,7 @@ # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -32,7 +32,6 @@ include ../Makefile.com LLDFLAGS = $(LLDFLAGS64) ELFLIBDIR = $(ELFLIBDIR64) -DEMLIB = $(DEMLIB64) CONVLIBDIR = $(CONVLIBDIR64) VAR_SGSBINPROG= $(VAR_SGSBINPROG64) diff --git a/usr/src/cmd/sgs/dump/common/dump.c b/usr/src/cmd/sgs/dump/common/dump.c index 85866e6026..ca9332b45c 100644 --- a/usr/src/cmd/sgs/dump/common/dump.c +++ b/usr/src/cmd/sgs/dump/common/dump.c @@ -487,10 +487,10 @@ static char * demangled_name(char *s) { static char *buf = NULL; - char *dn; + const char *dn; size_t len; - dn = sgs_demangle(s); + dn = conv_demangle_name(s); /* * If not demangled, just return the symbol name diff --git a/usr/src/cmd/sgs/dump/sparcv9/Makefile b/usr/src/cmd/sgs/dump/sparcv9/Makefile index 2fdcd4cc51..018d76d3bd 100644 --- a/usr/src/cmd/sgs/dump/sparcv9/Makefile +++ b/usr/src/cmd/sgs/dump/sparcv9/Makefile @@ -20,7 +20,7 @@ # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -32,7 +32,6 @@ include ../Makefile.com LLDFLAGS = $(LLDFLAGS64) ELFLIBDIR = $(ELFLIBDIR64) -DEMLIB = $(DEMLIB64) CONVLIBDIR = $(CONVLIBDIR64) VAR_SGSBINPROG= $(VAR_SGSBINPROG64) diff --git a/usr/src/cmd/sgs/gprof/Makefile.com b/usr/src/cmd/sgs/gprof/Makefile.com index 053d3d8551..812f2c8dc7 100644 --- a/usr/src/cmd/sgs/gprof/Makefile.com +++ b/usr/src/cmd/sgs/gprof/Makefile.com @@ -27,7 +27,10 @@ # cmd/sgs/gprof/Makefile.com # -include ../../../Makefile.cmd +PROG= gprof + +include $(SRC)/cmd/Makefile.cmd +include $(SRC)/cmd/sgs/Makefile.com COMOBJS= gprof.o arcs.o dfn.o lookup.o calls.o \ printgprof.o printlist.o readelf.o @@ -41,9 +44,10 @@ DEFLIST= -DELF_OBJ -DELF CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) CFLAGS += $(CCVERBOSE) C99MODE= $(C99_ENABLE) -LDLIBS += -L../../sgsdemangler/$(MACH) -ldemangle -LINTFLAGS += $(LDLIBS) -CLEANFILES += $(LINTOUT) +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf +LINTSRCS = $(SRCS) +LINTFLAGS += -x +CLEANFILES += $(LINTOUTS) ROOTLIBBLURB= $(BLURBS:%=$(ROOTSHLIBCCS)/%) diff --git a/usr/src/cmd/sgs/gprof/Makefile.targ b/usr/src/cmd/sgs/gprof/Makefile.targ index c58dc5a0a4..0ca19bba36 100644 --- a/usr/src/cmd/sgs/gprof/Makefile.targ +++ b/usr/src/cmd/sgs/gprof/Makefile.targ @@ -35,10 +35,6 @@ $(PROG): $(OBJS) clean: $(RM) $(OBJS) $(CLEANFILES) -lint: $(LINTOUT) +include $(SRC)/cmd/Makefile.targ +include $(SRC)/cmd/sgs/Makefile.targ -$(LINTOUT): $(SRCS) - perl ../../tools/lint_hdr.pl $(PROG) > $(LINTOUT) - $(LINT.c) $(SRCS) 2>&1 | tee -a $(LINTOUT) - -include ../../../Makefile.targ diff --git a/usr/src/cmd/sgs/gprof/common/printgprof.c b/usr/src/cmd/sgs/gprof/common/printgprof.c index a9f9a724d6..d02e9a3d9a 100644 --- a/usr/src/cmd/sgs/gprof/common/printgprof.c +++ b/usr/src/cmd/sgs/gprof/common/printgprof.c @@ -20,7 +20,7 @@ */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -30,6 +30,7 @@ #include <string.h> #include <sys/param.h> #include <stdlib.h> +#include "conv.h" #include "gprof.h" void print_demangled_name(int, nltype *); @@ -49,15 +50,13 @@ char *splsym[] = { static bool is_special_sym(nltype *nlp); -char * +const char * demangled_name(nltype *selfp) { - char *name; if (!Cflag) return (selfp->name); - name = (char *)sgs_demangle(selfp->name); - return (name); + return (conv_demangle_name(selfp->name)); } void @@ -497,7 +496,7 @@ printchildren(nltype *parentp) void printname(nltype *selfp) { - char *c; + const char *c; c = demangled_name(selfp); if (selfp->name != 0) { @@ -883,7 +882,8 @@ namecmp(const void *arg1, const void *arg2) void striped_name(char *s, nltype **npp) { - char *d, *c; + const char *d; + char *c; c = (char *)s; d = demangled_name(*npp); @@ -1033,7 +1033,7 @@ printindex() (void) sprintf(peterbuffer, "(%d)", nlp->index); if (i < nnames) { - char *d = demangled_name(nlp); + const char *d = demangled_name(nlp); if (does_clash(namesortnlp, i, nnames)) { (void) printf("%6.6s %d:%s\n", diff --git a/usr/src/cmd/sgs/gprof/i386/Makefile b/usr/src/cmd/sgs/gprof/i386/Makefile index 5941dcc975..b177dd3916 100644 --- a/usr/src/cmd/sgs/gprof/i386/Makefile +++ b/usr/src/cmd/sgs/gprof/i386/Makefile @@ -21,22 +21,20 @@ # #ident "%Z%%M% %I% %E% SMI" # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/sgs/gprof/i386/Makefile # -PROG= gprof - include ../Makefile.com -LDLIBS += -lelf - .KEEP_STATE: all: $(PROG) install: all .WAIT $(ROOTPROG) $(ROOTLIBBLURB) $(ROOTCCSBINLINK) +lint: $(LINTOUT32) $(SGSLINTOUT) + include ../Makefile.targ diff --git a/usr/src/cmd/sgs/gprof/sparc/Makefile b/usr/src/cmd/sgs/gprof/sparc/Makefile index 06333269b1..c018b8f889 100644 --- a/usr/src/cmd/sgs/gprof/sparc/Makefile +++ b/usr/src/cmd/sgs/gprof/sparc/Makefile @@ -21,24 +21,22 @@ # #ident "%Z%%M% %I% %E% SMI" # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/sgs/gprof/sparc/Makefile -PROG= gprof - include ../Makefile.com DEFLIST += -DSPARC -LDLIBS += -lelf - .KEEP_STATE: all: $(PROG) install: all .WAIT $(ROOTPROG) $(ROOTLIBBLURB) $(ROOTCCSBINLINK) +lint: $(LINTOUT32) $(SGSLINTOUT) + include ../Makefile.targ diff --git a/usr/src/cmd/sgs/include/sgs.h b/usr/src/cmd/sgs/include/sgs.h index 388ec978ec..89d61ef677 100644 --- a/usr/src/cmd/sgs/include/sgs.h +++ b/usr/src/cmd/sgs/include/sgs.h @@ -279,7 +279,6 @@ typedef struct lm_list32 Lm_list32; */ extern int assfail(const char *, const char *, int); extern void eprintf(Lm_list *, Error, const char *, ...); -extern char *sgs_demangle(char *); extern uint_t sgs_str_hash(const char *); extern uint_t findprime(uint_t); diff --git a/usr/src/cmd/sgs/nm/amd64/Makefile b/usr/src/cmd/sgs/nm/amd64/Makefile index 949114f3d0..b2c3e0d454 100644 --- a/usr/src/cmd/sgs/nm/amd64/Makefile +++ b/usr/src/cmd/sgs/nm/amd64/Makefile @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -42,11 +42,10 @@ LDFLAGS += '-R$$ORIGIN/../../../lib/$(MACH64)' INCLIST= -I../../include -I../../include/i386 \ -I$(SRCBASE)/uts/$(ARCH)/sys CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -LDLIBS += -L ../../sgsdemangler/amd64 -ldemangle \ - $(CONVLIBDIR64) $(CONV_LIB) -lelf +LDLIBS += $(CONVLIBDIR64) $(CONV_LIB) $(ELFLIBDIR) -lelf LINTFLAGS64 += -x $(LDLIBS) -Xarch=amd64 LINTSRCS= $(SRCS) -CLEANFILES += $(LINTOUT) +CLEANFILES += $(LINTOUTS) %.o: ../common/%.c @@ -59,7 +58,7 @@ $(ROOTCCSBIN64)/%: % all: $(PROG) -$(PROG): $(OBJS) ../../sgsdemangler/amd64/libdemangle.a +$(PROG): $(OBJS) $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(POST_PROCESS) diff --git a/usr/src/cmd/sgs/nm/common/nm.c b/usr/src/cmd/sgs/nm/common/nm.c index b962db7fe8..e9ef8c92b2 100644 --- a/usr/src/cmd/sgs/nm/common/nm.c +++ b/usr/src/cmd/sgs/nm/common/nm.c @@ -24,7 +24,7 @@ * Copyright (c) 1989 AT&T * All Rights Reserved * - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -157,6 +157,7 @@ static char d_buf[512]; static char p_buf[512]; static int exotic(char *s); static void set_A_header(char *); +static char *FormatName(char *, const char *); @@ -215,15 +216,15 @@ main(int argc, char *argv[], char *envp[]) fmt_flag = FMT_T_OCT; else (void) fprintf(stderr, gettext( - "%s: -x or -t set, -o ignored\n"), - prog_name); + "%s: -x or -t set, -o ignored\n"), + prog_name); break; case 'x': if (COMPAT_FMT_FLAG(FMT_T_HEX)) fmt_flag = FMT_T_HEX; else (void) fprintf(stderr, gettext( - "%s: -o or -t set, -x ignored\n"), - prog_name); + "%s: -o or -t set, -x ignored\n"), + prog_name); break; case 'h': h_flag = 1; break; @@ -231,42 +232,42 @@ main(int argc, char *argv[], char *envp[]) v_flag = 1; else (void) fprintf(stderr, gettext( - "%s: -n set, -v ignored\n"), - prog_name); + "%s: -n set, -v ignored\n"), + prog_name); break; case 'n': if (!v_flag) n_flag = 1; else (void) fprintf(stderr, gettext( - "%s: -v set, -n ignored\n"), - prog_name); + "%s: -v set, -n ignored\n"), + prog_name); break; case 'u': if (!e_flag && !g_flag) u_flag = 1; else (void) fprintf(stderr, gettext( - "%s: -e or -g set, -u ignored\n"), - prog_name); + "%s: -e or -g set, -u ignored\n"), + prog_name); break; case 'e': if (!u_flag && !g_flag) e_flag = 1; else (void) fprintf(stderr, gettext( - "%s: -u or -g set, -e ignored\n"), - prog_name); + "%s: -u or -g set, -e ignored\n"), + prog_name); break; case 'g': if (!u_flag && !e_flag) g_flag = 1; else (void) fprintf(stderr, gettext( - "%s: -u or -e set, -g ignored\n"), - prog_name); + "%s: -u or -e set, -g ignored\n"), + prog_name); break; case 'r': if (R_flag) { R_flag = 0; (void) fprintf(stderr, gettext( - "%s: -r set, -R ignored\n"), - prog_name); + "%s: -r set, -R ignored\n"), + prog_name); } r_flag = 1; break; @@ -274,13 +275,13 @@ main(int argc, char *argv[], char *envp[]) break; case 'p': if (P_flag == 1) { (void) fprintf(stderr, gettext( - "nm: -P set. -p ignored\n")); + "nm: -P set. -p ignored\n")); } else p_flag = 1; break; case 'P': if (p_flag == 1) { (void) fprintf(stderr, gettext( - "nm: -p set. -P ignored\n")); + "nm: -p set. -P ignored\n")); } else P_flag = 1; break; @@ -288,13 +289,13 @@ main(int argc, char *argv[], char *envp[]) break; case 'L': if (D_flag == 1) { (void) fprintf(stderr, gettext( - "nm: -D set. -L ignored\n")); + "nm: -D set. -L ignored\n")); } else L_flag = 1; break; case 'D': if (L_flag == 1) { (void) fprintf(stderr, gettext( - "nm: -L set. -D ignored\n")); + "nm: -L set. -D ignored\n")); } else D_flag = 1; break; @@ -304,10 +305,9 @@ main(int argc, char *argv[], char *envp[]) case 'A': A_flag = 1; break; case 'V': V_flag = 1; - (void) fprintf(stderr, - "nm: %s %s\n", - (const char *)SGU_PKG, - (const char *)SGU_REL); + (void) fprintf(stderr, "nm: %s %s\n", + (const char *)SGU_PKG, + (const char *)SGU_REL); break; case 'f': /* -f is a noop, see man page */ break; @@ -315,8 +315,8 @@ main(int argc, char *argv[], char *envp[]) R_flag = 1; else (void) fprintf(stderr, gettext( - "%s: -r set, -R ignored\n"), - prog_name); + "%s: -r set, -R ignored\n"), + prog_name); break; case 'T': break; @@ -341,8 +341,7 @@ main(int argc, char *argv[], char *envp[]) break; case ':': errflag += 1; (void) fprintf(stderr, gettext( - "nm: %c requires operand\n"), - optopt); + "nm: %c requires operand\n"), optopt); break; case '?': errflag += 1; break; @@ -411,30 +410,28 @@ each_file(char *filename) Elf_Cmd cmd; errno = 0; if (stat64(filename, &buf) == -1) { - (void) fprintf(stderr, - "%s: ", prog_name); + (void) fprintf(stderr, "%s: ", prog_name); perror(filename); errflag++; return; } if (elf_version(EV_CURRENT) == EV_NONE) { (void) fprintf(stderr, gettext( - "%s: %s: Libelf is out of date\n"), - prog_name, filename); + "%s: %s: Libelf is out of date\n"), + prog_name, filename); exit(BADELF); } if ((fd = open((filename), O_RDONLY)) == -1) { - (void) fprintf(stderr, gettext( - "%s: %s: cannot read file\n"), - prog_name, filename); + (void) fprintf(stderr, gettext("%s: %s: cannot read file\n"), + prog_name, filename); errflag++; return; } cmd = ELF_C_READ; if ((elf_file = elf_begin(fd, cmd, (Elf *) 0)) == NULL) { (void) fprintf(stderr, - "%s: %s: %s\n", prog_name, filename, elf_errmsg(-1)); + "%s: %s: %s\n", prog_name, filename, elf_errmsg(-1)); errflag++; (void) close(fd); return; @@ -450,40 +447,33 @@ each_file(char *filename) * u_flag is specified. */ if (p_flag) - (void) printf( - "\n\n%s:\n\n", - filename); + (void) printf("\n\n%s:\n\n", filename); else (void) printf(gettext( "\n\nUndefined symbols from %s:\n\n"), - filename); + filename); } else if (!h_flag & !P_flag) #else if (!h_flag & !P_flag) #endif { if (p_flag) - (void) printf( - "\n\n%s:\n", - filename); + (void) printf("\n\n%s:\n", filename); else { if (A_flag != 0) - (void) printf( - "\n\n%s%s:\n", - A_header, - filename); + (void) printf("\n\n%s%s:\n", + A_header, filename); else - (void) printf( - "\n\n%s:\n", - filename); + (void) printf("\n\n%s:\n", + filename); } } archive_name = (char *)0; process(elf_file, filename); } else { (void) fprintf(stderr, gettext( - "%s: %s: invalid file type\n"), - prog_name, filename); + "%s: %s: invalid file type\n"), + prog_name, filename); errflag++; } } @@ -503,7 +493,7 @@ process(Elf *elf_file, char *filename) if (gelf_getehdr(elf_file, &ehdr) == NULL) { (void) fprintf(stderr, - "%s: %s: %s\n", prog_name, filename, elf_errmsg(-1)); + "%s: %s: %s\n", prog_name, filename, elf_errmsg(-1)); return; } @@ -561,16 +551,16 @@ get_symtab(Elf *elf_file, char *filename) scnfd = get_scnfd(elf_file, shstrndx, SHT_STRTAB); if (scnfd == NULL) { (void) fprintf(stderr, gettext( - "%s: %s: could not get string table\n"), - prog_name, filename); + "%s: %s: could not get string table\n"), + prog_name, filename); return; } data = elf_getdata(scnfd, NULL); if (data->d_size == 0) { (void) fprintf(stderr, gettext( - "%s: %s: no data in string table\n"), - prog_name, filename); + "%s: %s: no data in string table\n"), + prog_name, filename); return; } @@ -586,16 +576,14 @@ get_symtab(Elf *elf_file, char *filename) GElf_Shdr shdr; if (gelf_getshdr(scn, &shdr) == NULL) { - (void) fprintf(stderr, - "%s: %s: %s:\n", - prog_name, - filename, elf_errmsg(-1)); + (void) fprintf(stderr, "%s: %s: %s:\n", + prog_name, filename, elf_errmsg(-1)); return; } if (shdr.sh_type == symtabtype) { print_symtab(elf_file, shstrndx, scn, - &shdr, filename); + &shdr, filename); } } /* end while */ } @@ -619,11 +607,8 @@ print_ar_files(int fd, Elf * elf_file, char *filename) while ((arf = elf_begin(fd, cmd, elf_file)) != 0) { p_ar = elf_getarhdr(arf); if (p_ar == NULL) { - (void) fprintf(stderr, - "%s: %s: %s\n", - prog_name, - filename, - elf_errmsg(-1)); + (void) fprintf(stderr, "%s: %s: %s\n", + prog_name, filename, elf_errmsg(-1)); return; } if ((int)strncmp(p_ar->ar_name, "/", 1) == 0) { @@ -635,17 +620,14 @@ print_ar_files(int fd, Elf * elf_file, char *filename) if (!h_flag & !P_flag) { if (p_flag) (void) printf("\n\n%s[%s]:\n", - filename, p_ar->ar_name); + filename, p_ar->ar_name); else { if (A_flag != 0) - (void) printf( - "\n\n%s%s[%s]:\n", - A_header, - filename, p_ar->ar_name); + (void) printf("\n\n%s%s[%s]:\n", + A_header, filename, p_ar->ar_name); else - (void) printf( - "\n\n%s[%s]:\n", - filename, p_ar->ar_name); + (void) printf("\n\n%s[%s]:\n", + filename, p_ar->ar_name); } } file_type = elf_kind(arf); @@ -653,8 +635,8 @@ print_ar_files(int fd, Elf * elf_file, char *filename) process(arf, p_ar->ar_name); } else { (void) fprintf(stderr, gettext( - "%s: %s: invalid file type\n"), - prog_name, p_ar->ar_name); + "%s: %s: invalid file type\n"), + prog_name, p_ar->ar_name); cmd = elf_next(arf); (void) elf_end(arf); errflag++; @@ -698,7 +680,7 @@ print_symtab(Elf *elf_file, unsigned int shstrndx, static void print_with_pflag(int, Elf *, unsigned int, SYM *, char *); static void print_with_Pflag(int, Elf *, unsigned int, SYM *); static void print_with_otherflags(int, Elf *, unsigned int, - SYM *, char *); + SYM *, char *); /* * Determine # of digits to use for each numeric value. @@ -716,9 +698,8 @@ print_symtab(Elf *elf_file, unsigned int shstrndx, * get symbol table data */ if (((sd = elf_getdata(p_sd, NULL)) == NULL) || (sd->d_size == 0)) { - (void) printf(gettext( - "%s: %s - No symbol table data\n"), - prog_name, filename); + (void) printf(gettext("%s: %s - No symbol table data\n"), + prog_name, filename); return; } count = shdr->sh_size / shdr->sh_entsize; @@ -727,16 +708,15 @@ print_symtab(Elf *elf_file, unsigned int shstrndx, * translate symbol table data */ sym_data = readsyms(sd, count, elf_file, shdr->sh_link, - (unsigned int)elf_ndxscn(p_sd)); + (unsigned int)elf_ndxscn(p_sd)); if (sym_data == NULL) { (void) fprintf(stderr, gettext( - "%s: %s: problem reading symbol data\n"), - prog_name, filename); + "%s: %s: problem reading symbol data\n"), + prog_name, filename); return; } - qsort((char *)sym_data, - count-1, sizeof (SYM), - (int (*)(const void *, const void *))compare); + qsort((char *)sym_data, count-1, sizeof (SYM), + (int (*)(const void *, const void *))compare); s = sym_data; while (count > 1) { #ifndef XPG4 @@ -750,13 +730,13 @@ print_symtab(Elf *elf_file, unsigned int shstrndx, if (p_flag) #endif print_with_pflag(ndigits, elf_file, shstrndx, - sym_data, filename); + sym_data, filename); else if (P_flag) print_with_Pflag(ndigits, elf_file, shstrndx, - sym_data); + sym_data); else print_with_otherflags(ndigits, elf_file, - shstrndx, sym_data, filename); + shstrndx, sym_data, filename); sym_data++; count--; } @@ -788,8 +768,7 @@ is_bss_section(unsigned int shndx, Elf * elf_file, unsigned int shstrndx) if (scn != NULL) { GElf_Shdr shdr; (void) gelf_getshdr(scn, &shdr); - sym_name = elf_strptr(elf_file, shstrndx, - shdr.sh_name); + sym_name = elf_strptr(elf_file, shstrndx, shdr.sh_name); if (strcmp(BSS_SECN, sym_name) == 0) return (1); } @@ -805,7 +784,6 @@ static SYM * readsyms(Elf_Data * data, GElf_Sxword num, Elf *elf, unsigned int link, unsigned int symscnndx) { - static char *FormatName(char *, char *); SYM *s, *buf; GElf_Sym sym; Elf32_Word *symshndx = 0; @@ -813,8 +791,7 @@ readsyms(Elf_Data * data, GElf_Sxword num, Elf *elf, int i; if ((buf = calloc(num, sizeof (SYM))) == NULL) { - (void) fprintf(stderr, - "%s: cannot calloc space\n", prog_name); + (void) fprintf(stderr, "%s: cannot calloc space\n", prog_name); return (NULL); } @@ -828,10 +805,9 @@ readsyms(Elf_Data * data, GElf_Sxword num, Elf *elf, if (sym.st_name == 0) buf->name = ""; else if (C_flag) { - char *dn; - char *name = (char *)elf_strptr(elf, link, - sym.st_name); - dn = sgs_demangle(name); + const char *dn; + char *name = (char *)elf_strptr(elf, link, sym.st_name); + dn = conv_demangle_name(name); if (strcmp(dn, name) == 0) { /* Not demangled */ if (exotic(name)) { name = FormatName(name, d_buf); @@ -842,9 +818,7 @@ readsyms(Elf_Data * data, GElf_Sxword num, Elf *elf, buf->name = name; } else - buf->name = (char *)elf_strptr(elf, - link, - sym.st_name); + buf->name = (char *)elf_strptr(elf, link, sym.st_name); buf->value = sym.st_value; buf->size = sym.st_size; @@ -913,7 +887,7 @@ set_A_header(char *fname) (void) snprintf(A_header, sizeof (A_header), "%s: ", fname); } else { (void) snprintf(A_header, sizeof (A_header), "%s[%s]: ", - archive_name, fname); + archive_name, fname); } } @@ -957,8 +931,8 @@ print_header(int ndigits) (void) printf("%s", A_header); ndigits += pad[fmt_flag]; (void) printf(fmt, "[Index]", ndigits, " Value", - ndigits, " Size", "Type", "Bind", - "Other", section_title, "Name"); + ndigits, " Size", "Type", "Bind", + "Other", section_title, "Name"); } } @@ -975,7 +949,7 @@ is_sym_print(SYM *sym_data) */ if (u_flag != 0) { if ((sym_data->shndx == SHN_UNDEF) && - (strlen(sym_data->name) != 0)) + (strlen(sym_data->name) != 0)) return (1); else return (0); @@ -1045,31 +1019,22 @@ print_with_uflag( char *filename ) { - if ((sym_data->shndx == SHN_UNDEF) && - (strlen(sym_data->name))) { + if ((sym_data->shndx == SHN_UNDEF) && (strlen(sym_data->name))) { if (!r_flag) { if (R_flag) { if (archive_name != (char *)0) - (void) printf( - " %s:%s:%s\n", - archive_name, - filename, - sym_data->name); + (void) printf(" %s:%s:%s\n", + archive_name, filename, + sym_data->name); else - (void) printf( - " %s:%s\n", - filename, - sym_data->name); + (void) printf(" %s:%s\n", + filename, sym_data->name); } else - (void) printf( - " %s\n", - sym_data->name); + (void) printf(" %s\n", sym_data->name); } else - (void) printf(" %s:%s\n", - filename, - sym_data->name); + (void) printf(" %s:%s\n", filename, sym_data->name); } } #endif @@ -1110,8 +1075,7 @@ print_with_pflag( /* * Symbol Type. */ - if ((sym_data->shndx == SHN_UNDEF) && - (strlen(sym_data->name))) + if ((sym_data->shndx == SHN_UNDEF) && (strlen(sym_data->name))) sym_key = UNDEFINED; else if (sym_data->type == STT_SPARC_REGISTER) { switch (sym_data->bind) { @@ -1139,8 +1103,7 @@ print_with_pflag( } else - sym_key = lookup(sym_data->type, - sym_data->bind); + sym_key = lookup(sym_data->type, sym_data->bind); if (sym_key != NULL) { if (!l_flag) @@ -1156,24 +1119,17 @@ print_with_pflag( if (!r_flag) { if (R_flag) { if (archive_name != (char *)0) - (void) printf( - "%s:%s:%s\n", - archive_name, - filename, - sym_data->name); + (void) printf("%s:%s:%s\n", archive_name, + filename, sym_data->name); else - (void) printf( - "%s:%s\n", - filename, - sym_data->name); + (void) printf("%s:%s\n", filename, + sym_data->name); } else (void) printf("%s\n", sym_data->name); } else - (void) printf("%s:%s\n", - filename, - sym_data->name); + (void) printf("%s:%s\n", filename, sym_data->name); } /* @@ -1219,8 +1175,7 @@ print_with_Pflag( /* * Symbol Type. */ - if ((sym_data->shndx == SHN_UNDEF) && - (strlen(sym_data->name))) + if ((sym_data->shndx == SHN_UNDEF) && (strlen(sym_data->name))) sym_key = UNDEFINED; else if (sym_data->type == STT_SPARC_REGISTER) { switch (sym_data->bind) { @@ -1234,8 +1189,7 @@ print_with_Pflag( break; } } else if (((sym_data->flags & FLG_SYM_SPECSEC) == 0) && - is_bss_section((int)sym_data->shndx, - elf_file, shstrndx)) { + is_bss_section((int)sym_data->shndx, elf_file, shstrndx)) { switch (sym_data->bind) { case STB_LOCAL : sym_key = BSS_LOCL; break; @@ -1248,8 +1202,7 @@ print_with_Pflag( } } else - sym_key = lookup(sym_data->type, - sym_data->bind); + sym_key = lookup(sym_data->type, sym_data->bind); if (sym_key != NULL) { if (!l_flag) @@ -1268,7 +1221,7 @@ print_with_Pflag( * (hex/octal/decimal) */ (void) printf(fmt[fmt_flag], ndigits, EC_ADDR(sym_data->value), - ndigits, EC_XWORD(sym_data->size)); + ndigits, EC_XWORD(sym_data->size)); } /* @@ -1299,7 +1252,7 @@ print_with_otherflags( (void) printf("%s", A_header); (void) printf("[%d]\t|", sym_data->indx); (void) printf(fmt_value_size[fmt_flag], ndigits, - EC_ADDR(sym_data->value), ndigits, EC_XWORD(sym_data->size)); + EC_ADDR(sym_data->value), ndigits, EC_XWORD(sym_data->size)); switch (sym_data->type) { case STT_NOTYPE:(void) printf("%-5s", "NOTY"); break; @@ -1328,34 +1281,26 @@ print_with_otherflags( if (sym_data->shndx == SHN_UNDEF) { if (!s_flag) - (void) printf("%-7s", - "UNDEF"); + (void) printf("%-7s", "UNDEF"); else - (void) printf("%-14s", - "UNDEF"); + (void) printf("%-14s", "UNDEF"); } else if (sym_data->shndx == SHN_SUNW_IGNORE) { if (!s_flag) - (void) printf("%-7s", - "IGNORE"); + (void) printf("%-7s", "IGNORE"); else - (void) printf("%-14s", - "IGNORE"); + (void) printf("%-14s", "IGNORE"); } else if ((sym_data->flags & FLG_SYM_SPECSEC) && (sym_data->shndx == SHN_ABS)) { if (!s_flag) - (void) printf("%-7s", - "ABS"); + (void) printf("%-7s", "ABS"); else - (void) printf("%-14s", - "ABS"); + (void) printf("%-14s", "ABS"); } else if ((sym_data->flags & FLG_SYM_SPECSEC) && (sym_data->shndx == SHN_COMMON)) { if (!s_flag) - (void) printf("%-7s", - "COMMON"); + (void) printf("%-7s", "COMMON"); else - (void) printf("%-14s", - "COMMON"); + (void) printf("%-14s", "COMMON"); } else { if (s_flag) { Elf_Scn *scn = elf_getscn(elf_file, sym_data->shndx); @@ -1364,8 +1309,8 @@ print_with_otherflags( if ((gelf_getshdr(scn, &shdr) != 0) && (shdr.sh_name != 0)) { (void) printf("%-14s", - (char *)elf_strptr(elf_file, - shstrndx, shdr.sh_name)); + (char *)elf_strptr(elf_file, + shstrndx, shdr.sh_name)); } else { (void) printf("%-14d", sym_data->shndx); } @@ -1377,21 +1322,17 @@ print_with_otherflags( if (!r_flag) { if (R_flag) { if (archive_name != (char *)0) - (void) printf("%s:%s:%s\n", - archive_name, - filename, - sym_data->name); + (void) printf("%s:%s:%s\n", archive_name, + filename, sym_data->name); else - (void) printf("%s:%s\n", - filename, - sym_data->name); + (void) printf("%s:%s\n", filename, + sym_data->name); } else (void) printf("%s\n", sym_data->name); } else - (void) printf("%s:%s\n", - filename, sym_data->name); + (void) printf("%s:%s\n", filename, sym_data->name); } /* @@ -1407,11 +1348,11 @@ static const char *vtbl_str = "virtual table for %s"; * Return name string */ static char * -FormatName(char *OldName, char *NewName) +FormatName(char *OldName, const char *NewName) { char *s = p_flag ? - "%s\n [%s]" : - "%s\n\t\t\t\t\t\t [%s]"; + "%s\n [%s]" : + "%s\n\t\t\t\t\t\t [%s]"; size_t length = strlen(s)+strlen(NewName)+strlen(OldName)-3; char *hold = OldName; OldName = malloc(length); @@ -1478,7 +1419,8 @@ parsename(char *s) (void) strcat(p_buf, root); *(root + len) = c; (void) strcat(p_buf, " in "); - for (p = child; *p != '_'; ++p); + for (p = child; *p != '_'; ++p) + ; c = *p; *p = '.'; (void) strcat(p_buf, child); @@ -1514,7 +1456,8 @@ parsename(char *s) (void) strcat(p_buf, root); *(root + len) = c; (void) strcat(p_buf, " in "); - for (p = child + child_len + 2; *p != '_'; ++p); + for (p = child + child_len + 2; *p != '_'; ++p) + ; c = *p; *p = '.'; (void) strcat(p_buf, child + child_len + 2); @@ -1551,7 +1494,7 @@ parse_fn_and_print(const char *str, char *s) if (buff == NULL) { (void) fprintf(stderr, gettext( - "%s: cannot malloc space\n"), prog_name); + "%s: cannot malloc space\n"), prog_name); exit(NOALLOC); } s = strcpy(buff, s); @@ -1560,8 +1503,8 @@ parse_fn_and_print(const char *str, char *s) if ((p1 = p2 = strstr(s, "_C_")) == NULL) if ((p1 = p2 = strstr(s, "_cc_")) == NULL) if ((p1 = p2 = strstr(s, "_cxx_")) == NULL) - if ( - (p1 = p2 = strstr(s, "_h_")) == NULL) + if ((p1 = p2 = strstr(s, "_h_")) == + NULL) yes = 0; else p2 += 2; @@ -1580,7 +1523,8 @@ parse_fn_and_print(const char *str, char *s) *p2 = '\0'; } - for (s = p1; *s != '_'; --s); + for (s = p1; *s != '_'; --s) + ; ++s; (void) sprintf(d_buf, str, s); diff --git a/usr/src/cmd/sgs/nm/i386/Makefile b/usr/src/cmd/sgs/nm/i386/Makefile index a129cd5840..c65e31848c 100644 --- a/usr/src/cmd/sgs/nm/i386/Makefile +++ b/usr/src/cmd/sgs/nm/i386/Makefile @@ -21,7 +21,7 @@ # # ident "%Z%%M% %I% %E% SMI" # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/sgs/nm/i386/Makefile @@ -47,11 +47,10 @@ INCLIST= -I../../include -I../../include/i386 \ -I$(SRCBASE)/uts/$(ARCH)/sys DEFLIST= -DTARGET=I386 -DI386=1 -D$(ARFORMAT) -DELF CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -LDLIBS += -L ../../sgsdemangler/i386 -ldemangle \ - $(CONVLIBDIR) $(CONV_LIB) -lelf +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf LINTFLAGS += -x $(LDLIBS) LINTSRCS= $(SRCS) -CLEANFILES += $(LINTOUT) +CLEANFILES += $(LINTOUTS) objs.xpg4/%.o := CPPFLAGS += -DXPG4 $(DEMOBJS):= DEFLIST = -DELF_OBJ @@ -73,11 +72,11 @@ objs.xpg4/%.o: ../common/%.c all: $(PROG) $(XPG4) -$(PROG): $(OBJS) ../../sgsdemangler/i386/libdemangle.a +$(PROG): $(OBJS) $(LINK.c) $(OBJS) -o $@ $(LLDFLAGS) $(LDLIBS) $(POST_PROCESS) -$(XPG4): $(XPG4OBJS) ../../sgsdemangler/i386/libdemangle.a +$(XPG4): $(XPG4OBJS) $(LINK.c) $(XPG4OBJS) -o $@ $(LDLIBS) $(POST_PROCESS) diff --git a/usr/src/cmd/sgs/nm/sparc/Makefile b/usr/src/cmd/sgs/nm/sparc/Makefile index a8ec896cb2..3fba7769c0 100644 --- a/usr/src/cmd/sgs/nm/sparc/Makefile +++ b/usr/src/cmd/sgs/nm/sparc/Makefile @@ -21,7 +21,7 @@ # # ident "%Z%%M% %I% %E% SMI" # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # cmd/sgs/nm/sparc/Makefile @@ -47,11 +47,10 @@ INCLIST= -I../../include -I../../include/sparc \ -I$(SRCBASE)/uts/$(ARCH)/sys DEFLIST= -DTARGET=SPARC -DSPARC=1 -D$(ARFORMAT) -DELF CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -LDLIBS += -L ../../sgsdemangler/sparc -ldemangle \ - $(CONVLIBDIR) $(CONV_LIB) -lelf +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf LINTFLAGS= -x $(LDLIBS) LINTSRCS= $(SRCS) -CLEANFILES += $(LINTOUT) +CLEANFILES += $(LINTOUTS) objs.xpg4/%.o := CPPFLAGS += -DXPG4 @@ -72,7 +71,7 @@ objs.xpg4/%.o: ../common/%.c all: $(PROG) $(XPG4) -$(PROG): $(OBJS) ../../sgsdemangler/sparc/libdemangle.a +$(PROG): $(OBJS) $(LINK.c) $(OBJS) -o $@ $(LLDFLAGS) $(LDLIBS) $(POST_PROCESS) diff --git a/usr/src/cmd/sgs/nm/sparcv9/Makefile b/usr/src/cmd/sgs/nm/sparcv9/Makefile index b7f224b267..d571df49b3 100644 --- a/usr/src/cmd/sgs/nm/sparcv9/Makefile +++ b/usr/src/cmd/sgs/nm/sparcv9/Makefile @@ -19,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -45,11 +45,10 @@ INCLIST= -I../../include -I../../include/sparc \ -I$(SRCBASE)/uts/$(ARCH)/sys DEFLIST= -DTARGET=SPARC -DSPARC=1 -D$(ARFORMAT) -DELF CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -LDLIBS += -L ../../sgsdemangler/sparcv9 -ldemangle \ - $(CONVLIBDIR64) $(CONV_LIB) -lelf +LDLIBS += $(CONVLIBDIR64) $(CONV_LIB) $(ELFLIBDIR) -lelf LINTFLAGS64= -x $(LDLIBS) -Xarch=v9 LINTSRCS= $(SRCS) -CLEANFILES += $(LINTOUT) +CLEANFILES += $(LINTOUTS) %.o: ../common/%.c @@ -62,7 +61,7 @@ $(ROOTCCSBIN64)/%: % all: $(PROG) -$(PROG): $(OBJS) ../../sgsdemangler/sparcv9/libdemangle.a +$(PROG): $(OBJS) $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(POST_PROCESS) diff --git a/usr/src/cmd/sgs/packages/Makefile b/usr/src/cmd/sgs/packages/Makefile index c6839379b5..4aa12fe3e2 100644 --- a/usr/src/cmd/sgs/packages/Makefile +++ b/usr/src/cmd/sgs/packages/Makefile @@ -161,7 +161,6 @@ package_dep_: FRC @ cd ../libconv; pwd; $(MAKE) all @ cd ../link_audit; pwd; $(MAKE) package @ cd ../messages/$(MACH); pwd; $(MAKE) test - @ cd ../sgsdemangler; pwd; $(MAKE) all lint: FRC $(MAKE) -f Makefile.lint lint diff --git a/usr/src/cmd/sgs/packages/Makefile.lint b/usr/src/cmd/sgs/packages/Makefile.lint index b61ee155d0..a5122dc95a 100644 --- a/usr/src/cmd/sgs/packages/Makefile.lint +++ b/usr/src/cmd/sgs/packages/Makefile.lint @@ -56,7 +56,6 @@ LSUBDIRS2 = ../rtld \ ../rtld/mdbmod LINTLDIRS= ../libld \ - ../sgsdemangler \ ../elfdump \ ../elfedit \ ../elfedit/modules \ diff --git a/usr/src/cmd/sgs/packages/Makefile.targ b/usr/src/cmd/sgs/packages/Makefile.targ index ed7ac485c6..d32d41e1c7 100644 --- a/usr/src/cmd/sgs/packages/Makefile.targ +++ b/usr/src/cmd/sgs/packages/Makefile.targ @@ -29,7 +29,7 @@ pkginfo: ../common/pkginfo.tmpl awk_pkginfo pkg: FRC @ $(RM) -r $(PACKAGE) - pkgmk -l 18000 -f prototype_$(MACH) -d $(PKGARCHIVE) -r $(ROOT) \ + pkgmk -l 20000 -f prototype_$(MACH) -d $(PKGARCHIVE) -r $(ROOT) \ -o $(PACKAGE) 2>&1 | egrep -v "$(SRC)|parametric paths may" pkgtrans -o -s $(PKGARCHIVE) $(PACKAGE).tmp $(PACKAGE) $(RM) -r $(PKGARCHIVE)/$(PACKAGE) diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README index 3e3d8d695d..10f2c681de 100644 --- a/usr/src/cmd/sgs/packages/common/SUNWonld-README +++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README @@ -1363,3 +1363,4 @@ Bugid Risk Synopsis 6713830 mdb dumped core reading a gcore 6712292 ld.so.1 should fall back to an interposer for failed direct bindings 6716350 usr/src/cmd/sgs should be linted by nightly builds +6720509 usr/src/cmd/sgs/sgsdemangler should be removed diff --git a/usr/src/cmd/sgs/packages/common/prototype_com b/usr/src/cmd/sgs/packages/common/prototype_com index d310b26eb5..76bda331a6 100644 --- a/usr/src/cmd/sgs/packages/common/prototype_com +++ b/usr/src/cmd/sgs/packages/common/prototype_com @@ -233,3 +233,72 @@ d none opt/SUNWonld/man 755 root bin d none opt/SUNWonld/man/man1l 755 root bin f none opt/SUNWonld/man/man1l/chkmsg.1l 444 root bin f none opt/SUNWonld/man/man1l/sgsmsg.1l 444 root bin + + +# +# The following commented items are for things that exist within +# usr/src/cmd/sgs, but which are not normally considered to be +# part of the SUNWonld package. It is possible to add these items +# to a special-purpose SUNWonld by uncommenting the appropriate lines. +# + +# /usr/share/lib/ccs is needed by: gprof, lex, yacc +#d none $SGSDIR/usr/share 755 root bin +#d none $SGSDIR/usr/share/lib 755 root bin +#d none $SGSDIR/usr/share/lib/ccs 755 root bin + +#f none $SGSDIR/usr/bin/ar=usr/bin/ar 555 root bin +#s none $SGSDIR/usr/ccs/bin/ar=../../bin/ar +#f none $SGSDIR/usr/xpg4/bin/ar=usr/xpg4/bin/ar 0555 root bin + +#f none $SGSDIR/usr/bin/error=usr/bin/error 555 root bin +#s none $SGSDIR/usr/ccs/bin/error=../../bin/error + +#f none $SGSDIR/usr/bin/gprof=usr/bin/gprof 555 root bin +#s none $SGSDIR/usr/ccs/bin/gprof=../../bin/gprof +#f none $SGSDIR/usr/share/lib/ccs/gprof.callg.blurb=usr/share/lib/ccs/gprof.callg.blurb 444 root bin +#f none $SGSDIR/usr/share/lib/ccs/gprof.flat.blurb=usr/share/lib/ccs/gprof.flat.blurb 444 root bin + +#f none $SGSDIR/usr/bin/lex=usr/bin/lex 555 root bin +#s none $SGSDIR/usr/ccs/bin/lex=../../bin/lex +#f none $SGSDIR/usr/share/lib/ccs/nceucform=usr/share/lib/ccs/nceucform 644 root bin +#f none $SGSDIR/usr/share/lib/ccs/ncform=usr/share/lib/ccs/ncform 644 root bin +#f none $SGSDIR/usr/share/lib/ccs/nrform=usr/share/lib/ccs/nrform 644 root bin +#f none $SGSDIR/usr/lib/libl.so.1=usr/lib/libl.so.1 755 root bin +#s none $SGSDIR/usr/lib/libl.so=./libl.so.1 +#f none $SGSDIR/usr/lib/llib-ll.ln=usr/lib/llib-ll.ln 644 root bin +#f none $SGSDIR/usr/lib/llib-ll=usr/lib/llib-ll 644 root bin + +#f none $SGSDIR/usr/bin/lorder=usr/bin/lorder 555 root bin +#s none $SGSDIR/usr/ccs/bin/lorder=../../bin/lorder + +#f none $SGSDIR/usr/bin/m4=usr/bin/m4 555 root bin +#s none $SGSDIR/usr/ccs/bin/m4=../../bin/m4 +#f none $SGSDIR/usr/xpg4/bin/m4=usr/xpg4/bin/m4 0555 root bin + +#f none $SGSDIR/usr/bin/prof=usr/bin/prof 555 root bin +#s none $SGSDIR/usr/ccs/bin/prof=../../bin/prof + +#f none $SGSDIR/usr/bin/ranlib=usr/bin/ranlib 555 root bin +#s none $SGSDIR/usr/ccs/bin/ranlib=../../bin/ranlib + +#f none $SGSDIR/usr/bin/size=usr/bin/size 555 root bin +#s none $SGSDIR/usr/ccs/bin/size=../../bin/size + +#f none $SGSDIR/usr/bin/symorder=usr/bin/symorder 555 root bin +#s none $SGSDIR/usr/ccs/bin/symorder=../../bin/symorder + +#f none $SGSDIR/usr/bin/tsort=usr/bin/tsort 555 root bin +#s none $SGSDIR/usr/ccs/bin/tsort=../../bin/tsort + +#f none $SGSDIR/usr/bin/unifdef=usr/bin/unifdef 555 root bin +#s none $SGSDIR/usr/ccs/bin/unifdef=../../bin/unifdef + +#f none $SGSDIR/usr/bin/yacc=usr/bin/yacc 555 root bin +#s none $SGSDIR/usr/ccs/bin/yacc=../../bin/yacc +#f none $SGSDIR/usr/share/lib/ccs/yaccpar=usr/share/lib/ccs/yaccpar 644 root bin +#s none $SGSDIR/usr/ccs/bin/yaccpar=../../share/lib/ccs/yaccpar +#f none $SGSDIR/usr/lib/liby.so.1=usr/lib/liby.so.1 755 root bin +#s none $SGSDIR/usr/lib/liby.so=./liby.so.1 +#f none $SGSDIR/usr/lib/llib-ly.ln=usr/lib/llib-ly.ln 644 root bin +#f none $SGSDIR/usr/lib/llib-ly=usr/lib/llib-ly 644 root bin diff --git a/usr/src/cmd/sgs/packages/common/prototype_i386 b/usr/src/cmd/sgs/packages/common/prototype_i386 index 1c7751b868..52b1ed359c 100644 --- a/usr/src/cmd/sgs/packages/common/prototype_i386 +++ b/usr/src/cmd/sgs/packages/common/prototype_i386 @@ -101,3 +101,20 @@ f none opt/SUNWonld/lib/amd64/libldmake.so.1 755 root bin f none opt/SUNWonld/lib/amd64/bindings.so.1 755 root bin f none opt/SUNWonld/lib/amd64/perfcnt.so.1 755 root bin f none opt/SUNWonld/lib/amd64/symbindrep.so.1 755 root bin + +# +# The following commented items are for things that exist within +# usr/src/cmd/sgs, but which are not normally considered to be +# part of the SUNWonld package. It is possible to add these items +# to a special-purpose SUNWonld by uncommenting the appropriate lines. +# +#f none $SGSDIR/usr/lib/amd64/libl.so.1=usr/lib/amd64/libl.so.1 755 root bin +#s none $SGSDIR/usr/lib/amd64/libl.so=./libl.so.1 +#f none $SGSDIR/usr/lib/amd64/llib-ll.ln=usr/lib/amd64/llib-ll.ln 644 root bin + +#f none $SGSDIR/usr/bin/amd64/size=usr/bin/amd64/size 555 root bin +#s none $SGSDIR/usr/ccs/bin/amd64/size=../../../bin/amd64/size + +#f none $SGSDIR/usr/lib/amd64/liby.so.1=usr/lib/amd64/liby.so.1 755 root bin +#s none $SGSDIR/usr/lib/amd64/liby.so=./liby.so.1 +#f none $SGSDIR/usr/lib/amd64/llib-ly.ln=usr/lib/amd64/llib-ly.ln 644 root bin diff --git a/usr/src/cmd/sgs/packages/common/prototype_sparc b/usr/src/cmd/sgs/packages/common/prototype_sparc index 3172f099f1..cd676819c6 100644 --- a/usr/src/cmd/sgs/packages/common/prototype_sparc +++ b/usr/src/cmd/sgs/packages/common/prototype_sparc @@ -102,3 +102,20 @@ f none opt/SUNWonld/lib/sparcv9/libldmake.so.1 755 root bin f none opt/SUNWonld/lib/sparcv9/bindings.so.1 755 root bin f none opt/SUNWonld/lib/sparcv9/perfcnt.so.1 755 root bin f none opt/SUNWonld/lib/sparcv9/symbindrep.so.1 755 root bin + +# +# The following commented items are for things that exist within +# usr/src/cmd/sgs, but which are not normally considered to be +# part of the SUNWonld package. It is possible to add these items +# to a special-purpose SUNWonld by uncommenting the appropriate lines. +# +#f none $SGSDIR/usr/lib/sparcv9/libl.so.1=usr/lib/sparcv9/libl.so.1 755 root bin +#s none $SGSDIR/usr/lib/sparcv9/libl.so=./libl.so.1 +#f none $SGSDIR/usr/lib/sparcv9/llib-ll.ln=usr/lib/sparcv9/llib-ll.ln 644 root bin + +#f none $SGSDIR/usr/bin/sparcv9/size=usr/bin/sparcv9/size 555 root bin +#s none $SGSDIR/usr/ccs/bin/sparcv9/size=../../../bin/sparcv9/size + +#f none $SGSDIR/usr/lib/sparcv9/liby.so.1=usr/lib/sparcv9/liby.so.1 755 root bin +#s none $SGSDIR/usr/lib/sparcv9/liby.so=./liby.so.1 +#f none $SGSDIR/usr/lib/sparcv9/llib-ly.ln=usr/lib/sparcv9/llib-ly.ln 644 root bin diff --git a/usr/src/cmd/sgs/packages/inc.flg b/usr/src/cmd/sgs/packages/inc.flg index dc36855c1b..1df75f194d 100644 --- a/usr/src/cmd/sgs/packages/inc.flg +++ b/usr/src/cmd/sgs/packages/inc.flg @@ -58,7 +58,6 @@ find_files "s.*" \ usr/src/cmd/sgs/rtld.4.x \ usr/src/cmd/sgs/tools \ usr/src/cmd/sgs/0@0 \ - usr/src/cmd/sgs/sgsdemangler \ usr/src/common/avl \ usr/src/common/dtrace \ usr/src/common/elfcap \ diff --git a/usr/src/cmd/sgs/sgsdemangler/Makefile.com b/usr/src/cmd/sgs/prof/Makefile.com index e82b9f88e4..5d457344da 100644 --- a/usr/src/cmd/sgs/sgsdemangler/Makefile.com +++ b/usr/src/cmd/sgs/prof/Makefile.com @@ -4,7 +4,7 @@ # 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 @@ -19,24 +19,35 @@ # CDDL HEADER END # # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# ident "%Z%%M% %I% %E% SMI" +# +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# cmd/sgs/prof/Makefile.com # -LIBRARY = libdemangle.a +PROG= prof + +include $(SRC)/cmd/Makefile.cmd +include $(SRC)/cmd/sgs/Makefile.com -include $(SRC)/lib/Makefile.lib -include $(SRC)/cmd/sgs/Makefile.com +COMOBJS= prof.o profv.o lookup.o rdelf.o \ + symintOpen.o symintClose.o symintUtil.o symintErr.o symintLoad.o -CFLAGS += $(C_PICFLAGS) -CFLAGS64 += $(C_PICFLAGS64) +OBJS= $(COMOBJS) +SRCS= $(COMOBJS:%.o=../common/%.c) -CLEANFILES += llib-ldemangle.ln lint.out +INCLIST= -I../common -I../../include -I../../include/$(MACH) -OBJECTS= demangle.o +CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) +CFLAGS += $(CCVERBOSE) +C99MODE= $(C99_ENABLE) +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf +LINTSRCS = $(SRCS) +LINTFLAGS += -x +CLEANFILES += $(LINTOUTS) -CFLAGS += -erroff=E_STATEMENT_NOT_REACHED -CFLAGS64 += -erroff=E_STATEMENT_NOT_REACHED +%.o: ../common/%.c + $(COMPILE.c) $< diff --git a/usr/src/cmd/sgs/sgsdemangler/Makefile.targ b/usr/src/cmd/sgs/prof/Makefile.targ index cafe981fee..9337bf00b3 100644 --- a/usr/src/cmd/sgs/sgsdemangler/Makefile.targ +++ b/usr/src/cmd/sgs/prof/Makefile.targ @@ -19,21 +19,22 @@ # CDDL HEADER END # # +#ident "%Z%%M% %I% %E% SMI" +# # Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# cmd/sgs/prof/Makefile.targ # -objs/demangle.o: \ - ../common/demangle.c - $(COMPILE.c) -I../common -c ../common/demangle.c -o $@ -lint: $(LINTOUT) +$(PROG): $(OBJS) + $(LINK.c) $(OBJS) -o $@ $(LDLIBS) + $(POST_PROCESS) + +clean: + $(RM) $(OBJS) $(CLEANFILES) -$(LINTOUT): ../common/llib-ldemangle - perl ../../tools/lint_hdr.pl $(LIBRARY) > $(LINTOUT) - $(LINT.c) -odemangle ../common/llib-ldemangle \ - 2>&1 | tee -a $(LINTOUT) +include $(SRC)/cmd/Makefile.targ +include $(SRC)/cmd/sgs/Makefile.targ -include $(SRC)/lib/Makefile.targ diff --git a/usr/src/cmd/sgs/prof/common/prof.c b/usr/src/cmd/sgs/prof/common/prof.c index 8b6dc1e660..c20a3888f6 100644 --- a/usr/src/cmd/sgs/prof/common/prof.c +++ b/usr/src/cmd/sgs/prof/common/prof.c @@ -67,7 +67,7 @@ #include <errno.h> #include <dlfcn.h> #include <ctype.h> -#include "sgs.h" +#include "conv.h" #include "symint.h" #include "sys/param.h" /* for HZ */ #include "mon.h" @@ -1314,10 +1314,10 @@ char *format_buf; static char * demangled_name(char *s) { - char *name; + const char *name; size_t len; - name = sgs_demangle(s); + name = conv_demangle_name(s); if (strcmp(name, s) == 0) return (s); diff --git a/usr/src/cmd/sgs/prof/common/profv.c b/usr/src/cmd/sgs/prof/common/profv.c index cdf7adb5b0..4f9b72596e 100644 --- a/usr/src/cmd/sgs/prof/common/profv.c +++ b/usr/src/cmd/sgs/prof/common/profv.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 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -35,6 +34,7 @@ #include <stdlib.h> #include <string.h> +#include "conv.h" #include "profv.h" bool time_in_ticks = FALSE; @@ -59,13 +59,14 @@ cmp_by_name(const void *arg1, const void *arg2) static void setup_demangled_names(void) { - char *p, *nbp, *nbe, *namebuf; + const char *p; + char *nbp, *nbe, *namebuf; size_t cur_len = 0, namebuf_sz = BUCKET_SZ; size_t i, namelen; if ((namebuf = malloc(namebuf_sz)) == NULL) { (void) fprintf(stderr, "%s: can't allocate %d bytes\n", - cmdname, namebuf_sz); + cmdname, namebuf_sz); exit(ERR_MEMORY); } @@ -73,7 +74,7 @@ setup_demangled_names(void) nbe = namebuf + namebuf_sz; for (i = 0; i < total_funcs; i++) { - if ((p = sgs_demangle(profsym[i].name)) == NULL) + if ((p = conv_demangle_name(profsym[i].name)) == NULL) continue; namelen = strlen(p); @@ -176,11 +177,11 @@ print_profile_data(void) * same as previous or next (if there's one) ? */ if (i && (strcmp(profsym[i].demangled_name, - profsym[i-1].demangled_name) == 0)) { + profsym[i-1].demangled_name) == 0)) { profsym[i].print_mid = TRUE; } else if ((i < (total_funcs - 1)) && - (strcmp(profsym[i].demangled_name, - profsym[i+1].demangled_name) == 0)) { + (strcmp(profsym[i].demangled_name, + profsym[i+1].demangled_name) == 0)) { profsym[i].print_mid = TRUE; } } @@ -229,10 +230,10 @@ print_profile_data(void) cumsecs += profsym[i].seconds; (void) printf("%6.1f%8.2f%8.2f", profsym[i].percent_time, - profsym[i].seconds, cumsecs); + profsym[i].seconds, cumsecs); (void) printf("%8d%12.4f ", - profsym[i].ncalls, profsym[i].msecs_per_call); + profsym[i].ncalls, profsym[i].msecs_per_call); if (profsym[i].print_mid) (void) printf("%d:", (profsym[i].module)->id); @@ -248,21 +249,21 @@ print_profile_data(void) if (flags & F_VERBOSE) { (void) puts("\n"); (void) printf("%s Total Object Modules %7d\n", - filler, n_modules); + filler, n_modules); (void) printf("%s Qualified Symbols %7d\n", - filler, total_funcs); + filler, total_funcs); (void) printf("%s Symbols with zero usage %7d\n", - filler, n_zeros); + filler, n_zeros); (void) printf("%s Total pc-hits %7d\n", - filler, n_pcsamples); + filler, n_pcsamples); (void) printf("%s Accounted pc-hits %7d\n", - filler, n_accounted_ticks); + filler, n_accounted_ticks); if ((!gflag) && (n_pcsamples - n_accounted_ticks)) { (void) printf("%s Missed pc-hits (try -g) %7d\n\n", - filler, n_pcsamples - n_accounted_ticks); + filler, n_pcsamples - n_accounted_ticks); } else { (void) printf("%s Missed pc-hits %7d\n\n", - filler, n_pcsamples - n_accounted_ticks); + filler, n_pcsamples - n_accounted_ticks); } (void) printf("%s Module info\n", filler); for (mi = &modules; mi; mi = mi->next) @@ -307,7 +308,7 @@ check_dupnames(void) if (i && (strcmp(pn[i].name, pn[i-1].name) == 0)) (pn[i].pfrec)->print_mid = TRUE; else if ((i < (total_funcs - 1)) && - (strcmp(pn[i].name, pn[i+1].name) == 0)) { + (strcmp(pn[i].name, pn[i+1].name) == 0)) { (pn[i].pfrec)->print_mid = TRUE; } } @@ -330,10 +331,10 @@ compute_times(nltype *nl, profrec_t *psym) if (time_in_ticks) { psym->seconds = (double)nl->nticks; if (nl->ncalls) { - psym->msecs_per_call = (double)nl->nticks / - (double)nl->ncalls; + psym->msecs_per_call = (double)nl->nticks / + (double)nl->ncalls; } else - psym->msecs_per_call = (double)0.0; + psym->msecs_per_call = (double)0.0; } else { psym->seconds = (double)nl->nticks / (double)hz; if (nl->ncalls) { @@ -512,7 +513,7 @@ process_cgraph(ProfCallGraph *cgp) nltype *nl; for (callee_off = cgp->functions; callee_off; - callee_off = calleep->next_to) { + callee_off = calleep->next_to) { /* LINTED: pointer cast */ calleep = (ProfFunction *)((char *)cgp + callee_off); @@ -528,7 +529,7 @@ process_cgraph(ProfCallGraph *cgp) continue; if (calleep->topc >= mi->load_base && - calleep->topc < mi->load_end) { + calleep->topc < mi->load_end) { /* * nllookup() returns the next lower entry * point on a miss. So just make sure the @@ -536,7 +537,7 @@ process_cgraph(ProfCallGraph *cgp) */ if (nl = nllookup(mi, calleep->topc, 0)) { f_end = mi->load_base + (nl->value - - mi->txt_origin) + nl->size; + mi->txt_origin) + nl->size; if (calleep->topc < f_end) nl->ncalls += calleep->count; } @@ -607,7 +608,7 @@ is_same_as_aout(char *modpath, struct stat *buf) } if ((buf->st_dev == aout_stat.st_dev) && - (buf->st_ino == aout_stat.st_ino)) { + (buf->st_ino == aout_stat.st_ino)) { return (TRUE); } else return (FALSE); @@ -646,8 +647,8 @@ process_modules(ProfModuleList *modlp) */ so_path = (caddr_t)modlp + newmodp->path; if (does_overlap(newmodp, &modules) || - is_same_as_aout(so_path, &so_statbuf) || - (!is_shared_obj(so_path))) { + is_same_as_aout(so_path, &so_statbuf) || + (!is_shared_obj(so_path))) { if (!newmodp->next) more_modules = FALSE; @@ -710,7 +711,7 @@ process_modules(ProfModuleList *modlp) /* Create this module's nameslist */ new_module = get_shobj_syms(so_path, - newmodp->startaddr, newmodp->endaddr); + newmodp->startaddr, newmodp->endaddr); /* Add it to the tail of active module list */ last->next = new_module; @@ -759,8 +760,8 @@ process_mon_out(caddr_t memp, size_t fsz) default : (void) fprintf(stderr, - "%s: unknown prof object type=%d\n", - cmdname, objp->type); + "%s: unknown prof object type=%d\n", + cmdname, objp->type); exit(ERR_INPUT); } /* LINTED: pointer cast */ @@ -863,7 +864,7 @@ profver(void) exit(ERR_SYSCALL); } if ((fmem = mmap(0, monout_stat.st_size, - PROT_READ, MAP_PRIVATE, fd, 0)) == MAP_FAILED) { + PROT_READ, MAP_PRIVATE, fd, 0)) == MAP_FAILED) { perror("mmap"); exit(ERR_SYSCALL); } diff --git a/usr/src/cmd/sgs/prof/common/profv.h b/usr/src/cmd/sgs/prof/common/profv.h index 4636ce55a9..11e997584d 100644 --- a/usr/src/cmd/sgs/prof/common/profv.h +++ b/usr/src/cmd/sgs/prof/common/profv.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. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -47,6 +46,7 @@ extern "C" { #include <sys/elf.h> #include "gelf.h" #include "monv.h" +#include "_machelf.h" /* * Booleans. @@ -163,12 +163,6 @@ struct profnames { typedef struct profnames profnames_t; /* - * st_info is the same size (1 byte) in both ELF64 and ELF32 - */ -#define ELF_ST_TYPE(info) ELF64_ST_TYPE(info) -#define ELF_ST_BIND(info) ELF64_ST_BIND(info) - -/* * File status. */ extern struct stat aout_stat, monout_stat; @@ -181,11 +175,6 @@ extern size_t n_pcsamples, n_accounted_ticks, n_zeros, total_funcs; extern double total_time; /* - * Imported declarations - */ -extern char *sgs_demangle(char *); - -/* * Other declarations */ extern void profver(void); diff --git a/usr/src/cmd/sgs/prof/i386/Makefile b/usr/src/cmd/sgs/prof/i386/Makefile index 9e27b8ee4c..ff45d0d4a5 100644 --- a/usr/src/cmd/sgs/prof/i386/Makefile +++ b/usr/src/cmd/sgs/prof/i386/Makefile @@ -27,47 +27,16 @@ # cmd/sgs/prof/i386/Makefile # -PROG= prof +include ../Makefile.com -include ../../../Makefile.cmd - -COMOBJS= prof.o profv.o lookup.o rdelf.o \ - symintOpen.o symintClose.o symintUtil.o symintErr.o symintLoad.o - -OBJS= $(COMOBJS) - -SRCS= $(COMOBJS:%.o=../common/%.c) - - -INCLIST= -I../common -I../../include -I../../include/i386 DEFLIST= -DI386 -DELF -CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -CFLAGS += $(CCVERBOSE) -C99MODE= $(C99_ENABLE) -LDLIBS += -L../../sgsdemangler/$(MACH) -ldemangle -lelf -LINTFLAGS += $(LDLIBS) -CLEANFILES += $(LINTOUT) - -%.o: ../common/%.c - $(COMPILE.c) $< .KEEP_STATE: all: $(PROG) -$(PROG): $(OBJS) - $(LINK.c) $(OBJS) -o $@ $(LDLIBS) - $(POST_PROCESS) - install: all $(ROOTPROG) $(ROOTCCSBINLINK) -clean: - $(RM) $(OBJS) $(CLEANFILES) - -lint: $(LINTOUT) - -$(LINTOUT): $(SRCS) - perl ../../tools/lint_hdr.pl $(PROG) > $(LINTOUT) - $(LINT.c) $(SRCS) 2>&1 | tee -a $(LINTOUT) +lint: $(LINTOUT32) $(SGSLINTOUT) -include ../../../Makefile.targ +include ../Makefile.targ diff --git a/usr/src/cmd/sgs/prof/sparc/Makefile b/usr/src/cmd/sgs/prof/sparc/Makefile index da8dc6b58b..66d729b45f 100644 --- a/usr/src/cmd/sgs/prof/sparc/Makefile +++ b/usr/src/cmd/sgs/prof/sparc/Makefile @@ -27,47 +27,16 @@ # cmd/sgs/prof/sparc/Makefile # -PROG= prof +include ../Makefile.com -include ../../../Makefile.cmd - -COMOBJS= prof.o profv.o lookup.o rdelf.o \ - symintOpen.o symintClose.o symintUtil.o symintErr.o symintLoad.o - -OBJS= $(COMOBJS) - -SRCS= $(COMOBJS:%.o=../common/%.c) - - -INCLIST= -I../common -I../../include -I../../include/sparc DEFLIST= -DSPARC -DELF -CPPFLAGS= $(INCLIST) $(DEFLIST) $(CPPFLAGS.master) -CFLAGS += $(CCVERBOSE) -C99MODE= $(C99_ENABLE) -LDLIBS += -L../../sgsdemangler/$(MACH) -ldemangle -lelf -LINTFLAGS += $(LDLIBS) -CLEANFILES += $(LINTOUT) - -%.o: ../common/%.c - $(COMPILE.c) $< .KEEP_STATE: all: $(PROG) -$(PROG): $(OBJS) - $(LINK.c) $(OBJS) -o $@ $(LDLIBS) - $(POST_PROCESS) - install: all $(ROOTPROG) $(ROOTCCSBINLINK) -clean: - $(RM) $(OBJS) $(CLEANFILES) - -lint: $(LINTOUT) - -$(LINTOUT): $(SRCS) - perl ../../tools/lint_hdr.pl $(PROG) > $(LINTOUT) - $(LINT.c) $(SRCS) >> $(LINTOUT) 2>&1 +lint: $(LINTOUT32) $(SGSLINTOUT) -include ../../../Makefile.targ +include ../Makefile.targ diff --git a/usr/src/cmd/sgs/sgsdemangler/Makefile b/usr/src/cmd/sgs/sgsdemangler/Makefile deleted file mode 100644 index 953322fca2..0000000000 --- a/usr/src/cmd/sgs/sgsdemangler/Makefile +++ /dev/null @@ -1,29 +0,0 @@ -# -# 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. -# -# 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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# - -# Copyright (c) 1997 by Sun Microsystems, Inc. -# All rights reserved. - -include Makefile.sub diff --git a/usr/src/cmd/sgs/sgsdemangler/Makefile.sub b/usr/src/cmd/sgs/sgsdemangler/Makefile.sub deleted file mode 100644 index f1974766fb..0000000000 --- a/usr/src/cmd/sgs/sgsdemangler/Makefile.sub +++ /dev/null @@ -1,49 +0,0 @@ -# -# 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. -# -# 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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# - -# Copyright (c) 1998-1999 by Sun Microsystems, Inc. -# All rights reserved. - -include ../../../Makefile.master - -SUBDIRS= $(MACH) $(BUILD64) $(MACH64) - -all := TARGET= all -clean := TARGET= clean -clobber := TARGET= clobber -delete := TARGET= delete -install := TARGET= install -lint := TARGET= lint -catalog := TARGET= catalog -package := TARGET= package - -.KEEP_STATE: - -all clean clobber delete install lint catalog package: $(SUBDIRS) - -$(MACH) $(MACH64): FRC - @cd $@; pwd; $(MAKE) $(TARGET) - -FRC: diff --git a/usr/src/cmd/sgs/sgsdemangler/amd64/Makefile b/usr/src/cmd/sgs/sgsdemangler/amd64/Makefile deleted file mode 100644 index 8597b35a4e..0000000000 --- a/usr/src/cmd/sgs/sgsdemangler/amd64/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# -# 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. -# -# 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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1998,2001 by Sun Microsystems, Inc. -# All rights reserved. - -include ../Makefile.com - -all install: $(LIBRARY) - -include ../Makefile.targ -include ../../Makefile.sub.64 diff --git a/usr/src/cmd/sgs/sgsdemangler/common/README.dem b/usr/src/cmd/sgs/sgsdemangler/common/README.dem deleted file mode 100644 index 5041a3880d..0000000000 --- a/usr/src/cmd/sgs/sgsdemangler/common/README.dem +++ /dev/null @@ -1,327 +0,0 @@ -# -# 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. -# -# 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 -# -/*ident "@(#)cls4:tools/demangler/README.dem 1.3" */ -#ident "%Z%%M% %I% %E% SMI" - -############################################################################### -# -# C++ source for the C++ Language System, Release 3.0. This product -# is a new release of the original cfront developed in the computer -# science research center of AT&T Bell Laboratories. -# -# Copyright (c) 1991 AT&T and UNIX System Laboratories, Inc. -# Copyright (c) 1984, 1989, 1990 AT&T. All Rights Reserved. -# -############################################################################### -Demangler Release Notes for 3.0.1 -January 1992 - - -INTRODUCTION - -This is the first release of the new C++ external name demangler. It -was rewritten for a couple of reasons, notably the desire to separate -the unmangling and printing functions and the need to fully support -template names and nested class names. - -In what follows it is assumed that the reader is familiar with page -122 and following of the Annotated C++ Reference Manual, where the -name mangling scheme is given. - - -INSTALLATION AND CUSTOMIZATION - -The demangler has two files, dem.h and dem.c. dem.h is #included in -user programs. dem.c can be compiled either for a standalone program: - - $ cc -DDEM_MAIN dem.c -o dem - -or to produce an object to be linked with an application: - - $ cc -c dem.c - - ... - - $ cc appl.o dem.o - -The standard main() driver program in dem.c will read from standard -input or from a set of command-line files, and unmangle names in -place, while passing all whitespace and invalid names through -unchanged. - -There are a couple of customization options. CLIP_UNDER should be set -(#defined) at the top of dem.c if external names on your system have a -leading underscore added to them. This is common, for example on the -Sun SPARCstation. An #if has been added for the most common machine -types. - -dem.c uses its own space management system both for speed and to avoid -having to call malloc(). SP_ALIGN is the alignment of blocks that are -allocated; 4 bytes is the default. If your system requires alignment -on other than a power-of-2 boundary, you will have to adjust the -function gs() to use the mod operator rather than the mask technique -that is used by default. - -There is a constant MAXDBUF defined in dem.h. This is the maximum -size of buffer required for an unmangled name's data structure. The -4096 size is the worst-case setting for a maximum input mangled name -length of 256. If you routinely have names longer than this, you -should adjust MAXDBUF upwards accordingly. - -Finally, there is a compile-time value EXPLAIN that can be set. If -turned on with -DEXPLAIN, the demanger will append a brief description -of the type of each input name to the demangled output. - - -USE OF THE STANDALONE DEMANGLER - -The standalone program reads from standard input or from one or more -files and processes each line in turn. All whitespace and -non-alphanumeric characters are passed through unchanged. All other -characters are separated into names and given to the demangler. If -the demangler fails, the name is printed unchanged. Otherwise, the -unmangled name is printed. - -The standalone demangler has an exit status of 0 unless one or more -input files could not be opened for reading; in that case the exit -status is the number of unopenable files. - - -USE OF THE DEMANGLER LIBRARY - -The basic idea is to call the dem() function: - - int ret; - char inbuf[1024]; - DEM d; - char sbuf[MAXDBUF]; - - ret = dem(inbuf, &d, sbuf); - -inbuf is the input name, d the data structure that dem() fills up, and -sbuf the internal buffer that the demangler writes into to allocate -its data structure. - -dem() returns -1 on error, otherwise 0. - -dem.h has comments describing each field in the data structures. The -data structures are somewhat complicated by the need to handle nested -types and function arguments which themselves are function pointers -with their own arguments. - -To format this data structure, there are several functions: - - dem_print - format a complete name - - dem_printcl - format a class name - - dem_printarg - format a function argument - - dem_printarglist - format a function argument list - - dem_printfunc - format a function name - - dem_explain - return a string explaining a type - - demangle - demangle in (char*) to out (char*) - - -AN EXAMPLE APPLICATION - -This particular application reads from standard input and displays the -class name for each mangled name read, or "(none)" on errors and C -functions/data. - - #include <stdio.h> - #include "dem.h" - - main() - { - char sbuf[MAXDBUF]; - DEM d; - int ret; - char buf[1024]; - char buf2[1024]; - - while (gets(buf) != NULL) { - ret = dem(buf, &d, sbuf); - if (ret || d.cl == NULL) { - printf("%s --> (none)\n", buf); - } - else { - dem_printcl(d.cl, buf2); - printf("%s --> %s\n", buf, buf2); - } - } - } - - -TYPENAMES - -The demangler handles mangled class typenames, whether they are -simple, nested, or template classes. For example: - - A__pt__2_i --> A<int> - - __Q2_1A1B --> A::B - - -LOCAL VARIABLES - -The demangler also handles local variables of the form: - - __nnnxxx - -For example: - - __2x --> x - -USE OF THE OLD C++FILT PROGRAM - -Many of the previously supported options to c++filt are no longer -supported. If you need to use them, you can build the old c++filt -using the source in the subdirectory "osrc". Note that we are -planning to eliminate them in a future release, so please send mail to -your C++ support person explaining what option you needed and why. - - -KNOWN BUGS AND AMBIGUITIES - -1. "signed" and "volatile" encodings are not handled. - -2. The encoding for nested classes as mentioned on page 123 of the -ARM is handled slightly differently in cfront; there is a "_" after -the digit after the "Q". - -3. A nested class starting with "Q" sometimes has the length encoded -before it; the demangler handles either case. - -4. The "Tnn" and "Nnnn" notations mentioned on page 124 are not fully -supported. It is assumed that the number of the designated argument -is less than or equal to 9. So if you have 11 or more arguments, and -you want to repeat argument 10 or greater, the demangler will reject -the encoded name. - -5. All literal arguments to templates are assumed to be const. For -example, the non-const literal value "37" is encoded as "Ci". - -6. Some compilers will add a gratuitous "_" before external names. - -7. The grammar allows class names up to 999 characters. This is -considered important for handling templates. - - -THE GRAMMAR FOR EXTERNAL NAMES - -start --> name - -######################### COMPLETE NAMES ######################### - -name --> sti | std | ptbl | func | data | vtbl | cname3 | local - -sti --> "__sti" "__" id - -std --> "__std" "__" id - -ptbl --> "__ptbl_vec" "__" id - -func --> "__op" arg funcpost | id funcpost - -funcpost --> "__" funcpost2 | "__" cname funcpost2 - -funcpost2 --> csv "F" arglist - -csv --> "" | "C" | "S" | "V" - -data --> id | id "__" cname - -vtbl --> "__vtbl" "__" cname - -local --> "__" num regid - -######################### CLASS NAMES ######################### - -cname --> cname2 | nest - -nest --> "Q" digit "_" cnamelist - -cnamelist --> cname2 | cnamelist cname2 - -cname2 --> cnlen cnid - -cname3 --> cnid | "__" nest - -cnlen --> digit | digit digit | digit digit digit - -cnid --> id | id "__pt__" cnlen "_" arglist - -######################### ARGUMENT LISTS ######################### - -arglist --> arg | arglist arg - -arg --> modlist arg2 | "X" modlist arg2 lit - -modlist --> mod | modlist mod - -mod --> "" | "U" | "C" | "V" | "S" | "P" | "R" | arr | mptr - -arr --> "A" num "_" - -mptr --> "M" cname - -arg2 --> fund | cname | funcp | repeat1 | repeat2 - -fund --> "v" | "c" | "s" | "i" | "l" | "f" | "d" | "r" | "e" - -funcp --> "F" arglist "_" arg - -repeat1 --> "T" digit | "T" digit digit - -repeat2 --> "N" digit digit | "N" digit digit digit - -lit --> litnum | zero | litmptr | cnlen id | sptr - -litnum --> "L" digit lnum | "L" digit digit "_" lnum - -litmptr --> "LM" num "_" litnum "_" cnlen id - -lnum --> num | "n" num - -sptr --> cnlen id "__" cname - -zero --> 0 - -######################### LOW LEVEL STUFF ######################### - -digit --> 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 - -id --> special | regid - -special --> "__ct" | "__pp" # etc. - -regid --> letter | letter restid - -restid --> letter | digit | restid letter | restid digit - -letter --> "A"-"Z" | "a" - "z" | "_" - -num --> digit | num digit diff --git a/usr/src/cmd/sgs/sgsdemangler/common/demangle.c b/usr/src/cmd/sgs/sgsdemangler/common/demangle.c deleted file mode 100644 index 718ec40497..0000000000 --- a/usr/src/cmd/sgs/sgsdemangler/common/demangle.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include <stdio.h> -#include <stdlib.h> -#include <dlfcn.h> - -/* - * C++ Demangling - */ -#define LIBDEMANGLE "libdemangle.so.1" -#define DEMANGLEFUNC "cplus_demangle" - -#define MAXDBUF 1024 - -char * -sgs_demangle(char *name) -{ - static char *demangled_name; - static int (*demangle_func)() = NULL; - static int first_flag = 0; - static int size = MAXDBUF; - int ret; - - /* - * Determine if libdemangle is available. - */ - if (first_flag == 0) { - void *demangle_hand; - - demangle_hand = dlopen(LIBDEMANGLE, RTLD_LAZY); - if (demangle_hand != NULL) - demangle_func = (int (*)(int))dlsym( - demangle_hand, DEMANGLEFUNC); - - first_flag = 1; - } - - /* - * Pass through name untouched if libdemangle is not available. - */ - if (demangle_func == NULL) - return (name); - - /* - * If this is the first call (or malloc() failed previously) allocate a - * new buffer for storage. - */ - if (demangled_name == NULL) { - size = MAXDBUF; - demangled_name = malloc(size); - if (demangled_name == NULL) - return (name); - } - - /* - * libdemangle returns -1 when the buffer size is not sufficient. - */ - while ((ret = (*demangle_func)(name, demangled_name, size)) == -1) { - free(demangled_name); - size = size + MAXDBUF; - demangled_name = malloc(size); - if (demangled_name == NULL) - return (name); - } - - if (ret != 0) - return (name); - return (demangled_name); -} diff --git a/usr/src/cmd/sgs/sgsdemangler/common/llib-ldemangle b/usr/src/cmd/sgs/sgsdemangler/common/llib-ldemangle deleted file mode 100644 index e81aafce15..0000000000 --- a/usr/src/cmd/sgs/sgsdemangler/common/llib-ldemangle +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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. - * - * 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 - */ -/* LINTLIBRARY */ -/* PROTOLIB1 */ - -/* - * Copyright (c) 1997 by Sun Microsystems, Inc. - * All rights reserved. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -char * sgs_demangle(char *); diff --git a/usr/src/cmd/sgs/sgsdemangler/i386/Makefile b/usr/src/cmd/sgs/sgsdemangler/i386/Makefile deleted file mode 100644 index aedb48ac58..0000000000 --- a/usr/src/cmd/sgs/sgsdemangler/i386/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# -# 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. -# -# 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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1998,2001 by Sun Microsystems, Inc. -# All rights reserved. - -include ../Makefile.com - -all install: $(LIBRARY) - -include ../Makefile.targ diff --git a/usr/src/cmd/sgs/sgsdemangler/sparc/Makefile b/usr/src/cmd/sgs/sgsdemangler/sparc/Makefile deleted file mode 100644 index aedb48ac58..0000000000 --- a/usr/src/cmd/sgs/sgsdemangler/sparc/Makefile +++ /dev/null @@ -1,32 +0,0 @@ -# -# 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. -# -# 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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1998,2001 by Sun Microsystems, Inc. -# All rights reserved. - -include ../Makefile.com - -all install: $(LIBRARY) - -include ../Makefile.targ diff --git a/usr/src/cmd/sgs/sgsdemangler/sparcv9/Makefile b/usr/src/cmd/sgs/sgsdemangler/sparcv9/Makefile deleted file mode 100644 index 8597b35a4e..0000000000 --- a/usr/src/cmd/sgs/sgsdemangler/sparcv9/Makefile +++ /dev/null @@ -1,33 +0,0 @@ -# -# 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. -# -# 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 -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1998,2001 by Sun Microsystems, Inc. -# All rights reserved. - -include ../Makefile.com - -all install: $(LIBRARY) - -include ../Makefile.targ -include ../../Makefile.sub.64 diff --git a/usr/src/cmd/sgs/tools/lint_hdr.pl b/usr/src/cmd/sgs/tools/lint_hdr.pl index 078a6c2a8c..f08b65af66 100644 --- a/usr/src/cmd/sgs/tools/lint_hdr.pl +++ b/usr/src/cmd/sgs/tools/lint_hdr.pl @@ -66,6 +66,7 @@ $script = 'lint_hdr'; $usage = "usage: $script target [elfclass]\n"; $sub = 0; +die $usage if (scalar(@ARGV) == 0); while ($_ = $ARGV[0],/^-/) { ARG: { if (/^-s$/) { |