Mercurial > illumos > illumos-gate
changeset 4947:e92895a4c96a
PSARC/2007/474 new ldd(1) -w option
6595139 various applications should export yy* global variables for libl
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/deleted_files/usr/src/cmd/genmsg/mapfile-intf Mon Aug 27 09:15:33 2007 -0700 @@ -0,0 +1,30 @@ +# +# 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" + +{ + local: + main; +};
--- a/usr/src/Makefile.master Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/Makefile.master Mon Aug 27 09:15:33 2007 -0700 @@ -555,6 +555,7 @@ MAPFILE.PGA = $(SRC)/common/mapfiles/$(MACH)/map.pagealign MAPFILE.NES = $(SRC)/common/mapfiles/common/map.noexstk MAPFILE.FLT = $(SRC)/common/mapfiles/common/map.filter +MAPFILE.LEX = $(SRC)/common/mapfiles/common/map.lex.yy # # Generated mapfiles that are compiler specific, and used throughout the
--- a/usr/src/cmd/agents/snmp/snmprelayd/Makefile Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/agents/snmp/snmprelayd/Makefile Mon Aug 27 09:15:33 2007 -0700 @@ -117,11 +117,15 @@ LIBS= -lsocket -lnsl -ll -CPPFLAGS += -I. -I../agent -I../snmplib -I../../include/netmgt -I${BIN} +# snmpdx has a name clash with main() and libl.so.1. However, snmpdx must +# still export a number of "yy*" (libl) interfaces, and interfaces for +# libssagent.so.1. Reduce all other symbols to local scope. +MAPFILES += $(MAPFILE.INT) $(MAPFILE.LEX) $(MAPFILE.NGB) +MAPOPTS = $(MAPFILES:%=-M%) -CFLAGS += -c -D$(TARG_SYS) - -LDFLAGS += $(MAPFILE.INT:%=-M%) $(LDLIBS) +CPPFLAGS += -I. -I../agent -I../snmplib -I../../include/netmgt -I${BIN} +CFLAGS += -c -D$(TARG_SYS) +LDFLAGS += $(MAPOPTS) $(LDLIBS) LINT=lint @@ -154,7 +158,7 @@ install: all $(OPTPROG) $(CONFRULE) $(ROOTMANIFEST) $(ROOTSVCMETHOD) -$(BINPROG): $(BIN) $(OBJECTS) $(BIN)/config.o $(MYLIBS) $(MAPFILE.INT) +$(BINPROG): $(BIN) $(OBJECTS) $(BIN)/config.o $(MYLIBS) $(MAPFILES) $(CC) -o $(BINPROG) $(LDFLAGS) $(OBJECTS) $(BIN)/config.o \ $(MYLINKLIBS) $(LIBS) $(POST_PROCESS)
--- a/usr/src/cmd/agents/snmp/snmprelayd/mapfile-intf Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/agents/snmp/snmprelayd/mapfile-intf Mon Aug 27 09:15:33 2007 -0700 @@ -26,8 +26,7 @@ # ident "%Z%%M% %I% %E% SMI" # -# snmpdx provides a couple of libssagent.so.1 functions. Reduce all remaining -# symbols to locals. +# snmpdx provides a couple of libssagent.so.1 functions. { global: default_config_file; @@ -39,6 +38,4 @@ agent_select_callback; agent_loop; agent_init; - local: - *; };
--- a/usr/src/cmd/agents/snmp/snmprelayd/name.h Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/agents/snmp/snmprelayd/name.h Mon Aug 27 09:15:33 2007 -0700 @@ -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. @@ -13,27 +12,31 @@ * * 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 + * 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 1996 Sun Microsystems, Inc. All Rights Reserved. + * Copyright 2007 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ +#ifndef _SNMPDX_NAME_H +#define _SNMPDX_NAME_H + #pragma ident "%Z%%M% %I% %E% SMI" -#define yyact mydbyyact -#define yypact mydbyypact -#define yychk mydbyychk -#define yyexca mydbyyexca -#define yydef mydbyydef -#define yyextra mydbyyextra -#define yypgo mydbyypgo -#define yyvstop mydbyyvstop -#define yycrank mydbyycrank -#define yysvec mydbyysvec -#define yyr1 mydbyyr1 -#define yyr2 mydbyyr2 +#define yyact mydbyyact +#define yypact mydbyypact +#define yychk mydbyychk +#define yyexca mydbyyexca +#define yydef mydbyydef +#define yypgo mydbyypgo +#define yyvstop mydbyyvstop +#define yycrank mydbyycrank +#define yysvec mydbyysvec +#define yyr1 mydbyyr1 +#define yyr2 mydbyyr2 + +#endif /* _SNMPDX_NAME_H */
--- a/usr/src/cmd/fs.d/udfs/fsdb/Makefile Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/fs.d/udfs/fsdb/Makefile Mon Aug 27 09:15:33 2007 -0700 @@ -30,17 +30,23 @@ include ../../Makefile.fstype -CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -LDLIBS += -lmalloc -ll -ladm -LDFLAGS += $(MAPFILE.NGB:%=-M%) -YFLAGS="-d" +# fsdb has a name clash with main() and libl.so.1. However, fsdb must +# still export a number of "yy*" (libl) interfaces. Reduce all other symbols +# to local scope. +MAPFILES += $(MAPFILE.INT) $(MAPFILE.LEX) $(MAPFILE.NGB) +MAPOPTS = $(MAPFILES:%=-M%) -LINTFLAGS += -erroff=E_STATIC_UNUSED -LINTFLAGS64 += -erroff=E_STATIC_UNUSED +CPPFLAGS += -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 +LDLIBS += -lmalloc -ll -ladm +LDFLAGS += $(MAPOPTS) +YFLAGS = "-d" + +LINTFLAGS += -erroff=E_STATIC_UNUSED +LINTFLAGS64 += -erroff=E_STATIC_UNUSED SRCS= fsdb.c ud_lib.c -fsdb : fsdb_yacc.o fsdb_lex.o ud_lib.o fsdb.o $(MAPFILE.NGB) +fsdb : fsdb_yacc.o fsdb_lex.o ud_lib.o fsdb.o $(MAPFILES) $(LINK.c) -o $@ fsdb.o fsdb_yacc.o fsdb_lex.o \ ud_lib.o $(LDLIBS) $(POST_PROCESS)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/cmd/fs.d/udfs/fsdb/mapfile-intf Mon Aug 27 09:15:33 2007 -0700 @@ -0,0 +1,38 @@ +# +# 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" +# + +# fsdb uses the -e option of lex, which generates additional lex interfaces +# that are not defined in the generic $(MAPFILE.LEX). These additional lex +# interfaces are exported here. +{ + global: + yywinput; + yywleng; + yywtext; + yywunput; +};
--- a/usr/src/cmd/genmsg/Makefile Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/genmsg/Makefile Mon Aug 27 09:15:33 2007 -0700 @@ -49,8 +49,13 @@ LINTFLAGS += -um -# genmsg has a name clash with main() and libl.so.1. Localize all symbols. -LDFLAGS += $(MAPFILE.INT:%=-M%) +# genmsg has a name clash with main() and libl.so.1. However, genmsg must +# still export a number of "yy*" (libl) interfaces. Reduce all other symbols +# to local scope. +MAPFILES += $(MAPFILE.LEX) $(MAPFILE.NGB) +MAPOPTS = $(MAPFILES:%=-M%) + +LDFLAGS += $(MAPOPTS) OBJS = $(C_OBJS) $(PSRC_Y:%.y=%.o) $(LEXOBJS) PSRC_C = $(PSRC_Y:%.y=%.c) @@ -58,11 +63,11 @@ .KEEP_STATE: -all: $(PROG) $(MAPFILE.INT) +all: $(PROG) install: all $(ROOTPROG) -$(PROG): $(OBJS) +$(PROG): $(OBJS) $(MAPFILES) $(CC) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS) $(POST_PROCESS)
--- a/usr/src/cmd/genmsg/mapfile-intf Mon Aug 27 08:25:15 2007 -0700 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License (the "License"). -# You may not use this file except in compliance with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -# Copyright 2007 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -# -# ident "%Z%%M% %I% %E% SMI" - -{ - local: - main; -};
--- a/usr/src/cmd/pools/poolcfg/Makefile Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/pools/poolcfg/Makefile Mon Aug 27 09:15:33 2007 -0700 @@ -35,10 +35,16 @@ include ../../Makefile.cmd include ../Makefile.pools +# poolcf has a name clash with main() and libl.so.1. However, poolcfg must +# still export a number of "yy*" (libl) interfaces. Reduce all other symbols +# to local scope. +MAPFILES += $(MAPFILE.LEX) $(MAPFILE.NGB) +MAPOPTS = $(MAPFILES:%=-M%) + LFLAGS = -t YFLAGS = -d CFLAGS += -I$(POOLSCOMMONDIR) -LDFLAGS += $(MAPFILE.NGB:%=-M%) +LDFLAGS += $(MAPOPTS) LDLIBS += -lpool -ll XGETFLAGS = -a CLOBBERFILES += poolcfg_lex.c poolcfg_grammar.c poolcfg_grammar.h @@ -47,7 +53,7 @@ all: $(PROG) -$(PROG): $(OBJS) $(COMMON_OBJS) $(MAPFILE.NGB) +$(PROG): $(OBJS) $(COMMON_OBJS) $(MAPFILES) $(LINK.c) -o $@ $(OBJS) $(COMMON_OBJS) $(LDLIBS) $(POST_PROCESS)
--- a/usr/src/cmd/sgs/include/rtld.h Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/sgs/include/rtld.h Mon Aug 27 09:15:33 2007 -0700 @@ -355,7 +355,8 @@ /* dependencies */ #define LML_FLG_TRC_UNUSED 0x04000000 /* trace unused dependencies */ #define LML_FLG_TRC_INIT 0x08000000 /* print .init order */ - +#define LML_FLG_TRC_NOUNRESWEAK 0x10000000 /* unresolved weak references */ + /* are not allowed */ #define LML_MSK_TRC 0xfff00000 /* tracing mask */ /*
--- a/usr/src/cmd/sgs/ldd/common/ldd.c Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/sgs/ldd/common/ldd.c Mon Aug 27 09:15:33 2007 -0700 @@ -33,7 +33,7 @@ * object. * * usage is: ldd [-d | -r] [-c] [-e envar] [-i] [-f] [-L] [-l] [-s] - * [-U | -u] [-v] file(s) + * [-U | -u] [-v] [-w] file(s) * * ldd opens the file and verifies the information in the elf header. * If the file is a dynamic executable, we set up some environment variables @@ -91,6 +91,12 @@ * unreferenced objects, and unreferenced cyclic dependencies to be detected. * These options assert that at least -d is set as relocation references are * what determine an objects use. + * + * If -w is specified, no unresolved weak references are allowed. -w causes + * LD_NOUNRESWEAK=1 to be set. By default, an unresolved weak reference is + * allowed, and a "0" is written to the relocation offset. The -w option + * disables this default. Any weak references that can not be resolved result + * in relocation error messages. */ #include <fcntl.h> #include <stdio.h> @@ -114,21 +120,9 @@ /* - * The following size definitions provide for allocating space for the string, - * or the string position at which any modifications to the variable will occur. + * Define all environment variable strings. The character following the "=" + * will be written to, to disable or enable the associated feature. */ -#define LD_LOAD_SIZE 27 -#define LD_PATH_SIZE 23 -#define LD_BIND_SIZE 13 -#define LD_VERB_SIZE 12 -#define LD_WARN_SIZE 9 -#define LD_CONF_SIZE 13 -#define LD_FLTR_SIZE 13 -#define LD_LAZY_SIZE 15 -#define LD_INIT_SIZE 9 -#define LD_UREF_SIZE 10 -#define LD_USED_SIZE 11 - static char bind[] = "LD_BIND_NOW= ", load_elf[] = "LD_TRACE_LOADED_OBJECTS_E= ", load_aout[] = "LD_TRACE_LOADED_OBJECTS_A= ", @@ -140,7 +134,8 @@ lazy[] = "LD_NOLAZYLOAD=1", init[] = "LD_INIT= ", uref[] = "LD_UNREF= ", - used[] = "LD_UNUSED= "; + used[] = "LD_UNUSED= ", + weak[] = "LD_NOUNRESWEAK= "; static char *load; static const char *prefile_32, *prefile_64, *prefile; @@ -178,7 +173,7 @@ Elf *elf; int cflag = 0, dflag = 0, fflag = 0, iflag = 0, Lflag = 0; int lflag = 0, rflag = 0, sflag = 0, Uflag = 0, uflag = 0; - int vflag = 0, nfile, var, error = 0; + int vflag = 0, wflag = 0, nfile, var, error = 0; Listnode *lnp; @@ -243,6 +238,9 @@ case 'v' : /* enable verbose output */ vflag = 1; break; + case 'w' : /* disable unresolved weak */ + wflag = 1; /* references */ + break; default : error++; break; @@ -307,17 +305,18 @@ * has these in their environment ... sort of thing the test folks * would do :-) */ - warn[LD_WARN_SIZE - 1] = (dflag || rflag || Uflag || uflag) ? '1' : + warn[sizeof (warn) - 2] = (dflag || rflag || Uflag || uflag) ? '1' : '\0'; - bind[LD_BIND_SIZE - 1] = (rflag) ? '1' : '\0'; - path[LD_PATH_SIZE - 1] = (sflag) ? '1' : '\0'; - verb[LD_VERB_SIZE - 1] = (vflag) ? '1' : '\0'; - fltr[LD_FLTR_SIZE - 1] = (Lflag) ? '\0' : (lflag) ? '2' : '1'; - init[LD_INIT_SIZE - 1] = (iflag) ? '1' : '\0'; - conf[LD_CONF_SIZE - 1] = (cflag) ? '1' : '\0'; - lazy[LD_LAZY_SIZE - 1] = (Lflag) ? '\0' : '1'; - uref[LD_UREF_SIZE - 1] = (Uflag) ? '1' : '\0'; - used[LD_USED_SIZE - 1] = (uflag) ? '1' : '\0'; + bind[sizeof (bind) - 2] = (rflag) ? '1' : '\0'; + path[sizeof (path) - 2] = (sflag) ? '1' : '\0'; + verb[sizeof (verb) - 2] = (vflag) ? '1' : '\0'; + fltr[sizeof (fltr) - 2] = (Lflag) ? '\0' : (lflag) ? '2' : '1'; + init[sizeof (init) - 2] = (iflag) ? '1' : '\0'; + conf[sizeof (conf) - 2] = (cflag) ? '1' : '\0'; + lazy[sizeof (lazy) - 2] = (Lflag) ? '\0' : '1'; + uref[sizeof (uref) - 2] = (Uflag) ? '1' : '\0'; + used[sizeof (used) - 2] = (uflag) ? '1' : '\0'; + weak[sizeof (weak) - 2] = (wflag) ? '1' : '\0'; /* * coordinate libelf's version information @@ -420,7 +419,7 @@ */ if (gelf_getehdr(elf, &ehdr) == NULL) { (void) fprintf(stderr, MSG_INTL(MSG_ELF_GETEHDR), - cname, fname, elf_errmsg(-1)); + cname, fname, elf_errmsg(-1)); return (1); } @@ -429,7 +428,7 @@ */ if ((class = is_runnable(&ehdr)) == ELFCLASSNONE) { (void) fprintf(stderr, MSG_INTL(MSG_ELF_CLASSDATA), - cname, fname); + cname, fname); return (1); } @@ -439,18 +438,18 @@ if ((ehdr.e_type != ET_EXEC) && (ehdr.e_type != ET_DYN) && (ehdr.e_type != ET_REL)) { (void) fprintf(stderr, MSG_INTL(MSG_ELF_BADMAGIC), - cname, fname); + cname, fname); return (1); } if ((class == ELFCLASS32) && (ehdr.e_machine != M_MACH)) { if (ehdr.e_machine != M_MACHPLUS) { (void) fprintf(stderr, MSG_INTL(MSG_ELF_MACHTYPE), - cname, fname); + cname, fname); return (1); } if ((ehdr.e_flags & M_FLAGSPLUS) == 0) { (void) fprintf(stderr, MSG_INTL(MSG_ELF_MACHFLAGS), - cname, fname); + cname, fname); return (1); } } @@ -464,7 +463,7 @@ if (access(fname, X_OK) != 0) { if (ehdr.e_type == ET_EXEC) { (void) fprintf(stderr, MSG_INTL(MSG_USP_NOTEXEC_1), - cname, fname); + cname, fname); return (1); } (void) fprintf(stderr, MSG_INTL(MSG_USP_NOTEXEC_2), cname, @@ -480,7 +479,7 @@ if (gelf_getphdr(elf, cnt, &phdr) == NULL) { (void) fprintf(stderr, MSG_INTL(MSG_ELF_GETPHDR), - cname, fname, elf_errmsg(-1)); + cname, fname, elf_errmsg(-1)); return (1); } @@ -518,7 +517,7 @@ (strncmp(interpreter, MSG_ORIG(MSG_PTH_ETCLIB), MSG_PTH_ETCLIB_SIZE) != 0)) { (void) fprintf(stderr, MSG_INTL(MSG_USP_ELFINS), - cname, fname, interpreter); + cname, fname, interpreter); return (1); } } @@ -562,7 +561,6 @@ return (run(nfile, cname, fname, conv_lddstub(class), class)); } - static int aout_check(int nfile, char *fname, char *cname, int fd, int fflag) { @@ -701,9 +699,15 @@ cname); exit(1); } - load[LD_LOAD_SIZE - 1] = '2'; + + /* + * The pointer "load" has be assigned to load_elf[] or + * load_aout[]. Use the size of load_elf[] as the size + * of load_aout[] is the same. + */ + load[sizeof (load_elf) - 2] = '2'; } else - load[LD_LOAD_SIZE - 1] = '1'; + load[sizeof (load_elf) - 2] = '1'; /* @@ -715,7 +719,7 @@ (putenv(fltr) != 0) || (putenv(conf) != 0) || (putenv(init) != 0) || (putenv(lazy) != 0) || (putenv(uref) != 0) || (putenv(used) != 0) || - (putenv(load) != 0)) { + (putenv(weak) != 0) || (putenv(load) != 0)) { (void) fprintf(stderr, MSG_INTL(MSG_ENV_FAILED), cname); exit(1); }
--- a/usr/src/cmd/sgs/ldd/common/ldd.msg Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/sgs/ldd/common/ldd.msg Mon Aug 27 09:15:33 2007 -0700 @@ -1,5 +1,5 @@ # -# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Copyright 2007 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # CDDL HEADER START @@ -34,7 +34,7 @@ # Argument usage messages. @ MSG_ARG_USAGE "usage: %s [-d | -r] [-c] [-e envar] [-f] [-i] [-L] \ - [-l] [-s] [-U | -u] [-v] file(s)\n" + [-l] [-s] [-U | -u] [-v] [-w] file(s)\n" # Environment messages. @@ -97,7 +97,7 @@ @ MSG_SUNW_OST_SGS "SUNW_OST_SGS" -@ MSG_STR_GETOPT "cde:fiLlrsUuv" +@ MSG_STR_GETOPT "cde:fiLlrsUuvw" @ MSG_STR_FMT1 "%s=./%s %s" @ MSG_STR_FMT2 "%s=%s %s" @ MSG_STR_FMT3 "%s:\n"
--- a/usr/src/cmd/sgs/packages/common/SUNWonld-README Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README Mon Aug 27 09:15:33 2007 -0700 @@ -1254,3 +1254,4 @@ 6583742 ELF string conversion library needs to lose static writable buffers 6589819 ld generated reference to __tls_get_addr() fails when resolving to a shared object reference +6595139 various applications should export yy* global variables for libl
--- a/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c Mon Aug 27 09:15:33 2007 -0700 @@ -806,9 +806,21 @@ if (rtype != R_AMD64_JUMP_SLOT) sl.sl_flags |= LKUP_SPEC; - bind = ELF_ST_BIND(symref->st_info); - if (bind == STB_WEAK) + /* + * Under ldd -w, any unresolved weak + * references are diagnosed. Set the + * symbol binding as global to trigger + * a relocation error if the symbol can + * not be found. + */ + if (LIST(lmp)->lm_flags & + LML_FLG_TRC_NOUNRESWEAK) { + bind = STB_GLOBAL; + } else if ((bind = + ELF_ST_BIND(symref->st_info)) == + STB_WEAK) { sl.sl_flags |= LKUP_WEAK; + } symdef = lookup_sym(&sl, &_lmp, &binfo);
--- a/usr/src/cmd/sgs/rtld/common/rtld.msg Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/sgs/rtld/common/rtld.msg Mon Aug 27 09:15:33 2007 -0700 @@ -353,6 +353,7 @@ @ MSG_LD_NOFLTCONFIG "NOFLTCONFIG" @ MSG_LD_NOLAZY "NOLAZYLOAD" @ MSG_LD_NOOBJALTER "NOOBJALTER" +@ MSG_LD_NOUNRESWEAK "NOUNRESWEAK" @ MSG_LD_NOVERSION "NOVERSION" @ MSG_LD_ORIGIN "ORIGIN" @ MSG_LD_PRELOAD "PRELOAD"
--- a/usr/src/cmd/sgs/rtld/common/util.c Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/sgs/rtld/common/util.c Mon Aug 27 09:15:33 2007 -0700 @@ -1390,6 +1390,7 @@ #define ENV_FLG_WARN 0x0800000000ULL #define ENV_FLG_NOFLTCONFIG 0x1000000000ULL #define ENV_FLG_BIND_LAZY 0x2000000000ULL +#define ENV_FLG_NOUNRESWEAK 0x4000000000ULL #ifdef SIEBEL_DISABLE #define ENV_FLG_FIX_1 0x8000000000ULL @@ -1693,6 +1694,15 @@ select |= SEL_ACT_RT; val = RT_FL_NOVERSION; variable = ENV_FLG_NOVERSION; + } else if ((len == MSG_LD_NOUNRESWEAK_SIZE) && (strncmp(s1, + MSG_ORIG(MSG_LD_NOUNRESWEAK), + MSG_LD_NOUNRESWEAK_SIZE) == 0)) { + /* + * LD_NOUNRESWEAK (internal, used by ldd(1)). + */ + select |= SEL_ACT_LML; + val = LML_FLG_TRC_NOUNRESWEAK; + variable = ENV_FLG_NOUNRESWEAK; } } /*
--- a/usr/src/cmd/sgs/rtld/i386/i386_elf.c Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/sgs/rtld/i386/i386_elf.c Mon Aug 27 09:15:33 2007 -0700 @@ -762,9 +762,21 @@ if (rtype != R_386_JMP_SLOT) sl.sl_flags |= LKUP_SPEC; - bind = ELF_ST_BIND(symref->st_info); - if (bind == STB_WEAK) + /* + * Under ldd -w, any unresolved weak + * references are diagnosed. Set the + * symbol binding as global to trigger + * a relocation error if the symbol can + * not be found. + */ + if (LIST(lmp)->lm_flags & + LML_FLG_TRC_NOUNRESWEAK) { + bind = STB_GLOBAL; + } else if ((bind = + ELF_ST_BIND(symref->st_info)) == + STB_WEAK) { sl.sl_flags |= LKUP_WEAK; + } symdef = lookup_sym(&sl, &_lmp, &binfo);
--- a/usr/src/cmd/sgs/rtld/sparc/sparc_elf.c Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/sgs/rtld/sparc/sparc_elf.c Mon Aug 27 09:15:33 2007 -0700 @@ -846,9 +846,21 @@ if (rtype != R_SPARC_JMP_SLOT) sl.sl_flags |= LKUP_SPEC; - bind = ELF_ST_BIND(symref->st_info); - if (bind == STB_WEAK) + /* + * Under ldd -w, any unresolved weak + * references are diagnosed. Set the + * symbol binding as global to trigger + * a relocation error if the symbol can + * not be found. + */ + if (LIST(lmp)->lm_flags & + LML_FLG_TRC_NOUNRESWEAK) { + bind = STB_GLOBAL; + } else if ((bind = + ELF_ST_BIND(symref->st_info)) == + STB_WEAK) { sl.sl_flags |= LKUP_WEAK; + } symdef = lookup_sym(&sl, &_lmp, &binfo);
--- a/usr/src/cmd/sgs/rtld/sparcv9/sparc_elf.c Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/sgs/rtld/sparcv9/sparc_elf.c Mon Aug 27 09:15:33 2007 -0700 @@ -1088,9 +1088,21 @@ if (rtype != R_SPARC_JMP_SLOT) sl.sl_flags |= LKUP_SPEC; - bind = ELF_ST_BIND(symref->st_info); - if (bind == STB_WEAK) + /* + * Under ldd -w, any unresolved weak + * references are diagnosed. Set the + * symbol binding as global to trigger + * a relocation error if the symbol can + * not be found. + */ + if (LIST(lmp)->lm_flags & + LML_FLG_TRC_NOUNRESWEAK) { + bind = STB_GLOBAL; + } else if ((bind = + ELF_ST_BIND(symref->st_info)) == + STB_WEAK) { sl.sl_flags |= LKUP_WEAK; + } symdef = lookup_sym(&sl, &_lmp, &binfo);
--- a/usr/src/cmd/svc/svccfg/Makefile Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/svc/svccfg/Makefile Mon Aug 27 09:15:33 2007 -0700 @@ -60,9 +60,15 @@ $(NATIVE_BUILD)PROG = $(MYPROG:%=%-native) $(NATIVE_BUILD)OBJS = $(MYOBJS:%.o=%-native.o) +# svccfg has a name clash with main() and libl.so.1. However, svccfg must +# still export a number of "yy*" (libl) interfaces. Reduce all other symbols +# to local scope. +MAPFILES += $(MAPFILE.LEX) $(MAPFILE.NGB) +MAPOPTS = $(MAPFILES:%=-M%) + MYCPPFLAGS = -I ../common -I/usr/include/libxml2 CPPFLAGS += $(MYCPPFLAGS) -LDFLAGS += $(MAPFILE.NGB:%=-M%) +LDFLAGS += $(MAPOPTS) LFLAGS = -t YFLAGS = -d @@ -114,7 +120,7 @@ @cd $(LIBSCF)/native; pwd; $(MAKE) $(MFLAGS) install @NATIVE_BUILD= $(MAKE) $(MFLAGS) all -$(PROG): $(OBJS) $(MAPFILE.NGB) +$(PROG): $(OBJS) $(MAPFILES) $(LINK.c) -o $@ $(OBJS) $(LDLIBS) $(CTFMERGE_HOOK) $(POST_PROCESS)
--- a/usr/src/cmd/zonecfg/Makefile Mon Aug 27 08:25:15 2007 -0700 +++ b/usr/src/cmd/zonecfg/Makefile Mon Aug 27 09:15:33 2007 -0700 @@ -30,18 +30,24 @@ include ../Makefile.cmd +# zonecfg has a name clash with main() and libl.so.1. However, zonecfg must +# still export a number of "yy*" (libl) interfaces. Reduce all other symbols +# to local scope. +MAPFILES += $(MAPFILE.LEX) $(MAPFILE.NGB) +MAPOPTS = $(MAPFILES:%=-M%) + LFLAGS = -t YFLAGS = -d -b zonecfg_grammar LDLIBS += -lzonecfg -ll -lnsl -ltecla -lzfs -lbrand CPPFLAGS += -I. -LDFLAGS += $(MAPFILE.NGB:%=-M%) +LDFLAGS += $(MAPOPTS) CLEANFILES += zonecfg_lex.c zonecfg_grammar.tab.c zonecfg_grammar.tab.h .KEEP_STATE: all: $(PROG) -$(PROG): $(OBJS) $(MAPFILE.NGB) +$(PROG): $(OBJS) $(MAPFILES) $(LINK.c) -o $@ $(OBJS) $(LDLIBS) $(POST_PROCESS)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/usr/src/common/mapfiles/common/map.lex.yy Mon Aug 27 09:15:33 2007 -0700 @@ -0,0 +1,58 @@ +# +# 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" +# + +# lex generates a lex.yy.c for use in building applications. A number of +# interfaces within this file are intended for libl.so to bind to, and thus +# should remain exported from any application using lex.yy.c. +{ + global: + yyback; + yyextra; + yyfnd; + yyinput; + yyleng; + yylex; + yylsp; + yylstate; + yyolsp; + yyout; + yyprevious; + yytext; + yyunput; +}; + +# Some applications use the -e option of lex, which generates additional lex +# interfaces that are not defined in the generic $(MAPFILE.LEX). Export the +# following interfaces to satisfy -e use. +#{ +# global: +# yywinput; +# yywleng; +# yywtext; +# yywunput; +#};