diff options
| author | Ali Bahrami <Ali.Bahrami@Sun.COM> | 2008-12-09 10:54:10 -0700 |
|---|---|---|
| committer | Ali Bahrami <Ali.Bahrami@Sun.COM> | 2008-12-09 10:54:10 -0700 |
| commit | d2d5cf7c5d909b74a88d499283e24750a9a52c5d (patch) | |
| tree | 84056ff7753630dde28e663a51fd53257a99a948 /usr/src/cmd/sgs | |
| parent | 3534c68111163b60e274fa816769616d177a08b7 (diff) | |
| download | illumos-joyent-d2d5cf7c5d909b74a88d499283e24750a9a52c5d.tar.gz | |
6775062 remove /usr/lib/libldstab.so
Diffstat (limited to 'usr/src/cmd/sgs')
33 files changed, 269 insertions, 1876 deletions
diff --git a/usr/src/cmd/sgs/ar/Makefile.com b/usr/src/cmd/sgs/ar/Makefile.com index 150baddead..e37d825ad4 100644 --- a/usr/src/cmd/sgs/ar/Makefile.com +++ b/usr/src/cmd/sgs/ar/Makefile.com @@ -29,7 +29,7 @@ XPG4PROG= ar include $(SRC)/cmd/Makefile.cmd COMOBJS= main.o file.o cmd.o global.o \ - message.o sbfocus_enter.o + message.o POFILE= ../ar.po @@ -37,7 +37,7 @@ OBJS= $(COMOBJS:%=objs/%) XPG4OBJS= $(COMOBJS:%=objs.xpg4/%) LLDFLAGS = '-R$$ORIGIN/../../lib' -CPPFLAGS= -I../../include -DBROWSER $(CPPFLAGS.master) +CPPFLAGS= -I../../include $(CPPFLAGS.master) CFLAGS += $(CCVERBOSE) C99MODE= $(C99_ENABLE) diff --git a/usr/src/cmd/sgs/ar/common/file.c b/usr/src/cmd/sgs/ar/common/file.c index d10161d354..7457d2e39f 100644 --- a/usr/src/cmd/sgs/ar/common/file.c +++ b/usr/src/cmd/sgs/ar/common/file.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -29,8 +29,6 @@ * */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "gelf.h" #include "inc.h" #include "extern.h" @@ -47,7 +45,7 @@ static int pad_symtab; /* # of bytes by which to pad symbol table */ * * ld(1) accesses archives by mmapping them into memory. If the mapped * objects have the proper alignment, we can access them directly. If the - * alignment is wrong, elflib "slides" them so that they are also accessible. + * alignment is wrong, libelf "slides" them so that they are also accessible. * This is expensive in time (to copy memory) and space (it causes swap * to be allocated by the system to back the now-modified pages). Hence, we * really want to ensure that the alignment is right. @@ -74,7 +72,7 @@ static int pad_symtab; /* # of bytes by which to pad symbol table */ static long mklong_tab(int *); static char *trimslash(char *s); -static long mksymtab(ARFILEP **, Cmd_info *, int *); +static long mksymtab(ARFILEP **, int *); static int writesymtab(char *, long, ARFILEP *); static void savename(char *); static void savelongname(ARFILE *, char *); @@ -90,10 +88,6 @@ static int sizeofnewarchive(int, int); static int search_sym_tab(ARFILE *, Elf *, Elf_Scn *, long *, ARFILEP **, int *); -#ifdef BROWSER -static void sbrowser_search_stab(Elf *, int, int, char *); -#endif - int getaf(Cmd_info *cmd_info) @@ -104,7 +98,7 @@ getaf(Cmd_info *cmd_info) if (elf_version(EV_CURRENT) == EV_NONE) { error_message(ELF_VERSION_ERROR, - LIBELF_ERROR, elf_errmsg(-1)); + LIBELF_ERROR, elf_errmsg(-1)); exit(1); } @@ -115,7 +109,7 @@ getaf(Cmd_info *cmd_info) } else { /* problem other than "does not exist" */ error_message(SYS_OPEN_ERROR, - SYSTEM_ERROR, strerror(errno), arnam); + SYSTEM_ERROR, strerror(errno), arnam); exit(1); } } @@ -125,10 +119,10 @@ getaf(Cmd_info *cmd_info) if (elf_kind(cmd_info->arf) != ELF_K_AR) { error_message(NOT_ARCHIVE_ERROR, - PLAIN_ERROR, (char *)0, arnam); + PLAIN_ERROR, (char *)0, arnam); if (opt_FLAG(cmd_info, a_FLAG) || opt_FLAG(cmd_info, b_FLAG)) - error_message(USAGE_06_ERROR, - PLAIN_ERROR, (char *)0, cmd_info->ponam); + error_message(USAGE_06_ERROR, + PLAIN_ERROR, (char *)0, cmd_info->ponam); exit(1); } return (fd); @@ -173,9 +167,9 @@ recover_padding(Elf *elf, ARFILE *file) return; /* - * elflib always puts the section header array at the end + * libelf always puts the section header array at the end * of the object, and all of our compilers and other tools - * use elflib or follow this convention. So, it is extremely + * use libelf or follow this convention. So, it is extremely * likely that the section header array is at the end of this * object: Find the address at the end of the array and compare * it to the archive ar_size. If they are within PADSZ bytes, then @@ -183,7 +177,7 @@ recover_padding(Elf *elf, ARFILE *file) * that no ELF section can fit into PADSZ bytes). */ extent = gelf_getehdr(elf, &ehdr) - ? (ehdr.e_shoff + (ehdr.e_shnum * ehdr.e_shentsize)) : 0; + ? (ehdr.e_shoff + (ehdr.e_shnum * ehdr.e_shentsize)) : 0; padding = file->ar_size - extent; if ((padding < 0) || (padding >= PADSZ)) { @@ -260,15 +254,15 @@ getfile(Cmd_info *cmd_info) if ((mem_header = elf_getarhdr(elf)) == NULL) { error_message(ELF_MALARCHIVE_ERROR, - LIBELF_ERROR, elf_errmsg(-1), - arnam, elf_getbase(elf)); + LIBELF_ERROR, elf_errmsg(-1), + arnam, elf_getbase(elf)); exit(1); } /* zip past special members like the symbol and string table members */ while (strncmp(mem_header->ar_name, "/", 1) == 0 || - strncmp(mem_header->ar_name, "//", 2) == 0) { + strncmp(mem_header->ar_name, "//", 2) == 0) { (void) elf_next(elf); (void) elf_end(elf); if ((elf = elf_begin(fd, ELF_C_READ, arf)) == 0) @@ -276,8 +270,8 @@ getfile(Cmd_info *cmd_info) /* the archive is empty or have hit the end */ if ((mem_header = elf_getarhdr(elf)) == NULL) { error_message(ELF_MALARCHIVE_ERROR, - LIBELF_ERROR, elf_errmsg(-1), - arnam, elf_getbase(elf)); + LIBELF_ERROR, elf_errmsg(-1), + arnam, elf_getbase(elf)); exit(0); } } @@ -298,7 +292,7 @@ getfile(Cmd_info *cmd_info) = malloc(strlen(mem_header->ar_name) + 1)) == NULL) { error_message(MALLOC_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); exit(1); } (void) strcpy(file->ar_longname, mem_header->ar_name); @@ -306,13 +300,13 @@ getfile(Cmd_info *cmd_info) = malloc(strlen(mem_header->ar_rawname) + 1)) == NULL) { error_message(MALLOC_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); exit(1); } tmp_rawname = mem_header->ar_rawname; file_rawname = file->ar_rawname; while (!isspace(*tmp_rawname) && - ((*file_rawname = *tmp_rawname) != '\0')) { + ((*file_rawname = *tmp_rawname) != '\0')) { file_rawname++; tmp_rawname++; } @@ -333,7 +327,7 @@ getfile(Cmd_info *cmd_info) == NULL) { if (ptr != 0) { error_message(ELF_RAWFILE_ERROR, - LIBELF_ERROR, elf_errmsg(-1)); + LIBELF_ERROR, elf_errmsg(-1)); exit(1); } } @@ -357,7 +351,7 @@ newfile(void) if ((buffer = (ARFILE *) calloc(CHUNK, sizeof (ARFILE))) == NULL) { error_message(MALLOC_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); exit(1); } count = CHUNK; @@ -404,7 +398,7 @@ trim(char *s) static long -mksymtab(ARFILEP **symlist, Cmd_info *cmd_info, int *found_obj) +mksymtab(ARFILEP **symlist, int *found_obj) { ARFILE *fptr; long mem_offset = 0; @@ -415,10 +409,6 @@ mksymtab(ARFILEP **symlist, Cmd_info *cmd_info, int *found_obj) long nsyms = 0; int class = 0; Elf_Data *data; - char *sbshstr; - char *sbshstrtp; - int sbstabsect = -1; - int sbstabstrsect = -1; int num_errs = 0; newfd = 0; @@ -434,22 +424,21 @@ mksymtab(ARFILEP **symlist, Cmd_info *cmd_info, int *found_obj) if ((newfd = open(fptr->ar_pathname, O_RDONLY)) == -1) { error_message(SYS_OPEN_ERROR, - SYSTEM_ERROR, strerror(errno), - fptr->ar_pathname); + SYSTEM_ERROR, strerror(errno), + fptr->ar_pathname); num_errs++; continue; } if ((elf = elf_begin(newfd, - ELF_C_READ, - (Elf *)0)) == 0) { + ELF_C_READ, (Elf *)0)) == 0) { if (fptr->ar_pathname != NULL) error_message(ELF_BEGIN_02_ERROR, - LIBELF_ERROR, elf_errmsg(-1), - fptr->ar_pathname); + LIBELF_ERROR, elf_errmsg(-1), + fptr->ar_pathname); else error_message(ELF_BEGIN_03_ERROR, - LIBELF_ERROR, elf_errmsg(-1)); + LIBELF_ERROR, elf_errmsg(-1)); (void) close(newfd); newfd = 0; num_errs++; @@ -458,11 +447,11 @@ mksymtab(ARFILEP **symlist, Cmd_info *cmd_info, int *found_obj) if (elf_kind(elf) == ELF_K_AR) { if (fptr->ar_pathname != NULL) error_message(ARCHIVE_IN_ARCHIVE_ERROR, - PLAIN_ERROR, (char *)0, - fptr->ar_pathname); + PLAIN_ERROR, (char *)0, + fptr->ar_pathname); else error_message(ARCHIVE_USAGE_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); if (newfd) { (void) close(newfd); newfd = 0; @@ -472,7 +461,7 @@ mksymtab(ARFILEP **symlist, Cmd_info *cmd_info, int *found_obj) } } else { error_message(INTERNAL_01_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); exit(1); } if (gelf_getehdr(elf, &ehdr) != 0) { @@ -484,11 +473,11 @@ mksymtab(ARFILEP **symlist, Cmd_info *cmd_info, int *found_obj) if (scn == NULL) { if (fptr->ar_pathname != NULL) error_message(ELF_GETSCN_01_ERROR, - LIBELF_ERROR, elf_errmsg(-1), - fptr->ar_pathname); + LIBELF_ERROR, elf_errmsg(-1), + fptr->ar_pathname); else error_message(ELF_GETSCN_02_ERROR, - LIBELF_ERROR, elf_errmsg(-1)); + LIBELF_ERROR, elf_errmsg(-1)); num_errs++; if (newfd) { (void) close(newfd); @@ -503,11 +492,11 @@ mksymtab(ARFILEP **symlist, Cmd_info *cmd_info, int *found_obj) if (data == NULL) { if (fptr->ar_pathname != NULL) error_message(ELF_GETDATA_01_ERROR, - LIBELF_ERROR, elf_errmsg(-1), - fptr->ar_pathname); + LIBELF_ERROR, elf_errmsg(-1), + fptr->ar_pathname); else error_message(ELF_GETDATA_02_ERROR, - LIBELF_ERROR, elf_errmsg(-1)); + LIBELF_ERROR, elf_errmsg(-1)); num_errs++; if (newfd) { (void) close(newfd); @@ -519,11 +508,11 @@ mksymtab(ARFILEP **symlist, Cmd_info *cmd_info, int *found_obj) if (data->d_size == 0) { if (fptr->ar_pathname != NULL) error_message(W_ELF_NO_DATA_01_ERROR, - PLAIN_ERROR, (char *)0, - fptr->ar_pathname); + PLAIN_ERROR, (char *)0, + fptr->ar_pathname); else error_message(W_ELF_NO_DATA_02_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); if (newfd) { (void) close(newfd); newfd = 0; @@ -532,7 +521,6 @@ mksymtab(ARFILEP **symlist, Cmd_info *cmd_info, int *found_obj) num_errs++; continue; } - sbshstr = (char *)data->d_buf; /* loop through sections to find symbol table */ scn = 0; @@ -541,13 +529,15 @@ mksymtab(ARFILEP **symlist, Cmd_info *cmd_info, int *found_obj) if (gelf_getshdr(scn, &shdr) == NULL) { if (fptr->ar_pathname != NULL) error_message( - ELF_GETDATA_01_ERROR, - LIBELF_ERROR, elf_errmsg(-1), - fptr->ar_pathname); + ELF_GETDATA_01_ERROR, + LIBELF_ERROR, + elf_errmsg(-1), + fptr->ar_pathname); else error_message( - ELF_GETDATA_02_ERROR, - LIBELF_ERROR, elf_errmsg(-1)); + ELF_GETDATA_02_ERROR, + LIBELF_ERROR, + elf_errmsg(-1)); if (newfd) { (void) close(newfd); newfd = 0; @@ -558,49 +548,16 @@ mksymtab(ARFILEP **symlist, Cmd_info *cmd_info, int *found_obj) } *found_obj = 1; if (shdr.sh_type == SHT_SYMTAB) - if (search_sym_tab(fptr, elf, - scn, - &nsyms, - symlist, - &num_errs) == -1) { - if (newfd) { - (void) close(newfd); - newfd = 0; + if (search_sym_tab(fptr, elf, + scn, &nsyms, symlist, + &num_errs) == -1) { + if (newfd) { + (void) close(newfd); + newfd = 0; + } + continue; } - continue; - } -#ifdef BROWSER - /* - * XX64: sbrowser_search_stab() currently gets - * confused by sb-tabs in v9. at this - * point, no one knows what v9 sb-tabs are - * supposed to look like. - */ -/* if (shdr.sh_name != 0) { */ - if ((class == ELFCLASS32) && - (shdr.sh_name != 0)) { - sbshstrtp = (char *) - ((long)sbshstr + shdr.sh_name); - if (strcmp(sbshstrtp, ".stab") == 0) { - sbstabsect = elf_ndxscn(scn); - } else if (strcmp(sbshstrtp, - ".stabstr") == 0) { - sbstabstrsect = elf_ndxscn(scn); - } - } -#endif - } -#ifdef BROWSER - if (sbstabsect != -1 || sbstabstrsect != -1) { - sbrowser_search_stab( - elf, - sbstabsect, - sbstabstrsect, - cmd_info->arnam); - sbstabsect = -1; - sbstabstrsect = -1; } -#endif } mem_offset += sizeof (struct ar_hdr) + fptr->ar_size; if (fptr->ar_size & 01) @@ -647,7 +604,7 @@ writesymtab(char *dst, long nsyms, ARFILEP *symlist) sym_tab_size += pad_symtab; (void) sprintf(buf1, FORMAT, SYMDIRNAME, time(0), (unsigned)0, - (unsigned)0, (unsigned)0, (long)sym_tab_size, ARFMAG); + (unsigned)0, (unsigned)0, (long)sym_tab_size, ARFMAG); if (strlen(buf1) != sizeof (struct ar_hdr)) { error_message(INTERNAL_02_ERROR); @@ -718,10 +675,9 @@ savename(char *symbol) diff = 0; if (str_base == (char *)0) { /* no space allocated yet */ - if ((str_base = malloc((unsigned)str_length)) - == NULL) { + if ((str_base = malloc((unsigned)str_length)) == NULL) { error_message(MALLOC_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); exit(1); } str_top = str_base; @@ -735,11 +691,12 @@ savename(char *symbol) do str_length += BUFSIZ * 2; - while (str_top > str_base + str_length); + while (str_top > str_base + str_length) + ; if ((str_base = (char *)realloc(str_base, str_length)) == NULL) { error_message(MALLOC_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); exit(1); } /* @@ -748,8 +705,7 @@ savename(char *symbol) diff = str_base - old_base; p += diff; } - for (i = 0, s = symbol; - i < strlen(symbol) && *s != '\0'; i++) { + for (i = 0, s = symbol; i < strlen(symbol) && *s != '\0'; i++) { *p++ = *s++; } *p++ = '\0'; @@ -773,7 +729,7 @@ savelongname(ARFILE *fptr, char *ptr_index) if ((str_base1 = malloc((unsigned)str_length)) == NULL) { error_message(MALLOC_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); exit(1); } str_top1 = str_base1; @@ -795,11 +751,12 @@ savelongname(ARFILE *fptr, char *ptr_index) do str_length += BUFSIZ * 2; - while (str_top1 > str_base1 + str_length); + while (str_top1 > str_base1 + str_length) + ; if ((str_base1 = (char *)realloc(str_base1, str_length)) == NULL) { error_message(MALLOC_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); exit(1); } /* @@ -809,8 +766,7 @@ savelongname(ARFILE *fptr, char *ptr_index) p += diff; } for (i = 0, s = fptr->ar_longname; - i < strlen(fptr->ar_longname) && *s != '\0'; - i++) { + i < strlen(fptr->ar_longname) && *s != '\0'; i++) { *p++ = *s++; } *p++ = '/'; @@ -836,7 +792,7 @@ writefile(Cmd_info *cmd_info) int found_obj = 0; long_tab_size = mklong_tab(&longnames); - nsyms = mksymtab(&symlist, cmd_info, &found_obj); + nsyms = mksymtab(&symlist, &found_obj); for (i = 0; signum[i]; i++) /* started writing, cannot interrupt */ @@ -845,14 +801,13 @@ writefile(Cmd_info *cmd_info) /* Is this a new archive? */ if ((access(cmd_info->arnam, 0) < 0) && (errno == ENOENT)) { - new_archive = 1; - if (!opt_FLAG(cmd_info, c_FLAG)) { - error_message(BER_MES_CREATE_ERROR, - PLAIN_ERROR, (char *)0, cmd_info->arnam); - } - } - else - new_archive = 0; + new_archive = 1; + if (!opt_FLAG(cmd_info, c_FLAG)) { + error_message(BER_MES_CREATE_ERROR, + PLAIN_ERROR, (char *)0, cmd_info->arnam); + } + } else + new_archive = 0; /* * Calculate the size of the new archive @@ -876,7 +831,7 @@ writefile(Cmd_info *cmd_info) } if (dst == NULL) { return writelargefile(cmd_info, long_tab_size, - longnames, symlist, nsyms, found_obj, new_archive); + longnames, symlist, nsyms, found_obj, new_archive); } (void) memcpy(tmp_dst, ARMAG, SARMAG); @@ -890,8 +845,8 @@ writefile(Cmd_info *cmd_info) if (longnames) { (void) sprintf(tmp_dst, FORMAT, LONGDIRNAME, time(0), - (unsigned)0, (unsigned)0, (unsigned)0, - (long)long_tab_size, ARFMAG); + (unsigned)0, (unsigned)0, (unsigned)0, + (long)long_tab_size, ARFMAG); tmp_dst += sizeof (struct ar_hdr); (void) memcpy(tmp_dst, str_base1, str_top1 - str_base1); tmp_dst += str_top1 - str_base1; @@ -913,7 +868,7 @@ writefile(Cmd_info *cmd_info) } if (strlen(fptr->ar_longname) <= (unsigned)SNAME-2) (void) sprintf(tmp_dst, FNFORMAT, - trimslash(fptr->ar_longname)); + trimslash(fptr->ar_longname)); else (void) sprintf(tmp_dst, FNFORMAT, fptr->ar_name); (void) sprintf(tmp_dst+16, TLFORMAT, fptr->ar_date, @@ -936,19 +891,18 @@ writefile(Cmd_info *cmd_info) fptr->ar_longname); exit(1); } else { - if (fread(tmp_dst, - sizeof (char), + if (fread(tmp_dst, sizeof (char), fptr->ar_size, f) != fptr->ar_size) { error_message(SYS_READ_ERROR, - SYSTEM_ERROR, strerror(errno), - fptr->ar_longname); + SYSTEM_ERROR, strerror(errno), + fptr->ar_longname); exit(1); } } (void) fclose(f); } else { (void) memcpy(tmp_dst, fptr->ar_contents, - fptr->ar_size); + fptr->ar_size); if (fptr->ar_flag & F_MALLOCED) { (void) free(fptr->ar_contents); fptr->ar_flag &= ~(F_MALLOCED); @@ -986,7 +940,7 @@ writefile(Cmd_info *cmd_info) nfd = creat(name, 0666); if (nfd == -1) { error_message(SYS_CREATE_01_ERROR, - SYSTEM_ERROR, strerror(errno), name); + SYSTEM_ERROR, strerror(errno), name); exit(1); } } else { @@ -996,23 +950,22 @@ writefile(Cmd_info *cmd_info) nfd = open(name, O_RDWR|O_TRUNC); if (nfd == -1) { error_message(SYS_WRITE_02_ERROR, - SYSTEM_ERROR, strerror(errno), name); + SYSTEM_ERROR, strerror(errno), name); exit(1); } } #ifndef XPG4 if (opt_FLAG(cmd_info, v_FLAG)) { - error_message(BER_MES_WRITE_ERROR, - PLAIN_ERROR, (char *)0, - cmd_info->arnam); + error_message(BER_MES_WRITE_ERROR, + PLAIN_ERROR, (char *)0, cmd_info->arnam); } #endif if (write(nfd, dst, arsize) != arsize) { error_message(SYS_WRITE_04_ERROR, - SYSTEM_ERROR, strerror(errno), name); + SYSTEM_ERROR, strerror(errno), name); if (!new_archive) error_message(WARN_USER_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); exit(2); } return (dst); @@ -1053,109 +1006,6 @@ sputl(long n, char *cp) *cp++ = n & 255; } -#ifdef BROWSER - -static void -sbrowser_search_stab(Elf *elf, int stabid, int stabstrid, char *arnam) -{ - Elf_Scn *stab_scn; - Elf_Scn *stabstr_scn; - Elf_Data *data; - struct nlist *np; - struct nlist *stabtab; - char *stabstrtab; - char *stabstroff; - char *symname; - int prevstabstrsz; - GElf_Xword nstab; - GElf_Shdr shdr; - - /* use the .stab and stabstr section index to find the data buffer */ - if (stabid == -1) { - error_message(SBROW_01_ERROR, - PLAIN_ERROR, (char *)0); - return; - } - stab_scn = elf_getscn(elf, (size_t)stabid); - if (stab_scn == NULL) { - error_message(ELF_GETDATA_02_ERROR, - LIBELF_ERROR, elf_errmsg(-1)); - return; - } - - (void) gelf_getshdr(stab_scn, &shdr); - /* - * Zero length .stab sections have been produced by some compilers so - * ignore the section if this is the case. - */ - if ((nstab = shdr.sh_size / shdr.sh_entsize) == 0) - return; - - if (stabstrid == -1) { - error_message(SBROW_02_ERROR, - PLAIN_ERROR, (char *)0); - return; - } - stabstr_scn = elf_getscn(elf, (size_t)stabstrid); - if (stabstr_scn == NULL) { - error_message(ELF_GETDATA_02_ERROR, - LIBELF_ERROR, elf_errmsg(-1)); - return; - } - if (gelf_getshdr(stabstr_scn, &shdr) == NULL) { - error_message(ELF_GETDATA_02_ERROR, - LIBELF_ERROR, elf_errmsg(-1)); - return; - } - if (shdr.sh_size == 0) { - error_message(SBROW_03_ERROR, - PLAIN_ERROR, (char *)0); - return; - } - - data = 0; - data = elf_getdata(stabstr_scn, data); - if (data == NULL) { - error_message(ELF_GETDATA_02_ERROR, - LIBELF_ERROR, elf_errmsg(-1)); - return; - } - if (data->d_size == 0) { - error_message(SBROW_02_ERROR, - PLAIN_ERROR, (char *)0); - return; - } - stabstrtab = (char *)data->d_buf; - data = 0; - data = elf_getdata(stab_scn, data); - if (data == NULL) { - error_message(ELF_GETDATA_02_ERROR, - LIBELF_ERROR, elf_errmsg(-1)); - return; - } - if (data->d_size == 0) { - error_message(SBROW_03_ERROR, - PLAIN_ERROR, (char *)0); - return; - } - stabtab = (struct nlist *)data->d_buf; - stabstroff = stabstrtab; - prevstabstrsz = 0; - for (np = stabtab; np < &stabtab[nstab]; np++) { - if (np->n_type == 0) { - stabstroff += prevstabstrsz; - prevstabstrsz = np->n_value; - } - symname = stabstroff + np->n_un.n_strx; - if (np->n_type == 0x48) { - sbfocus_symbol(&sb_data, arnam, "-a", symname); - } - } -} -#endif - - - static int search_sym_tab(ARFILE *fptr, Elf *elf, Elf_Scn *scn, long *nsyms, ARFILEP **symlist, int *num_errs) @@ -1177,11 +1027,11 @@ search_sym_tab(ARFILE *fptr, Elf *elf, Elf_Scn *scn, if (str_scn == NULL) { if (fname != NULL) error_message(ELF_GETDATA_01_ERROR, - LIBELF_ERROR, elf_errmsg(-1), - fname); + LIBELF_ERROR, elf_errmsg(-1), + fname); else error_message(ELF_GETDATA_02_ERROR, - LIBELF_ERROR, elf_errmsg(-1)); + LIBELF_ERROR, elf_errmsg(-1)); (*num_errs)++; return (-1); } @@ -1189,7 +1039,7 @@ search_sym_tab(ARFILE *fptr, Elf *elf, Elf_Scn *scn, no_of_symbols = shdr.sh_size / shdr.sh_entsize; if (no_of_symbols == -1) { error_message(SYMTAB_01_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); return (-1); } @@ -1198,10 +1048,10 @@ search_sym_tab(ARFILE *fptr, Elf *elf, Elf_Scn *scn, if (str_shtype == -1) { if (fname != NULL) error_message(ELF_GETDATA_01_ERROR, - LIBELF_ERROR, elf_errmsg(-1), fname); + LIBELF_ERROR, elf_errmsg(-1), fname); else error_message(ELF_GETDATA_02_ERROR, - LIBELF_ERROR, elf_errmsg(-1)); + LIBELF_ERROR, elf_errmsg(-1)); (*num_errs)++; return (-1); } @@ -1213,44 +1063,44 @@ search_sym_tab(ARFILE *fptr, Elf *elf, Elf_Scn *scn, if (str_shtype != SHT_STRTAB) { if (fname != NULL) error_message(SYMTAB_02_ERROR, - PLAIN_ERROR, (char *)0, - fname); + PLAIN_ERROR, (char *)0, + fname); else error_message(SYMTAB_03_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); return (0); } str_data = 0; if ((str_data = elf_getdata(str_scn, str_data)) == 0) { if (fname != NULL) error_message(SYMTAB_04_ERROR, - PLAIN_ERROR, (char *)0, - fname); + PLAIN_ERROR, (char *)0, + fname); else error_message(SYMTAB_05_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); return (0); } if (str_data->d_size == 0) { if (fname != NULL) error_message(SYMTAB_06_ERROR, - PLAIN_ERROR, (char *)0, - fname); + PLAIN_ERROR, (char *)0, + fname); else error_message(SYMTAB_07_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); return (0); } sym_data = 0; if ((sym_data = elf_getdata(scn, sym_data)) == NULL) { if (fname != NULL) error_message(ELF_01_ERROR, - LIBELF_ERROR, elf_errmsg(-1), - fname, elf_errmsg(-1)); + LIBELF_ERROR, elf_errmsg(-1), + fname, elf_errmsg(-1)); else error_message(ELF_02_ERROR, - LIBELF_ERROR, elf_errmsg(-1), - elf_errmsg(-1)); + LIBELF_ERROR, elf_errmsg(-1), + elf_errmsg(-1)); return (0); } @@ -1262,14 +1112,14 @@ search_sym_tab(ARFILE *fptr, Elf *elf, Elf_Scn *scn, symname = (char *)(str_data->d_buf) + sym.st_name; if (((GELF_ST_BIND(sym.st_info) == STB_GLOBAL) || - (GELF_ST_BIND(sym.st_info) == STB_WEAK)) && - (sym.st_shndx != SHN_UNDEF)) { + (GELF_ST_BIND(sym.st_info) == STB_WEAK)) && + (sym.st_shndx != SHN_UNDEF)) { if (!syms_left) { sym_ptr = malloc((SYMCHUNK+1) - * sizeof (ARFILEP)); + * sizeof (ARFILEP)); if (sym_ptr == NULL) { error_message(MALLOC_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); exit(1); } syms_left = SYMCHUNK; @@ -1380,7 +1230,7 @@ static void arwrite(char *name, int nfd, char *dst, int size) { if (write(nfd, dst, size) != size) { error_message(SYS_WRITE_04_ERROR, - SYSTEM_ERROR, strerror(errno), name); + SYSTEM_ERROR, strerror(errno), name); exit(2); } } @@ -1493,14 +1343,14 @@ writelargefile(Cmd_info *cmd_info, long long_tab_size, int longnames, nfd = open(name, O_RDWR|O_CREAT|O_LARGEFILE, 0666); if (nfd == -1) { error_message(SYS_CREATE_01_ERROR, - SYSTEM_ERROR, strerror(errno), name); + SYSTEM_ERROR, strerror(errno), name); exit(1); } } else { nfd = open(new_name, O_RDWR|O_CREAT|O_LARGEFILE, 0666); if (nfd == -1) { error_message(SYS_WRITE_02_ERROR, - SYSTEM_ERROR, strerror(errno), name); + SYSTEM_ERROR, strerror(errno), name); exit(1); } } @@ -1523,17 +1373,17 @@ writelargefile(Cmd_info *cmd_info, long long_tab_size, int longnames, if (longnames) { (void) sprintf(tmp_dst, FORMAT, LONGDIRNAME, time(0), - (unsigned)0, (unsigned)0, (unsigned)0, - (long)long_tab_size, ARFMAG); + (unsigned)0, (unsigned)0, (unsigned)0, + (long)long_tab_size, ARFMAG); tmp_dst += sizeof (struct ar_hdr); (void) memcpy(tmp_dst, str_base1, str_top1 - str_base1); tmp_dst += str_top1 - str_base1; } #ifndef XPG4 if (opt_FLAG(cmd_info, v_FLAG)) { - error_message(BER_MES_WRITE_ERROR, - PLAIN_ERROR, (char *)0, - cmd_info->arnam); + error_message(BER_MES_WRITE_ERROR, + PLAIN_ERROR, (char *)0, + cmd_info->arnam); } #endif arwrite(name, nfd, dst, (int)(tmp_dst - dst)); @@ -1545,7 +1395,7 @@ writelargefile(Cmd_info *cmd_info, long long_tab_size, int longnames, } if (strlen(fptr->ar_longname) <= (unsigned)SNAME-2) (void) sprintf(dst, FNFORMAT, - trimslash(fptr->ar_longname)); + trimslash(fptr->ar_longname)); else (void) sprintf(dst, FNFORMAT, fptr->ar_name); (void) sprintf(dst+16, TLFORMAT, fptr->ar_date, @@ -1564,22 +1414,22 @@ writelargefile(Cmd_info *cmd_info, long long_tab_size, int longnames, } if (f == NULL) { error_message(SYS_OPEN_ERROR, - SYSTEM_ERROR, strerror(errno), - fptr->ar_longname); + SYSTEM_ERROR, strerror(errno), + fptr->ar_longname); exit(1); } else { if ((fptr->ar_contents = (char *) malloc(ROUNDUP(stbuf.st_size))) == NULL) { error_message(MALLOC_ERROR, - PLAIN_ERROR, (char *)0); + PLAIN_ERROR, (char *)0); exit(1); } if (fread(fptr->ar_contents, sizeof (char), stbuf.st_size, f) != stbuf.st_size) { error_message(SYS_READ_ERROR, - SYSTEM_ERROR, strerror(errno), - fptr->ar_longname); + SYSTEM_ERROR, strerror(errno), + fptr->ar_longname); exit(1); } } diff --git a/usr/src/cmd/sgs/ar/common/inc.h b/usr/src/cmd/sgs/ar/common/inc.h index 1ced24c18d..e7d14df1cd 100644 --- a/usr/src/cmd/sgs/ar/common/inc.h +++ b/usr/src/cmd/sgs/ar/common/inc.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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -30,7 +29,8 @@ * */ -#pragma ident "%Z%%M% %I% %E% SMI" +#ifndef _INC_H +#define _INC_H #include <stdio.h> #include <sys/param.h> @@ -60,10 +60,6 @@ #include <string.h> #include <fcntl.h> -#ifdef BROWSER -#include "sbfocus_enter.h" -#endif - #include <time.h> #include <locale.h> @@ -251,3 +247,5 @@ char *trim(char *); #define SYS_WRITE_04_ERROR 58 #define WARN_USER_ERROR 59 #define ELF_RAWFILE_ERROR 60 + +#endif /* _INC_H */ diff --git a/usr/src/cmd/sgs/ar/common/main.c b/usr/src/cmd/sgs/ar/common/main.c index a3bb313b67..c5c94d062c 100644 --- a/usr/src/cmd/sgs/ar/common/main.c +++ b/usr/src/cmd/sgs/ar/common/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. @@ -23,12 +22,10 @@ /* All Rights Reserved */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include "inc.h" #include "extern.h" @@ -119,22 +116,15 @@ main(int argc, char **argv) (opt_FLAG(cmd_info, r_FLAG) && (opt_FLAG(cmd_info, a_FLAG) || opt_FLAG(cmd_info, b_FLAG))))) { error_message(NOT_FOUND_01_ERROR, - PLAIN_ERROR, (char *)0, arnam); + PLAIN_ERROR, (char *)0, arnam); exit(1); } (*cmd_info->comfun)(cmd_info); -#ifdef BROWSER - sb_data.fd = NULL; - sb_data.failed = 0; -#endif if (cmd_info->modified) { data = writefile(cmd_info); } else (void) close(fd); -#ifdef BROWSER - sbfocus_close(&sb_data); -#endif ret = notfound(cmd_info); @@ -271,12 +261,12 @@ setup(int argc, char *argv[], Cmd_info *cmd_info) break; case ':': error_message(USAGE_02_ERROR, - PLAIN_ERROR, (char *)0, optopt); + PLAIN_ERROR, (char *)0, optopt); usage_err++; break; case '?': error_message(USAGE_03_ERROR, - PLAIN_ERROR, (char *)0, optopt); + PLAIN_ERROR, (char *)0, optopt); usage_err++; break; } @@ -337,7 +327,7 @@ notfound(Cmd_info *cmd_info) for (i = 0; i < cmd_info->namc; i++) if (cmd_info->namv[i]) { error_message(NOT_FOUND_03_ERROR, - PLAIN_ERROR, (char *)0, cmd_info->namv[i]); + PLAIN_ERROR, (char *)0, cmd_info->namv[i]); n++; } return (n); diff --git a/usr/src/cmd/sgs/ar/common/sbfocus_enter.c b/usr/src/cmd/sgs/ar/common/sbfocus_enter.c deleted file mode 100644 index f3aa31448f..0000000000 --- a/usr/src/cmd/sgs/ar/common/sbfocus_enter.c +++ /dev/null @@ -1,119 +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 - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#include "sbfocus_enter.h" - -/* - * sbfocus_symbol() will write one symbol to a pipe that has the program - * "sbfocus" at the receiving end. If the program has not been started yet, - * it is started, and the pipe established. "sbfocus" is started with the - * function arguments "type" and "name" as its arguments, in that order. - * - * sbfocus_symbol() should be called with four arguments: - * data Pointer to a Sbld struct that the caller has allocated in - * permanent storage. It must be the same struct for all related - * calls to sbfocus_symbol(). - * name This is the string name of the library/executable being built. - * type A string, should be one of: - * "-a": Building a archived library - * "-s": Building a shared library - * "-x": Building an executable - * "-r": Concatenating object files - * symbol The string that should be written to "sbfocus". If this - * argument is NULL "sbfocus" is started, but no symbol is - * written to it. - */ - -void -sbfocus_symbol(Sbld data, char *name, char *type, char *symbol) -{ - int fd[2]; - - if (data->failed) { - return; - } - - if (data->fd == NULL) { - data->failed = 0; - (void) pipe(fd); - - switch (vfork()) { - case -1: - (void) fprintf(stderr, - "vfork() failed. SourceBrowser data will be lost.\n"); - data->failed = 1; - (void) close(fd[0]); - (void) close(fd[1]); - return; - - /* - * Child process - */ - case 0: - (void) dup2(fd[0], fileno(stdin)); - (void) close(fd[1]); - (void) execlp("sbfocus", "sbfocus", type, name, 0); - data->failed = 1; - _exit(1); - - /* - * Parent process - */ - default: - if (data->failed) { - (void) fprintf(stderr, - "`sbfocus' would not start." - " SourceBrowser data will be lost.\n"); - return; - } - (void) close(fd[0]); - data->fd = fdopen(fd[1], "w"); - break; - } - } - if (symbol != NULL) { - (void) fputs(symbol, data->fd); - (void) putc('\n', data->fd); - } -} - -/* - * sbfocus_close() will close the pipe to "sbfocus", causing it to terminate. - * - * sbfocus_close() should be called with one argument, a pointer to the data - * block used with sbfocus_symbol(). - */ -void -sbfocus_close(Sbld data) -{ - if ((data->fd != NULL) && (data->failed == 0)) { - (void) fclose(data->fd); - } - data->fd = NULL; - data->failed = 0; -} diff --git a/usr/src/cmd/sgs/ar/common/sbfocus_enter.h b/usr/src/cmd/sgs/ar/common/sbfocus_enter.h deleted file mode 100644 index 136f9875b4..0000000000 --- a/usr/src/cmd/sgs/ar/common/sbfocus_enter.h +++ /dev/null @@ -1,68 +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 - */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -#ifndef _SBFOCUS_ENTER_H -#define _SBFOCUS_ENTER_H - -#include <stdio.h> -#include <sys/param.h> -#include <signal.h> -#include <errno.h> -#include <unistd.h> - -/* - * Datastructure that holds persistent data that sbfocus_symbol & sbfocus_close - * needs. Passing in a pointer to this struct makes them re-entrant. - */ -typedef struct Sbld_tag *Sbld, Sbld_rec; - -struct Sbld_tag { - FILE *fd; - int failed; -}; - -/* - * fragment of SunOS <machine/a.out.h> - * Format of a symbol table entry - */ -struct nlist { - union { - char *n_name; /* for use when in-core */ - long n_strx; /* index into file string table */ - } n_un; - unsigned char n_type; /* type flag (N_TEXT...) */ - char n_other; /* unused */ - short n_desc; /* see <stab.h> */ - unsigned long n_value; /* value of symbol (or sdb offset) */ -}; - -void sbfocus_symbol(Sbld data, char *name, char *type, char *symbol); -void sbfocus_close(Sbld data); - -Sbld_rec sb_data; -#endif /* _SBFOCUS_ENTER_H */ diff --git a/usr/src/cmd/sgs/crle/inc.flg b/usr/src/cmd/sgs/crle/inc.flg deleted file mode 100644 index a8420bf8dd..0000000000 --- a/usr/src/cmd/sgs/crle/inc.flg +++ /dev/null @@ -1,81 +0,0 @@ -#!/bin/sh -# -# 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 -# -# -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# A combination of requirements and instructions for building crle and -# its dependent libraries. Although this provides a reduced environment -# over bringinging over usr/src/cmd/sgs/packages, it's debatable whether -# its worth the trouble. - -echo_file usr/src/cmd/sgs/Makefile.com -echo_file usr/src/cmd/sgs/Makefile.sub -echo_file usr/src/cmd/sgs/Makefile.sub.64 -echo_file usr/src/cmd/sgs/Makefile.targ - -echo_file usr/src/cmd/sgs/packages/common/SUNWonld-README - -echo_file usr/src/uts/common/sys/machelf.h -echo_file usr/src/uts/intel/sys/Makefile -echo_file usr/src/uts/sparc/sys/Makefile -echo_file usr/src/uts/common/krtld/reloc.h -echo_file usr/src/uts/common/krtld/reloc_defs.h - -echo_file usr/src/cmd/sgs/rtld/common/_elf.h -echo_file usr/src/cmd/sgs/rtld/common/_rtld.h - -echo_file usr/src/lib/libc/inc/libc_int.h - -echo_file usr/src/lib/Makefile.lib -echo_file usr/src/lib/Makefile.targ - -find_files "s.*" \ - usr/src/cmd/sgs/tools \ - usr/src/cmd/sgs/messages \ - usr/src/cmd/sgs/include \ - usr/src/cmd/sgs/libconv \ - usr/src/cmd/sgs/libcrle \ - usr/src/cmd/sgs/librtld - -# The following is required to set up a local linker: -# -# mkdir -p $SRC/cmd/sgs/proto/$MACH -# ln -s /usr/ccs/bin/ld $SRC/cmd/sgs/proto/$MACH/ld -# -# The following are required to build sgsmsgs, something like: -# -# (cd $SRC/cmd/sgs/tools ; NATIVECC=cc make -e) -# -# The following is required to build libconv.a: -# -# (cd $SRC/cmd/sgs/libconv ; make install lint) -# -# crle(1) and its support libraries can be built as needed: -# -# mkdir -p $ROOT/usr/lib/$MACH $ROOT/usr/lib/sparcv9 -# (cd $SRC/cmd/sgs/libcrle ; make install lint) -# (cd $SRC/cmd/sgs/librtld ; make install lint) -# mkdir -p $ROOT/usr/bin/$MACH $ROOT/usr/bin/sparcv9 -# (cd $SRC/cmd/sgs/crle ; make install lint) diff --git a/usr/src/cmd/sgs/include/debug.h b/usr/src/cmd/sgs/include/debug.h index ac263f067f..cf330ec233 100644 --- a/usr/src/cmd/sgs/include/debug.h +++ b/usr/src/cmd/sgs/include/debug.h @@ -59,7 +59,6 @@ extern "C" { */ #define DBG_SUP_ENVIRON 1 #define DBG_SUP_CMDLINE 2 -#define DBG_SUP_DEFAULT 3 #define DBG_CONF_IGNORE 1 /* configuration processing errors */ #define DBG_CONF_VERSION 2 @@ -353,6 +352,7 @@ extern uintptr_t Dbg_setup(const char *, Dbg_desc *); #define Dbg_support_action Dbg64_support_action #define Dbg_support_load Dbg64_support_load #define Dbg_support_req Dbg64_support_req +#define Dbg_support_vnone Dbg64_support_vnone #define Dbg_syminfo_entry Dbg64_syminfo_entry #define Dbg_syminfo_title Dbg64_syminfo_title @@ -558,6 +558,7 @@ extern uintptr_t Dbg_setup(const char *, Dbg_desc *); #define Dbg_support_action Dbg32_support_action #define Dbg_support_load Dbg32_support_load #define Dbg_support_req Dbg32_support_req +#define Dbg_support_vnone Dbg32_support_vnone #define Dbg_syminfo_entry Dbg32_syminfo_entry #define Dbg_syminfo_title Dbg32_syminfo_title @@ -802,6 +803,7 @@ extern void Dbg_support_action(Lm_list *, const char *, const char *, Support_ndx, const char *); extern void Dbg_support_load(Lm_list *, const char *, const char *); extern void Dbg_support_req(Lm_list *, const char *, int); +extern void Dbg_support_vnone(Lm_list *, const char *); extern void Dbg_syminfo_entry(Lm_list *, Word, Syminfo *, Sym *, const char *, Dyn *); diff --git a/usr/src/cmd/sgs/include/libld.h b/usr/src/cmd/sgs/include/libld.h index 92a0fb1d78..c696c6beae 100644 --- a/usr/src/cmd/sgs/include/libld.h +++ b/usr/src/cmd/sgs/include/libld.h @@ -1028,7 +1028,7 @@ struct group_desc { * Indexes into the ld_support_funcs[] table. */ typedef enum { - LDS_VERSION = 0, + LDS_VERSION = 0, /* Must be first and have value 0 */ LDS_INPUT_DONE, LDS_START, LDS_ATEXIT, diff --git a/usr/src/cmd/sgs/lex/common/inc.flg b/usr/src/cmd/sgs/lex/common/inc.flg deleted file mode 100644 index fd5584bf78..0000000000 --- a/usr/src/cmd/sgs/lex/common/inc.flg +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# -# 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 -# -# -# Copyright 1993 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#pragma ident "%Z%%M% %I% %E% SMI" - - -echo_file usr/src/lib/Makefile.lib - diff --git a/usr/src/cmd/sgs/libdl/inc.flg b/usr/src/cmd/sgs/libdl/inc.flg deleted file mode 100644 index 9540e580ec..0000000000 --- a/usr/src/cmd/sgs/libdl/inc.flg +++ /dev/null @@ -1,36 +0,0 @@ -#!/bin/sh -# -# 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 2007 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -echo_file usr/src/lib/Makefile.lib -echo_file usr/src/lib/Makefile.targ - -echo_file usr/src/common/mapfiles/common/map.filter - -echo_file usr/src/cmd/sgs/Makefile.sub -echo_file usr/src/cmd/sgs/Makefile.com diff --git a/usr/src/cmd/sgs/libelf/inc.flg b/usr/src/cmd/sgs/libelf/inc.flg deleted file mode 100644 index 15be5817c8..0000000000 --- a/usr/src/cmd/sgs/libelf/inc.flg +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/sh -# -# 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 -# -# -# pragma ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1996 by Sun Microsystems, Inc. -# - -echo_file usr/src/lib/Makefile.lib -echo_file usr/src/lib/Makefile.targ - -echo_file usr/src/cmd/sgs/Makefile.sub -echo_file usr/src/cmd/sgs/Makefile.com - -echo_file usr/src/cmd/sgs/tools/Makefile.com -echo_file usr/src/cmd/sgs/tools/Makefile.targ -echo_file usr/src/cmd/sgs/tools/common/sgsmsg.c -echo_file usr/src/cmd/sgs/tools/$MACH/Makefile - -find_files "s.*" \ - usr/src/cmd/sgs/messages diff --git a/usr/src/cmd/sgs/libld/common/ldmain.c b/usr/src/cmd/sgs/libld/common/ldmain.c index 206de2af9a..284c8b5f8e 100644 --- a/usr/src/cmd/sgs/libld/common/ldmain.c +++ b/usr/src/cmd/sgs/libld/common/ldmain.c @@ -111,7 +111,6 @@ ld_main(int argc, char **argv, Half mach) { char *sgs_support; /* SGS_SUPPORT environment string */ Half etype; - int suplib = 0; Ofl_desc *ofl; /* @@ -165,10 +164,9 @@ ld_main(int argc, char **argv, Half mach) return (0); /* - * Determine whether any support libraries been loaded (either through - * the SGS_SUPPORT environment variable and/or through the -S option). - * By default the support library libldstab.so.1 is loaded provided the - * user hasn't specified their own -S libraries. + * Determine whether any support libraries should be loaded, + * (either through the SGS_SUPPORT environment variable and/or + * through the -S option). */ #if defined(_LP64) if ((sgs_support = getenv(MSG_ORIG(MSG_SGS_SUPPORT_64))) == NULL) @@ -186,11 +184,6 @@ ld_main(int argc, char **argv, Half mach) DBG_SUP_ENVIRON)); if ((lib = strtok_r(sgs_support, sep, &lasts)) != NULL) { do { - if (strcmp(lib, - MSG_ORIG(MSG_FIL_LIBSTAB)) == 0) { - if (suplib++) - continue; - } if (ld_sup_loadso(ofl, lib) == S_ERROR) return (ld_exit(ofl)); @@ -208,17 +201,8 @@ ld_main(int argc, char **argv, Half mach) if (ld_sup_loadso(ofl, lib) == S_ERROR) return (ld_exit(ofl)); } - DBG_CALL(Dbg_util_nl(ofl->ofl_lml, DBG_NL_STD)); - } else { - if (suplib == 0) { - DBG_CALL(Dbg_support_req(ofl->ofl_lml, - MSG_ORIG(MSG_FIL_LIBSTAB), DBG_SUP_DEFAULT)); - if (ld_sup_loadso(ofl, MSG_ORIG(MSG_FIL_LIBSTAB)) == - S_ERROR) - return (ld_exit(ofl)); - } - DBG_CALL(Dbg_util_nl(ofl->ofl_lml, DBG_NL_STD)); } + DBG_CALL(Dbg_util_nl(ofl->ofl_lml, DBG_NL_STD)); DBG_CALL(Dbg_ent_print(ofl->ofl_lml, ofl->ofl_dehdr->e_machine, &ofl->ofl_ents, (ofl->ofl_flags & FLG_OF_DYNAMIC) != 0)); diff --git a/usr/src/cmd/sgs/libld/common/libld.msg b/usr/src/cmd/sgs/libld/common/libld.msg index 17137b0e15..e994b1ddd8 100644 --- a/usr/src/cmd/sgs/libld/common/libld.msg +++ b/usr/src/cmd/sgs/libld/common/libld.msg @@ -1236,10 +1236,6 @@ @ MSG_ARG_T_OPAR "(" @ MSG_ARG_T_CPAR ")" -# File and pathname strings - -@ MSG_FIL_LIBSTAB "libldstab.so.1" - # Environment variable strings @ MSG_LD_RUN_PATH "LD_RUN_PATH" diff --git a/usr/src/cmd/sgs/libld/common/machrel.amd.c b/usr/src/cmd/sgs/libld/common/machrel.amd.c index 5438433ef1..c6bb568d8d 100644 --- a/usr/src/cmd/sgs/libld/common/machrel.amd.c +++ b/usr/src/cmd/sgs/libld/common/machrel.amd.c @@ -640,7 +640,7 @@ ld_do_activerelocs(Ofl_desc *ofl) } /* - * We deteremine what the 'got reference' + * We determine what the 'got reference' * model (if required) is at this point. This * needs to be done before tls_fixup() since * it may 'transition' our instructions. diff --git a/usr/src/cmd/sgs/libld/common/machrel.intel.c b/usr/src/cmd/sgs/libld/common/machrel.intel.c index 955abf3a11..aeaca95609 100644 --- a/usr/src/cmd/sgs/libld/common/machrel.intel.c +++ b/usr/src/cmd/sgs/libld/common/machrel.intel.c @@ -720,7 +720,7 @@ ld_do_activerelocs(Ofl_desc *ofl) } /* - * We deteremine what the 'got reference' + * We determine what the 'got reference' * model (if required) is at this point. This * needs to be done before tls_fixup() since * it may 'transition' our instructions. diff --git a/usr/src/cmd/sgs/libld/common/support.c b/usr/src/cmd/sgs/libld/common/support.c index 32c6f0c4ce..84c4cdd461 100644 --- a/usr/src/cmd/sgs/libld/common/support.c +++ b/usr/src/cmd/sgs/libld/common/support.c @@ -20,12 +20,10 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <dlfcn.h> #include <libelf.h> @@ -86,21 +84,40 @@ ld_sup_loadso(Ofl_desc *ofl, const char *obj) support[interface].sup_name)) == NULL) continue; - if ((flp = libld_malloc(sizeof (Func_list))) == NULL) - return (S_ERROR); - - flp->fl_obj = obj; - flp->fl_fptr = fptr; DBG_CALL(Dbg_support_load(ofl->ofl_lml, obj, support[interface].sup_name)); if (interface == LDS_VERSION) { - DBG_CALL(Dbg_support_action(ofl->ofl_lml, flp->fl_obj, + DBG_CALL(Dbg_support_action(ofl->ofl_lml, obj, support[LDS_VERSION].sup_name, LDS_VERSION, 0)); - version = ((uint_t(*)())flp->fl_fptr)(LD_SUP_VCURRENT); - if ((version == LD_SUP_VNONE) || - (version > LD_SUP_VCURRENT)) { + version = ((uint_t(*)())fptr)(LD_SUP_VCURRENT); + + /* + * If version is LD_SUP_VNONE, unload the support + * library and act as if it was never requested. + * This provides the support library with a mechanism + * for opting out of the process. + * + * Note that this depends on LDS_VERSION being the + * first item in support[]. If this were not true, + * then other functions from the library might be + * entered into the function lists, and unloading + * the object would cause corruption. + */ + assert(LDS_VERSION == 0); + if (version == LD_SUP_VNONE) { + DBG_CALL(Dbg_support_vnone(ofl->ofl_lml, + obj)); + (void) dlclose(handle); + return (1); + } + + /* + * If the support library has a version higher + * than we support, we are unable to accept it. + */ + if (version > LD_SUP_VCURRENT) { eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SUP_BADVERSION), LD_SUP_VCURRENT, version); @@ -108,6 +125,14 @@ ld_sup_loadso(Ofl_desc *ofl, const char *obj) return (S_ERROR); } } + + + if ((flp = libld_malloc(sizeof (Func_list))) == NULL) { + (void) dlclose(handle); + return (S_ERROR); + } + flp->fl_obj = obj; + flp->fl_fptr = fptr; flp->fl_version = version; if (list_appendc(&support[interface].sup_funcs, flp) == 0) return (S_ERROR); diff --git a/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg b/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg index 3c7d850680..f08aa2f02b 100644 --- a/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg +++ b/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg @@ -628,12 +628,12 @@ @ MSG_SUP_REQ "support object request=%s (%s)" @ MSG_SUP_REQ_ENV "supplied via SGS_SUPPORT" @ MSG_SUP_REQ_CMD "supplied via -S" -@ MSG_SUP_REQ_DEF "default" @ MSG_SUP_ROUTINE " support object=%s: provides routine %s" @ MSG_SUP_CALLING_1 " calling routine=%s (%s)" @ MSG_SUP_CALLING_2 " calling routine=%s (%s) %s=%s" +@ MSG_SUP_VNONE " unloading object=%s: version=LD_SUP_VNONE" @ MSG_SUP_OUTFILE "output file" @ MSG_SUP_INFILE "input file" @ MSG_SUP_INSEC "input section" diff --git a/usr/src/cmd/sgs/liblddbg/common/mapfile-vers b/usr/src/cmd/sgs/liblddbg/common/mapfile-vers index 6681386f1f..490451488f 100644 --- a/usr/src/cmd/sgs/liblddbg/common/mapfile-vers +++ b/usr/src/cmd/sgs/liblddbg/common/mapfile-vers @@ -38,7 +38,7 @@ # Policy for Shared Library Version Names and Interface Definitions -SUNWprivate_4.67 { +SUNWprivate_4.68 { global: dbg_desc = NODIRECT; # interposed - ld.so.1(1) dbg_print = NODIRECT; # interposed - ld(1) and ld.so.1(1) @@ -316,6 +316,8 @@ SUNWprivate_4.67 { Dbg64_support_load; Dbg32_support_req; Dbg64_support_req; + Dbg32_support_vnone; + Dbg64_support_vnone; Dbg32_syminfo_entry; Dbg64_syminfo_entry; diff --git a/usr/src/cmd/sgs/liblddbg/common/support.c b/usr/src/cmd/sgs/liblddbg/common/support.c index 6f946962cc..b018b9ae91 100644 --- a/usr/src/cmd/sgs/liblddbg/common/support.c +++ b/usr/src/cmd/sgs/liblddbg/common/support.c @@ -20,10 +20,9 @@ */ /* - * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" #include "msg.h" #include "_debug.h" @@ -36,12 +35,17 @@ Dbg_support_req(Lm_list *lml, const char *define, int flag) if (DBG_NOTCLASS(DBG_C_SUPPORT)) return; - if (flag == DBG_SUP_ENVIRON) + switch (flag) { + case DBG_SUP_ENVIRON: str = MSG_INTL(MSG_SUP_REQ_ENV); - else if (flag == DBG_SUP_CMDLINE) + break; + case DBG_SUP_CMDLINE: str = MSG_INTL(MSG_SUP_REQ_CMD); - else - str = MSG_INTL(MSG_SUP_REQ_DEF); + break; + default: + str = MSG_ORIG(MSG_STR_EMPTY); + break; + } dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY)); dbg_print(lml, MSG_INTL(MSG_SUP_REQ), define, str); @@ -57,6 +61,15 @@ Dbg_support_load(Lm_list *lml, const char *obj, const char *func) } void +Dbg_support_vnone(Lm_list *lml, const char *obj) +{ + if (DBG_NOTCLASS(DBG_C_SUPPORT)) + return; + + dbg_print(lml, MSG_INTL(MSG_SUP_VNONE), obj); +} + +void Dbg_support_action(Lm_list *lml, const char *obj, const char *func, Support_ndx ndx, const char *name) { diff --git a/usr/src/cmd/sgs/libldstab/Makefile.com b/usr/src/cmd/sgs/libldstab/Makefile.com index 91f93046a1..bd0ad2c294 100644 --- a/usr/src/cmd/sgs/libldstab/Makefile.com +++ b/usr/src/cmd/sgs/libldstab/Makefile.com @@ -19,20 +19,17 @@ # CDDL HEADER END # # -# Copyright 2006 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" -# LIBRARY= libldstab.a VERS= .1 COMOBJS= stab.o DUPOBJS+= -BLTOBJ= msg.o -OBJECTS= $(BLTOBJ) $(COMOBJS) $(DUPOBJS) +OBJECTS= $(COMOBJS) $(DUPOBJS) include $(SRC)/lib/Makefile.lib include $(SRC)/cmd/sgs/Makefile.com @@ -59,21 +56,10 @@ XXXFLAGS= $(DYNLIB) := XXXFLAGS= $(USE_PROTO) DYNFLAGS += $(XXXFLAGS) -BLTDEFS= msg.h -BLTDATA= msg.c -BLTMESG= $(SGSMSGDIR)/libldstab - -BLTFILES= $(BLTDEFS) $(BLTDATA) $(BLTMESG) - -SGSMSGCOM= ../common/libldstab.msg -SGSMSGALL= $(SGSMSGCOM) -SGSMSGTARG= $(SGSMSGCOM) -SGSMSGFLAGS += -h $(BLTDEFS) -d $(BLTDATA) -m $(BLTMESG) -n libldstab_msg - -SRCS= $(COMOBJS:%.o=../common/%.c) $(BLTDATA) +SRCS= $(COMOBJS:%.o=../common/%.c) LINTSRCS= $(SRCS) -CLEANFILES += $(LINTOUTS) $(BLTFILES) +CLEANFILES += $(LINTOUTS) CLOBBERFILES += $(DYNLIB) ROOTDYNLIB= $(DYNLIB:%=$(ROOTLIBDIR)/%) diff --git a/usr/src/cmd/sgs/libldstab/Makefile.targ b/usr/src/cmd/sgs/libldstab/Makefile.targ index 9ffef5b4d5..b20710f983 100644 --- a/usr/src/cmd/sgs/libldstab/Makefile.targ +++ b/usr/src/cmd/sgs/libldstab/Makefile.targ @@ -19,11 +19,9 @@ # CDDL HEADER END # # -# Copyright 2006 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" -# pics/%.o: ../common/%.c $(COMPILE.c) -o $@ $< @@ -53,12 +51,8 @@ include $(SRC)/cmd/sgs/Makefile.targ # Derived source and header files (messaging). -catalog: $(BLTMESG) +catalog: -chkmsg: $(SRCS) - sh $(CHKMSG) $(CHKMSGFLAGS) $(SRCS) +chkmsg: -$(BLTDEFS) + \ -$(BLTDATA) + \ -$(BLTMESG) : $(SGSMSGALL) - $(SGSMSG) $(SGSMSGFLAGS) $(SGSMSGALL) +package: diff --git a/usr/src/cmd/sgs/libldstab/common/libldstab.msg b/usr/src/cmd/sgs/libldstab/common/libldstab.msg deleted file mode 100644 index 4fe0361e8d..0000000000 --- a/usr/src/cmd/sgs/libldstab/common/libldstab.msg +++ /dev/null @@ -1,74 +0,0 @@ -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# 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" - - -@ _START_ - -# Message file for cmd/sgs/libldstab. - -@ MSG_ID_LIBLDSTAB - - -# Stab processing errors. - -@ MSG_STAB_MISTBL "libldstab: file %s: .stab[.index|.sbfocus] found \ - with no matching string table\n" -@ MSG_STAB_BADTBL "libldstab: file %s: .stab[.index|.sbfocus] error \ - when reading string table\n" -@ MSG_STAB_NOSBROW "SourceBrowser data will be lost" - -# System errors - -@ MSG_SYS_EXEC "libldstab: file %s: %s exec failed: %s: %s\n" -@ MSG_SYS_FORK "libldstab: file %s: fork failed: %s: %s\n" -@ MSG_SYS_GETCWD "libldstab: file %s: getcwd failed: %s\n" - -@ MSG_ELF_GETDATA "libldstab: file %s: elf_getdata: %s\n" -@ MSG_ELF_GETSCN "libldstab: file %s: elf_getscn: %s\n" - -@ _END_ - -# The following strings represent reserved names. Reference to these strings -# is via the MSG_ORIG() macro, and thus translations are not required. - -# Elf processing messages. - -@ MSG_STR_DASHR "-r" -@ MSG_STR_DASHX "-x" -@ MSG_STR_W "w" - -@ MSG_STR_SBFOCUS "sbfocus" - -@ MSG_SUNW_OST_SGS "SUNW_OST_SGS" - -# Section strings - -@ MSG_SCN_STAB ".stab" -@ MSG_SCN_STABSTR ".stabstr" -@ MSG_SCN_STABINDEX ".stab.index" -@ MSG_SCN_STABINDEXSTR ".stab.indexstr" -@ MSG_SCN_STABSBFOCUS ".stab.sbfocus" -@ MSG_SCN_STABSBFOCUSTR ".stab.sbfocusstr" diff --git a/usr/src/cmd/sgs/libldstab/common/mapfile-64 b/usr/src/cmd/sgs/libldstab/common/mapfile-64 index 8b0dfac4db..47759d6adc 100644 --- a/usr/src/cmd/sgs/libldstab/common/mapfile-64 +++ b/usr/src/cmd/sgs/libldstab/common/mapfile-64 @@ -1,15 +1,12 @@ # -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # 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. @@ -28,8 +25,5 @@ SUNWprivate_1.1 { global: - ld_atexit64; - ld_file64; - ld_section64; - ld_start64; + ld_version64; }; diff --git a/usr/src/cmd/sgs/libldstab/common/mapfile-vers b/usr/src/cmd/sgs/libldstab/common/mapfile-vers index b1f190c814..10fe1ce804 100644 --- a/usr/src/cmd/sgs/libldstab/common/mapfile-vers +++ b/usr/src/cmd/sgs/libldstab/common/mapfile-vers @@ -1,15 +1,12 @@ # -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2008 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # 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. @@ -28,16 +25,10 @@ SUNWprivate_1.1 { global: - ld_atexit; - ld_file; - ld_section; - ld_start; + ld_version; }; { - global: - eprintf = FUNCTION extern; - libld_malloc = FUNCTION extern; local: *; }; diff --git a/usr/src/cmd/sgs/libldstab/common/stab.c b/usr/src/cmd/sgs/libldstab/common/stab.c index 1f8a00a289..92eef3d774 100644 --- a/usr/src/cmd/sgs/libldstab/common/stab.c +++ b/usr/src/cmd/sgs/libldstab/common/stab.c @@ -24,627 +24,50 @@ * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - * This file contains all functions relating to stab processing. The - * stab table is compressed by eliminating duplicate include file entries. - */ -#include <stdio.h> -#include <string.h> -#include <stab.h> -#include <unistd.h> -#include <stdlib.h> -#include <signal.h> -#include <sys/param.h> -#include <errno.h> -#include <libintl.h> -#include "libld.h" -#include "msg.h" - - -/* - * With the 5.x compiler, stab.h changed struct nlist into - * struct stab and got rid of it's embeded unions. - */ -#if __SUNPRO_C >= 0x500 || defined(__GNUC__) -#define nlist stab -#else -#define n_strx n_un.n_strx -#endif - - -/* - * Data structure that holds persistent data that sbfocus_symbol & sbfocus_close - * needs. Passing in a pointer to this struct makes them re-entrant. - */ -typedef struct sbld_tag { - FILE *fd; - int failed; -} *Sbld, Sbld_rec; - - -extern Sbld_rec sb_data; -extern const char *out_fname, *in_fname; -extern Half out_e_type; -extern void sbfocus_symbol(Sbld, const char *, const char *, - const char *); - -#if !defined(_ELF64) - -/* - * holds information needed by sbfocus_symbol and sbfocus_close. - */ -Sbld_rec sb_data = { NULL, 0 }; - -/* - * holds information out the output file being created. - */ -const char *out_fname = NULL; -const char *in_fname = NULL; /* current input file */ -Half out_e_type = ET_NONE; - -/* - * Signal handler is called when a SIGPIPE is encountered. This would - * happen in case `sbfocus' did not exist and `ld' is writing down a - * pipe with no reader. Trap signal and set failed field so that no - * more subsequent writes occur. - */ -static void -sigpipe_handler() -{ - sb_data.failed = 1; -} - -/* - * sbfocus_symbol() will write one symbol to a pipe that has the program - * "sbfocus" at the receiving end. If the program has not been started yet, - * it is started, and the pipe established. "sbfocus" is started with the - * function arguments "type" and "name" as its arguments, in that order. - * - * sbfocus_symbol() should be called with four arguments: - * data Pointer to a Sbld struct that the caller has allocated in - * permanent storage. It must be the same struct for all related - * calls to sbfocus_symbol(). - * name This is the string name of the library/executable being built. - * type A string, should be one of: - * "-x": Building an executable or shared object - * "-r": Concatenating object files - * symbol The string that should be written to "sbfocus". If this - * argument is NULL "sbfocus" is started, but no symbol is - * written to it. - */ -void -sbfocus_symbol(Sbld data, const char *name, const char *type, - const char *symbol) -{ - int fd[2], err; - - if (data->failed) { - return; - } - - (void) signal(SIGPIPE, (void (*)(int)) sigpipe_handler); - - if (data->fd == NULL) { - data->failed = 0; - (void) pipe(fd); - - switch (fork()) { - case -1: - err = errno; - (void) fprintf(stderr, MSG_INTL(MSG_SYS_FORK), - in_fname, strerror(err), - MSG_INTL(MSG_STAB_NOSBROW)); - data->failed = 1; - (void) close(fd[0]); - (void) close(fd[1]); - return; - - /* - * Child process - */ - case 0: - (void) close(fd[1]); - (void) dup2(fd[0], fileno(stdin)); - (void) close(fd[0]); - (void) execlp(MSG_ORIG(MSG_STR_SBFOCUS), - MSG_ORIG(MSG_STR_SBFOCUS), type, name, 0); - - err = errno; - (void) fprintf(stderr, MSG_INTL(MSG_SYS_EXEC), - in_fname, MSG_ORIG(MSG_STR_SBFOCUS), - strerror(err), MSG_INTL(MSG_STAB_NOSBROW)); - exit(-1); - - /* - * Parent process - */ - default: - (void) close(fd[0]); - data->fd = fdopen(fd[1], MSG_ORIG(MSG_STR_W)); - break; - } - } - if (symbol != NULL) { - (void) fputs(symbol, data->fd); - (void) putc('\n', data->fd); - } -} -#endif /* !defined(_ELF64) */ - - -static Xword -pass1_stabindex(const Elf_Data *s_data, const Elf_Data *str_data, - const size_t cwd_len, const size_t name_len) -{ - struct nlist *elem; - struct nlist *last = NULL; - size_t i; - size_t str_offset = 0; - size_t new_size = 0; - size_t first_object = 1; - size_t any_obj = 0; - size_t num_elem; - /* - * The processing of the stab table happens in two passes. - * - * first pass: calculate if any change is needed and if so, how much - * the string table needs to be expanded by. - */ - num_elem = s_data->d_size / sizeof (struct nlist); - for (i = 0; i < num_elem; i++) { - char *str; - - elem = (struct nlist *)s_data->d_buf + i; - switch (elem->n_type) { - case 0: - if (last) - str_offset += last->n_value; - last = elem; - break; - case N_OBJ: - str = (char *)str_data->d_buf + str_offset + - elem->n_strx; - - if ((*str == '\0') && first_object) { - /* - * This is a 'CWD' N_OBJ - * - * we only record the 'cwd' once in each - * stringtable. so - we only need to add - * it's length once to the new_size - */ - if (any_obj == 0) { - any_obj++; - new_size += cwd_len + 1; - } /* if */ - first_object = 0; - } /* if */ - else if (*str == '\0') { - /* - * This is a 'object_name' N_OBJ - */ - new_size += name_len + 1; - first_object = 1; - } /* else if */ - break; - default: - /* no-op */ - break; - } /* switch */ - } /* for */ - /*LINTED*/ - return ((Xword) new_size); -} /* pass1_stabindex */ - - -static int -pass2_stabindex(Elf_Data *s_data, Elf_Data *str_data, const char *name, - size_t name_len, size_t cwd_pos, size_t free_pos) -{ - struct nlist *elem; - struct nlist *last = NULL; - size_t i; - size_t str_offset = 0; - size_t first_object = 1; - size_t num_elem; - /* - * The processing of the stab table happens in two passes. - * - * first pass: calculate if any change is needed and if so, how much - * the string table needs to be expanded by. - */ - num_elem = s_data->d_size / sizeof (struct nlist); - for (i = 0; i < num_elem; i++) { - char *str; - - elem = (struct nlist *)s_data->d_buf + i; - switch (elem->n_type) { - case 0: - if (last) - str_offset += last->n_value; - last = elem; - break; - case N_OBJ: - str = (char *)str_data->d_buf + str_offset + - elem->n_strx; - - if ((*str == '\0') && first_object) { - /* - * This is a 'CWD' N_OBJ - * - * We point it at the CWD entry that we've - * already placed in the new string_table. - */ - /*LINTED*/ - elem->n_strx = (unsigned)(cwd_pos - str_offset); - first_object = 0; - } /* if */ - else if (*str == '\0') { - /* - * This is a 'object_name' N_OBJ. - * - * Append the object name to the string table - * and set the elem->n_un.n_strx to point - * to it. - */ - (void) strcpy((char *)str_data->d_buf + - free_pos, name); - /*LINTED*/ - elem->n_strx = (unsigned)(free_pos - - str_offset); - free_pos += name_len + 1; - first_object = 1; - } /* if */ - break; - default: - break; - } /* switch */ - } /* for */ - - /*LINTED*/ - last->n_value = (unsigned)(str_data->d_size - str_offset); - - return (1); -} /* pass2_stabindex() */ - - -/* - * find_scn() - * - * Find a section in elf that matches the supplied section name, - * type, and flags. - * - * Returns: - * section number if found - * 0 - if no matching section found - * -1 - if error - * - * If shdr is a non-null pointer it will be set to the section header - * that was found. - */ -static size_t -find_scn(Elf *elf, const char *elf_strtab, const char *name, - const Word sh_type, const Xword sh_flags, Elf_Scn **ret_scn) -{ - Elf_Scn *scn = NULL; - Shdr *scn_shdr; - - while ((scn = elf_nextscn(elf, scn)) != 0) { - if ((scn_shdr = elf_getshdr(scn)) == NULL) - return ((size_t)-1); - if ((scn_shdr->sh_type == sh_type) && - (scn_shdr->sh_flags == sh_flags) && - (strcmp(elf_strtab + scn_shdr->sh_name, name) == 0)) { - size_t scn_ndx; - /* - * we've got a match - */ - if ((scn_ndx = elf_ndxscn(scn)) == SHN_UNDEF) - return ((size_t)-1); - if (ret_scn) - *ret_scn = scn; - return (scn_ndx); - } /* if */ - } /* while */ - - /* - * no match found - */ - return (0); -} /* find_scn() */ - - -static Elf_Data * -get_str_data(Elf *elf, const char *strtab, const char *name, Shdr *shdr) -{ - Elf_Scn *str_scn; - Elf_Data *str_data; - - /* - * The stab's string table can be found through the - * shdr->sh_link value. - */ - if (shdr->sh_link == 0) { - /* - * Normally the sh_link field should point to the - * required strtab. But if it's not filled in (which - * means something goofed somewhere) we will try to look - * it up from the elf file itself. - */ - size_t strscn_ndx; - - strscn_ndx = find_scn(elf, strtab, name, SHT_STRTAB, - shdr->sh_flags, &str_scn); - if (strscn_ndx == 0) { - (void) fprintf(stderr, MSG_INTL(MSG_STAB_MISTBL), - in_fname); - return ((Elf_Data *)S_ERROR); - } else if (strscn_ndx == (size_t)-1) { - (void) fprintf(stderr, MSG_INTL(MSG_STAB_BADTBL), - in_fname); - return ((Elf_Data *)S_ERROR); - } - } else { - if ((str_scn = elf_getscn(elf, shdr->sh_link)) == NULL) { - (void) fprintf(stderr, MSG_INTL(MSG_ELF_GETSCN), - in_fname, elf_errmsg(0)); - return ((Elf_Data *)S_ERROR); - } - } - - if ((str_data = elf_getdata(str_scn, NULL)) == NULL) { - (void) fprintf(stderr, MSG_INTL(MSG_ELF_GETDATA), in_fname, - elf_errmsg(0)); - return ((Elf_Data *)S_ERROR); - } - - return (str_data); -} - - - - /* - * We examine all the stab's looking for pairs of N_OBJ's who's - * string pointers (elem->n_un.n_strx) points to a null string. - * When we find a pair we set the first string pointing to the - * CWD and we set the second string to the file object name (*name). + * The sharable object /usr/lib/libldstab.so.1 is a link-editor + * support library that was used to compress the stab table by + * eliminating duplicate include file entries. The link-editor would + * load it by default, unless the user explicitly supplied a support + * library via the ld -S option. We publically documented this in the + * Solaris Linkers and Libraries Manual (LLM), stating that users + * who supply their own support libraries should also explicitly + * add '-S libldstab.so.1' to their link commands in order to retain + * the functionality it supplied. * - * The stab's string table will have to be expanded to hold - * these new enties. - */ -static void -process_stabindex(Elf *elf, const char *elf_strtab, const char *strtab_name, - Shdr *shdr, Elf_Data *s_data) -{ - Elf_Data *str_data; - static char *cwd = NULL; - static size_t cwd_len; - size_t new_size; - size_t cwd_pos; - size_t name_len; - Elf_Void *data; - - if ((str_data = get_str_data(elf, elf_strtab, strtab_name, - shdr)) == (Elf_Data *)S_ERROR) - return; - - if (cwd == NULL) { - if ((cwd = getcwd(NULL, MAXPATHLEN)) == NULL) { - (void) fprintf(stderr, MSG_INTL(MSG_SYS_GETCWD), - in_fname, strerror(errno)); - return; - } - cwd_len = strlen(cwd); - } - name_len = strlen(in_fname); - - new_size = pass1_stabindex(s_data, str_data, cwd_len, name_len); - - if (new_size == 0) - /* no changes are needed */ - return; - /* - * The .stab.index data buffer must be updated so a new copy is - * allocated. The original is read-only. - */ - if ((data = malloc(s_data->d_size)) == 0) - return; - (void) memcpy(data, s_data->d_buf, s_data->d_size); - s_data->d_buf = data; - - /* - * Allocate a new .stab.indexstr that is big enough to hold the new - * entries that we will need to place into it. - * - * Then append the 'cwd' onto the end of the current data. - */ - if ((data = malloc(str_data->d_size + new_size)) == 0) - return; - (void) memcpy(data, str_data->d_buf, str_data->d_size); - cwd_pos = str_data->d_size; - (void) strcpy((char *)data + cwd_pos, cwd); - str_data->d_buf = data; - str_data->d_size = str_data->d_size + new_size; - - (void) pass2_stabindex(s_data, str_data, in_fname, name_len, cwd_pos, - cwd_pos + cwd_len + 1); -} - - -static void -process_stabsbfocus(Elf *elf, const char *elf_strtab, - const char *strtab_name, Shdr *shdr, Elf_Data *s_data, - const char *out_name, Half etype) -{ - Elf_Data *str_data; - struct nlist *elem, *last = NULL; - size_t i, str_offset = 0, num_elem; - - if ((str_data = get_str_data(elf, elf_strtab, strtab_name, - shdr)) == (Elf_Data *)S_ERROR) - return; - - num_elem = s_data->d_size / sizeof (struct nlist); - for (i = 0; i < num_elem; i++) { - const char *type, *str; - - elem = (struct nlist *)s_data->d_buf + i; - switch (elem->n_type) { - case 0: - if (last) - str_offset += last->n_value; - last = elem; - break; - case N_BROWS: - str = (char *)str_data->d_buf + elem->n_strx + - str_offset; - if (etype == ET_REL) - type = MSG_ORIG(MSG_STR_DASHR); - else - type = MSG_ORIG(MSG_STR_DASHX); - sbfocus_symbol(&sb_data, out_name, type, str); - break; - default: - /* no-op */ - break; - } - } -} - - -/* ARGSUSED2 */ -void -#if defined(_ELF64) -ld_start64(const char *out_name, const Half etype, const char *caller) -#else -ld_start(const char *out_name, const Half etype, const char *caller) -#endif -{ - out_fname = out_name; - out_e_type = etype; -} - - -/* ARGSUSED1 */ -void -#if defined(_ELF64) -ld_file64(const char *name, const Elf_Kind kind, int flags, Elf *elf) -#else -ld_file(const char *name, const Elf_Kind kind, int flags, Elf *elf) -#endif -{ - in_fname = name; -} - - -/* - * ld_section() + * The original libldstab.so worked by forking a child process running + * a program named sbfocus. sbfocus was delivered with the Sun + * compilers, and was expected to be found in the users PATH. + * As the compilers and the OSnet are delivered on disjoint schedules, + * this division never worked very well. Modern versions of the + * compilers supply their own support libraries directly as needed, and + * no longer deliver a program named sbfocus. The link-editor no longer + * loads libldstab.so.1 by default, and it is no longer documented in the LLM. * - * Args: - * name - pointer to name of current section being processed. - * shdr - pointer to Section Header of current in-file being - * processed. - * s_data - pointer to Section Data structure of current in-file - * being processed. - * elf - pointer to elf structure for current in-file being - * processed + * The current version of /usr/lib/libldstab.so.1 is a stub that exists + * solely for backward compatibility. In the case where an existing + * Makefile still follows the old advice in the LLM and supplies + * '-S libldstab.so.1' to the link-editor command line, this object + * will be loaded. It specifies a support library version of + * LD_SUP_VNONE, which indicates to the link-editor that it is + * not needed and should be quietly unloaded. In this way, we + * preserve the old documented interface without undue overhead. */ -/* ARGSUSED2 */ -void -#if defined(_ELF64) -ld_section64(const char *scn_name, Shdr *shdr, Word scnndx, -#else -ld_section(const char *scn_name, Shdr *shdr, Word scnndx, -#endif - Elf_Data *s_data, Elf *elf) -{ - Ehdr *ehdr; - Elf_Data *str_data; - Elf_Scn *str_scn; - char *strtab; - ehdr = elf_getehdr(elf); - if ((ehdr->e_type != ET_DYN) && (shdr->sh_type == SHT_PROGBITS)) { - /* - * this is a minor optimization for speed. If it's not a - * stab string we aren't going to strcmp() it. - */ - if ((scn_name[1] == 's') && - (scn_name[2] == 't') && - (scn_name[3] == 'a') && - (scn_name[4] == 'b')) { - Word shstrndx; - /* - * If 'extended sections' are in use, then - * e_shstrndx == Shdr[0].sh_link - */ - if (ehdr->e_shstrndx == SHN_XINDEX) { - Elf_Scn *scn0; - Shdr *shdr0; - scn0 = elf_getscn(elf, 0); - shdr0 = elf_getshdr(scn0); - shstrndx = shdr0->sh_link; - } else - shstrndx = ehdr->e_shstrndx; - - str_scn = elf_getscn(elf, shstrndx); - str_data = elf_getdata(str_scn, NULL); - strtab = str_data->d_buf; +#include <stdio.h> +#include <link.h> +#include "libld.h" - if (strcmp(scn_name, MSG_ORIG(MSG_SCN_STAB)) == 0) { - /* - * Process .stab - */ - process_stabsbfocus(elf, strtab, - MSG_ORIG(MSG_SCN_STABSTR), shdr, - s_data, out_fname, out_e_type); - } else if (strcmp(scn_name, - MSG_ORIG(MSG_SCN_STABINDEX)) == 0) { - /* - * Process .stab.index - */ - process_stabindex(elf, strtab, - MSG_ORIG(MSG_SCN_STABINDEXSTR), shdr, - s_data); - } else if (strcmp(scn_name, - MSG_ORIG(MSG_SCN_STABSBFOCUS)) == 0) { - /* - * Process .stab.sbfocus - */ - process_stabsbfocus(elf, strtab, - MSG_ORIG(MSG_SCN_STABSBFOCUSTR), shdr, - s_data, out_fname, out_e_type); - } - } - } -} -/* - * Null atexit() routine, causes dlsym() to pass and thus no dlerror() message - * generation. - */ /* ARGSUSED */ -void +uint_t #if defined(_ELF64) -ld_atexit64(int status) +ld_version64(uint_t version) #else -ld_atexit(int status) +ld_version(uint_t version) #endif { + /* LD_SUP_VNONE tells libld.so to ignore this support library */ + return (LD_SUP_VNONE); } - -#if !defined(_ELF64) -/* - * Messaging support - funnel everything through dgettext(). - */ - -const char * -_libldstab_msg(Msg mid) -{ - return (dgettext(MSG_ORIG(MSG_SUNW_OST_SGS), MSG_ORIG(mid))); -} -#endif diff --git a/usr/src/cmd/sgs/libldstab/common/stab.h b/usr/src/cmd/sgs/libldstab/common/stab.h deleted file mode 100644 index 65a5bf840f..0000000000 --- a/usr/src/cmd/sgs/libldstab/common/stab.h +++ /dev/null @@ -1,230 +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 - */ -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - -#pragma ident "%Z%%M% %I% %E% SMI" - -/* - */ - -/* - * THIS FILE IS NOW THE MASTER stab.h FILE, A DUPLICATE OF stab.h MAY BE - * MAINTAINED BY SPARCompilers - * - * KEEP IN SYNC - * - */ - -/* FILE NOT I18N */ - -/* - * This file gives definitions supplementing <a.out.h> - * for debugging symbol table entries. - * These entries must have one of the N_STAB bits on, - * and are subject to relocation according to the masks in <a.out.h> - * on 4.x (stabs not relocated on SVR4). - */ - -#ifndef _STAB_H -#define _STAB_H - -#if (!defined(_a_out_h) && !defined(_A_OUT_H)) || defined(HP_UX) -/* this file also contains fragments of a.out.h relevant to - * support of stab processing within ELF files - * (when a.out.h is not available) - */ -struct stab { - unsigned n_strx; /* index into file string table */ - unsigned char n_type; /* type flag (N_TEXT,..) */ - char n_other; /* used by N_SLINE stab */ - short n_desc; /* see stabs documentation */ - unsigned n_value; /* value of symbol (or sdb offset) */ -}; - -/* patchtypes for N_PATCH stab (n_desc field) */ - -#define P_BITFIELD 0x1 -#define P_SPILL 0x2 -#define P_SCOPY 0x3 - -/* markers for N_CODETAG stab (n_other field) */ - -#define CODETAG_BITFIELD 0x1 /* load/store of a bit field */ -#define CODETAG_SPILL 0x2 /* spill of registers */ -#define CODETAG_SCOPY 0x3 /* structure copy load/store */ -#define CODETAG_FSTART 0x4 /* points to first inst of new frame (0==leaf)*/ -#define CODETAG_END_CTORS 0x5 /* end of calls to super-class constructors */ -/* UNUSED 0x6 DW_ATCF_SUN_branch_target in dwarf, not used in stabs */ -#define CODETAG_STACK_PROBE 0x7 /* marks insns which probe the stack memory */ - -/* - * Simple values for n_type. - */ -#define N_UNDF 0x0 /* undefined */ -#define N_ABS 0x2 /* absolute */ -#define N_TEXT 0x4 /* text */ -#define N_DATA 0x6 /* data */ -#define N_BSS 0x8 /* bss */ -#define N_COMM 0x12 /* common (internal to ld) */ -#define N_FN 0x1f /* file name symbol */ - -#define N_EXT 01 /* external bit, or'ed in */ -#define N_TYPE 0x1e /* mask for all the type bits */ - -#endif - -/* - * maximum length of stab string before using continuation stab. - * (this is just a suggested limit), assembler has no limit. - */ - -#define MAX_STAB_STR_LEN 250 - -/* - * for symbolic debuggers: - */ -#define N_GSYM 0x20 /* global symbol: name,,0,type,0 */ -#define N_FNAME 0x22 /* procedure name (f77 kludge): name,,0 */ -#define N_FUN 0x24 /* procedure: name,,0,linenumber,0 */ -#define N_OUTL 0x25 /* outlined func: name,,0,linenumber,0 */ -#define N_STSYM 0x26 /* static symbol: name,,0,type,0 or section relative */ -#define N_TSTSYM 0x27 /* thread static symbol: Ttdata.data */ -#define N_LCSYM 0x28 /* .lcomm symbol: name,,0,type,0 or section relative */ -#define N_TLCSYM 0x29 /* thread local symbol: Ttbss.bss */ -#define N_MAIN 0x2a /* name of main routine : name,,0,0,0 */ -#define N_ROSYM 0x2c /* ro_data: name,,0,type,0 or section relative */ -#define N_FLSYM 0x2e /* fragmented data: name,,0,type,0 */ -#define N_TFLSYM 0x2f /* thread fragmented data: name,,0,type,0 */ -#define N_PC 0x30 /* global pascal symbol: name,,0,subtype,line */ -#define N_CMDLINE 0x34 /* command line info */ -#define N_OBJ 0x38 /* object file path or name */ -#define N_OPT 0x3c /* compiler options */ -#define N_RSYM 0x40 /* register sym: name,,0,type,register */ -#define N_SLINE 0x44 /* src line: 0,,0,linenumber,function relative */ -#define N_XLINE 0x45 /* h.o. src line: 0,,0,linenumber>>16,0 */ -#define N_ILDPAD 0x4c /* now used as ild pad stab value=strtab delta - was designed for "function start.end" */ -#define N_SSYM 0x60 /* structure elt: name,,0,type,struct_offset */ -#define N_ENDM 0x62 /* last stab emitted for object module */ -#define N_SO 0x64 /* source file name: name,,0,0,0 */ -#define N_MOD 0x66 /* f90 module: name,,0,0,0 */ -#define N_EMOD 0x68 /* end of f90 module: name,,0,0,0 */ -#define N_READ_MOD 0x6a /* use of f90 module: name;locallist,,0,0,0 */ -#define N_ALIAS 0x6c /* alias name: name,,0,0,0 */ -#define N_LSYM 0x80 /* local sym: name,,0,type,offset */ -#define N_BINCL 0x82 /* header file: name,,0,0,0 */ -#define N_SOL 0x84 /* #included file name: name,,0,0,0 */ -#define N_PSYM 0xa0 /* parameter: name,,0,type,offset */ -#define N_EINCL 0xa2 /* end of include file */ -#define N_ENTRY 0xa4 /* alternate entry: name,linenumber,0 */ -#define N_SINCL 0xa6 /* shared include file */ -#define N_LBRAC 0xc0 /* left bracket: 0,,0,nesting level,function relative */ -#define N_EXCL 0xc2 /* excluded include file */ -#define N_USING 0xc4 /* C++ using command */ -#define N_ISYM 0xc6 /* position independent type symbol, internal */ -#define N_ESYM 0xc8 /* position independent type symbol, external */ -#define N_PATCH 0xd0 /* Instruction to be ignored by run-time checking. */ -#define N_CONSTRUCT 0xd2 /* C++ constructor call. */ -#define N_DESTRUCT 0xd4 /* C++ destructor call. */ -#define N_CODETAG 0xd8 /* Generic code tag */ -#define N_FUN_CHILD 0xd9 /* Identifies a child function */ -#define N_RBRAC 0xe0 /* right bracket: 0,,0,nesting level,function relative */ -#define N_BCOMM 0xe2 /* begin common: name,, */ -#define N_TCOMM 0xe3 /* begin task common: name,, */ -#define N_ECOMM 0xe4 /* end task_common/common: name,, */ -#define N_XCOMM 0xe6 /* excluded common block */ -#define N_ECOML 0xe8 /* end common (local name): ,,address */ -#define N_WITH 0xea /* pascal with statement: type,,0,0,offset */ -#define N_LENG 0xfe /* second stab entry with length information */ - -/* - * for analyzer (cache profile feedback support) - */ -#define N_CPROF 0xf0 /* annotation for cache profile feedback */ - -/* - * n_descr values used in N_CPROF stabs. The n_descr field of - * an N_CPROF stab identifies the type of table whose location - * is defined by the N_CPROF stab. - */ -typedef enum n_cprof_instr_type_t { - N_CPROF_INSTR_TYPE_LOAD=0, /* profiled load ops */ - N_CPROF_INSTR_TYPE_STORE, /* profiled store ops */ - N_CPROF_INSTR_TYPE_PREFETCH, /* profiled prefetch ops */ - N_CPROF_INSTR_TYPE_BRTARGET, /* branch target locations */ - N_CPROF_INSTR_TYPE_NTYPES /* number of types */ -} n_cprof_instr_type_t; - -/* - * for code browser only - */ -#define N_BROWS 0x48 /* path to associated .cb file */ - -/* - * for functions -- n_other bits for N_FUN stab - */ -#define N_FUN_PURE (1<<0) -#define N_FUN_ELEMENTAL (1<<1) -#define N_FUN_RECURSIVE (1<<2) - -/* - * for variables -- n_other bits for N_LSYM, N_GSYM, N_LCSYM, N_STSYM, ... - */ -#define N_SYM_OMP_TLS (1<<3) - -/* - * Optional language designations for N_SO (n_desc field) - */ -#define N_SO_AS 1 /* Assembler */ -#define N_SO_C 2 /* C */ -#define N_SO_ANSI_C 3 /* ANSI C */ -#define N_SO_CC 4 /* C++ */ -#define N_SO_FORTRAN 5 /* Fortran 77 */ -#define N_SO_FORTRAN77 5 /* Fortran 77 */ -#define N_SO_PASCAL 6 /* Pascal */ -#define N_SO_FORTRAN90 7 /* Fortran 90 */ -#define N_SO_JAVA 8 /* Java */ -#define N_SO_C99 9 /* C99 */ - -/* - * Floating point type values (encoded in "R" type specification string) - */ -#define NF_NONE 0 /* Undefined type */ -#define NF_SINGLE 1 /* Float IEEE 32 bit floating point */ -#define NF_DOUBLE 2 /* Double IEEE 64 bit floating point */ -#define NF_COMPLEX 3 /* Complex (2 32bit floats) */ -#define NF_COMPLEX16 4 /* Complex (2 64bit doubles) */ -#define NF_COMPLEX32 5 /* Complex (2 128bit long doubles) */ -#define NF_LDOUBLE 6 /* Long double 128 bit floating point */ -#define NF_INTERARITH 7 /* Interval (2 32bit floats) */ -#define NF_DINTERARITH 8 /* Interval (2 64bit doubles) */ -#define NF_QINTERARITH 9 /* Interval (2 128bit long doubles) */ -#define NF_IMAGINARY 10 /* Imaginary (1 32bit floats) */ -#define NF_DIMAGINARY 11 /* Imaginary (1 64bit doubles) */ -#define NF_QIMAGINARY 12 /* Imaginary (1 128bit long doubles) */ - -#endif - - diff --git a/usr/src/cmd/sgs/messages/Makefile.com b/usr/src/cmd/sgs/messages/Makefile.com index a588344d2e..97b2c0c7e3 100644 --- a/usr/src/cmd/sgs/messages/Makefile.com +++ b/usr/src/cmd/sgs/messages/Makefile.com @@ -19,9 +19,7 @@ # CDDL HEADER END # # -# 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/messages/Makefile.com @@ -44,16 +42,15 @@ MSGFMT= msgfmt # is formatted as a message text source file (.msg) - see gencat(1). POFILES= ld ldd libld liblddbg \ - libldstab librtld rtld libelf \ - ldprof libcrle crle moe \ - pvs elfdump elfedit lari + librtld rtld libelf ldprof \ + libcrle crle moe pvs \ + elfdump elfedit elfwrap lari # These message files are generated as a side effect of generating the # elfedit messages. Otherwise they are the same thing as POFILES POFILES_ELFEDIT_MODULES = \ elfedit_cap elfedit_dyn elfedit_ehdr elfedit_phdr \ - elfedit_shdr elfedit_str elfedit_sym elfedit_syminfo\ - lari + elfedit_shdr elfedit_str elfedit_sym elfedit_syminfo # Define a local version of the message catalog. Test using: LANG=piglatin diff --git a/usr/src/cmd/sgs/messages/sgs.ident b/usr/src/cmd/sgs/messages/sgs.ident index 6afbf5ff5e..eaee78733e 100644 --- a/usr/src/cmd/sgs/messages/sgs.ident +++ b/usr/src/cmd/sgs/messages/sgs.ident @@ -21,8 +21,6 @@ # # CDDL HEADER END # -# ident "%Z%%M% %I% %E% SMI" -# # # Global message identifiers for the sgs utilities. This information is read # by sgsmsg(1l) using the -i option. @@ -37,7 +35,7 @@ MSG_ID_RTLD 1 SUNW_OST_SGS /* sgs/rtld */ MSG_ID_LIBRTLD 2 SUNW_OST_SGS /* sgs/librtld */ MSG_ID_LIBLD 3 SUNW_OST_SGS /* sgs/libld */ MSG_ID_LIBLDDBG 4 SUNW_OST_SGS /* sgs/liblddbg */ -MSG_ID_LIBLDSTAB 5 SUNW_OST_SGS /* sgs/libldstab */ + MSG_ID_LIBRTLD_DB 6 SUNW_OST_SGS /* sgs/librtld_db */ MSG_ID_LIBPROF 7 SUNW_OST_SGS /* sgs/libprof */ MSG_ID_LIBCRLE 8 SUNW_OST_SGS /* sgs/libcrle */ diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README index bd382a6539..293f890539 100644 --- a/usr/src/cmd/sgs/packages/common/SUNWonld-README +++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README @@ -1409,3 +1409,4 @@ Bugid Risk Synopsis 6772661 ldd/lddstub/ld.so.1 dump core in current nightly while processing libsoftcrypto_hwcap.so.1 6765931 mcs generates unlink(NULL) system calls +6775062 remove /usr/lib/libldstab.so (D) diff --git a/usr/src/cmd/sgs/packages/inc.flg b/usr/src/cmd/sgs/packages/inc.flg deleted file mode 100644 index 1df75f194d..0000000000 --- a/usr/src/cmd/sgs/packages/inc.flg +++ /dev/null @@ -1,110 +0,0 @@ -#!/bin/sh -# -# 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 2008 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" -# - -find_files "s.*" \ - usr/src/cmd/sgs/crle \ - usr/src/cmd/sgs/dump \ - usr/src/cmd/sgs/include \ - usr/src/cmd/sgs/lari \ - usr/src/cmd/sgs/ld \ - usr/src/cmd/sgs/ldd \ - usr/src/cmd/sgs/lddstub \ - usr/src/cmd/sgs/ldprof \ - usr/src/cmd/sgs/libconv \ - usr/src/cmd/sgs/libdl \ - usr/src/cmd/sgs/libcrle \ - usr/src/cmd/sgs/libelf \ - usr/src/cmd/sgs/libld \ - usr/src/cmd/sgs/liblddbg \ - usr/src/cmd/sgs/libldmake \ - usr/src/cmd/sgs/libldstab \ - usr/src/cmd/sgs/librtld \ - usr/src/cmd/sgs/librtld_db \ - usr/src/cmd/sgs/link_audit \ - usr/src/cmd/sgs/nm \ - usr/src/cmd/sgs/mcs \ - usr/src/cmd/sgs/messages \ - usr/src/cmd/sgs/moe \ - usr/src/cmd/sgs/elfdump \ - usr/src/cmd/sgs/elfedit \ - usr/src/cmd/sgs/elfwrap \ - usr/src/cmd/sgs/pvs \ - usr/src/cmd/sgs/rtld \ - usr/src/cmd/sgs/rtld.4.x \ - usr/src/cmd/sgs/tools \ - usr/src/cmd/sgs/0@0 \ - usr/src/common/avl \ - usr/src/common/dtrace \ - usr/src/common/elfcap \ - usr/src/common/sgsrtcid \ - usr/src/common/mapfiles \ - usr/src/lib/libc/inc \ - usr/src/lib/libproc \ - usr/src/lib/common - -echo_file usr/src/head/Makefile -echo_file usr/src/head/dlfcn.h -echo_file usr/src/head/gelf.h -echo_file usr/src/head/libelf.h -echo_file usr/src/head/link.h -echo_file usr/src/head/proc_service.h -echo_file usr/src/head/rtld_db.h -echo_file usr/src/head/apptrace.h -echo_file usr/src/head/apptrace_impl.h -echo_file usr/src/uts/common/sys/Makefile -echo_file usr/src/uts/Makefile.uts -echo_file usr/src/uts/common/krtld/reloc.h -echo_file usr/src/uts/common/krtld/reloc_defs.h -echo_file usr/src/uts/common/sys/Makefile.syshdrs -echo_file usr/src/uts/common/sys/auxv.h -echo_file usr/src/uts/common/sys/auxv_386.h -echo_file usr/src/uts/common/sys/auxv_SPARC.h -echo_file usr/src/uts/common/sys/elf.h -echo_file usr/src/uts/common/sys/elf_386.h -echo_file usr/src/uts/common/sys/elf_amd64.h -echo_file usr/src/uts/common/sys/elf_SPARC.h -echo_file usr/src/uts/common/sys/elf_notes.h -echo_file usr/src/uts/common/sys/elftypes.h -echo_file usr/src/uts/common/sys/link.h -echo_file usr/src/uts/common/sys/machelf.h -echo_file usr/src/uts/common/sys/note.h -echo_file usr/src/uts/common/sys/systeminfo.h -echo_file usr/src/uts/sparc/sys/Makefile -echo_file usr/src/uts/sparc/krtld/doreloc.c -echo_file usr/src/uts/intel/sys/Makefile -echo_file usr/src/uts/intel/ia32/krtld/doreloc.c -echo_file usr/src/uts/intel/amd64/krtld/doreloc.c -echo_file usr/src/cmd/sgs/Makefile -echo_file usr/src/cmd/sgs/Makefile.com -echo_file usr/src/cmd/sgs/Makefile.sub -echo_file usr/src/cmd/sgs/Makefile.sub.64 -echo_file usr/src/cmd/sgs/Makefile.targ -echo_file usr/src/cmd/sgs/Makefile.var -echo_file usr/src/lib/Makefile.lib -echo_file usr/src/lib/Makefile.lib.64 -echo_file usr/src/lib/Makefile.targ diff --git a/usr/src/cmd/sgs/rtld.4.x/inc.flg b/usr/src/cmd/sgs/rtld.4.x/inc.flg deleted file mode 100644 index a2cd9ba4c9..0000000000 --- a/usr/src/cmd/sgs/rtld.4.x/inc.flg +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# -# 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 -# -# -# Copyright 1993 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" - - -echo_file usr/src/lib/Makefile.lib diff --git a/usr/src/cmd/sgs/yacc/sparc/inc.flg b/usr/src/cmd/sgs/yacc/sparc/inc.flg deleted file mode 100644 index fd5584bf78..0000000000 --- a/usr/src/cmd/sgs/yacc/sparc/inc.flg +++ /dev/null @@ -1,31 +0,0 @@ -#!/bin/sh -# -# 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 -# -# -# Copyright 1993 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -#pragma ident "%Z%%M% %I% %E% SMI" - - -echo_file usr/src/lib/Makefile.lib - |
