diff options
author | rie <none@none> | 2006-03-14 09:22:52 -0800 |
---|---|---|
committer | rie <none@none> | 2006-03-14 09:22:52 -0800 |
commit | 5aefb6555731130ca4fd295960123d71f2d21fe8 (patch) | |
tree | 4a9d5ca45517238fab7e100759f72f7083cd2e23 /usr/src | |
parent | 44bb982b3dceb1fe23d61ef29b896b40508e2a5a (diff) | |
download | illumos-joyent-5aefb6555731130ca4fd295960123d71f2d21fe8.tar.gz |
6316708 LD_DEBUG should provide a means of identifying/isolating individual
link-map lists
6280209 elfdump cores on memory model 0x3
6197234 elfdump and dump don't handle 64-bit symbols correctly
--HG--
rename : usr/src/cmd/sgs/libelf/spec/Makefile => deleted_files/usr/src/cmd/sgs/libelf/spec/Makefile
rename : usr/src/cmd/sgs/libelf/spec/Makefile.targ => deleted_files/usr/src/cmd/sgs/libelf/spec/Makefile.targ
rename : usr/src/cmd/sgs/libelf/spec/amd64/Makefile => deleted_files/usr/src/cmd/sgs/libelf/spec/amd64/Makefile
rename : usr/src/cmd/sgs/libelf/spec/elf.spec => deleted_files/usr/src/cmd/sgs/libelf/spec/elf.spec
rename : usr/src/cmd/sgs/libelf/spec/elf32.spec => deleted_files/usr/src/cmd/sgs/libelf/spec/elf32.spec
rename : usr/src/cmd/sgs/libelf/spec/elf64.spec => deleted_files/usr/src/cmd/sgs/libelf/spec/elf64.spec
rename : usr/src/cmd/sgs/libelf/spec/gelf.spec => deleted_files/usr/src/cmd/sgs/libelf/spec/gelf.spec
rename : usr/src/cmd/sgs/libelf/spec/i386/Makefile => deleted_files/usr/src/cmd/sgs/libelf/spec/i386/Makefile
rename : usr/src/cmd/sgs/libelf/spec/sparc/Makefile => deleted_files/usr/src/cmd/sgs/libelf/spec/sparc/Makefile
rename : usr/src/cmd/sgs/libelf/spec/sparcv9/Makefile => deleted_files/usr/src/cmd/sgs/libelf/spec/sparcv9/Makefile
rename : usr/src/cmd/sgs/libelf/spec/versions => deleted_files/usr/src/cmd/sgs/libelf/spec/versions
rename : usr/src/cmd/sgs/libelf/spec/weak.spec => deleted_files/usr/src/cmd/sgs/libelf/spec/weak.spec
rename : usr/src/cmd/sgs/librtld_db/common/lintsup.c => deleted_files/usr/src/cmd/sgs/librtld_db/common/lintsup.c
rename : usr/src/cmd/sgs/libld/amd64/machrel.c => usr/src/cmd/sgs/libld/common/machrel.amd.c
rename : usr/src/cmd/sgs/libld/i386/machrel.c => usr/src/cmd/sgs/libld/common/machrel.intel.c
rename : usr/src/cmd/sgs/libld/sparc/machrel.c => usr/src/cmd/sgs/libld/common/machrel.sparc.c
rename : usr/src/cmd/sgs/libld/i386/machsym.c => usr/src/cmd/sgs/libld/common/machsym.intel.c
rename : usr/src/cmd/sgs/libld/sparc/machsym.c => usr/src/cmd/sgs/libld/common/machsym.sparc.c
rename : usr/src/cmd/sgs/libld/amd64/amd64unwind.c => usr/src/cmd/sgs/libld/common/unwind.amd.c
rename : usr/src/cmd/sgs/librtld_db/common/librtld_db.sparc.msg => usr/src/cmd/sgs/librtld_db/common/librtld_db.sparcv9.msg
rename : usr/src/cmd/sgs/rtld/common/sunwmove.c => usr/src/cmd/sgs/rtld/common/move.c
Diffstat (limited to 'usr/src')
335 files changed, 14418 insertions, 14321 deletions
diff --git a/usr/src/Targetdirs b/usr/src/Targetdirs index b7b86ab6f3..b55eb30c94 100644 --- a/usr/src/Targetdirs +++ b/usr/src/Targetdirs @@ -615,8 +615,6 @@ $(ROOT)/usr/ccs/lib/libl.so:= REALPATH=../../lib/libl.so.1 $(ROOT)/usr/ccs/lib/llib-ll.ln:= REALPATH=../../lib/llib-ll.ln $(ROOT)/usr/ccs/lib/liby.so:= REALPATH=../../lib/liby.so.1 $(ROOT)/usr/ccs/lib/llib-ly.ln:= REALPATH=../../lib/llib-ly.ln -$(ROOT)/usr/ccs/lib/libld.so.2:= REALPATH=../../../lib/libld.so.2 -$(ROOT)/usr/ccs/lib/libld.so.3:= REALPATH=../../../lib/libld.so.3 $(ROOT)/usr/lib/libp/libc.so.1:= REALPATH=../../../lib/libc.so.1 $(ROOT)/usr/lib/lwp/libthread.so.1:= REALPATH=../libthread.so.1 $(ROOT)/usr/lib/lwp/libthread_db.so.1:= REALPATH=../libthread_db.so.1 @@ -672,10 +670,6 @@ $(ROOT)/usr/ccs/lib/$(MACH64)/liby.so:= \ REALPATH=../../../lib/$(MACH64)/liby.so.1 $(ROOT)/usr/ccs/lib/$(MACH64)/llib-ly.ln:= \ REALPATH=../../../lib/$(MACH64)/llib-ly.ln -$(ROOT)/usr/ccs/lib/$(MACH64)/libld.so.2:= \ - REALPATH=../../../../lib/$(MACH64)/libld.so.2 -$(ROOT)/usr/ccs/lib/$(MACH64)/libld.so.3:= \ - REALPATH=../../../../lib/$(MACH64)/libld.so.3 $(ROOT)/usr/lib/libp/$(MACH64)/libc.so.1:= \ REALPATH=../../../../lib/$(MACH64)/libc.so.1 $(ROOT)/usr/lib/lwp/$(MACH64)/libthread.so.1:= \ @@ -716,13 +710,11 @@ SYM.USRCCSLIB= \ /usr/ccs/lib/llib-ll.ln \ /usr/ccs/lib/liby.so \ /usr/ccs/lib/llib-ly.ln \ - /usr/ccs/lib/libld.so.2 \ /usr/lib/libp/libc.so.1 \ /usr/lib/lwp/libthread.so.1 \ /usr/lib/lwp/libthread_db.so.1 SYM.USRCCSLIB64= \ - /usr/ccs/lib/libld.so.3 \ /usr/ccs/lib/$(MACH64)/libcurses.so \ /usr/ccs/lib/$(MACH64)/llib-lcurses.ln \ /usr/ccs/lib/$(MACH64)/libform.so \ @@ -748,8 +740,6 @@ SYM.USRCCSLIB64= \ /usr/ccs/lib/$(MACH64)/llib-ll.ln \ /usr/ccs/lib/$(MACH64)/liby.so \ /usr/ccs/lib/$(MACH64)/llib-ly.ln \ - /usr/ccs/lib/$(MACH64)/libld.so.2 \ - /usr/ccs/lib/$(MACH64)/libld.so.3 \ /usr/lib/libp/$(MACH64)/libc.so.1 \ /usr/lib/lwp/$(MACH64)/libthread.so.1 \ /usr/lib/lwp/$(MACH64)/libthread_db.so.1 @@ -818,8 +808,6 @@ $(ROOT)/usr/lib/libintl.so.1:= REALPATH=../../lib/libintl.so.1 $(ROOT)/usr/lib/libintl.so:= REALPATH=../../lib/libintl.so.1 $(ROOT)/usr/lib/libkstat.so.1:= REALPATH=../../lib/libkstat.so.1 $(ROOT)/usr/lib/libkstat.so:= REALPATH=../../lib/libkstat.so.1 -$(ROOT)/usr/lib/libld.so.2:= REALPATH=../../lib/libld.so.2 -$(ROOT)/usr/lib/libld.so.3:= REALPATH=../../lib/libld.so.3 $(ROOT)/usr/lib/liblddbg.so.4:= REALPATH=../../lib/liblddbg.so.4 $(ROOT)/usr/lib/libmd5.so.1:= REALPATH=../../lib/libmd5.so.1 $(ROOT)/usr/lib/libmd5.so:= REALPATH=../../lib/libmd5.so.1 @@ -1081,10 +1069,6 @@ $(ROOT)/usr/lib/$(MACH64)/libkstat.so.1:= \ REALPATH=../../../lib/$(MACH64)/libkstat.so.1 $(ROOT)/usr/lib/$(MACH64)/libkstat.so:= \ REALPATH=../../../lib/$(MACH64)/libkstat.so.1 -$(ROOT)/usr/lib/$(MACH64)/libld.so.2:= \ - REALPATH=../../../lib/$(MACH64)/libld.so.2 -$(ROOT)/usr/lib/$(MACH64)/libld.so.3:= \ - REALPATH=../../../lib/$(MACH64)/libld.so.3 $(ROOT)/usr/lib/$(MACH64)/liblddbg.so.4:= \ REALPATH=../../../lib/$(MACH64)/liblddbg.so.4 $(ROOT)/usr/lib/$(MACH64)/libmd5.so.1:= \ @@ -1376,7 +1360,6 @@ SYM.USRLIB= \ /usr/lib/libintl.so.1 \ /usr/lib/libkstat.so \ /usr/lib/libkstat.so.1 \ - /usr/lib/libld.so.2 \ /usr/lib/liblddbg.so.4 \ /usr/lib/libmd5.so \ /usr/lib/libmd5.so.1 \ @@ -1602,8 +1585,6 @@ SYM.USRLIB64= \ /usr/lib/$(MACH64)/libintl.so.1 \ /usr/lib/$(MACH64)/libkstat.so \ /usr/lib/$(MACH64)/libkstat.so.1 \ - /usr/lib/$(MACH64)/libld.so.2 \ - /usr/lib/$(MACH64)/libld.so.3 \ /usr/lib/$(MACH64)/liblddbg.so.4 \ /usr/lib/$(MACH64)/libmd5.so \ /usr/lib/$(MACH64)/libmd5.so.1 \ @@ -1716,8 +1697,7 @@ SYM.USRLIB64= \ /usr/lib/$(MACH64)/nss_files.so.1 \ /usr/lib/$(MACH64)/nss_nis.so.1 \ /usr/lib/$(MACH64)/nss_nisplus.so.1 \ - /usr/lib/$(MACH64)/nss_user.so.1 \ - /usr/lib/libld.so.3 + /usr/lib/$(MACH64)/nss_user.so.1 $(SYM.USRLIB:%=$(ROOT)%):= \ INS.dir= -$(RM) $@; $(SYMLINK) $(REALPATH) $@; \ diff --git a/usr/src/cmd/sgs/Makefile b/usr/src/cmd/sgs/Makefile index a6db073295..40572f3e35 100644 --- a/usr/src/cmd/sgs/Makefile +++ b/usr/src/cmd/sgs/Makefile @@ -28,11 +28,8 @@ include $(SRC)/cmd/Makefile.cmd SUBDIRS-common= libconv \ - .WAIT \ libdl \ - .WAIT \ libelf \ - .WAIT \ liblddbg \ .WAIT \ libld \ diff --git a/usr/src/cmd/sgs/Makefile.com b/usr/src/cmd/sgs/Makefile.com index e90a394f0d..d45a4d537b 100644 --- a/usr/src/cmd/sgs/Makefile.com +++ b/usr/src/cmd/sgs/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,27 +18,30 @@ # # CDDL HEADER END # + # -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# cmd/sgs/Makefile.com +# ident "%Z%%M% %I% %E% SMI" +# .KEEP_STATE: +.KEEP_STATE_FILE: .make.state.$(MACH) + include $(SRC)/cmd/sgs/Makefile.var -SRCBASE= ../../../.. +SRCBASE = ../../../.. -i386_ARCH= $(VAR_I386_ARCH) -sparc_ARCH= sparc +i386_ARCH = $(VAR_I386_ARCH) +sparc_ARCH = sparc -ARCH= $($(MACH)_ARCH) +ARCH = $($(MACH)_ARCH) -ROOTCCSBIN64= $(ROOTCCSBIN)/$(MACH64) -ROOTCCSBINPROG64= $(PROG:%=$(ROOTCCSBIN64)/%) +ROOTCCSBIN64 = $(ROOTCCSBIN)/$(MACH64) +ROOTCCSBINPROG64 = \ + $(PROG:%=$(ROOTCCSBIN64)/%) # Establish any global flags. @@ -47,17 +49,17 @@ ROOTCCSBINPROG64= $(PROG:%=$(ROOTCCSBIN64)/%) # checking. This is automatically enabled for DEBUG builds, not for non-debug # builds. Unset the global C99_DISABLE flag to insure we uncover all compiler # warnings/errors. -DEBUG= +DEBUG = $(NOT_RELEASE_BUILD)DEBUG = -DDEBUG -C99_DISABLE= $(C99_ENABLE) +C99_DISABLE = $(C99_ENABLE) CFLAGS += $(CCVERBOSE) $(DEBUG) $(XFFLAG) CFLAGS64 += $(CCVERBOSE) $(DEBUG) $(XFFLAG) # Reassign CPPFLAGS so that local search paths are used before any parent # $ROOT paths. -CPPFLAGS= -I. -I../common -I../../include -I../../include/$(MACH) \ +CPPFLAGS = -I. -I../common -I../../include -I../../include/$(MACH) \ $(VAR_CPPFLAGS) $(CPPFLAGS.master) # PICS64 is unique to our environment @@ -70,62 +72,59 @@ DYNFLAGS += $(ZIGNORE) # Establish the local tools, proto and package area. -SGSHOME= $(SRC)/cmd/sgs -SGSPROTO= $(SGSHOME)/proto/$(MACH) -SGSTOOLS= $(SGSHOME)/tools -SGSMSGID= $(SGSHOME)/messages -SGSMSGDIR= $(SGSHOME)/messages/$(MACH) -SGSONLD= $(ROOT)/opt/SUNWonld -SGSRPATH= /usr/lib -SGSRPATH64= $(SGSRPATH)/$(MACH64) +SGSHOME = $(SRC)/cmd/sgs +SGSPROTO = $(SGSHOME)/proto/$(MACH) +SGSTOOLS = $(SGSHOME)/tools +SGSMSGID = $(SGSHOME)/messages +SGSMSGDIR = $(SGSHOME)/messages/$(MACH) +SGSONLD = $(ROOT)/opt/SUNWonld +SGSRPATH = /usr/lib +SGSRPATH64 = $(SGSRPATH)/$(MACH64) # -# Macros to be used to include link against libconv and include -# vernote.o +# Macros to be used to include link against libconv and include vernote.o # -VERSREF= -ulink_ver_string -CONVLIBDIR= -L$(SGSHOME)/libconv/$(MACH) -CONVLIBDIR64= -L$(SGSHOME)/libconv/$(MACH64) +VERSREF = -ulink_ver_string -ELFLIBDIR= -L$(SGSHOME)/libelf/$(MACH) -ELFLIBDIR64= -L$(SGSHOME)/libelf/$(MACH64) +LDLIBDIR = -L$(SGSHOME)/libld/$(MACH) +LDLIBDIR64 = -L$(SGSHOME)/libld/$(MACH64) -LDDBGLIBDIR= -L$(SGSHOME)/liblddbg/$(MACH) -LDDBGLIBDIR64= -L$(SGSHOME)/liblddbg/$(MACH64) +CONVLIBDIR = -L$(SGSHOME)/libconv/$(MACH) +CONVLIBDIR64 = -L$(SGSHOME)/libconv/$(MACH64) +ELFLIBDIR = -L$(SGSHOME)/libelf/$(MACH) +ELFLIBDIR64 = -L$(SGSHOME)/libelf/$(MACH64) +LDDBGLIBDIR = -L$(SGSHOME)/liblddbg/$(MACH) +LDDBGLIBDIR64 = -L$(SGSHOME)/liblddbg/$(MACH64) # The cmd/Makefile.com and lib/Makefile.com define TEXT_DOMAIN. We don't need # this definition as the sgs utilities obtain their domain via sgsmsg(1l). -DTEXTDOM= - +DTEXTDOM = # Define any generic sgsmsg(1l) flags. The default message generation system # is to use gettext(3i), add the -C flag to switch to catgets(3c). -SGSMSG= $(SGSTOOLS)/$(MACH)/sgsmsg -CHKMSG= $(SGSTOOLS)/chkmsg.sh +SGSMSG = $(SGSTOOLS)/$(MACH)/sgsmsg +CHKMSG = $(SGSTOOLS)/chkmsg.sh SGSMSGVFLAG = SGSMSGFLAGS = $(SGSMSGVFLAG) -i $(SGSMSGID)/sgs.ident -CHKMSGFLAGS= $(SGSMSGTARG:%=-m %) $(SGSMSGCHK:%=-m %) - +CHKMSGFLAGS = $(SGSMSGTARG:%=-m %) $(SGSMSGCHK:%=-m %) # Native targets should use the minimum of ld(1) flags to allow building on # previous releases. We use mapfiles to scope, but don't bother versioning. -native:= DYNFLAGS = $(MAPOPTS) -R$(SGSPROTO) -L$(SGSPROTO) $(ZNOVERSION) +native := DYNFLAGS = $(MAPOPTS) -R$(SGSPROTO) -L$(SGSPROTO) $(ZNOVERSION) -USE_PROTO= -Yl,$(SGSPROTO) - -.KEEP_STATE_FILE: .make.state.$(MACH) +USE_PROTO = -Yl,$(SGSPROTO) # # lint-related stuff # -DASHES= "------------------------------------------------------------" +DASHES = "------------------------------------------------------------" LIBNAME32 = $(LIBNAME:%=%32) LIBNAME64 = $(LIBNAME:%=%64) @@ -144,18 +143,21 @@ LINTLIBS = $(LINTLIB32) $(LINTLIB64) LINTFLAGS = -m -errtags=yes -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED LINTFLAGS64 = -m -errtags=yes -erroff=E_SUPPRESSION_DIRECTIVE_UNUSED \ - -errchk=longptr64 $(VAR_LINTFLAGS64) + $(VAR_LINTFLAGS64) \ # -# These libraries have two resulting lint libraries. -# If a dependency is declared using these variables, -# the substitution for the 32/64 versions at lint time -# will happen automatically (see Makefile.targ). +# These libraries have two resulting lint libraries. If a dependency is +# declared using these variables, the substitution for the 32/64 versions at +# lint time happens automatically (see Makefile.targ). # -LDDBG_LIB= -llddbg -LDDBG_LIB32= -llddbg32 -LDDBG_LIB64= -llddbg64 +LD_LIB = -lld +LD_LIB32 = -lld32 +LD_LIB64 = -lld64 + +LDDBG_LIB = -llddbg +LDDBG_LIB32 = -llddbg32 +LDDBG_LIB64 = -llddbg64 -LD_LIB= -lld -LD_LIB32= -lld32 -LD_LIB64= -lld64 +CONV_LIB = -lconv +CONV_LIB32 = -lconv32 +CONV_LIB64 = -lconv64 diff --git a/usr/src/cmd/sgs/Makefile.sub b/usr/src/cmd/sgs/Makefile.sub index f03c70f40f..08fb449778 100644 --- a/usr/src/cmd/sgs/Makefile.sub +++ b/usr/src/cmd/sgs/Makefile.sub @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,10 +18,11 @@ # # CDDL HEADER END # + # # ident "%Z%%M% %I% %E% SMI" # -# Copyright 2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # Standard subdirs makefile for the sgs area. @@ -42,8 +42,7 @@ include $(SRC)/Makefile.master # to build whatever 64-bit directories we actually find as a side-effect # of descending into the 32-bit directories. Ick. -# Note, SPECDIR is defined only in those targets that require spec files. -SUBDIRS = $(PRESUBDIRS) $(SPECDIR) $(MACH) $(EXTRASUBDIRS) +SUBDIRS = $(MACH) $(EXTRASUBDIRS) all := TARGET= all clean := TARGET= clean @@ -55,8 +54,8 @@ catalog := TARGET= catalog package := TARGET= package chkmsg := TARGET= chkmsg -.KEEP_STATE_FILE: .make.state.$(MACH) .KEEP_STATE: +.KEEP_STATE_FILE: .make.state.$(MACH) all clean clobber delete install lint catalog package chkmsg: \ $(SUBDIRS) diff --git a/usr/src/cmd/sgs/Makefile.sub.64 b/usr/src/cmd/sgs/Makefile.sub.64 index 661b0b00e9..521ef23ca6 100644 --- a/usr/src/cmd/sgs/Makefile.sub.64 +++ b/usr/src/cmd/sgs/Makefile.sub.64 @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,15 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -# Copyright (c) 1997, by Sun Microsystems, Inc. -# All rights reserved. +# ident "%Z%%M% %I% %E% SMI" # -#ident "%Z%%M% %I% %E% SMI" # # Include overrides for building 64-bit objects # -include ../../../../Makefile.master.64 +include $(SRC)/Makefile.master.64 diff --git a/usr/src/cmd/sgs/Makefile.targ b/usr/src/cmd/sgs/Makefile.targ index dc6f859e3b..f43cd7c737 100644 --- a/usr/src/cmd/sgs/Makefile.targ +++ b/usr/src/cmd/sgs/Makefile.targ @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,64 +18,59 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -# cmd/sgs/Makefile.targ ################################################################################ # # Linting the Linker Libraries # -# Several of the linker's libraries are, in whole or in part, -# are built in two passes, once as Elf32 and once as Elf64, -# i.e. with -D_ELF64 defined. Lint needs to be able to do -# both passes, but combining the two is problematic for the -# 2nd pass of lint, as it sees many interfaces as being defined -# both ways and considers them to be incompatible. The targets -# defined here allow for both passes to live independently. -# This means that both the lint.out, and the lint library itself -# get generated separately, to different output files. The -# lint.out's get combined into a single lint.out report, and -# the lint libraries get generated with a 32/64 suffix. The -# dependents on these lint libraries, then, choose which version -# the need to use. Substitutions can be made automatically if -# the macro's defined in ./Makefile.com are used to specify -# the dependency, for those libs that need them. +# Several of the linker's libraries are, in whole or in part, built in two +# passes, once as Elf32 and once as Elf64 (i.e. with -D_ELF64 defined). Lint +# needs to be able to do both passes, but combining the two is problematic for +# the 2nd pass of lint, as it sees many interfaces as being defined both ways +# and considers them to be incompatible. The targets defined here allow for +# both passes to live independently. This means that both the lint.out, and +# the lint library itself get generated separately, to different output files. +# The lint.out's get combined into a single lint.out report, and the lint +# libraries get generated with a 32/64 suffix. The dependents on these lint +# libraries, then, choose which version they need to use. Substitutions can +# be made automatically if the macro's defined in ./Makefile.com are used to +# specify the dependency, for those libs that need them. # # Don't # -# Don't use the /*LINTLIBRARY*/ directive in linker libraries, -# this disables some important checks, including the ability -# to test format strings from the msg.h files. +# Don't use the /*LINTLIBRARY*/ directive in linker libraries, this disables +# some important checks, including the ability to test format strings from the +# msg.h files. # -# Don't use the `-x' option to lint when linting linker libraries. -# This masks all the dead wood in our own header files. Instead, -# there has been added to the relevant common directories a file -# called `lintsup.c' which is used to mask out the headers that -# we aren't interested in. This method is used for libraries, like -# libld, which have their own header files, but is irrelevant to -# libraries like libldstab which exports no interface of it's own. +# Don't use the `-x' option to lint when linting linker libraries. This masks +# all the dead wood in our own header files. Instead, there has been added to +# the relevant common directories a file called `lintsup.c' which is used to +# mask out the headers that we aren't interested in. This method is used for +# libraries, like libld, which have their own header files, but is irrelevant +# to libraries like libldstab which exports no interface of it's own. # -# The `lintsup.c' file can also be used, in some cases, to mask -# out other issues that lint won't otherwise shut up about. +# The `lintsup.c' file can also be used, in some cases, to mask out other +# issues that lint won't otherwise shut up about. # # Other Lint Options # -# `-m' has been added to the LINTFLAGS. Warnings about globals -# that could be static are irrelevant because we use mapfiles to -# scope down unnecessary globals. +# `-m' has been added to the LINTFLAGS. Warnings about globals that could be +# static are irrelevant as we use mapfiles to scope down unnecessary globals. # -# `-u' is used in the LINTFLAGS for libraries, otherwise lint -# tends to be very noisy. +# `-u' is used in the LINTFLAGS for libraries, otherwise lint tends to be very +# noisy. # -# `-x' is avoided for libraries, but is used for executables -# because all we care about is that what we use is defined, -# not about declarations in public headers that we don't use. +# `-x' is avoided for libraries, but is used for executables because all we +# care about is that what we use is defined, not about declarations in public +# headers that we don't use. # # Relevant variables: # @@ -119,13 +113,16 @@ LINTOUT = $(LINTOUT1) # -# If LD_LIB or LDDBG_LIB is added to LDLIBS, then the -# right lint library should be picked up automatically. +# If LD_LIB, LDDBG_LIB, or CONV_LIB is added to LDLIBS, then the right lint +# library should be picked up automatically. # $(LINTOUT32) := LD_LIB=$(LD_LIB32) $(LINTOUT32) := LDDBG_LIB=$(LDDBG_LIB32) +$(LINTOUT32) := CONV_LIB=$(CONV_LIB32) + $(LINTOUT64) := LD_LIB=$(LD_LIB64) $(LINTOUT64) := LDDBG_LIB=$(LDDBG_LIB64) +$(LINTOUT64) := CONV_LIB=$(CONV_LIB64) # # Force $(LINTLIB) in order to help the $(SGSLINTOUT) @@ -185,16 +182,20 @@ $(SGSLINTOUT): FRC $(ROOTLIBDIR)/$(LINTLIBSRC): ../common/$(LINTLIBSRC) $(INS.file) ../common/$(LINTLIBSRC) -$(VAR_POUND_1)$(ROOTFS_LIBDIR)/$(LIBLINKS): $(ROOTFS_LIBDIR)/$(LIBLINKS)$(VERS) +$(VAR_POUND_1)$(ROOTFS_LIBDIR)/$(LIBLINKS): \ + $(ROOTFS_LIBDIR)/$(LIBLINKS)$(VERS) $(VAR_POUND_1) $(INS.liblink) -$(VAR_POUND_1)$(ROOTFS_LIBDIR64)/$(LIBLINKS): $(ROOTFS_LIBDIR64)/$(LIBLINKS)$(VERS) +$(VAR_POUND_1)$(ROOTFS_LIBDIR64)/$(LIBLINKS): \ + $(ROOTFS_LIBDIR64)/$(LIBLINKS)$(VERS) $(VAR_POUND_1) $(INS.liblink64) -$(VAR_POUND_1)$(ROOTFS_LIBDIR)/$(LIBLINKSCCC): $(ROOTFS_LIBDIR)/$(LIBLINKSCCC)$(VERS) +$(VAR_POUND_1)$(ROOTFS_LIBDIR)/$(LIBLINKSCCC): \ + $(ROOTFS_LIBDIR)/$(LIBLINKSCCC)$(VERS) $(VAR_POUND_1) $(INS.liblinkccc) -$(VAR_POUND_1)$(ROOTFS_LIBDIR64)/$(LIBLINKSCCC): $(ROOTFS_LIBDIR64)/$(LIBLINKSCCC)$(VERS) +$(VAR_POUND_1)$(ROOTFS_LIBDIR64)/$(LIBLINKSCCC): \ + $(ROOTFS_LIBDIR64)/$(LIBLINKSCCC)$(VERS) $(VAR_POUND_1) $(INS.liblinkccc64) FRC: diff --git a/usr/src/cmd/sgs/Makefile.var b/usr/src/cmd/sgs/Makefile.var index 5513cae0aa..6e5417ab04 100644 --- a/usr/src/cmd/sgs/Makefile.var +++ b/usr/src/cmd/sgs/Makefile.var @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,26 +18,24 @@ # # CDDL HEADER END # + # -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# cmd/sgs/Makefile.var +# ident "%Z%%M% %I% %E% SMI" # -# The link-editor related source files and Makefile files -# are unified for on10-gate, on{81,28,998}-patch gates. -# However, some of the compiler pre-processor flags, linker flags -# are different among the releases. This file is used to -# specify such flags. +# The link-editor related source files and Makefile files are normally unified +# across all presently maintained release gates. However, some of the compiler +# pre-processor flags, linker flags are different among the releases. This +# file is used to specify such flags. # # This file is included by the ./Makefile.com. # -# This file should be the only file which is different -# among /ws/{on10-gate,on{81,28,998}-patch} workspaces -# among the files which generate link-editors and related tools. +# This file should be the only file which is different among the presently +# maintained release workspaces and the files that generate the link-editors +# and related tools. # # CPPFEATUREMACROS provides for selectively turning on/off features within the @@ -114,21 +111,15 @@ VAR_XFFLAG= -xF=%all VAR_LINTFLAGS64= -Xarch=$(MACH64:sparcv9=v9) VAR_I386_ARCH= intel + VAR_PLAT_sparc= sparc VAR_PLAT_i386= intel/ia32 VAR_PLAT_amd64= intel/amd64 -VAR_MAPDIR_sparc= ../spec/sparc -VAR_MAPDIR_sparcv9= ../spec/sparcv9 -VAR_MAPDIR_i386= ../spec/i386 -VAR_MAPDIR_amd64= ../spec/amd64 VAR_POUND_1= VAR_POUND_2= $(POUND_SIGN) VAR_POUND_3= $(POUND_SIGN) -VAR_SPEC_ON= -VAR_SPEC_OFF= $(POUND_SIGN) - # # VAR_AVLDIR - directory to find avl.c in. # @@ -144,7 +135,7 @@ VAR_SPEC_OFF= $(POUND_SIGN) # files avl.c, avl.h and avl_impl.h until these files are back ported into # the system. # -VAR_AVLDIR=$(SRCBASE)/common/avl +VAR_AVLDIR= $(SRCBASE)/common/avl VAR_AVLINCDIR= # diff --git a/usr/src/cmd/sgs/crle/Makefile.com b/usr/src/cmd/sgs/crle/Makefile.com index 971c7096ad..24acbfe326 100644 --- a/usr/src/cmd/sgs/crle/Makefile.com +++ b/usr/src/cmd/sgs/crle/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -51,7 +51,7 @@ CPPFLAGS += -I. -I../../include -I../../include/$(MACH) \ $(CPPFLAGS.master) -D__EXTENSIONS__ LDFLAGS += $(VERSREF) $(USE_PROTO) -M$(MAPFILE) \ '-R$$ORIGIN/../lib' $(ZNOLAZYLOAD) -LDLIBS += -lelf $(CONVLIBDIR) -lconv $(DLLIB) +LDLIBS += -lelf $(CONVLIBDIR) $(CONV_LIB) $(DLLIB) LINTFLAGS += -mx BLTDEFS= msg.h diff --git a/usr/src/cmd/sgs/crle/common/print.c b/usr/src/cmd/sgs/crle/common/print.c index 9a9cfbfc4d..0e93105c0f 100644 --- a/usr/src/cmd/sgs/crle/common/print.c +++ b/usr/src/cmd/sgs/crle/common/print.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -265,7 +265,7 @@ scanconfig(Crle_desc * crle, Addr addr) const char *fmt; if (head->ch_dlflags) - fmt = conv_dlflag_str(head->ch_dlflags, 0); + fmt = conv_dl_flag(head->ch_dlflags, 0); else fmt = MSG_ORIG(MSG_STR_EMPTY); @@ -287,7 +287,7 @@ scanconfig(Crle_desc * crle, Addr addr) if (head->ch_dlflags && (head->ch_dlflags != RTLD_REL_RELATIVE)) { (void) snprintf(_cmd, PATH_MAX, MSG_ORIG(MSG_CMD_FLAGS), - conv_dlflag_str(head->ch_dlflags, 1)); + conv_dl_flag(head->ch_dlflags, 1)); cmd = strcpy(alloca(strlen(_cmd) + 1), _cmd); if (list_append(&cmdline, cmd) == 0) return (1); @@ -362,12 +362,12 @@ scanconfig(Crle_desc * crle, Addr addr) #ifndef SGS_PRE_UNIFIED_PROCESS if ((head->ch_cnflags & RTC_HDR_UPM) == 0) { if (head->ch_cnflags & RTC_HDR_64) - str = conv_upm_string(str, + str = conv_config_upm(str, MSG_ORIG(MSG_PTH_OLDDLP_64), MSG_ORIG(MSG_PTH_UPDLP_64), MSG_PTH_UPDLP_64_SIZE); else - str = conv_upm_string(str, + str = conv_config_upm(str, MSG_ORIG(MSG_PTH_OLDDLP), MSG_ORIG(MSG_PTH_UPDLP), MSG_PTH_UPDLP_SIZE); @@ -429,12 +429,12 @@ scanconfig(Crle_desc * crle, Addr addr) #ifndef SGS_PRE_UNIFIED_PROCESS if ((head->ch_cnflags & RTC_HDR_UPM) == 0) { if (head->ch_cnflags & RTC_HDR_64) - str = conv_upm_string(str, + str = conv_config_upm(str, MSG_ORIG(MSG_PTH_OLDTD_64), MSG_ORIG(MSG_PTH_UPTD_64), MSG_PTH_UPTD_64_SIZE); else - str = conv_upm_string(str, + str = conv_config_upm(str, MSG_ORIG(MSG_PTH_OLDTD), MSG_ORIG(MSG_PTH_UPTD), MSG_PTH_UPTD_SIZE); diff --git a/usr/src/cmd/sgs/dump/Makefile.com b/usr/src/cmd/sgs/dump/Makefile.com index 51f15e06a6..bf582949f6 100644 --- a/usr/src/cmd/sgs/dump/Makefile.com +++ b/usr/src/cmd/sgs/dump/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -49,7 +49,7 @@ LDFLAGS += $(LLDFLAGS) DEMLIB= -L../../sgsdemangler/$(MACH) DEMLIB64= -L../../sgsdemangler/$(MACH64) -LDLIBS += $(DEMLIB) -ldemangle $(CONVLIBDIR) -lconv \ +LDLIBS += $(DEMLIB) -ldemangle $(CONVLIBDIR) $(CONV_LIB) \ $(ELFLIBDIR) -lelf LINTSRCS = $(SRCS) diff --git a/usr/src/cmd/sgs/dump/Makefile.targ b/usr/src/cmd/sgs/dump/Makefile.targ index 35214fd69a..bcfbfbf2f1 100644 --- a/usr/src/cmd/sgs/dump/Makefile.targ +++ b/usr/src/cmd/sgs/dump/Makefile.targ @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -20,17 +19,16 @@ # CDDL HEADER END # # -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 1998,2002 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# ident "%Z%%M% %I% %E% SMI" +# %.o: ../common/%.c $(COMPILE.c) $< $(POST_PROCESS_O) - $(PROG): $(OBJS) $(LINK.c) $(OBJS) -o $@ $(LDLIBS) $(POST_PROCESS) @@ -46,7 +44,5 @@ install: all $(ROOTCCSBINPROG) clean: $(RM) $(OBJS) $(CLEANFILES) -lint: $(LINTOUT32) $(SGSLINTOUT) - include $(SRC)/cmd/Makefile.targ include $(SRC)/cmd/sgs/Makefile.targ diff --git a/usr/src/cmd/sgs/dump/amd64/Makefile b/usr/src/cmd/sgs/dump/amd64/Makefile index 78eca686dd..1510a43625 100644 --- a/usr/src/cmd/sgs/dump/amd64/Makefile +++ b/usr/src/cmd/sgs/dump/amd64/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -34,12 +34,13 @@ LLDFLAGS = $(LLDFLAGS64) ELFLIBDIR = $(ELFLIBDIR64) DEMLIB = $(DEMLIB64) CONVLIBDIR = $(CONVLIBDIR64) -LINTFLAGS64 += -Xarch=amd64 ROOTCCSBINPROG= $(ROOTCCSBINPROG64) include ../Makefile.targ include ../../Makefile.sub.64 +lint: $(LINTOUT64) $(SGSLINTOUT) + install \ package: $(ROOTCCSBINPROG64) diff --git a/usr/src/cmd/sgs/dump/common/dump.c b/usr/src/cmd/sgs/dump/common/dump.c index 7dde74fdd5..ffc0b056d1 100644 --- a/usr/src/cmd/sgs/dump/common/dump.c +++ b/usr/src/cmd/sgs/dump/common/dump.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,14 +18,12 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - */ - -/* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -41,6 +38,7 @@ #include <sys/elf_M32.h> #include <sys/elf_386.h> #include <sys/elf_SPARC.h> +#include <sys/elf_amd64.h> #include <sys/machelf.h> #include <fcntl.h> #include <sys/stat.h> @@ -301,7 +299,7 @@ print_rela(Elf *elf_file, SCNTAB *p_scns, Elf_Data *rdata, Elf_Data *sym_data, int adj = 0; if (gelf_getclass(elf_file) == ELFCLASS64) - adj = 4; + adj = 8; rel_entsize = p_scns->p_shdr.sh_entsize; if ((rel_entsize == 0) || @@ -400,7 +398,7 @@ print_rel(Elf *elf_file, SCNTAB *p_scns, Elf_Data *rdata, Elf_Data *sym_data, int adj = 0; if (gelf_getclass(elf_file) == ELFCLASS64) - adj = 4; + adj = 8; rel_entsize = p_scns->p_shdr.sh_entsize; if ((rel_entsize == 0) || @@ -468,12 +466,12 @@ print_rel(Elf *elf_file, SCNTAB *p_scns, Elf_Data *rdata, Elf_Data *sym_data, } /* demangle C++ names */ -static char *format = "%s\t[%s]"; static char * demangled_name(char *s) { - char *dn; - static char *buf; + static char *buf = NULL; + char *dn; + size_t len; dn = sgs_demangle(s); @@ -489,11 +487,11 @@ demangled_name(char *s) if (buf != NULL) free(buf); - buf = malloc(strlen(dn) + 1 + 1 + strlen(s) + 1 + 1); - if (buf == NULL) + len = strlen(dn) + strlen(s) + 4; + if ((buf = malloc(len)) == NULL) return (s); - (void) sprintf(buf, format, dn, s); + (void) snprintf(buf, len, "%s\t[%s]", dn, s); return (buf); } @@ -516,7 +514,7 @@ print_symtab(Elf *elf_file, SCNTAB *p_symtab, Elf_Data *sym_data, unsigned int nosymshndx = 0; if (gelf_getclass(elf_file) == ELFCLASS64) - adj = 4; + adj = 8; while (range > 0) { char *sym_name = (char *)0; @@ -712,7 +710,7 @@ print_shdr(Elf *elf_file, SCNTAB *s, int num_scns, int index) int field; if (gelf_getclass(elf_file) == ELFCLASS64) - field = 15; + field = 21; else field = 13; @@ -798,6 +796,12 @@ print_shdr(Elf *elf_file, SCNTAB *s, int num_scns, int index) case SHT_SUNW_COMDAT: (void) printf("COMD"); break; + case SHT_AMD64_UNWIND: + (void) printf("UNWD"); + break; + case SHT_SPARC_GOTDATA: + (void) printf("GOTD"); + break; default: (void) printf("%u", EC_WORD(p->p_shdr.sh_type)); break; @@ -903,7 +907,7 @@ dump_reloc_table(Elf *elf_file, GElf_Ehdr *p_ehdr, size_t shnum; if (gelf_getclass(elf_file) == ELFCLASS64) - adj = 4; + adj = 8; if ((!p_flag) && (!r_title)) { (void) printf("\n **** RELOCATION INFORMATION ****\n"); @@ -1114,7 +1118,7 @@ dump_symbol_table(Elf *elf_file, SCNTAB *p_symtab, char *filename) int adj = 0; /* field adjustment for elf64 */ if (gelf_getclass(elf_file) == ELFCLASS64) - adj = 4; + adj = 8; if (p_symtab == NULL) { (void) fprintf(stderr, @@ -1859,15 +1863,15 @@ dump_elf_header(Elf *elf_file, char *filename, GElf_Ehdr * elf_head_p) int field; if (gelf_getehdr(elf_file, elf_head_p) == NULL) { - (void) fprintf(stderr, - "%s: %s: %s\n", prog_name, filename, elf_errmsg(-1)); + (void) fprintf(stderr, "%s: %s: %s\n", prog_name, filename, + elf_errmsg(-1)); return (NULL); } class = (int)elf_head_p->e_ident[4]; if (class == ELFCLASS64) - field = 17; + field = 21; else field = 13; @@ -1875,14 +1879,13 @@ dump_elf_header(Elf *elf_file, char *filename, GElf_Ehdr * elf_head_p) return (elf_head_p); if (!p_flag) { - (void) printf( - "\n **** ELF HEADER ****\n"); - (void) printf("%-*s%-11s%-*sMachine Version\n", - field, "Class", "Data", field, "Type"); - (void) printf("%-*s%-11s%-*sFlags Ehsize\n", - field, "Entry", "Phoff", field, "Shoff"); - (void) printf("%-*s%-11s%-*sShnum Shstrndx\n\n", - field, "Phentsize", "Phnum", field, "Shentsz"); + (void) printf("\n **** ELF HEADER ****\n"); + (void) printf("%-*s%-11s%-*sMachine Version\n", + field, "Class", "Data", field, "Type"); + (void) printf("%-*s%-11s%-*sFlags Ehsize\n", + field, "Entry", "Phoff", field, "Shoff"); + (void) printf("%-*s%-11s%-*sShnum Shstrndx\n\n", + field, "Phentsize", "Phnum", field, "Shentsz"); } if (!v_flag) { @@ -2040,9 +2043,9 @@ dump_elf_header(Elf *elf_file, char *filename, GElf_Ehdr * elf_head_p) int field; if (gelf_getclass(elf_file) == ELFCLASS64) - field = 14; + field = 21; else - field = 12; + field = 13; if (!p_flag) { (void) printf("\n **** SECTION HEADER[0] " "{Elf Extensions} ****\n"); @@ -2051,7 +2054,7 @@ dump_elf_header(Elf *elf_file, char *filename, GElf_Ehdr * elf_head_p) field, "Addr", field, "Offset", field, "Size(shnum)", /* compatibility: tab for elf32 */ - (field == 12) ? "\t" : " "); + (field == 13) ? "\t" : " "); (void) printf("\tLn(strndx) Info\t%-*s Entsize\n", field, "Adralgn"); } @@ -2079,7 +2082,7 @@ dump_elf_header(Elf *elf_file, char *filename, GElf_Ehdr * elf_head_p) field, EC_OFF(shdr0.sh_offset), field, EC_XWORD(shdr0.sh_size), /* compatibility: tab for elf32 */ - ((field == 12) ? "\t" : " "), + ((field == 13) ? "\t" : " "), field, EC_WORD(shdr0.sh_name)); (void) printf("\t%u\t%u\t%-#*llx %-#*llx\n", @@ -2231,16 +2234,16 @@ dump_shdr(Elf *elf_file, SCNTAB *s, int num_scns, char *filename) int found_it = 0; /* for use with -n section_name */ if (gelf_getclass(elf_file) == ELFCLASS64) - field = 14; + field = 21; else - field = 12; + field = 13; if (!p_flag) { (void) printf("\n **** SECTION HEADER TABLE ****\n"); (void) printf("[No]\tType\tFlags\t%-*s %-*s %-*s%sName\n", field, "Addr", field, "Offset", field, "Size", /* compatibility: tab for elf32 */ - (field == 12) ? "\t" : " "); + (field == 13) ? "\t" : " "); (void) printf("\tLink\tInfo\t%-*s Entsize\n\n", field, "Adralgn"); } @@ -2528,6 +2531,8 @@ dump_ar_files(int fd, Elf *elf_file, char *filename) cmd = ELF_C_READ; while ((arf = elf_begin(fd, cmd, elf_file)) != 0) { + size_t len; + p_ar = elf_getarhdr(arf); if (p_ar == NULL) { (void) fprintf(stderr, @@ -2542,8 +2547,11 @@ dump_ar_files(int fd, Elf *elf_file, char *filename) continue; } - fullname = malloc(strlen(filename) + strlen(p_ar->ar_name) + 3); - (void) sprintf(fullname, "%s[%s]", filename, p_ar->ar_name); + len = strlen(filename) + strlen(p_ar->ar_name) + 3; + if ((fullname = malloc(len)) == NULL) + return; + (void) snprintf(fullname, len, "%s[%s]", filename, + p_ar->ar_name); (void) printf("\n%s:\n", fullname); file_type = elf_kind(arf); if (file_type == ELF_K_ELF) { @@ -2593,26 +2601,21 @@ each_file(char *filename) errno = 0; if (stat(filename, &buf) == -1) { - (void) fprintf(stderr, "%s: ", prog_name); - perror(filename); + int err = errno; + (void) fprintf(stderr, "%s: %s: %s", prog_name, filename, + strerror(err)); return; } - if (elf_version(EV_CURRENT) == EV_NONE) { - (void) fprintf(stderr, - "%s: Libelf is out of date\n", prog_name); - exit(101); - } - if ((fd = open((filename), O_RDONLY)) == -1) { - (void) fprintf(stderr, "%s: %s: cannot read\n", - prog_name, filename); + (void) fprintf(stderr, "%s: %s: cannot read\n", prog_name, + filename); return; } cmd = ELF_C_READ; if ((elf_file = elf_begin(fd, cmd, (Elf *)0)) == NULL) { - (void) fprintf(stderr, - "%s: %s: %s\n", prog_name, filename, elf_errmsg(-1)); + (void) fprintf(stderr, "%s: %s: %s\n", prog_name, filename, + elf_errmsg(-1)); return; } @@ -2627,24 +2630,18 @@ each_file(char *filename) } else { if (file_type == ELF_K_ELF) { (void) printf("\n%s:\n", filename); - if (dump_elf_header(elf_file, filename, &elf_head) - == (GElf_Ehdr *)0) { - (void) elf_end(elf_file); - (void) close(fd); - return; + if (dump_elf_header(elf_file, filename, &elf_head)) { + if (o_flag) + dump_exec_header(elf_file, + (unsigned)elf_head.e_phnum, + filename); + if (x_flag) + dump_section_table(elf_file, + &elf_head, filename); } - if (o_flag) - dump_exec_header(elf_file, - (unsigned)elf_head.e_phnum, filename); - if (x_flag) - dump_section_table(elf_file, - &elf_head, filename); } else { (void) fprintf(stderr, "%s: %s: invalid file type\n", - prog_name, filename); - (void) elf_end(elf_file); - (void) close(fd); - return; + prog_name, filename); } } (void) elf_end(elf_file); @@ -2661,7 +2658,6 @@ main(int argc, char *argv[], char *envp[]) char *optstr = OPTSTR; /* option string used by getopt() */ int optchar; - /* * Check for a binary that better fits this architecture. */ @@ -2769,6 +2765,12 @@ main(int argc, char *argv[], char *envp[]) } } + if (elf_version(EV_CURRENT) == EV_NONE) { + (void) fprintf(stderr, "%s: libelf is out of date\n", + prog_name); + exit(101); + } + while (optind < argc) { each_file(argv[optind]); optind++; diff --git a/usr/src/cmd/sgs/dump/i386/Makefile b/usr/src/cmd/sgs/dump/i386/Makefile index a8ddaa2890..761372e144 100644 --- a/usr/src/cmd/sgs/dump/i386/Makefile +++ b/usr/src/cmd/sgs/dump/i386/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,15 +18,18 @@ # # CDDL HEADER END # + # -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 1998,2002 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# ident "%Z%%M% %I% %E% SMI" +# include ../Makefile.com .KEEP_STATE: +lint: $(LINTOUT32) $(SGSLINTOUT) + include ../Makefile.targ diff --git a/usr/src/cmd/sgs/dump/sparc/Makefile b/usr/src/cmd/sgs/dump/sparc/Makefile index a8ddaa2890..761372e144 100644 --- a/usr/src/cmd/sgs/dump/sparc/Makefile +++ b/usr/src/cmd/sgs/dump/sparc/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,15 +18,18 @@ # # CDDL HEADER END # + # -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 1998,2002 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# ident "%Z%%M% %I% %E% SMI" +# include ../Makefile.com .KEEP_STATE: +lint: $(LINTOUT32) $(SGSLINTOUT) + include ../Makefile.targ diff --git a/usr/src/cmd/sgs/dump/sparcv9/Makefile b/usr/src/cmd/sgs/dump/sparcv9/Makefile index 5b89e1eca5..1510a43625 100644 --- a/usr/src/cmd/sgs/dump/sparcv9/Makefile +++ b/usr/src/cmd/sgs/dump/sparcv9/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 1998-2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -34,12 +34,13 @@ LLDFLAGS = $(LLDFLAGS64) ELFLIBDIR = $(ELFLIBDIR64) DEMLIB = $(DEMLIB64) CONVLIBDIR = $(CONVLIBDIR64) -LINTFLAGS64 += -Xarch=v9 ROOTCCSBINPROG= $(ROOTCCSBINPROG64) include ../Makefile.targ include ../../Makefile.sub.64 +lint: $(LINTOUT64) $(SGSLINTOUT) + install \ package: $(ROOTCCSBINPROG64) diff --git a/usr/src/cmd/sgs/elfdump/Makefile b/usr/src/cmd/sgs/elfdump/Makefile index 3fb5c9663e..2f70df00c7 100644 --- a/usr/src/cmd/sgs/elfdump/Makefile +++ b/usr/src/cmd/sgs/elfdump/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,10 +18,12 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" # -# Copyright (c) 1996 by Sun Microsystems, Inc. -# All rights reserved. include $(SRC)/cmd/sgs/Makefile.sub diff --git a/usr/src/cmd/sgs/elfdump/Makefile.com b/usr/src/cmd/sgs/elfdump/Makefile.com index 03f3c19d5d..cfa1cbf126 100644 --- a/usr/src/cmd/sgs/elfdump/Makefile.com +++ b/usr/src/cmd/sgs/elfdump/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -31,40 +31,46 @@ PROG= elfdump include $(SRC)/cmd/Makefile.cmd include $(SRC)/cmd/sgs/Makefile.com -COMOBJ= elfdump.o -TOOLOBJS= leb128.o -BLTOBJ= msg.o +COMOBJ = main.o + +COMOBJ32 = elfdump32.o + +COMOBJ64 = elfdump64.o + +TOOLOBJ = leb128.o + +BLTOBJ = msg.o -OBJS= $(BLTOBJ) $(COMOBJ) $(TOOLOBJS) +OBJS= $(BLTOBJ) $(COMOBJ) $(COMOBJ32) $(COMOBJ64) $(TOOLOBJ) MAPFILE= ../common/mapfile-vers -CPPFLAGS= -I. -I../../include -I../../include/$(MACH) \ - -I../../liblddbg/common \ +CPPFLAGS= -I. -I../common -I../../include -I../../include/$(MACH) \ -I$(SRCBASE)/uts/$(ARCH)/sys \ $(CPPFLAGS.master) LLDFLAGS = $(VAR_ELFDUMP_LLDFLAGS) LLDFLAGS64 = $(VAR_LD_LLDFLAGS64) LDFLAGS += $(VERSREF) $(USE_PROTO) -M$(MAPFILE) $(LLDFLAGS) $(ZLAZYLOAD) LDLIBS += $(ELFLIBDIR) -lelf $(LDDBGLIBDIR) $(LDDBG_LIB) \ - $(CONVLIBDIR) -lconv + $(CONVLIBDIR) $(CONV_LIB) LINTFLAGS += -x LINTFLAGS64 += -x -BLTDEFS= msg.h -BLTDATA= msg.c -BLTMESG= $(SGSMSGDIR)/elfdump +BLTDEFS = msg.h +BLTDATA = msg.c +BLTMESG = $(SGSMSGDIR)/elfdump -BLTFILES= $(BLTDEFS) $(BLTDATA) $(BLTMESG) +BLTFILES = $(BLTDEFS) $(BLTDATA) $(BLTMESG) -SGSMSGCOM= ../common/elfdump.msg -SGSMSGTARG= $(SGSMSGCOM) -SGSMSGALL= $(SGSMSGCOM) +SGSMSGCOM = ../common/elfdump.msg +SGSMSGTARG = $(SGSMSGCOM) +SGSMSGALL = $(SGSMSGCOM) SGSMSGFLAGS += -h $(BLTDEFS) -d $(BLTDATA) -m $(BLTMESG) -n elfdump_msg -SRCS= $(COMOBJ:%.o=../common/%.c) $(TOOLOBJS:%.o=../../tools/common/%.c) \ - $(BLTDATA) -LINTSRCS= $(SRCS) ../common/lintsup.c +SRCS = $(COMOBJ:%.o=../common/%.c) \ + $(COMOBJ32:%32.o=../common/%.c) \ + $(TOOLOBJ:%.o=../../tools/common/%.c) $(BLTDATA) +LINTSRCS = $(SRCS) ../common/lintsup.c CLEANFILES += $(LINTOUTS) $(BLTFILES) diff --git a/usr/src/cmd/sgs/elfdump/Makefile.targ b/usr/src/cmd/sgs/elfdump/Makefile.targ index 3a28e302e5..8f87f82964 100644 --- a/usr/src/cmd/sgs/elfdump/Makefile.targ +++ b/usr/src/cmd/sgs/elfdump/Makefile.targ @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,19 +18,28 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# ident "%Z%%M% %I% %E% SMI" +# %.o: ../common/%.c - $(COMPILE.c) $< + $(COMPILE.c) -o $@ $< + $(POST_PROCESS_O) + +%32.o: ../common/%.c + $(COMPILE.c) -o $@ $< + $(POST_PROCESS_O) + +%64.o: ../common/%.c + $(COMPILE.c) -D_ELF64 -o $@ $< $(POST_PROCESS_O) %.o: $(SGSTOOLS)/common/%.c - $(COMPILE.c) $< + $(COMPILE.c) -o $@ $< $(POST_PROCESS_O) $(PROG): $(OBJS) $(MAPFILE) @@ -52,7 +60,9 @@ delete: install \ package: all $(ROOTCCSBINPROG) -lint: $(LINTOUT32) $(SGSLINTOUT) +.PARALLEL: $(LINTOUT32) $(LINTOUT64) + +lint: $(LINTOUT32) $(LINTOUT64) $(SGSLINTOUT) include $(SRC)/cmd/Makefile.targ include $(SRC)/cmd/sgs/Makefile.targ diff --git a/usr/src/cmd/sgs/elfdump/amd64/Makefile b/usr/src/cmd/sgs/elfdump/amd64/Makefile index b8e24c8ce2..8f39ca01c6 100644 --- a/usr/src/cmd/sgs/elfdump/amd64/Makefile +++ b/usr/src/cmd/sgs/elfdump/amd64/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -31,9 +31,9 @@ include ../Makefile.com .KEEP_STATE: LLDFLAGS = $(LLDFLAGS64) -ELFLIBDIR= $(ELFLIBDIR64) -LDDBGLIBDIR= $(LDDBGLIBDIR64) -CONVLIBDIR= $(CONVLIBDIR64) +ELFLIBDIR = $(ELFLIBDIR64) +LDDBGLIBDIR = $(LDDBGLIBDIR64) +CONVLIBDIR = $(CONVLIBDIR64) LINTFLAGS64 += $(VAR_LINTFLAGS64) ROOTCCSBINPROG= $(ROOTCCSBINPROG64) @@ -43,4 +43,3 @@ include ../../Makefile.sub.64 install \ package: $(ROOTCCSBINPROG64) - diff --git a/usr/src/cmd/sgs/elfdump/common/_elfdump.h b/usr/src/cmd/sgs/elfdump/common/_elfdump.h new file mode 100644 index 0000000000..f485c3e0bd --- /dev/null +++ b/usr/src/cmd/sgs/elfdump/common/_elfdump.h @@ -0,0 +1,139 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ + +#ifndef __ELFDUMP_H +#define __ELFDUMP_H + +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <machelf.h> +#include <debug.h> + +/* + * Local include file for elfdump. + */ +#ifdef __cplusplus +extern "C" { +#endif + +#define FLG_DYNAMIC 0x00000001 +#define FLG_EHDR 0x00000002 +#define FLG_INTERP 0x00000004 +#define FLG_SHDR 0x00000008 +#define FLG_NOTE 0x00000010 +#define FLG_PHDR 0x00000020 +#define FLG_RELOC 0x00000040 +#define FLG_SYMBOLS 0x00000080 +#define FLG_VERSIONS 0x00000100 +#define FLG_HASH 0x00000200 +#define FLG_GOT 0x00000400 +#define FLG_SYMINFO 0x00000800 +#define FLG_MOVE 0x00001000 +#define FLG_GROUP 0x00002000 +#define FLG_CAP 0x00004000 +#define FLG_UNWIND 0x00008000 +#define FLG_LONGNAME 0x00100000 /* not done by default */ +#define FLG_CHECKSUM 0x00200000 /* not done by default */ +#define FLG_DEMANGLE 0x00400000 /* not done by default */ +#define FLG_EVERYTHING 0x000fffff + +#define MAXNDXSIZE 10 + +typedef struct cache { + Shdr *c_shdr; + Elf_Data *c_data; + char *c_name; +} Cache; + +typedef struct got_info { + Word g_reltype; /* it will never happen, but */ + /* support mixed relocations */ + void *g_rel; + const char *g_symname; +} Got_info; + +extern const Cache cache_init; + +extern void failure(const char *, const char *); +extern const char *demangle(const char *, uint_t); + +/* + * Define various elfdump() functions into their 32-bit and 64-bit variants. + */ +#if defined(_ELF64) +#define cap cap64 +#define checksum checksum64 +#define dynamic dynamic64 +#define got got64 +#define group group64 +#define hash hash64 +#define interp interp64 +#define move move64 +#define note note64 +#define note_entry note_entry64 +#define regular regular64 +#define reloc reloc64 +#define sections sections64 +#define string string64 +#define symbols symbols64 +#define syminfo syminfo64 +#define symlookup symlookup64 +#define unwind unwind64 +#define versions versions64 +#define version_def version_def64 +#define version_need version_need64 +#else +#define cap cap32 +#define checksum checksum32 +#define dynamic dynamic32 +#define got got32 +#define group group32 +#define hash hash32 +#define interp interp32 +#define move move32 +#define note note32 +#define note_entry note_entry32 +#define regular regular32 +#define reloc reloc32 +#define sections sections32 +#define string string32 +#define symbols symbols32 +#define syminfo syminfo32 +#define symlookup symlookup32 +#define unwind unwind32 +#define versions versions32 +#define version_def version_def32 +#define version_need version_need32 +#endif + +extern void regular32(const char *, Elf *, uint_t, char *, int); +extern void regular64(const char *, Elf *, uint_t, char *, int); + +#ifdef __cplusplus +} +#endif + +#endif /* __ELFDUMP_H */ diff --git a/usr/src/cmd/sgs/elfdump/common/elfdump.c b/usr/src/cmd/sgs/elfdump/common/elfdump.c index c5d3315b60..33dfa79b01 100644 --- a/usr/src/cmd/sgs/elfdump/common/elfdump.c +++ b/usr/src/cmd/sgs/elfdump/common/elfdump.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. @@ -29,151 +28,33 @@ /* * Dump an elf file. */ -#include <sys/param.h> -#include <fcntl.h> -#include <stdio.h> -#include <libelf.h> -#include <gelf.h> -#include <link.h> -#include <stdarg.h> +#include <machdep.h> +#include <sys/elf_386.h> +#include <sys/elf_amd64.h> +#include <sys/elf_SPARC.h> +#include <dwarf.h> #include <unistd.h> -#include <libgen.h> -#include <libintl.h> -#include <locale.h> #include <errno.h> #include <strings.h> -#include <sys/elf_SPARC.h> -#include <sys/elf_386.h> -#include <sys/elf_amd64.h> #include <debug.h> -#include <_debug.h> #include <conv.h> #include <msg.h> -#include <dwarf.h> - -#define FLG_DYNAMIC 0x00000001 -#define FLG_EHDR 0x00000002 -#define FLG_INTERP 0x00000004 -#define FLG_SHDR 0x00000008 -#define FLG_NOTE 0x00000010 -#define FLG_PHDR 0x00000020 -#define FLG_RELOC 0x00000040 -#define FLG_SYMBOLS 0x00000080 -#define FLG_VERSIONS 0x00000100 -#define FLG_HASH 0x00000200 -#define FLG_GOT 0x00000400 -#define FLG_SYMINFO 0x00000800 -#define FLG_MOVE 0x00001000 -#define FLG_GROUP 0x00002000 -#define FLG_CAP 0x00004000 -#define FLG_UNWIND 0x00008000 -#define FLG_LONGNAME 0x00100000 /* not done by default */ -#define FLG_CHECKSUM 0x00200000 /* not done by default */ -#define FLG_DEMANGLE 0x00400000 /* not done by default */ - -#define FLG_EVERYTHING 0x000fffff - -#define IAM_SPARC(X) \ - ((X == EM_SPARC) || (X == EM_SPARC32PLUS) || (X == EM_SPARCV9)) -#define IAM_INTEL(X) \ - (X == EM_386) - -#define MAXNDXSIZE 10 - -typedef struct cache { - GElf_Shdr c_shdr; - Elf_Data *c_data; - char *c_name; -} Cache; - -typedef struct got_info { - GElf_Word g_rshtype; /* it will never happen, but */ - /* support mixed relocations */ - GElf_Rela g_rela; - const char *g_symname; -} Got_info; - -static const Cache _cache_init = {{0}, NULL, NULL}; - -const char * -_elfdump_msg(Msg mid) -{ - return (gettext(MSG_ORIG(mid))); -} - -/* - * Determine whether a symbol name should be demangled. - */ -static const char * -demangle(const char *name, uint32_t flags) -{ - if (flags & FLG_DEMANGLE) - return (Gelf_sym_dem(name)); - else - return ((char *)name); -} - - -/* - * Define our own printing routine. All Elf routines referenced call upon - * this routine to carry out the actual printing. - */ -/*PRINTFLIKE1*/ -void -dbg_print(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - (void) vprintf(format, ap); - (void) printf(MSG_ORIG(MSG_STR_NL)); - va_end(ap); -} - -/* - * Just like dbg_print - except that it does not insert - * a newline at the end. Can be used for printing tables - * and such. - */ -/*PRINTFLIKE1*/ -void -dbg_printf(const char *format, ...) -{ - va_list ap; - va_start(ap, format); - (void) vprintf(format, ap); - va_end(ap); -} - - - -/* - * Define our own standard error routine. - */ -static void -failure(const char *file, const char *func) -{ - (void) fprintf(stderr, MSG_INTL(MSG_ERR_FAILURE), - file, func, elf_errmsg(elf_errno())); - (void) fflush(stderr); -} - +#include <_elfdump.h> /* * Focal point for verifying symbol names. */ static const char * -string(Cache *refsec, GElf_Word ndx, Cache *strsec, const char *file, - ulong_t name) +string(Cache *refsec, Word ndx, Cache *strsec, const char *file, Word name) { static Cache *osec = 0; static int nostr; const char *strs = (char *)strsec->c_data->d_buf; - ulong_t strn = strsec->c_data->d_size; + Word strn = strsec->c_data->d_size; /* - * Only print a diagnoistic regarding an empty string table once per + * Only print a diagnostic regarding an empty string table once per * input section being processed. */ if (osec != refsec) { @@ -192,14 +73,12 @@ string(Cache *refsec, GElf_Word ndx, Cache *strsec, const char *file, if (nostr == 0) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), file, strsec->c_name); - (void) fflush(stderr); nostr++; } } else { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSTOFF), - file, refsec->c_name, ndx, strsec->c_name, - EC_XWORD(name), EC_XWORD(strn - 1)); - (void) fflush(stderr); + file, refsec->c_name, EC_WORD(ndx), strsec->c_name, + EC_WORD(name), EC_WORD(strn - 1)); } /* @@ -212,64 +91,152 @@ string(Cache *refsec, GElf_Word ndx, Cache *strsec, const char *file, } /* + * Relocations can reference section symbols and standard symbols. If the + * former, establish the section name. + */ +static const char * +relsymname(Cache *cache, Cache *csec, Cache *strsec, Word symndx, Word symnum, + Word relndx, Sym *syms, char *secstr, size_t secsz, const char *file, + uint_t flags) +{ + Sym *sym; + + if (symndx >= symnum) { + (void) fprintf(stderr, MSG_INTL(MSG_ERR_RELBADSYMNDX), + file, EC_WORD(symndx), EC_WORD(relndx)); + return (MSG_INTL(MSG_STR_UNKNOWN)); + } + + sym = (Sym *)(syms + symndx); + + /* + * If the symbol represents a section offset construct an appropriate + * string. + */ + if ((ELF_ST_TYPE(sym->st_info) == STT_SECTION) && (sym->st_name == 0)) { + if (flags & FLG_LONGNAME) + (void) snprintf(secstr, secsz, + MSG_INTL(MSG_STR_L_SECTION), + cache[sym->st_shndx].c_name); + else + (void) snprintf(secstr, secsz, + MSG_INTL(MSG_STR_SECTION), + cache[sym->st_shndx].c_name); + return ((const char *)secstr); + } + + return (string(csec, symndx, strsec, file, sym->st_name)); +} + +/* + * Focal point for establishing a string table section. Data such as the + * dynamic information simply points to a string table. Data such as + * relocations, reference a symbol table, which in turn is associated with a + * string table. + */ +static int +stringtbl(Cache *cache, int symtab, Word ndx, Word shnum, const char *file, + Word *symnum, Cache **symsec, Cache **strsec) +{ + Shdr *shdr = cache[ndx].c_shdr; + + if (symtab) { + /* + * Validate the symbol table section. + */ + if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { + (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), + file, cache[ndx].c_name, EC_WORD(shdr->sh_link)); + return (0); + } + + /* + * Obtain, and verify the symbol table data. + */ + if (cache[ndx].c_data->d_buf == 0) { + (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), + file, cache[ndx].c_name); + return (0); + } + + /* + * Establish the string table index. + */ + ndx = shdr->sh_link; + shdr = cache[ndx].c_shdr; + + /* + * Return symbol table information. + */ + if (symnum) + *symnum = (shdr->sh_size / shdr->sh_entsize); + if (symsec) + *symsec = &cache[ndx]; + } + + /* + * Validate the associated string table section. + */ + if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { + (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), + file, cache[ndx].c_name, EC_WORD(shdr->sh_link)); + return (0); + } + + if (strsec) + *strsec = &cache[shdr->sh_link]; + + return (1); +} + +/* * Lookup a symbol and set Sym accordingly. - * - * Returns: - * 1 - symbol found - * 0 - symbol not found */ static int -symlookup(const char *name, Cache *cache, GElf_Word shnum, GElf_Sym *sym, +symlookup(const char *name, Cache *cache, Word shnum, Sym **sym, Cache *symtab, const char *file) { - GElf_Shdr * shdr; - GElf_Word symn, cnt; + Shdr *shdr; + Word symn, cnt; + Sym *syms; if (symtab == 0) return (0); - shdr = &symtab->c_shdr; + shdr = symtab->c_shdr; + /* * Determine the symbol data and number. */ if ((shdr->sh_entsize == 0) || (shdr->sh_size == 0)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), file, symtab->c_name); - (void) fflush(stderr); return (0); } /* LINTED */ - symn = (GElf_Word)(shdr->sh_size / shdr->sh_entsize); + symn = (Word)(shdr->sh_size / shdr->sh_entsize); + syms = (Sym *)symtab->c_data->d_buf; /* * Get the associated string table section. */ if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), - file, symtab->c_name, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); + file, symtab->c_name, EC_WORD(shdr->sh_link)); return (0); } /* * Loop through the symbol table to find a match. */ - for (cnt = 0; cnt < symn; cnt++) { - GElf_Sym tsym; - const char *sname; - - if (gelf_getsym(symtab->c_data, cnt, &tsym) == NULL) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSYM), - file, symtab->c_name, elf_errmsg(0)); - (void) fflush(stderr); - return (0); - } + for (cnt = 0; cnt < symn; syms++, cnt++) { + const char *symname; - sname = string(symtab, cnt, &cache[shdr->sh_link], file, - tsym.st_name); + symname = string(symtab, cnt, &cache[shdr->sh_link], file, + syms->st_name); - if (strcmp(name, sname) == 0) { - *sym = tsym; + if (symname && (strcmp(name, symname) == 0)) { + *sym = syms; return (1); } } @@ -277,74 +244,39 @@ symlookup(const char *name, Cache *cache, GElf_Word shnum, GElf_Sym *sym, } /* - * The full usage message - */ -static void -detail_usage() -{ - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL1)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL2)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL3)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL4)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL5)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL6)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL7)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL8)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL9)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL9_1)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL10)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL11)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL12)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL13)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL14)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL15)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL16)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL17)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL18)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL19)); - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL20)); - (void) fflush(stderr); -} - -/* * Print section headers. */ static void -sections(const char *file, Cache *cache, GElf_Word shnum, GElf_Word phnum, - GElf_Ehdr *ehdr, const char *name) +sections(const char *file, Cache *cache, Word shnum, Ehdr *ehdr, + const char *name) { - GElf_Word cnt; - Cache * _cache; + size_t seccnt; - for (cnt = 1; cnt < shnum; cnt++) { - GElf_Shdr *shdr; - const char *sname; + for (seccnt = 1; seccnt < shnum; seccnt++) { + Cache *_cache = &cache[seccnt]; + Shdr *shdr = _cache->c_shdr; + const char *secname = _cache->c_name; - _cache = &cache[cnt]; - sname = _cache->c_name; - if (name && strcmp(name, sname)) + if (name && strcmp(name, secname)) continue; /* * Although numerous section header entries can be zero, it's * usually a sign of trouble if the name or type are zero. */ - shdr = &_cache->c_shdr; if (shdr->sh_type == 0) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHTYPE), - file, sname, EC_XWORD(shdr->sh_type)); - (void) fflush(stderr); + file, secname, EC_WORD(shdr->sh_type)); } if (shdr->sh_name == 0) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHNAME), - file, sname, EC_XWORD(shdr->sh_name)); - (void) fflush(stderr); + file, secname, EC_XWORD(shdr->sh_name)); /* * Use the empty string, rather than the fabricated * name for the section output. */ - sname = MSG_ORIG(MSG_STR_EMPTY); + secname = MSG_ORIG(MSG_STR_EMPTY); } /* @@ -352,66 +284,100 @@ sections(const char *file, Cache *cache, GElf_Word shnum, GElf_Word phnum, * shouldn't exist in a relocatable object. */ if (ehdr->e_type == ET_REL) { - if (strncmp(sname, MSG_ORIG(MSG_ELF_GOT), + if (strncmp(secname, MSG_ORIG(MSG_ELF_GOT), MSG_ELF_GOT_SIZE) == 0) { (void) fprintf(stderr, - MSG_INTL(MSG_GOT_UNEXPECTED), file, sname); - (void) fflush(stderr); + MSG_INTL(MSG_GOT_UNEXPECTED), file, + secname); } } - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - /* LINTED */ - dbg_print(MSG_INTL(MSG_ELF_SHDR), (uint_t)cnt, sname); - Gelf_shdr_entry(ehdr->e_machine, shdr); + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_INTL(MSG_ELF_SHDR), EC_WORD(seccnt), secname); + Elf_shdr(0, ehdr->e_machine, shdr); } } +/* + * A couple of instances of unwind data are printed as tables of 8 data items + * expressed as 0x?? integers. + */ +#define UNWINDTBLSZ 10 + (8 * 5) + 1 + static void -unwind(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, - const char *name, const char *file, Elf *elf) +unwindtbl(uint64_t *ndx, uint_t len, uchar_t *data, uint64_t doff, + const char *msg, const char *pre, size_t plen) { - GElf_Word cnt; - GElf_Phdr unwind_phdr; - /* - * For the moment - UNWIND is only relevant for - * a AMD64 object - */ - if (ehdr->e_machine != EM_AMD64) - return; - - unwind_phdr.p_type = PT_NULL; + char buffer[UNWINDTBLSZ]; + uint_t boff = plen, cnt = 0; + + dbg_print(0, msg); + (void) strncpy(buffer, pre, UNWINDTBLSZ); + + while (*ndx < (len + 4)) { + if (cnt == 8) { + dbg_print(0, buffer); + boff = plen; + cnt = 0; + } + (void) snprintf(&buffer[boff], UNWINDTBLSZ - boff, + MSG_ORIG(MSG_UNW_TBLENTRY), data[doff + (*ndx)++]); + boff += 5; + cnt++; + } + if (cnt) + dbg_print(0, buffer); +} - for (cnt = 0; cnt < phnum; cnt++) { - GElf_Phdr phdr; +/* + * Obtain a specified Phdr entry. + */ +static Phdr * +getphdr(Word phnum, Word type, const char *file, Elf *elf) +{ + Word cnt; + Phdr *phdr; - if (gelf_getphdr(elf, cnt, &phdr) == NULL) { - failure(file, MSG_ORIG(MSG_ELF_GETPHDR)); - return; - } + if ((phdr = elf_getphdr(elf)) == NULL) { + failure(file, MSG_ORIG(MSG_ELF_GETPHDR)); + return (0); + } - if (phdr.p_type == PT_SUNW_UNWIND) { - unwind_phdr = phdr; - break; - } + for (cnt = 0; cnt < phnum; phdr++, cnt++) { + if (phdr->p_type == type) + return (phdr); } + return (0); +} + +static void +unwind(Cache *cache, Word shnum, Word phnum, Ehdr *ehdr, const char *name, + const char *file, Elf *elf) +{ + Word cnt; + Phdr *uphdr = 0; + + /* + * For the moment - UNWIND is only relevant for a AMD64 object. + */ + if (ehdr->e_machine != EM_AMD64) + return; + if (phnum) + uphdr = getphdr(phnum, PT_SUNW_UNWIND, file, elf); for (cnt = 1; cnt < shnum; cnt++) { - Cache *_cache; - GElf_Shdr *shdr; - unsigned char *data; + Cache *_cache = &cache[cnt]; + Shdr *shdr = _cache->c_shdr; + uchar_t *data; size_t datasize; - uint64_t off, ndx; + uint64_t off, ndx, frame_ptr, fde_cnt, tabndx; + uint_t vers, frame_ptr_enc, fde_cnt_enc, table_enc; - - _cache = &cache[cnt]; - shdr = &_cache->c_shdr; /* - * XX64 - this is a strmcp() just to find the gcc - * produced sections. Soon gcc should be - * settng the section type - and we'll not need - * this strcmp(). + * AMD64 - this is a strmcp() just to find the gcc produced + * sections. Soon gcc should be setting the section type - and + * we'll not need this strcmp(). */ if ((shdr->sh_type != SHT_AMD64_UNWIND) && (strncmp(_cache->c_name, MSG_ORIG(MSG_SCN_FRM), @@ -422,70 +388,54 @@ unwind(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, if (name && strcmp(name, _cache->c_name)) continue; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_ELF_SCN_UNWIND), _cache->c_name); + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_INTL(MSG_ELF_SCN_UNWIND), _cache->c_name); - data = (unsigned char *)(_cache->c_data->d_buf); + data = (uchar_t *)(_cache->c_data->d_buf); datasize = _cache->c_data->d_size; off = 0; /* * Is this a .eh_frame_hdr */ - if (((unwind_phdr.p_type == PT_SUNW_UNWIND) && - (shdr->sh_addr == unwind_phdr.p_vaddr)) || + if ((uphdr && (shdr->sh_addr == uphdr->p_vaddr)) || (strncmp(_cache->c_name, MSG_ORIG(MSG_SCN_FRMHDR), - MSG_SCN_FRMHDR_SIZE) == 0)) { - uint_t vers; - uint_t frame_ptr_enc; - uint64_t frame_ptr; - uint_t fde_cnt_enc; - uint64_t fde_cnt; - uint_t table_enc; - uint64_t tabndx; - - dbg_print(MSG_ORIG(MSG_UNW_FRMHDR)); - ndx = 0; - - vers = data[ndx++]; - frame_ptr_enc = data[ndx++]; - fde_cnt_enc = data[ndx++]; - table_enc = data[ndx++]; - - dbg_print(MSG_ORIG(MSG_UNW_FRMVERS), vers); - - frame_ptr = dwarf_ehe_extract(data, - &ndx, frame_ptr_enc, ehdr->e_ident, - shdr->sh_addr + ndx); - - dbg_print(MSG_ORIG(MSG_UNW_FRPTRENC), - conv_dwarf_ehe_str(frame_ptr_enc), - frame_ptr); - - fde_cnt = dwarf_ehe_extract(data, - &ndx, fde_cnt_enc, ehdr->e_ident, - shdr->sh_addr + ndx); - dbg_print(MSG_ORIG(MSG_UNW_FDCNENC), - conv_dwarf_ehe_str(fde_cnt_enc), - fde_cnt); - dbg_print(MSG_ORIG(MSG_UNW_TABENC), - conv_dwarf_ehe_str(table_enc)); - dbg_print(MSG_ORIG(MSG_UNW_BINSRTAB1)); - dbg_print(MSG_ORIG(MSG_UNW_BINSRTAB2)); - - for (tabndx = 0; tabndx < fde_cnt; tabndx++) { - uint64_t init_loc; - uint64_t fde_loc; - init_loc = dwarf_ehe_extract(data, - &ndx, table_enc, ehdr->e_ident, - shdr->sh_addr); - fde_loc = dwarf_ehe_extract(data, - &ndx, table_enc, ehdr->e_ident, - shdr->sh_addr); - dbg_print(MSG_ORIG(MSG_UNW_BINSRTABENT), - init_loc, fde_loc); - } - continue; + MSG_SCN_FRMHDR_SIZE) == 0)) { + + dbg_print(0, MSG_ORIG(MSG_UNW_FRMHDR)); + ndx = 0; + + vers = data[ndx++]; + frame_ptr_enc = data[ndx++]; + fde_cnt_enc = data[ndx++]; + table_enc = data[ndx++]; + + dbg_print(0, MSG_ORIG(MSG_UNW_FRMVERS), vers); + + frame_ptr = dwarf_ehe_extract(data, &ndx, frame_ptr_enc, + ehdr->e_ident, shdr->sh_addr + ndx); + + dbg_print(0, MSG_ORIG(MSG_UNW_FRPTRENC), + conv_dwarf_ehe(frame_ptr_enc), EC_XWORD(frame_ptr)); + + fde_cnt = dwarf_ehe_extract(data, &ndx, fde_cnt_enc, + ehdr->e_ident, shdr->sh_addr + ndx); + + dbg_print(0, MSG_ORIG(MSG_UNW_FDCNENC), + conv_dwarf_ehe(fde_cnt_enc), EC_XWORD(fde_cnt)); + dbg_print(0, MSG_ORIG(MSG_UNW_TABENC), + conv_dwarf_ehe(table_enc)); + dbg_print(0, MSG_ORIG(MSG_UNW_BINSRTAB1)); + dbg_print(0, MSG_ORIG(MSG_UNW_BINSRTAB2)); + + for (tabndx = 0; tabndx < fde_cnt; tabndx++) { + dbg_print(0, MSG_ORIG(MSG_UNW_BINSRTABENT), + EC_XWORD(dwarf_ehe_extract(data, &ndx, + table_enc, ehdr->e_ident, shdr->sh_addr)), + EC_XWORD(dwarf_ehe_extract(data, &ndx, + table_enc, ehdr->e_ident, shdr->sh_addr))); + } + continue; } /* @@ -494,12 +444,10 @@ unwind(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, while (off < datasize) { uint_t cieid, cielength, cieversion, cieretaddr; - int cieRflag, cieLflag, - ciePflag, cieZflag; - uint_t length, id; + int cieRflag, cieLflag, ciePflag, cieZflag; + uint_t cieaugndx, length, id; uint64_t ciecalign, ciedalign; char *cieaugstr; - uint_t cieaugndx; ndx = 0; /* @@ -515,47 +463,50 @@ unwind(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, ndx += 4; /* - * A CIE record has a id of '0', otherwise - * this is a FDE entry and the 'id' is the - * CIE pointer. + * A CIE record has a id of '0', otherwise this is a + * FDE entry and the 'id' is the CIE pointer. */ if (id == 0) { uint64_t persVal; + cielength = length; cieid = id; + cieLflag = ciePflag = cieRflag = cieZflag = 0; - cieLflag = 0; - ciePflag = 0; - cieRflag = 0; - cieZflag = 0; - - dbg_print(MSG_ORIG(MSG_UNW_CIE), - shdr->sh_addr + off); - dbg_print(MSG_ORIG(MSG_UNW_CIELNGTH), + dbg_print(0, MSG_ORIG(MSG_UNW_CIE), + EC_XWORD(shdr->sh_addr + off)); + dbg_print(0, MSG_ORIG(MSG_UNW_CIELNGTH), cielength, cieid); + cieversion = data[off + ndx]; ndx += 1; cieaugstr = (char *)(&data[off + ndx]); ndx += strlen(cieaugstr) + 1; - dbg_print(MSG_ORIG(MSG_UNW_CIEVERS), - cieversion, cieaugstr); + + dbg_print(0, MSG_ORIG(MSG_UNW_CIEVERS), + cieversion, cieaugstr); + ciecalign = uleb_extract(&data[off], &ndx); ciedalign = sleb_extract(&data[off], &ndx); cieretaddr = data[off + ndx]; ndx += 1; - dbg_print(MSG_ORIG(MSG_UNW_CIECALGN), - ciecalign, ciedalign, cieretaddr); + + dbg_print(0, MSG_ORIG(MSG_UNW_CIECALGN), + EC_XWORD(ciecalign), EC_XWORD(ciedalign), + cieretaddr); if (cieaugstr[0]) - dbg_print(MSG_ORIG(MSG_UNW_CIEAUXVAL)); + dbg_print(0, MSG_ORIG(MSG_UNW_CIEAUXVAL)); + for (cieaugndx = 0; cieaugstr[cieaugndx]; cieaugndx++) { uint_t val; + switch (cieaugstr[cieaugndx]) { case 'z': val = uleb_extract(&data[off], &ndx); - dbg_print( + dbg_print(0, MSG_ORIG(MSG_UNW_CIEAUXSIZE), val); cieZflag = 1; @@ -568,60 +519,52 @@ unwind(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, &data[off], &ndx, ciePflag, ehdr->e_ident, shdr->sh_addr + off + ndx); - dbg_print( + dbg_print(0, MSG_ORIG(MSG_UNW_CIEAUXPERS), ciePflag, - conv_dwarf_ehe_str(ciePflag), + conv_dwarf_ehe(ciePflag), EC_XWORD(persVal)); break; case 'R': val = data[off + ndx]; ndx += 1; - dbg_print( + dbg_print(0, MSG_ORIG(MSG_UNW_CIEAUXCENC), - val, conv_dwarf_ehe_str(val)); + val, conv_dwarf_ehe(val)); cieRflag = val; break; case 'L': val = data[off + ndx]; ndx += 1; - dbg_print( + dbg_print(0, MSG_ORIG(MSG_UNW_CIEAUXLSDA), - val, conv_dwarf_ehe_str(val)); + val, conv_dwarf_ehe(val)); cieLflag = val; break; default: - dbg_print( + dbg_print(0, MSG_ORIG(MSG_UNW_CIEAUXUNEC), cieaugstr[cieaugndx]); break; } } - if ((cielength + 4) > ndx) { - uint_t cnt; - dbg_printf(MSG_ORIG(MSG_UNW_CIECFI)); - cnt = 0; - while (ndx < (cielength + 4)) { - if ((cnt++ % 8) == 0) { - dbg_printf( - MSG_ORIG(MSG_UNW_CIECFI1)); - } - dbg_printf( - MSG_ORIG(MSG_UNW_CIECFI2), - data[off + ndx++]); - } - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - } + if ((cielength + 4) > ndx) + unwindtbl(&ndx, cielength, data, off, + MSG_ORIG(MSG_UNW_CIECFI), + MSG_ORIG(MSG_UNW_CIEPRE), + MSG_UNW_CIEPRE_SIZE); off += cielength + 4; + } else { uint_t fdelength = length; int fdecieptr = id; uint64_t fdeinitloc, fdeaddrrange; - dbg_print(MSG_ORIG(MSG_UNW_FDE), - shdr->sh_addr + off); - dbg_print(MSG_ORIG(MSG_UNW_FDELNGTH), + dbg_print(0, MSG_ORIG(MSG_UNW_FDE), + EC_XWORD(shdr->sh_addr + off)); + dbg_print(0, MSG_ORIG(MSG_UNW_FDELNGTH), fdelength, fdecieptr); + fdeinitloc = dwarf_ehe_extract(&data[off], &ndx, cieRflag, ehdr->e_ident, shdr->sh_addr + off + ndx); @@ -629,41 +572,35 @@ unwind(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, &ndx, (cieRflag & ~DW_EH_PE_pcrel), ehdr->e_ident, shdr->sh_addr + off + ndx); - dbg_print(MSG_ORIG(MSG_UNW_FDEINITLOC), - fdeinitloc, fdeaddrrange); + + dbg_print(0, MSG_ORIG(MSG_UNW_FDEINITLOC), + EC_XWORD(fdeinitloc), + EC_XWORD(fdeaddrrange)); + if (cieaugstr[0]) - dbg_print(MSG_ORIG(MSG_UNW_FDEAUXVAL)); + dbg_print(0, + MSG_ORIG(MSG_UNW_FDEAUXVAL)); if (cieZflag) { uint64_t val; val = uleb_extract(&data[off], &ndx); - dbg_print( - MSG_ORIG(MSG_UNW_FDEAUXSIZE), val); + dbg_print(0, + MSG_ORIG(MSG_UNW_FDEAUXSIZE), + EC_XWORD(val)); if (val & cieLflag) { fdeinitloc = dwarf_ehe_extract( &data[off], &ndx, cieLflag, ehdr->e_ident, shdr->sh_addr + off + ndx); - dbg_print( + dbg_print(0, MSG_ORIG(MSG_UNW_FDEAUXLSDA), - val); - } - } - if ((fdelength + 4) > ndx) { - uint_t cnt; - dbg_printf(MSG_ORIG(MSG_UNW_FDECFI)); - cnt = 0; - while (ndx < (fdelength + 4)) { - if ((cnt++ % 8) == 0) { - dbg_printf( - MSG_ORIG(MSG_UNW_FDECFI1)); - } - dbg_printf( - MSG_ORIG(MSG_UNW_FDECFI2), - data[off + ndx++]); + EC_XWORD(val)); } - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); } - + if ((fdelength + 4) > ndx) + unwindtbl(&ndx, fdelength, data, off, + MSG_ORIG(MSG_UNW_FDECFI), + MSG_ORIG(MSG_UNW_FDEPRE), + MSG_UNW_FDEPRE_SIZE); off += fdelength + 4; } } @@ -675,30 +612,32 @@ unwind(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, * this should be accompanied with a program header. */ static void -cap(const char *file, Cache *cache, GElf_Word shnum, GElf_Word phnum, - GElf_Ehdr *ehdr, Elf *elf) +cap(const char *file, Cache *cache, Word shnum, Word phnum, Ehdr *ehdr, + Elf *elf) { - GElf_Word cnt; - GElf_Shdr * cshdr = 0; + Word cnt; + Shdr * cshdr = 0; Cache * ccache; - Elf64_Off cphdr_off = 0; - Elf64_Xword cphdr_sz; + Off cphdr_off = 0; + Xword cphdr_sz; /* * Determine if a hardware/software capabilities header exists. */ - for (cnt = 0; cnt < phnum; cnt++) { - GElf_Phdr phdr; + if (phnum) { + Phdr *phdr; - if (gelf_getphdr(elf, cnt, &phdr) == NULL) { + if ((phdr = elf_getphdr(elf)) == NULL) { failure(file, MSG_ORIG(MSG_ELF_GETPHDR)); return; } - if (phdr.p_type == PT_SUNWCAP) { - cphdr_off = phdr.p_offset; - cphdr_sz = phdr.p_filesz; - break; + for (cnt = 0; cnt < phnum; phdr++, cnt++) { + if (phdr->p_type == PT_SUNWCAP) { + cphdr_off = phdr->p_offset; + cphdr_sz = phdr->p_filesz; + break; + } } } @@ -706,11 +645,8 @@ cap(const char *file, Cache *cache, GElf_Word shnum, GElf_Word phnum, * Determine if a hardware/software capabilities section exists. */ for (cnt = 1; cnt < shnum; cnt++) { - Cache * _cache; - GElf_Shdr *shdr; - - _cache = &cache[cnt]; - shdr = &_cache->c_shdr; + Cache *_cache = &cache[cnt]; + Shdr *shdr = _cache->c_shdr; if (shdr->sh_type != SHT_SUNW_cap) continue; @@ -731,28 +667,19 @@ cap(const char *file, Cache *cache, GElf_Word shnum, GElf_Word phnum, * Print the hardware/software capabilities section. */ if (cshdr) { - GElf_Word ndx, capn; + Word ndx, capn; + Cap *cap = (Cap *)ccache->c_data->d_buf; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_ELF_SCN_CAP), ccache->c_name); + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_INTL(MSG_ELF_SCN_CAP), ccache->c_name); - Gelf_cap_title(); - - /* LINTED */ - capn = (GElf_Word)(cshdr->sh_size / cshdr->sh_entsize); + Elf_cap_title(0); - /* LINTED */ - for (ndx = 0; ndx < capn; ndx++) { - GElf_Cap cap; + capn = (Word)(cshdr->sh_size / cshdr->sh_entsize); - if (gelf_getcap(ccache->c_data, ndx, &cap) == NULL) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADCAP), - file, ccache->c_name, elf_errmsg(0)); - (void) fflush(stderr); - return; - } - if (cap.c_tag != CA_SUNW_NULL) - Gelf_cap_print(&cap, ndx, ehdr->e_machine); + for (ndx = 0; ndx < capn; cap++, ndx++) { + if (cap->c_tag != CA_SUNW_NULL) + Elf_cap_entry(0, cap, ndx, ehdr->e_machine); } } else (void) fprintf(stderr, MSG_INTL(MSG_WARN_INVCAP1), file); @@ -777,30 +704,23 @@ cap(const char *file, Cache *cache, GElf_Word shnum, GElf_Word phnum, * Print the interpretor. */ static void -interp(const char *file, Cache *cache, GElf_Word shnum, GElf_Word phnum, - GElf_Ehdr *ehdr, Elf *elf) +interp(const char *file, Cache *cache, Word shnum, Word phnum, Elf *elf) { - GElf_Word cnt; - GElf_Shdr * ishdr = 0; - Cache * icache; - Elf64_Off iphdr_off = 0; - Elf64_Xword iphdr_sz; + Word cnt; + Shdr *ishdr = 0; + Cache *icache; + Off iphdr_off = 0; + Xword iphdr_fsz; /* * Determine if an interp header exists. */ - for (cnt = 0; cnt < phnum; cnt++) { - GElf_Phdr phdr; + if (phnum) { + Phdr *phdr; - if (gelf_getphdr(elf, cnt, &phdr) == NULL) { - failure(file, MSG_ORIG(MSG_ELF_GETPHDR)); - return; - } - - if (phdr.p_type == PT_INTERP) { - iphdr_off = phdr.p_offset; - iphdr_sz = phdr.p_filesz; - break; + if ((phdr = getphdr(phnum, PT_INTERP, file, elf)) != 0) { + iphdr_off = phdr->p_offset; + iphdr_fsz = phdr->p_filesz; } } @@ -811,11 +731,8 @@ interp(const char *file, Cache *cache, GElf_Word shnum, GElf_Word phnum, * Determine if an interp section exists. */ for (cnt = 1; cnt < shnum; cnt++) { - Cache * _cache; - GElf_Shdr *shdr; - - _cache = &cache[cnt]; - shdr = &_cache->c_shdr; + Cache *_cache = &cache[cnt]; + Shdr *shdr = _cache->c_shdr; /* * Scan sections to find a section which contains the PT_INTERP @@ -823,7 +740,7 @@ interp(const char *file, Cache *cache, GElf_Word shnum, GElf_Word phnum, */ if ((shdr->sh_type == SHT_NOBITS) || (iphdr_off < shdr->sh_offset) || - (iphdr_off + iphdr_sz) > (shdr->sh_offset + shdr->sh_size)) + (iphdr_off + iphdr_fsz) > (shdr->sh_offset + shdr->sh_size)) continue; icache = _cache; @@ -836,9 +753,9 @@ interp(const char *file, Cache *cache, GElf_Word shnum, GElf_Word phnum, * program header, as this is the offset used by the kernel. */ if (ishdr) { - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_ELF_SCN_INTERP), icache->c_name); - dbg_print(MSG_ORIG(MSG_FMT_INDENT), + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_INTL(MSG_ELF_SCN_INTERP), icache->c_name); + dbg_print(0, MSG_ORIG(MSG_FMT_INDENT), (char *)icache->c_data->d_buf + (iphdr_off - ishdr->sh_offset)); } else @@ -849,10 +766,9 @@ interp(const char *file, Cache *cache, GElf_Word shnum, GElf_Word phnum, * section information, flag them. */ if (ishdr && ((iphdr_off != ishdr->sh_offset) || - (iphdr_sz != ishdr->sh_size))) { + (iphdr_fsz != ishdr->sh_size))) { (void) fprintf(stderr, MSG_INTL(MSG_WARN_INVINTERP2), file, icache->c_name); - (void) fflush(stderr); } } @@ -860,124 +776,81 @@ interp(const char *file, Cache *cache, GElf_Word shnum, GElf_Word phnum, * Print the syminfo section. */ static void -syminfo(Cache *cache, GElf_Word shnum, const char *file) +syminfo(Cache *cache, Word shnum, const char *file) { - GElf_Shdr *shdr; - Elf_Data *dsyms, *ddyn; - GElf_Word symn, cnt, ndx; - Cache *syminfo = 0; - char *sname; + Shdr *infoshdr; + Syminfo *info; + Sym *syms; + Dyn *dyns; + Word infonum, cnt, ndx, symnum; + Cache *infocache = 0, *symsec, *strsec; for (cnt = 1; cnt < shnum; cnt++) { - if (cache[cnt].c_shdr.sh_type == SHT_SUNW_syminfo) { - syminfo = &cache[cnt]; + if (cache[cnt].c_shdr->sh_type == SHT_SUNW_syminfo) { + infocache = &cache[cnt]; break; } } - if (syminfo == 0) + if (infocache == 0) return; - shdr = &syminfo->c_shdr; - /* - * Determine the symbol info data and number. - */ - if ((shdr->sh_entsize == 0) || (shdr->sh_size == 0)) { + infoshdr = infocache->c_shdr; + if ((infoshdr->sh_entsize == 0) || (infoshdr->sh_size == 0)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), - file, syminfo->c_name); - (void) fflush(stderr); + file, infocache->c_name); return; } - /* LINTED */ - symn = (GElf_Word)(shdr->sh_size / shdr->sh_entsize); + infonum = (Word)(infoshdr->sh_size / infoshdr->sh_entsize); + info = (Syminfo *)infocache->c_data->d_buf; /* * Get the data buffer of the associated dynamic section. */ - if ((shdr->sh_info == 0) || (shdr->sh_info >= shnum)) { + if ((infoshdr->sh_info == 0) || (infoshdr->sh_info >= shnum)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHINFO), - file, syminfo->c_name, EC_XWORD(shdr->sh_info)); - (void) fflush(stderr); + file, infocache->c_name, EC_WORD(infoshdr->sh_info)); return; } - ddyn = cache[shdr->sh_info].c_data; - if (ddyn->d_buf == 0) { + dyns = cache[infoshdr->sh_info].c_data->d_buf; + if (dyns == 0) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), - file, cache[shdr->sh_info].c_name); - (void) fflush(stderr); + file, cache[infoshdr->sh_info].c_name); return; } /* - * Get the data buffer of the associated symbol table. + * Get the data buffer for the associated symbol table and string table. */ - if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), - file, syminfo->c_name, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); - return; - } - dsyms = cache[shdr->sh_link].c_data; - if (dsyms->d_buf == 0) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), - file, cache[shdr->sh_link].c_name); - (void) fflush(stderr); + if (stringtbl(cache, 1, cnt, shnum, file, + &symnum, &symsec, &strsec) == 0) return; - } - sname = cache[shdr->sh_link].c_name; - shdr = &cache[shdr->sh_link].c_shdr; + syms = symsec->c_data->d_buf; + /* - * Get the associated string table section. + * Loop through the syminfo entries. */ - if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), - file, sname, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); - return; - } + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_INTL(MSG_ELF_SCN_SYMINFO), infocache->c_name); + Elf_syminfo_title(0); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_ELF_SCN_SYMINFO), syminfo->c_name); - Gelf_syminfo_title(); + for (ndx = 1, info++; ndx < infonum; ndx++, info++) { + Sym *sym; + const char *needed = 0, *name; - for (ndx = 1; ndx < symn; ndx++) { - GElf_Syminfo gsip; - GElf_Sym gsym; - GElf_Dyn gdyn; - const char *needed, *sname; - - if (gelf_getsyminfo(syminfo->c_data, ndx, &gsip) == 0) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_SIBADCOUNT), - file, syminfo->c_name, ndx); - (void) fflush(stderr); - return; - } - if ((gsip.si_flags == 0) && (gsip.si_boundto == 0)) + if ((info->si_flags == 0) && (info->si_boundto == 0)) continue; - if (gelf_getsym(dsyms, ndx, &gsym) == 0) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSYM), - file, syminfo->c_name, elf_errmsg(0)); - (void) fflush(stderr); - return; - } + sym = &syms[ndx]; + name = string(infocache, ndx, strsec, file, sym->st_name); - sname = string(syminfo, cnt, &cache[shdr->sh_link], file, - gsym.st_name); - needed = 0; + if (info->si_boundto < SYMINFO_BT_LOWRESERVE) { + Dyn *dyn = &dyns[info->si_boundto]; - if (gsip.si_boundto < SYMINFO_BT_LOWRESERVE) { - if (gelf_getdyn(ddyn, gsip.si_boundto, &gdyn) == 0) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADDYN), - file, syminfo->c_name, gsip.si_boundto); - (void) fflush(stderr); - return; - } - needed = string(syminfo, gsip.si_boundto, - &cache[shdr->sh_link], file, gdyn.d_un.d_val); + needed = string(infocache, info->si_boundto, + strsec, file, dyn->d_un.d_val); } - - Gelf_syminfo_entry(ndx, &gsip, sname, needed); + Elf_syminfo_entry(0, ndx, info, name, needed); } } @@ -985,28 +858,27 @@ syminfo(Cache *cache, GElf_Word shnum, const char *file) * Print version definition section entries. */ static void -version_def(GElf_Verdef *vdf, GElf_Word shnum, Cache *vcache, Cache *scache, +version_def(Verdef *vdf, Word shnum, Cache *vcache, Cache *scache, const char *file) { - GElf_Word cnt; - char index[MAXNDXSIZE]; + Word cnt; + char index[MAXNDXSIZE]; - Gelf_ver_def_title(); + Elf_ver_def_title(0); for (cnt = 1; cnt <= shnum; cnt++, - vdf = (GElf_Verdef *)((uintptr_t)vdf + vdf->vd_next)) { - - GElf_Half vcnt = vdf->vd_cnt - 1; - GElf_Half ndx = vdf->vd_ndx; - GElf_Verdaux *vdap = (GElf_Verdaux *) - ((uintptr_t)vdf + vdf->vd_aux); + vdf = (Verdef *)((uintptr_t)vdf + vdf->vd_next)) { const char *name, *dep; + Half vcnt = vdf->vd_cnt - 1; + Half ndx = vdf->vd_ndx; + Verdaux *vdap = (Verdaux *)((uintptr_t)vdf + + vdf->vd_aux); /* * Obtain the name and first dependency (if any). */ name = string(vcache, cnt, scache, file, vdap->vda_name); - vdap = (GElf_Verdaux *)((uintptr_t)vdap + vdap->vda_next); + vdap = (Verdaux *)((uintptr_t)vdap + vdap->vda_next); if (vcnt) dep = string(vcache, cnt, scache, file, vdap->vda_name); else @@ -1014,21 +886,20 @@ version_def(GElf_Verdef *vdf, GElf_Word shnum, Cache *vcache, Cache *scache, (void) snprintf(index, MAXNDXSIZE, MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(ndx)); - Gelf_ver_line_1(index, name, dep, - conv_verflg_str(vdf->vd_flags)); + Elf_ver_line_1(0, index, name, dep, + conv_ver_flags(vdf->vd_flags)); /* * Print any additional dependencies. */ if (vcnt) { - vdap = (GElf_Verdaux *)((uintptr_t)vdap + - vdap->vda_next); + vdap = (Verdaux *)((uintptr_t)vdap + vdap->vda_next); for (vcnt--; vcnt; vcnt--, - vdap = (GElf_Verdaux *)((uintptr_t)vdap + + vdap = (Verdaux *)((uintptr_t)vdap + vdap->vda_next)) { dep = string(vcache, cnt, scache, file, vdap->vda_name); - Gelf_ver_line_2(MSG_ORIG(MSG_STR_EMPTY), dep); + Elf_ver_line_2(0, MSG_ORIG(MSG_STR_EMPTY), dep); } } } @@ -1038,20 +909,19 @@ version_def(GElf_Verdef *vdf, GElf_Word shnum, Cache *vcache, Cache *scache, * Print a version needed section entries. */ static void -version_need(GElf_Verneed *vnd, GElf_Word shnum, Cache *vcache, Cache *scache, +version_need(Verneed *vnd, Word shnum, Cache *vcache, Cache *scache, const char *file) { - GElf_Word cnt; + Word cnt; - Gelf_ver_need_title(); + Elf_ver_need_title(0); for (cnt = 1; cnt <= shnum; cnt++, - vnd = (GElf_Verneed *)((uintptr_t)vnd + vnd->vn_next)) { - - GElf_Half vcnt = vnd->vn_cnt; - GElf_Vernaux *vnap = (GElf_Vernaux *)((uintptr_t)vnd + - vnd->vn_aux); + vnd = (Verneed *)((uintptr_t)vnd + vnd->vn_next)) { const char *name, *dep; + Half vcnt = vnd->vn_cnt; + Vernaux *vnap = (Vernaux *)((uintptr_t)vnd + + vnd->vn_aux); /* * Obtain the name of the needed file and the version name @@ -1065,43 +935,43 @@ version_need(GElf_Verneed *vnd, GElf_Word shnum, Cache *vcache, Cache *scache, else dep = MSG_INTL(MSG_STR_NULL); - Gelf_ver_line_1(MSG_ORIG(MSG_STR_EMPTY), name, dep, - conv_verflg_str(vnap->vna_flags)); + Elf_ver_line_1(0, MSG_ORIG(MSG_STR_EMPTY), name, dep, + conv_ver_flags(vnap->vna_flags)); /* * Print any additional version dependencies. */ if (vcnt) { - vnap = (GElf_Vernaux *)((uintptr_t)vnap + - vnap->vna_next); + vnap = (Vernaux *)((uintptr_t)vnap + vnap->vna_next); for (vcnt--; vcnt; vcnt--, - vnap = (GElf_Vernaux *)((uintptr_t)vnap + + vnap = (Vernaux *)((uintptr_t)vnap + vnap->vna_next)) { dep = string(vcache, cnt, scache, file, vnap->vna_name); - Gelf_ver_line_3(MSG_ORIG(MSG_STR_EMPTY), dep, - conv_verflg_str(vnap->vna_flags)); + Elf_ver_line_3(0, MSG_ORIG(MSG_STR_EMPTY), dep, + conv_ver_flags(vnap->vna_flags)); } } } } /* - * Search for any verion sections - the Versym output is possibly - * used by the symbols() printing. If VERSYM is specified - then - * display the version information. + * Search for any version sections - the Versym output is possibly used by the + * symbols() printing. If VERSYM is specified - then display the version + * information. */ static Cache * -versions(Cache *cache, GElf_Word shnum, const char *file, uint32_t flags) +versions(Cache *cache, Word shnum, const char *file, uint_t flags) { GElf_Word cnt; Cache *versymcache = 0; for (cnt = 1; cnt < shnum; cnt++) { - void * ver; + void *ver; uint_t num; - Cache * _cache = &cache[cnt]; - GElf_Shdr * shdr = &_cache->c_shdr; + Cache *_cache = &cache[cnt]; + Shdr *shdr = _cache->c_shdr; + const char *secname = _cache->c_name; /* * If this is the version symbol table simply record its @@ -1124,14 +994,12 @@ versions(Cache *cache, GElf_Word shnum, const char *file, uint32_t flags) */ if ((ver = (void *)_cache->c_data->d_buf) == 0) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), - file, _cache->c_name); - (void) fflush(stderr); + file, secname); continue; } if ((num = shdr->sh_info) == 0) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHINFO), - file, _cache->c_name, EC_XWORD(shdr->sh_info)); - (void) fflush(stderr); + file, secname, EC_WORD(shdr->sh_info)); continue; } @@ -1140,21 +1008,18 @@ versions(Cache *cache, GElf_Word shnum, const char *file, uint32_t flags) */ if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), - file, _cache->c_name, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); + file, secname, EC_WORD(shdr->sh_link)); continue; } - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); if (shdr->sh_type == SHT_SUNW_verdef) { - dbg_print(MSG_INTL(MSG_ELF_SCN_VERDEF), - _cache->c_name); - version_def((GElf_Verdef *)ver, num, _cache, + dbg_print(0, MSG_INTL(MSG_ELF_SCN_VERDEF), secname); + version_def((Verdef *)ver, num, _cache, &cache[shdr->sh_link], file); } else if (shdr->sh_type == SHT_SUNW_verneed) { - dbg_print(MSG_INTL(MSG_ELF_SCN_VERNEED), - _cache->c_name); - version_need((GElf_Verneed *)ver, num, _cache, + dbg_print(0, MSG_INTL(MSG_ELF_SCN_VERNEED), secname); + version_need((Verneed *)ver, num, _cache, &cache[shdr->sh_link], file); } } @@ -1162,29 +1027,59 @@ versions(Cache *cache, GElf_Word shnum, const char *file, uint32_t flags) } /* - * Search for and process any symbol tables. + * Determine the extended section index used for symbol tables entries. */ -static void -symbols(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, - const char *name, Cache *versymcache, const char *file) +static int +symbols_getxindex(Cache *cache, Word shnum, Word seccnt, Word **shxndx, + uint_t *symnshxndx) { - GElf_Word cnt; - char is_core = (ehdr->e_type == ET_CORE); + uint_t symn; + Word symcnt; - for (cnt = 1; cnt < shnum; cnt++) { - GElf_Sym sym; - GElf_Word symn, _cnt; - GElf_Versym *versym; - Cache *_cache = &cache[cnt]; - GElf_Shdr *shdr = &_cache->c_shdr; - Word *symshndx; - uint_t nosymshndx; - uint_t nosyminshndx; + for (symcnt = 1; symcnt < shnum; symcnt++) { + Cache *_cache = &cache[symcnt]; + Shdr *shdr = _cache->c_shdr; + + if ((shdr->sh_type != SHT_SYMTAB_SHNDX) || + (shdr->sh_link != seccnt)) + continue; + + if ((shdr->sh_entsize) && + /* LINTED */ + ((symn = (uint_t)(shdr->sh_size / shdr->sh_entsize)) == 0)) + continue; + + *shxndx = _cache->c_data->d_buf; + *symnshxndx = symn; + return (0); + } + return (1); +} + +/* + * Search for and process any symbol tables. + */ +void +symbols(Cache *cache, Word shnum, Ehdr *ehdr, const char *name, + Cache *versymcache, const char *file, uint_t flags) +{ + Word seccnt; + char is_core = (ehdr->e_type == ET_CORE); + + for (seccnt = 1; seccnt < shnum; seccnt++) { + Word symn, symcnt, *shxndx; + Versym *versym; + Cache *_cache = &cache[seccnt]; + Shdr *shdr = _cache->c_shdr; + const char *secname = _cache->c_name; + Sym *sym; + int noshxndx; + uint_t symnshxndx; if ((shdr->sh_type != SHT_SYMTAB) && (shdr->sh_type != SHT_DYNSYM)) continue; - if (name && strcmp(name, _cache->c_name)) + if (name && strcmp(name, secname)) continue; /* @@ -1192,20 +1087,19 @@ symbols(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, */ if ((shdr->sh_entsize == 0) || (shdr->sh_size == 0)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), - file, _cache->c_name); - (void) fflush(stderr); + file, secname); continue; } /* LINTED */ - symn = (GElf_Word)(shdr->sh_size / shdr->sh_entsize); + symn = (Word)(shdr->sh_size / shdr->sh_entsize); + sym = (Sym *)_cache->c_data->d_buf; /* * Get the associated string table section. */ if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), - file, _cache->c_name, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); + file, secname, EC_WORD(shdr->sh_link)); continue; } @@ -1213,7 +1107,7 @@ symbols(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, * Determine if there is a associated Versym section * with this Symbol Table. */ - if (versymcache && (versymcache->c_shdr.sh_link == cnt)) + if (versymcache && (versymcache->c_shdr->sh_link == seccnt)) versym = versymcache->c_data->d_buf; else versym = 0; @@ -1221,110 +1115,74 @@ symbols(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, /* * Loop through the symbol tables entries. */ - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_ELF_SCN_SYMTAB), _cache->c_name); - Gelf_sym_table_title(ehdr, MSG_INTL(MSG_STR_INDEX), - MSG_INTL(MSG_STR_NAME)); - - symshndx = 0; - nosymshndx = 0; - nosyminshndx = 0; - for (_cnt = 0; _cnt < symn; _cnt++) { - char index[MAXNDXSIZE]; - char *sec; - const char *sname; + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_INTL(MSG_ELF_SCN_SYMTAB), secname); + Elf_syms_table_title(0, ELF_DBG_ELFDUMP); + + shxndx = 0; + noshxndx = 0; + symnshxndx = 0; + for (symcnt = 0; symcnt < symn; sym++, symcnt++) { + char index[MAXNDXSIZE], *sec; + const char *symname; int verndx; uchar_t type; - GElf_Shdr *tshdr; + Shdr *tshdr; Word shndx; - if (gelf_getsym(_cache->c_data, _cnt, &sym) == NULL) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSYM), - file, _cache->c_name, elf_errmsg(0)); - (void) fflush(stderr); - break; - } - /* * If we are using extended symbol indexes, find the * corresponding SHN_SYMTAB_SHNDX table. */ - if ((sym.st_shndx == SHN_XINDEX) && - (symshndx == 0) && (nosymshndx == 0)) { - Word __cnt; - - for (__cnt = 1; __cnt < shnum; __cnt++) { - Cache *_cache = &cache[__cnt]; - GElf_Shdr *shdr = &_cache->c_shdr; - - if ((shdr->sh_type != - SHT_SYMTAB_SHNDX) || - (shdr->sh_link != cnt)) - continue; - if (shdr->sh_entsize) - /* LINTED */ - nosyminshndx = (uint_t) - shdr->sh_size/shdr->sh_entsize; - if (nosyminshndx == 0) - continue; - symshndx = _cache->c_data->d_buf; - break; - } - if (symshndx == 0) - nosymshndx = 1; - } + if ((sym->st_shndx == SHN_XINDEX) && + (shxndx == 0) && (noshxndx == 0)) + noshxndx = symbols_getxindex(cache, shnum, + seccnt, &shxndx, &symnshxndx); /* LINTED */ - sname = string(_cache, _cnt, &cache[shdr->sh_link], - file, sym.st_name); + symname = string(_cache, symcnt, &cache[shdr->sh_link], + file, sym->st_name); tshdr = 0; sec = NULL; if (is_core) sec = (char *)MSG_INTL(MSG_STR_UNKNOWN); - else if ((sym.st_shndx < SHN_LORESERVE) && - (sym.st_shndx < shnum)) { - shndx = sym.st_shndx; - tshdr = &(cache[shndx].c_shdr); + else if ((sym->st_shndx < SHN_LORESERVE) && + (sym->st_shndx < shnum)) { + shndx = sym->st_shndx; + tshdr = cache[shndx].c_shdr; sec = cache[shndx].c_name; - } else if (sym.st_shndx == SHN_XINDEX) { - if (symshndx) { - Word _symshndx; + } else if (sym->st_shndx == SHN_XINDEX) { + if (shxndx) { + Word _shxndx; - if (_cnt > nosyminshndx) { + if (symcnt > symnshxndx) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSYMXINDEX1), - file, _cache->c_name, - EC_WORD(_cnt)); - (void) fflush(stderr); - } else if ((_symshndx = - symshndx[_cnt]) > shnum) { + file, secname, EC_WORD(symcnt)); + } else if ((_shxndx = + shxndx[symcnt]) > shnum) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSYMXINDEX2), - file, _cache->c_name, - EC_WORD(_cnt), - EC_WORD(_symshndx)); - (void) fflush(stderr); + file, secname, EC_WORD(symcnt), + EC_WORD(_shxndx)); } else { - shndx = _symshndx; - tshdr = &(cache[shndx].c_shdr); + shndx = _shxndx; + tshdr = cache[shndx].c_shdr; sec = cache[shndx].c_name; } } else { (void) fprintf(stderr, - MSG_INTL(MSG_ERR_BADSYMXINDEX3), - file, _cache->c_name, - EC_WORD(_cnt)); - (void) fflush(stderr); + MSG_INTL(MSG_ERR_BADSYMXINDEX3), + file, secname, EC_WORD(symcnt)); } - } else if ((sym.st_shndx < SHN_LORESERVE) && - (sym.st_shndx >= shnum)) { + } else if ((sym->st_shndx < SHN_LORESERVE) && + (sym->st_shndx >= shnum)) { (void) fprintf(stderr, - MSG_INTL(MSG_ERR_BADSYM5), - file, _cache->c_name, - sname, sym.st_shndx); - (void) fflush(stderr); + MSG_INTL(MSG_ERR_BADSYM5), file, + secname, demangle(symname, flags), + sym->st_shndx); } /* @@ -1332,29 +1190,27 @@ symbols(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, * version index. */ if (versym) - verndx = (int)versym[_cnt]; + verndx = (int)versym[symcnt]; else verndx = 0; /* * Error checking for TLS. */ - type = ELF_ST_TYPE(sym.st_info); + type = ELF_ST_TYPE(sym->st_info); if (type == STT_TLS) { if (tshdr && - (sym.st_shndx != SHN_UNDEF) && + (sym->st_shndx != SHN_UNDEF) && ((tshdr->sh_flags & SHF_TLS) == 0)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSYM3), file, - _cache->c_name, sname); - (void) fflush(stderr); + secname, demangle(symname, flags)); } - } else if ((type != STT_SECTION) && sym.st_size && + } else if ((type != STT_SECTION) && sym->st_size && tshdr && (tshdr->sh_flags & SHF_TLS)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSYM4), file, - _cache->c_name, sname); - (void) fflush(stderr); + secname, demangle(symname, flags)); } /* @@ -1362,21 +1218,19 @@ symbols(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, * references is appropriate. Note, UNDEF symbols that * have a size, have been known to exist - ignore them. */ - if (sym.st_size && shndx && tshdr && - (tshdr->sh_size < sym.st_size)) { + if (sym->st_size && shndx && tshdr && + (tshdr->sh_size < sym->st_size)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSYM6), file, - _cache->c_name, sname, EC_WORD(shndx), - EC_XWORD(tshdr->sh_size), - EC_XWORD(sym.st_size)); - (void) fflush(stderr); + secname, demangle(symname, flags), + EC_WORD(shndx), EC_XWORD(tshdr->sh_size), + EC_XWORD(sym->st_size)); } (void) snprintf(index, MAXNDXSIZE, - MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(_cnt)); - - Gelf_sym_table_entry(index, ehdr, &sym, verndx, sec, - sname); + MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(symcnt)); + Elf_syms_table_entry(0, ELF_DBG_ELFDUMP, index, + ehdr->e_machine, sym, verndx, sec, symname); } } } @@ -1385,35 +1239,36 @@ symbols(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, * Search for and process any relocation sections. */ static void -reloc(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, - const char *name, const char *file, uint32_t flags) +reloc(Cache *cache, Word shnum, Ehdr *ehdr, const char *name, const char *file, + uint_t flags) { - GElf_Word cnt; + Word cnt; for (cnt = 1; cnt < shnum; cnt++) { - Word type; - ulong_t numrels, entsize; - int ndx; - Elf_Data *dsyms; + Word type, symnum; + Xword relndx, relnum, relsize; + void *rels; + Sym *syms; + Cache *symsec, *strsec; Cache *_cache = &cache[cnt]; - GElf_Shdr *shdr = &_cache->c_shdr; - char *sname; + Shdr *shdr = _cache->c_shdr; + char *relname = _cache->c_name; if (((type = shdr->sh_type) != SHT_RELA) && (type != SHT_REL)) continue; - if (name && strcmp(name, _cache->c_name)) + if (name && strcmp(name, relname)) continue; /* - * Decide entry size + * Decide entry size. */ - if (((entsize = shdr->sh_entsize) == 0) || - (entsize > shdr->sh_size)) { + if (((relsize = shdr->sh_entsize) == 0) || + (relsize > shdr->sh_size)) { if (type == SHT_RELA) - entsize = sizeof (GElf_Rela); + relsize = sizeof (Rela); else - entsize = sizeof (GElf_Rel); + relsize = sizeof (Rel); } /* @@ -1421,131 +1276,90 @@ reloc(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, */ if (shdr->sh_size == 0) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), - file, _cache->c_name); - (void) fflush(stderr); + file, relname); continue; } - numrels = shdr->sh_size / entsize; + rels = _cache->c_data->d_buf; + relnum = shdr->sh_size / relsize; /* - * Get the data buffer for the associated symbol table. Note - * that we've been known to create static binaries containing - * relocations against weak symbols, if these get stripped the - * relocation records can't make symbolic references. + * Get the data buffer for the associated symbol table and + * string table. */ - if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), - file, _cache->c_name, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); + if (stringtbl(cache, 1, cnt, shnum, file, + &symnum, &symsec, &strsec) == 0) continue; - } - dsyms = cache[shdr->sh_link].c_data; - if (dsyms->d_buf == 0) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), - file, cache[shdr->sh_link].c_name); - (void) fflush(stderr); - continue; - } - sname = cache[shdr->sh_link].c_name; - shdr = &cache[shdr->sh_link].c_shdr; - /* - * Get the associated string table section. - */ - if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), - file, sname, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); - continue; - } + syms = symsec->c_data->d_buf; /* * Loop through the relocation entries. */ - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_ELF_SCN_RELOC), _cache->c_name); - if (type == SHT_RELA) { - if (flags & FLG_LONGNAME) - dbg_print(MSG_INTL(MSG_ELF_L_RELOC_RELA)); - else - dbg_print(MSG_INTL(MSG_ELF_RELOC_RELA)); - } else { - if (flags & FLG_LONGNAME) - dbg_print(MSG_INTL(MSG_ELF_L_RELOC_REL)); - else - dbg_print(MSG_INTL(MSG_ELF_RELOC_REL)); - } + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_INTL(MSG_ELF_SCN_RELOC), _cache->c_name); + Elf_reloc_title(0, ELF_DBG_ELFDUMP, type); - /* LINTED */ - for (ndx = 0; ndx < numrels; ndx++) { + for (relndx = 0; relndx < relnum; relndx++, + rels = (void *)((char *)rels + relsize)) { char section[BUFSIZ]; - const char *_name; - GElf_Word sndx; - ulong_t r_type; - GElf_Sym _sym; - GElf_Rela rela; + const char *symname; + Word symndx, reltype; + Rela *rela; + Rel *rel; /* - * Determine the symbol with which this relocation is - * associated. If the symbol represents a section - * offset construct an appropriate string. + * Unravel the relocation and determine the symbol with + * which this relocation is associated. */ if (type == SHT_RELA) { - (void) gelf_getrela(_cache->c_data, ndx, - &rela); + rela = (Rela *)rels; + symndx = ELF_R_SYM(rela->r_info); + reltype = ELF_R_TYPE(rela->r_info); } else { - (void) gelf_getrel(_cache->c_data, ndx, - (GElf_Rel*)&rela); + rel = (Rel *)rels; + symndx = ELF_R_SYM(rel->r_info); + reltype = ELF_R_TYPE(rel->r_info); } - /* LINTED */ - sndx = (GElf_Word)GELF_R_SYM(rela.r_info); - r_type = GELF_R_TYPE(rela.r_info); - /* LINTED */ - if (gelf_getsym(dsyms, (int)sndx, &_sym) == NULL) { - (void) fprintf(stderr, - MSG_INTL(MSG_ERR_RELBADSYMNDX), - file, elf_errmsg(0)); - (void) fflush(stderr); - _name = MSG_INTL(MSG_STR_UNKNOWN); - } else { - if ((GELF_ST_TYPE(_sym.st_info) == - STT_SECTION) && (_sym.st_name == 0)) { - if (flags & FLG_LONGNAME) - (void) snprintf(section, BUFSIZ, - MSG_INTL(MSG_STR_L_SECTION), - cache[_sym.st_shndx].c_name); - else - (void) snprintf(section, BUFSIZ, - MSG_INTL(MSG_STR_SECTION), - cache[_sym.st_shndx].c_name); - _name = (const char *)section; - } else { - /* LINTED */ - _name = string(_cache, - sndx, &cache[shdr->sh_link], - file, _sym.st_name); + symname = relsymname(cache, _cache, strsec, symndx, + symnum, relndx, syms, section, BUFSIZ, file, + flags); + + /* + * A zero symbol index is only valid for a few + * relocations. + */ + if (symndx == 0) { + Half mach = ehdr->e_machine; + int badrel = 0; + + if ((mach == EM_SPARC) || + (mach == EM_SPARC32PLUS) || + (mach == EM_SPARCV9)) { + if ((reltype != R_SPARC_NONE) && + (reltype != R_SPARC_REGISTER) && + (reltype != R_SPARC_RELATIVE)) + badrel++; + } else if (mach == EM_386) { + if ((reltype != R_386_NONE) && + (reltype != R_386_RELATIVE)) + badrel++; + } else if (mach == EM_AMD64) { + if ((reltype != R_AMD64_NONE) && + (reltype != R_AMD64_RELATIVE)) + badrel++; } - } - if ((sndx == 0) && ((IAM_SPARC(ehdr->e_machine) && - ((r_type != R_SPARC_NONE) && - (r_type != R_SPARC_REGISTER) && - (r_type != R_SPARC_RELATIVE))) || - ((IAM_INTEL(ehdr->e_machine) && - ((r_type != R_386_NONE) && - (r_type != R_386_RELATIVE)))))) { - (void) fprintf(stderr, - MSG_INTL(MSG_ERR_BADREL1), file, - conv_reloc_type_str(ehdr->e_machine, - /* LINTED */ - (uint_t)r_type)); - (void) fflush(stderr); + if (badrel) { + (void) fprintf(stderr, + MSG_INTL(MSG_ERR_BADREL1), file, + conv_reloc_type(mach, reltype)); + } } - Gelf_reloc_entry(MSG_ORIG(MSG_STR_EMPTY), - ehdr->e_machine, type, (void *)&rela, - _cache->c_name, _name); + Elf_reloc_entry_1(0, ELF_DBG_ELFDUMP, + MSG_ORIG(MSG_STR_EMPTY), ehdr->e_machine, type, + rels, relname, symname, 0); } } } @@ -1554,81 +1368,69 @@ reloc(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, * Search for and process a .dynamic section. */ static void -dynamic(Cache *cache, GElf_Word shnum, GElf_Ehdr *ehdr, const char *file) +dynamic(Cache *cache, Word shnum, Ehdr *ehdr, const char *file) { - GElf_Word cnt; + Word cnt; for (cnt = 1; cnt < shnum; cnt++) { - GElf_Dyn dyn; - ulong_t numdyn; - int ndx; - Cache * _cache = &cache[cnt]; - GElf_Shdr * shdr = &_cache->c_shdr; + Dyn *dyn; + ulong_t numdyn; + int ndx; + Cache *_cache = &cache[cnt], *strsec; + Shdr *shdr = _cache->c_shdr; if (shdr->sh_type != SHT_DYNAMIC) continue; /* - * Get the associated string table section. + * Verify the associated string table section. */ - if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), - file, _cache->c_name, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); + if (stringtbl(cache, 0, cnt, shnum, file, 0, 0, &strsec) == 0) continue; - } + numdyn = shdr->sh_size / shdr->sh_entsize; + dyn = (Dyn *)_cache->c_data->d_buf; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_ELF_SCN_DYNAMIC), _cache->c_name); + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_INTL(MSG_ELF_SCN_DYNAMIC), _cache->c_name); - Gelf_dyn_title(); + Elf_dyn_title(0); - /* LINTED */ - for (ndx = 0; ndx < numdyn; ++ndx) { + for (ndx = 0; ndx < numdyn; dyn++, ndx++) { const char *name; - (void) gelf_getdyn(_cache->c_data, ndx, &dyn); - if (dyn.d_tag == DT_NULL) - break; - /* * Print the information numerically, and if possible * as a string. */ - if ((dyn.d_tag == DT_NEEDED) || - (dyn.d_tag == DT_SONAME) || - (dyn.d_tag == DT_FILTER) || - (dyn.d_tag == DT_AUXILIARY) || - (dyn.d_tag == DT_CONFIG) || - (dyn.d_tag == DT_RPATH) || - (dyn.d_tag == DT_RUNPATH) || - (dyn.d_tag == DT_USED) || - (dyn.d_tag == DT_DEPAUDIT) || - (dyn.d_tag == DT_AUDIT) || - (dyn.d_tag == DT_SUNW_AUXILIARY) || - (dyn.d_tag == DT_SUNW_FILTER)) - name = string(_cache, ndx, - &cache[shdr->sh_link], file, - dyn.d_un.d_ptr); - else if (dyn.d_tag == DT_FLAGS) - /* LINTED */ - name = conv_dynflag_str((Word)dyn.d_un.d_val); - else if (dyn.d_tag == DT_FLAGS_1) - /* LINTED */ - name = conv_dynflag_1_str((Word)dyn.d_un.d_val); - else if (dyn.d_tag == DT_POSFLAG_1) - /* LINTED */ - name = conv_dynposflag_1_str((Word)dyn.d_un.d_val); - else if (dyn.d_tag == DT_FEATURE_1) - /* LINTED */ - name = conv_dynfeature_1_str((Word)dyn.d_un.d_val); - else if (dyn.d_tag == DT_DEPRECATED_SPARC_REGISTER) - name = MSG_INTL(MSG_STR_DEPRECATED); + if ((dyn->d_tag == DT_NEEDED) || + (dyn->d_tag == DT_SONAME) || + (dyn->d_tag == DT_FILTER) || + (dyn->d_tag == DT_AUXILIARY) || + (dyn->d_tag == DT_CONFIG) || + (dyn->d_tag == DT_RPATH) || + (dyn->d_tag == DT_RUNPATH) || + (dyn->d_tag == DT_USED) || + (dyn->d_tag == DT_DEPAUDIT) || + (dyn->d_tag == DT_AUDIT) || + (dyn->d_tag == DT_SUNW_AUXILIARY) || + (dyn->d_tag == DT_SUNW_FILTER)) + name = string(_cache, ndx, strsec, + file, dyn->d_un.d_ptr); + else if (dyn->d_tag == DT_FLAGS) + name = conv_dyn_flag(dyn->d_un.d_val); + else if (dyn->d_tag == DT_FLAGS_1) + name = conv_dyn_flag1(dyn->d_un.d_val); + else if (dyn->d_tag == DT_POSFLAG_1) + name = conv_dyn_posflag1(dyn->d_un.d_val); + else if (dyn->d_tag == DT_FEATURE_1) + name = conv_dyn_feature1(dyn->d_un.d_val); + else if (dyn->d_tag == DT_DEPRECATED_SPARC_REGISTER) + name = MSG_INTL(MSG_STR_DEPRECATED); else - name = MSG_ORIG(MSG_STR_EMPTY); + name = MSG_ORIG(MSG_STR_EMPTY); - Gelf_dyn_print(&dyn, ndx, name, ehdr->e_machine); + Elf_dyn_entry(0, dyn, ndx, name, ehdr->e_machine); } } } @@ -1637,19 +1439,18 @@ dynamic(Cache *cache, GElf_Word shnum, GElf_Ehdr *ehdr, const char *file) * Search for and process a MOVE section. */ static void -move(Cache *cache, GElf_Word shnum, const char *name, const char *file, - uint32_t flags) +move(Cache *cache, Word shnum, const char *name, const char *file, uint_t flags) { - GElf_Word cnt; + Word cnt; + const char *fmt = 0; for (cnt = 1; cnt < shnum; cnt++) { - ulong_t num, symn; - int ndx; - Elf_Data *dsyms; - const char *fmt; - Cache *_cache = &cache[cnt]; - GElf_Shdr *shdr = &_cache->c_shdr; - char *sname; + Word movenum, symnum, ndx; + Sym *syms; + Cache *_cache = &cache[cnt]; + Shdr *shdr = _cache->c_shdr; + Cache *symsec, *strsec; + Move *move; if (shdr->sh_type != SHT_SUNW_move) continue; @@ -1662,142 +1463,84 @@ move(Cache *cache, GElf_Word shnum, const char *name, const char *file, if ((shdr->sh_entsize == 0) || (shdr->sh_size == 0)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), file, _cache->c_name); - (void) fflush(stderr); continue; } - num = shdr->sh_size / shdr->sh_entsize; + move = (Move *)_cache->c_data->d_buf; + movenum = shdr->sh_size / shdr->sh_entsize; /* - * Get the data buffer for the associated symbol table. + * Get the data buffer for the associated symbol table and + * string table. */ - if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), - file, _cache->c_name, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); - continue; - } - dsyms = cache[shdr->sh_link].c_data; - if (dsyms->d_buf == 0) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), - file, cache[shdr->sh_link].c_name); - (void) fflush(stderr); - continue; - } - - sname = cache[shdr->sh_link].c_name; - shdr = &cache[shdr->sh_link].c_shdr; - - /* - * Get the associated string table section. - */ - if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), - file, sname, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); - continue; - } - if ((shdr->sh_entsize == 0) || (shdr->sh_size == 0)) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), - file, sname); - (void) fflush(stderr); - continue; - } - symn = shdr->sh_size / shdr->sh_entsize; + if (stringtbl(cache, 1, cnt, shnum, file, + &symnum, &symsec, &strsec) == 0) + return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_MV_TITLE), _cache->c_name); + syms = (Sym *)symsec->c_data->d_buf; - fmt = MSG_INTL(MSG_MV_ENTRY); + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_INTL(MSG_ELF_SCN_MOVE), _cache->c_name); + dbg_print(0, MSG_INTL(MSG_MOVE_TITLE)); - /* LINTED */ - for (ndx = 0; ndx < num; ndx++) { - GElf_Move move; - const char *name; - GElf_Sym sym; - char sct[BUFSIZ]; - Word shndx; + if (fmt == 0) + fmt = MSG_INTL(MSG_MOVE_ENTRY); - if (gelf_getmove(_cache->c_data, ndx, &move) == NULL) { - (void) fprintf(stderr, - MSG_INTL(MSG_ERR_BADMOVE), - file, _cache->c_name, elf_errmsg(0)); - (void) fflush(stderr); - break; - } + for (ndx = 0; ndx < movenum; move++, ndx++) { + const char *symname; + char index[MAXNDXSIZE], section[BUFSIZ]; + Word symndx, shndx; + Sym *sym; /* * Check for null entries */ - if ((move.m_info == 0) && (move.m_value == 0) && - (move.m_poffset == 0) && (move.m_repeat == 0) && - (move.m_stride == 0)) { - dbg_print(fmt, EC_XWORD(move.m_poffset), - EC_XWORD(0), 0, 0, 0, EC_LWORD(0), - MSG_ORIG(MSG_STR_EMPTY)); + if ((move->m_info == 0) && (move->m_value == 0) && + (move->m_poffset == 0) && (move->m_repeat == 0) && + (move->m_stride == 0)) { + dbg_print(0, fmt, MSG_ORIG(MSG_STR_EMPTY), + EC_XWORD(move->m_poffset), 0, 0, 0, + EC_LWORD(0), MSG_ORIG(MSG_STR_EMPTY)); continue; } - if ((GELF_M_SYM(move.m_info) == 0) || - (GELF_M_SYM(move.m_info) >= symn)) { + if (((symndx = ELF_M_SYM(move->m_info)) == 0) || + (symndx >= symnum)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADMINFO), file, - _cache->c_name, EC_XWORD(move.m_info)); - (void) fflush(stderr); - dbg_print(fmt, EC_XWORD(move.m_poffset), - EC_XWORD(GELF_M_SYM(move.m_info)), - /* LINTED */ - GELF_M_SIZE(move.m_info), move.m_repeat, - move.m_stride, EC_LWORD(move.m_value), + _cache->c_name, EC_XWORD(move->m_info)); + + (void) snprintf(index, MAXNDXSIZE, + MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(symndx)); + dbg_print(0, fmt, index, + EC_XWORD(move->m_poffset), + ELF_M_SIZE(move->m_info), move->m_repeat, + move->m_stride, move->m_value, MSG_INTL(MSG_STR_UNKNOWN)); continue; } - if (gelf_getsym(dsyms, - /* LINTED */ - (int)GELF_M_SYM(move.m_info), &sym) == NULL) { - (void) fprintf(stderr, - MSG_INTL(MSG_ERR_MVBADSYMNDX), - file, elf_errmsg(0)); - (void) fflush(stderr); - name = MSG_INTL(MSG_STR_UNKNOWN); - } else { - if ((GELF_ST_TYPE(sym.st_info) == - STT_SECTION) && (sym.st_name == 0)) { - if (flags & FLG_LONGNAME) - (void) snprintf(sct, BUFSIZ, - MSG_INTL(MSG_STR_L_SECTION), - cache[sym.st_shndx].c_name); - else - (void) snprintf(sct, BUFSIZ, - MSG_INTL(MSG_STR_SECTION), - cache[sym.st_shndx].c_name); - name = (const char *)sct; - } else { - name = demangle(string(_cache, - /* LINTED */ - (GElf_Word)GELF_M_SYM(move.m_info), - &cache[shdr->sh_link], file, - sym.st_name), flags); - } - } + symname = relsymname(cache, _cache, strsec, + symndx, symnum, ndx, syms, section, BUFSIZ, file, + flags); + sym = (Sym *)(syms + symndx); /* * Additional sanity check. */ - shndx = sym.st_shndx; + shndx = sym->st_shndx; if (!((shndx == SHN_COMMON) || (((shndx >= 1) && (shndx <= shnum)) && - (cache[shndx].c_shdr).sh_type == SHT_NOBITS))) { + (cache[shndx].c_shdr)->sh_type == SHT_NOBITS))) { (void) fprintf(stderr, - MSG_INTL(MSG_ERR_BADSYM2), file, - _cache->c_name, name); - (void) fflush(stderr); + MSG_INTL(MSG_ERR_BADSYM2), file, + _cache->c_name, demangle(symname, flags)); } - dbg_print(fmt, EC_XWORD(move.m_poffset), - EC_XWORD(GELF_M_SYM(move.m_info)), - /* LINTED */ - GELF_M_SIZE(move.m_info), move.m_repeat, - move.m_stride, EC_LWORD(move.m_value), name); + (void) snprintf(index, MAXNDXSIZE, + MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(symndx)); + dbg_print(0, fmt, index, EC_XWORD(move->m_poffset), + ELF_M_SIZE(move->m_info), move->m_repeat, + move->m_stride, move->m_value, + demangle(symname, flags)); } } } @@ -1808,27 +1551,26 @@ move(Cache *cache, GElf_Word shnum, const char *name, const char *file, * and is decremented as each element is processed. */ void -note_entry(Cache *cache, Word *data, Word size, const char *file) +note_entry(Cache *cache, Word *data, size_t size, const char *file) { - Word bsize = size; + size_t bsize = size; + /* * Print out a single `note' information block. */ while (size > 0) { - Word namesz, descsz, type, pad, noteoff; - + size_t namesz, descsz, type, pad, noteoff; noteoff = bsize - size; /* * Make sure we can at least reference the 3 initial entries * (4-byte words) of the note information block. */ - if (size >= (Word)(sizeof (Word) * 3)) - size -= (Word)(sizeof (Word) * 3); + if (size >= (sizeof (Word) * 3)) + size -= (sizeof (Word) * 3); else { - (void) fprintf(stderr, MSG_INTL(MSG_NOTE_BADDATASIZE), - file, cache->c_name, EC_WORD(noteoff)); - (void) fflush(stderr); + (void) fprintf(stderr, MSG_INTL(MSG_NOTE_BADDATASZ), + file, cache->c_name, EC_WORD(noteoff)); return; } @@ -1840,13 +1582,13 @@ note_entry(Cache *cache, Word *data, Word size, const char *file) size -= namesz; else { (void) fprintf(stderr, - MSG_INTL(MSG_NOTE_BADNMSIZE), - file, cache->c_name, EC_WORD(noteoff), - EC_WORD(namesz)); - (void) fflush(stderr); + MSG_INTL(MSG_NOTE_BADNMSZ), file, + cache->c_name, EC_WORD(noteoff), + EC_WORD(namesz)); return; } } + /* * Make sure any specified descriptor can be referenced. */ @@ -1855,28 +1597,27 @@ note_entry(Cache *cache, Word *data, Word size, const char *file) * If namesz isn't a 4-byte multiple, account for any * padding that must exist before the descriptor. */ - if ((pad = (namesz & (Word)(sizeof (Word) - 1))) != 0) { - pad = (Word)sizeof (Word) - pad; + if ((pad = (namesz & (sizeof (Word) - 1))) != 0) { + pad = sizeof (Word) - pad; size -= pad; } if (size >= descsz) size -= descsz; else { (void) fprintf(stderr, - MSG_INTL(MSG_NOTE_BADDESIZE), - file, cache->c_name, EC_WORD(noteoff), - EC_WORD(namesz)); - (void) fflush(stderr); + MSG_INTL(MSG_NOTE_BADDESZ), file, + cache->c_name, EC_WORD(noteoff), + EC_WORD(namesz)); return; } } type = *data++; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_ORIG(MSG_NOTE_TYPE), EC_WORD(type)); + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_ORIG(MSG_NOTE_TYPE), EC_WORD(type)); - dbg_print(MSG_ORIG(MSG_NOTE_NAMESZ), EC_WORD(namesz)); + dbg_print(0, MSG_ORIG(MSG_NOTE_NAMESZ), EC_WORD(namesz)); if (namesz) { char *name = (char *)data; @@ -1890,7 +1631,7 @@ note_entry(Cache *cache, Word *data, Word size, const char *file) ~(sizeof (Word) - 1)); /* LINTED */ data = (Word *)name; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); } /* @@ -1898,16 +1639,16 @@ note_entry(Cache *cache, Word *data, Word size, const char *file) * account for any padding that must exist before the next * information block. */ - if ((pad = (descsz & (Word)(sizeof (Word) - 1))) != 0) { - pad = (Word)sizeof (Word) - pad; + if ((pad = (descsz & (sizeof (Word) - 1))) != 0) { + pad = sizeof (Word) - pad; if (size > pad) size -= pad; } - dbg_print(MSG_ORIG(MSG_NOTE_DESCSZ), EC_WORD(descsz)); + dbg_print(0, MSG_ORIG(MSG_NOTE_DESCSZ), EC_WORD(descsz)); if (descsz) { int ndx, byte, word; - char string[58], * str = string; + char string[58], *str = string; uchar_t *desc = (uchar_t *)data; /* @@ -1927,7 +1668,7 @@ note_entry(Cache *cache, Word *data, Word size, const char *file) } if (word == 4) { *str = '\0'; - dbg_print(MSG_ORIG(MSG_NOTE_DESC), + dbg_print(0, MSG_ORIG(MSG_NOTE_DESC), ndx, string); word = 0; ndx += 16; @@ -1936,7 +1677,8 @@ note_entry(Cache *cache, Word *data, Word size, const char *file) } if (byte || word) { *str = '\0'; - dbg_print(MSG_ORIG(MSG_NOTE_DESC), ndx, string); + dbg_print(0, MSG_ORIG(MSG_NOTE_DESC), + ndx, string); } desc += pad; @@ -1950,16 +1692,16 @@ note_entry(Cache *cache, Word *data, Word size, const char *file) * Search for and process a .note section. */ static void -note(Cache *cache, GElf_Word shnum, const char *name, const char *file) +note(Cache *cache, Word shnum, const char *name, const char *file) { - GElf_Word cnt; + Word cnt; /* * Otherwise look for any .note sections. */ for (cnt = 1; cnt < shnum; cnt++) { - Cache * _cache = &cache[cnt]; - GElf_Shdr * shdr = &_cache->c_shdr; + Cache *_cache = &cache[cnt]; + Shdr *shdr = _cache->c_shdr; if (shdr->sh_type != SHT_NOTE) continue; @@ -1973,49 +1715,93 @@ note(Cache *cache, GElf_Word shnum, const char *name, const char *file) if (shdr->sh_offset & (sizeof (Word) - 1)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADALIGN), file, _cache->c_name); - (void) fflush(stderr); continue; } - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_ELF_SCN_NOTE), _cache->c_name); + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_INTL(MSG_ELF_SCN_NOTE), _cache->c_name); note_entry(_cache, (Word *)_cache->c_data->d_buf, /* LINTED */ (Word)_cache->c_data->d_size, file); } } +/* + * Determine an individual hash entry. This may be the initial hash entry, + * or an associated chain entry. + */ +static void +hash_entry(Cache *refsec, Cache *strsec, const char *hsecname, Word hashndx, + Word symndx, Word symn, Sym *syms, const char *file, ulong_t bkts, + uint_t flags, int chain) +{ + Sym *sym; + const char *symname, *str; + char _bucket[MAXNDXSIZE], _symndx[MAXNDXSIZE]; + ulong_t nbkt, nhash; + + if (symndx > symn) { + (void) fprintf(stderr, MSG_INTL(MSG_ERR_HSBADSYMNDX), file, + EC_WORD(symndx), EC_WORD(hashndx)); + symname = MSG_INTL(MSG_STR_UNKNOWN); + } else { + sym = (Sym *)(syms + symndx); + symname = string(refsec, symndx, strsec, file, sym->st_name); + } + + if (chain == 0) { + (void) snprintf(_bucket, MAXNDXSIZE, MSG_ORIG(MSG_FMT_INTEGER), + hashndx); + str = (const char *)_bucket; + } else + str = MSG_ORIG(MSG_STR_EMPTY); + + (void) snprintf(_symndx, MAXNDXSIZE, MSG_ORIG(MSG_FMT_INDEX2), + EC_WORD(symndx)); + dbg_print(0, MSG_ORIG(MSG_FMT_HASH_INFO), str, _symndx, + demangle(symname, flags)); + + /* + * Determine if this string is in the correct bucket. + */ + nhash = elf_hash(symname); + nbkt = nhash % bkts; + + if (nbkt != hashndx) { + (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADHASH), file, + hsecname, symname, EC_WORD(hashndx), nbkt); + } +} #define MAXCOUNT 500 static void -hash(Cache *cache, GElf_Word shnum, const char *name, const char *file, - uint32_t flags) +hash(Cache *cache, Word shnum, const char *name, const char *file, uint_t flags) { static int count[MAXCOUNT]; - GElf_Word cnt; + Word cnt; ulong_t ndx, bkts; char number[MAXNDXSIZE]; for (cnt = 1; cnt < shnum; cnt++) { uint_t *hash, *chain; - Elf_Data *dsyms; Cache *_cache = &cache[cnt]; - GElf_Shdr *shdr = &_cache->c_shdr; - char *sname; + Shdr *sshdr, *hshdr = _cache->c_shdr; + char *ssecname, *hsecname = _cache->c_name; + Sym *syms; + Word symn; - if (shdr->sh_type != SHT_HASH) + if (hshdr->sh_type != SHT_HASH) continue; - if (name && strcmp(name, _cache->c_name)) + if (name && strcmp(name, hsecname)) continue; /* * Determine the hash table data and size. */ - if ((shdr->sh_entsize == 0) || (shdr->sh_size == 0)) { + if ((hshdr->sh_entsize == 0) || (hshdr->sh_size == 0)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), - file, _cache->c_name); - (void) fflush(stderr); + file, hsecname); continue; } hash = (uint_t *)_cache->c_data->d_buf; @@ -2026,85 +1812,52 @@ hash(Cache *cache, GElf_Word shnum, const char *name, const char *file, /* * Get the data buffer for the associated symbol table. */ - if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { + if ((hshdr->sh_link == 0) || (hshdr->sh_link >= shnum)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), - file, _cache->c_name, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); + file, hsecname, EC_WORD(hshdr->sh_link)); continue; } - dsyms = cache[shdr->sh_link].c_data; - if (dsyms->d_buf == 0) { + + _cache = &cache[hshdr->sh_link]; + ssecname = _cache->c_name; + + if ((syms = (Sym *)_cache->c_data->d_buf) == 0) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), - file, cache[shdr->sh_link].c_name); - (void) fflush(stderr); + file, ssecname); continue; } - sname = cache[shdr->sh_link].c_name; - shdr = &cache[shdr->sh_link].c_shdr; + sshdr = _cache->c_shdr; + /* LINTED */ + symn = (Word)(sshdr->sh_size / sshdr->sh_entsize); + /* * Get the associated string table section. */ - if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { + if ((sshdr->sh_link == 0) || (sshdr->sh_link >= shnum)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), - file, sname, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); + file, ssecname, EC_WORD(sshdr->sh_link)); continue; } - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_ELF_SCN_HASH), _cache->c_name); - dbg_print(MSG_INTL(MSG_ELF_HASH_INFO)); + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_INTL(MSG_ELF_SCN_HASH), hsecname); + dbg_print(0, MSG_INTL(MSG_ELF_HASH_INFO)); /* * Loop through the hash buckets, printing the appropriate * symbols. */ for (ndx = 0; ndx < bkts; ndx++, hash++) { - GElf_Sym _sym; - const char *_str; - GElf_Word _ndx, _cnt; - char _number[MAXNDXSIZE]; - ulong_t nbkt, nhash; + Word _ndx, _cnt; if (*hash == 0) { count[0]++; continue; } - /* LINTED */ - if (gelf_getsym(dsyms, (int)*hash, &_sym) == NULL) { - (void) fprintf(stderr, - MSG_INTL(MSG_ERR_HSBADSYMNDX), - file, elf_errmsg(0)); - (void) fflush(stderr); - _str = MSG_INTL(MSG_STR_UNKNOWN); - } else { - _str = string(_cache, (GElf_Word)*hash, - &cache[shdr->sh_link], file, - _sym.st_name); - } - - (void) snprintf(number, MAXNDXSIZE, - /* LINTED */ - MSG_ORIG(MSG_FMT_INTEGER), (int)ndx); - (void) snprintf(_number, MAXNDXSIZE, - MSG_ORIG(MSG_FMT_INDEX2), EC_XWORD(*hash)); - dbg_print(MSG_ORIG(MSG_FMT_HASH_INFO), number, _number, - demangle(_str, flags)); - - /* - * Determine if this string is in the correct bucket. - */ - nhash = elf_hash(_str); - nbkt = nhash % bkts; - if (nbkt != ndx) { - (void) fprintf(stderr, - MSG_INTL(MSG_ERR_BADHASH), file, - /* LINTED */ - _cache->c_name, _str, (int)ndx, (int)nbkt); - (void) fflush(stderr); - } + hash_entry(_cache, &cache[sshdr->sh_link], hsecname, + ndx, *hash, symn, syms, file, bkts, flags, 0); /* * Determine if any other symbols are chained to this @@ -2113,50 +1866,18 @@ hash(Cache *cache, GElf_Word shnum, const char *name, const char *file, _ndx = chain[*hash]; _cnt = 1; while (_ndx) { - /* LINTED */ - if (gelf_getsym(dsyms, (int)_ndx, - &_sym) == NULL) { - (void) fprintf(stderr, - MSG_INTL(MSG_ERR_HSBADSYMNDX), - file, elf_errmsg(0)); - (void) fflush(stderr); - _str = MSG_INTL(MSG_STR_UNKNOWN); - } else - _str = string(_cache, _ndx, - &cache[shdr->sh_link], file, - _sym.st_name); - - (void) snprintf(_number, MAXNDXSIZE, - MSG_ORIG(MSG_FMT_INDEX2), EC_XWORD(_ndx)); - dbg_print(MSG_ORIG(MSG_FMT_HASH_INFO), - MSG_ORIG(MSG_STR_EMPTY), _number, - demangle(_str, flags)); + hash_entry(_cache, &cache[sshdr->sh_link], + hsecname, ndx, _ndx, symn, syms, file, + bkts, flags, 1); _ndx = chain[_ndx]; _cnt++; - - /* - * Determine if this string is in the correct - * bucket. - */ - nhash = elf_hash(_str); - nbkt = nhash % bkts; - if (nbkt != ndx) { - (void) fprintf(stderr, - MSG_INTL(MSG_ERR_BADHASH), file, - _cache->c_name, _str, - /* LINTED */ - (int)ndx, (int)nbkt); - (void) fflush(stderr); - } } if (_cnt >= MAXCOUNT) { (void) fprintf(stderr, MSG_INTL(MSG_HASH_OVERFLW), file, - _cache->c_name, - /* LINTED */ - (int)ndx, _cnt); - (void) fflush(stderr); + _cache->c_name, EC_WORD(ndx), + EC_WORD(_cnt)); } else count[_cnt]++; } @@ -2167,147 +1888,124 @@ hash(Cache *cache, GElf_Word shnum, const char *name, const char *file, * Print out the count information. */ bkts = cnt = 0; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + for (ndx = 0; ndx < MAXCOUNT; ndx++) { - GElf_Word _cnt; + Word _cnt; if ((_cnt = count[ndx]) == 0) continue; - (void) snprintf(number, MAXNDXSIZE, MSG_ORIG(MSG_FMT_INTEGER), - /* LINTED */ - (int)_cnt); - /* LINTED */ - dbg_print(MSG_INTL(MSG_ELF_HASH_BKTS1), number, (int)ndx); + (void) snprintf(number, MAXNDXSIZE, + MSG_ORIG(MSG_FMT_INTEGER), _cnt); + dbg_print(0, MSG_INTL(MSG_ELF_HASH_BKTS1), number, + EC_WORD(ndx)); bkts += _cnt; - /* LINTED */ - cnt += (GElf_Word)(ndx * _cnt); + cnt += (Word)(ndx * _cnt); } if (cnt) { (void) snprintf(number, MAXNDXSIZE, MSG_ORIG(MSG_FMT_INTEGER), - /* LINTED */ - (int)bkts); - /* LINTED */ - dbg_print(MSG_INTL(MSG_ELF_HASH_BKTS2), number, (int)cnt); + bkts); + dbg_print(0, MSG_INTL(MSG_ELF_HASH_BKTS2), number, + EC_WORD(cnt)); } } - static void -group(Cache *cache, GElf_Word shnum, const char *name, const char *file, - uint32_t flags) +group(Cache *cache, Word shnum, const char *name, const char *file, + uint_t flags) { - GElf_Word cnt; - - for (cnt = 1; cnt < shnum; cnt++) { - Cache *_cache = &cache[cnt]; - GElf_Shdr *shdr = &_cache->c_shdr; - Elf_Data *dsyms; - GElf_Shdr *symshdr; - GElf_Sym sym; - const char *symname; - char flgstrbuf[MSG_GRP_COMDAT_SIZE + 10]; - Word *grpdata; - size_t _cnt; - size_t grpcnt; + Word scnt; + for (scnt = 1; scnt < shnum; scnt++) { + Cache *_cache = &cache[scnt]; + Shdr *shdr = _cache->c_shdr; + Word *grpdata, gcnt, grpcnt, symnum, unknown; + Cache *symsec, *strsec; + Sym *syms, *sym; + char flgstrbuf[MSG_GRP_COMDAT_SIZE + 10]; if (shdr->sh_type != SHT_GROUP) continue; if (name && strcmp(name, _cache->c_name)) continue; - dbg_print(MSG_INTL(MSG_GRP_LINE1), _cache->c_name); - if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), - file, _cache->c_name, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); + if ((_cache->c_data == 0) || + ((grpdata = (Word *)_cache->c_data->d_buf) == 0)) continue; - } + grpcnt = shdr->sh_size / sizeof (Word); - if (shdr->sh_entsize != sizeof (Word)) { - (void) fprintf(stderr, MSG_INTL(MSG_GRP_BADENTSZ), - file, _cache->c_name, - EC_XWORD(shdr->sh_entsize)); - (void) fflush(stderr); - } - symshdr = &(cache[shdr->sh_link].c_shdr); - if ((symshdr->sh_type != SHT_SYMTAB) && - (symshdr->sh_type != SHT_DYNSYM)) { - (void) fprintf(stderr, MSG_INTL(MSG_GRP_NOTSYMTAB), - file, _cache->c_name, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); - continue; - } - dsyms = cache[shdr->sh_link].c_data; - if ((shdr->sh_info == SHN_UNDEF) || ((ulong_t)shdr->sh_info > - (symshdr->sh_size / symshdr->sh_entsize))) { - (void) fprintf(stderr, MSG_INTL(MSG_GRP_BADSYMNDX), - file, _cache->c_name, EC_XWORD(shdr->sh_info)); - (void) fflush(stderr); - continue; + /* + * Get the data buffer for the associated symbol table and + * string table. + */ + if (stringtbl(cache, 1, scnt, shnum, file, + &symnum, &symsec, &strsec) == 0) + return; + + syms = symsec->c_data->d_buf; + + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_INTL(MSG_ELF_SCN_GRP), _cache->c_name); + dbg_print(0, MSG_INTL(MSG_GRP_TITLE)); + + /* + * The first element of the group defines the group. The + * associated symbol is defined by the sh_link field. + */ + if ((shdr->sh_info == SHN_UNDEF) || (shdr->sh_info > symnum)) { + (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHINFO), + file, _cache->c_name, EC_WORD(shdr->sh_info)); + return; } - flgstrbuf[0] = '['; - flgstrbuf[1] = '\0'; - if ((shdr->sh_size != 0) && - (_cache->c_data) && - ((grpdata = (Word *)_cache->c_data->d_buf) != 0)) { - if (grpdata[0] & GRP_COMDAT) { - (void) strcat(flgstrbuf, - MSG_ORIG(MSG_GRP_COMDAT)); - } - if ((grpdata[0] & ~GRP_COMDAT) != 0) { - (void) snprintf(flgstrbuf + strlen(flgstrbuf), - (MSG_GRP_COMDAT_SIZE + 10), - MSG_ORIG(MSG_GRP_FMT1), - (uint_t)(grpdata[0] & ~GRP_COMDAT)); - } + + (void) strcpy(flgstrbuf, MSG_ORIG(MSG_STR_OSQBRKT)); + if (grpdata[0] & GRP_COMDAT) { + (void) strcat(flgstrbuf, MSG_ORIG(MSG_GRP_COMDAT)); } - (void) strcat(flgstrbuf, MSG_ORIG(MSG_GRP_CLOSBRKT)); + if ((unknown = (grpdata[0] & ~GRP_COMDAT)) != 0) { + size_t len = strlen(flgstrbuf); - if (gelf_getsym(dsyms, shdr->sh_info, &sym) == NULL) { - (void) fprintf(stderr, - MSG_INTL(MSG_ERR_GRBADSYMNDX), - file, elf_errmsg(0)); - (void) fflush(stderr); + (void) snprintf(&flgstrbuf[len], + (MSG_GRP_COMDAT_SIZE + 10 - len), + MSG_ORIG(MSG_GRP_UNKNOWN), unknown); } - symname = demangle(string(_cache, shdr->sh_link, - &cache[symshdr->sh_link], file, sym.st_name), - flags); - dbg_print(MSG_INTL(MSG_GRP_LINE2)); - dbg_print(MSG_INTL(MSG_GRP_LINE3), - flgstrbuf, symname); - for (_cnt = 1, grpcnt = (shdr->sh_size / sizeof (Word)); - _cnt < grpcnt; _cnt++) { + (void) strcat(flgstrbuf, MSG_ORIG(MSG_STR_CSQBRKT)); + sym = (Sym *)(syms + shdr->sh_info); + + dbg_print(0, MSG_INTL(MSG_GRP_SIGNATURE), flgstrbuf, + demangle(string(_cache, 0, strsec, file, sym->st_name), + flags)); + + for (gcnt = 1; gcnt < grpcnt; gcnt++) { char index[MAXNDXSIZE]; - const char *sname; + const char *name; (void) snprintf(index, MAXNDXSIZE, - MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(_cnt)); - if (grpdata[_cnt] >= shnum) { - sname = MSG_INTL(MSG_GRP_INVALSCN); - } else { - sname = cache[grpdata[_cnt]].c_name; - } - (void) printf(MSG_ORIG(MSG_GRP_FMT2), index, sname, - (uint_t)grpdata[_cnt]); + MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(gcnt)); + + if (grpdata[gcnt] >= shnum) + name = MSG_INTL(MSG_GRP_INVALSCN); + else + name = cache[grpdata[gcnt]].c_name; + + (void) printf(MSG_ORIG(MSG_GRP_ENTRY), index, name, + EC_XWORD(grpdata[gcnt])); } } } - static void -got(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, - const char *file) +got(Cache *cache, Word shnum, Ehdr *ehdr, const char *file, uint_t flags) { Cache *gotcache = 0, *symtab = 0, *_cache; - GElf_Addr gotbgn, gotend; - GElf_Shdr *gotshdr; - GElf_Word cnt, gotents, gotndx; + Addr gotbgn, gotend; + Shdr *gotshdr; + Word cnt, gotents, gotndx; size_t gentsize; Got_info *gottable; char *gotdata; - GElf_Sym gsym; - GElf_Xword gsymaddr; + Sym *gotsym; + Xword gotsymaddr; /* * First, find the got. @@ -2320,7 +2018,7 @@ got(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, break; } } - if (!gotcache) + if (gotcache == 0) return; /* @@ -2329,40 +2027,33 @@ got(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, if (ehdr->e_type == ET_REL) { (void) fprintf(stderr, MSG_INTL(MSG_GOT_UNEXPECTED), file, _cache->c_name); - (void) fflush(stderr); } - gotshdr = &gotcache->c_shdr; - gotbgn = gotshdr->sh_addr; - + gotshdr = gotcache->c_shdr; if (gotshdr->sh_size == 0) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), file, gotcache->c_name); - (void) fflush(stderr); return; } + + gotbgn = gotshdr->sh_addr; gotend = gotbgn + gotshdr->sh_size; /* - * Some architectures don't properly set the sh_entsize - * for the GOT table. If it's not set we will default - * to a size of a pointer. + * Some architectures don't properly set the sh_entsize for the GOT + * table. If it's not set, default to a size of a pointer. */ - if ((gentsize = gotshdr->sh_entsize) == 0) { - if (ehdr->e_ident[EI_CLASS] == ELFCLASS64) - gentsize = sizeof (GElf_Xword); - else - gentsize = sizeof (GElf_Word); - } + if ((gentsize = gotshdr->sh_entsize) == 0) + gentsize = sizeof (Xword); + /* LINTED */ - gotents = (GElf_Word)(gotshdr->sh_size / gentsize); + gotents = (Word)(gotshdr->sh_size / gentsize); gotdata = gotcache->c_data->d_buf; if ((gottable = calloc(gotents, sizeof (Got_info))) == 0) { int err = errno; - (void) fprintf(stderr, MSG_INTL(MSG_ERR_MALLOC), - file, strerror(err)); - (void) fflush(stderr); + (void) fprintf(stderr, MSG_INTL(MSG_ERR_MALLOC), file, + strerror(err)); return; } @@ -2374,97 +2065,86 @@ got(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, * overriding a dynsym) so that we can lookup _GLOBAL_OFFSET_TABLE_. */ for (cnt = 1; cnt < shnum; cnt++) { - GElf_Shdr *shdr; - GElf_Word rtype; - Elf_Data *dsyms, *reldata; - GElf_Rela rela; - ulong_t rcount; - int ndx; - char *sname; + Word type, symnum; + Xword relndx, relnum, relsize; + void *rels; + Sym *syms; + Cache *symsec, *strsec; + Cache *_cache = &cache[cnt]; + Shdr *shdr; - _cache = &cache[cnt]; - shdr = &_cache->c_shdr; + shdr = _cache->c_shdr; + type = shdr->sh_type; - if ((symtab == 0) && (shdr->sh_type == SHT_DYNSYM)) { + if ((symtab == 0) && (type == SHT_DYNSYM)) { symtab = _cache; continue; } - if (shdr->sh_type == SHT_SYMTAB) { + if (type == SHT_SYMTAB) { symtab = _cache; continue; } - - rtype = shdr->sh_type; - if ((rtype != SHT_RELA) && (rtype != SHT_REL)) + if ((type != SHT_RELA) && (type != SHT_REL)) continue; /* - * Determine the relocation data and number. + * Decide entry size. */ - if ((shdr->sh_entsize == 0) || (shdr->sh_size == 0)) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), - file, _cache->c_name); - (void) fflush(stderr); - continue; + if (((relsize = shdr->sh_entsize) == 0) || + (relsize > shdr->sh_size)) { + if (type == SHT_RELA) + relsize = sizeof (Rela); + else + relsize = sizeof (Rel); } - rcount = shdr->sh_size / shdr->sh_entsize; - - reldata = _cache->c_data; /* - * Get the data buffer for the associated symbol table. + * Determine the number of relocations available. */ - if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), - file, _cache->c_name, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); - continue; - } - dsyms = cache[shdr->sh_link].c_data; - if (dsyms->d_buf == 0) { + if (shdr->sh_size == 0) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSZ), - file, cache[shdr->sh_link].c_name); - (void) fflush(stderr); + file, _cache->c_name); continue; } + rels = _cache->c_data->d_buf; + relnum = shdr->sh_size / relsize; - sname = cache[shdr->sh_link].c_name; - shdr = &cache[shdr->sh_link].c_shdr; /* - * Get the associated string table section. + * Get the data buffer for the associated symbol table and + * string table. */ - if ((shdr->sh_link == 0) || (shdr->sh_link >= shnum)) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHLINK), - file, sname, EC_XWORD(shdr->sh_link)); - (void) fflush(stderr); + if (stringtbl(cache, 1, cnt, shnum, file, + &symnum, &symsec, &strsec) == 0) continue; - } - /* LINTED */ - for (ndx = 0; ndx < rcount; ++ndx) { - GElf_Sym _sym; - GElf_Word sndx; - GElf_Addr offset; + syms = symsec->c_data->d_buf; + + /* + * Loop through the relocation entries. + */ + for (relndx = 0; relndx < relnum; relndx++, + rels = (void *)((char *)rels + relsize)) { + char section[BUFSIZ]; + Addr offset; Got_info *gip; - void *relret; + Word symndx, reltype; + Rela *rela; + Rel *rel; - if (rtype == SHT_RELA) { - relret = (void *)gelf_getrela(reldata, ndx, - &rela); + /* + * Unravel the relocation. + */ + if (type == SHT_RELA) { + rela = (Rela *)rels; + symndx = ELF_R_SYM(rela->r_info); + reltype = ELF_R_TYPE(rela->r_info); + offset = rela->r_offset; } else { - relret = (void *)gelf_getrel(reldata, ndx, - (GElf_Rel *)&rela); + rel = (Rel *)rels; + symndx = ELF_R_SYM(rel->r_info); + reltype = ELF_R_TYPE(rel->r_info); + offset = rel->r_offset; } - if (relret == NULL) { - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADREL), - file, _cache->c_name, elf_errmsg(0)); - (void) fflush(stderr); - break; - } - - offset = rela.r_offset; - /* LINTED */ - sndx = (GElf_Word)GELF_R_SYM(rela.r_info); /* * Only pay attention to relocations against the GOT. @@ -2473,148 +2153,129 @@ got(Cache *cache, GElf_Word shnum, GElf_Word phnum, GElf_Ehdr *ehdr, continue; /* LINTED */ - gotndx = (GElf_Word)((offset - gotbgn) / + gotndx = (Word)((offset - gotbgn) / gotshdr->sh_entsize); gip = &gottable[gotndx]; - if (gip->g_rshtype != 0) { + + if (gip->g_reltype != 0) { (void) fprintf(stderr, MSG_INTL(MSG_GOT_MULTIPLE), file, - /* LINTED */ - EC_WORD(gotndx), EC_XWORD(offset)); - (void) fflush(stderr); + EC_WORD(gotndx), EC_ADDR(offset)); continue; } - /* LINTED */ - if (gelf_getsym(dsyms, sndx, &_sym) == NULL) { - (void) fprintf(stderr, - MSG_INTL(MSG_ERR_RELBADSYMNDX), - file, elf_errmsg(0)); - (void) fflush(stderr); - gip->g_symname = MSG_INTL(MSG_STR_UNKNOWN); - } else { - gip->g_symname = string(_cache, sndx, - &cache[shdr->sh_link], file, _sym.st_name); - } - gip->g_rshtype = rtype; - gip->g_rela = rela; + if (symndx) + gip->g_symname = relsymname(cache, _cache, + strsec, symndx, symnum, relndx, syms, + section, BUFSIZ, file, flags); + gip->g_reltype = reltype; + gip->g_rel = rels; } } - if (symlookup(MSG_ORIG(MSG_GOT_SYM), cache, shnum, &gsym, symtab, file)) - gsymaddr = gsym.st_value; + if (symlookup(MSG_ORIG(MSG_GOT_SYM), cache, shnum, &gotsym, symtab, + file)) + gotsymaddr = gotsym->st_value; else - gsymaddr = gotbgn; + gotsymaddr = gotbgn; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_ELF_SCN_GOT), gotcache->c_name, gotents); - Gelf_got_title(ehdr->e_ident[EI_CLASS]); + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_INTL(MSG_ELF_SCN_GOT), gotcache->c_name); + Elf_got_title(0); for (gotndx = 0; gotndx < gotents; gotndx++) { Got_info *gip; Sword gindex; - GElf_Addr gaddr; - GElf_Xword gotentry; + Addr gaddr; + Xword gotentry; gip = &gottable[gotndx]; gaddr = gotbgn + (gotndx * gentsize); - /* LINTED */ - gindex = (Sword)((gaddr - gsymaddr) / gentsize); + gindex = (Sword)(gaddr - gotsymaddr) / (Sword)gentsize; - if (gentsize == sizeof (GElf_Word)) + if (gentsize == sizeof (Word)) /* LINTED */ - gotentry = (GElf_Xword)(*((GElf_Word *)(gotdata) + - gotndx)); + gotentry = (Xword)(*((Word *)(gotdata) + gotndx)); else /* LINTED */ - gotentry = *((GElf_Xword *)(gotdata) + gotndx); + gotentry = *((Xword *)(gotdata) + gotndx); - Gelf_got_entry(ehdr, gindex, gaddr, gotentry, gip->g_rshtype, - &gip->g_rela, gip->g_symname); + Elf_got_entry(0, gindex, gaddr, gotentry, ehdr->e_machine, + gip->g_reltype, gip->g_rel, gip->g_symname); } - free(gottable); } void checksum(Elf *elf) { - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_STR_CHECKSUM), gelf_checksum(elf)); + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_INTL(MSG_STR_CHECKSUM), elf_checksum(elf)); } -static void -regular(const char *file, Elf *elf, uint32_t flags, char *Nname, int wfd) +void +regular(const char *file, Elf *elf, uint_t flags, char *Nname, int wfd) { Elf_Scn *scn; - GElf_Ehdr ehdr; + Ehdr *ehdr; Elf_Data *data; - uint_t cnt; - GElf_Word shnum, phnum; - size_t shstrndx, _shnum, _phnum; - GElf_Shdr nameshdr; - GElf_Shdr shdr0; - GElf_Shdr *_shdr0; + size_t cnt, shstrndx, shnum, phnum; + Shdr *nameshdr, *shdr; char *names = 0; Cache *cache, *_cache; - Cache *versymcache; + Cache *versymcache = 0; - if (gelf_getehdr(elf, &ehdr) == NULL) { + if ((ehdr = elf_getehdr(elf)) == NULL) { failure(file, MSG_ORIG(MSG_ELF_GETEHDR)); return; } - if (elf_getshnum(elf, &_shnum) == 0) { + if (elf_getshnum(elf, &shnum) == 0) { failure(file, MSG_ORIG(MSG_ELF_GETSHNUM)); return; } - /* LINTED */ - shnum = (GElf_Word)_shnum; if (elf_getshstrndx(elf, &shstrndx) == 0) { failure(file, MSG_ORIG(MSG_ELF_GETSHSTRNDX)); return; } - if (elf_getphnum(elf, &_phnum) == 0) { + if (elf_getphnum(elf, &phnum) == 0) { failure(file, MSG_ORIG(MSG_ELF_GETPHNUM)); return; } - /* LINTED */ - phnum = (GElf_Word)_phnum; if ((scn = elf_getscn(elf, 0)) != NULL) { - if ((_shdr0 = gelf_getshdr(scn, &shdr0)) == NULL) { + if ((shdr = elf_getshdr(scn)) == NULL) { failure(file, MSG_ORIG(MSG_ELF_GETSHDR)); (void) fprintf(stderr, MSG_INTL(MSG_ELF_ERR_SCN), 0); - (void) fflush(stderr); return; } } else - _shdr0 = 0; + shdr = 0; /* * Print the elf header. */ if (flags & FLG_EHDR) - Gelf_elf_header(&ehdr, _shdr0); + Elf_ehdr(0, ehdr, shdr); /* * Print the program headers. */ - if ((flags & FLG_PHDR) && phnum != 0) { - GElf_Phdr phdr; + if ((flags & FLG_PHDR) && (phnum != 0)) { + Phdr *phdr; - for (cnt = 0; cnt < phnum; cnt++) { - if (gelf_getphdr(elf, cnt, &phdr) == NULL) { - failure(file, MSG_ORIG(MSG_ELF_GETPHDR)); - return; - } + if ((phdr = elf_getphdr(elf)) == NULL) { + failure(file, MSG_ORIG(MSG_ELF_GETPHDR)); + return; + } - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_ELF_PHDR), cnt); - Gelf_phdr_entry(ehdr.e_machine, &phdr); + for (cnt = 0; cnt < phnum; phdr++, cnt++) { + dbg_print(0, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(0, MSG_INTL(MSG_ELF_PHDR), EC_WORD(cnt)); + Elf_phdr(0, ehdr->e_machine, phdr); } } @@ -2625,11 +2286,12 @@ regular(const char *file, Elf *elf, uint32_t flags, char *Nname, int wfd) * was requested. */ if ((shnum <= 1) || (flags && (flags & ~(FLG_EHDR | FLG_PHDR)) == 0)) { - if ((ehdr.e_type == ET_CORE) && (flags & FLG_NOTE)) + if ((ehdr->e_type == ET_CORE) && (flags & FLG_NOTE)) note(0, shnum, 0, file); return; } + /* * Obtain the .shstrtab data buffer to provide the required section * name strings. @@ -2638,22 +2300,20 @@ regular(const char *file, Elf *elf, uint32_t flags, char *Nname, int wfd) failure(file, MSG_ORIG(MSG_ELF_GETSCN)); (void) fprintf(stderr, MSG_INTL(MSG_ELF_ERR_SHDR), EC_XWORD(shstrndx)); - (void) fflush(stderr); + } else if ((data = elf_getdata(scn, NULL)) == NULL) { failure(file, MSG_ORIG(MSG_ELF_GETDATA)); (void) fprintf(stderr, MSG_INTL(MSG_ELF_ERR_DATA), EC_XWORD(shstrndx)); - (void) fflush(stderr); - } else if (gelf_getshdr(scn, &nameshdr) == NULL) { + + } else if ((nameshdr = elf_getshdr(scn)) == NULL) { failure(file, MSG_ORIG(MSG_ELF_GETSHDR)); (void) fprintf(stderr, MSG_INTL(MSG_ELF_ERR_SCN), /* LINTED */ (int)elf_ndxscn(scn)); - (void) fflush(stderr); - } else if ((names = data->d_buf) == 0) { + + } else if ((names = data->d_buf) == 0) (void) fprintf(stderr, MSG_INTL(MSG_ERR_SHSTRNULL), file); - (void) fflush(stderr); - } /* * Fill in the cache descriptor with information for each section. @@ -2662,28 +2322,26 @@ regular(const char *file, Elf *elf, uint32_t flags, char *Nname, int wfd) int err = errno; (void) fprintf(stderr, MSG_INTL(MSG_ERR_MALLOC), file, strerror(err)); - (void) fflush(stderr); return; } - *cache = _cache_init; + *cache = cache_init; _cache = cache; _cache++; for (cnt = 1, scn = NULL; scn = elf_nextscn(elf, scn); cnt++, _cache++) { - if (gelf_getshdr(scn, &_cache->c_shdr) == NULL) { + if ((_cache->c_shdr = elf_getshdr(scn)) == NULL) { failure(file, MSG_ORIG(MSG_ELF_GETSHDR)); (void) fprintf(stderr, MSG_INTL(MSG_ELF_ERR_SCN), /* LINTED */ (int)elf_ndxscn(scn)); - (void) fflush(stderr); } - if (names && _cache->c_shdr.sh_name && + if (names && _cache->c_shdr->sh_name && /* LINTED */ - (nameshdr.sh_size > _cache->c_shdr.sh_name)) - _cache->c_name = names + _cache->c_shdr.sh_name; + (nameshdr->sh_size > _cache->c_shdr->sh_name)) + _cache->c_name = names + _cache->c_shdr->sh_name; else { /* * If there exists no shstrtab data, or a section header @@ -2702,12 +2360,11 @@ regular(const char *file, Elf *elf, uint32_t flags, char *Nname, int wfd) */ if (names && /* LINTED */ - (nameshdr.sh_size <= _cache->c_shdr.sh_name)) { + (nameshdr->sh_size <= _cache->c_shdr->sh_name)) { (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADSHNAME), file, _cache->c_name, - EC_XWORD(_cache->c_shdr.sh_name)); - (void) fflush(stderr); + EC_XWORD(_cache->c_shdr->sh_name)); } if ((_cache->c_name = @@ -2715,7 +2372,6 @@ regular(const char *file, Elf *elf, uint32_t flags, char *Nname, int wfd) int err = errno; (void) fprintf(stderr, MSG_INTL(MSG_ERR_MALLOC), file, strerror(err)); - (void) fflush(stderr); return; } (void) strcpy(_cache->c_name, scnndxnm); @@ -2726,7 +2382,6 @@ regular(const char *file, Elf *elf, uint32_t flags, char *Nname, int wfd) (void) fprintf(stderr, MSG_INTL(MSG_ELF_ERR_SCNDATA), /* LINTED */ (int)elf_ndxscn(scn)); - (void) fflush(stderr); } /* @@ -2739,21 +2394,21 @@ regular(const char *file, Elf *elf, uint32_t flags, char *Nname, int wfd) } if (flags & FLG_SHDR) - sections(file, cache, shnum, phnum, &ehdr, Nname); + sections(file, cache, shnum, ehdr, Nname); if (flags & FLG_INTERP) - interp(file, cache, shnum, phnum, &ehdr, elf); + interp(file, cache, shnum, phnum, elf); versymcache = versions(cache, shnum, file, flags); if (flags & FLG_SYMBOLS) - symbols(cache, shnum, phnum, &ehdr, Nname, versymcache, file); + symbols(cache, shnum, ehdr, Nname, versymcache, file, flags); if (flags & FLG_HASH) hash(cache, shnum, Nname, file, flags); if (flags & FLG_GOT) - got(cache, shnum, phnum, &ehdr, file); + got(cache, shnum, ehdr, file, flags); if (flags & FLG_GROUP) group(cache, shnum, Nname, file, flags); @@ -2762,10 +2417,10 @@ regular(const char *file, Elf *elf, uint32_t flags, char *Nname, int wfd) syminfo(cache, shnum, file); if (flags & FLG_RELOC) - reloc(cache, shnum, phnum, &ehdr, Nname, file, flags); + reloc(cache, shnum, ehdr, Nname, file, flags); if (flags & FLG_DYNAMIC) - dynamic(cache, shnum, &ehdr, file); + dynamic(cache, shnum, ehdr, file); if (flags & FLG_NOTE) note(cache, shnum, Nname, file); @@ -2777,358 +2432,10 @@ regular(const char *file, Elf *elf, uint32_t flags, char *Nname, int wfd) checksum(elf); if (flags & FLG_CAP) - cap(file, cache, shnum, phnum, &ehdr, elf); + cap(file, cache, shnum, phnum, ehdr, elf); if (flags & FLG_UNWIND) - unwind(cache, shnum, phnum, &ehdr, Nname, file, elf); + unwind(cache, shnum, phnum, ehdr, Nname, file, elf); free(cache); } - -static void -archive(const char *file, int fd, Elf *elf, uint32_t flags, char *Nname, - int wfd) -{ - Elf_Cmd cmd = ELF_C_READ; - Elf_Arhdr *arhdr; - Elf *_elf = 0; - size_t ptr; - Elf_Arsym *arsym = 0; - - /* - * Determine if the archive sysmbol table itself is required. - */ - if ((flags & FLG_SYMBOLS) && ((Nname == NULL) || - (strcmp(Nname, MSG_ORIG(MSG_ELF_ARSYM)) == 0))) { - /* - * Get the archive symbol table. - */ - if (((arsym = elf_getarsym(elf, &ptr)) == 0) && elf_errno()) { - /* - * The arsym could be 0 even though there was no error. - * Print the error message only when there was - * real error from elf_getarsym(). - */ - failure(file, MSG_ORIG(MSG_ELF_GETARSYM)); - return; - } - } - - /* - * Print the archive symbol table only when the archive symbol - * table exists and it was requested to print. - */ - if (arsym) { - size_t cnt; - char index[MAXNDXSIZE]; - size_t offset = 0, _offset = 0; - - /* - * Print out all the symbol entries. - */ - dbg_print(MSG_INTL(MSG_ARCHIVE_SYMTAB)); - dbg_print(MSG_INTL(MSG_ARCHIVE_FIELDS)); - - for (cnt = 0; cnt < ptr; cnt++, arsym++) { - /* - * For each object obtain an elf descriptor so that we - * can establish the members name. Note, we have had - * archives where the archive header has not been - * obtainable so be lenient with errors. - */ - if ((offset == 0) || ((arsym->as_off != 0) && - (arsym->as_off != _offset))) { - - if (_elf) - (void) elf_end(_elf); - - if (elf_rand(elf, arsym->as_off) != - arsym->as_off) { - failure(file, MSG_ORIG(MSG_ELF_RAND)); - arhdr = 0; - } else if ((_elf = elf_begin(fd, - ELF_C_READ, elf)) == 0) { - failure(file, MSG_ORIG(MSG_ELF_BEGIN)); - arhdr = 0; - } else if ((arhdr = elf_getarhdr(_elf)) == 0) { - failure(file, - MSG_ORIG(MSG_ELF_GETARHDR)); - arhdr = 0; - } - - _offset = arsym->as_off; - if (offset == 0) - offset = _offset; - } - - (void) snprintf(index, MAXNDXSIZE, - MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(cnt)); - if (arsym->as_off) - dbg_print(MSG_ORIG(MSG_FMT_ARSYM1), index, - /* LINTED */ - (int)arsym->as_off, arhdr ? arhdr->ar_name : - MSG_INTL(MSG_STR_UNKNOWN), (arsym->as_name ? - demangle(arsym->as_name, flags) : - MSG_INTL(MSG_STR_NULL))); - else - dbg_print(MSG_ORIG(MSG_FMT_ARSYM2), index, - /* LINTED */ - (int)arsym->as_off); - } - - if (_elf) - (void) elf_end(_elf); - - /* - * If we only need the archive symbol table return. - */ - if ((flags & FLG_SYMBOLS) && Nname && - (strcmp(Nname, MSG_ORIG(MSG_ELF_ARSYM)) == 0)) - return; - - /* - * Reset elf descriptor in preparation for processing each - * member. - */ - if (offset) - (void) elf_rand(elf, offset); - } - - /* - * Process each object within the archive. - */ - while ((_elf = elf_begin(fd, cmd, elf)) != NULL) { - char name[MAXPATHLEN]; - - if ((arhdr = elf_getarhdr(_elf)) == NULL) { - failure(file, MSG_ORIG(MSG_ELF_GETARHDR)); - return; - } - if (*arhdr->ar_name != '/') { - (void) snprintf(name, MAXPATHLEN, - MSG_ORIG(MSG_FMT_ARNAME), file, arhdr->ar_name); - dbg_print(MSG_ORIG(MSG_FMT_NLSTR), name); - - switch (elf_kind(_elf)) { - case ELF_K_AR: - archive(name, fd, _elf, flags, Nname, wfd); - break; - case ELF_K_ELF: - regular(name, _elf, flags, Nname, wfd); - break; - default: - (void) fprintf(stderr, - MSG_INTL(MSG_ERR_BADFILE), name); - (void) fflush(stderr); - break; - } - } - - cmd = elf_next(_elf); - (void) elf_end(_elf); - } -} - -int -main(int argc, char **argv, char **envp) -{ - Elf *elf; - int var, fd, wfd = 0; - char *Nname = NULL, *wname = 0; - uint32_t flags = 0, dbg_flags = 0; - - /* - * If we're on a 64-bit kernel, try to exec a full 64-bit version of - * the binary. If successful, conv_check_native() won't return. - */ - conv_check_native(argv, envp); - - /* - * Establish locale. - */ - (void) setlocale(LC_MESSAGES, MSG_ORIG(MSG_STR_EMPTY)); - (void) textdomain(MSG_ORIG(MSG_SUNW_OST_SGS)); - - (void) setvbuf(stdout, NULL, _IOLBF, 0); - (void) setvbuf(stderr, NULL, _IOLBF, 0); - - opterr = 0; - while ((var = getopt(argc, argv, MSG_ORIG(MSG_STR_OPTIONS))) != EOF) { - switch (var) { - case 'C': - flags |= FLG_DEMANGLE; - break; - case 'c': - flags |= FLG_SHDR; - break; - case 'd': - flags |= FLG_DYNAMIC; - break; - case 'e': - flags |= FLG_EHDR; - break; - case 'G': - flags |= FLG_GOT; - break; - case 'g': - flags |= FLG_GROUP; - break; - case 'H': - flags |= FLG_CAP; - break; - case 'h': - flags |= FLG_HASH; - break; - case 'i': - flags |= FLG_INTERP; - break; - case 'k': - flags |= FLG_CHECKSUM; - break; - case 'l': - flags |= FLG_LONGNAME; - break; - case 'm': - flags |= FLG_MOVE; - break; - case 'N': - Nname = optarg; - break; - case 'n': - flags |= FLG_NOTE; - break; - case 'p': - flags |= FLG_PHDR; - break; - case 'r': - flags |= FLG_RELOC; - break; - case 's': - flags |= FLG_SYMBOLS; - break; - case 'u': - flags |= FLG_UNWIND; - break; - case 'v': - flags |= FLG_VERSIONS; - break; - case 'w': - wname = optarg; - break; - case 'y': - flags |= FLG_SYMINFO; - break; - case '?': - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_BRIEF), - basename(argv[0])); - detail_usage(); - return (1); - default: - break; - } - } - - /* - * Validate any arguments. - */ - if (flags == 0) { - if (!wname && !Nname) { - flags = FLG_EVERYTHING; - } else if (!wname || !Nname) { - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_BRIEF), - basename(argv[0])); - return (1); - } - } - - if ((var = argc - optind) == 0) { - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_BRIEF), - basename(argv[0])); - return (1); - } - - /* - * If the -C option is used by itself, report an error since the option - * has no use without other symbol name generating options. - * - * If the -l option is used by itself, report an error. - */ - if ((flags == FLG_DEMANGLE) || (flags == FLG_LONGNAME) || - (flags == (FLG_DEMANGLE | FLG_LONGNAME))) { - if (flags & FLG_DEMANGLE) - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DEMANGLE)); - if (flags & FLG_LONGNAME) - (void) fprintf(stderr, MSG_INTL(MSG_USAGE_LONGNAME)); - return (1); - } - - /* - * If the -l/-C option is specified, set up the liblddbg.so. - */ - if (flags & FLG_LONGNAME) - dbg_flags = DBG_LONG; - if (flags & FLG_DEMANGLE) - dbg_flags |= DBG_DEMANGLE; - if (dbg_flags) - Dbg_set(dbg_flags); - - /* - * If the -w option has indicated an output file open it. It's - * arguable whether this option has much use when multiple files are - * being processed. - */ - if (wname) { - if ((wfd = open(wname, (O_RDWR | O_CREAT | O_TRUNC), - 0666)) < 0) { - int err = errno; - (void) fprintf(stderr, MSG_INTL(MSG_ERR_OPEN), - wname, strerror(err)); - (void) fflush(stderr); - wfd = 0; - } - } - - /* - * Open the input file and initialize the elf interface. - */ - for (; optind < argc; optind++) { - const char *file = argv[optind]; - - if ((fd = open(argv[optind], O_RDONLY)) == -1) { - int err = errno; - (void) fprintf(stderr, MSG_INTL(MSG_ERR_OPEN), - file, strerror(err)); - (void) fflush(stderr); - continue; - } - (void) elf_version(EV_CURRENT); - if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) { - failure(file, MSG_ORIG(MSG_ELF_BEGIN)); - (void) close(fd); - continue; - } - - if (var > 1) - dbg_print(MSG_ORIG(MSG_FMT_NLSTRNL), file); - - switch (elf_kind(elf)) { - case ELF_K_AR: - archive(file, fd, elf, flags, Nname, wfd); - break; - case ELF_K_ELF: - regular(file, elf, flags, Nname, wfd); - break; - default: - (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADFILE), file); - (void) fflush(stderr); - break; - } - - (void) close(fd); - (void) elf_end(elf); - } - - if (wfd) - (void) close(wfd); - return (0); -} diff --git a/usr/src/cmd/sgs/elfdump/common/elfdump.msg b/usr/src/cmd/sgs/elfdump/common/elfdump.msg index 4e1be11685..a2a75db5b0 100644 --- a/usr/src/cmd/sgs/elfdump/common/elfdump.msg +++ b/usr/src/cmd/sgs/elfdump/common/elfdump.msg @@ -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. @@ -25,6 +24,7 @@ # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" +# @ _START_ @@ -65,11 +65,6 @@ @ MSG_USAGE_DETAIL20 "\t[-y]\t\tdump the contents of the .SUNW_syminfo \ section\n" -@ MSG_USAGE_DEMANGLE "usage: -C option is only meaningful \ - with other options that display symbol names\n" -@ MSG_USAGE_LONGNAME "usage: -l option is only meaningful \ - with other options that display section names\n" - # Errors @ MSG_ERR_BADFILE "%s: invalid file type\n" @@ -77,13 +72,10 @@ @ MSG_ERR_SHSTRNULL "%s: zero size section header string table (shstrtab)\n" @ MSG_ERR_FAILURE "%s: %s failed: %s\n" @ MSG_ERR_BADSHNAME "%s: %s: invalid sh_name: %lld\n" -@ MSG_ERR_BADSHLINK "%s: %s: invalid sh_link: %lld\n" -@ MSG_ERR_BADSHINFO "%s: %s: invalid sh_info: %lld\n" -@ MSG_ERR_BADSHTYPE "%s: %s: invalid sh_type: %lld\n" +@ MSG_ERR_BADSHLINK "%s: %s: invalid sh_link: %d\n" +@ MSG_ERR_BADSHINFO "%s: %s: invalid sh_info: %d\n" +@ MSG_ERR_BADSHTYPE "%s: %s: invalid sh_type: %d\n" @ MSG_ERR_BADALIGN "%s: %s: bad sh_offset alignment\n" -@ MSG_ERR_SIBADCOUNT "%s: %s: bad syminfo entry: %d\n" -@ MSG_ERR_BADCAP "%s: %s: bad capabilities entry: %s\n" -@ MSG_ERR_BADSYM "%s: %s: bad symbol entry: %s\n" @ MSG_ERR_BADSYM2 "%s: %s: bad symbol entry: %s: must be SHN_COMMON or \ defined in SHT_NOBITS section\n" @ MSG_ERR_BADSYM3 "%s: %s: bad symbol entry: %s: must be defined in \ @@ -93,12 +85,10 @@ @ MSG_ERR_BADSYM5 "%s: %s: bad symbol entry: %s: invalid shndx: %d\n" @ MSG_ERR_BADSYM6 "%s: %s: bad symbol entry: %s: section[%d] size: %lld: \ is smaller than symbol size: %lld\n" -@ MSG_ERR_BADMOVE "%s: %s: bad move table entry: %s\n" -@ MSG_ERR_BADREL "%s: %s: bad relocation table entry: %s\n" -@ MSG_ERR_RELBADSYMNDX "%s: bad symbol reference from relocation entry: %s\n" -@ MSG_ERR_MVBADSYMNDX "%s: bad symbol reference from move entry: %s\n" -@ MSG_ERR_HSBADSYMNDX "%s: bad symbol reference from hash entry: %s\n" -@ MSG_ERR_GRBADSYMNDX "%s: bad symbol reference from group entry: %s\n" + +@ MSG_ERR_RELBADSYMNDX "%s: bad symbol reference %d: from relocation \ + entry: %d\n" +@ MSG_ERR_HSBADSYMNDX "%s: bad symbol reference %d: from hash entry: %d\n" @ MSG_ERR_BADSYMXINDEX1 "%s: %s: index[%d]: invalid SHN_XINDEX reference: \ SHT_SYMTAB_SHNDX section truncated: no entry for this \ symbol\n" @@ -106,12 +96,12 @@ bad SHT_SYMTAB_SHNDX entry: invalid shndx: 0x%x\n" @ MSG_ERR_BADSYMXINDEX3 "%s: %s: index[%d]: invalid SHN_XINDEX reference: \ SHT_SYMTAB_SHNDX section not found\n" -@ MSG_ERR_BADSTOFF "%s: %s: index[%d]: bad %s offset: 0x%llx: max 0x%llx\n" -@ MSG_ERR_BADDYN "%s: %s: bad index into .dynamic: %d\n" -@ MSG_ERR_BADSZ "%s: %s: zero size or entry size information\n" + +@ MSG_ERR_BADSTOFF "%s: %s: index[%d]: bad %s offset: 0x%x: max 0x%x\n" +@ MSG_ERR_BADSZ "%s: %s: zero size or zero entry size information\n" @ MSG_ERR_BADMINFO "%s: %s: invalid m_info: 0x%llx\n" @ MSG_ERR_BADHASH "%s: %s: bad hash entry: symbol %s: exists in bucket \ - %d, should be bucket %d\n" + %d, should be bucket %ld\n" @ MSG_WARN_INVINTERP1 "%s: PT_INTERP header has no associated section\n" @ MSG_WARN_INVINTERP2 "%s: interp section: %s: and PT_INTERP program \ @@ -138,17 +128,13 @@ @ MSG_ELF_SCN_NOTE "Note Section: %s" @ MSG_ELF_SCN_HASH "Hash Section: %s" @ MSG_ELF_SCN_SYMINFO "Syminfo Section: %s" -@ MSG_ELF_SCN_GOT "Global Offset Table Section: %s (%u entries)" - -@ MSG_ELF_RELOC_RELA "\ttype\t\t offset addend section \ - with respect to" -@ MSG_ELF_RELOC_REL "\ttype\t\t offset section \ - with respect to" -@ MSG_ELF_L_RELOC_RELA "\ttype\t\t offset addend section/symbol" -@ MSG_ELF_L_RELOC_REL "\ttype\t\t offset section/symbol" +@ MSG_ELF_SCN_GOT "Global Offset Table Section: %s" +@ MSG_ELF_SCN_GRP "Group Section: %s" +@ MSG_ELF_SCN_MOVE "Move Section: %s" + @ MSG_ELF_HASH_BKTS1 "%10.10s buckets contain %8d symbols" @ MSG_ELF_HASH_BKTS2 "%10.10s buckets %8d symbols (globals)" -@ MSG_ELF_HASH_INFO " bucket symndx name" +@ MSG_ELF_HASH_INFO " bucket symndx name" @ MSG_HASH_OVERFLW "%s: warning: section %s: too many symbols to count, \ bucket=%d count=%d" @ MSG_ELF_ERR_SHDR "\tunable to obtain section header: shstrtab[%lld]\n" @@ -163,11 +149,8 @@ @ MSG_GOT_UNEXPECTED "%s: warning: section %s: section unexpected within \ relocatable object\n" - # Miscellaneous clutter -@ MSG_STR_INDEX "index" -@ MSG_STR_NAME "name" @ MSG_STR_NULL "(null)" @ MSG_STR_DEPRECATED "(deprecated value)" @ MSG_STR_UNKNOWN "<unknown>" @@ -181,47 +164,41 @@ @ MSG_ERR_OPEN "%s: open: %s\n" # -# For Elf{32,64}_Move section +# SHT_MOVE messages # -@ MSG_MV_TITLE "Move Section: %s\n\ - \toffset\tndx\tsize\trepeat\tstride\tvalue\twith \ - respect to" -@ MSG_MV_ENTRY "\t0x%llx\t0x%llx\t%d\t%d\t%d\t0x%llx\t%s" - +@ MSG_MOVE_TITLE " symndx offset size repeat stride \ + value with respect to" +@ MSG_MOVE_ENTRY "%10.10s %6lld %6d %6d %6d %#18.18llx %s" # # SHT_GROUP messages # -@ MSG_GRP_NOTSYMTAB "%s: %s: sh_link[%lld] does not point to .symtab\n" -@ MSG_GRP_BADSYMNDX "%s: %s: sh_info[%lld] has invalid symbol index\n" -@ MSG_GRP_BADENTSZ "%s: %s: has invalid sh_entsize: %lld\n" -@ MSG_GRP_LINE1 "\nGroup Section: %s" -@ MSG_GRP_LINE2 "\t[ndx] Flags/Section Signature Symbol" -@ MSG_GRP_LINE3 "\t [0] %-24s %s" +@ MSG_GRP_TITLE " index flags / section signature symbol" +@ MSG_GRP_SIGNATURE " [0] %-24s %s" @ MSG_GRP_INVALSCN "<invalid section>" # # SHT_NOTE messages # -@ MSG_NOTE_BADDATASIZE "%s: %s: note header exceeds section size. \ +@ MSG_NOTE_BADDATASZ "%s: %s: note header exceeds section size. \ offset: 0x%x\n" -@ MSG_NOTE_BADNMSIZE "%s: %s: note name value exceeds section size. \ +@ MSG_NOTE_BADNMSZ "%s: %s: note name value exceeds section size. \ offset: 0x%x namesize: 0x%x\n" -@ MSG_NOTE_BADDESIZE "%s: %s: note data size exceeds section size. \ +@ MSG_NOTE_BADDESZ "%s: %s: note data size exceeds section size. \ offset: 0x%x datasize: 0x%x\n" - @ _END_ # The following strings represent reserved words, files, pathnames and symbols. # Reference to this strings is via the MSG_ORIG() macro, and thus no message # translation is required. +@ MSG_STR_OSQBRKT "[" +@ MSG_STR_CSQBRKT "]" -@ MSG_GRP_COMDAT " COMDAT" -@ MSG_GRP_FMT1 " 0x%x" -@ MSG_GRP_FMT2 "%13.13s %s[%d]\n" -@ MSG_GRP_CLOSBRKT " ]" +@ MSG_GRP_COMDAT " COMDAT " +@ MSG_GRP_ENTRY "%10.10s %s [%lld]\n" +@ MSG_GRP_UNKNOWN " 0x%x " @ MSG_ELF_GOT ".got" @@ -244,11 +221,10 @@ @ MSG_STR_OPTIONS "CcdeGgHhiklmN:nprsuvw:y" @ MSG_STR_EMPTY "" -@ MSG_STR_NL "\n" @ MSG_FMT_INDENT " %s" @ MSG_FMT_INDEX " [%lld]" -@ MSG_FMT_INDEX2 "[%lld]" +@ MSG_FMT_INDEX2 "[%d]" @ MSG_FMT_INTEGER " %d" @ MSG_FMT_HASH_INFO "%10.10s %-10s %s" @ MSG_FMT_ARSYM1 "%10.10s 0x%8.8x (%s):%s" @@ -260,40 +236,42 @@ @ MSG_SUNW_OST_SGS "SUNW_OST_SGS" # Unwind info + @ MSG_SCN_FRM ".eh_frame" @ MSG_SCN_FRMHDR ".eh_frame_hdr" + @ MSG_UNW_FRMHDR "Frame Header:" @ MSG_UNW_FRMVERS " Version: %d" -@ MSG_UNW_FRPTRENC " FramePtrEnc: %-16s FramePtr: 0x%llx" -@ MSG_UNW_FDCNENC " FdeCntEnc: %-16s FdeCnt: %lld" -@ MSG_UNW_TABENC " TableEnc: %-16s" +@ MSG_UNW_FRPTRENC " FramePtrEnc: %-20s FramePtr: 0x%llx" +@ MSG_UNW_FDCNENC " FdeCntEnc: %-20s FdeCnt: %lld" +@ MSG_UNW_TABENC " TableEnc: %-20s" @ MSG_UNW_BINSRTAB1 " Binary Search Table:" -@ MSG_UNW_BINSRTAB2 " InitialLoc FdeLoc" -@ MSG_UNW_BINSRTABENT " 0x%012llx 0x%012llx" +@ MSG_UNW_BINSRTAB2 " InitialLoc FdeLoc" +@ MSG_UNW_BINSRTABENT " 0x%016llx 0x%016llx" @ MSG_UNW_CIE "CIE: [0x%08llx]" @ MSG_UNW_CIELNGTH " length: 0x%02x cieid: %d" @ MSG_UNW_CIEVERS " version: %d augstring: `%s'" @ MSG_UNW_CIECALGN " codealign: 0x%llx dataalign: %lld \ retaddr: %d" -@ MSG_UNW_CIEAUXVAL " Auxillary vals:" +@ MSG_UNW_CIEAUXVAL " Auxiliary vals:" @ MSG_UNW_CIEAUXSIZE " size: %d" @ MSG_UNW_CIEAUXPERS " pers: 0x%02x %s 0x%08llx" @ MSG_UNW_CIEAUXCENC " cenc: 0x%02x %s" @ MSG_UNW_CIEAUXLSDA " lsda: 0x%02x %s" @ MSG_UNW_CIEAUXUNEC " Unexpected aug val: %c" @ MSG_UNW_CIECFI " CallFrameInstructions:" -@ MSG_UNW_CIECFI1 "\n " -@ MSG_UNW_CIECFI2 "0x%02x " +@ MSG_UNW_CIEPRE " " @ MSG_UNW_FDE " FDE: [0x%08llx]" @ MSG_UNW_FDELNGTH " length: 0x%02x cieptr: 0x%02x" @ MSG_UNW_FDEINITLOC " initloc: 0x%08llx addrrange: 0x%04llx" -@ MSG_UNW_FDEAUXVAL " Auxillary vals:" +@ MSG_UNW_FDEAUXVAL " Auxiliary vals:" @ MSG_UNW_FDEAUXSIZE " size: 0x%llx" @ MSG_UNW_FDEAUXLSDA " lsda: 0x%llx" @ MSG_UNW_FDECFI " CallFrameInstructions:" -@ MSG_UNW_FDECFI1 "\n " -@ MSG_UNW_FDECFI2 "0x%02x " +@ MSG_UNW_FDEPRE " " + +@ MSG_UNW_TBLENTRY "0x%02x " # Note messages diff --git a/usr/src/cmd/sgs/elfdump/common/lintsup.c b/usr/src/cmd/sgs/elfdump/common/lintsup.c index 4648da81dc..24109ff04e 100644 --- a/usr/src/cmd/sgs/elfdump/common/lintsup.c +++ b/usr/src/cmd/sgs/elfdump/common/lintsup.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,25 +18,41 @@ * * CDDL HEADER END */ -/* LINTLIBRARY */ -/* PROTOLIB1 */ /* - * Copyright (c) 1998 by Sun Microsystems, Inc. - * All rights reserved. - */ + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ +/* LINTLIBRARY */ +/* PROTOLIB1 */ #pragma ident "%Z%%M% %I% %E% SMI" /* - * Supplimental Pseudo-code to get lint to consider - * these symbols used. + * Supplemental Pseudo-code to get lint to consider these symbols used. */ - -#include "msg.h" +#include <sys/types.h> +#include <libelf.h> +#include <conv.h> +#include <msg.h> +#include <_elfdump.h> void foo() { (void) _elfdump_msg((Msg)&__elfdump_msg[0]); } + +#if defined(_ELF64) +void +regular32(const char *file, Elf *elf, uint32_t flags, char *Nname, int wfd) +{ + regular64(file, elf, flags, Nname, wfd); +} +#else +void +regular64(const char *file, Elf *elf, uint32_t flags, char *Nname, int wfd) +{ + regular32(file, elf, flags, Nname, wfd); +} +#endif diff --git a/usr/src/cmd/sgs/elfdump/common/main.c b/usr/src/cmd/sgs/elfdump/common/main.c new file mode 100644 index 0000000000..f160fbf952 --- /dev/null +++ b/usr/src/cmd/sgs/elfdump/common/main.c @@ -0,0 +1,441 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ +#pragma ident "%Z%%M% %I% %E% SMI" + +/* + * Dump an elf file. + */ +#include <sys/param.h> +#include <fcntl.h> +#include <stdio.h> +#include <libelf.h> +#include <link.h> +#include <stdarg.h> +#include <unistd.h> +#include <libgen.h> +#include <libintl.h> +#include <locale.h> +#include <errno.h> +#include <strings.h> +#include <debug.h> +#include <conv.h> +#include <msg.h> +#include <_elfdump.h> + +const Cache cache_init = {NULL, NULL, NULL}; + +const char * +_elfdump_msg(Msg mid) +{ + return (gettext(MSG_ORIG(mid))); +} + +/* + * Determine whether a symbol name should be demangled. + */ +const char * +demangle(const char *name, uint_t flags) +{ + if (flags & FLG_DEMANGLE) + return (Elf_demangle_name(name)); + else + return ((char *)name); +} + +/* + * Define our own standard error routine. + */ +void +failure(const char *file, const char *func) +{ + (void) fprintf(stderr, MSG_INTL(MSG_ERR_FAILURE), + file, func, elf_errmsg(elf_errno())); +} + +/* + * The full usage message + */ +static void +detail_usage() +{ + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL1)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL2)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL3)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL4)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL5)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL6)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL7)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL8)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL9)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL9_1)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL10)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL11)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL12)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL13)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL14)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL15)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL16)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL17)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL18)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL19)); + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_DETAIL20)); +} + +static void +decide(const char *file, Elf *elf, uint_t flags, char *Nname, int wfd) +{ + if (gelf_getclass(elf) == ELFCLASS64) + regular64(file, elf, flags, Nname, wfd); + else + regular32(file, elf, flags, Nname, wfd); +} + +static void +archive(const char *file, int fd, Elf *elf, uint_t flags, char *Nname, + int wfd) +{ + Elf_Cmd cmd = ELF_C_READ; + Elf_Arhdr *arhdr; + Elf *_elf = 0; + size_t ptr; + Elf_Arsym *arsym = 0; + + /* + * Determine if the archive sysmbol table itself is required. + */ + if ((flags & FLG_SYMBOLS) && ((Nname == NULL) || + (strcmp(Nname, MSG_ORIG(MSG_ELF_ARSYM)) == 0))) { + /* + * Get the archive symbol table. + */ + if (((arsym = elf_getarsym(elf, &ptr)) == 0) && elf_errno()) { + /* + * The arsym could be 0 even though there was no error. + * Print the error message only when there was + * real error from elf_getarsym(). + */ + failure(file, MSG_ORIG(MSG_ELF_GETARSYM)); + return; + } + } + + /* + * Print the archive symbol table only when the archive symbol + * table exists and it was requested to print. + */ + if (arsym) { + size_t cnt; + char index[MAXNDXSIZE]; + size_t offset = 0, _offset = 0; + + /* + * Print out all the symbol entries. + */ + dbg_print(0, MSG_INTL(MSG_ARCHIVE_SYMTAB)); + dbg_print(0, MSG_INTL(MSG_ARCHIVE_FIELDS)); + + for (cnt = 0; cnt < ptr; cnt++, arsym++) { + /* + * For each object obtain an elf descriptor so that we + * can establish the members name. Note, we have had + * archives where the archive header has not been + * obtainable so be lenient with errors. + */ + if ((offset == 0) || ((arsym->as_off != 0) && + (arsym->as_off != _offset))) { + + if (_elf) + (void) elf_end(_elf); + + if (elf_rand(elf, arsym->as_off) != + arsym->as_off) { + failure(file, MSG_ORIG(MSG_ELF_RAND)); + arhdr = 0; + } else if ((_elf = elf_begin(fd, + ELF_C_READ, elf)) == 0) { + failure(file, MSG_ORIG(MSG_ELF_BEGIN)); + arhdr = 0; + } else if ((arhdr = elf_getarhdr(_elf)) == 0) { + failure(file, + MSG_ORIG(MSG_ELF_GETARHDR)); + arhdr = 0; + } + + _offset = arsym->as_off; + if (offset == 0) + offset = _offset; + } + + (void) snprintf(index, MAXNDXSIZE, + MSG_ORIG(MSG_FMT_INDEX), EC_XWORD(cnt)); + if (arsym->as_off) + dbg_print(0, MSG_ORIG(MSG_FMT_ARSYM1), index, + /* LINTED */ + (int)arsym->as_off, arhdr ? arhdr->ar_name : + MSG_INTL(MSG_STR_UNKNOWN), (arsym->as_name ? + demangle(arsym->as_name, flags) : + MSG_INTL(MSG_STR_NULL))); + else + dbg_print(0, MSG_ORIG(MSG_FMT_ARSYM2), index, + /* LINTED */ + (int)arsym->as_off); + } + + if (_elf) + (void) elf_end(_elf); + + /* + * If we only need the archive symbol table return. + */ + if ((flags & FLG_SYMBOLS) && Nname && + (strcmp(Nname, MSG_ORIG(MSG_ELF_ARSYM)) == 0)) + return; + + /* + * Reset elf descriptor in preparation for processing each + * member. + */ + if (offset) + (void) elf_rand(elf, offset); + } + + /* + * Process each object within the archive. + */ + while ((_elf = elf_begin(fd, cmd, elf)) != NULL) { + char name[MAXPATHLEN]; + + if ((arhdr = elf_getarhdr(_elf)) == NULL) { + failure(file, MSG_ORIG(MSG_ELF_GETARHDR)); + return; + } + if (*arhdr->ar_name != '/') { + (void) snprintf(name, MAXPATHLEN, + MSG_ORIG(MSG_FMT_ARNAME), file, arhdr->ar_name); + dbg_print(0, MSG_ORIG(MSG_FMT_NLSTR), name); + + switch (elf_kind(_elf)) { + case ELF_K_AR: + archive(name, fd, _elf, flags, Nname, wfd); + break; + case ELF_K_ELF: + decide(name, _elf, flags, Nname, wfd); + break; + default: + (void) fprintf(stderr, + MSG_INTL(MSG_ERR_BADFILE), name); + break; + } + } + + cmd = elf_next(_elf); + (void) elf_end(_elf); + } +} + +int +main(int argc, char **argv, char **envp) +{ + Elf *elf; + int var, fd, wfd = 0; + char *Nname = NULL, *wname = 0; + uint_t flags = 0; + + /* + * If we're on a 64-bit kernel, try to exec a full 64-bit version of + * the binary. If successful, conv_check_native() won't return. + */ + conv_check_native(argv, envp); + + /* + * Establish locale. + */ + (void) setlocale(LC_MESSAGES, MSG_ORIG(MSG_STR_EMPTY)); + (void) textdomain(MSG_ORIG(MSG_SUNW_OST_SGS)); + + (void) setvbuf(stdout, NULL, _IOLBF, 0); + (void) setvbuf(stderr, NULL, _IOLBF, 0); + + opterr = 0; + while ((var = getopt(argc, argv, MSG_ORIG(MSG_STR_OPTIONS))) != EOF) { + switch (var) { + case 'C': + flags |= FLG_DEMANGLE; + break; + case 'c': + flags |= FLG_SHDR; + break; + case 'd': + flags |= FLG_DYNAMIC; + break; + case 'e': + flags |= FLG_EHDR; + break; + case 'G': + flags |= FLG_GOT; + break; + case 'g': + flags |= FLG_GROUP; + break; + case 'H': + flags |= FLG_CAP; + break; + case 'h': + flags |= FLG_HASH; + break; + case 'i': + flags |= FLG_INTERP; + break; + case 'k': + flags |= FLG_CHECKSUM; + break; + case 'l': + flags |= FLG_LONGNAME; + break; + case 'm': + flags |= FLG_MOVE; + break; + case 'N': + Nname = optarg; + break; + case 'n': + flags |= FLG_NOTE; + break; + case 'p': + flags |= FLG_PHDR; + break; + case 'r': + flags |= FLG_RELOC; + break; + case 's': + flags |= FLG_SYMBOLS; + break; + case 'u': + flags |= FLG_UNWIND; + break; + case 'v': + flags |= FLG_VERSIONS; + break; + case 'w': + wname = optarg; + break; + case 'y': + flags |= FLG_SYMINFO; + break; + case '?': + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_BRIEF), + basename(argv[0])); + detail_usage(); + return (1); + default: + break; + } + } + + /* + * Validate any arguments. + */ + if ((flags & ~(FLG_DEMANGLE | FLG_LONGNAME)) == 0) { + if (!wname && !Nname) { + flags |= FLG_EVERYTHING; + } else if (!wname || !Nname) { + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_BRIEF), + basename(argv[0])); + return (1); + } + } + + if ((var = argc - optind) == 0) { + (void) fprintf(stderr, MSG_INTL(MSG_USAGE_BRIEF), + basename(argv[0])); + return (1); + } + + /* + * If the -l/-C option is specified, set up the liblddbg.so. + */ + if (flags & FLG_LONGNAME) + dbg_desc->d_extra |= DBG_E_LONG; + if (flags & FLG_DEMANGLE) + dbg_desc->d_extra |= DBG_E_DEMANGLE; + + /* + * If the -w option has indicated an output file open it. It's + * arguable whether this option has much use when multiple files are + * being processed. + */ + if (wname) { + if ((wfd = open(wname, (O_RDWR | O_CREAT | O_TRUNC), + 0666)) < 0) { + int err = errno; + (void) fprintf(stderr, MSG_INTL(MSG_ERR_OPEN), + wname, strerror(err)); + wfd = 0; + } + } + + /* + * Open the input file and initialize the elf interface. + */ + for (; optind < argc; optind++) { + const char *file = argv[optind]; + + if ((fd = open(argv[optind], O_RDONLY)) == -1) { + int err = errno; + (void) fprintf(stderr, MSG_INTL(MSG_ERR_OPEN), + file, strerror(err)); + continue; + } + (void) elf_version(EV_CURRENT); + if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) { + failure(file, MSG_ORIG(MSG_ELF_BEGIN)); + (void) close(fd); + continue; + } + + if (var > 1) + dbg_print(0, MSG_ORIG(MSG_FMT_NLSTRNL), file); + + switch (elf_kind(elf)) { + case ELF_K_AR: + archive(file, fd, elf, flags, Nname, wfd); + break; + case ELF_K_ELF: + decide(file, elf, flags, Nname, wfd); + break; + default: + (void) fprintf(stderr, MSG_INTL(MSG_ERR_BADFILE), file); + break; + } + + (void) close(fd); + (void) elf_end(elf); + } + + if (wfd) + (void) close(wfd); + return (0); +} diff --git a/usr/src/cmd/sgs/elfdump/common/mapfile-vers b/usr/src/cmd/sgs/elfdump/common/mapfile-vers index 1b935a2dc3..fdd8464b9b 100644 --- a/usr/src/cmd/sgs/elfdump/common/mapfile-vers +++ b/usr/src/cmd/sgs/elfdump/common/mapfile-vers @@ -1,15 +1,9 @@ # -#ident "%Z%%M% %I% %E% SMI" -# -# 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. +# 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. @@ -25,12 +19,18 @@ # CDDL HEADER END # +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +#ident "%Z%%M% %I% %E% SMI" +# + # Specify what global symbols we export (none). Note that we're not # interested in declaring a version, simply scoping the file is sufficient. { global: - dbg_print; main; # debuggers seem to like this. local: *; diff --git a/usr/src/cmd/sgs/elfdump/i386/Makefile b/usr/src/cmd/sgs/elfdump/i386/Makefile index e7beceaa98..607c8a31ce 100644 --- a/usr/src/cmd/sgs/elfdump/i386/Makefile +++ b/usr/src/cmd/sgs/elfdump/i386/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,10 +18,12 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -# Copyright (c) 1994 by Sun Microsystems, Inc. +# ident "%Z%%M% %I% %E% SMI" # include ../Makefile.com diff --git a/usr/src/cmd/sgs/elfdump/sparc/Makefile b/usr/src/cmd/sgs/elfdump/sparc/Makefile index e7beceaa98..607c8a31ce 100644 --- a/usr/src/cmd/sgs/elfdump/sparc/Makefile +++ b/usr/src/cmd/sgs/elfdump/sparc/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,10 +18,12 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -# Copyright (c) 1994 by Sun Microsystems, Inc. +# ident "%Z%%M% %I% %E% SMI" # include ../Makefile.com diff --git a/usr/src/cmd/sgs/elfdump/sparcv9/Makefile b/usr/src/cmd/sgs/elfdump/sparcv9/Makefile index cb948c5392..8f39ca01c6 100644 --- a/usr/src/cmd/sgs/elfdump/sparcv9/Makefile +++ b/usr/src/cmd/sgs/elfdump/sparcv9/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 1998-2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -31,9 +31,9 @@ include ../Makefile.com .KEEP_STATE: LLDFLAGS = $(LLDFLAGS64) -ELFLIBDIR= $(ELFLIBDIR64) -LDDBGLIBDIR= $(LDDBGLIBDIR64) -CONVLIBDIR= $(CONVLIBDIR64) +ELFLIBDIR = $(ELFLIBDIR64) +LDDBGLIBDIR = $(LDDBGLIBDIR64) +CONVLIBDIR = $(CONVLIBDIR64) LINTFLAGS64 += $(VAR_LINTFLAGS64) ROOTCCSBINPROG= $(ROOTCCSBINPROG64) @@ -43,4 +43,3 @@ include ../../Makefile.sub.64 install \ package: $(ROOTCCSBINPROG64) - diff --git a/usr/src/cmd/sgs/include/conv.h b/usr/src/cmd/sgs/include/conv.h index adbd1bb970..c3ff2a6daf 100644 --- a/usr/src/cmd/sgs/include/conv.h +++ b/usr/src/cmd/sgs/include/conv.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #ifndef _CONV_H @@ -65,62 +64,170 @@ extern "C" { #define CONF_FEATMSK 0xffff00 /* - * Functions + * Various values that can't be matched to a symbolic definition are converted + * to a numeric string. Each function that may require this fallback maintains + * its own static string buffer, as many conversion routines may be called for + * one final diagnostic. See conv_invalid_val(). + * + * The string size reflects the largest possible decimal number plus a trailing + * null. Typically however, values are hex with a leading "0x". + */ +#if defined(_ELF64) +#define CONV_INV_STRSIZE 22 +#else +#define CONV_INV_STRSIZE 12 +#endif + +/* + * Flags for conv_invalid_val(). + */ +#define CONV_INV_DECIMAL 0x1 /* print as decimal (default is hex) */ +#define CONV_INV_SPACE 0x2 /* append a space */ + +/* + * The expansion of bit-field data items is driven from a value descriptor and + * the conv_expn_field() routine. + */ +typedef struct { + Xword v_val; /* expansion value */ + const char *v_msg; /* associated message string */ +} Val_desc; + +/* + * Define all generic interfaces. */ extern void conv_check_native(char **, char **); -extern const char *conv_binding_str(uint_t); -extern const char *conv_bindent_str(uint_t); -extern const char *conv_d_type_str(Elf_Type); -extern const char *conv_deftag_str(Symref); -extern const char *conv_dlflag_str(int, int); -extern const char *conv_dlmode_str(int, int); -extern const char *conv_dyntag_str(uint64_t, ushort_t); -extern const char *conv_dynflag_str(uint_t); -extern const char *conv_dynflag_1_str(uint_t); -extern const char *conv_dynposflag_1_str(uint_t); -extern const char *conv_dynfeature_1_str(uint_t); -extern const char *conv_captag_str(uint64_t); -extern const char *conv_capval_str(uint64_t, uint64_t, ushort_t); -extern const char *conv_config_str(int); +extern const char *conv_config_feat(int); extern const char *conv_config_obj(ushort_t); -extern const char *conv_dwarf_ehe_str(uint_t); -extern const char *conv_eclass_str(uchar_t); -extern const char *conv_edata_str(uchar_t); -extern const char *conv_emach_str(ushort_t); -extern const char *conv_ever_str(uint_t); -extern const char *conv_etype_str(ushort_t); -extern const char *conv_eflags_str(ushort_t, uint_t); -extern const char *conv_hwcap_1_str(uint64_t, ushort_t); -extern const char *conv_hwcap_1_386_str(uint64_t); -extern const char *conv_hwcap_1_SPARC_str(uint64_t); -extern const char *conv_sfcap_1_str(uint64_t, ushort_t); -extern const char *conv_grphdrflags_str(uint_t); -extern const char *conv_info_bind_str(uchar_t); -extern const char *conv_info_type_str(ushort_t, uchar_t); -extern const char *conv_invalid_str(char *, size_t, uint64_t, int); +extern const char *conv_config_upm(const char *, const char *, + const char *, size_t); +extern const char *conv_def_tag(Symref); +extern const char *conv_demangle_name(const char *); +extern const char *conv_dl_flag(int, int); +extern const char *conv_dl_mode(int, int); +extern const char *conv_dwarf_ehe(uint_t); +extern const char *conv_elfdata_type(Elf_Type); +extern const char *conv_grphdl_flags(uint_t); extern Isa_desc *conv_isalist(void); extern const char *conv_lddstub(int); -extern const char *conv_phdrflg_str(uint_t); -extern const char *conv_phdrtyp_str(ushort_t, uint_t); -extern const char *conv_reloc_type_str(ushort_t, uint_t); -extern const char *conv_reloc_SPARC_type_str(uint_t); -extern const char *conv_reloc_386_type_str(uint_t); -extern const char *conv_reloc_amd64_type_str(uint_t); -extern const char *conv_reject_str(Rej_desc *); -extern const char *conv_sym_dem(const char *); -extern const char *conv_sym_value_str(ushort_t, uint_t, uint64_t); -extern const char *conv_sym_SPARC_value_str(uint64_t); -extern const char *conv_sym_stother(uchar_t); -extern const char *conv_secflg_str(ushort_t, uint_t); -extern const char *conv_secinfo_str(uint_t, uint_t); -extern const char *conv_sectyp_str(ushort_t, uint_t); -extern const char *conv_segaflg_str(uint_t); -extern const char *conv_shndx_str(ushort_t); +extern const char *conv_seg_flags(Half); extern int conv_sys_eclass(); -extern const char *conv_upm_string(const char *, const char *, - const char *, size_t); extern Uts_desc *conv_uts(void); -extern const char *conv_verflg_str(ushort_t); +extern const char *conv_ver_flags(Half); + +/* + * Define all class specific routines. + */ +#if defined(_ELF64) +#define conv_bnd_obj conv64_bnd_obj +#define conv_bnd_type conv64_bnd_type +#define conv_cap_tag conv64_cap_tag +#define conv_cap_val conv64_cap_val +#define conv_cap_val_hw1 conv64_cap_val_hw1 +#define conv_cap_val_sf1 conv64_cap_val_sf1 +#define conv_dyn_feature1 conv64_dyn_feature1 +#define conv_dyn_flag1 conv64_dyn_flag1 +#define conv_dyn_flag conv64_dyn_flag +#define conv_dyn_posflag1 conv64_dyn_posflag1 +#define conv_dyn_tag conv64_dyn_tag +#define conv_ehdr_class conv64_ehdr_class +#define conv_ehdr_data conv64_ehdr_data +#define conv_ehdr_flags conv64_ehdr_flags +#define conv_ehdr_mach conv64_ehdr_mach +#define conv_ehdr_type conv64_ehdr_type +#define conv_ehdr_vers conv64_ehdr_vers +#define conv_expn_field conv64_expn_field +#define conv_invalid_val conv64_invalid_val +#define conv_phdr_flags conv64_phdr_flags +#define conv_phdr_type conv64_phdr_type +#define conv_reject_desc conv64_reject_desc +#define conv_reloc_type conv64_reloc_type +#define conv_reloc_386_type conv64_reloc_386_type +#define conv_reloc_amd64_type conv64_reloc_amd64_type +#define conv_reloc_SPARC_type conv64_reloc_SPARC_type +#define conv_sec_flags conv64_sec_flags +#define conv_sec_info conv64_sec_info +#define conv_sec_type conv64_sec_type +#define conv_sym_info_bind conv64_sym_info_bind +#define conv_sym_info_type conv64_sym_info_type +#define conv_sym_shndx conv64_sym_shndx +#define conv_sym_other conv64_sym_other +#define conv_sym_value conv64_sym_value +#define conv_sym_SPARC_value conv64_sym_SPARC_value +#else +#define conv_bnd_obj conv32_bnd_obj +#define conv_bnd_type conv32_bnd_type +#define conv_cap_tag conv32_cap_tag +#define conv_cap_val conv32_cap_val +#define conv_cap_val_hw1 conv32_cap_val_hw1 +#define conv_cap_val_sf1 conv32_cap_val_sf1 +#define conv_dyn_feature1 conv32_dyn_feature1 +#define conv_dyn_flag1 conv32_dyn_flag1 +#define conv_dyn_flag conv32_dyn_flag +#define conv_dyn_posflag1 conv32_dyn_posflag1 +#define conv_dyn_tag conv32_dyn_tag +#define conv_ehdr_class conv32_ehdr_class +#define conv_ehdr_data conv32_ehdr_data +#define conv_ehdr_flags conv32_ehdr_flags +#define conv_ehdr_mach conv32_ehdr_mach +#define conv_ehdr_type conv32_ehdr_type +#define conv_ehdr_vers conv32_ehdr_vers +#define conv_expn_field conv32_expn_field +#define conv_invalid_val conv32_invalid_val +#define conv_phdr_flags conv32_phdr_flags +#define conv_phdr_type conv32_phdr_type +#define conv_reject_desc conv32_reject_desc +#define conv_reloc_type conv32_reloc_type +#define conv_reloc_386_type conv32_reloc_386_type +#define conv_reloc_amd64_type conv32_reloc_amd64_type +#define conv_reloc_SPARC_type conv32_reloc_SPARC_type +#define conv_sec_flags conv32_sec_flags +#define conv_sec_info conv32_sec_info +#define conv_sec_type conv32_sec_type +#define conv_sym_info_bind conv32_sym_info_bind +#define conv_sym_info_type conv32_sym_info_type +#define conv_sym_shndx conv32_sym_shndx +#define conv_sym_other conv32_sym_other +#define conv_sym_value conv32_sym_value +#define conv_sym_SPARC_value conv32_sym_SPARC_value +#endif + +extern const char *conv_bnd_obj(uint_t); +extern const char *conv_bnd_type(uint_t); +extern const char *conv_cap_tag(Xword); +extern const char *conv_cap_val(Xword, Xword, Half); +extern const char *conv_cap_val_hw1(Xword, Half); +extern const char *conv_cap_val_sf1(Xword, Half); +extern const char *conv_dyn_flag1(Xword); +extern const char *conv_dyn_flag(Xword); +extern const char *conv_dyn_posflag1(Xword); +extern const char *conv_dyn_tag(Xword, Half); +extern const char *conv_dyn_feature1(Xword); +extern const char *conv_ehdr_class(uchar_t); +extern const char *conv_ehdr_data(uchar_t); +extern const char *conv_ehdr_flags(Half, Word); +extern const char *conv_ehdr_mach(Half); +extern const char *conv_ehdr_type(Half); +extern const char *conv_ehdr_vers(Word); +extern int conv_expn_field(char *, size_t, const Val_desc *, + Xword, Xword, const char *, int); +extern const char *conv_invalid_val(char *, size_t, Xword, int); +extern const char *conv_phdr_flags(Word); +extern const char *conv_phdr_type(Half, Word); +extern const char *conv_reject_desc(Rej_desc *); +extern const char *conv_reloc_type(Half, Word); +extern const char *conv_reloc_386_type(Word); +extern const char *conv_reloc_amd64_type(Word); +extern const char *conv_reloc_SPARC_type(Word); +extern const char *conv_sec_flags(Xword); +extern const char *conv_sec_info(Word, Xword); +extern const char *conv_sec_type(Half, Word); +extern const char *conv_sym_info_bind(uchar_t); +extern const char *conv_sym_info_type(Half, uchar_t); +extern const char *conv_sym_shndx(Half); +extern const char *conv_sym_other(uchar_t); +extern const char *conv_sym_value(Half, uchar_t, Addr); +extern const char *conv_sym_SPARC_value(Addr); #ifdef __cplusplus } diff --git a/usr/src/cmd/sgs/include/debug.h b/usr/src/cmd/sgs/include/debug.h index 496ef10820..d3e0b45e5a 100644 --- a/usr/src/cmd/sgs/include/debug.h +++ b/usr/src/cmd/sgs/include/debug.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,11 +30,11 @@ #pragma ident "%Z%%M% %I% %E% SMI" /* - * Global include file for linker debugging. + * Global include file for lddbg debugging. * - * ld(1) and ld.so carry out all diagnostic debugging calls via dlopen'ing - * the library liblddbg.so. Thus debugging is always enabled. The utility - * elfdump() is explicitly dependent upon this library. There are two + * ld(1) and ld.so.1(1) carry out all diagnostic debugging calls via lazy + * loading the library liblddbg.so. Thus debugging is always enabled. The + * utility elfdump(1) is explicitly dependent upon this library. There are two * categories of routines defined in this library: * * o Debugging routines that have specific linker knowledge, and test the @@ -44,14 +43,11 @@ * * o Lower level routines that provide generic ELF structure interpretation * start with the `Elf_' prefix. These latter routines are the only - * routines used by the elfdump() utility. + * routines used by the elfdump(1) utility. */ - -#include <libelf.h> #include <sgs.h> #include <libld.h> #include <rtld.h> -#include <machdep.h> #include <gelf.h> #ifdef __cplusplus @@ -59,7 +55,7 @@ extern "C" { #endif /* - * Define any interface flags. These flags direct the debugging routine to + * Define Dbg_*() interface flags. These flags direct the debugging routine to * generate different diagnostics, thus the strings themselves are maintained * in this library. */ @@ -127,414 +123,811 @@ extern "C" { #define DBG_REL_FINISH 2 #define DBG_REL_NONE 3 +#define DBG_NL_STD 0 /* newline controllers - standard and */ +#define DBG_NL_FRC 2 /* forced. */ + /* - * Define our setup entry point. + * Define a debug descriptor, and a user macro that inspects the descriptor as + * a means of triggering a class of diagnostic output. */ -extern uint_t Dbg_setup(const char *); -extern void Dbg_set(uint_t); +typedef struct { + uint_t d_class; /* debugging classes */ + uint_t d_extra; /* extra information for classes */ + Alist *d_list; /* associated strings */ +} Dbg_desc; + +extern Dbg_desc *dbg_desc; + +#define DBG_ENABLED (dbg_desc->d_class) +#define DBG_CALL(func) if (DBG_ENABLED) func /* - * Define a user macro to invoke debugging. The `dbg_mask' variable acts as a - * suitable flag, and can be set to collect the return value from Dbg_setup(). + * Most debugging tokens are interpreted within liblddbg, and thus any flags + * within d_class are only meaningful to this library. The following flags + * extend the d_class diagnostic, and are maintained in d_extra. These flags + * may be interpreted by the debugging library itself or from the callers + * dbg_print() routine. */ -extern uint_t dbg_mask; +#define DBG_E_DETAIL 0x0001 /* add detail to a class */ +#define DBG_E_LONG 0x0002 /* use long names (ie. no truncation) */ -#define DBG_CALL(func) if (dbg_mask) func +#define DBG_E_STDNL 0x0010 /* standard newline indicator */ + +#define DBG_E_SNAME 0x0100 /* prepend simple name (ld only) */ +#define DBG_E_FNAME 0x0200 /* prepend full name (ld only) */ +#define DBG_E_CLASS 0x0400 /* prepend ELF class (ld only) */ +#define DBG_E_LMID 0x0800 /* prepend link-map id (ld.so.1 only) */ +#define DBG_E_DEMANGLE 0x1000 /* demangle symbol names */ + +#define DBG_NOTDETAIL() !(dbg_desc->d_extra & DBG_E_DETAIL) +#define DBG_NOTLONG() !(dbg_desc->d_extra & DBG_E_LONG) + +#define DBG_ISSNAME() (dbg_desc->d_extra & DBG_E_SNAME) +#define DBG_ISFNAME() (dbg_desc->d_extra & DBG_E_FNAME) +#define DBG_ISCLASS() (dbg_desc->d_extra & DBG_E_CLASS) +#define DBG_ISLMID() (dbg_desc->d_extra & DBG_E_LMID) +#define DBG_ISDEMANGLE() \ + (dbg_desc->d_extra & DBG_E_DEMANGLE) /* - * Most debugging tokens are interpreted within liblddbg, and thus any flags - * within dbg_mask are only meaningful to this library. The following flags - * may be set by the Dbg_setup() by can be interpreted by the caller. + * Print routine, this must be supplied by the application. The initial + * argument may provide a link-map list to associate with the format statement + * that follows. */ -#define DBG_G_SNAME 0x10000000 /* prepend simple name */ -#define DBG_G_FNAME 0x20000000 /* prepend full name */ -#define DBG_G_CLASS 0x40000000 /* prepend ELF class */ +/* PRINTFLIKE2 */ +extern void dbg_print(Lm_list *, const char *, ...); + +extern uintptr_t Dbg_setup(const char *, Dbg_desc *); /* - * Print routine, this must be supplied by the application. + * Establish ELF32 and ELF64 class Dbg_*() interfaces. */ -/*PRINTFLIKE1*/ -extern void dbg_print(const char *, ...); +#if defined(_ELF64) + +#define Dbg_demangle_name Dbg64_demangle_name + +#define Dbg_bind_global Dbg64_bind_global +#define Dbg_bind_plt_summary Dbg64_bind_plt_summary +#define Dbg_bind_pltpad_from Dbg64_bind_pltpad_from +#define Dbg_bind_pltpad_to Dbg64_bind_pltpad_to +#define Dbg_bind_weak Dbg64_bind_weak + +#define Dbg_cap_val_hw1 Dbg64_cap_val_hw1 +#define Dbg_cap_hw_candidate Dbg64_cap_hw_candidate +#define Dbg_cap_hw_filter Dbg64_cap_hw_filter +#define Dbg_cap_mapfile Dbg64_cap_mapfile +#define Dbg_cap_sec_entry Dbg64_cap_sec_entry +#define Dbg_cap_sec_title Dbg64_cap_sec_title + +#define Dbg_ent_entry Dbg64_ent_entry +#define Dbg_ent_print Dbg64_ent_print + +#define Dbg_file_analyze Dbg64_file_analyze +#define Dbg_file_aout Dbg64_file_aout +#define Dbg_file_ar Dbg64_file_ar +#define Dbg_file_ar_rescan Dbg64_file_ar_rescan +#define Dbg_file_bind_entry Dbg64_file_bind_entry +#define Dbg_file_bindings Dbg64_file_bindings +#define Dbg_file_cntl Dbg64_file_cntl +#define Dbg_file_config_dis Dbg64_file_config_dis +#define Dbg_file_config_obj Dbg64_file_config_obj +#define Dbg_file_del_rescan Dbg64_file_del_rescan +#define Dbg_file_delete Dbg64_file_delete +#define Dbg_file_dlclose Dbg64_file_dlclose +#define Dbg_file_dldump Dbg64_file_dldump +#define Dbg_file_dlopen Dbg64_file_dlopen +#define Dbg_file_elf Dbg64_file_elf +#define Dbg_file_filtee Dbg64_file_filtee +#define Dbg_file_filter Dbg64_file_filter +#define Dbg_file_fixname Dbg64_file_fixname +#define Dbg_file_generic Dbg64_file_generic +#define Dbg_file_hdl_action Dbg64_file_hdl_action +#define Dbg_file_hdl_collect Dbg64_file_hdl_collect +#define Dbg_file_hdl_title Dbg64_file_hdl_title +#define Dbg_file_lazyload Dbg64_file_lazyload +#define Dbg_file_ldso Dbg64_file_ldso +#define Dbg_file_mode_promote Dbg64_file_mode_promote +#define Dbg_file_needed Dbg64_file_needed +#define Dbg_file_output Dbg64_file_output +#define Dbg_file_preload Dbg64_file_preload +#define Dbg_file_prot Dbg64_file_prot +#define Dbg_file_rejected Dbg64_file_rejected +#define Dbg_file_reuse Dbg64_file_reuse +#define Dbg_file_skip Dbg64_file_skip + +#define Dbg_got_display Dbg64_got_display + +#define Dbg_libs_audit Dbg64_libs_audit +#define Dbg_libs_find Dbg64_libs_find +#define Dbg_libs_found Dbg64_libs_found +#define Dbg_libs_ignore Dbg64_libs_ignore +#define Dbg_libs_init Dbg64_libs_init +#define Dbg_libs_l Dbg64_libs_l +#define Dbg_libs_path Dbg64_libs_path +#define Dbg_libs_req Dbg64_libs_req +#define Dbg_libs_update Dbg64_libs_update +#define Dbg_libs_yp Dbg64_libs_yp +#define Dbg_libs_ylu Dbg64_libs_ylu + +#define Dbg_map_dash Dbg64_map_dash +#define Dbg_map_ent Dbg64_map_ent +#define Dbg_map_parse Dbg64_map_parse +#define Dbg_map_pipe Dbg64_map_pipe +#define Dbg_map_seg Dbg64_map_seg +#define Dbg_map_set_atsign Dbg64_map_set_atsign +#define Dbg_map_set_equal Dbg64_map_set_equal +#define Dbg_map_size_new Dbg64_map_size_new +#define Dbg_map_size_old Dbg64_map_size_old +#define Dbg_map_sort_fini Dbg64_map_sort_fini +#define Dbg_map_sort_orig Dbg64_map_sort_orig +#define Dbg_map_symbol Dbg64_map_symbol +#define Dbg_map_version Dbg64_map_version + +#define Dbg_move_adjexpandreloc Dbg64_move_adjexpandreloc +#define Dbg_move_adjmovereloc Dbg64_move_adjmovereloc +#define Dbg_move_data Dbg64_move_data +#define Dbg_move_entry1 Dbg64_move_entry1 +#define Dbg_move_entry2 Dbg64_move_entry2 +#define Dbg_move_expand Dbg64_move_expand +#define Dbg_move_input Dbg64_move_input +#define Dbg_move_outmove Dbg64_move_outmove +#define Dbg_move_outsctadj Dbg64_move_outsctadj +#define Dbg_move_parexpn Dbg64_move_parexpn + +#define Dbg_reloc_apply_reg Dbg64_reloc_apply_reg +#define Dbg_reloc_apply_val Dbg64_reloc_apply_val +#define Dbg_reloc_ars_entry Dbg64_reloc_ars_entry +#define Dbg_reloc_copy Dbg64_reloc_copy +#define Dbg_reloc_discard Dbg64_reloc_discard +#define Dbg_reloc_doact Dbg64_reloc_doact +#define Dbg_reloc_doact_title Dbg64_reloc_doact_title +#define Dbg_reloc_dooutrel Dbg64_reloc_dooutrel +#define Dbg_reloc_entry Dbg64_reloc_entry +#define Dbg_reloc_error Dbg64_reloc_error +#define Dbg_reloc_generate Dbg64_reloc_generate +#define Dbg_reloc_in Dbg64_reloc_in +#define Dbg_reloc_ors_entry Dbg64_reloc_ors_entry +#define Dbg_reloc_out Dbg64_reloc_out +#define Dbg_reloc_proc Dbg64_reloc_proc +#define Dbg_reloc_run Dbg64_reloc_run +#define Dbg_reloc_transition Dbg64_reloc_transition + +#define Dbg_sec_added Dbg64_sec_added +#define Dbg_sec_created Dbg64_sec_created +#define Dbg_sec_discarded Dbg64_sec_discarded +#define Dbg_sec_group Dbg64_sec_group +#define Dbg_sec_in Dbg64_sec_in +#define Dbg_sec_order_error Dbg64_sec_order_error +#define Dbg_sec_order_list Dbg64_sec_order_list +#define Dbg_sec_strtab Dbg64_sec_strtab + +#define Dbg_seg_desc_entry Dbg64_seg_desc_entry +#define Dbg_seg_entry Dbg64_seg_entry +#define Dbg_seg_list Dbg64_seg_list +#define Dbg_seg_os Dbg64_seg_os +#define Dbg_seg_title Dbg64_seg_title + +#define Dbg_statistics_ar Dbg64_statistics_ar +#define Dbg_statistics_ld Dbg64_statistics_ld + +#define Dbg_support_action Dbg64_support_action +#define Dbg_support_load Dbg64_support_load +#define Dbg_support_req Dbg64_support_req + +#define Dbg_syminfo_entry Dbg64_syminfo_entry +#define Dbg_syminfo_title Dbg64_syminfo_title + +#define Dbg_syms_ar_checking Dbg64_syms_ar_checking +#define Dbg_syms_ar_entry Dbg64_syms_ar_entry +#define Dbg_syms_ar_resolve Dbg64_syms_ar_resolve +#define Dbg_syms_ar_title Dbg64_syms_ar_title +#define Dbg_syms_created Dbg64_syms_created +#define Dbg_syms_discarded Dbg64_syms_discarded +#define Dbg_syms_dlsym Dbg64_syms_dlsym +#define Dbg_syms_entered Dbg64_syms_entered +#define Dbg_syms_entry Dbg64_syms_entry +#define Dbg_syms_global Dbg64_syms_global +#define Dbg_syms_ignore Dbg64_syms_ignore +#define Dbg_syms_lazy_rescan Dbg64_syms_lazy_rescan +#define Dbg_syms_lookup Dbg64_syms_lookup +#define Dbg_syms_new Dbg64_syms_new +#define Dbg_syms_old Dbg64_syms_old +#define Dbg_syms_process Dbg64_syms_process +#define Dbg_syms_reduce Dbg64_syms_reduce +#define Dbg_syms_reloc Dbg64_syms_reloc +#define Dbg_syms_resolved Dbg64_syms_resolved +#define Dbg_syms_resolving Dbg64_syms_resolving +#define Dbg_syms_sec_entry Dbg64_syms_sec_entry +#define Dbg_syms_sec_title Dbg64_syms_sec_title +#define Dbg_syms_spec_title Dbg64_syms_spec_title +#define Dbg_syms_updated Dbg64_syms_updated +#define Dbg_syms_up_title Dbg64_syms_up_title + +#define Dbg_util_broadcast Dbg64_util_broadcast +#define Dbg_util_call_array Dbg64_util_call_array +#define Dbg_util_call_fini Dbg64_util_call_fini +#define Dbg_util_call_init Dbg64_util_call_init +#define Dbg_util_call_main Dbg64_util_call_main +#define Dbg_util_collect Dbg64_util_collect +#define Dbg_util_dbnotify Dbg64_util_dbnotify +#define Dbg_util_edge_in Dbg64_util_edge_in +#define Dbg_util_edge_out Dbg64_util_edge_out +#define Dbg_util_intoolate Dbg64_util_intoolate +#define Dbg_util_nl Dbg64_util_nl +#define Dbg_util_no_init Dbg64_util_no_init +#define Dbg_util_scc_entry Dbg64_util_scc_entry +#define Dbg_util_scc_title Dbg64_util_scc_title +#define Dbg_util_str Dbg64_util_str +#define Dbg_util_wait Dbg64_util_wait + +#define Dbg_unused_file Dbg64_unused_file +#define Dbg_unused_rtldinfo Dbg64_unused_rtldinfo +#define Dbg_unused_sec Dbg64_unused_sec +#define Dbg_unused_unref Dbg64_unused_unref + +#define Dbg_ver_avail_entry Dbg64_ver_avail_entry +#define Dbg_ver_avail_title Dbg64_ver_avail_title +#define Dbg_ver_def_title Dbg64_ver_def_title +#define Dbg_ver_desc_entry Dbg64_ver_desc_entry +#define Dbg_ver_need_entry Dbg64_ver_need_entry +#define Dbg_ver_need_title Dbg64_ver_need_title +#define Dbg_ver_nointerface Dbg64_ver_nointerface +#define Dbg_ver_symbol Dbg64_ver_symbol + +#else + +#define Dbg_demangle_name Dbg32_demangle_name + +#define Dbg_bind_global Dbg32_bind_global +#define Dbg_bind_plt_summary Dbg32_bind_plt_summary +#define Dbg_bind_weak Dbg32_bind_weak + +#define Dbg_cap_val_hw1 Dbg32_cap_val_hw1 +#define Dbg_cap_hw_candidate Dbg32_cap_hw_candidate +#define Dbg_cap_hw_filter Dbg32_cap_hw_filter +#define Dbg_cap_mapfile Dbg32_cap_mapfile +#define Dbg_cap_sec_entry Dbg32_cap_sec_entry +#define Dbg_cap_sec_title Dbg32_cap_sec_title + +#define Dbg_ent_entry Dbg32_ent_entry +#define Dbg_ent_print Dbg32_ent_print + +#define Dbg_file_analyze Dbg32_file_analyze +#define Dbg_file_aout Dbg32_file_aout +#define Dbg_file_ar Dbg32_file_ar +#define Dbg_file_ar_rescan Dbg32_file_ar_rescan +#define Dbg_file_bind_entry Dbg32_file_bind_entry +#define Dbg_file_bindings Dbg32_file_bindings +#define Dbg_file_cntl Dbg32_file_cntl +#define Dbg_file_config_dis Dbg32_file_config_dis +#define Dbg_file_config_obj Dbg32_file_config_obj +#define Dbg_file_del_rescan Dbg32_file_del_rescan +#define Dbg_file_delete Dbg32_file_delete +#define Dbg_file_dlclose Dbg32_file_dlclose +#define Dbg_file_dldump Dbg32_file_dldump +#define Dbg_file_dlopen Dbg32_file_dlopen +#define Dbg_file_elf Dbg32_file_elf +#define Dbg_file_filtee Dbg32_file_filtee +#define Dbg_file_filter Dbg32_file_filter +#define Dbg_file_fixname Dbg32_file_fixname +#define Dbg_file_generic Dbg32_file_generic +#define Dbg_file_hdl_action Dbg32_file_hdl_action +#define Dbg_file_hdl_collect Dbg32_file_hdl_collect +#define Dbg_file_hdl_title Dbg32_file_hdl_title +#define Dbg_file_lazyload Dbg32_file_lazyload +#define Dbg_file_ldso Dbg32_file_ldso +#define Dbg_file_mode_promote Dbg32_file_mode_promote +#define Dbg_file_needed Dbg32_file_needed +#define Dbg_file_output Dbg32_file_output +#define Dbg_file_preload Dbg32_file_preload +#define Dbg_file_prot Dbg32_file_prot +#define Dbg_file_rejected Dbg32_file_rejected +#define Dbg_file_reuse Dbg32_file_reuse +#define Dbg_file_skip Dbg32_file_skip + +#define Dbg_got_display Dbg32_got_display + +#define Dbg_libs_audit Dbg32_libs_audit +#define Dbg_libs_find Dbg32_libs_find +#define Dbg_libs_found Dbg32_libs_found +#define Dbg_libs_ignore Dbg32_libs_ignore +#define Dbg_libs_init Dbg32_libs_init +#define Dbg_libs_l Dbg32_libs_l +#define Dbg_libs_path Dbg32_libs_path +#define Dbg_libs_req Dbg32_libs_req +#define Dbg_libs_update Dbg32_libs_update +#define Dbg_libs_yp Dbg32_libs_yp +#define Dbg_libs_ylu Dbg32_libs_ylu + +#define Dbg_map_dash Dbg32_map_dash +#define Dbg_map_ent Dbg32_map_ent +#define Dbg_map_parse Dbg32_map_parse +#define Dbg_map_pipe Dbg32_map_pipe +#define Dbg_map_seg Dbg32_map_seg +#define Dbg_map_set_atsign Dbg32_map_set_atsign +#define Dbg_map_set_equal Dbg32_map_set_equal +#define Dbg_map_size_new Dbg32_map_size_new +#define Dbg_map_size_old Dbg32_map_size_old +#define Dbg_map_sort_fini Dbg32_map_sort_fini +#define Dbg_map_sort_orig Dbg32_map_sort_orig +#define Dbg_map_symbol Dbg32_map_symbol +#define Dbg_map_version Dbg32_map_version + +#define Dbg_move_adjexpandreloc Dbg32_move_adjexpandreloc +#define Dbg_move_adjmovereloc Dbg32_move_adjmovereloc +#define Dbg_move_data Dbg32_move_data +#define Dbg_move_entry1 Dbg32_move_entry1 +#define Dbg_move_entry2 Dbg32_move_entry2 +#define Dbg_move_expand Dbg32_move_expand +#define Dbg_move_input Dbg32_move_input +#define Dbg_move_outmove Dbg32_move_outmove +#define Dbg_move_outsctadj Dbg32_move_outsctadj +#define Dbg_move_parexpn Dbg32_move_parexpn + +#define Dbg_reloc_apply_reg Dbg32_reloc_apply_reg +#define Dbg_reloc_apply_val Dbg32_reloc_apply_val +#define Dbg_reloc_ars_entry Dbg32_reloc_ars_entry +#define Dbg_reloc_copy Dbg32_reloc_copy +#define Dbg_reloc_discard Dbg32_reloc_discard +#define Dbg_reloc_doact Dbg32_reloc_doact +#define Dbg_reloc_doact_title Dbg32_reloc_doact_title +#define Dbg_reloc_dooutrel Dbg32_reloc_dooutrel +#define Dbg_reloc_entry Dbg32_reloc_entry +#define Dbg_reloc_error Dbg32_reloc_error +#define Dbg_reloc_generate Dbg32_reloc_generate +#define Dbg_reloc_in Dbg32_reloc_in +#define Dbg_reloc_ors_entry Dbg32_reloc_ors_entry +#define Dbg_reloc_out Dbg32_reloc_out +#define Dbg_reloc_proc Dbg32_reloc_proc +#define Dbg_reloc_run Dbg32_reloc_run +#define Dbg_reloc_transition Dbg32_reloc_transition + +#define Dbg_sec_added Dbg32_sec_added +#define Dbg_sec_created Dbg32_sec_created +#define Dbg_sec_discarded Dbg32_sec_discarded +#define Dbg_sec_group Dbg32_sec_group +#define Dbg_sec_in Dbg32_sec_in +#define Dbg_sec_order_error Dbg32_sec_order_error +#define Dbg_sec_order_list Dbg32_sec_order_list +#define Dbg_sec_strtab Dbg32_sec_strtab + +#define Dbg_seg_desc_entry Dbg32_seg_desc_entry +#define Dbg_seg_entry Dbg32_seg_entry +#define Dbg_seg_list Dbg32_seg_list +#define Dbg_seg_os Dbg32_seg_os +#define Dbg_seg_title Dbg32_seg_title + +#define Dbg_statistics_ar Dbg32_statistics_ar +#define Dbg_statistics_ld Dbg32_statistics_ld + +#define Dbg_support_action Dbg32_support_action +#define Dbg_support_load Dbg32_support_load +#define Dbg_support_req Dbg32_support_req + +#define Dbg_syminfo_entry Dbg32_syminfo_entry +#define Dbg_syminfo_title Dbg32_syminfo_title + +#define Dbg_syms_ar_checking Dbg32_syms_ar_checking +#define Dbg_syms_ar_entry Dbg32_syms_ar_entry +#define Dbg_syms_ar_resolve Dbg32_syms_ar_resolve +#define Dbg_syms_ar_title Dbg32_syms_ar_title +#define Dbg_syms_created Dbg32_syms_created +#define Dbg_syms_discarded Dbg32_syms_discarded +#define Dbg_syms_dlsym Dbg32_syms_dlsym +#define Dbg_syms_entered Dbg32_syms_entered +#define Dbg_syms_entry Dbg32_syms_entry +#define Dbg_syms_global Dbg32_syms_global +#define Dbg_syms_ignore Dbg32_syms_ignore +#define Dbg_syms_lazy_rescan Dbg32_syms_lazy_rescan +#define Dbg_syms_lookup Dbg32_syms_lookup +#define Dbg_syms_lookup_aout Dbg32_syms_lookup_aout +#define Dbg_syms_new Dbg32_syms_new +#define Dbg_syms_old Dbg32_syms_old +#define Dbg_syms_process Dbg32_syms_process +#define Dbg_syms_reduce Dbg32_syms_reduce +#define Dbg_syms_reloc Dbg32_syms_reloc +#define Dbg_syms_resolved Dbg32_syms_resolved +#define Dbg_syms_resolving Dbg32_syms_resolving +#define Dbg_syms_sec_entry Dbg32_syms_sec_entry +#define Dbg_syms_sec_title Dbg32_syms_sec_title +#define Dbg_syms_spec_title Dbg32_syms_spec_title +#define Dbg_syms_updated Dbg32_syms_updated +#define Dbg_syms_up_title Dbg32_syms_up_title + +#define Dbg_util_broadcast Dbg32_util_broadcast +#define Dbg_util_call_array Dbg32_util_call_array +#define Dbg_util_call_fini Dbg32_util_call_fini +#define Dbg_util_call_init Dbg32_util_call_init +#define Dbg_util_call_main Dbg32_util_call_main +#define Dbg_util_collect Dbg32_util_collect +#define Dbg_util_dbnotify Dbg32_util_dbnotify +#define Dbg_util_edge_in Dbg32_util_edge_in +#define Dbg_util_edge_out Dbg32_util_edge_out +#define Dbg_util_intoolate Dbg32_util_intoolate +#define Dbg_util_nl Dbg32_util_nl +#define Dbg_util_no_init Dbg32_util_no_init +#define Dbg_util_scc_entry Dbg32_util_scc_entry +#define Dbg_util_scc_title Dbg32_util_scc_title +#define Dbg_util_str Dbg32_util_str +#define Dbg_util_wait Dbg32_util_wait + +#define Dbg_unused_file Dbg32_unused_file +#define Dbg_unused_rtldinfo Dbg32_unused_rtldinfo +#define Dbg_unused_sec Dbg32_unused_sec +#define Dbg_unused_unref Dbg32_unused_unref + +#define Dbg_ver_avail_entry Dbg32_ver_avail_entry +#define Dbg_ver_avail_title Dbg32_ver_avail_title +#define Dbg_ver_def_title Dbg32_ver_def_title +#define Dbg_ver_desc_entry Dbg32_ver_desc_entry +#define Dbg_ver_need_entry Dbg32_ver_need_entry +#define Dbg_ver_need_title Dbg32_ver_need_title +#define Dbg_ver_nointerface Dbg32_ver_nointerface +#define Dbg_ver_symbol Dbg32_ver_symbol +#endif /* - * External interface routines. These are linker specific. + * External Dbg_*() interface routines. */ -#ifdef _ELF64 -#define Dbg_cap_hw_1 Dbg_cap_hw_164 -#define Dbg_cap_mapfile Dbg_cap_mapfile64 -#define Dbg_cap_sec_entry Dbg_cap_sec_entry64 -#define Dbg_file_analyze Dbg_file_analyze64 -#define Dbg_file_aout Dbg_file_aout64 -#define Dbg_file_archive Dbg_file_archive64 -#define Dbg_file_bind_entry Dbg_file_bind_entry64 -#define Dbg_file_bindings Dbg_file_bindings64 -#define Dbg_file_config_dis Dbg_file_config_dis64 -#define Dbg_file_config_obj Dbg_file_config_obj64 -#define Dbg_file_delete Dbg_file_delete64 -#define Dbg_file_dlclose Dbg_file_dlclose64 -#define Dbg_file_dldump Dbg_file_dldump64 -#define Dbg_file_dlopen Dbg_file_dlopen64 -#define Dbg_file_elf Dbg_file_elf64 -#define Dbg_file_filtee Dbg_file_filtee64 -#define Dbg_file_filter Dbg_file_filter64 -#define Dbg_file_fixname Dbg_file_fixname64 -#define Dbg_file_generic Dbg_file_generic64 -#define Dbg_file_hdl_action Dbg_file_hdl_action64 -#define Dbg_file_hdl_collect Dbg_file_hdl_collect64 -#define Dbg_file_hdl_title Dbg_file_hdl_title64 -#define Dbg_file_ldso Dbg_file_ldso64 -#define Dbg_file_lazyload Dbg_file_lazyload64 -#define Dbg_file_needed Dbg_file_needed64 -#define Dbg_file_nl Dbg_file_nl64 -#define Dbg_file_output Dbg_file_output64 -#define Dbg_file_preload Dbg_file_preload64 -#define Dbg_file_prot Dbg_file_prot64 -#define Dbg_file_reuse Dbg_file_reuse64 -#define Dbg_file_skip Dbg_file_skip64 -#define Dbg_got_display Dbg_got_display64 -#define Dbg_map_atsign Dbg_map_atsign64 -#define Dbg_map_cap Dbg_map_cap64 -#define Dbg_map_dash Dbg_map_dash64 -#define Dbg_map_ent Dbg_map_ent64 -#define Dbg_map_equal Dbg_map_equal64 -#define Dbg_map_parse Dbg_map_parse64 -#define Dbg_map_pipe Dbg_map_pipe64 -#define Dbg_map_seg Dbg_map_seg64 -#define Dbg_map_size_new Dbg_map_size_new64 -#define Dbg_map_size_old Dbg_map_size_old64 -#define Dbg_map_sort_fini Dbg_map_sort_fini64 -#define Dbg_map_sort_orig Dbg_map_sort_orig64 -#define Dbg_map_symbol Dbg_map_symbol64 -#define Dbg_map_version Dbg_map_version64 -#define Dbg_move_mventry Dbg_move_mventry64 -#define Dbg_move_mventry2 Dbg_move_mventry264 -#define Dbg_move_outsctadj Dbg_move_outsctadj64 -#define Dbg_reloc_discard Dbg_reloc_discard64 -#define Dbg_reloc_error Dbg_reloc_error64 -#define Dbg_reloc_generate Dbg_reloc_generate64 -#define Dbg_reloc_in Dbg_reloc_in64 -#define Dbg_reloc_out Dbg_reloc_out64 -#define Dbg_reloc_proc Dbg_reloc_proc64 -#define Dbg_reloc_ars_entry Dbg_reloc_ars_entry64 -#define Dbg_reloc_ors_entry Dbg_reloc_ors_entry64 -#define Dbg_reloc_doact Dbg_reloc_doact64 -#define Dbg_reloc_dooutrel Dbg_reloc_dooutrel64 -#define Dbg_reloc_reg_apply Dbg_reloc_reg_apply64 -#define Dbg_reloc_transition Dbg_reloc_transition64 -#define Dbg_sec_added Dbg_sec_added64 -#define Dbg_sec_created Dbg_sec_created64 -#define Dbg_sec_discarded Dbg_sec_discarded64 -#define Dbg_sec_group Dbg_sec_group64 -#define Dbg_sec_in Dbg_sec_in64 -#define Dbg_sec_order_list Dbg_sec_order_list64 -#define Dbg_sec_order_error Dbg_sec_order_error64 -#define Dbg_sec_strtab Dbg_sec_strtab64 -#define Dbg_seg_entry Dbg_seg_entry64 -#define Dbg_seg_list Dbg_seg_list64 -#define Dbg_seg_os Dbg_seg_os64 -#define Dbg_seg_title Dbg_seg_title64 -#define Dbg_statistics_ar Dbg_statistics_ar64 -#define Dbg_statistics_ld Dbg_statistics_ld64 -#define Dbg_syminfo_entry Dbg_syminfo_entry64 -#define Dbg_syminfo_entry_title Dbg_syminfo_entry_title64 -#define Dbg_syminfo_title Dbg_syminfo_title64 -#define Dbg_syms_ar_checking Dbg_syms_ar_checking64 -#define Dbg_syms_ar_entry Dbg_syms_ar_entry64 -#define Dbg_syms_ar_resolve Dbg_syms_ar_resolve64 -#define Dbg_syms_created Dbg_syms_created64 -#define Dbg_syms_discarded Dbg_syms_discarded64 -#define Dbg_syms_entered Dbg_syms_entered64 -#define Dbg_syms_entry Dbg_syms_entry64 -#define Dbg_syms_global Dbg_syms_global64 -#define Dbg_syms_ignore Dbg_syms_ignore64 -#define Dbg_syms_new Dbg_syms_new64 -#define Dbg_syms_nl Dbg_syms_nl64 -#define Dbg_syms_old Dbg_syms_old64 -#define Dbg_syms_process Dbg_syms_process64 -#define Dbg_syms_reduce Dbg_syms_reduce64 -#define Dbg_syms_reloc Dbg_syms_reloc64 -#define Dbg_syms_resolved Dbg_syms_resolved64 -#define Dbg_syms_resolving1 Dbg_syms_resolving164 -#define Dbg_syms_resolving2 Dbg_syms_resolving264 -#define Dbg_syms_sec_entry Dbg_syms_sec_entry64 -#define Dbg_syms_sec_title Dbg_syms_sec_title64 -#define Dbg_syms_spec_title Dbg_syms_spec_title64 -#define Dbg_syms_up_title Dbg_syms_up_title64 -#define Dbg_syms_updated Dbg_syms_updated64 -#define Dbg_syms_dlsym Dbg_syms_dlsym64 -#define Dbg_syms_lookup_aout Dbg_syms_lookup_aout64 -#define Dbg_syms_lookup Dbg_syms_lookup64 -#define Dbg_tls_modactivity Dbg_tls_modactivity64 -#define Dbg_tls_static_block Dbg_tls_static_block64 -#define Dbg_unused_sec Dbg_unused_sec64 -#define Dbg_audit_interface Dbg_audit_interface64 -#define Dbg_audit_lib Dbg_audit_lib64 -#define Dbg_audit_object Dbg_audit_object64 -#define Dbg_audit_symval Dbg_audit_symval64 -#define Dbg_audit_version Dbg_audit_version64 -#define Dbg_ver_avail_entry Dbg_ver_avail_entry64 -#define Dbg_ver_desc_entry Dbg_ver_desc_entry64 -#endif /* _ELF64 */ - -extern void Dbg_args_files(int, char *); -extern void Dbg_args_flags(int, int); -extern void Dbg_bind_global(const char *, caddr_t, caddr_t, Xword, - Pltbindtype, const char *, caddr_t, caddr_t, - const char *, uint_t); -extern void Dbg_bind_plt_summary(Half, Word, Word, Word, - Word, Word, Word); -extern void Dbg_bind_profile(uint_t, uint_t); -extern void Dbg_bind_weak(const char *, caddr_t, caddr_t, - const char *); -extern void Dbg_cap_hw_candidate(const char *); -extern void Dbg_cap_hw_filter(const char *, const char *); -extern void Dbg_cap_hw_1(Xword, Half); -extern void Dbg_cap_mapfile(Xword, Xword, Half); -extern void Dbg_cap_sec_entry(uint_t, Xword, Xword, Half); -extern void Dbg_cap_sec_title(const char *); -extern void Dbg_ent_print(Half, List * len, Boolean); -extern void Dbg_file_analyze(Rt_map *); -extern void Dbg_file_aout(const char *, ulong_t, ulong_t, ulong_t); -extern void Dbg_file_archive(const char *, int); -extern void Dbg_file_ar_rescan(void); -extern void Dbg_file_bind_entry(Bnd_desc *); -extern void Dbg_file_bindings(Rt_map *, int, Word); -extern void Dbg_file_cntl(Lm_list *, Aliste, Aliste); -extern void Dbg_file_config_dis(const char *, int); -extern void Dbg_file_config_obj(const char *, const char *, - const char *); -extern void Dbg_file_delete(const char *); -extern void Dbg_file_dlclose(const char *, int); -extern void Dbg_file_dldump(const char *, const char *, int); -extern void Dbg_file_dlopen(const char *, const char *, int); -extern void Dbg_file_del_rescan(void); -extern void Dbg_file_elf(const char *, ulong_t, ulong_t, ulong_t, - ulong_t, Lmid_t, Aliste); -extern void Dbg_file_filtee(const char *, const char *, int); -extern void Dbg_file_filter(const char *, const char *, int); -extern void Dbg_file_fixname(const char *, const char *); -extern void Dbg_file_generic(Ifl_desc *); -extern void Dbg_file_hdl_action(Grp_hdl *, Rt_map *, int); -extern void Dbg_file_hdl_collect(Grp_hdl *, const char *); -extern void Dbg_file_hdl_title(int); -extern void Dbg_file_lazyload(const char *, const char *, - const char *); -extern void Dbg_file_ldso(const char *, ulong_t, ulong_t, char **, - auxv_t *); -extern void Dbg_file_mode_promote(const char *, int); -extern void Dbg_file_needed(const char *, const char *); -extern void Dbg_file_nl(void); -extern void Dbg_file_output(Ofl_desc *); -extern void Dbg_file_preload(const char *); -extern void Dbg_file_prot(const char *, int); -extern void Dbg_file_reuse(const char *, const char *); -extern void Dbg_file_rejected(Rej_desc *); -extern void Dbg_file_skip(const char *, const char *); -extern void Dbg_got_display(Gottable *, Ofl_desc *); -extern void Dbg_libs_audit(const char *, const char *); -extern void Dbg_libs_ignore(const char *); -extern void Dbg_libs_init(List *, List *); -extern void Dbg_libs_l(const char *, const char *); -extern void Dbg_libs_path(const char *, Half, const char *); -extern void Dbg_libs_req(const char *, const char *, const char *); -extern void Dbg_libs_update(List *, List *); -extern void Dbg_libs_yp(const char *); -extern void Dbg_libs_ylu(const char *, const char *, int); -extern void Dbg_libs_find(const char *); -extern void Dbg_libs_found(const char *, int); -extern void Dbg_map_atsign(Boolean); -extern void Dbg_map_dash(const char *, Sdf_desc *); -extern void Dbg_map_ent(Boolean, Ent_desc *, Ofl_desc *); -extern void Dbg_map_equal(Boolean); -extern void Dbg_map_parse(const char *); -extern void Dbg_map_pipe(Sg_desc *, const char *, const Word); -extern void Dbg_map_seg(Half, int, Sg_desc *); -extern void Dbg_map_size_new(const char *); -extern void Dbg_map_size_old(Ehdr *, Sym_desc *); -extern void Dbg_map_sort_fini(Sg_desc *); -extern void Dbg_map_sort_orig(Sg_desc *); -extern void Dbg_map_symbol(Ehdr *, Sym_desc *); -extern void Dbg_map_version(const char *, const char *, int); -extern void Dbg_move_adjexpandreloc(ulong_t, const char *); -extern void Dbg_move_adjmovereloc(ulong_t, ulong_t, const char *); -extern void Dbg_move_data(const char *); -extern void Dbg_move_expanding(Move *, Addr); -extern void Dbg_move_input1(const char *); -extern void Dbg_move_mventry(int, Move *, Sym_desc *); -extern void Dbg_move_mventry2(Move *, Word, char *); -extern void Dbg_move_outmove(const uchar_t *); -extern void Dbg_move_outsctadj(Sym_desc *); -extern void Dbg_move_parexpn(const char *, const char *); +extern void Dbg_args_files(Lm_list *, int, char *); +extern void Dbg_args_flags(Lm_list *, int, int); +extern void Dbg_audit_interface(Lm_list *, const char *, const char *); +extern void Dbg_audit_lib(Lm_list *, const char *); +extern void Dbg_audit_object(Lm_list *, const char *, const char *); +extern void Dbg_audit_symval(Lm_list *, const char *, const char *, + const char *, Addr, Addr); +extern void Dbg_audit_version(Lm_list *, const char *, ulong_t); + +extern void Dbg_bind_global(Rt_map *, Addr, Off, Xword, Pltbindtype, + Rt_map *, Addr, Off, const char *, uint_t); +extern void Dbg_bind_plt_summary(Lm_list *, Half, Word, Word, Word, Word, + Word, Word); #if defined(_ELF64) -extern void Dbg_pltpad_bindto64(const char *, const char *, Addr); -extern void Dbg_pltpad_boundto64(const char *, Addr, const char *, - const char *); +extern void Dbg_bind_pltpad_from(Rt_map *, Addr, const char *); +extern void Dbg_bind_pltpad_to(Rt_map *, Addr, const char *, const char *); #endif -extern void Dbg_reloc_apply(unsigned long long, unsigned long long); -extern void Dbg_reloc_discard(Half, Rel_desc *); -extern void Dbg_reloc_error(Half, Word, void *, const char *, - const char *); -extern void Dbg_reloc_generate(Os_desc *, Word); -extern void Dbg_reloc_reg_apply(unsigned long long, - unsigned long long); -extern void Dbg_reloc_in(Half, Word, void *, const char *, - const char *); -extern void Dbg_reloc_out(Half, Word, void *, const char *, - const char *); -extern void Dbg_reloc_proc(Os_desc *, Is_desc *, Is_desc *); -extern void Dbg_reloc_ars_entry(Half, Rel_desc *); -extern void Dbg_reloc_ors_entry(Half, Rel_desc *); -extern void Dbg_reloc_doactiverel(void); -extern void Dbg_reloc_doact(Half, Word, Xword, Xword, const char *, - Os_desc *); -extern void Dbg_reloc_dooutrel(GElf_Word); -extern void Dbg_reloc_copy(const char *, const char *, - const char *, int); -extern void Dbg_reloc_run(const char *, uint_t, int, int); -extern void Dbg_reloc_transition(Half, Word, Word, Xword, - const char *); -extern void Dbg_sec_added(Os_desc *, Sg_desc *); -extern void Dbg_sec_created(Os_desc *, Sg_desc *); -extern void Dbg_sec_discarded(Is_desc *, Is_desc *); -extern void Dbg_sec_group(Is_desc *, Group_desc *); -extern void Dbg_sec_in(Is_desc *); -extern void Dbg_sec_order_list(Ofl_desc *, int); -extern void Dbg_sec_order_error(Ifl_desc *, Word, int); -extern void Dbg_sec_strtab(Os_desc *, Str_tbl *); -extern void Dbg_seg_entry(Half, int, Sg_desc *); -extern void Dbg_seg_list(Half, List *); -extern void Dbg_seg_os(Ofl_desc *, Os_desc *, int); -extern void Dbg_seg_title(void); -extern void Dbg_support_action(const char *, const char *, - Support_ndx, const char *); -extern void Dbg_support_load(const char *, const char *); -extern void Dbg_support_req(const char *, int); -extern void Dbg_syms_ar_checking(Xword, Elf_Arsym *, const char *); -extern void Dbg_syms_ar_entry(Xword, Elf_Arsym *); -extern void Dbg_syms_ar_resolve(Xword, Elf_Arsym *, const char *, - int); -extern void Dbg_syms_ar_title(const char *, int); -extern void Dbg_syms_created(const char *); -extern void Dbg_syms_discarded(Sym_desc *, Is_desc *); -extern void Dbg_syms_entered(Ehdr *, Sym *, Sym_desc *); -extern void Dbg_syms_entry(Xword, Sym_desc *); -extern void Dbg_syms_global(Xword, const char *); -extern void Dbg_syms_ignore(Ehdr *, Sym_desc *); -extern void Dbg_syms_lazy_rescan(const char *); -extern void Dbg_syms_new(Ehdr *, Sym *, Sym_desc *); -extern void Dbg_syms_nl(void); -extern void Dbg_syms_old(Ehdr *, Sym_desc *); -extern void Dbg_syms_process(Ifl_desc *); -extern void Dbg_syms_reduce(int, Ehdr *, Sym_desc *, int, - const char *); -extern void Dbg_syms_reloc(Ehdr *, Sym_desc *); -extern void Dbg_syms_resolved(Ehdr *, Sym_desc *); -extern void Dbg_syms_resolving1(Xword, const char *, int, int); -extern void Dbg_syms_resolving2(Ehdr *, Sym *, Sym *, Sym_desc *, - Ifl_desc *); -extern void Dbg_syms_sec_entry(int, Sg_desc *, Os_desc *); -extern void Dbg_syms_sec_title(void); -extern void Dbg_syms_spec_title(void); -extern void Dbg_syms_up_title(Ehdr *); -extern void Dbg_syms_updated(Ehdr *, Sym_desc *, const char *); -extern void Dbg_syms_dlsym(const char *, const char *, const char *, - int); -extern void Dbg_syms_lookup_aout(const char *); -extern void Dbg_syms_lookup(const char *, const char *, - const char *); -extern void Dbg_tls_modactivity(void *, uint_t); -extern void Dbg_tls_static_block(void *, ulong_t); -extern void Dbg_audit_interface(const char *, const char *); -extern void Dbg_audit_lib(const char *); -extern void Dbg_audit_object(const char *, const char *); -extern void Dbg_audit_symval(const char *, const char *, - const char *, Addr, Addr); -extern void Dbg_audit_version(const char *, ulong_t); -extern void Dbg_statistics_ar(Ofl_desc *); -extern void Dbg_statistics_ld(Ofl_desc *); -extern void Dbg_syminfo_entry(int, Syminfo *, Sym *, - const char *, Dyn *); -extern void Dbg_syminfo_title(void); -extern void Dbg_unused_file(const char *, int, int); -extern void Dbg_unused_rtldinfo(const char *, const char *); -extern void Dbg_unused_sec(Is_desc *); -extern void Dbg_unused_unref(const char *, const char *); -extern void Dbg_util_broadcast(const char *); -extern void Dbg_util_call_array(const char *, void *, - uint_t, uint_t); -extern void Dbg_util_call_fini(const char *); -extern void Dbg_util_call_init(const char *, int); -extern void Dbg_util_call_main(const char *); -extern void Dbg_util_collect(const char *, int, int); -extern void Dbg_util_dbnotify(rd_event_e, r_state_e); -extern void Dbg_util_edge_in(Rt_map *, uint_t, Rt_map *, int, int); -extern void Dbg_util_edge_out(const char *, int, const char *); -extern void Dbg_util_intoolate(const char *); -extern void Dbg_util_nl(void); -extern void Dbg_util_no_init(const char *); -extern void Dbg_util_scc_entry(uint_t, const char *); -extern void Dbg_util_scc_title(int); -extern void Dbg_util_str(const char *); -extern void Dbg_util_wait(int, const char *, const char *); -extern void Dbg_ver_avail_entry(Ver_index *, const char *); -extern void Dbg_ver_avail_title(const char *); -extern void Dbg_ver_desc_entry(Ver_desc *); -extern void Dbg_ver_def_title(const char *); -extern void Dbg_ver_need_title(const char *); -extern void Dbg_ver_need_entry(Half, const char *, const char *); -extern void Dbg_ver_nointerface(const char *); -extern void Dbg_ver_symbol(const char *); +extern void Dbg_bind_weak(Rt_map *, Addr, Addr, const char *); + +extern void Dbg_cap_hw_candidate(Lm_list *, const char *); +extern void Dbg_cap_hw_filter(Lm_list *, const char *, Rt_map *); +extern void Dbg_cap_mapfile(Lm_list *, Xword, Xword, Half); +extern void Dbg_cap_sec_entry(Lm_list *, uint_t, Xword, Xword, Half); +extern void Dbg_cap_sec_title(Ofl_desc *); +extern void Dbg_cap_val_hw1(Lm_list *, Xword, Half); + +extern const char * + Dbg_demangle_name(const char *); + +extern void Dbg_ent_entry(Lm_list *, Half, Ent_desc *); +extern void Dbg_ent_print(Lm_list *, Half, List *, Boolean); + +extern void Dbg_file_analyze(Rt_map *); +extern void Dbg_file_aout(Lm_list *, const char *, ulong_t, ulong_t, + ulong_t, const char *, Aliste); +extern void Dbg_file_ar(Lm_list *, const char *, int); +extern void Dbg_file_ar_rescan(Lm_list *); +extern void Dbg_file_bind_entry(Lm_list *, Bnd_desc *); +extern void Dbg_file_bindings(Rt_map *, int); +extern void Dbg_file_cntl(Lm_list *, Aliste, Aliste); +extern void Dbg_file_config_dis(Lm_list *, const char *, int); +extern void Dbg_file_config_obj(Lm_list *, const char *, const char *, + const char *); +extern void Dbg_file_del_rescan(Lm_list *); +extern void Dbg_file_delete(Rt_map *); +extern void Dbg_file_dlclose(Lm_list *, const char *, int); +extern void Dbg_file_dldump(Rt_map *, const char *, int); +extern void Dbg_file_dlopen(Rt_map *, const char *, int); +extern void Dbg_file_elf(Lm_list *, const char *, ulong_t, ulong_t, + ulong_t, ulong_t, const char *, Aliste); +extern void Dbg_file_filtee(Lm_list *, const char *, const char *, int); +extern void Dbg_file_filter(Lm_list *, const char *, const char *, int); +extern void Dbg_file_fixname(Lm_list *, const char *, const char *); +extern void Dbg_file_generic(Lm_list *, Ifl_desc *); +extern void Dbg_file_hdl_action(Grp_hdl *, Rt_map *, int); +extern void Dbg_file_hdl_collect(Grp_hdl *, const char *); +extern void Dbg_file_hdl_title(int); +extern void Dbg_file_lazyload(Rt_map *, const char *, const char *); +extern void Dbg_file_ldso(Rt_map *, char **, auxv_t *, const char *, + Aliste); +extern void Dbg_file_mode_promote(Rt_map *, int); +extern void Dbg_file_needed(Rt_map *, const char *); +extern void Dbg_file_output(Ofl_desc *); +extern void Dbg_file_preload(Lm_list *, const char *); +extern void Dbg_file_prot(Rt_map *, int); +extern void Dbg_file_rejected(Lm_list *, Rej_desc *); +extern void Dbg_file_reuse(Lm_list *, const char *, const char *); +extern void Dbg_file_skip(Lm_list *, const char *, const char *); + +extern void Dbg_got_display(Ofl_desc *, Gottable *); + +extern void Dbg_libs_audit(Lm_list *, const char *, const char *); +extern void Dbg_libs_find(Lm_list *, const char *); +extern void Dbg_libs_found(Lm_list *, const char *, int); +extern void Dbg_libs_ignore(Lm_list *, const char *); +extern void Dbg_libs_init(Lm_list *, List *, List *); +extern void Dbg_libs_l(Lm_list *, const char *, const char *); +extern void Dbg_libs_path(Lm_list *, const char *, Half, const char *); +extern void Dbg_libs_req(Lm_list *, const char *, const char *, + const char *); +extern void Dbg_libs_update(Lm_list *, List *, List *); +extern void Dbg_libs_yp(Lm_list *, const char *); +extern void Dbg_libs_ylu(Lm_list *, const char *, const char *, int); + +extern void Dbg_map_dash(Lm_list *, const char *, Sdf_desc *); +extern void Dbg_map_ent(Lm_list *, Boolean, Ent_desc *, Ofl_desc *); +extern void Dbg_map_parse(Lm_list *, const char *); +extern void Dbg_map_pipe(Lm_list *, Sg_desc *, const char *, const Word); +extern void Dbg_map_seg(Ofl_desc *, int, Sg_desc *); +extern void Dbg_map_set_atsign(Boolean); +extern void Dbg_map_set_equal(Boolean); +extern void Dbg_map_size_new(Lm_list *, const char *); +extern void Dbg_map_size_old(Ofl_desc *, Sym_desc *); +extern void Dbg_map_sort_fini(Lm_list *, Sg_desc *); +extern void Dbg_map_sort_orig(Lm_list *, Sg_desc *); +extern void Dbg_map_symbol(Ofl_desc *, Sym_desc *); +extern void Dbg_map_version(Lm_list *, const char *, const char *, int); + +extern void Dbg_move_adjexpandreloc(Lm_list *, Xword, const char *); +extern void Dbg_move_adjmovereloc(Lm_list *, Xword, Xword, const char *); +extern void Dbg_move_data(Rt_map *); +extern void Dbg_move_entry1(Lm_list *, int, Move *, Sym_desc *); +extern void Dbg_move_entry2(Lm_list *, Move *, Word, const char *); +extern void Dbg_move_expand(Lm_list *, Move *, Addr); +extern void Dbg_move_input(Lm_list *, const char *); +extern void Dbg_move_outmove(Lm_list *, const char *); +extern void Dbg_move_outsctadj(Lm_list *, Sym_desc *); +extern void Dbg_move_parexpn(Lm_list *, const char *, const char *); + +extern void Dbg_reloc_apply_reg(Lm_list *, int, Half, Xword, Xword); +extern void Dbg_reloc_apply_val(Lm_list *, int, Xword, Xword); +extern void Dbg_reloc_ars_entry(Lm_list *, int, Word, Half, Rel_desc *); +extern void Dbg_reloc_copy(Rt_map *, Rt_map *, const char *, int); +extern void Dbg_reloc_discard(Lm_list *, Half, Rel_desc *); +extern void Dbg_reloc_doact(Lm_list *, int, Half, Word, Word, Xword, Xword, + const char *, Os_desc *); +extern void Dbg_reloc_doact_title(Lm_list *); +extern void Dbg_reloc_dooutrel(Lm_list *, Word); +extern void Dbg_reloc_entry(Lm_list *, const char *, Half, Word, void *, + const char *, const char *, const char *); +extern void Dbg_reloc_error(Lm_list *, int, Half, Word, void *, + const char *); +extern void Dbg_reloc_generate(Lm_list *, Os_desc *, Word); +extern void Dbg_reloc_in(Lm_list *, int, Half, Word, void *, const char *, + const char *); +extern void Dbg_reloc_ors_entry(Lm_list *, int, Word, Half, Rel_desc *); +extern void Dbg_reloc_out(Ofl_desc *, int, Word, void *, const char *, + const char *); +extern void Dbg_reloc_proc(Lm_list *, Os_desc *, Is_desc *, Is_desc *); +extern void Dbg_reloc_run(Rt_map *, uint_t, int, int); +extern void Dbg_reloc_transition(Lm_list *, Half, Word, Word, Xword, + const char *); + +extern void Dbg_sec_added(Lm_list *, Os_desc *, Sg_desc *); +extern void Dbg_sec_created(Lm_list *, Os_desc *, Sg_desc *); +extern void Dbg_sec_discarded(Lm_list *, Is_desc *, Is_desc *); +extern void Dbg_sec_group(Lm_list *, Is_desc *, Group_desc *); +extern void Dbg_sec_in(Lm_list *, Is_desc *); +extern void Dbg_sec_order_error(Lm_list *, Ifl_desc *, Word, int); +extern void Dbg_sec_order_list(Ofl_desc *, int); +extern void Dbg_sec_strtab(Lm_list *, Os_desc *, Str_tbl *); + +extern void Dbg_seg_desc_entry(Lm_list *, Half, int, Sg_desc *); +extern void Dbg_seg_entry(Ofl_desc *, int, Sg_desc *); +extern void Dbg_seg_list(Lm_list *, Half, List *); +extern void Dbg_seg_os(Ofl_desc *, Os_desc *, int); +extern void Dbg_seg_title(Lm_list *); + +extern void Dbg_statistics_ar(Ofl_desc *); +extern void Dbg_statistics_ld(Ofl_desc *); + +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_syminfo_entry(Lm_list *, Word, Syminfo *, Sym *, + const char *, Dyn *); +extern void Dbg_syminfo_title(Lm_list *); + +extern void Dbg_syms_ar_checking(Lm_list *, Xword, Elf_Arsym *, + const char *); +extern void Dbg_syms_ar_entry(Lm_list *, Xword, Elf_Arsym *); +extern void Dbg_syms_ar_resolve(Lm_list *, Xword, Elf_Arsym *, + const char *, int); +extern void Dbg_syms_ar_title(Lm_list *, const char *, int); +extern void Dbg_syms_created(Lm_list *, const char *); +extern void Dbg_syms_discarded(Lm_list *, Sym_desc *, Is_desc *); +extern void Dbg_syms_dlsym(Rt_map *, const char *, const char *, int); +extern void Dbg_syms_entered(Ofl_desc *, Sym *, Sym_desc *); +extern void Dbg_syms_entry(Lm_list *, Word, Sym_desc *); +extern void Dbg_syms_global(Lm_list *, Word, const char *); +extern void Dbg_syms_ignore(Ofl_desc *, Sym_desc *); +extern void Dbg_syms_lazy_rescan(Lm_list *, const char *); +extern void Dbg_syms_lookup(Rt_map *, const char *, const char *); +#if !(defined(_ELF64)) +extern void Dbg_syms_lookup_aout(Lm_list *, const char *); +#endif +extern void Dbg_syms_new(Ofl_desc *, Sym *, Sym_desc *); +extern void Dbg_syms_old(Ofl_desc *, Sym_desc *); +extern void Dbg_syms_process(Lm_list *, Ifl_desc *); +extern void Dbg_syms_reduce(Ofl_desc *, int, Sym_desc *, int, + const char *); +extern void Dbg_syms_reloc(Ofl_desc *, Sym_desc *); +extern void Dbg_syms_resolved(Ofl_desc *, Sym_desc *); +extern void Dbg_syms_resolving(Ofl_desc *, Word, const char *, int, int, + Sym *, Sym *, Sym_desc *, Ifl_desc *); +extern void Dbg_syms_sec_entry(Lm_list *, Word, Sg_desc *, Os_desc *); +extern void Dbg_syms_sec_title(Lm_list *); +extern void Dbg_syms_spec_title(Lm_list *); +extern void Dbg_syms_updated(Ofl_desc *, Sym_desc *, const char *); +extern void Dbg_syms_up_title(Lm_list *); + +extern void Dbg_tls_modactivity(Lm_list *, void *, uint_t); +extern void Dbg_tls_static_block(Lm_list *, void *, ulong_t); + +extern void Dbg_util_broadcast(Rt_map *); +extern void Dbg_util_call_array(Rt_map *, void *, int, Word); +extern void Dbg_util_call_fini(Rt_map *); +extern void Dbg_util_call_init(Rt_map *, int); +extern void Dbg_util_call_main(Rt_map *); +extern void Dbg_util_collect(Rt_map *, int, int); +extern void Dbg_util_dbnotify(Lm_list *, rd_event_e, r_state_e); +extern void Dbg_util_edge_in(Lm_list *, Rt_map *, uint_t, Rt_map *, + int, int); +extern void Dbg_util_edge_out(Rt_map *, Rt_map *); +extern void Dbg_util_intoolate(Rt_map *); +extern void Dbg_util_nl(Lm_list *, int); +extern void Dbg_util_no_init(Rt_map *); +extern void Dbg_util_str(Lm_list *, const char *); +extern void Dbg_util_scc_entry(Rt_map *, uint_t); +extern void Dbg_util_scc_title(Lm_list *, int); +extern void Dbg_util_wait(Rt_map *, Rt_map *, int); + +extern void Dbg_unused_file(Lm_list *, const char *, int, uint_t); +extern void Dbg_unused_rtldinfo(Rt_map *); +extern void Dbg_unused_sec(Lm_list *, Is_desc *); +extern void Dbg_unused_unref(Rt_map *, const char *); + +extern void Dbg_ver_avail_entry(Lm_list *, Ver_index *, const char *); +extern void Dbg_ver_avail_title(Lm_list *, const char *); +extern void Dbg_ver_def_title(Lm_list *, const char *); +extern void Dbg_ver_desc_entry(Lm_list *, Ver_desc *); +extern void Dbg_ver_need_entry(Lm_list *, Half, const char *, + const char *); +extern void Dbg_ver_need_title(Lm_list *, const char *); +extern void Dbg_ver_nointerface(Lm_list *, const char *); +extern void Dbg_ver_symbol(Lm_list *, const char *); + +/* + * Define Elf_*() interface flags. + */ +#define ELF_DBG_ELFDUMP 1 +#define ELF_DBG_RTLD 2 +#define ELF_DBG_LD 3 /* - * External interface routines. These are not linker specific and provide - * generic routines for interpreting elf structures. + * Define generic Elf_*() interfaces. */ -#ifdef _ELF64 -#define Elf_phdr_entry Gelf_phdr_entry -#define Elf_shdr_entry Gelf_shdr_entry -#define Elf_sym_table_entry Gelf_sym_table_entry -#else /* elf32 */ -extern void Elf_phdr_entry(Half, Elf32_Phdr *); -extern void Elf_shdr_entry(Half, Elf32_Shdr *); -extern void Elf_sym_table_entry(const char *, Elf32_Ehdr *, - Elf32_Sym *, Elf32_Word, const char *, - const char *); -#endif /* _ELF64 */ +extern void Elf_syminfo_entry(Lm_list *, Word, Syminfo *, const char *, + const char *); +extern void Elf_syminfo_title(Lm_list *); /* - * These are used by both the Elf32 and Elf64 sides. + * Establish ELF32 and ELF64 class Elf_*() interfaces. */ -extern const char *Gelf_sym_dem(const char *); - -extern void Gelf_cap_print(GElf_Cap *, int, Half); -extern void Gelf_cap_title(void); -extern void Gelf_phdr_entry(Half, GElf_Phdr *); -extern void Gelf_shdr_entry(Half, GElf_Shdr *); -extern void Gelf_sym_table_entry(const char *, GElf_Ehdr *, - GElf_Sym *, GElf_Word, const char *, const char *); -extern void Gelf_elf_data_title(void); -extern void Gelf_syminfo_entry(int, GElf_Syminfo *, const char *, - const char *); -extern void Gelf_sym_table_title(GElf_Ehdr *, const char *, - const char *); -extern void Gelf_ver_def_title(void); -extern void Gelf_ver_need_title(void); -extern void Gelf_ver_line_1(const char *, const char *, - const char *, const char *); -extern void Gelf_ver_line_2(const char *, const char *); -extern void Gelf_ver_line_3(const char *, const char *, - const char *); - -extern void Gelf_dyn_print(GElf_Dyn *, int ndx, const char *, Half); -extern void Gelf_dyn_title(void); -extern void Gelf_elf_header(GElf_Ehdr *, GElf_Shdr *); -extern void Gelf_got_title(uchar_t); -extern void Gelf_got_entry(GElf_Ehdr *, Sword, GElf_Addr, - GElf_Xword, GElf_Word, void *, const char *); -extern void Gelf_reloc_entry(const char *, GElf_Half, GElf_Word, - GElf_Rela *, const char *, const char *); -extern void Gelf_syminfo_title(void); +#if defined(_ELF64) + +#define Elf_cap_entry Elf64_cap_entry +#define Elf_cap_title Elf64_cap_title + +#define Elf_demangle_name Elf64_demangle_name +#define Elf_dyn_entry Elf64_dyn_entry +#define Elf_dyn_title Elf64_dyn_title + +#define Elf_ehdr Elf64_ehdr + +#define Elf_got_entry Elf64_got_entry +#define Elf_got_title Elf64_got_title + +#define Elf_reloc_apply_reg Elf64_reloc_apply_reg +#define Elf_reloc_apply_val Elf64_reloc_apply_val +#define Elf_reloc_entry_1 Elf64_reloc_entry_1 +#define Elf_reloc_entry_2 Elf64_reloc_entry_2 +#define Elf_reloc_title Elf64_reloc_title + +#define Elf_phdr Elf64_phdr + +#define Elf_shdr Elf64_shdr + +#define Elf_syms_table_entry Elf64_syms_table_entry +#define Elf_syms_table_title Elf64_syms_table_title + +#define Elf_ver_def_title Elf64_ver_def_title +#define Elf_ver_line_1 Elf64_ver_line_1 +#define Elf_ver_line_2 Elf64_ver_line_2 +#define Elf_ver_line_3 Elf64_ver_line_3 +#define Elf_ver_line_4 Elf64_ver_line_4 +#define Elf_ver_line_5 Elf64_ver_line_5 +#define Elf_ver_need_title Elf64_ver_need_title + +#else + +#define Elf_cap_entry Elf32_cap_entry +#define Elf_cap_title Elf32_cap_title + +#define Elf_demangle_name Elf32_demangle_name +#define Elf_dyn_entry Elf32_dyn_entry +#define Elf_dyn_title Elf32_dyn_title + +#define Elf_ehdr Elf32_ehdr + +#define Elf_got_entry Elf32_got_entry +#define Elf_got_title Elf32_got_title + +#define Elf_reloc_apply_reg Elf32_reloc_apply_reg +#define Elf_reloc_apply_val Elf32_reloc_apply_val +#define Elf_reloc_entry_1 Elf32_reloc_entry_1 +#define Elf_reloc_entry_2 Elf32_reloc_entry_2 +#define Elf_reloc_title Elf32_reloc_title + +#define Elf_phdr Elf32_phdr + +#define Elf_shdr Elf32_shdr + +#define Elf_syms_table_entry Elf32_syms_table_entry +#define Elf_syms_table_title Elf32_syms_table_title + +#define Elf_ver_def_title Elf32_ver_def_title +#define Elf_ver_line_1 Elf32_ver_line_1 +#define Elf_ver_line_2 Elf32_ver_line_2 +#define Elf_ver_line_3 Elf32_ver_line_3 +#define Elf_ver_line_4 Elf32_ver_line_4 +#define Elf_ver_line_5 Elf32_ver_line_5 +#define Elf_ver_need_title Elf32_ver_need_title + +#endif + +extern void Elf_cap_entry(Lm_list *, Cap *, int, Half); +extern void Elf_cap_title(Lm_list *); + +extern const char \ + *Elf_demangle_name(const char *); +extern void Elf_dyn_entry(Lm_list *, Dyn *, int, const char *, Half); +extern void Elf_dyn_title(Lm_list *); + +extern void Elf_ehdr(Lm_list *, Ehdr *, Shdr *); + +extern void Elf_got_entry(Lm_list *, Sword, Addr, Xword, Half, Word, void *, + const char *); +extern void Elf_got_title(Lm_list *); + +extern void Elf_phdr(Lm_list *, Half, Phdr *); + +extern void Elf_reloc_apply_val(Lm_list *, int, Xword, Xword); +extern void Elf_reloc_apply_reg(Lm_list *, int, Half, Xword, Xword); +extern void Elf_reloc_entry_1(Lm_list *, int, const char *, Half, Word, + void *, const char *, const char *, const char *); +extern void Elf_reloc_entry_2(Lm_list *, int, const char *, Word, + const char *, Off, Sxword, const char *, const char *, + const char *); +extern void Elf_reloc_title(Lm_list *, int, Word); + +extern void Elf_shdr(Lm_list *, Half, Shdr *); + +extern void Elf_syms_table_entry(Lm_list *, int, const char *, Half, Sym *, + Word, const char *, const char *); +extern void Elf_syms_table_title(Lm_list *, int); + +extern void Elf_ver_def_title(Lm_list *); +extern void Elf_ver_line_1(Lm_list *, const char *, const char *, + const char *, const char *); +extern void Elf_ver_line_2(Lm_list *, const char *, const char *); +extern void Elf_ver_line_3(Lm_list *, const char *, const char *, + const char *); +extern void Elf_ver_line_4(Lm_list *, const char *); +extern void Elf_ver_line_5(Lm_list *, const char *, const char *); +extern void Elf_ver_need_title(Lm_list *); #ifdef __cplusplus } diff --git a/usr/src/cmd/sgs/include/i386/machdep.h b/usr/src/cmd/sgs/include/i386/machdep.h index 00bbcc9019..911dc3aa50 100644 --- a/usr/src/cmd/sgs/include/i386/machdep.h +++ b/usr/src/cmd/sgs/include/i386/machdep.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. * * Global include file for all sgs ia32 based machine dependent macros, * constants and declarations. @@ -150,9 +149,6 @@ extern "C" { #define M_GOT_ENTSIZE 4 /* got entry size in bytes */ #endif - - - /* * Make machine class dependent functions transparent to the common code */ @@ -210,7 +206,7 @@ extern "C" { #define M_REL_SHT_TYPE SHT_RELA /* section header type */ #define M_REL_ELF_TYPE ELF_T_RELA /* data buffer type */ -#define M_REL_CONTYPSTR conv_reloc_amd64_type_str +#define M_REL_CONTYPSTR conv_reloc_amd64_type #else /* _ELF32 */ #define M_REL_DT_TYPE DT_REL /* .dynamic entry */ #define M_REL_DT_SIZE DT_RELSZ /* .dynamic entry */ @@ -219,7 +215,7 @@ extern "C" { #define M_REL_SHT_TYPE SHT_REL /* section header type */ #define M_REL_ELF_TYPE ELF_T_REL /* data buffer type */ -#define M_REL_CONTYPSTR conv_reloc_386_type_str +#define M_REL_CONTYPSTR conv_reloc_386_type #endif /* ELF32 */ /* diff --git a/usr/src/cmd/sgs/include/libld.h b/usr/src/cmd/sgs/include/libld.h index 4f1b3c14e4..1608f9d99d 100644 --- a/usr/src/cmd/sgs/include/libld.h +++ b/usr/src/cmd/sgs/include/libld.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. @@ -24,8 +23,7 @@ * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -113,7 +111,8 @@ struct ofl_desc { const char *ofl_name; /* full file name */ Elf *ofl_elf; /* elf_memory() elf descriptor */ Elf *ofl_welf; /* ELF_C_WRITE elf descriptor */ - Ehdr *ofl_ehdr; /* elf header describing this file */ + Ehdr *ofl_dehdr; /* default elf header, and new elf */ + Ehdr *ofl_nehdr; /* header describing this file */ Phdr *ofl_phdr; /* program header descriptor */ Phdr *ofl_tlsphdr; /* TLS phdr */ int ofl_fd; /* file descriptor */ @@ -161,9 +160,6 @@ struct ofl_desc { Word ofl_regsymcnt; /* no. of output register symbols */ Word ofl_lregsymcnt; /* no. of local register symbols */ Sym_desc *ofl_dtracesym; /* ld -zdtrace= */ - Half ofl_e_machine; /* elf header e_machine field setting */ - Word ofl_e_flags; /* elf header e_flags field setting */ - Word ofl_libver; /* max version that libelf can handle */ Word ofl_flags; /* various state bits, args etc. */ Word ofl_flags1; /* more flags */ Xword ofl_segorigin; /* segment origin (start) */ @@ -247,6 +243,7 @@ struct ofl_desc { Alist *ofl_dtsfltrs; /* associated .dynamic/.dynstrs */ Xword ofl_hwcap_1; /* hardware capabilities */ Xword ofl_sfcap_1; /* software capabilities */ + Lm_list *ofl_lml; /* runtime link-map list */ }; #define FLG_OF_DYNAMIC 0x00000001 /* generate dynamic output module */ @@ -319,8 +316,6 @@ struct ofl_desc { /* section */ #define FLG_OF1_TLSOREL 0x00100000 /* output relocation against .tlsbss */ /* section */ -#define FLG_OF1_DEMANGL 0x00200000 /* demangle C++ sym name diagnostics */ - #define FLG_OF1_NOHDR 0x00800000 /* no elf header/phdr alignment */ /* needed */ #define FLG_OF1_VADDR 0x01000000 /* vaddr was explicitly set */ @@ -976,54 +971,55 @@ typedef struct ar_desc { */ #define FLG_ARD_EXTRACT 0x00010000 /* archive member has been extracted */ - /* - * Function Declarations + * Function Declarations. */ -extern char *add_string(char *, char *); -extern uintptr_t create_outfile(Ofl_desc *); -extern Elf64_Off _elf_getxoff(Elf_Data *); -extern uintptr_t ent_setup(Ofl_desc *, Xword); -extern void eprintf(Error, const char *, ...); -extern uintptr_t finish_libs(Ofl_desc *); -extern int ld_main(int, char **); -extern uintptr_t ld_support_loadso(const char *); -extern void lds_start(const char *, const Half, const char *); -extern void lds_atexit(int); -extern void lds_file(const char *, const Elf_Kind, - int flags, Elf *); -extern uintptr_t lds_input_section(const char *, Shdr **, Word, - const char *, Elf_Scn *, Elf *, Ofl_desc *); -extern void lds_input_done(void); -extern void lds_section(const char *, Shdr *, Word, Elf_Data *, - Elf *); -extern Listnode *list_appendc(List *, const void *); -extern Listnode *list_insertc(List *, const void *, Listnode *); -extern Listnode *list_prependc(List *, const void *); -extern Listnode *list_where(List *, Word); -extern uintptr_t make_sections(Ofl_desc *); -extern void ofl_cleanup(Ofl_desc *); -extern uintptr_t open_outfile(Ofl_desc *); -extern Ifl_desc *process_open(const char *, size_t, int, Ofl_desc *, +#if defined(_ELF64) + +#define ld_create_outfile ld64_create_outfile +#define ld_ent_setup ld64_ent_setup +#define ld_ofl_cleanup ld64_ofl_cleanup +#define ld_make_sections ld64_make_sections +#define ld_main ld64_main +#define ld_process_open ld64_process_open +#define ld_reloc_init ld64_reloc_init +#define ld_reloc_process ld64_reloc_process +#define ld_sym_add_u ld64_sym_add_u +#define ld_sym_validate ld64_sym_validate +#define ld_update_outfile ld64_update_outfile + +#else + +#define ld_create_outfile ld32_create_outfile +#define ld_ent_setup ld32_ent_setup +#define ld_ofl_cleanup ld32_ofl_cleanup +#define ld_make_sections ld32_make_sections +#define ld_main ld32_main +#define ld_process_open ld32_process_open +#define ld_reloc_init ld32_reloc_init +#define ld_reloc_process ld32_reloc_process +#define ld_sym_add_u ld32_sym_add_u +#define ld_sym_validate ld32_sym_validate +#define ld_update_outfile ld32_update_outfile + +#endif + +extern int ld32_main(int, char **); +extern int ld64_main(int, char **); + +extern uintptr_t ld_create_outfile(Ofl_desc *); +extern uintptr_t ld_ent_setup(Ofl_desc *, Xword); +extern void ld_ofl_cleanup(Ofl_desc *); +extern uintptr_t ld_make_sections(Ofl_desc *); +extern Ifl_desc *ld_process_open(const char *, size_t, int, Ofl_desc *, Half, Rej_desc *); -extern uintptr_t reloc_init(Ofl_desc *); -extern uintptr_t reloc_process(Ofl_desc *); -extern Sdf_desc *sdf_find(const char *, List *); -extern Sdf_desc *sdf_add(const char *, List *); -extern void sec_validate(Ofl_desc *); -extern uintptr_t sunwmove_preprocess(Ofl_desc *); -extern Sym_desc *sym_add_u(const char *, Ofl_desc *); -extern Sym_desc *sym_enter(const char *, Sym *, Word, Ifl_desc *, - Ofl_desc *, Word, Word, Word, Half, - avl_index_t *); -extern Sym_desc *sym_find(const char *, Word, avl_index_t *, - Ofl_desc *); -extern uintptr_t sym_validate(Ofl_desc *); -extern uintptr_t update_outfile(Ofl_desc *); -extern Ver_desc *vers_base(Ofl_desc *); -extern uintptr_t vers_check_defs(Ofl_desc *); -extern Ver_desc *vers_desc(const char *, Word, List *); -extern Ver_desc *vers_find(const char *, Word, List *); +extern uintptr_t ld_reloc_init(Ofl_desc *); +extern uintptr_t ld_reloc_process(Ofl_desc *); +extern Sym_desc *ld_sym_add_u(const char *, Ofl_desc *); +extern uintptr_t ld_sym_validate(Ofl_desc *); +extern uintptr_t ld_update_outfile(Ofl_desc *); + +extern Elf64_Off _elf_getxoff(Elf_Data *); #ifdef __cplusplus } diff --git a/usr/src/cmd/sgs/include/rtld.h b/usr/src/cmd/sgs/include/rtld.h index 2a7c375a92..66af01f1a2 100644 --- a/usr/src/cmd/sgs/include/rtld.h +++ b/usr/src/cmd/sgs/include/rtld.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -65,7 +65,7 @@ typedef struct rt_map Rt_map; /* * A binding descriptor. Establishes the binding relationship between two - * objects, the caller (originator and the dependency (destination). + * objects, the caller (originator) and the dependency (destination). */ typedef struct { Rt_map *b_caller; /* caller (originator) of a binding */ @@ -236,7 +236,7 @@ typedef struct { #define LMC_FLG_REANALYZE 0x04 /* repeat analysis (established when */ /* interposers are added */ -typedef struct { +struct lm_list { /* * BEGIN: Exposed to rtld_db - don't move, don't delete */ @@ -257,13 +257,15 @@ typedef struct { Alist *lm_lists; /* active and pending link-map lists */ char ***lm_environ; /* pointer to environment array */ Word lm_tflags; /* transferable flags */ - int lm_obj; /* total number of objs on link-map */ - int lm_init; /* new obj since last init processing */ - int lm_lazy; /* obj with pending lazy dependencies */ -} Lm_list; + uint_t lm_obj; /* total number of objs on link-map */ + uint_t lm_init; /* new obj since last init processing */ + uint_t lm_lazy; /* obj with pending lazy dependencies */ + uint_t lm_lmid; /* unique link-map list identifier, */ + char *lm_lmidstr; /* and associated diagnostic string */ +}; #ifdef _SYSCALL32 -typedef struct { +struct lm_list32 { /* * BEGIN: Exposed to rtld_db - don't move, don't delete */ @@ -282,10 +284,12 @@ typedef struct { Elf32_Addr lm_lists; Elf32_Addr lm_environ; Elf32_Word lm_tflags; - int lm_obj; - int lm_init; - int lm_lazy; -} Lm_list32; + uint_t lm_obj; + uint_t lm_init; + uint_t lm_lazy; + uint_t lm_lmid; + Elf32_Addr lm_lmidstr; +}; #endif /* _SYSCALL32 */ /* @@ -363,8 +367,9 @@ typedef struct { * handle structure returned that describes a group of one or more objects. */ typedef struct { - Alist * gh_depends; /* handle dependency list */ - Rt_map * gh_owner; /* handle owner and the link-map */ + Alist *gh_depends; /* handle dependency list */ + Rt_map *gh_ownlmp; /* handle owners link-map */ + Lm_list *gh_ownlml; /* handle owners link-map list */ uint_t gh_refcnt; /* handle reference count */ uint_t gh_flags; /* handle flags */ } Grp_hdl; @@ -800,11 +805,8 @@ extern Lm_list lml_main; /* main's link map list */ extern Lm_list lml_rtld; /* rtld's link map list */ extern Lm_list *lml_list[]; -extern int do_reloc(uchar_t, uchar_t *, Xword *, const char *, - const char *); extern Pltbindtype elf_plt_write(uintptr_t, uintptr_t, void *, uintptr_t, Xword); -extern void eprintf(Error, const char *, ...); extern Rt_map *is_so_loaded(Lm_list *, const char *, int); extern Sym *lookup_sym(Slookup *, Rt_map **, uint_t *); extern int rt_dldump(Rt_map *, const char *, int, Addr); diff --git a/usr/src/cmd/sgs/include/sgs.h b/usr/src/cmd/sgs/include/sgs.h index df16995762..514ae44099 100644 --- a/usr/src/cmd/sgs/include/sgs.h +++ b/usr/src/cmd/sgs/include/sgs.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,13 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * * - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Global include file for all sgs. @@ -246,12 +246,21 @@ typedef struct audit_list Audit_list; typedef struct rel_desc Rel_desc; /* + * Data structures defined in rtld.h. + */ +typedef struct lm_list Lm_list; +#ifdef _SYSCALL32 +typedef struct lm_list32 Lm_list32; +#endif /* _SYSCALL32 */ + +/* * For the various utilities that include sgs.h */ +extern int assfail(const char *, const char *, int); +extern void eprintf(Lm_list *, Error, const char *, ...); extern char *sgs_demangle(char *); extern uint_t sgs_str_hash(const char *); extern uint_t findprime(uint_t); -extern int assfail(const char *, const char *, int); #endif /* _ASM */ diff --git a/usr/src/cmd/sgs/include/sparc/machdep.h b/usr/src/cmd/sgs/include/sparc/machdep.h index 656e0020f6..6782ad4245 100644 --- a/usr/src/cmd/sgs/include/sparc/machdep.h +++ b/usr/src/cmd/sgs/include/sparc/machdep.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,12 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Global include file for all sgs SPARC machine dependent macros, constants @@ -178,9 +177,6 @@ extern "C" { #define M_WORD_ALIGN 4 #endif - - - /* * Make machine class dependent functions transparent to the common code */ @@ -227,7 +223,6 @@ extern "C" { #define elf_getshdr elf32_getshdr #endif /* Elf32 */ - /* * Make common relocation information transparent to the common code */ @@ -238,7 +233,7 @@ extern "C" { #define M_REL_SHT_TYPE SHT_RELA /* section header type */ #define M_REL_ELF_TYPE ELF_T_RELA /* data buffer type */ -#define M_REL_CONTYPSTR conv_reloc_SPARC_type_str +#define M_REL_CONTYPSTR conv_reloc_SPARC_type /* * Make common relocation types transparent to the common code diff --git a/usr/src/cmd/sgs/ld/Makefile b/usr/src/cmd/sgs/ld/Makefile index 3fb5c9663e..75eeaf1889 100644 --- a/usr/src/cmd/sgs/ld/Makefile +++ b/usr/src/cmd/sgs/ld/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,10 +18,11 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -# Copyright (c) 1996 by Sun Microsystems, Inc. -# All rights reserved. +# ident "%Z%%M% %I% %E% SMI" include $(SRC)/cmd/sgs/Makefile.sub diff --git a/usr/src/cmd/sgs/ld/Makefile.com b/usr/src/cmd/sgs/ld/Makefile.com index 6236820802..b133bb87f2 100644 --- a/usr/src/cmd/sgs/ld/Makefile.com +++ b/usr/src/cmd/sgs/ld/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,49 +18,40 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -PROG= ld +PROG = ld include $(SRC)/cmd/Makefile.cmd include $(SRC)/cmd/sgs/Makefile.com -COMOBJS= ld.o -BLTOBJ= msg.o +COMOBJS = ld.o +BLTOBJ = msg.o -OBJS = $(BLTOBJ) $(MACHOBJS) $(COMOBJS) +OBJS = $(BLTOBJ) $(COMOBJS) .PARALLEL: $(OBJS) -MAPFILE= ../common/mapfile-vers - -# Building SUNWonld results in a call to the `package' target. Requirements -# needed to run this application on older releases are established: -# dlopen/dlclose requires libdl.so.1 prior to 5.10 -# -DLLIB = $(VAR_DL_LIB) -package := DLLIB = $(VAR_PKG_DL_LIB) +MAPFILE = ../common/mapfile-vers -LLDFLAGS = $(VAR_LD_LLDFLAGS) -LLDFLAGS64 = $(VAR_LD_LLDFLAGS64) -LDFLAGS += $(VERSREF) $(LAZYLOAD) $(BDIRECT) \ - $(USE_PROTO) -M$(MAPFILE) -LLDLIBS= -lelf $(DLLIB) $(CONVLIBDIR) -lconv -LLDLIBS64= -lelf $(DLLIB) $(CONVLIBDIR64) -lconv +LDFLAGS += $(VERSREF) $(LAZYLOAD) $(BDIRECT) $(USE_PROTO) -M$(MAPFILE) \ + $(VAR_LD_LLDFLAGS) +LDLIBS += $(LDLIBDIR) $(LD_LIB) $(ELFLIBDIR) -lelf \ + $(LDDBGLIBDIR) $(LDDBG_LIB) $(CONVLIBDIR) $(CONV_LIB) -LDFLAGS += $(LLDFLAGS) -LDLIBS += $(LLDLIBS) LINTFLAGS += -x -LINTFLAGS64 += -x +LINTFLAGS64 += -x $(VAR_LINTFLAGS64) + CLEANFILES += $(LINTOUTS) native := LDFLAGS = -R$(SGSPROTO) $(ZNOVERSION) -native := LLDLIBS = -L$(SGSPROTO) -lelf -ldl $(CONVLIBDIR) \ - -lconv $(VAR_LD_NATIVE_LLDLIBS) +native := LDLIBS = -L$(SGSPROTO) $(LD_LIB) -lelf $(CONVLIBDIR) \ + $(CONV_LIB) $(VAR_LD_NATIVE_LLDLIBS) BLTDEFS= msg.h BLTDATA= msg.c diff --git a/usr/src/cmd/sgs/ld/Makefile.targ b/usr/src/cmd/sgs/ld/Makefile.targ index 27f2f37620..3bc4d5ac3f 100644 --- a/usr/src/cmd/sgs/ld/Makefile.targ +++ b/usr/src/cmd/sgs/ld/Makefile.targ @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,11 +18,13 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" # -# Copyright (c) 2001 by Sun Microsystems, Inc. -# All rights reserved. all: $(PROG) diff --git a/usr/src/cmd/sgs/ld/amd64/Makefile b/usr/src/cmd/sgs/ld/amd64/Makefile index f67bde5c58..0fc37d2f27 100644 --- a/usr/src/cmd/sgs/ld/amd64/Makefile +++ b/usr/src/cmd/sgs/ld/amd64/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -28,13 +28,18 @@ include ../Makefile.com -.KEEP_STATE: +LDLIBDIR = $(LDLIBDIR64) +ELFLIBDIR = $(ELFLIBDIR64) +LDDBGLIBDIR = $(LDDBGLIBDIR64) +CONVLIBDIR = $(CONVLIBDIR64) -LLDLIBS = $(LLDLIBS64) -LLDFLAGS = $(LLDFLAGS64) -LINTFLAGS64 += $(VAR_LINTFLAGS64) +VAR_LD_LLDFLAGS = \ + $(VAR_LD_LLDFLAGS64) + +.KEEP_STATE: -ROOTCCSBINPROG= $(ROOTCCSBINPROG64) +ROOTCCSBINPROG = \ + $(ROOTCCSBINPROG64) include ../Makefile.targ include ../../Makefile.sub.64 diff --git a/usr/src/cmd/sgs/ld/common/ld.c b/usr/src/cmd/sgs/ld/common/ld.c index c2b42a7c9e..83add33a75 100644 --- a/usr/src/cmd/sgs/ld/common/ld.c +++ b/usr/src/cmd/sgs/ld/common/ld.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -36,12 +36,10 @@ #include <libintl.h> #include <locale.h> #include <fcntl.h> -#include <dlfcn.h> #include "conv.h" #include "libld.h" #include "msg.h" - /* * The following prevent us from having to include ctype.h which defines these * functions as macros which reference the __ctype[] array. Go through .plt's @@ -50,6 +48,52 @@ */ extern int isspace(int); +/* + * Print a message to stdout + */ +/* VARARGS3 */ +void +eprintf(Lm_list *lml, Error error, const char *format, ...) +{ + va_list args; + static const char *strings[ERR_NUM] = { MSG_ORIG(MSG_STR_EMPTY) }; + +#if defined(lint) + /* + * The lml argument is only meaningful for diagnostics sent to ld.so.1. + * Supress the lint error by making a dummy assignment. + */ + lml = 0; +#endif + if (error > ERR_NONE) { + if (error == ERR_WARNING) { + if (strings[ERR_WARNING] == 0) + strings[ERR_WARNING] = MSG_INTL(MSG_ERR_WARNING); + } else if (error == ERR_FATAL) { + if (strings[ERR_FATAL] == 0) + strings[ERR_FATAL] = MSG_INTL(MSG_ERR_FATAL); + } else if (error == ERR_ELF) { + if (strings[ERR_ELF] == 0) + strings[ERR_ELF] = MSG_INTL(MSG_ERR_ELF); + } + (void) fputs(MSG_ORIG(MSG_STR_LDDIAG), stderr); + } + (void) fputs(strings[error], stderr); + + va_start(args, format); + (void) vfprintf(stderr, format, args); + if (error == ERR_ELF) { + int elferr; + + if ((elferr = elf_errno()) != 0) + (void) fprintf(stderr, MSG_ORIG(MSG_STR_ELFDIAG), + elf_errmsg(elferr)); + } + (void) fprintf(stderr, MSG_ORIG(MSG_STR_NL)); + (void) fflush(stderr); + va_end(args); +} + /* * Determine whether we need the Elf32 or Elf64 libld. @@ -111,7 +155,7 @@ getmore: if ((fd = open(argv[optind], O_RDONLY)) == -1) { int err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), + eprintf(0, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), argv[optind], strerror(err)); return (0); } @@ -146,8 +190,8 @@ getmore: static int prepend_ldoptions(char *ld_options, int *argcp, char ***argvp) { - int nargc; /* New argc */ - char **nargv; /* New argv */ + int nargc; /* new argc */ + char **nargv; /* new argv */ char *arg, *string; int count; @@ -182,8 +226,11 @@ prepend_ldoptions(char *ld_options, int *argcp, char ***argvp) * Allocate a new argv array big enough to hold the new options from * the environment string and the old argv options. */ - if ((nargv = calloc(nargc + *argcp, sizeof (char *))) == 0) + if ((nargv = calloc(nargc + *argcp, sizeof (char *))) == 0) { + int err = errno; + eprintf(0, ERR_FATAL, MSG_INTL(MSG_SYS_ALLOC), strerror(err)); return (0); + } /* * Initialize first element of new argv array to be the first element @@ -224,17 +271,15 @@ prepend_ldoptions(char *ld_options, int *argcp, char ***argvp) } /* - * The ld_altexec() function checks to see if there is - * a LD_ALTEXEC=<path to alternate ld> in the environment. - * If there is - it will null that variable out - and then - * exec() the binary pointed to with the same arguements - * as the originating process. - * This permits using alternate link-editors (debugging/developer - * copies) even in complex build environments. + * Check to see if there is a LD_ALTEXEC=<path to alternate ld> in the + * environment. If so, first null the environment variable out, and then + * exec() the binary pointed to by the environment variable, passing the same + * arguments as the originating process. This mechanism permits using + * alternate link-editors (debugging/developer copies) even in complex build + * environments. * - * If LD_ALTEXEC= isn't set, or the exec() fails this - * function silently returns and the execution of this - * link-editor continues on. + * If LD_ALTEXEC= isn't set, or the exec() fails, silently return and allow the + * current link-editor to execute. */ void ld_altexec(char **argv, char **envp) @@ -273,9 +318,8 @@ ld_altexec(char **argv, char **envp) (void) execve(execstr, argv, envp); /* - * If the exec failes - we just silently fall - * through and continue execution of the - * current link-editor. + * If the exec() fails, silently fall through and continue execution of + * the current link-editor. */ } @@ -283,16 +327,12 @@ int main(int argc, char **argv, char **envp) { char *ld_options, **oargv = argv; - const char *libld = MSG_ORIG(MSG_LD_LIB32); - void *libld_h; - int (*libld_main)(int, char **); - unsigned char class; + uchar_t class; /* - * XX64 -- Strip "-Wl," from the head of each argument. - * This is to accommodate awkwardness in pasing ld arguments - * to gcc while maintaining the structure of the build - * environment's Makefiles. + * XX64 -- Strip "-Wl," from the head of each argument. This is to + * accommodate awkwardness in passing ld arguments to gcc while + * maintaining the structure of the OSNet build environment's Makefiles. */ { int i; @@ -330,52 +370,32 @@ main(int argc, char **argv, char **envp) } /* - * Locate the first input file and from it determine the class of + * Locate the first input file and from this file determine the class of * objects we're going to process. If the class is ELFCLASS64 we'll - * specifically load libld.so.3, otherwise we'll fall back to - * libld.so.2. Note that if the option -64 is encountered a 64-bit - * link is explicitly being requested. + * call the ELF64 class of interfaces, else the ELF32 class. Note that + * if the option -64 is encountered a 64-bit link is explicitly being + * requested. */ if ((class = determine_class(argc, argv)) == 0) return (1); /* - * dlopen() right libld implementation. Note: the RTLD_GLOBAL flag is - * added to make ld behave as if libld was one of its dependencies. - * Support libraries, like libldstab.so.1, may expect this, to get at - * libld_malloc, which they argueably shouldn't be using anyway. + * If we're on a 64-bit kernel, try to exec a full 64-bit version of ld. */ - if (class == ELFCLASS64) { - /* - * If we're on a 64-bit kernel, try to exec a full 64-bit - * version of ld. - */ + if (class == ELFCLASS64) conv_check_native(oargv, envp); - libld = MSG_ORIG(MSG_LD_LIB64); - } - if ((libld_h = dlopen(libld, (RTLD_LAZY | RTLD_GLOBAL))) == NULL) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_DLOPEN), libld, dlerror()); - return (1); - } - - /* - * Find ld_main(), which is ld's generic entry point. - */ - if ((libld_main = (int (*)(int, char **))dlsym(libld_h, - MSG_ORIG(MSG_LD_MAIN))) == NULL) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_DLSYM), libld, dlerror()); - return (1); - } /* - * Reset the arg counter and getopt(3c) error message flag and call the - * generic entry point. + * Reset the getopt(3c) error message flag, and call the generic entry + * point using the appropriate class. */ optind = opterr = 1; - return (libld_main(argc, argv)); + if (class == ELFCLASS64) + return (ld64_main(argc, argv)); + else + return (ld32_main(argc, argv)); } - /* * Exported interfaces required by our dependencies. libld and friends bind to * the different implementations of these provided by either ld or ld.so.1. @@ -385,42 +405,3 @@ _ld_msg(Msg mid) { return (gettext(MSG_ORIG(mid))); } - -/* - * Print a message to stdout - */ -/* VARARGS2 */ -void -eprintf(Error error, const char *format, ...) -{ - va_list args; - static const char *strings[ERR_NUM] = { MSG_ORIG(MSG_STR_EMPTY) }; - - if (error > ERR_NONE) { - if (error == ERR_WARNING) { - if (strings[ERR_WARNING] == 0) - strings[ERR_WARNING] = MSG_INTL(MSG_ERR_WARNING); - } else if (error == ERR_FATAL) { - if (strings[ERR_FATAL] == 0) - strings[ERR_FATAL] = MSG_INTL(MSG_ERR_FATAL); - } else if (error == ERR_ELF) { - if (strings[ERR_ELF] == 0) - strings[ERR_ELF] = MSG_INTL(MSG_ERR_ELF); - } - (void) fputs(MSG_ORIG(MSG_STR_LDDIAG), stderr); - } - (void) fputs(strings[error], stderr); - - va_start(args, format); - (void) vfprintf(stderr, format, args); - if (error == ERR_ELF) { - int elferr; - - if ((elferr = elf_errno()) != 0) - (void) fprintf(stderr, MSG_ORIG(MSG_STR_ELFDIAG), - elf_errmsg(elferr)); - } - (void) fprintf(stderr, MSG_ORIG(MSG_STR_NL)); - (void) fflush(stderr); - va_end(args); -} diff --git a/usr/src/cmd/sgs/ld/common/ld.msg b/usr/src/cmd/sgs/ld/common/ld.msg index ab131c79d8..65ecc23c2d 100644 --- a/usr/src/cmd/sgs/ld/common/ld.msg +++ b/usr/src/cmd/sgs/ld/common/ld.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,7 +18,12 @@ # # CDDL HEADER END # -#ident "%Z%%M% %I% %E% SMI" + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" @ _START_ @@ -33,8 +34,8 @@ # System error messages @ MSG_SYS_OPEN "file %s: open failed: %s" -@ MSG_SYS_DLOPEN "file %s: dlopen failed: %s" -@ MSG_SYS_DLSYM "file %s: dlsym failed: %s" + +@ MSG_SYS_ALLOC "alloc failed: %s" # Generic error diagnostic labels @@ -49,10 +50,6 @@ # Reference to this strings is via the MSG_ORIG() macro, and thus no message # translation is required. -@ MSG_LD_MAIN "ld_main" -@ MSG_LD_LIB32 "libld.so.2" -@ MSG_LD_LIB64 "libld.so.3" - @ MSG_STR_EMPTY "" @ MSG_STR_NL "\n" @ MSG_STR_LDDIAG "ld: " diff --git a/usr/src/cmd/sgs/ld/common/lintsup.c b/usr/src/cmd/sgs/ld/common/lintsup.c index 7218e98ed3..38bacd6838 100644 --- a/usr/src/cmd/sgs/ld/common/lintsup.c +++ b/usr/src/cmd/sgs/ld/common/lintsup.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,7 +22,7 @@ /* PROTOLIB1 */ /* - * Copyright 1999-2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -34,11 +33,11 @@ */ #include <stdlib.h> -#include "debug.h" +#include <debug.h> #include "msg.h" void exit(int status) { - dbg_print(_ld_msg((Msg)&__ld_msg[0]), status); + dbg_print(0, _ld_msg((Msg)&__ld_msg[0]), status); } diff --git a/usr/src/cmd/sgs/ld/common/mapfile-vers b/usr/src/cmd/sgs/ld/common/mapfile-vers index 096e812f6b..a5d64c2399 100644 --- a/usr/src/cmd/sgs/ld/common/mapfile-vers +++ b/usr/src/cmd/sgs/ld/common/mapfile-vers @@ -1,15 +1,9 @@ # -#ident "%Z%%M% %I% %E% SMI" -# -# 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. +# 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. @@ -25,12 +19,18 @@ # CDDL HEADER END # +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# # Specify what global symbols we export. Note that we're not really # interested in declaring a version, simply scoping the file is sufficient. { global: - main; # Provides basic adb symbol offsets + main; eprintf; local: *; diff --git a/usr/src/cmd/sgs/ld/sparcv9/Makefile b/usr/src/cmd/sgs/ld/sparcv9/Makefile index 9b3f122556..0fc37d2f27 100644 --- a/usr/src/cmd/sgs/ld/sparcv9/Makefile +++ b/usr/src/cmd/sgs/ld/sparcv9/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 1998-2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -28,13 +28,18 @@ include ../Makefile.com -.KEEP_STATE: +LDLIBDIR = $(LDLIBDIR64) +ELFLIBDIR = $(ELFLIBDIR64) +LDDBGLIBDIR = $(LDDBGLIBDIR64) +CONVLIBDIR = $(CONVLIBDIR64) -LLDLIBS = $(LLDLIBS64) -LLDFLAGS = $(LLDFLAGS64) -LINTFLAGS64 += $(VAR_LINTFLAGS64) +VAR_LD_LLDFLAGS = \ + $(VAR_LD_LLDFLAGS64) + +.KEEP_STATE: -ROOTCCSBINPROG= $(ROOTCCSBINPROG64) +ROOTCCSBINPROG = \ + $(ROOTCCSBINPROG64) include ../Makefile.targ include ../../Makefile.sub.64 diff --git a/usr/src/cmd/sgs/ldd/Makefile.com b/usr/src/cmd/sgs/ldd/Makefile.com index 06a931bef2..32cd977b47 100644 --- a/usr/src/cmd/sgs/ldd/Makefile.com +++ b/usr/src/cmd/sgs/ldd/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -50,7 +50,7 @@ CPPFLAGS += -I. -I../../include -I../../include/$(MACH) \ $(CPPFLAGS.master) LDFLAGS += $(VERSREF) $(USE_PROTO) -M$(MAPFILE) \ '-R$$ORIGIN/../lib' -LDLIBS += $(CONVLIBDIR) -lconv -lelf $(DLLIB) +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) -lelf $(DLLIB) LINTFLAGS += -x BLTDEFS= msg.h diff --git a/usr/src/cmd/sgs/libconv/Makefile b/usr/src/cmd/sgs/libconv/Makefile index 3fb5c9663e..2f70df00c7 100644 --- a/usr/src/cmd/sgs/libconv/Makefile +++ b/usr/src/cmd/sgs/libconv/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,10 +18,12 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" # -# Copyright (c) 1996 by Sun Microsystems, Inc. -# All rights reserved. include $(SRC)/cmd/sgs/Makefile.sub diff --git a/usr/src/cmd/sgs/libconv/Makefile.com b/usr/src/cmd/sgs/libconv/Makefile.com index a0046e07f9..1d6fc1f46d 100644 --- a/usr/src/cmd/sgs/libconv/Makefile.com +++ b/usr/src/cmd/sgs/libconv/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,35 +18,50 @@ # # CDDL HEADER END # + # -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# ident "%Z%%M% %I% %E% SMI" +# + +LIBRARY = libconv.a -LIBRARY= libconv.a +COMOBJS32 = cap32.o dynamic32.o \ + elf32.o globals32.o \ + phdr32.o \ + relocate_i38632.o relocate_amd6432.o \ + relocate_sparc32.o sections32.o \ + symbols32.o symbols_sparc32.o -COMOBJS_MSG= arch.o config.o \ +COMOBJS64 = cap64.o dynamic64.o \ + elf64.o globals64.o \ + phdr64.o \ + relocate_i38664.o relocate_amd6464.o \ + relocate_sparc64.o sections64.o \ + symbols64.o symbols_sparc64.o + +COMOBJS= arch.o config.o \ data.o deftag.o \ - dl.o dynamic.o \ - elf.o globals.o \ - dwarf_ehe.o \ - cap.o group.o \ - relocate_amd64.o \ - lddstub.o phdr.o \ - relocate_i386.o relocate_sparc.o \ - sections.o segments.o \ - symbols.o symbols_sparc.o \ + demangle.o dl.o \ + dwarf_ehe.o group.o \ + lddstub.o segments.o \ version.o -COMOBJS_NOMSG= relocate.o tokens.o +COMOBJS_NOMSG = tokens.o + +COMOBJS_NOMSG32 = \ + relocate32.o +COMOBJS_NOMSG64 = \ + relocate64.o ELFCAP_OBJS= elfcap.o ASOBJS= vernote.o -OBJECTS= $(COMOBJS_MSG) $(COMOBJS_NOMSG) $(ELFCAP_OBJS) $(ASOBJS) +OBJECTS = $(COMOBJS) $(COMOBJS32) $(COMOBJS64) $(COMOBJS_NOMSG) \ + $(COMOBJS_NOMSG32) $(COMOBJS_NOMSG64) $(ELFCAP_OBJS) $(ASOBJS) ELFCAP= $(SRC)/common/elfcap @@ -56,8 +70,8 @@ ELFCAP= $(SRC)/common/elfcap # Since static archives should never contain CTF data (regardless of # whether the object code is position-independent), we disable CTF. # -NOCTFOBJS= $(OBJECTS) -CTFMERGE_LIB= : +NOCTFOBJS = $(OBJECTS) +CTFMERGE_LIB = : include $(SRC)/lib/Makefile.lib include $(SRC)/cmd/sgs/Makefile.com @@ -73,21 +87,25 @@ ARFLAGS= cr AS_CPPFLAGS= -P -D_ASM $(CPPFLAGS) -BLTDATA= $(COMOBJS_MSG:%.o=%_msg.h) +BLTDATA= $(COMOBJS:%.o=%_msg.h) \ + $(COMOBJS32:%.o=%_msg.h) $(COMOBJS64:%.o=%_msg.h) SRCS= ../common/llib-lconv -LINTSRCS= $(COMOBJS_MSG:%.o=../common/%.c) \ - $(COMOBJS_NOMSG:%.o=../common/%.c) \ - $(ELFCOM_OBJS:%.o=$(ELFCAP)/%.c) \ - ../common/lintsup.c +LINTSRCS= $(COMOBJS:%.o=../common/%.c) \ + $(COMOBJS_NOMSG:%.o=../common/%.c) \ + $(ELFCOM_OBJS:%.o=$(ELFCAP)/%.c) ../common/lintsup.c +LINTSRCS32 = $(COMOBJS32:%32.o=../common/%.c) +LINTSRCS64 = $(COMOBJS64:%64.o=../common/%.c) VERNOTE_DEBUG= -D $(INTERNAL_RELEASE_BUILD)VERNOTE_DEBUG= -SGSMSGTARG= $(COMOBJS_MSG:%.o=../common/%.msg) +SGSMSGTARG= $(COMOBJS:%.o=../common/%.msg) \ + $(COMOBJS32:%32.o=../common/%.msg) \ + $(COMOBJS64:%64.o=../common/%.msg) LINTFLAGS += -u LINTFLAGS64 += -u CLEANFILES += $(BLTDATA) $(LINTOUTS) bld_vernote vernote.s -CLOBBERFILES += $(LINTLIB) +CLOBBERFILES += $(LINTLIBS) diff --git a/usr/src/cmd/sgs/libconv/Makefile.targ b/usr/src/cmd/sgs/libconv/Makefile.targ index 2874fef836..d80271602f 100644 --- a/usr/src/cmd/sgs/libconv/Makefile.targ +++ b/usr/src/cmd/sgs/libconv/Makefile.targ @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,13 @@ # # CDDL HEADER END # + # -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# ident "%Z%%M% %I% %E% SMI" +# pics/%.o: ../common/%.c $(COMPILE.c) -o $@ $< @@ -34,6 +34,14 @@ pics/%.o: %.s $(COMPILE.s) -o $@ $< $(POST_PROCESS_O) +pics/%32.o: ../common/%.c + $(COMPILE.c) -o $@ $< + $(POST_PROCESS_O) + +pics/%64.o: ../common/%.c + $(COMPILE.c) -D_ELF64 -o $@ $< + $(POST_PROCESS_O) + pics/elfcap.o: $(ELFCAP)/elfcap.c $(COMPILE.c) -DCAP_UPPERCASE -o $@ $(ELFCAP)/elfcap.c $(POST_PROCESS_O) @@ -64,10 +72,10 @@ $(LIBRARY): pics $$(PICS) chkmsg: $(LINTSRCS) sh $(CHKMSG) $(CHKMSGFLAGS) $(LINTSRCS) -lint: $(LINTLIB) $(LINTOUT32) $(SGSLINTOUT) +.PARALLEL: $(LINTOUT32) $(LINTOUT64) $(LINTLIB32) $(LINTLIB64) -$(LINTLIB): $$(SRCS) - $(LINT.c) -o $(LIBNAME) $(SRCS) > $(LINTOUT) 2>&1 +lint: $(LINTLIB32) $(LINTOUT32) $(LINTLIB64) $(LINTOUT64) \ + .WAIT $(SGSLINTOUT) catalog: diff --git a/usr/src/cmd/sgs/libconv/amd64/Makefile b/usr/src/cmd/sgs/libconv/amd64/Makefile index 656cf2753d..74c6c24d25 100644 --- a/usr/src/cmd/sgs/libconv/amd64/Makefile +++ b/usr/src/cmd/sgs/libconv/amd64/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -31,8 +31,6 @@ include ../Makefile.com .PARALLEL: $(PICS) .KEEP_STATE: -CPPFLAGS += -D_ELF64 - install all: $(LIBRARY) .WAIT include ../Makefile.targ diff --git a/usr/src/cmd/sgs/libconv/common/_conv.h b/usr/src/cmd/sgs/libconv/common/_conv.h index 0314403f3d..6ac9cd6cb9 100644 --- a/usr/src/cmd/sgs/libconv/common/_conv.h +++ b/usr/src/cmd/sgs/libconv/common/_conv.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright 1998,2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #ifndef __CONV_DOT_H @@ -39,16 +39,24 @@ extern "C" { #endif /* - * Various values that can't be matched to a symbolic definition will be - * converted to a numeric string. Each function that may require this - * fallback maintains its own static string buffer, as many conversion - * routines may be called for one final diagnostic. - * - * Most strings are printed as a 10.10s, but the string size is big - * enough for any 32 bit value. + * Some format strings differ depending on whether they are used for 32-bit + * or 64-bit values. */ -#define STRSIZE 12 -#define STRSIZE64 24 +#if defined(_ELF64) +#define MSG_GBL_FMT_DEC MSG_GBL_FMT_DEC_64 +#define MSG_GBL_FMT_DECS MSG_GBL_FMT_DECS_64 +#define MSG_GBL_FMT_HEX MSG_GBL_FMT_HEX_64 +#define MSG_GBL_FMT_HEXS MSG_GBL_FMT_HEXS_64 + +#define MSG_SYM_FMT_VAL MSG_SYM_FMT_VAL_64 +#else +#define MSG_GBL_FMT_DEC MSG_GBL_FMT_DEC_32 +#define MSG_GBL_FMT_DECS MSG_GBL_FMT_DECS_32 +#define MSG_GBL_FMT_HEX MSG_GBL_FMT_HEX_32 +#define MSG_GBL_FMT_HEXS MSG_GBL_FMT_HEXS_32 + +#define MSG_SYM_FMT_VAL MSG_SYM_FMT_VAL_32 +#endif #ifdef __cplusplus } diff --git a/usr/src/cmd/sgs/libconv/common/arch.c b/usr/src/cmd/sgs/libconv/common/arch.c index 6a228babef..5416b01c3c 100644 --- a/usr/src/cmd/sgs/libconv/common/arch.c +++ b/usr/src/cmd/sgs/libconv/common/arch.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -29,8 +29,6 @@ #include <unistd.h> #include <string.h> #include <sys/systeminfo.h> -#include <sys/param.h> -#include <sys/auxv.h> #include "_conv.h" #include "arch_msg.h" @@ -39,7 +37,7 @@ * Return the corresponding EI_CLASS constant. */ int -conv_sys_eclass() +conv_sys_eclass(void) { char buf[BUFSIZ]; @@ -62,7 +60,7 @@ conv_sys_eclass() void conv_check_native(char **argv, char **envp) { - /* ia32 & 64-bit sparc version does nothing */ + /* 64-bit version does nothing */ } #else diff --git a/usr/src/cmd/sgs/libconv/common/cap.c b/usr/src/cmd/sgs/libconv/common/cap.c index d1ca8c4a1c..6172a01275 100644 --- a/usr/src/cmd/sgs/libconv/common/cap.c +++ b/usr/src/cmd/sgs/libconv/common/cap.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -30,14 +30,13 @@ */ #include <strings.h> #include <stdio.h> -#include <limits.h> #include <sys/machelf.h> #include <elfcap.h> #include "_conv.h" #include "cap_msg.h" -void -conv_cap_1_str(uint64_t val, char *str, size_t len, ushort_t mach, +static int +conv_cap_1(Xword val, char *str, size_t len, Half mach, int (*fptr)(uint64_t, char *, size_t, int, ushort_t)) { size_t _len; @@ -47,68 +46,79 @@ conv_cap_1_str(uint64_t val, char *str, size_t len, ushort_t mach, len -= _len; str += _len; - if ((*fptr)(val, str, len, CAP_FMT_DBLSPACE, mach) == 0) { - _len = strlen(str); + if ((*fptr)(val, str, len, CAP_FMT_DBLSPACE, mach) != 0) + return (0); - if ((len - _len) >= MSG_GBL_CSQBRKT_SIZE) { - str += _len; - (void) strcpy(str, MSG_ORIG(MSG_GBL_CSQBRKT)); - } + _len = strlen(str); + if ((len - _len) >= MSG_GBL_CSQBRKT_SIZE) { + str += _len; + (void) strcpy(str, MSG_ORIG(MSG_GBL_CSQBRKT)); } + return (1); } -#define HW1SZ 100 +/* + * Establish a buffer size based on the maximum number of hardware capabilities + * that exist. See common/elfcap. + */ +#define HW1SZ 200 const char * -conv_hwcap_1_str(uint64_t val, ushort_t mach) +conv_cap_val_hw1(Xword val, Half mach) { - static char string[HW1SZ] = { '\0' }; + static char string[HW1SZ]; if (val == 0) return (MSG_ORIG(MSG_GBL_ZERO)); - conv_cap_1_str(val, string, HW1SZ, mach, hwcap_1_val2str); + if (conv_cap_1(val, string, HW1SZ, mach, hwcap_1_val2str) == 0) + return (conv_invalid_val(string, HW1SZ, val, 0)); return ((const char *)string); } -#define SF1SZ 40 +/* + * Establish a buffer size based on the maximum number of software capabilities + * that exist. See common/elfcap. + */ +#define SF1SZ 50 const char * -conv_sfcap_1_str(uint64_t val, ushort_t mach) +conv_cap_val_sf1(Xword val, Half mach) { - static char string[SF1SZ] = { '\0' }; + static char string[SF1SZ]; if (val == 0) return (MSG_ORIG(MSG_GBL_ZERO)); - conv_cap_1_str(val, string, SF1SZ, mach, sfcap_1_val2str); + if (conv_cap_1(val, string, SF1SZ, mach, sfcap_1_val2str) == 0) + return (conv_invalid_val(string, SF1SZ, val, 0)); return ((const char *)string); } -static const Msg cap_tags[] = { - MSG_CA_SUNW_NULL, MSG_CA_SUNW_HW_1, MSG_CA_SUNW_SF_1 -}; - const char * -conv_captag_str(uint64_t tag) +conv_cap_tag(Xword tag) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; + static const Msg tags[] = { + MSG_CA_SUNW_NULL, MSG_CA_SUNW_HW_1, + MSG_CA_SUNW_SF_1 + }; if (tag <= CA_SUNW_SF_1) - return (MSG_ORIG(cap_tags[tag])); + return (MSG_ORIG(tags[tag])); else - return (conv_invalid_str(string, STRSIZE, tag, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, tag, 0)); } const char * -conv_capval_str(uint64_t tag, uint64_t val, ushort_t mach) +conv_cap_val(Xword tag, Xword val, Half mach) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; if (tag == CA_SUNW_HW_1) - return (conv_hwcap_1_str(val, mach)); + return (conv_cap_val_hw1(val, mach)); else if (tag == CA_SUNW_SF_1) - return (conv_sfcap_1_str(val, mach)); + return (conv_cap_val_sf1(val, mach)); else - return (conv_invalid_str(string, STRSIZE, val, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, val, 0)); } diff --git a/usr/src/cmd/sgs/libconv/common/config.c b/usr/src/cmd/sgs/libconv/common/config.c index b31ae50fb7..f3bffa9835 100644 --- a/usr/src/cmd/sgs/libconv/common/config.c +++ b/usr/src/cmd/sgs/libconv/common/config.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -32,64 +32,62 @@ #include "_conv.h" #include "config_msg.h" -#define MODESZ MSG_GBL_OSQBRKT_SIZE + \ +#define FEATSZ MSG_GBL_OSQBRKT_SIZE + \ MSG_CONF_EDLIBPATH_SIZE + \ - MSG_CONF_ADLIBPATH_SIZE + \ MSG_CONF_ESLIBPATH_SIZE + \ + MSG_CONF_ADLIBPATH_SIZE + \ MSG_CONF_ASLIBPATH_SIZE + \ MSG_CONF_DIRCFG_SIZE + \ MSG_CONF_OBJALT_SIZE + \ + MSG_CONF_MEMRESV_SIZE + \ MSG_CONF_ENVS_SIZE + \ - MSG_GBL_CSQBRKT_SIZE + MSG_CONF_FLTR_SIZE + \ + CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE /* * String conversion routine for configuration file information. */ const char * -conv_config_str(int feature) +conv_config_feat(int features) { - static char string[MODESZ] = { '\0' }; - - (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); - - if (feature & CONF_EDLIBPATH) - (void) strcat(string, MSG_ORIG(MSG_CONF_EDLIBPATH)); - if (feature & CONF_ESLIBPATH) - (void) strcat(string, MSG_ORIG(MSG_CONF_ESLIBPATH)); - if (feature & CONF_ADLIBPATH) - (void) strcat(string, MSG_ORIG(MSG_CONF_ADLIBPATH)); - if (feature & CONF_ASLIBPATH) - (void) strcat(string, MSG_ORIG(MSG_CONF_ASLIBPATH)); - if (feature & CONF_DIRCFG) - (void) strcat(string, MSG_ORIG(MSG_CONF_DIRCFG)); - if (feature & CONF_OBJALT) - (void) strcat(string, MSG_ORIG(MSG_CONF_OBJALT)); - if (feature & CONF_MEMRESV) - (void) strcat(string, MSG_ORIG(MSG_CONF_MEMRESV)); - if (feature & CONF_ENVS) - (void) strcat(string, MSG_ORIG(MSG_CONF_ENVS)); - if (feature & CONF_FLTR) - (void) strcat(string, MSG_ORIG(MSG_CONF_FLTR)); - - (void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT)); + static char string[FEATSZ]; + static Val_desc vda[] = { + { CONF_EDLIBPATH, MSG_ORIG(MSG_CONF_EDLIBPATH) }, + { CONF_ESLIBPATH, MSG_ORIG(MSG_CONF_ESLIBPATH) }, + { CONF_ADLIBPATH, MSG_ORIG(MSG_CONF_ADLIBPATH) }, + { CONF_ASLIBPATH, MSG_ORIG(MSG_CONF_ASLIBPATH) }, + { CONF_DIRCFG, MSG_ORIG(MSG_CONF_DIRCFG) }, + { CONF_OBJALT, MSG_ORIG(MSG_CONF_OBJALT) }, + { CONF_MEMRESV, MSG_ORIG(MSG_CONF_MEMRESV) }, + { CONF_ENVS, MSG_ORIG(MSG_CONF_ENVS) }, + { CONF_FLTR, MSG_ORIG(MSG_CONF_FLTR) }, + { 0, 0 } + }; + + (void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FEATSZ); + if (conv_expn_field(string, FEATSZ, vda, features, + features, 0, 0)) + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FEATSZ); return ((const char *)string); } #define FLAGSZ MSG_GBL_OSQBRKT_SIZE + \ MSG_CONF_DIRENT_SIZE + \ - MSG_CONF_NOEXIST_SIZE + \ MSG_CONF_ALLENTS_SIZE + \ + MSG_CONF_NOEXIST_SIZE + \ MSG_CONF_EXEC_SIZE + \ MSG_CONF_ALTER_SIZE + \ + MSG_CONF_OPTIONAL_SIZE + \ MSG_CONF_DUMP_SIZE + \ MSG_CONF_REALPATH_SIZE + \ + MSG_CONF_NOALTER_SIZE + \ MSG_CONF_GROUP_SIZE + \ MSG_CONF_APP_SIZE + \ MSG_CONF_CMDLINE_SIZE + \ MSG_CONF_FILTER_SIZE + \ MSG_CONF_FILTEE_SIZE + \ - MSG_GBL_CSQBRKT_SIZE + CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE /* * String conversion routine for object flags. @@ -97,45 +95,46 @@ conv_config_str(int feature) const char * conv_config_obj(ushort_t flags) { - static char string[FLAGSZ] = { '\0' }; - - (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); - - if (flags & RTC_OBJ_DIRENT) - (void) strcat(string, MSG_ORIG(MSG_CONF_DIRENT)); - if (flags & RTC_OBJ_ALLENTS) - (void) strcat(string, MSG_ORIG(MSG_CONF_ALLENTS)); - if (flags & RTC_OBJ_NOEXIST) - (void) strcat(string, MSG_ORIG(MSG_CONF_NOEXIST)); - if (flags & RTC_OBJ_EXEC) - (void) strcat(string, MSG_ORIG(MSG_CONF_EXEC)); - if (flags & RTC_OBJ_ALTER) { - if (flags & RTC_OBJ_OPTINAL) - (void) strcat(string, MSG_ORIG(MSG_CONF_OPTIONAL)); - else - (void) strcat(string, MSG_ORIG(MSG_CONF_ALTER)); - } - if (flags & RTC_OBJ_DUMP) - (void) strcat(string, MSG_ORIG(MSG_CONF_DUMP)); - if (flags & RTC_OBJ_REALPTH) - (void) strcat(string, MSG_ORIG(MSG_CONF_REALPATH)); - if (flags & RTC_OBJ_GROUP) - (void) strcat(string, MSG_ORIG(MSG_CONF_GROUP)); - if (flags & RTC_OBJ_APP) - (void) strcat(string, MSG_ORIG(MSG_CONF_APP)); - if (flags & RTC_OBJ_CMDLINE) - (void) strcat(string, MSG_ORIG(MSG_CONF_CMDLINE)); - if (flags & RTC_OBJ_FILTER) - (void) strcat(string, MSG_ORIG(MSG_CONF_FILTER)); - if (flags & RTC_OBJ_FILTEE) - (void) strcat(string, MSG_ORIG(MSG_CONF_FILTEE)); - - (void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT)); - - if (strlen(string) == (MSG_GBL_OSQBRKT_SIZE + MSG_GBL_CSQBRKT_SIZE)) + static char string[FLAGSZ]; + static Val_desc vda[] = { + { RTC_OBJ_DIRENT, MSG_ORIG(MSG_CONF_DIRENT) }, + { RTC_OBJ_ALLENTS, MSG_ORIG(MSG_CONF_ALLENTS) }, + { RTC_OBJ_NOEXIST, MSG_ORIG(MSG_CONF_NOEXIST) }, + { RTC_OBJ_EXEC, MSG_ORIG(MSG_CONF_EXEC) }, + { RTC_OBJ_ALTER, MSG_ORIG(MSG_CONF_ALTER) }, + { RTC_OBJ_DUMP, MSG_ORIG(MSG_CONF_DUMP) }, + { RTC_OBJ_NOALTER, MSG_ORIG(MSG_CONF_NOALTER) }, + { RTC_OBJ_REALPTH, MSG_ORIG(MSG_CONF_REALPATH) }, + { RTC_OBJ_GROUP, MSG_ORIG(MSG_CONF_GROUP) }, + { RTC_OBJ_APP, MSG_ORIG(MSG_CONF_APP) }, + { RTC_OBJ_CMDLINE, MSG_ORIG(MSG_CONF_CMDLINE) }, + { RTC_OBJ_FILTER, MSG_ORIG(MSG_CONF_FILTER) }, + { RTC_OBJ_FILTEE, MSG_ORIG(MSG_CONF_FILTEE) }, + { 0, 0 } + }; + ushort_t _flags = flags; + + if ((flags == 0) || (flags == RTC_OBJ_OPTINAL)) return (MSG_ORIG(MSG_GBL_NULL)); - else - return ((const char *)string); + + (void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAGSZ); + + /* + * Print an alternative-optional object simply as optional. + */ + if ((flags & (RTC_OBJ_ALTER | RTC_OBJ_OPTINAL)) == + (RTC_OBJ_ALTER | RTC_OBJ_OPTINAL)) { + if (strlcat(string, MSG_ORIG(MSG_CONF_OPTIONAL), + FLAGSZ) >= FLAGSZ) + return (conv_invalid_val(string, FLAGSZ, flags, 0)); + flags = _flags &= ~(RTC_OBJ_ALTER | RTC_OBJ_OPTINAL); + } + flags = _flags &= ~RTC_OBJ_OPTINAL; + + if (conv_expn_field(string, FLAGSZ, vda, flags, _flags, 0, 0)) + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ); + + return ((const char *)string); } /* @@ -149,7 +148,7 @@ conv_config_obj(ushort_t flags) * /local/lib:/opt/sfw/lib:/lib:/usr/lib */ const char * -conv_upm_string(const char *str, const char *old, const char *new, +conv_config_upm(const char *str, const char *old, const char *new, size_t newlen) { const char *curstr, *ptr; diff --git a/usr/src/cmd/sgs/libconv/common/config.msg b/usr/src/cmd/sgs/libconv/common/config.msg index 6f2f700b05..169e828caa 100644 --- a/usr/src/cmd/sgs/libconv/common/config.msg +++ b/usr/src/cmd/sgs/libconv/common/config.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,6 +18,11 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# # ident "%Z%%M% %I% %E% SMI" # # Message file for cmd/sgs/libconv/common/config.c @@ -44,6 +45,7 @@ @ MSG_CONF_ALTER " ALTERNATE " @ MSG_CONF_DUMP " DUMPED " @ MSG_CONF_REALPATH " REALPATH " +@ MSG_CONF_NOALTER " NO-ALTERNATE " @ MSG_CONF_GROUP " GROUP " @ MSG_CONF_APP " SPECIFIC-APP " @ MSG_CONF_CMDLINE " COMMAND-LINE " diff --git a/usr/src/cmd/sgs/libconv/common/data.c b/usr/src/cmd/sgs/libconv/common/data.c index 69849c44b1..ec0027b4a9 100644 --- a/usr/src/cmd/sgs/libconv/common/data.c +++ b/usr/src/cmd/sgs/libconv/common/data.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,36 +18,40 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ + #pragma ident "%Z%%M% %I% %E% SMI" /* * String conversion routine for Elf data buffer types. */ -#include <stdio.h> #include "_conv.h" #include "data_msg.h" -static const Msg types[] = { - MSG_DATA_BYTE, MSG_DATA_ADDR, MSG_DATA_DYN, - MSG_DATA_EHDR, MSG_DATA_HALF, MSG_DATA_OFF, - MSG_DATA_PHDR, MSG_DATA_RELA, MSG_DATA_REL, - MSG_DATA_SHDR, MSG_DATA_SWORD, MSG_DATA_SYM, - MSG_DATA_WORD, MSG_DATA_VDEF, MSG_DATA_VNEED, - MSG_DATA_SXWORD, MSG_DATA_XWORD, MSG_DATA_SYMINFO, - MSG_DATA_NOTE, MSG_DATA_MOVE, MSG_DATA_MOVEP -}; - const char * -conv_d_type_str(Elf_Type type) +conv_elfdata_type(Elf_Type type) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; + static const Msg types[] = { + MSG_DATA_BYTE, MSG_DATA_ADDR, + MSG_DATA_DYN, MSG_DATA_EHDR, + MSG_DATA_HALF, MSG_DATA_OFF, + MSG_DATA_PHDR, MSG_DATA_RELA, + MSG_DATA_REL, MSG_DATA_SHDR, + MSG_DATA_SWORD, MSG_DATA_SYM, + MSG_DATA_WORD, MSG_DATA_VDEF, + MSG_DATA_VNEED, MSG_DATA_SXWORD, + MSG_DATA_XWORD, MSG_DATA_SYMINFO, + MSG_DATA_NOTE, MSG_DATA_MOVE, + MSG_DATA_MOVEP, MSG_DATA_CAP + }; if (type >= ELF_T_NUM) - return (conv_invalid_str(string, STRSIZE, type, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, type, 0)); else return (MSG_ORIG(types[type])); } diff --git a/usr/src/cmd/sgs/libconv/common/data.msg b/usr/src/cmd/sgs/libconv/common/data.msg index c081d74d8a..4f4590b935 100644 --- a/usr/src/cmd/sgs/libconv/common/data.msg +++ b/usr/src/cmd/sgs/libconv/common/data.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,9 +18,12 @@ # # CDDL HEADER END # -# ident "%Z%%M% %I% %E% SMI" + # -# Message file for cmd/sgs/libconv/common/data.c +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" @ MSG_DATA_BYTE "BYTE" @ MSG_DATA_ADDR "ADDR" @@ -47,3 +46,4 @@ @ MSG_DATA_NOTE "NOTE" @ MSG_DATA_MOVE "MOVE" @ MSG_DATA_MOVEP "MOVEP" +@ MSG_DATA_CAP "CAP" diff --git a/usr/src/cmd/sgs/libconv/common/deftag.c b/usr/src/cmd/sgs/libconv/common/deftag.c index a193feca12..38b61567da 100644 --- a/usr/src/cmd/sgs/libconv/common/deftag.c +++ b/usr/src/cmd/sgs/libconv/common/deftag.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -28,21 +28,19 @@ /* * String conversion routine for symbol references. */ -#include <stdio.h> #include "_conv.h" #include "deftag_msg.h" -static const Msg refs[] = { - MSG_REF_DYN_SEEN, MSG_REF_DYN_NEED, MSG_REF_REL_NEED -}; - const char * -conv_deftag_str(Symref ref) +conv_def_tag(Symref ref) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; + static const Msg refs[] = { + MSG_REF_DYN_SEEN, MSG_REF_DYN_NEED, MSG_REF_REL_NEED + }; if (ref >= REF_NUM) - return (conv_invalid_str(string, STRSIZE, ref, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, ref, 0)); else return (MSG_ORIG(refs[ref])); } diff --git a/usr/src/cmd/sgs/libconv/common/deftag.msg b/usr/src/cmd/sgs/libconv/common/deftag.msg index 39554ea23f..27a6860192 100644 --- a/usr/src/cmd/sgs/libconv/common/deftag.msg +++ b/usr/src/cmd/sgs/libconv/common/deftag.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,9 +18,12 @@ # # CDDL HEADER END # -# ident "%Z%%M% %I% %E% SMI" + # -# Message file for cmd/sgs/libconv/common/deftag.c +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" @ MSG_REF_DYN_SEEN "REF_DYN_SEEN" @ MSG_REF_DYN_NEED "REF_DYN_NEED" diff --git a/usr/src/cmd/sgs/libconv/common/demangle.c b/usr/src/cmd/sgs/libconv/common/demangle.c new file mode 100644 index 0000000000..aa3589a51c --- /dev/null +++ b/usr/src/cmd/sgs/libconv/common/demangle.c @@ -0,0 +1,118 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <stdio.h> +#include <demangle.h> +#include "_conv.h" +#include "demangle_msg.h" + +/* + * Demangle C++ symbols. + * + * This routine acts as a generic routine for use by liblddbg (and hence tools + * like elfdump(1) and pvs(1)), ld(1) and ld.so.1(1). + * + * The C++ ABI-2 places no limits on symbol names, thus when demangling a name + * it's possible the buffer won't be big enough (DEMANGLE_ESPACE) so here we + * try to allocate bigger buffers. However, we place a limit on this buffer + * size for fear of a C++ error sending us into an infinit loop. + * + * NOTE. we create and use a common buffer for use by cplus_demangle(), thus + * each call to this routine will override the contents of any existing call. + * Normally this is sufficient for typical error diagnostics referencing one + * symbol. For those diagnostics using more than one symbol name, all but the + * last name must be copied to a temporary buffer (regardless of whether + * demangling occurred, as the process of attempting to demangle may damage the + * buffer). One model is: + * + * if ((_name1 = demangle(name1)) != name1) { + * char * __name1 = alloca(strlen(_name1) + 1); + * (void) strcpy(__name1, _name1); + * name1 = (const char *)__name1; + * } + * name2 = demangle(name2); + * eprintf(format, name1, name2); + */ +#define SYM_MAX 1000 + +const char * +conv_demangle_name(const char *name) +{ + static char _str[SYM_MAX], *str = _str; + static size_t size = SYM_MAX; + static int again = 1; + static int (*fptr)() = 0; + int error; + + if (str == 0) + return (name); + + /* + * If we haven't located the demangler yet try now (we do this rather + * than maintain a static dependency on libdemangle as it's part of an + * optional package). Null the str element out to reject any other + * callers until this operation is complete - under ld.so.1 we can get + * into serious recursion without this. + */ + if (fptr == 0) { + void *hdl; + + str = 0; + if (!(hdl = dlopen(MSG_ORIG(MSG_DEM_LIB), RTLD_LAZY)) || + !(fptr = (int (*)())dlsym(hdl, MSG_ORIG(MSG_DEM_SYM)))) + return (name); + str = _str; + } + + if ((error = (*fptr)(name, str, size)) == 0) + return ((const char *)str); + + while ((error == DEMANGLE_ESPACE) && again) { + char *_str; + size_t _size = size; + + /* + * If we haven't allocated our maximum try incrementing the + * present buffer size. Use malloc() rather than realloc() so + * that we at least have the old buffer on failure. + */ + if (((_size += SYM_MAX) > (SYM_MAX * 4)) || + ((_str = malloc(_size)) == 0)) { + again = 0; + break; + } + if (size != SYM_MAX) { + free(str); + } + str = _str; + size = _size; + + if ((error = (*fptr)(name, str, size)) == 0) + return ((const char *)str); + } + return (name); +} diff --git a/usr/src/cmd/sgs/libelf/spec/Makefile b/usr/src/cmd/sgs/libconv/common/demangle.msg index 79634503a9..c7cbeaf921 100644 --- a/usr/src/cmd/sgs/libelf/spec/Makefile +++ b/usr/src/cmd/sgs/libconv/common/demangle.msg @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,14 +18,13 @@ # # CDDL HEADER END # + # -# Copyright (c) 1997-1999 by Sun Microsystems, Inc. -# All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" # -# cmd/sgs/libelf/spec/Makefile - -include $(SRC)/lib/Makefile.spec.arch -chkmsg: +@ MSG_DEM_SYM "cplus_demangle" +@ MSG_DEM_LIB "libdemangle.so.1" diff --git a/usr/src/cmd/sgs/libconv/common/dl.c b/usr/src/cmd/sgs/libconv/common/dl.c index a04ffd4d53..31adc67bcf 100644 --- a/usr/src/cmd/sgs/libconv/common/dl.c +++ b/usr/src/cmd/sgs/libconv/common/dl.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -31,78 +31,72 @@ #define MODESZ MSG_GBL_OSQBRKT_SIZE + \ MSG_RTLD_LAZY_SIZE + \ - MSG_RTLD_NOLOAD_SIZE + \ MSG_RTLD_GLOBAL_SIZE + \ + MSG_RTLD_NOLOAD_SIZE + \ MSG_RTLD_PARENT_SIZE + \ MSG_RTLD_GROUP_SIZE + \ MSG_RTLD_WORLD_SIZE + \ MSG_RTLD_NODELETE_SIZE + \ MSG_RTLD_FIRST_SIZE + \ MSG_RTLD_CONFGEN_SIZE + \ - MSG_GBL_CSQBRKT_SIZE + CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE + /* * String conversion routine for dlopen() attributes. */ const char * -conv_dlmode_str(int mode, int fabricate) +conv_dl_mode(int mode, int fabricate) { - static char string[MODESZ] = { '\0' }; + static char string[MODESZ]; + static Val_desc vda[] = { + { RTLD_NOLOAD, MSG_ORIG(MSG_RTLD_NOLOAD) }, + { RTLD_PARENT, MSG_ORIG(MSG_RTLD_PARENT) }, + { RTLD_GROUP, MSG_ORIG(MSG_RTLD_GROUP) }, + { RTLD_WORLD, MSG_ORIG(MSG_RTLD_WORLD) }, + { RTLD_NODELETE, MSG_ORIG(MSG_RTLD_NODELETE) }, + { RTLD_FIRST, MSG_ORIG(MSG_RTLD_FIRST) }, + { RTLD_CONFGEN, MSG_ORIG(MSG_RTLD_CONFGEN) }, + { 0, 0 } + }; + int _mode = mode; (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); - if (mode & RTLD_NOW) - (void) strcat(string, MSG_ORIG(MSG_RTLD_NOW)); - else if (fabricate) - (void) strcat(string, MSG_ORIG(MSG_RTLD_LAZY)); - - if (mode & RTLD_NOLOAD) - (void) strcat(string, MSG_ORIG(MSG_RTLD_NOLOAD)); - - if (mode & RTLD_GLOBAL) - (void) strcat(string, MSG_ORIG(MSG_RTLD_GLOBAL)); - else if (fabricate) - (void) strcat(string, MSG_ORIG(MSG_RTLD_LOCAL)); - - if (mode & RTLD_PARENT) - (void) strcat(string, MSG_ORIG(MSG_RTLD_PARENT)); - if (mode & RTLD_GROUP) - (void) strcat(string, MSG_ORIG(MSG_RTLD_GROUP)); - if (mode & RTLD_WORLD) - (void) strcat(string, MSG_ORIG(MSG_RTLD_WORLD)); - if (mode & RTLD_NODELETE) - (void) strcat(string, MSG_ORIG(MSG_RTLD_NODELETE)); - if (mode & RTLD_FIRST) - (void) strcat(string, MSG_ORIG(MSG_RTLD_FIRST)); - if (mode & RTLD_CONFGEN) - (void) strcat(string, MSG_ORIG(MSG_RTLD_CONFGEN)); - - (void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT)); + if (mode & RTLD_NOW) { + if (strlcat(string, MSG_ORIG(MSG_RTLD_NOW), MODESZ) >= MODESZ) + return (conv_invalid_val(string, MODESZ, mode, 0)); + } else if (fabricate) { + if (strlcat(string, MSG_ORIG(MSG_RTLD_LAZY), MODESZ) >= MODESZ) + return (conv_invalid_val(string, MODESZ, mode, 0)); + } + if (mode & RTLD_GLOBAL) { + if (strlcat(string, MSG_ORIG(MSG_RTLD_GLOBAL), MODESZ) >= MODESZ) + return (conv_invalid_val(string, MODESZ, mode, 0)); + } else if (fabricate) { + if (strlcat(string, MSG_ORIG(MSG_RTLD_LOCAL), MODESZ) >= MODESZ) + return (conv_invalid_val(string, MODESZ, mode, 0)); + } + _mode &= ~(RTLD_LAZY | RTLD_NOW | RTLD_GLOBAL); + + if (conv_expn_field(string, MODESZ, vda, mode, _mode, 0, 0)) + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), MODESZ); return ((const char *)string); } #define FLAGSZ MSG_GBL_OSQBRKT_SIZE + \ - MSG_RTLD_REL_RELATIVE_SIZE + \ - MSG_GBL_SEP_SIZE + \ - MSG_RTLD_REL_EXEC_SIZE + \ - MSG_GBL_SEP_SIZE + \ - MSG_RTLD_REL_DEPENDS_SIZE + \ - MSG_GBL_SEP_SIZE + \ - MSG_RTLD_REL_PRELOAD_SIZE + \ - MSG_GBL_SEP_SIZE + \ - MSG_RTLD_REL_SELF_SIZE + \ - MSG_GBL_SEP_SIZE + \ - MSG_RTLD_REL_WEAK_SIZE + \ - MSG_GBL_SEP_SIZE + \ - MSG_RTLD_MEMORY_SIZE + \ - MSG_GBL_SEP_SIZE + \ - MSG_RTLD_STRIP_SIZE + \ - MSG_GBL_SEP_SIZE + \ - MSG_RTLD_NOHEAP_SIZE + \ - MSG_GBL_SEP_SIZE + \ + MSG_RTLD_REL_RELATIVE_SIZE + MSG_GBL_SEP_SIZE + \ + MSG_RTLD_REL_EXEC_SIZE + MSG_GBL_SEP_SIZE + \ + MSG_RTLD_REL_DEPENDS_SIZE + MSG_GBL_SEP_SIZE + \ + MSG_RTLD_REL_PRELOAD_SIZE + MSG_GBL_SEP_SIZE + \ + MSG_RTLD_REL_SELF_SIZE + MSG_GBL_SEP_SIZE + \ + MSG_RTLD_REL_WEAK_SIZE + MSG_GBL_SEP_SIZE + \ + MSG_RTLD_MEMORY_SIZE + MSG_GBL_SEP_SIZE + \ + MSG_RTLD_STRIP_SIZE + MSG_GBL_SEP_SIZE + \ + MSG_RTLD_NOHEAP_SIZE + MSG_GBL_SEP_SIZE + \ MSG_RTLD_CONFSET_SIZE + \ - MSG_GBL_CSQBRKT_SIZE + CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE /* * String conversion routine for dldump() flags. @@ -110,79 +104,46 @@ conv_dlmode_str(int mode, int fabricate) * we build a "|" separated string. */ const char * -conv_dlflag_str(int flags, int separator) +conv_dl_flag(int flags, int separator) { - static char string[FLAGSZ] = { '\0' }; - int element = 0; + static char string[FLAGSZ]; + static Val_desc vda[] = { + { RTLD_REL_RELATIVE, MSG_ORIG(MSG_RTLD_REL_RELATIVE) }, + { RTLD_REL_EXEC, MSG_ORIG(MSG_RTLD_REL_EXEC) }, + { RTLD_REL_DEPENDS, MSG_ORIG(MSG_RTLD_REL_DEPENDS) }, + { RTLD_REL_PRELOAD, MSG_ORIG(MSG_RTLD_REL_PRELOAD) }, + { RTLD_REL_SELF, MSG_ORIG(MSG_RTLD_REL_SELF) }, + { RTLD_REL_WEAK, MSG_ORIG(MSG_RTLD_REL_WEAK) }, + { RTLD_MEMORY, MSG_ORIG(MSG_RTLD_MEMORY) }, + { RTLD_STRIP, MSG_ORIG(MSG_RTLD_STRIP) }, + { RTLD_NOHEAP, MSG_ORIG(MSG_RTLD_NOHEAP) }, + { RTLD_CONFSET, MSG_ORIG(MSG_RTLD_CONFSET) }, + { 0, 0 } + }; + int _flags = flags, element = 0; if (flags == 0) return (MSG_ORIG(MSG_GBL_ZERO)); if (separator) - (void) strcpy(string, MSG_ORIG(MSG_GBL_QUOTE)); + (void) strlcpy(string, MSG_ORIG(MSG_GBL_QUOTE), FLAGSZ); else - (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); + (void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAGSZ); if ((flags & RTLD_REL_ALL) == RTLD_REL_ALL) { - (void) strcat(string, MSG_ORIG(MSG_RTLD_REL_ALL)); - element++; - } else { - if (flags & RTLD_REL_RELATIVE) { - (void) strcat(string, MSG_ORIG(MSG_RTLD_REL_RELATIVE)); - element++; - } - if (flags & RTLD_REL_EXEC) { - if (separator && element++) - (void) strcat(string, MSG_ORIG(MSG_GBL_SEP)); - (void) strcat(string, MSG_ORIG(MSG_RTLD_REL_EXEC)); - } - if (flags & RTLD_REL_DEPENDS) { - if (separator && element++) - (void) strcat(string, MSG_ORIG(MSG_GBL_SEP)); - (void) strcat(string, MSG_ORIG(MSG_RTLD_REL_DEPENDS)); - } - if (flags & RTLD_REL_PRELOAD) { - if (separator && element++) - (void) strcat(string, MSG_ORIG(MSG_GBL_SEP)); - (void) strcat(string, MSG_ORIG(MSG_RTLD_REL_PRELOAD)); - } - if (flags & RTLD_REL_SELF) { - if (separator && element++) - (void) strcat(string, MSG_ORIG(MSG_GBL_SEP)); - (void) strcat(string, MSG_ORIG(MSG_RTLD_REL_SELF)); - } - if (flags & RTLD_REL_WEAK) { - if (separator && element++) - (void) strcat(string, MSG_ORIG(MSG_GBL_SEP)); - (void) strcat(string, MSG_ORIG(MSG_RTLD_REL_WEAK)); - } + if (strlcat(string, MSG_ORIG(MSG_RTLD_REL_ALL), FLAGSZ) >= FLAGSZ) + return (conv_invalid_val(string, FLAGSZ, flags, 0)); + element++; + flags = _flags &= ~RTLD_REL_ALL; } - if (flags & RTLD_MEMORY) { - if (separator && element++) - (void) strcat(string, MSG_ORIG(MSG_GBL_SEP)); - (void) strcat(string, MSG_ORIG(MSG_RTLD_MEMORY)); + if (conv_expn_field(string, FLAGSZ, vda, flags, _flags, + (separator ? MSG_ORIG(MSG_GBL_SEP) : 0), element)) { + if (separator) + (void) strlcat(string, MSG_ORIG(MSG_GBL_QUOTE), FLAGSZ); + else + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ); } - if (flags & RTLD_STRIP) { - if (separator && element++) - (void) strcat(string, MSG_ORIG(MSG_GBL_SEP)); - (void) strcat(string, MSG_ORIG(MSG_RTLD_STRIP)); - } - if (flags & RTLD_NOHEAP) { - if (separator && element++) - (void) strcat(string, MSG_ORIG(MSG_GBL_SEP)); - (void) strcat(string, MSG_ORIG(MSG_RTLD_NOHEAP)); - } - if (flags & RTLD_CONFSET) { - if (separator && element++) - (void) strcat(string, MSG_ORIG(MSG_GBL_SEP)); - (void) strcat(string, MSG_ORIG(MSG_RTLD_CONFSET)); - } - - if (separator) - (void) strcat(string, MSG_ORIG(MSG_GBL_QUOTE)); - else - (void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT)); return ((const char *)string); } diff --git a/usr/src/cmd/sgs/libconv/common/dwarf_ehe.c b/usr/src/cmd/sgs/libconv/common/dwarf_ehe.c index 6cbf141671..e7a0dc94bb 100644 --- a/usr/src/cmd/sgs/libconv/common/dwarf_ehe.c +++ b/usr/src/cmd/sgs/libconv/common/dwarf_ehe.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,89 +18,96 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <strings.h> -#include <stdio.h> -#include <limits.h> #include <dwarf.h> #include <dwarf_ehe_msg.h> +#include "_conv.h" + +#define FLAGSZ MSG_GBL_OSQBRKT_SIZE + \ + MSG_DWEHE_SLEB128_SIZE + \ + MSG_DWEHE_INDIRECT_SIZE + \ + CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE -#define STRBUFSIZE 128 const char * -conv_dwarf_ehe_str(uint_t flags) +conv_dwarf_ehe(uint_t flags) { - static char string[STRBUFSIZE]; + static char string[FLAGSZ]; + size_t ret = 0; - (void) strncpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), STRBUFSIZE); + (void) strncpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAGSZ); - if (flags == DW_EH_PE_omit) { - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_OMIT), STRBUFSIZE); - (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), STRBUFSIZE); - return (string); - } - if (flags == DW_EH_PE_absptr) { - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_ABSPTR), STRBUFSIZE); - (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), STRBUFSIZE); + if (flags == DW_EH_PE_omit) + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_OMIT), FLAGSZ); + else if (flags == DW_EH_PE_absptr) + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_ABSPTR), FLAGSZ); + + if (ret >= FLAGSZ) + return (conv_invalid_val(string, FLAGSZ, flags, 0)); + + if ((flags == DW_EH_PE_omit) || (flags == DW_EH_PE_absptr)) { + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ); return (string); } switch (flags & 0x0f) { - case DW_EH_PE_absptr: - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_ABSPTR), STRBUFSIZE); - break; case DW_EH_PE_uleb128: - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_ULEB128), STRBUFSIZE); + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_ULEB128), FLAGSZ); break; case DW_EH_PE_udata2: - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_UDATA2), STRBUFSIZE); + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_UDATA2), FLAGSZ); break; case DW_EH_PE_udata4: - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_UDATA4), STRBUFSIZE); + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_UDATA4), FLAGSZ); break; case DW_EH_PE_udata8: - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_UDATA8), STRBUFSIZE); + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_UDATA8), FLAGSZ); break; case DW_EH_PE_sleb128: - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_SLEB128), STRBUFSIZE); + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_SLEB128), FLAGSZ); break; case DW_EH_PE_sdata2: - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_SDATA2), STRBUFSIZE); + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_SDATA2), FLAGSZ); break; case DW_EH_PE_sdata4: - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_SDATA4), STRBUFSIZE); + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_SDATA4), FLAGSZ); break; case DW_EH_PE_sdata8: - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_SDATA8), STRBUFSIZE); + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_SDATA8), FLAGSZ); break; } + if (ret >= FLAGSZ) + return (conv_invalid_val(string, FLAGSZ, flags, 0)); switch (flags & 0xf0) { case DW_EH_PE_pcrel: - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_PCREL), STRBUFSIZE); + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_PCREL), FLAGSZ); break; case DW_EH_PE_textrel: - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_TEXTREL), STRBUFSIZE); + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_TEXTREL), FLAGSZ); break; case DW_EH_PE_datarel: - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_DATAREL), STRBUFSIZE); + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_DATAREL), FLAGSZ); break; case DW_EH_PE_funcrel: - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_FUNCREL), STRBUFSIZE); + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_FUNCREL), FLAGSZ); break; case DW_EH_PE_aligned: - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_ALIGNED), STRBUFSIZE); + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_ALIGNED), FLAGSZ); break; case DW_EH_PE_indirect: - (void) strlcat(string, MSG_ORIG(MSG_DWEHE_INDIRECT), - STRBUFSIZE); + ret = strlcat(string, MSG_ORIG(MSG_DWEHE_INDIRECT), FLAGSZ); break; } + if (ret >= FLAGSZ) + return (conv_invalid_val(string, FLAGSZ, flags, 0)); - (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), STRBUFSIZE); + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ); return (string); } diff --git a/usr/src/cmd/sgs/libconv/common/dwarf_ehe.msg b/usr/src/cmd/sgs/libconv/common/dwarf_ehe.msg index 2d5b75ca4f..69d74cb862 100644 --- a/usr/src/cmd/sgs/libconv/common/dwarf_ehe.msg +++ b/usr/src/cmd/sgs/libconv/common/dwarf_ehe.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,28 +18,31 @@ # # CDDL HEADER END # -# ident "%Z%%M% %I% %E% SMI" + # -# Message file for cmd/sgs/libconv/common/dwarf_ehe.c +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +@ MSG_DWEHE_OMIT " omit " +@ MSG_DWEHE_ABSPTR " absptr " -@ MSG_DWEHE_OMIT "omit " -@ MSG_DWEHE_ABSPTR "absptr " -@ MSG_DWEHE_ULEB128 "uleb128 " -@ MSG_DWEHE_UDATA2 "udata2 " -@ MSG_DWEHE_UDATA4 "udata4 " -@ MSG_DWEHE_UDATA8 "udata8 " -@ MSG_DWEHE_SLEB128 "sleb128 " -@ MSG_DWEHE_SDATA2 "sdata2 " -@ MSG_DWEHE_SDATA4 "sdata4 " -@ MSG_DWEHE_SDATA8 "sdata8 " +@ MSG_DWEHE_ULEB128 " uleb128 " +@ MSG_DWEHE_UDATA2 " udata2 " +@ MSG_DWEHE_UDATA4 " udata4 " +@ MSG_DWEHE_UDATA8 " udata8 " +@ MSG_DWEHE_SLEB128 " sleb128 " +@ MSG_DWEHE_SDATA2 " sdata2 " +@ MSG_DWEHE_SDATA4 " sdata4 " +@ MSG_DWEHE_SDATA8 " sdata8 " -@ MSG_DWEHE_PCREL "pcrel " -@ MSG_DWEHE_TEXTREL "textrel " -@ MSG_DWEHE_DATAREL "datarel " -@ MSG_DWEHE_FUNCREL "funcrel " -@ MSG_DWEHE_ALIGNED "aligned " -@ MSG_DWEHE_INDIRECT "indirect " +@ MSG_DWEHE_PCREL " pcrel " +@ MSG_DWEHE_TEXTREL " textrel " +@ MSG_DWEHE_DATAREL " datarel " +@ MSG_DWEHE_FUNCREL " funcrel " +@ MSG_DWEHE_ALIGNED " aligned " +@ MSG_DWEHE_INDIRECT " indirect " -@ MSG_GBL_OSQBRKT "[ " +@ MSG_GBL_OSQBRKT "[" @ MSG_GBL_CSQBRKT "]" diff --git a/usr/src/cmd/sgs/libconv/common/dynamic.c b/usr/src/cmd/sgs/libconv/common/dynamic.c index 6607cf5d02..3392af6a78 100644 --- a/usr/src/cmd/sgs/libconv/common/dynamic.c +++ b/usr/src/cmd/sgs/libconv/common/dynamic.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -38,60 +38,62 @@ #define POSSZ MSG_GBL_OSQBRKT_SIZE + \ MSG_DFP_LAZYLOAD_SIZE + \ MSG_DFP_GROUPPERM_SIZE + \ - MSG_GBL_CSQBRKT_SIZE + CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE const char * -conv_dynposflag_1_str(uint_t flags) +conv_dyn_posflag1(Xword flags) { - static char string[POSSZ] = { '\0' }; + static char string[POSSZ]; + static Val_desc vda[] = { + { DF_P1_LAZYLOAD, MSG_ORIG(MSG_DFP_LAZYLOAD) }, + { DF_P1_GROUPPERM, MSG_ORIG(MSG_DFP_GROUPPERM) }, + { 0, 0 } + }; + if (flags == 0) return (MSG_ORIG(MSG_GBL_ZERO)); - (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); - - if (flags & DF_P1_LAZYLOAD) - (void) strcat(string, MSG_ORIG(MSG_DFP_LAZYLOAD)); - if (flags & DF_P1_GROUPPERM) - (void) strcat(string, MSG_ORIG(MSG_DFP_GROUPPERM)); - - (void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT)); + (void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), POSSZ); + if (conv_expn_field(string, POSSZ, vda, flags, flags, 0, 0)) + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), POSSZ); return ((const char *)string); } -#define FLAGSZ MSG_DF_ORIGIN_SIZE + \ +#define FLAGSZ MSG_GBL_OSQBRKT_SIZE + \ + MSG_DF_ORIGIN_SIZE + \ MSG_DF_SYMBOLIC_SIZE + \ MSG_DF_TEXTREL_SIZE + \ MSG_DF_BIND_NOW_SIZE + \ - MSG_DF_STATIC_TLS_SIZE + MSG_DF_STATIC_TLS_SIZE + \ + CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE const char * -conv_dynflag_str(uint_t flags) +conv_dyn_flag(Xword flags) { - static char string[FLAGSZ] = { '\0' }; + static char string[FLAGSZ]; + static Val_desc vda[] = { + { DF_ORIGIN, MSG_ORIG(MSG_DF_ORIGIN) }, + { DF_SYMBOLIC, MSG_ORIG(MSG_DF_SYMBOLIC) }, + { DF_TEXTREL, MSG_ORIG(MSG_DF_TEXTREL) }, + { DF_BIND_NOW, MSG_ORIG(MSG_DF_BIND_NOW) }, + { DF_STATIC_TLS, MSG_ORIG(MSG_DF_STATIC_TLS) }, + { 0, 0 } + }; + if (flags == 0) return (MSG_ORIG(MSG_GBL_ZERO)); - else { - (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); - if (flags & DF_ORIGIN) - (void) strcat(string, MSG_ORIG(MSG_DF_ORIGIN)); - if (flags & DF_SYMBOLIC) - (void) strcat(string, MSG_ORIG(MSG_DF_SYMBOLIC)); - if (flags & DF_TEXTREL) - (void) strcat(string, MSG_ORIG(MSG_DF_TEXTREL)); - if (flags & DF_BIND_NOW) - (void) strcat(string, MSG_ORIG(MSG_DF_BIND_NOW)); - if (flags & DF_STATIC_TLS) - (void) strcat(string, MSG_ORIG(MSG_DF_STATIC_TLS)); - - (void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT)); - - return ((const char *)string); - } + + (void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAGSZ); + if (conv_expn_field(string, FLAGSZ, vda, flags, flags, 0, 0)) + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ); + + return ((const char *)string); } #define FLAG1SZ MSG_GBL_OSQBRKT_SIZE + \ MSG_DF1_NOW_SIZE + \ + MSG_DF1_GLOBAL_SIZE + \ MSG_DF1_GROUP_SIZE + \ MSG_DF1_NODELETE_SIZE + \ MSG_DF1_LOADFLTR_SIZE + \ @@ -111,116 +113,101 @@ conv_dynflag_str(uint_t flags) MSG_DF1_IGNMULDEF_SIZE + \ MSG_DF1_NOKSYMS_SIZE + \ MSG_DF1_NORELOC_SIZE + \ - MSG_GBL_CSQBRKT_SIZE + CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE const char * -conv_dynflag_1_str(uint_t flags) +conv_dyn_flag1(Xword flags) { - static char string[FLAG1SZ] = { '\0' }; + static char string[FLAG1SZ]; + static Val_desc vda[] = { + { DF_1_NOW, MSG_ORIG(MSG_DF_ORIGIN) }, + { DF_1_GLOBAL, MSG_ORIG(MSG_DF1_GLOBAL) }, + { DF_1_GROUP, MSG_ORIG(MSG_DF1_GROUP) }, + { DF_1_NODELETE, MSG_ORIG(MSG_DF1_NODELETE) }, + { DF_1_LOADFLTR, MSG_ORIG(MSG_DF1_LOADFLTR) }, + { DF_1_INITFIRST, MSG_ORIG(MSG_DF1_INITFIRST) }, + { DF_1_NOOPEN, MSG_ORIG(MSG_DF1_NOOPEN) }, + { DF_1_ORIGIN, MSG_ORIG(MSG_DF1_ORIGIN) }, + { DF_1_DIRECT, MSG_ORIG(MSG_DF1_DIRECT) }, + { DF_1_TRANS, MSG_ORIG(MSG_DF1_TRANS) }, + { DF_1_INTERPOSE, MSG_ORIG(MSG_DF1_INTERPOSE) }, + { DF_1_NODEFLIB, MSG_ORIG(MSG_DF1_NODEFLIB) }, + { DF_1_NODUMP, MSG_ORIG(MSG_DF1_NODUMP) }, + { DF_1_CONFALT, MSG_ORIG(MSG_DF1_CONFALT) }, + { DF_1_ENDFILTEE, MSG_ORIG(MSG_DF1_ENDFILTEE) }, + { DF_1_DISPRELPND, MSG_ORIG(MSG_DF1_DISPRELPND) }, + { DF_1_DISPRELDNE, MSG_ORIG(MSG_DF1_DISPRELDNE) }, + { DF_1_NODIRECT, MSG_ORIG(MSG_DF1_NODIRECT) }, + { DF_1_IGNMULDEF, MSG_ORIG(MSG_DF1_IGNMULDEF) }, + { DF_1_NOKSYMS, MSG_ORIG(MSG_DF1_NOKSYMS) }, + { DF_1_NORELOC, MSG_ORIG(MSG_DF1_NORELOC) }, + { 0, 0 } + }; if (flags == 0) return (MSG_ORIG(MSG_GBL_ZERO)); - else { - (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); - - if (flags & DF_1_NOW) - (void) strcat(string, MSG_ORIG(MSG_DF1_NOW)); - if (flags & DF_1_GROUP) - (void) strcat(string, MSG_ORIG(MSG_DF1_GROUP)); - if (flags & DF_1_NODELETE) - (void) strcat(string, MSG_ORIG(MSG_DF1_NODELETE)); - if (flags & DF_1_LOADFLTR) - (void) strcat(string, MSG_ORIG(MSG_DF1_LOADFLTR)); - if (flags & DF_1_INITFIRST) - (void) strcat(string, MSG_ORIG(MSG_DF1_INITFIRST)); - if (flags & DF_1_NOOPEN) - (void) strcat(string, MSG_ORIG(MSG_DF1_NOOPEN)); - if (flags & DF_1_ORIGIN) - (void) strcat(string, MSG_ORIG(MSG_DF1_ORIGIN)); - if (flags & DF_1_DIRECT) - (void) strcat(string, MSG_ORIG(MSG_DF1_DIRECT)); - if (flags & DF_1_TRANS) - (void) strcat(string, MSG_ORIG(MSG_DF1_TRANS)); - if (flags & DF_1_INTERPOSE) - (void) strcat(string, MSG_ORIG(MSG_DF1_INTERPOSE)); - if (flags & DF_1_NODEFLIB) - (void) strcat(string, MSG_ORIG(MSG_DF1_NODEFLIB)); - if (flags & DF_1_NODUMP) - (void) strcat(string, MSG_ORIG(MSG_DF1_NODUMP)); - if (flags & DF_1_CONFALT) - (void) strcat(string, MSG_ORIG(MSG_DF1_CONFALT)); - if (flags & DF_1_ENDFILTEE) - (void) strcat(string, MSG_ORIG(MSG_DF1_ENDFILTEE)); - if (flags & DF_1_DISPRELPND) - (void) strcat(string, MSG_ORIG(MSG_DF1_DISPRELPND)); - if (flags & DF_1_DISPRELDNE) - (void) strcat(string, MSG_ORIG(MSG_DF1_DISPRELDNE)); - if (flags & DF_1_NODIRECT) - (void) strcat(string, MSG_ORIG(MSG_DF1_NODIRECT)); - if (flags & DF_1_IGNMULDEF) - (void) strcat(string, MSG_ORIG(MSG_DF1_IGNMULDEF)); - if (flags & DF_1_NOKSYMS) - (void) strcat(string, MSG_ORIG(MSG_DF1_NOKSYMS)); - if (flags & DF_1_NORELOC) - (void) strcat(string, MSG_ORIG(MSG_DF1_NORELOC)); - - (void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT)); - - return ((const char *)string); - } + + (void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAG1SZ); + if (conv_expn_field(string, FLAG1SZ, vda, flags, flags, 0, 0)) + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAG1SZ); + + return ((const char *)string); } #define FEATSZ MSG_GBL_OSQBRKT_SIZE + \ MSG_DTF_PARINIT_SIZE + \ MSG_DTF_CONFEXP_SIZE + \ - MSG_GBL_CSQBRKT_SIZE + CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE const char * -conv_dynfeature_1_str(uint_t flags) +conv_dyn_feature1(Xword flags) { - static char string[FEATSZ] = { '\0' }; + static char string[FEATSZ]; + static Val_desc vda[] = { + { DTF_1_PARINIT, MSG_ORIG(MSG_DTF_PARINIT) }, + { DTF_1_CONFEXP, MSG_ORIG(MSG_DTF_CONFEXP) }, + { 0, 0 } + }; if (flags == 0) return (MSG_ORIG(MSG_GBL_ZERO)); - else { - (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); - - if (flags & DTF_1_PARINIT) - (void) strcat(string, MSG_ORIG(MSG_DTF_PARINIT)); - if (flags & DTF_1_CONFEXP) - (void) strcat(string, MSG_ORIG(MSG_DTF_CONFEXP)); - (void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT)); + (void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FEATSZ); + if (conv_expn_field(string, FEATSZ, vda, flags, flags, 0, 0)) + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FEATSZ); - return ((const char *)string); - } + return ((const char *)string); } -const Msg _dyntag_tags[DT_MAXPOSTAGS] = { - MSG_DYN_NULL, MSG_DYN_NEEDED, MSG_DYN_PLTRELSZ, - MSG_DYN_PLTGOT, MSG_DYN_HASH, MSG_DYN_STRTAB, - MSG_DYN_SYMTAB, MSG_DYN_RELA, MSG_DYN_RELASZ, - MSG_DYN_RELAENT, MSG_DYN_STRSZ, MSG_DYN_SYMENT, - MSG_DYN_INIT, MSG_DYN_FINI, MSG_DYN_SONAME, - MSG_DYN_RPATH, MSG_DYN_SYMBOLIC, MSG_DYN_REL, - MSG_DYN_RELSZ, MSG_DYN_RELENT, MSG_DYN_PLTREL, - MSG_DYN_DEBUG, MSG_DYN_TEXTREL, MSG_DYN_JMPREL, - MSG_DYN_BIND_NOW, MSG_DYN_INIT_ARRAY, MSG_DYN_FINI_ARRAY, - MSG_DYN_INIT_ARRAYSZ, MSG_DYN_FINI_ARRAYSZ, MSG_DYN_RUNPATH, - MSG_DYN_FLAGS, MSG_DYN_NULL, MSG_DYN_PREINIT_ARRAY, - MSG_DYN_PREINIT_ARRAYSZ -}; - const char * -conv_dyntag_str(uint64_t tag, ushort_t mach) +conv_dyn_tag(Xword tag, Half mach) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; + static const Msg tags[DT_MAXPOSTAGS] = { + MSG_DYN_NULL, MSG_DYN_NEEDED, + MSG_DYN_PLTRELSZ, MSG_DYN_PLTGOT, + MSG_DYN_HASH, MSG_DYN_STRTAB, + MSG_DYN_SYMTAB, MSG_DYN_RELA, + MSG_DYN_RELASZ, MSG_DYN_RELAENT, + MSG_DYN_STRSZ, MSG_DYN_SYMENT, + MSG_DYN_INIT, MSG_DYN_FINI, + MSG_DYN_SONAME, MSG_DYN_RPATH, + MSG_DYN_SYMBOLIC, MSG_DYN_REL, + MSG_DYN_RELSZ, MSG_DYN_RELENT, + MSG_DYN_PLTREL, MSG_DYN_DEBUG, + MSG_DYN_TEXTREL, MSG_DYN_JMPREL, + MSG_DYN_BIND_NOW, MSG_DYN_INIT_ARRAY, + MSG_DYN_FINI_ARRAY, MSG_DYN_INIT_ARRAYSZ, + MSG_DYN_FINI_ARRAYSZ, MSG_DYN_RUNPATH, + MSG_DYN_FLAGS, MSG_DYN_NULL, + MSG_DYN_PREINIT_ARRAY, MSG_DYN_PREINIT_ARRAYSZ + }; if (tag < DT_MAXPOSTAGS) { /* * Generic dynamic tags. */ - return (MSG_ORIG(_dyntag_tags[tag])); + return (MSG_ORIG(tags[tag])); } else { /* * SUNW: DT_LOOS -> DT_HIOS range. @@ -306,65 +293,65 @@ conv_dyntag_str(uint64_t tag, ushort_t mach) else if (tag == DT_DEPRECATED_SPARC_REGISTER) return (MSG_ORIG(MSG_DYN_REGISTER)); else - return (conv_invalid_str(string, STRSIZE, tag, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, + tag, 0)); } } -#define BINDESZ MSG_GBL_OSQBRKT_SIZE + \ +#define BINDTSZ MSG_GBL_OSQBRKT_SIZE + \ MSG_BND_NEEDED_SIZE + \ MSG_BND_REFER_SIZE + \ MSG_BND_FILTER_SIZE + \ - MSG_GBL_CSQBRKT_SIZE + CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE const char * -conv_bindent_str(uint_t flags) +conv_bnd_type(uint_t flags) { - static char string[BINDESZ] = { '\0' }; + static char string[BINDTSZ]; + static Val_desc vda[] = { + { BND_NEEDED, MSG_ORIG(MSG_BND_NEEDED) }, + { BND_REFER, MSG_ORIG(MSG_BND_REFER) }, + { BND_FILTER, MSG_ORIG(MSG_BND_FILTER) }, + { 0, 0 } + }; - /* - * Evaluate the binding descriptors flags. - */ - if (flags) { - (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); - if (flags & BND_NEEDED) - (void) strcat(string, MSG_ORIG(MSG_BND_NEEDED)); - if (flags & BND_REFER) - (void) strcat(string, MSG_ORIG(MSG_BND_REFER)); - if (flags & BND_FILTER) - (void) strcat(string, MSG_ORIG(MSG_BND_FILTER)); - (void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT)); - - return ((const char *)string); - } else + if (flags == 0) return (MSG_ORIG(MSG_STR_EMPTY)); + + (void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), BINDTSZ); + if (conv_expn_field(string, BINDTSZ, vda, flags, flags, 0, 0)) + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), BINDTSZ); + + return ((const char *)string); } -#define BINDSSZ MSG_GBL_OSQBRKT_SIZE + \ +#define BINDOSZ MSG_GBL_OSQBRKT_SIZE + \ MSG_BND_ADDED_SIZE + \ MSG_BND_REEVAL_SIZE + \ MSG_GBL_CSQBRKT_SIZE const char * -conv_binding_str(uint_t flags) +conv_bnd_obj(uint_t flags) { - static char string[BINDSSZ] = { '\0' }; + static char string[BINDOSZ]; + static Val_desc vda[] = { + { LML_FLG_OBJADDED, MSG_ORIG(MSG_BND_ADDED) }, + { LML_FLG_OBJREEVAL, MSG_ORIG(MSG_BND_REEVAL) }, + { LML_FLG_OBJDELETED, MSG_ORIG(MSG_BND_DELETED) }, + { LML_FLG_ATEXIT, MSG_ORIG(MSG_BND_ATEXIT) }, + { 0, 0 } + }; + + if (flags == 0) + return (MSG_ORIG(MSG_STR_EMPTY)); /* - * Evaluate the binding descriptors flags. + * Note, we're not worried about unknown flags for this family, only + * the selected flags are of interest. */ - if (flags) { - (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); - if (flags & LML_FLG_OBJADDED) - (void) strcat(string, MSG_ORIG(MSG_BND_ADDED)); - if (flags & LML_FLG_OBJREEVAL) - (void) strcat(string, MSG_ORIG(MSG_BND_REEVAL)); - if (flags & LML_FLG_OBJDELETED) - (void) strcat(string, MSG_ORIG(MSG_BND_DELETED)); - if (flags & LML_FLG_ATEXIT) - (void) strcat(string, MSG_ORIG(MSG_BND_ATEXIT)); - (void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT)); - - return ((const char *)string); - } else - return (MSG_ORIG(MSG_STR_EMPTY)); + (void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), BINDOSZ); + if (conv_expn_field(string, BINDOSZ, vda, flags, 0, 0, 0)) + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), BINDOSZ); + + return ((const char *)string); } diff --git a/usr/src/cmd/sgs/libconv/common/dynamic.msg b/usr/src/cmd/sgs/libconv/common/dynamic.msg index 66dd55e1fb..b4d13b9971 100644 --- a/usr/src/cmd/sgs/libconv/common/dynamic.msg +++ b/usr/src/cmd/sgs/libconv/common/dynamic.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,9 +18,12 @@ # # CDDL HEADER END # -# ident "%Z%%M% %I% %E% SMI" + # -# Message file for cmd/sgs/libconv/common/dynamic.c +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" @ MSG_DYN_NULL "NULL" @ MSG_DYN_NEEDED "NEEDED" @@ -100,6 +99,7 @@ @ MSG_DF_STATIC_TLS " STATIC_TLS " @ MSG_DF1_NOW " NOW " +@ MSG_DF1_GLOBAL " GLOBAL " @ MSG_DF1_GROUP " GROUP " @ MSG_DF1_NODELETE " NODELETE " @ MSG_DF1_LOADFLTR " LOADFILTER " diff --git a/usr/src/cmd/sgs/libconv/common/elf.c b/usr/src/cmd/sgs/libconv/common/elf.c index fcd163d825..a37ed82ad8 100644 --- a/usr/src/cmd/sgs/libconv/common/elf.c +++ b/usr/src/cmd/sgs/libconv/common/elf.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -34,252 +34,168 @@ #include "elf_msg.h" #include <sys/elf_SPARC.h> -static const Msg classes[] = { - MSG_ELFCLASSNONE, MSG_ELFCLASS32, MSG_ELFCLASS64 -}; - const char * -conv_eclass_str(uchar_t class) +conv_ehdr_class(uchar_t class) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; + static const Msg classes[] = { + MSG_ELFCLASSNONE, MSG_ELFCLASS32, MSG_ELFCLASS64 + }; if (class >= ELFCLASSNUM) - return (conv_invalid_str(string, STRSIZE, class, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, class, 0)); else return (MSG_ORIG(classes[class])); - } -static const Msg datas[] = { - MSG_ELFDATANONE, MSG_ELFDATA2LSB, MSG_ELFDATA2MSB -}; - const char * -conv_edata_str(uchar_t data) +conv_ehdr_data(uchar_t data) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; + static const Msg datas[] = { + MSG_ELFDATANONE, MSG_ELFDATA2LSB, MSG_ELFDATA2MSB + }; if (data >= ELFDATANUM) - return (conv_invalid_str(string, STRSIZE, data, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, data, 0)); else return (MSG_ORIG(datas[data])); - } static const Msg machines[EM_NUM] = { - MSG_EM_NONE, - MSG_EM_M32, - MSG_EM_SPARC, - MSG_EM_386, - MSG_EM_68K, - MSG_EM_88K, - MSG_EM_486, - MSG_EM_860, - MSG_EM_MIPS, - MSG_EM_UNKNOWN9, - MSG_EM_MIPS_RS3_LE, - MSG_EM_RS6000, - MSG_EM_UNKNOWN12, - MSG_EM_UNKNOWN13, - MSG_EM_UNKNOWN14, - MSG_EM_PA_RISC, - MSG_EM_nCUBE, - MSG_EM_VPP500, - MSG_EM_SPARC32PLUS, - MSG_EM_UNKNOWN19, - MSG_EM_PPC, - MSG_EM_PPC64, - MSG_EM_UNKNOWN22, - MSG_EM_UNKNOWN23, - MSG_EM_UNKNOWN24, - MSG_EM_UNKNOWN25, - MSG_EM_UNKNOWN26, - MSG_EM_UNKNOWN27, - MSG_EM_UNKNOWN28, - MSG_EM_UNKNOWN29, - MSG_EM_UNKNOWN30, - MSG_EM_UNKNOWN31, - MSG_EM_UNKNOWN32, - MSG_EM_UNKNOWN33, - MSG_EM_UNKNOWN34, - MSG_EM_UNKNOWN35, - MSG_EM_Y800, - MSG_EM_FR20, - MSG_EM_RH32, - MSG_EM_RCE, - MSG_EM_ARM, - MSG_EM_ALPHA, - MSG_EM_SH, - MSG_EM_SPARCV9, - MSG_EM_TRICORE, - MSG_EM_ARC, - MSG_EM_H8_300, - MSG_EM_H8_300H, - MSG_EM_H8S, - MSG_EM_H8_500, - MSG_EM_IA_64, - MSG_EM_MIPS_X, - MSG_EM_COLDFIRE, - MSG_EM_68HC12, - MSG_EM_MMA, - MSG_EM_PCP, - MSG_EM_NCPU, - MSG_EM_NDR1, - MSG_EM_STARCORE, - MSG_EM_ME16, - MSG_EM_ST100, - MSG_EM_TINYJ, - MSG_EM_AMD64, - MSG_EM_UNKNOWN63, - MSG_EM_UNKNOWN64, - MSG_EM_UNKNOWN65, - MSG_EM_FX66, - MSG_EM_ST9PLUS, - MSG_EM_ST7, - MSG_EM_68HC16, - MSG_EM_68HC11, - MSG_EM_68HC08, - MSG_EM_68HC05, - MSG_EM_SVX, - MSG_EM_ST19, - MSG_EM_VAX, - MSG_EM_CRIS, - MSG_EM_JAVELIN, - MSG_EM_FIREPATH, - MSG_EM_ZSP, - MSG_EM_MMIX, - MSG_EM_HUANY, - MSG_EM_PRISM, - MSG_EM_AVR, - MSG_EM_FR30, - MSG_EM_D10V, - MSG_EM_D30V, - MSG_EM_V850, - MSG_EM_M32R, - MSG_EM_MN10300, - MSG_EM_MN10200, - MSG_EM_PJ, - MSG_EM_OPENRISC, - MSG_EM_ARC_A5, - MSG_EM_XTENSA + MSG_EM_NONE, MSG_EM_M32, MSG_EM_SPARC, + MSG_EM_386, MSG_EM_68K, MSG_EM_88K, + MSG_EM_486, MSG_EM_860, MSG_EM_MIPS, + MSG_EM_UNKNOWN9, MSG_EM_MIPS_RS3_LE, MSG_EM_RS6000, + MSG_EM_UNKNOWN12, MSG_EM_UNKNOWN13, MSG_EM_UNKNOWN14, + MSG_EM_PA_RISC, MSG_EM_nCUBE, MSG_EM_VPP500, + MSG_EM_SPARC32PLUS, MSG_EM_UNKNOWN19, MSG_EM_PPC, + MSG_EM_PPC64, MSG_EM_UNKNOWN22, MSG_EM_UNKNOWN23, + MSG_EM_UNKNOWN24, MSG_EM_UNKNOWN25, MSG_EM_UNKNOWN26, + MSG_EM_UNKNOWN27, MSG_EM_UNKNOWN28, MSG_EM_UNKNOWN29, + MSG_EM_UNKNOWN30, MSG_EM_UNKNOWN31, MSG_EM_UNKNOWN32, + MSG_EM_UNKNOWN33, MSG_EM_UNKNOWN34, MSG_EM_UNKNOWN35, + MSG_EM_Y800, MSG_EM_FR20, MSG_EM_RH32, + MSG_EM_RCE, MSG_EM_ARM, MSG_EM_ALPHA, + MSG_EM_SH, MSG_EM_SPARCV9, MSG_EM_TRICORE, + MSG_EM_ARC, MSG_EM_H8_300, MSG_EM_H8_300H, + MSG_EM_H8S, MSG_EM_H8_500, MSG_EM_IA_64, + MSG_EM_MIPS_X, MSG_EM_COLDFIRE, MSG_EM_68HC12, + MSG_EM_MMA, MSG_EM_PCP, MSG_EM_NCPU, + MSG_EM_NDR1, MSG_EM_STARCORE, MSG_EM_ME16, + MSG_EM_ST100, MSG_EM_TINYJ, MSG_EM_AMD64, + MSG_EM_UNKNOWN63, MSG_EM_UNKNOWN64, MSG_EM_UNKNOWN65, + MSG_EM_FX66, MSG_EM_ST9PLUS, MSG_EM_ST7, + MSG_EM_68HC16, MSG_EM_68HC11, MSG_EM_68HC08, + MSG_EM_68HC05, MSG_EM_SVX, MSG_EM_ST19, + MSG_EM_VAX, MSG_EM_CRIS, MSG_EM_JAVELIN, + MSG_EM_FIREPATH, MSG_EM_ZSP, MSG_EM_MMIX, + MSG_EM_HUANY, MSG_EM_PRISM, MSG_EM_AVR, + MSG_EM_FR30, MSG_EM_D10V, MSG_EM_D30V, + MSG_EM_V850, MSG_EM_M32R, MSG_EM_MN10300, + MSG_EM_MN10200, MSG_EM_PJ, MSG_EM_OPENRISC, + MSG_EM_ARC_A5, MSG_EM_XTENSA }; +#if (EM_NUM != (EM_XTENSA + 1)) +#error "EM_NUM has grown" +#endif const char * -conv_emach_str(ushort_t machine) +conv_ehdr_mach(Half machine) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; - /* - * In order to assure that all values included in sys/elf.h::EM_* are - * included in libconv/elfdump for decoding - we have the below - * #define trap. Each time the machines[] table is updated, make - * sure the following entry is updated. - */ -#if (EM_NUM != (EM_XTENSA + 1)) -#error "EM_NUM has grown" -#endif if (machine >= (EM_NUM)) - return (conv_invalid_str(string, STRSIZE, machine, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, machine, 0)); else return (MSG_ORIG(machines[machine])); - } -static const Msg etypes[] = { - MSG_ET_NONE, MSG_ET_REL, MSG_ET_EXEC, - MSG_ET_DYN, MSG_ET_CORE -}; - const char * -conv_etype_str(ushort_t etype) +conv_ehdr_type(Half etype) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; + static const Msg etypes[] = { + MSG_ET_NONE, MSG_ET_REL, MSG_ET_EXEC, + MSG_ET_DYN, MSG_ET_CORE + }; if (etype == ET_SUNWPSEUDO) return (MSG_ORIG(MSG_ET_SUNWPSEUDO)); else if (etype >= ET_NUM) - return (conv_invalid_str(string, STRSIZE, etype, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, etype, 0)); else return (MSG_ORIG(etypes[etype])); } -static const Msg versions[] = { - MSG_EV_NONE, MSG_EV_CURRENT -}; - const char * -conv_ever_str(uint_t version) +conv_ehdr_vers(Word version) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; + static const Msg versions[] = { + MSG_EV_NONE, MSG_EV_CURRENT + }; if (version >= EV_NUM) - return (conv_invalid_str(string, STRSIZE, version, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, version, 0)); else return (MSG_ORIG(versions[version])); } - -static const Msg mm_flags[] = { - MSG_EF_SPARCV9_TSO, MSG_EF_SPARCV9_PSO, MSG_EF_SPARCV9_RMO -}; - #define EFLAGSZ MSG_GBL_OSQBRKT_SIZE + \ MSG_EF_SPARCV9_TSO_SIZE + \ MSG_EF_SPARC_SUN_US1_SIZE + \ MSG_EF_SPARC_HAL_R1_SIZE + \ MSG_EF_SPARC_SUN_US3_SIZE + \ - MSG_GBL_CSQBRKT_SIZE + CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE /* - * Valid vendor extension bits for SPARCV9. This must be updated along with - * elf_SPARC.h. + * Make a string representation of the e_flags field. */ const char * -conv_eflags_str(ushort_t mach, uint_t flags) +conv_ehdr_flags(Half mach, Word flags) { - static char string[EFLAGSZ] = { '\0' }; + static char string[EFLAGSZ]; + static Val_desc vda[] = { + { EF_SPARC_32PLUS, MSG_ORIG(MSG_EF_SPARC_32PLUS) }, + { EF_SPARC_SUN_US1, MSG_ORIG(MSG_EF_SPARC_SUN_US1) }, + { EF_SPARC_HAL_R1, MSG_ORIG(MSG_EF_SPARC_HAL_R1) }, + { EF_SPARC_SUN_US3, MSG_ORIG(MSG_EF_SPARC_SUN_US3) }, + { 0, 0 } + }; + static const Msg mm_flags[] = { + MSG_EF_SPARCV9_TSO, MSG_EF_SPARCV9_PSO, + MSG_EF_SPARCV9_RMO + }; + Word _flags = flags; /* - * Make a string representation of the e_flags field. If any bogus - * bits are set, then just return a string containing the numeric value. + * Non-SPARC architectures presently provide no known flags. */ if ((mach == EM_SPARCV9) || (((mach == EM_SPARC) || (mach == EM_SPARC32PLUS)) && flags)) { - uint_t _flags = flags; - + /* + * Valid vendor extension bits for SPARCV9. These must be + * updated along with elf_SPARC.h. + */ (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); - if (mach == EM_SPARCV9) { - (void) strcat(string, MSG_ORIG(mm_flags[flags & - EF_SPARCV9_MM])); - _flags &= ~EF_SPARCV9_MM; - } - - if (flags & EF_SPARC_32PLUS) { - (void) strcat(string, MSG_ORIG(MSG_EF_SPARC_32PLUS)); - _flags &= ~EF_SPARC_32PLUS; + if ((mach == EM_SPARCV9) && (flags <= EF_SPARCV9_RMO)) { + if (strlcat(string, + MSG_ORIG(mm_flags[flags & EF_SPARCV9_MM]), + EFLAGSZ) >= EFLAGSZ) + return (conv_invalid_val(string, EFLAGSZ, + flags, 0)); + _flags &= ~EF_SPARCV9_MM; } - if (flags & EF_SPARC_SUN_US1) { - (void) strcat(string, MSG_ORIG(MSG_EF_SPARC_SUN_US1)); - _flags &= ~EF_SPARC_SUN_US1; - } - if (flags & EF_SPARC_HAL_R1) { - (void) strcat(string, MSG_ORIG(MSG_EF_SPARC_HAL_R1)); - _flags &= ~EF_SPARC_HAL_R1; - } - if (flags & EF_SPARC_SUN_US3) { - (void) strcat(string, MSG_ORIG(MSG_EF_SPARC_SUN_US3)); - _flags &= ~EF_SPARC_SUN_US3; - } - if (_flags) - (void) sprintf(&string[strlen(string)], - MSG_ORIG(MSG_EF_GEN_1_FLAGS), _flags); - (void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT)); - } else - (void) sprintf(string, MSG_ORIG(MSG_EF_GEN_2_FLAGS), flags); + if (conv_expn_field(string, EFLAGSZ, vda, flags, _flags, 0, 0)) + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), + EFLAGSZ); - return (string); + return (string); + } + return (conv_invalid_val(string, EFLAGSZ, flags, CONV_INV_DECIMAL)); } /* @@ -287,31 +203,31 @@ conv_eflags_str(ushort_t mach, uint_t flags) * terms of a string. */ const char * -conv_reject_str(Rej_desc * rej) +conv_reject_desc(Rej_desc * rej) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; ushort_t type = rej->rej_type; uint_t info = rej->rej_info; if (type == SGS_REJ_MACH) /* LINTED */ - return (conv_emach_str((ushort_t)info)); + return (conv_ehdr_mach((Half)info)); else if (type == SGS_REJ_CLASS) /* LINTED */ - return (conv_eclass_str((uchar_t)info)); + return (conv_ehdr_class((uchar_t)info)); else if (type == SGS_REJ_DATA) /* LINTED */ - return (conv_edata_str((uchar_t)info)); + return (conv_ehdr_data((uchar_t)info)); else if (type == SGS_REJ_TYPE) /* LINTED */ - return (conv_etype_str((ushort_t)info)); + return (conv_ehdr_type((Half)info)); else if ((type == SGS_REJ_BADFLAG) || (type == SGS_REJ_MISFLAG) || (type == SGS_REJ_HAL) || (type == SGS_REJ_US3)) /* * Only called from ld.so.1, thus M_MACH is hardcoded. */ - return (conv_eflags_str(M_MACH, info)); + return (conv_ehdr_flags(M_MACH, (Word)info)); else if (type == SGS_REJ_UNKFILE) return ((const char *)0); else if ((type == SGS_REJ_STR) || (type == SGS_REJ_HWCAP_1)) { @@ -320,5 +236,6 @@ conv_reject_str(Rej_desc * rej) else return (MSG_ORIG(MSG_STR_EMPTY)); } else - return (conv_invalid_str(string, STRSIZE, info, 1)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, info, + CONV_INV_DECIMAL)); } diff --git a/usr/src/cmd/sgs/libconv/common/elf.msg b/usr/src/cmd/sgs/libconv/common/elf.msg index 9695f0dd68..d27865ab92 100644 --- a/usr/src/cmd/sgs/libconv/common/elf.msg +++ b/usr/src/cmd/sgs/libconv/common/elf.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,9 +18,13 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# # ident "%Z%%M% %I% %E% SMI" # -# Message file for cmd/sgs/libconv/common/elf.c @ MSG_ELFCLASSNONE "ELFCLASSNONE" @ MSG_ELFCLASS32 "ELFCLASS32" @@ -149,8 +149,7 @@ @ MSG_EF_SPARCV9_PSO " EF_SPARCV9_PSO " @ MSG_EF_SPARCV9_RMO " EF_SPARCV9_RMO " -@ MSG_EF_GEN_1_FLAGS " %#x " -@ MSG_EF_GEN_2_FLAGS "%#x" +@ MSG_GBL_ZERO "0" @ MSG_GBL_OSQBRKT "[" @ MSG_GBL_CSQBRKT "]" diff --git a/usr/src/cmd/sgs/libconv/common/globals.c b/usr/src/cmd/sgs/libconv/common/globals.c index 22e1d0d0c4..401d1648c6 100644 --- a/usr/src/cmd/sgs/libconv/common/globals.c +++ b/usr/src/cmd/sgs/libconv/common/globals.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,27 +18,95 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <strings.h> #include <sys/machelf.h> +#include "_conv.h" #include "globals_msg.h" const char * -conv_invalid_str(char *string, size_t size, uint64_t value, int decimal) +conv_invalid_val(char *string, size_t size, Xword value, int flags) { - Msg format; - - if (decimal) - format = MSG_GBL_FMT_DEC; - else - format = MSG_GBL_FMT_HEX; + const char *fmt; - /* LINTED */ - (void) snprintf(string, size, MSG_ORIG(format), value); + if (flags & CONV_INV_DECIMAL) { + if (flags & CONV_INV_SPACE) + fmt = MSG_ORIG(MSG_GBL_FMT_DECS); + else + fmt = MSG_ORIG(MSG_GBL_FMT_DEC); + } else { + if (flags & CONV_INV_SPACE) + fmt = MSG_ORIG(MSG_GBL_FMT_HEXS); + else + fmt = MSG_ORIG(MSG_GBL_FMT_HEX); + } + (void) snprintf(string, size, fmt, value); return ((const char *)string); } + +/* + * Provide a focal point for expanding values (typically bit-fields) into + * their corresponding strings. + */ +int +conv_expn_field(char *string, size_t size, const Val_desc *vdp, + Xword oflags, Xword rflags, const char *separator, int element) +{ + const Val_desc *vde; + + /* + * Traverse the callers Val_desc array and determine if the value + * corresponds to any array item. + */ + for (vde = vdp; vde->v_msg; vde++) { + if (oflags & vde->v_val) { + /* + * If a separator is required, and elements have already + * been added to the users output buffer, add the + * separator to the buffer first. + */ + if (separator && element++) { + if (strlcat(string, separator, size) >= size) { + (void) conv_invalid_val(string, size, + oflags, 0); + return (0); + } + } + + /* + * Add the items strings to the users output buffer. + */ + if (strlcat(string, vde->v_msg, size) >= size) { + (void) conv_invalid_val(string, size, + oflags, 0); + return (0); + } + + /* + * Indicate this item has been collected. + */ + rflags &= ~(vde->v_val); + } + } + + /* + * If any flags remain, then they are unidentified. Add the number + * representation of these flags to the users output buffer. + */ + if (rflags) { + size_t off = strlen(string); + size_t rem = size - off; + + (void) conv_invalid_val(&string[off], rem, rflags, + CONV_INV_SPACE); + } + + return (1); +} diff --git a/usr/src/cmd/sgs/libconv/common/globals.msg b/usr/src/cmd/sgs/libconv/common/globals.msg index 62d3d844bf..3545bdf4d0 100644 --- a/usr/src/cmd/sgs/libconv/common/globals.msg +++ b/usr/src/cmd/sgs/libconv/common/globals.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,9 +18,20 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# # ident "%Z%%M% %I% %E% SMI" # -# Message file for cmd/sgs/libconv/common/globals.c -@ MSG_GBL_FMT_HEX "0x%llx" -@ MSG_GBL_FMT_DEC "%lld" +@ MSG_GBL_FMT_DEC_32 "%ld" +@ MSG_GBL_FMT_DEC_64 "%lld" +@ MSG_GBL_FMT_DECS_32 " %ld " +@ MSG_GBL_FMT_DECS_64 " %lld " + +@ MSG_GBL_FMT_HEX_32 "0x%lx" +@ MSG_GBL_FMT_HEX_64 "0x%llx" +@ MSG_GBL_FMT_HEXS_32 " 0x%lx " +@ MSG_GBL_FMT_HEXS_64 " 0x%llx " diff --git a/usr/src/cmd/sgs/libconv/common/group.c b/usr/src/cmd/sgs/libconv/common/group.c index 08b8a02d37..d5e69e84a4 100644 --- a/usr/src/cmd/sgs/libconv/common/group.c +++ b/usr/src/cmd/sgs/libconv/common/group.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -31,43 +31,39 @@ #include "group_msg.h" #define FLAGSZ MSG_GBL_OSQBRKT_SIZE + \ - MSG_GPH_INITIAL_SIZE + \ MSG_GPH_ZERO_SIZE + \ MSG_GPH_LDSO_SIZE + \ MSG_GPH_FIRST_SIZE + \ MSG_GPH_PARENT_SIZE + \ MSG_GPH_FILTEE_SIZE + \ - MSG_GBL_CSQBRKT_SIZE + MSG_GPH_INITIAL_SIZE + \ + MSG_GPH_STICKY_SIZE + \ + CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE /* * String conversion routine for Grp_hdl flags. */ const char * -conv_grphdrflags_str(uint_t flags) +conv_grphdl_flags(uint_t flags) { - static char string[FLAGSZ] = { '\0' }; - - (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); + static char string[FLAGSZ]; + static Val_desc vda[] = { + { GPH_ZERO, MSG_ORIG(MSG_GPH_ZERO) }, + { GPH_LDSO, MSG_ORIG(MSG_GPH_LDSO) }, + { GPH_FIRST, MSG_ORIG(MSG_GPH_FIRST) }, + { GPH_PARENT, MSG_ORIG(MSG_GPH_PARENT) }, + { GPH_FILTEE, MSG_ORIG(MSG_GPH_FILTEE) }, + { GPH_INITIAL, MSG_ORIG(MSG_GPH_INITIAL) }, + { GPH_STICKY, MSG_ORIG(MSG_GPH_STICKY) }, + { 0, 0 } + }; if (flags == 0) return (MSG_ORIG(MSG_GBL_NULL)); - if (flags & GPH_INITIAL) - (void) strcat(string, MSG_ORIG(MSG_GPH_INITIAL)); - if (flags & GPH_ZERO) - (void) strcat(string, MSG_ORIG(MSG_GPH_ZERO)); - if (flags & GPH_LDSO) - (void) strcat(string, MSG_ORIG(MSG_GPH_LDSO)); - if (flags & GPH_FIRST) - (void) strcat(string, MSG_ORIG(MSG_GPH_FIRST)); - if (flags & GPH_PARENT) - (void) strcat(string, MSG_ORIG(MSG_GPH_PARENT)); - if (flags & GPH_FILTEE) - (void) strcat(string, MSG_ORIG(MSG_GPH_FILTEE)); - if (flags & GPH_STICKY) - (void) strcat(string, MSG_ORIG(MSG_GPH_STICKY)); - - (void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT)); + (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); + if (conv_expn_field(string, FLAGSZ, vda, flags, flags, 0, 0)) + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ); return ((const char *)string); } diff --git a/usr/src/cmd/sgs/libconv/common/group.msg b/usr/src/cmd/sgs/libconv/common/group.msg index 72f0e3692f..4271e87966 100644 --- a/usr/src/cmd/sgs/libconv/common/group.msg +++ b/usr/src/cmd/sgs/libconv/common/group.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,9 +18,12 @@ # # CDDL HEADER END # -# ident "%Z%%M% %I% %E% SMI" + # -# Message file for cmd/sgs/libconv/common/group.c +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" @ MSG_GPH_ZERO " GPH_ZERO " @ MSG_GPH_LDSO " GPH_LDSO " diff --git a/usr/src/cmd/sgs/libconv/common/lddstub.c b/usr/src/cmd/sgs/libconv/common/lddstub.c index 3946bc5873..89978218d7 100644 --- a/usr/src/cmd/sgs/libconv/common/lddstub.c +++ b/usr/src/cmd/sgs/libconv/common/lddstub.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -33,40 +33,6 @@ #include "_conv.h" #include "lddstub_msg.h" -static char orgstub[PATH_MAX]; -static char orgstub64[PATH_MAX]; -static int orgflag; -static int orgflag64; - -#ifdef NEED_OWN_STRLCAT -/* - * Appends src to the dstsize buffer at dst. The append will never - * overflow the destination buffer and the buffer will always be null - * terminated. Never reference beyond &bst[dstsize-1] when computing - * the length of the pre-existing string. - */ -size_t -strlcat(char *dst, const char *src, size_t dstsize) -{ - char *df = dst; - size_t left = dstsize; - size_t l1; - size_t l2 = strlen(src); - size_t copied; - - while (left-- != 0 && *df != '\0') - df++; - l1 = df - dst; - if (dstsize == l1) - return (l1 + l2); - - copied = l1 + l2 >= dstsize ? dstsize - l1 - 1 : l2; - memcpy(dst + l1, src, copied); - dst[l1+copied] = '\0'; - return (l1 + l2); -} -#endif - static int originlddstub(char *buffer, const char *orgfile) { @@ -79,12 +45,15 @@ originlddstub(char *buffer, const char *orgfile) if ((len = resolvepath(buffer, buffer, (PATH_MAX - 1))) == -1) return (-1); buffer[len] = '\0'; - if (access(orgstub, X_OK) == -1) + if (access(buffer, X_OK) == -1) return (-1); - return (0); + return (1); } +static char orgstub[PATH_MAX], orgstub64[PATH_MAX]; +static int orgflag, orgflag64; + /* * Determine what lddstub to run. */ diff --git a/usr/src/cmd/sgs/libconv/common/lddstub.msg b/usr/src/cmd/sgs/libconv/common/lddstub.msg index 9d38a14594..a2a4b243f7 100644 --- a/usr/src/cmd/sgs/libconv/common/lddstub.msg +++ b/usr/src/cmd/sgs/libconv/common/lddstub.msg @@ -1,13 +1,9 @@ # -# 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. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -21,10 +17,12 @@ # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END + # -#pragma ident "%Z%%M% %I% %E% SMI" +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -# Message file for cmd/sgs/libconv/common/lddstub.c +# ident "%Z%%M% %I% %E% SMI" @ MSG_ORG_LDDSTUB "/../lib/lddstub" @ MSG_ORG_LDDSTUB_64 "/../lib/64/lddstub" diff --git a/usr/src/cmd/sgs/libconv/common/llib-lconv b/usr/src/cmd/sgs/libconv/common/llib-lconv index 26585345dc..f58b9c9459 100644 --- a/usr/src/cmd/sgs/libconv/common/llib-lconv +++ b/usr/src/cmd/sgs/libconv/common/llib-lconv @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,75 +18,115 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ /* LINTLIBRARY */ /* PROTOLIB1 */ -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. - */ - #pragma ident "%Z%%M% %I% %E% SMI" #include <stdlib.h> #include <libelf.h> #include <sys/machelf.h> -#include "sgs.h" +#include <sgs.h> +#include <libld.h> +#include <conv.h> +/* + * Define all generic interfaces. + */ void conv_check_native(char **, char **); -const char *conv_binding_str(uint_t); -const char *conv_bindent_str(uint_t); -const char *conv_captag_str(uint64_t); -const char *conv_capval_str(uint64_t, uint64_t, ushort_t); +const char *conv_config_feat(int); const char *conv_config_obj(ushort_t); -const char *conv_config_str(int); -const char *conv_d_type_str(Elf_Type); -const char *conv_deftag_str(int); -const char *conv_dlflag_str(int, int); -const char *conv_dlmode_str(int, int); -const char *conv_dyntag_str(uint64_t, ushort_t); -const char *conv_dynflag_str(uint_t); -const char *conv_dynflag_1_str(uint_t); -const char *conv_dynposflag_1_str(uint_t); -const char *conv_dynfeature_1_str(uint_t); -const char *conv_dwarf_ehe_str(uint_t); -const char *conv_eclass_str(uchar_t); -const char *conv_edata_str(uchar_t); -const char *conv_emach_str(ushort_t); -const char *conv_ever_str(uint_t); -const char *conv_etype_str(ushort_t); -const char *conv_eflags_str(ushort_t, uint_t); -const char *conv_hwcap_1_str(uint64_t, ushort_t); -const char *conv_hwcap_1_386_str(uint64_t); -const char *conv_hwcap_1_SPARC_str(uint64_t); -const char *conv_sfcap_1_str(uint64_t, ushort_t); -const char *conv_grphdrflags_str(uint_t); -const char *conv_info_bind_str(uchar_t); -const char *conv_info_type_str(ushort_t, uchar_t); +const char *conv_config_upm(const char *, const char *, const char *, + size_t); +const char *conv_def_tag(Symref); +const char *conv_demangle_name(const char *); +const char *conv_dl_flag(int, int); +const char *conv_dl_mode(int, int); +const char *conv_dwarf_ehe(uint_t); +const char *conv_elfdata_type(Elf_Type); +int conv_expn_field(char *, size_t, const Val_desc *, Xword, Xword, + const char *, int); +const char *conv_grphdl_flags(uint_t); Isa_desc *conv_isalist(void); const char *conv_lddstub(int); -const char *conv_phdrflg_str(uint_t); -const char *conv_phdrtyp_str(ushort_t, uint_t); -const char *conv_reject_str(Rej_desc *); -const char *conv_reloc_type_str(ushort_t, uint_t); -const char *conv_reloc_amd64_type_str(uint_t); -const char *conv_reloc_SPARC_type_str(uint_t); -const char *conv_reloc_386_type_str(uint_t); -const char *conv_sym_dem(const char *); -const char *conv_sym_stother(uchar_t); -const char *conv_sym_value_str(ushort_t, uint_t, uint64_t); -const char *conv_sym_SPARC_value_str(uint64_t); -const char *conv_secflg_str(ushort_t, uint_t); -const char *conv_secinfo_str(uint_t, uint_t); -const char *conv_sectyp_str(ushort_t, uint_t); -const char *conv_segaflg_str(uint_t); -const char *conv_shndx_str(ushort_t); +const char *conv_seg_flags(Half); int conv_sys_eclass(void); Uts_desc *conv_uts(void); -const char *conv_upm_string(const char *, const char *, const char *, - size_t); -const char *conv_verflg_str(ushort_t); +const char *conv_ver_flags(Half); + +/* + * Define all class specific routines. + */ +const char *conv32_bnd_obj(uint_t); +const char *conv64_bnd_obj(uint_t); +const char *conv32_bnd_type(uint_t); +const char *conv64_bnd_type(uint_t); +const char *conv32_cap_tag(Elf32_Word); +const char *conv64_cap_tag(Elf64_Xword); +const char *conv32_cap_val(Elf32_Word, Elf32_Word, Half); +const char *conv64_cap_val(Elf64_Xword, Elf64_Xword, Half); +const char *conv32_cap_val_hw1(Elf32_Word, Half); +const char *conv64_cap_val_hw1(Elf64_Xword, Half); +const char *conv32_cap_val_sf1(Elf32_Word, Half); +const char *conv64_cap_val_sf1(Elf64_Xword, Half); +const char *conv32_dyn_flag1(Elf32_Word); +const char *conv64_dyn_flag1(Elf64_Xword); +const char *conv32_dyn_flag(Elf32_Word); +const char *conv64_dyn_flag(Elf64_Xword); +const char *conv32_dyn_posflag1(Elf32_Word); +const char *conv64_dyn_posflag1(Elf64_Xword); +const char *conv32_dyn_tag(Elf32_Word, Elf32_Half); +const char *conv64_dyn_tag(Elf64_Xword, Elf64_Half); +const char *conv32_dyn_feature1(Elf32_Word); +const char *conv64_dyn_feature1(Elf64_Xword); +const char *conv32_ehdr_class(uchar_t); +const char *conv64_ehdr_class(uchar_t); +const char *conv32_ehdr_data(uchar_t); +const char *conv64_ehdr_data(uchar_t); +const char *conv32_ehdr_flags(Elf32_Half, Elf32_Word); +const char *conv64_ehdr_flags(Elf64_Half, Elf64_Word); +const char *conv32_ehdr_mach(Elf32_Half); +const char *conv64_ehdr_mach(Elf64_Half); +const char *conv32_ehdr_type(Elf32_Half); +const char *conv64_ehdr_type(Elf64_Half); +const char *conv32_ehdr_vers(Elf32_Word); +const char *conv64_ehdr_vers(Elf64_Word); +const char *conv32_invalid_val(char *, size_t, Elf32_Word, int); +const char *conv64_invalid_val(char *, size_t, Elf64_Xword, int); +const char *conv32_phdr_flags(Word); +const char *conv64_phdr_flags(Word); +const char *conv32_phdr_type(Elf32_Half, Word); +const char *conv64_phdr_type(Elf64_Half, Word); +const char *conv32_reject_desc(Rej_desc *); +const char *conv64_reject_desc(Rej_desc *); +const char *conv32_reloc_type(Half, Word); +const char *conv64_reloc_type(Half, Word); +const char *conv32_reloc_386_type(Word); +const char *conv64_reloc_386_type(Word); +const char *conv32_reloc_amd64_type(Word); +const char *conv64_reloc_amd64_type(Word); +const char *conv32_reloc_SPARC_type(Word); +const char *conv64_reloc_SPARC_type(Word); +const char *conv32_sec_flags(Elf32_Word); +const char *conv64_sec_flags(Elf64_Xword); +const char *conv32_sec_info(Elf32_Word, Elf32_Word); +const char *conv64_sec_info(Elf64_Word, Elf64_Xword); +const char *conv32_sec_type(Elf32_Half, Elf32_Word); +const char *conv64_sec_type(Elf64_Half, Elf64_Word); +const char *conv32_sym_info_bind(uchar_t); +const char *conv64_sym_info_bind(uchar_t); +const char *conv32_sym_info_type(Elf32_Half, uchar_t); +const char *conv64_sym_info_type(Elf64_Half, uchar_t); +const char *conv32_sym_shndx(Elf32_Half); +const char *conv64_sym_shndx(Elf64_Half); +const char *conv32_sym_other(uchar_t); +const char *conv64_sym_other(uchar_t); +const char *conv32_sym_value(Elf32_Half, uchar_t, Elf32_Addr); +const char *conv64_sym_value(Elf64_Half, uchar_t, Elf64_Addr); +const char *conv32_sym_SPARC_value(Elf32_Addr); +const char *conv64_sym_SPARC_value(Elf64_Addr); diff --git a/usr/src/cmd/sgs/libconv/common/phdr.c b/usr/src/cmd/sgs/libconv/common/phdr.c index ad5ecb6762..a9a5ce2eee 100644 --- a/usr/src/cmd/sgs/libconv/common/phdr.c +++ b/usr/src/cmd/sgs/libconv/common/phdr.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -30,62 +30,59 @@ * String conversion routines for program header attributes. */ #include <string.h> -#include <sys/elf_amd64.h> #include <_conv.h> #include <phdr_msg.h> -static const Msg phdrs[] = { - MSG_PT_NULL, MSG_PT_LOAD, MSG_PT_DYNAMIC, - MSG_PT_INTERP, MSG_PT_NOTE, MSG_PT_SHLIB, - MSG_PT_PHDR, MSG_PT_TLS -}; - static const Msg uphdrs[] = { MSG_PT_SUNWBSS, MSG_PT_SUNWSTACK, MSG_PT_SUNWDTRACE, MSG_PT_SUNWCAP }; const char * -/* ARGSUSED 1 */ -conv_phdrtyp_str(ushort_t mach, uint_t phdr) +conv_phdr_type(Half mach, Word type) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; + static const Msg phdrs[] = { + MSG_PT_NULL, MSG_PT_LOAD, MSG_PT_DYNAMIC, + MSG_PT_INTERP, MSG_PT_NOTE, MSG_PT_SHLIB, + MSG_PT_PHDR, MSG_PT_TLS + }; - if (phdr < PT_NUM) - return (MSG_ORIG(phdrs[phdr])); - else if ((phdr >= PT_SUNWBSS) && (phdr <= PT_HISUNW)) - return (MSG_ORIG(uphdrs[phdr - PT_SUNWBSS])); - else if ((phdr == PT_SUNW_UNWIND) && (mach == EM_AMD64)) + if (type < PT_NUM) + return (MSG_ORIG(phdrs[type])); + else if ((type >= PT_SUNWBSS) && (type <= PT_HISUNW)) + return (MSG_ORIG(uphdrs[type - PT_SUNWBSS])); + else if ((type == PT_SUNW_UNWIND) && (mach == EM_AMD64)) return (MSG_ORIG(MSG_PT_SUNW_UNWIND)); else - return (conv_invalid_str(string, STRSIZE, phdr, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, type, 0)); } #define PHDRSZ MSG_GBL_OSQBRKT_SIZE + \ MSG_PF_X_SIZE + \ MSG_PF_W_SIZE + \ MSG_PF_R_SIZE + \ - MSG_GBL_CSQBRKT_SIZE + MSG_PF_SUNW_FAILURE_SIZE + \ + CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE const char * -conv_phdrflg_str(uint_t flags) +conv_phdr_flags(Word flags) { - static char string[PHDRSZ] = { '\0' }; + static char string[PHDRSZ]; + static Val_desc vda[] = { + { PF_X, MSG_ORIG(MSG_PF_X) }, + { PF_W, MSG_ORIG(MSG_PF_W) }, + { PF_R, MSG_ORIG(MSG_PF_R) }, + { PF_SUNW_FAILURE, MSG_ORIG(MSG_PF_SUNW_FAILURE) }, + { 0, 0 } + }; if (flags == 0) return (MSG_ORIG(MSG_GBL_ZERO)); - else { - (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); - if (flags & PF_X) - (void) strcat(string, MSG_ORIG(MSG_PF_X)); - if (flags & PF_W) - (void) strcat(string, MSG_ORIG(MSG_PF_W)); - if (flags & PF_R) - (void) strcat(string, MSG_ORIG(MSG_PF_R)); - if (flags & PF_SUNW_FAILURE) - (void) strcat(string, MSG_ORIG(MSG_PF_SUNW_FAILURE)); - (void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT)); - return ((const char *)string); - } + (void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), PHDRSZ); + if (conv_expn_field(string, PHDRSZ, vda, flags, flags, 0, 0)) + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), PHDRSZ); + + return ((const char *)string); } diff --git a/usr/src/cmd/sgs/libconv/common/phdr.msg b/usr/src/cmd/sgs/libconv/common/phdr.msg index 93714a5972..b3fe1edf98 100644 --- a/usr/src/cmd/sgs/libconv/common/phdr.msg +++ b/usr/src/cmd/sgs/libconv/common/phdr.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,9 +18,13 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# # ident "%Z%%M% %I% %E% SMI" # -# Message file for cmd/sgs/libconv/common/phdr.c @ MSG_PT_NULL "[ PT_NULL ]" @ MSG_PT_LOAD "[ PT_LOAD ]" diff --git a/usr/src/cmd/sgs/libconv/common/relocate.c b/usr/src/cmd/sgs/libconv/common/relocate.c index 60eec68dc0..5bcc4082c2 100644 --- a/usr/src/cmd/sgs/libconv/common/relocate.c +++ b/usr/src/cmd/sgs/libconv/common/relocate.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -35,19 +35,19 @@ * Generic front-end that determines machine specific relocations. */ const char * -conv_reloc_type_str(ushort_t mach, uint_t rel) +conv_reloc_type(Half mach, Word type) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; if (mach == EM_386) - return (conv_reloc_386_type_str(rel)); + return (conv_reloc_386_type(type)); if ((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) || (mach == EM_SPARCV9)) - return (conv_reloc_SPARC_type_str(rel)); + return (conv_reloc_SPARC_type(type)); if (mach == EM_AMD64) - return (conv_reloc_amd64_type_str(rel)); + return (conv_reloc_amd64_type(type)); - return (conv_invalid_str(string, STRSIZE, rel, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, type, 0)); } diff --git a/usr/src/cmd/sgs/libconv/common/relocate_amd64.c b/usr/src/cmd/sgs/libconv/common/relocate_amd64.c index fbdc256484..14482a93b9 100644 --- a/usr/src/cmd/sgs/libconv/common/relocate_amd64.c +++ b/usr/src/cmd/sgs/libconv/common/relocate_amd64.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -61,11 +60,11 @@ static const Msg rels[R_AMD64_NUM] = { #endif const char * -conv_reloc_amd64_type_str(uint_t type) +conv_reloc_amd64_type(Word type) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; if (type >= R_AMD64_NUM) - return (conv_invalid_str(string, STRSIZE, type, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, type, 0)); return (MSG_ORIG(rels[type])); } diff --git a/usr/src/cmd/sgs/libconv/common/relocate_i386.c b/usr/src/cmd/sgs/libconv/common/relocate_i386.c index b93f24acef..84bf504221 100644 --- a/usr/src/cmd/sgs/libconv/common/relocate_i386.c +++ b/usr/src/cmd/sgs/libconv/common/relocate_i386.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -64,11 +63,11 @@ static const Msg rels[R_386_NUM] = { #endif const char * -conv_reloc_386_type_str(uint_t type) +conv_reloc_386_type(Word type) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; if (type >= R_386_NUM) - return (conv_invalid_str(string, STRSIZE, type, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, type, 0)); return (MSG_ORIG(rels[type])); } diff --git a/usr/src/cmd/sgs/libconv/common/relocate_sparc.c b/usr/src/cmd/sgs/libconv/common/relocate_sparc.c index 93d2c5ad17..bd6d33177d 100644 --- a/usr/src/cmd/sgs/libconv/common/relocate_sparc.c +++ b/usr/src/cmd/sgs/libconv/common/relocate_sparc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -88,11 +87,11 @@ static const Msg rels[R_SPARC_NUM] = { #endif const char * -conv_reloc_SPARC_type_str(uint_t type) +conv_reloc_SPARC_type(Word type) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; if (type >= R_SPARC_NUM) - return (conv_invalid_str(string, STRSIZE, type, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, type, 0)); return (MSG_ORIG(rels[type])); } diff --git a/usr/src/cmd/sgs/libconv/common/sections.c b/usr/src/cmd/sgs/libconv/common/sections.c index 985439a69d..f7ac3adc5d 100644 --- a/usr/src/cmd/sgs/libconv/common/sections.c +++ b/usr/src/cmd/sgs/libconv/common/sections.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -60,27 +59,25 @@ static const Msg usecs[SHT_HISUNW - SHT_LOSUNW + 1] = { #endif const char * -/* ARGSUSED 1 */ -conv_sectyp_str(ushort_t mach, uint_t sec) +conv_sec_type(Half mach, Word sec) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; if (sec < SHT_NUM) return (MSG_ORIG(secs[sec])); else if ((sec >= SHT_LOSUNW) && (sec <= SHT_HISUNW)) return (MSG_ORIG(usecs[sec - SHT_LOSUNW])); else if ((sec >= SHT_LOPROC) && (sec <= SHT_HIPROC)) { - if ((sec == (uint_t)SHT_SPARC_GOTDATA) && - ((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) || - (mach == EM_SPARCV9))) + if ((sec == SHT_SPARC_GOTDATA) && ((mach == EM_SPARC) || + (mach == EM_SPARC32PLUS) || (mach == EM_SPARCV9))) return (MSG_ORIG(MSG_SHT_SPARC_GOTDATA)); - else if ((sec == (uint_t)SHT_AMD64_UNWIND) && - (mach == EM_AMD64)) + else if ((sec == SHT_AMD64_UNWIND) && (mach == EM_AMD64)) return (MSG_ORIG(MSG_SHT_AMD64_UNWIND)); else - return (conv_invalid_str(string, STRSIZE, sec, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, + sec, 0)); } else - return (conv_invalid_str(string, STRSIZE, sec, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, sec, 0)); } #define FLAGSZ MSG_GBL_OSQBRKT_SIZE + \ @@ -97,101 +94,43 @@ conv_sectyp_str(ushort_t mach, uint_t sec) MSG_SHF_EXCLUDE_SIZE + \ MSG_SHF_ORDERED_SIZE + \ MSG_SHF_AMD64_LARGE_SIZE + \ - MSG_GBL_CSQBRKT_SIZE + CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE const char * -/* ARGSUSED 1 */ -conv_secflg_str(ushort_t mach, uint_t flags) +conv_sec_flags(Xword flags) { - static char string[FLAGSZ] = { '\0' }; + static char string[FLAGSZ]; + static Val_desc vda[] = { + { SHF_WRITE, MSG_ORIG(MSG_SHF_WRITE) }, + { SHF_ALLOC, MSG_ORIG(MSG_SHF_ALLOC) }, + { SHF_EXECINSTR, MSG_ORIG(MSG_SHF_EXECINSTR) }, + { SHF_MERGE, MSG_ORIG(MSG_SHF_MERGE) }, + { SHF_STRINGS, MSG_ORIG(MSG_SHF_STRINGS) }, + { SHF_INFO_LINK, MSG_ORIG(MSG_SHF_INFO_LINK) }, + { SHF_LINK_ORDER, MSG_ORIG(MSG_SHF_LINK_ORDER) }, + { SHF_OS_NONCONFORMING, MSG_ORIG(MSG_SHF_OS_NONCONFORMING) }, + { SHF_GROUP, MSG_ORIG(MSG_SHF_GROUP) }, + { SHF_TLS, MSG_ORIG(MSG_SHF_TLS) }, + { SHF_EXCLUDE, MSG_ORIG(MSG_SHF_EXCLUDE) }, + { SHF_ORDERED, MSG_ORIG(MSG_SHF_ORDERED) }, + { SHF_AMD64_LARGE, MSG_ORIG(MSG_SHF_AMD64_LARGE) }, + { 0, 0 } + }; if (flags == 0) return (MSG_ORIG(MSG_GBL_ZERO)); - else { - uint_t flags_handled = 0; - (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); - if (flags & SHF_WRITE) { - (void) strcat(string, MSG_ORIG(MSG_SHF_WRITE)); - flags_handled |= SHF_WRITE; - } - if (flags & SHF_ALLOC) { - (void) strcat(string, MSG_ORIG(MSG_SHF_ALLOC)); - flags_handled |= SHF_ALLOC; - } - if (flags & SHF_EXECINSTR) { - (void) strcat(string, MSG_ORIG(MSG_SHF_EXECINSTR)); - flags_handled |= SHF_EXECINSTR; - } - if (flags & SHF_MERGE) { - (void) strcat(string, MSG_ORIG(MSG_SHF_MERGE)); - flags_handled |= SHF_MERGE; - } - if (flags & SHF_STRINGS) { - (void) strcat(string, MSG_ORIG(MSG_SHF_STRINGS)); - flags_handled |= SHF_STRINGS; - } - if (flags & SHF_INFO_LINK) { - (void) strcat(string, MSG_ORIG(MSG_SHF_INFO_LINK)); - flags_handled |= SHF_INFO_LINK; - } - if (flags & SHF_LINK_ORDER) { - (void) strcat(string, MSG_ORIG(MSG_SHF_LINK_ORDER)); - flags_handled |= SHF_LINK_ORDER; - } - if (flags & SHF_OS_NONCONFORMING) { - (void) strcat(string, - MSG_ORIG(MSG_SHF_OS_NONCONFORMING)); - flags_handled |= SHF_OS_NONCONFORMING; - } - if (flags & SHF_GROUP) { - (void) strcat(string, MSG_ORIG(MSG_SHF_GROUP)); - flags_handled |= SHF_GROUP; - } - if (flags & SHF_TLS) { - (void) strcat(string, MSG_ORIG(MSG_SHF_TLS)); - flags_handled |= SHF_TLS; - } - if (flags & SHF_EXCLUDE) { - (void) strcat(string, MSG_ORIG(MSG_SHF_EXCLUDE)); - flags_handled |= SHF_EXCLUDE; - } - if (flags & SHF_ORDERED) { - (void) strcat(string, MSG_ORIG(MSG_SHF_ORDERED)); - flags_handled |= SHF_ORDERED; - } - if (flags & SHF_AMD64_LARGE) { - (void) strcat(string, MSG_ORIG(MSG_SHF_AMD64_LARGE)); - flags_handled |= SHF_AMD64_LARGE; - } + (void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), FLAGSZ); + if (conv_expn_field(string, FLAGSZ, vda, flags, flags, 0, 0)) + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), FLAGSZ); - /* - * Are there any flags that haven't been handled. - */ - if ((flags & flags_handled) != flags) { - char *str; - size_t len; - - len = strlen(string); - str = string + len; - (void) conv_invalid_str(str, FLAGSZ - len, - (flags & (~flags_handled)), 0); - } - (void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT)); - - return ((const char *)string); - } + return ((const char *)string); } -/* - * Need to be able to hold a 32bit signed integer. - */ -#define INFOSZ 128 - const char * -conv_secinfo_str(uint_t info, uint_t flags) +conv_sec_info(Word info, Xword flags) { - static char string[INFOSZ] = { '\0' }; + static char string[CONV_INV_STRSIZE]; if (flags & SHF_ORDERED) { if (info == SHN_BEFORE) @@ -199,6 +138,6 @@ conv_secinfo_str(uint_t info, uint_t flags) else if (info == SHN_AFTER) return (MSG_ORIG(MSG_SHN_AFTER)); } - (void) conv_invalid_str(string, INFOSZ, info, 1); + (void) conv_invalid_val(string, CONV_INV_STRSIZE, info, 1); return ((const char *)string); } diff --git a/usr/src/cmd/sgs/libconv/common/segments.c b/usr/src/cmd/sgs/libconv/common/segments.c index dc7195502b..a2974f66c7 100644 --- a/usr/src/cmd/sgs/libconv/common/segments.c +++ b/usr/src/cmd/sgs/libconv/common/segments.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -29,7 +29,8 @@ * String conversion routine for segment flags. */ #include <string.h> -#include "libld.h" +#include <libld.h> +#include "_conv.h" #include "segments_msg.h" #define SEGSZ MSG_GBL_OSQBRKT_SIZE + \ @@ -41,41 +42,40 @@ MSG_FLG_SG_FLAGS_SIZE + \ MSG_FLG_SG_TYPE_SIZE + \ MSG_FLG_SG_ORDER_SIZE + \ - MSG_FLG_SG_EMPTY_SIZE + \ MSG_FLG_SG_NOHDR_SIZE + \ - MSG_GBL_CSQBRKT_SIZE + MSG_FLG_SG_EMPTY_SIZE + \ + MSG_FLG_SG_KEY_SIZE + \ + MSG_FLG_SG_DISABLED_SIZE + \ + MSG_FLG_SG_PHREQ_SIZE + \ + CONV_INV_STRSIZE + MSG_GBL_CSQBRKT_SIZE const char * -conv_segaflg_str(uint_t flags) +conv_seg_flags(Half flags) { - static char string[SEGSZ] = { '\0' }; + static char string[SEGSZ]; + static Val_desc vda[] = { + { FLG_SG_VADDR, MSG_ORIG(MSG_FLG_SG_VADDR) }, + { FLG_SG_PADDR, MSG_ORIG(MSG_FLG_SG_PADDR) }, + { FLG_SG_LENGTH, MSG_ORIG(MSG_FLG_SG_LENGTH) }, + { FLG_SG_ALIGN, MSG_ORIG(MSG_FLG_SG_ALIGN) }, + { FLG_SG_ROUND, MSG_ORIG(MSG_FLG_SG_ROUND) }, + { FLG_SG_FLAGS, MSG_ORIG(MSG_FLG_SG_FLAGS) }, + { FLG_SG_TYPE, MSG_ORIG(MSG_FLG_SG_TYPE) }, + { FLG_SG_ORDER, MSG_ORIG(MSG_FLG_SG_ORDER) }, + { FLG_SG_NOHDR, MSG_ORIG(MSG_FLG_SG_NOHDR) }, + { FLG_SG_EMPTY, MSG_ORIG(MSG_FLG_SG_EMPTY) }, + { FLG_SG_KEY, MSG_ORIG(MSG_FLG_SG_KEY) }, + { FLG_SG_DISABLED, MSG_ORIG(MSG_FLG_SG_DISABLED) }, + { FLG_SG_PHREQ, MSG_ORIG(MSG_FLG_SG_PHREQ) }, + { 0, 0 } + }; if (flags == 0) return (MSG_ORIG(MSG_GBL_ZERO)); - else { - (void) strcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT)); - if (flags & FLG_SG_VADDR) - (void) strcat(string, MSG_ORIG(MSG_FLG_SG_VADDR)); - if (flags & FLG_SG_PADDR) - (void) strcat(string, MSG_ORIG(MSG_FLG_SG_PADDR)); - if (flags & FLG_SG_LENGTH) - (void) strcat(string, MSG_ORIG(MSG_FLG_SG_LENGTH)); - if (flags & FLG_SG_ALIGN) - (void) strcat(string, MSG_ORIG(MSG_FLG_SG_ALIGN)); - if (flags & FLG_SG_ROUND) - (void) strcat(string, MSG_ORIG(MSG_FLG_SG_ROUND)); - if (flags & FLG_SG_FLAGS) - (void) strcat(string, MSG_ORIG(MSG_FLG_SG_FLAGS)); - if (flags & FLG_SG_TYPE) - (void) strcat(string, MSG_ORIG(MSG_FLG_SG_TYPE)); - if (flags & FLG_SG_ORDER) - (void) strcat(string, MSG_ORIG(MSG_FLG_SG_ORDER)); - if (flags & FLG_SG_EMPTY) - (void) strcat(string, MSG_ORIG(MSG_FLG_SG_EMPTY)); - if (flags & FLG_SG_NOHDR) - (void) strcat(string, MSG_ORIG(MSG_FLG_SG_NOHDR)); - (void) strcat(string, MSG_ORIG(MSG_GBL_CSQBRKT)); - return ((const char *)string); - } + (void) strlcpy(string, MSG_ORIG(MSG_GBL_OSQBRKT), SEGSZ); + if (conv_expn_field(string, SEGSZ, vda, flags, flags, 0, 0)) + (void) strlcat(string, MSG_ORIG(MSG_GBL_CSQBRKT), SEGSZ); + + return ((const char *)string); } diff --git a/usr/src/cmd/sgs/libconv/common/segments.msg b/usr/src/cmd/sgs/libconv/common/segments.msg index 8b96a438b2..ba542a9589 100644 --- a/usr/src/cmd/sgs/libconv/common/segments.msg +++ b/usr/src/cmd/sgs/libconv/common/segments.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,9 +18,12 @@ # # CDDL HEADER END # -# ident "%Z%%M% %I% %E% SMI" + # -# Message file for cmd/sgs/libconv/common/segments.c +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" @ MSG_FLG_SG_VADDR " FLG_SG_VADDR " @ MSG_FLG_SG_PADDR " FLG_SG_PADDR " @@ -34,8 +33,11 @@ @ MSG_FLG_SG_FLAGS " FLG_SG_FLAGS " @ MSG_FLG_SG_TYPE " FLG_SG_TYPE " @ MSG_FLG_SG_ORDER " FLG_SG_ORDER " -@ MSG_FLG_SG_EMPTY " FLG_SG_EMPTY " @ MSG_FLG_SG_NOHDR " FLG_SG_NOHDR " +@ MSG_FLG_SG_EMPTY " FLG_SG_EMPTY " +@ MSG_FLG_SG_KEY " FLG_SG_KEY " +@ MSG_FLG_SG_DISABLED " FLG_SG_DISABLED " +@ MSG_FLG_SG_PHREQ " FLG_SG_PHREQ " @ MSG_GBL_ZERO "0" @ MSG_GBL_OSQBRKT "[" diff --git a/usr/src/cmd/sgs/libconv/common/symbols.c b/usr/src/cmd/sgs/libconv/common/symbols.c index d14cfdd217..74895e3093 100644 --- a/usr/src/cmd/sgs/libconv/common/symbols.c +++ b/usr/src/cmd/sgs/libconv/common/symbols.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -29,49 +29,46 @@ * String conversion routines for symbol attributes. */ #include <stdio.h> -#include <demangle.h> -#include "_conv.h" -#include "symbols_msg.h" +#include <sys/machelf.h> #include <sys/elf_SPARC.h> #include <sys/elf_amd64.h> - -static const char vis_types[4] = { - 'D', /* STV_DEFAULT */ - 'I', /* STV_INTERNAL */ - 'H', /* STV_HIDDEN */ - 'P' /* STV_PROTECTED */ - }; +#include "_conv.h" +#include "symbols_msg.h" const char * -conv_sym_stother(uchar_t stother) +conv_sym_other(uchar_t other) { - uint_t vis = ELF_ST_VISIBILITY(stother); - static char string[STRSIZE]; - uint_t ndx = 0; + static char string[CONV_INV_STRSIZE]; + static const char visibility[4] = { + 'D', /* STV_DEFAULT */ + 'I', /* STV_INTERNAL */ + 'H', /* STV_HIDDEN */ + 'P' /* STV_PROTECTED */ + }; + uint_t vis = ELF_ST_VISIBILITY(other); + uint_t ndx = 0; + + string[ndx++] = visibility[vis]; - string[ndx++] = vis_types[vis]; /* * If unkown bits are present in stother - throw out a '?' */ - if (stother & ~MSK_SYM_VISIBILITY) + if (other & ~MSK_SYM_VISIBILITY) string[ndx++] = '?'; - string[ndx++] = '\0'; return (string); } -static const Msg types[] = { - MSG_STT_NOTYPE, MSG_STT_OBJECT, MSG_STT_FUNC, - MSG_STT_SECTION, MSG_STT_FILE, MSG_STT_COMMON, - MSG_STT_TLS -}; - const char * -conv_info_type_str(ushort_t mach, uchar_t type) +conv_sym_info_type(Half mach, uchar_t type) { - static char string[STRSIZE] = { '\0' }; - + static char string[CONV_INV_STRSIZE]; + static const Msg types[] = { + MSG_STT_NOTYPE, MSG_STT_OBJECT, MSG_STT_FUNC, + MSG_STT_SECTION, MSG_STT_FILE, MSG_STT_COMMON, + MSG_STT_TLS + }; if (type < STT_NUM) return (MSG_ORIG(types[type])); @@ -79,154 +76,60 @@ conv_info_type_str(ushort_t mach, uchar_t type) (mach == EM_SPARCV9)) && (type == STT_SPARC_REGISTER)) return (MSG_ORIG(MSG_STT_REGISTER)); else - return (conv_invalid_str(string, STRSIZE, type, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, type, 0)); } -static const Msg binds[] = { - MSG_STB_LOCAL, MSG_STB_GLOBAL, MSG_STB_WEAK -}; - const char * -conv_info_bind_str(uchar_t bind) +conv_sym_info_bind(uchar_t bind) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; + static const Msg binds[] = { + MSG_STB_LOCAL, MSG_STB_GLOBAL, MSG_STB_WEAK + }; if (bind >= STB_NUM) - return (conv_invalid_str(string, STRSIZE, bind, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, bind, 0)); else return (MSG_ORIG(binds[bind])); } const char * -conv_shndx_str(ushort_t shndx) +conv_sym_shndx(Half shndx) { - static char string[STRSIZE] = { '\0' }; + static char string[CONV_INV_STRSIZE]; - if (shndx == SHN_UNDEF) + switch (shndx) { + case SHN_UNDEF: return (MSG_ORIG(MSG_SHN_UNDEF)); - else if (shndx == SHN_SUNW_IGNORE) + case SHN_SUNW_IGNORE: return (MSG_ORIG(MSG_SHN_SUNW_IGNORE)); - else if (shndx == SHN_ABS) + case SHN_ABS: return (MSG_ORIG(MSG_SHN_ABS)); - else if (shndx == SHN_COMMON) + case SHN_COMMON: return (MSG_ORIG(MSG_SHN_COMMON)); - else if (shndx == SHN_X86_64_LCOMMON) - return (MSG_ORIG(MSG_SHN_X86_64_LCOMMON)); - else if (shndx == SHN_AFTER) + case SHN_AMD64_LCOMMON: + return (MSG_ORIG(MSG_SHN_AMD64_LCOMMON)); + case SHN_AFTER: return (MSG_ORIG(MSG_SHN_AFTER)); - else if (shndx == SHN_BEFORE) + case SHN_BEFORE: return (MSG_ORIG(MSG_SHN_BEFORE)); - else if (shndx == SHN_XINDEX) + case SHN_XINDEX: return (MSG_ORIG(MSG_SHN_XINDEX)); - else - return (conv_invalid_str(string, STRSIZE, shndx, 1)); + default: + return (conv_invalid_val(string, CONV_INV_STRSIZE, shndx, + CONV_INV_DECIMAL)); + } } const char * -conv_sym_value_str(ushort_t mach, uint_t type, uint64_t value) +conv_sym_value(Half mach, uchar_t type, Addr value) { - static char string[STRSIZE64] = { '\0' }; - const char *fmt; + static char string[CONV_INV_STRSIZE]; if (((mach == EM_SPARC) || (mach == EM_SPARC32PLUS) || (mach == EM_SPARCV9)) && (type == STT_SPARC_REGISTER)) - return (conv_sym_SPARC_value_str(value)); + return (conv_sym_SPARC_value(value)); - /* - * Should obtain the elf class rather than relying on e_machine here... - */ - if (mach == EM_SPARCV9) - fmt = MSG_ORIG(MSG_FMT_VAL_64); - else - fmt = MSG_ORIG(MSG_FMT_VAL); - - (void) sprintf(string, fmt, EC_XWORD(value)); + (void) sprintf(string, MSG_ORIG(MSG_SYM_FMT_VAL), EC_ADDR(value)); return (string); } - -/* - * Demangle C++ symbols. - * - * This routine acts as a generic routine for use by liblddbg (and hence tools - * like elfdump(1) and pvs(1)), ld(1) and ld.so.1(1). - * - * The C++ ABI-2 places no limits on symbol names, thus when demangling a name - * it's possible the buffer won't be big enough (DEMANGLE_ESPACE) so here we - * try to allocate bigger buffers. However, we place a limit on this buffer - * size for fear of a C++ error sending us into an infinit loop. - * - * NOTE. we create and use a common buffer for use by cplus_demangle(), thus - * each call to this routine will override the contents of any existing call. - * Normally this is sufficient for typical error diagnostics referencing one - * symbol. For those diagnostics using more than one symbol name, all but the - * last name must be copied to a temporary buffer (regardless of whether - * demangling occurred, as the process of attempting to demangle may damage the - * buffer). One model is: - * - * if ((_name1 = demangle(name1)) != name1) { - * char * __name1 = alloca(strlen(_name1) + 1); - * (void) strcpy(__name1, _name1); - * name1 = (const char *)__name1; - * } - * name2 = demangle(name2); - * eprintf(format, name1, name2); - */ -#define SYM_MAX 1000 - -const char * -conv_sym_dem(const char *name) -{ - static char _str[SYM_MAX], *str = _str; - static size_t size = SYM_MAX; - static int again = 1; - static int (*fptr)() = 0; - int error; - - if (str == 0) - return (name); - - /* - * If we haven't located the demangler yet try now (we do this rather - * than maintain a static dependency on libdemangle as it's part of an - * optional package). Null the str element out to reject any other - * callers until this operation is complete - under ld.so.1 we can get - * into serious recursion without this. - */ - if (fptr == 0) { - void *hdl; - - str = 0; - if (!(hdl = dlopen(MSG_ORIG(MSG_DEM_LIB), RTLD_LAZY)) || - !(fptr = (int (*)())dlsym(hdl, MSG_ORIG(MSG_DEM_SYM)))) - return (name); - str = _str; - } - - if ((error = (*fptr)(name, str, size)) == 0) - return ((const char *)str); - - while ((error == DEMANGLE_ESPACE) && again) { - char *_str; - size_t _size = size; - - /* - * If we haven't allocated our maximum try incrementing the - * present buffer size. Use malloc() rather than realloc() so - * that we at least have the old buffer on failure. - */ - if (((_size += SYM_MAX) > (SYM_MAX * 4)) || - ((_str = malloc(_size)) == 0)) { - again = 0; - break; - } - if (size != SYM_MAX) { - free(str); - } - str = _str; - size = _size; - - if ((error = (*fptr)(name, str, size)) == 0) - return ((const char *)str); - } - return (name); -} diff --git a/usr/src/cmd/sgs/libconv/common/symbols.msg b/usr/src/cmd/sgs/libconv/common/symbols.msg index 2357201577..43f6f1c204 100644 --- a/usr/src/cmd/sgs/libconv/common/symbols.msg +++ b/usr/src/cmd/sgs/libconv/common/symbols.msg @@ -1,13 +1,9 @@ # -# 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. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -21,10 +17,13 @@ # information: Portions Copyright [yyyy] [name of copyright owner] # # CDDL HEADER END + # -#pragma ident "%Z%%M% %I% %E% SMI" +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" # -# Message file for cmd/sgs/libconv/common/symbols.c @ MSG_STT_NOTYPE "NOTY" @ MSG_STT_OBJECT "OBJT" @@ -43,13 +42,10 @@ @ MSG_SHN_SUNW_IGNORE "IGNORE" @ MSG_SHN_ABS "ABS" @ MSG_SHN_COMMON "COMMON" -@ MSG_SHN_X86_64_LCOMMON "LCOMMON" +@ MSG_SHN_AMD64_LCOMMON "LCOMMON" @ MSG_SHN_AFTER "AFTER" @ MSG_SHN_BEFORE "BEFORE" @ MSG_SHN_XINDEX "XINDEX" -@ MSG_FMT_VAL "0x%8.8llx" -@ MSG_FMT_VAL_64 "0x%12.12llx" - -@ MSG_DEM_SYM "cplus_demangle" -@ MSG_DEM_LIB "libdemangle.so.1" +@ MSG_SYM_FMT_VAL_32 "0x%8.8llx" +@ MSG_SYM_FMT_VAL_64 "0x%16.16llx" diff --git a/usr/src/cmd/sgs/libconv/common/symbols_sparc.c b/usr/src/cmd/sgs/libconv/common/symbols_sparc.c index a9662de17f..eb9513ee30 100644 --- a/usr/src/cmd/sgs/libconv/common/symbols_sparc.c +++ b/usr/src/cmd/sgs/libconv/common/symbols_sparc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,10 +18,12 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ + #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> @@ -41,12 +42,12 @@ static const Msg registers[] = { 0, }; const char * -conv_sym_SPARC_value_str(uint64_t val) +conv_sym_SPARC_value(Addr val) { - static char string[STRSIZE64] = { '\0' }; + static char string[CONV_INV_STRSIZE]; if ((val < STO_SPARC_REGISTER_G1) || (val > STO_SPARC_REGISTER_G7)) - return (conv_invalid_str(string, STRSIZE64, val, 0)); + return (conv_invalid_val(string, CONV_INV_STRSIZE, val, 0)); else return (MSG_ORIG(registers[val])); } diff --git a/usr/src/cmd/sgs/libconv/common/symbols_sparc.msg b/usr/src/cmd/sgs/libconv/common/symbols_sparc.msg index 527d6f4fee..774a7412be 100644 --- a/usr/src/cmd/sgs/libconv/common/symbols_sparc.msg +++ b/usr/src/cmd/sgs/libconv/common/symbols_sparc.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,9 +18,13 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# # ident "%Z%%M% %I% %E% SMI" # -# Message file for cmd/sgs/libconv/common/symbols_sparc.c @ MSG_STO_REGISTERG1 "REG_G1" @ MSG_STO_REGISTERG2 "REG_G2" diff --git a/usr/src/cmd/sgs/libconv/common/tokens.c b/usr/src/cmd/sgs/libconv/common/tokens.c index 1c0d67d4d6..52135e1243 100644 --- a/usr/src/cmd/sgs/libconv/common/tokens.c +++ b/usr/src/cmd/sgs/libconv/common/tokens.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 1999,2001 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" diff --git a/usr/src/cmd/sgs/libconv/common/version.c b/usr/src/cmd/sgs/libconv/common/version.c index c4ce9239b4..8d577a5695 100644 --- a/usr/src/cmd/sgs/libconv/common/version.c +++ b/usr/src/cmd/sgs/libconv/common/version.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -33,11 +33,8 @@ #include "version_msg.h" const char * -conv_verflg_str(ushort_t flags) +conv_ver_flags(Half flags) { - /* - * Presently we only know about a weak flag. - */ if (flags & VER_FLG_WEAK) return (MSG_ORIG(MSG_VER_FLG_WEAK)); else if (flags & VER_FLG_BASE) diff --git a/usr/src/cmd/sgs/libconv/i386/Makefile b/usr/src/cmd/sgs/libconv/i386/Makefile index e657c34e6c..01486931df 100644 --- a/usr/src/cmd/sgs/libconv/i386/Makefile +++ b/usr/src/cmd/sgs/libconv/i386/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,10 +18,12 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -# Copyright (c) 1998 by Sun Microsystems, Inc. +# ident "%Z%%M% %I% %E% SMI" # include ../Makefile.com diff --git a/usr/src/cmd/sgs/libconv/sparc/Makefile b/usr/src/cmd/sgs/libconv/sparc/Makefile index e657c34e6c..01486931df 100644 --- a/usr/src/cmd/sgs/libconv/sparc/Makefile +++ b/usr/src/cmd/sgs/libconv/sparc/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,10 +18,12 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -# Copyright (c) 1998 by Sun Microsystems, Inc. +# ident "%Z%%M% %I% %E% SMI" # include ../Makefile.com diff --git a/usr/src/cmd/sgs/libconv/sparcv9/Makefile b/usr/src/cmd/sgs/libconv/sparcv9/Makefile index 4e0885885d..74c6c24d25 100644 --- a/usr/src/cmd/sgs/libconv/sparcv9/Makefile +++ b/usr/src/cmd/sgs/libconv/sparcv9/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,21 +18,19 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" # -# cmd/sgs/libconv/sparcv9/Makefile include ../Makefile.com .PARALLEL: $(PICS) .KEEP_STATE: -CPPFLAGS += -D_ELF64 - install all: $(LIBRARY) .WAIT include ../Makefile.targ diff --git a/usr/src/cmd/sgs/libcrle/amd64/Makefile b/usr/src/cmd/sgs/libcrle/amd64/Makefile index b90ba64a55..425d513e92 100644 --- a/usr/src/cmd/sgs/libcrle/amd64/Makefile +++ b/usr/src/cmd/sgs/libcrle/amd64/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -38,7 +38,8 @@ CPPFLAGS += -D_ELF64 all: $(DYNLIB) $(LIBLINKS) -install package: all $(ROOTDYNLIB64) +install \ +package: all $(ROOTDYNLIB64) lint: $(LINTOUT64) $(SGSLINTOUT) diff --git a/usr/src/cmd/sgs/libcrle/common/dump.c b/usr/src/cmd/sgs/libcrle/common/dump.c index fa3c14b15a..0340dd8f49 100644 --- a/usr/src/cmd/sgs/libcrle/common/dump.c +++ b/usr/src/cmd/sgs/libcrle/common/dump.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -78,7 +78,7 @@ load(const char *opath, const char *npath) MSG_ORIG(MSG_FIL_LIBCRLE), dlerror()); return (1); } - lmp = ghp->gh_owner; + lmp = ghp->gh_ownlmp; FLAGS1(lmp) |= FL1_RT_CONFSET; /* @@ -177,7 +177,7 @@ scanconfig(Addr addr, int (*fptr)()) if ((ghp = dlmopen(LM_ID_BASE, 0, (RTLD_NOLOAD | RTLD_CONFGEN))) == 0) return (1); - FLAGS1(ghp->gh_owner) |= FL1_RT_CONFSET; + FLAGS1(ghp->gh_ownlmp) |= FL1_RT_CONFSET; } else { /* diff --git a/usr/src/cmd/sgs/libcrle/i386/Makefile b/usr/src/cmd/sgs/libcrle/i386/Makefile index 6e72484e0e..488cb7f9a8 100644 --- a/usr/src/cmd/sgs/libcrle/i386/Makefile +++ b/usr/src/cmd/sgs/libcrle/i386/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,20 +18,23 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# -include $(SRC)/cmd/sgs/libcrle/Makefile.com +include ../Makefile.com .KEEP_STATE: all: $(DYNLIB) $(LIBLINKS) -install package: all $(ROOTDYNLIB) +install \ +package: all $(ROOTDYNLIB) lint: $(LINTOUT32) $(SGSLINTOUT) -include $(SRC)/cmd/sgs/libcrle/Makefile.targ +include ../Makefile.targ diff --git a/usr/src/cmd/sgs/libcrle/sparc/Makefile b/usr/src/cmd/sgs/libcrle/sparc/Makefile index e5b15dbcf4..488cb7f9a8 100644 --- a/usr/src/cmd/sgs/libcrle/sparc/Makefile +++ b/usr/src/cmd/sgs/libcrle/sparc/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,11 +18,13 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# include ../Makefile.com @@ -31,7 +32,8 @@ include ../Makefile.com all: $(DYNLIB) $(LIBLINKS) -install package: all $(ROOTDYNLIB) +install \ +package: all $(ROOTDYNLIB) lint: $(LINTOUT32) $(SGSLINTOUT) diff --git a/usr/src/cmd/sgs/libcrle/sparcv9/Makefile b/usr/src/cmd/sgs/libcrle/sparcv9/Makefile index b90ba64a55..425d513e92 100644 --- a/usr/src/cmd/sgs/libcrle/sparcv9/Makefile +++ b/usr/src/cmd/sgs/libcrle/sparcv9/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -38,7 +38,8 @@ CPPFLAGS += -D_ELF64 all: $(DYNLIB) $(LIBLINKS) -install package: all $(ROOTDYNLIB64) +install \ +package: all $(ROOTDYNLIB64) lint: $(LINTOUT64) $(SGSLINTOUT) diff --git a/usr/src/cmd/sgs/libelf/Makefile b/usr/src/cmd/sgs/libelf/Makefile index e83316ecbc..2f70df00c7 100644 --- a/usr/src/cmd/sgs/libelf/Makefile +++ b/usr/src/cmd/sgs/libelf/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,12 @@ # # CDDL HEADER END # + # -# Copyright 2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" - -SPECDIR= spec +# include $(SRC)/cmd/sgs/Makefile.sub diff --git a/usr/src/cmd/sgs/libelf/Makefile.com b/usr/src/cmd/sgs/libelf/Makefile.com index 70d75d4a47..04fc80ed74 100644 --- a/usr/src/cmd/sgs/libelf/Makefile.com +++ b/usr/src/cmd/sgs/libelf/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -64,14 +64,13 @@ $(OBJS) := XFFLAG= WARLOCKFILES= $(OBJECTS:%.o=wlocks/%.ll) -MAPFILE= $(MAPDIR)/mapfile -MAPFILES= $(MAPFILE) +MAPFILES= ../common/mapfile-common MAPOPTS= $(MAPFILES:%=-M%) -CLOBBERFILES += $(MAPFILE) +CLOBBERFILES += DYNFLAGS += $(VERSREF) $(MAPOPTS) -LDLIBS += $(CONVLIBDIR) -lconv $(VAR_LIBELF_LDLIBS) -lc +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) $(VAR_LIBELF_LDLIBS) -lc LINTFLAGS += -u -erroff=E_BAD_PTR_CAST_ALIGN LINTFLAGS64 += -u -erroff=E_CAST_INT_TO_SMALL_INT diff --git a/usr/src/cmd/sgs/libelf/Makefile.targ b/usr/src/cmd/sgs/libelf/Makefile.targ index d1739711a6..e2264e5178 100644 --- a/usr/src/cmd/sgs/libelf/Makefile.targ +++ b/usr/src/cmd/sgs/libelf/Makefile.targ @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ # # CDDL HEADER END # + # -# Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -# sgs/libelf/Makefile.targ $(VAR_POUND_2)LIBS += $(LIBRARY) @@ -67,12 +66,7 @@ $(VAR_POUND_2)lint := LIBTHREADFLAG=-lthread delete: $(RM) $(DYNLIB) -$(DYNLIB): $(MAPFILES) - -$(VAR_SPEC_ON)$(MAPFILE): -$(VAR_SPEC_ON) @ cd $(MAPDIR); $(MAKE) mapfile -$(VAR_SPEC_OFF)$(MAPFILE): -$(VAR_SPEC_OFF) @ sccs get mapfile +$(DYNLIB): $$(MAPFILES) $(LIBLINKS): $(RM) $(LIBLINKS) diff --git a/usr/src/cmd/sgs/libelf/Makefile.targ.64 b/usr/src/cmd/sgs/libelf/Makefile.targ.64 index a1fb80fde9..4bb6e6f15f 100644 --- a/usr/src/cmd/sgs/libelf/Makefile.targ.64 +++ b/usr/src/cmd/sgs/libelf/Makefile.targ.64 @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ # # CDDL HEADER END # + # -# Copyright 1997-2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -# cmd/sgs/libelf/Makefile.targ.64 objs/%.o \ pics/%.o: %.c @@ -64,11 +63,6 @@ delete: $(DYNLIB): $(MAPFILES) -$(VAR_SPEC_ON)$(MAPFILE): -$(VAR_SPEC_ON) @ cd $(MAPDIR); $(MAKE) mapfile -$(VAR_SPEC_OFF)$(MAPFILE): -$(VAR_SPEC_OFF) @ sccs get mapfile - $(LIBLINKS): $(RM) $(LIBLINKS) $(SYMLINK) $(DYNLIB) $(LIBLINKS) diff --git a/usr/src/cmd/sgs/libelf/amd64/Makefile b/usr/src/cmd/sgs/libelf/amd64/Makefile index a3f89dad26..38303fff2e 100644 --- a/usr/src/cmd/sgs/libelf/amd64/Makefile +++ b/usr/src/cmd/sgs/libelf/amd64/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,15 +18,14 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -MAPDIR= $(VAR_MAPDIR_amd64) - include ../Makefile.com CONVLIBDIR= $(CONVLIBDIR64) diff --git a/usr/src/cmd/sgs/libelf/common/lintsup.c b/usr/src/cmd/sgs/libelf/common/lintsup.c index d600b4cdfc..0afa6c1e8b 100644 --- a/usr/src/cmd/sgs/libelf/common/lintsup.c +++ b/usr/src/cmd/sgs/libelf/common/lintsup.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,33 +18,17 @@ * * CDDL HEADER END */ -/* LINTLIBRARY */ -/* PROTOLIB1 */ /* - * Copyright (c) 1998 by Sun Microsystems, Inc. - * All rights reserved. - */ + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ -#pragma ident "%Z%%M% %I% %E% SMI" +/* LINTLIBRARY */ +/* PROTOLIB1 */ -/* - * Supplimental definitions for lint that help us avoid - * options like `-x' that filter out things we want to - * know about as well as things we don't. - */ +#pragma ident "%Z%%M% %I% %E% SMI" -/* - * The public interfaces are allowed to be "declared - * but not used". - */ #include <malloc.h> #include <link.h> - - -/* - * These are from libc.so.1, but are not in it's lint - * library. - */ -int __threaded; -char * _dgettext(const char *, const char *); +#include <sgs.h> diff --git a/usr/src/cmd/sgs/libelf/spec/Makefile.targ b/usr/src/cmd/sgs/libelf/common/mapfile-32 index afcbac02a0..14b0a68547 100644 --- a/usr/src/cmd/sgs/libelf/spec/Makefile.targ +++ b/usr/src/cmd/sgs/libelf/common/mapfile-32 @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,22 +18,15 @@ # # CDDL HEADER END # -#ident "%Z%%M% %I% %E% SMI" + # -# Copyright (c) 1997-1999 by Sun Microsystems, Inc. -# All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" # -# cmd/sgs/libelf/Makefile.targ - -LIBRARY = libelf.a -VERS = .1 - -OBJECTS = elf.o \ - elf32.o \ - elf64.o \ - gelf.o \ - weak.o - -SPECCPP = -lint: +SUNWprivate_1.1 { + global: + elf_demangle; +}; diff --git a/usr/src/cmd/sgs/libelf/common/mapfile-common b/usr/src/cmd/sgs/libelf/common/mapfile-common new file mode 100644 index 0000000000..84e86b86d9 --- /dev/null +++ b/usr/src/cmd/sgs/libelf/common/mapfile-common @@ -0,0 +1,187 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +SUNW_1.6 { + global: + elf_getphnum; +} SUNW_1.5; + +SUNW_1.5 { + global: + gelf_getcap; + gelf_update_cap; +} SUNW_1.4; + +SUNW_1.4 { + global: + elf_getshnum; + elf_getshstrndx; + gelf_getsymshndx; + gelf_update_symshndx; +} SUNW_1.3; + +SUNW_1.3 { + global: + elf32_checksum; + elf64_checksum; + gelf_checksum; +} SUNW_1.2; + +SUNW_1.2 { + global: + elf64_fsize; + elf64_getehdr; + elf64_getphdr; + elf64_getshdr; + elf64_newehdr; + elf64_newphdr; + elf64_xlatetof; + elf64_xlatetom; + gelf_getclass; + gelf_fsize; + gelf_getehdr; + gelf_update_ehdr; + gelf_newehdr; + gelf_getphdr; + gelf_update_phdr; + gelf_newphdr; + gelf_getshdr; + gelf_update_shdr; + gelf_xlatetof; + gelf_xlatetom; + gelf_getsym; + gelf_update_sym; + gelf_getsyminfo; + gelf_getmove; + gelf_update_move; + gelf_update_syminfo; + gelf_getdyn; + gelf_update_dyn; + gelf_getrela; + gelf_update_rela; + gelf_getrel; + gelf_update_rel; +} SUNW_1.1; + +SUNW_1.1 { + global: + SUNW_1.1; +} SUNW_0.7; + +SUNW_0.7 { + global: + elf_begin; + elf_end; + elf_memory; + elf_next; + elf_rand; + elf_cntl; + elf_errmsg; + elf_errno; + elf_fill; + elf_flagdata; + elf_flagehdr; + elf_flagelf; + elf_flagphdr; + elf_flagscn; + elf_flagshdr; + elf_getarhdr; + elf_getarsym; + elf_getbase; + elf_getdata; + elf_newdata; + elf_rawdata; + elf_getident; + elf_getscn; + elf_ndxscn; + elf_newscn; + elf_nextscn; + elf_hash; + elf_kind; + elf_rawfile; + elf_strptr; + elf_update; + elf_version; + nlist; + elf32_fsize; + elf32_getphdr; + elf32_newphdr; + elf32_getshdr; + elf32_getehdr; + elf32_newehdr; + elf32_xlatetof; + elf32_xlatetom; + local: + *; +}; + +SUNWprivate_1.1 { + global: + _elf_getxoff; + _elf_outsync; + _elf_begin; + _elf_memory; + _elf_cntl; + _elf_end; + _elf_errno; + _elf_errmsg; + _elf_fill; + _elf_flagdata; + _elf_flagehdr; + _elf_flagelf; + _elf_flagphdr; + _elf_flagscn; + _elf_flagshdr; + _elf_getarhdr; + _elf_getarsym; + _elf_getbase; + _elf_getdata; + _elf32_getehdr; + _elf_getident; + _elf32_getphdr; + _elf_getscn; + _elf32_getshdr; + _elf_hash; + _elf_kind; + _elf_ndxscn; + _elf_newdata; + _elf32_newehdr; + _elf32_newphdr; + _elf_newscn; + _elf_next; + _elf_nextscn; + _elf_rand; + _elf_rawdata; + _elf_rawfile; + _elf_strptr; + _elf_update; + _elf32_fsize; + _elf32_xlatetof; + _elf32_xlatetom; + _elf_version; +}; diff --git a/usr/src/cmd/sgs/libelf/common/xlate.m4 b/usr/src/cmd/sgs/libelf/common/xlate.m4 index 8fa336f562..69ed313a0f 100644 --- a/usr/src/cmd/sgs/libelf/common/xlate.m4 +++ b/usr/src/cmd/sgs/libelf/common/xlate.m4 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1600,15 +1600,18 @@ $1(Elf32_Nhdr *dst, unsigned char *src, size_t cnt) dst->n_descsz = tomw(src, N1_descsz_$2); dst->n_type = tomw(src, N1_type_$2); nhdr = dst; + /* LINTED */ dst = (Elf32_Nhdr *)((char *)dst + sizeof (Elf32_Nhdr)); namestr = src + N1_sizeof; field_sz = S_ROUND(nhdr->n_namesz, sizeof (Elf32_Word)); (void)memcpy((void *)dst, namestr, field_sz); desc = namestr + field_sz; + /* LINTED */ dst = (Elf32_Nhdr *)((char *)dst + field_sz); field_sz = nhdr->n_descsz; (void)memcpy(dst, desc, field_sz); field_sz = S_ROUND(field_sz, sizeof (Elf32_Word)); + /* LINTED */ dst = (Elf32_Nhdr *)((char *)dst + field_sz); src = (unsigned char *)desc + field_sz; } diff --git a/usr/src/cmd/sgs/libelf/common/xlate64.m4 b/usr/src/cmd/sgs/libelf/common/xlate64.m4 index 267c025586..3105e929c5 100644 --- a/usr/src/cmd/sgs/libelf/common/xlate64.m4 +++ b/usr/src/cmd/sgs/libelf/common/xlate64.m4 @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1644,15 +1644,18 @@ $1(Elf64_Nhdr *dst, unsigned char *src, size_t cnt) dst->n_descsz = tomw(src, N1_descsz_$2); dst->n_type = tomw(src, N1_type_$2); nhdr = dst; + /* LINTED */ dst = (Elf64_Nhdr *)((char *)dst + sizeof (Elf64_Nhdr)); namestr = src + N1_sizeof; field_sz = S_ROUND(nhdr->n_namesz, sizeof (Elf64_Word)); (void)memcpy((void *)dst, namestr, field_sz); desc = namestr + field_sz; + /* LINTED */ dst = (Elf64_Nhdr *)((char *)dst + field_sz); field_sz = nhdr->n_descsz; (void)memcpy(dst, desc, field_sz); field_sz = S_ROUND(field_sz, sizeof (Elf64_Word)); + /* LINTED */ dst = (Elf64_Nhdr *)((char *)dst + field_sz); src = (unsigned char *)desc + field_sz; } diff --git a/usr/src/cmd/sgs/libelf/i386/Makefile b/usr/src/cmd/sgs/libelf/i386/Makefile index 0c71b144d6..c68f2cfae5 100644 --- a/usr/src/cmd/sgs/libelf/i386/Makefile +++ b/usr/src/cmd/sgs/libelf/i386/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,19 +18,16 @@ # # CDDL HEADER END # + # -# Copyright 2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" -MAPDIR= $(VAR_MAPDIR_i386) - include ../Makefile.com -# Optimization reduced to level O1 due to compiler bug# 4137136 - -COPTFLAG= -xO1 +MAPFILES += ../common/mapfile-32 SGSMSGTARG += $(SGSMSG32) diff --git a/usr/src/cmd/sgs/libelf/sparc/Makefile b/usr/src/cmd/sgs/libelf/sparc/Makefile index 13aacdcc6d..c68f2cfae5 100644 --- a/usr/src/cmd/sgs/libelf/sparc/Makefile +++ b/usr/src/cmd/sgs/libelf/sparc/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,16 +18,17 @@ # # CDDL HEADER END # + # -# Copyright 2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" -MAPDIR= $(VAR_MAPDIR_sparc) - include ../Makefile.com +MAPFILES += ../common/mapfile-32 + SGSMSGTARG += $(SGSMSG32) .KEEP_STATE: diff --git a/usr/src/cmd/sgs/libelf/sparcv9/Makefile b/usr/src/cmd/sgs/libelf/sparcv9/Makefile index 5d703a1d05..38303fff2e 100644 --- a/usr/src/cmd/sgs/libelf/sparcv9/Makefile +++ b/usr/src/cmd/sgs/libelf/sparcv9/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ # # CDDL HEADER END # + # -# Copyright 2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" - -MAPDIR= $(VAR_MAPDIR_sparcv9) +# include ../Makefile.com diff --git a/usr/src/cmd/sgs/libelf/spec/elf.spec b/usr/src/cmd/sgs/libelf/spec/elf.spec deleted file mode 100644 index ae88a0aac2..0000000000 --- a/usr/src/cmd/sgs/libelf/spec/elf.spec +++ /dev/null @@ -1,287 +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 -# -#pragma ident "%Z%%M% %I% %E% SMI" -# -# cmd/sgs/libelf/spec/elf.spec - - -function elf_getphnum -include <libelf.h> -declaration int elf_getphnum(Elf *elf, size_t *phnum) -version SUNW_1.6 -end - -function elf_getshnum -include <libelf.h> -declaration int elf_getshnum(Elf *elf, size_t *shnum) -version SUNW_1.4 -end - -function elf_getshstrndx -include <libelf.h> -declaration int elf_getshstrndx(Elf *elf, size_t *shstrndx) -version SUNW_1.4 -end - -function elf_begin -include <libelf.h> -declaration Elf *elf_begin(int fildes, Elf_Cmd cmd, Elf *ref) -version SUNW_0.7 -exception $return == NULL -end - -function elf_end -include <libelf.h> -declaration int elf_end(Elf *elf) -version SUNW_0.7 -exception $return == 0 -end - -function elf_memory -include <libelf.h> -declaration Elf *elf_memory(char *image, size_t sz) -version SUNW_0.7 -exception $return == NULL -end - -function elf_next -include <libelf.h> -declaration Elf_Cmd elf_next(Elf *elf) -version SUNW_0.7 -exception $return == ELF_C_NULL -end - -function elf_rand -include <libelf.h> -declaration size_t elf_rand(Elf *elf, size_t offset) -version SUNW_0.7 -exception $return == 0 -end - -function elf_cntl -include <libelf.h> -declaration int elf_cntl(Elf *elf, Elf_Cmd cmd) -version SUNW_0.7 -exception $return == -1 -end - -function elf_errmsg -include <libelf.h> -declaration const char *elf_errmsg (int err) -version SUNW_0.7 -exception $return == NULL -end - -function elf_errno -include <libelf.h> -declaration int elf_errno(void) -version SUNW_0.7 -end - -function elf_fill -include <libelf.h> -declaration void elf_fill(int fill) -version SUNW_0.7 -end - -function elf_flagdata -include <libelf.h> -declaration unsigned elf_flagdata(Elf_Data *data, Elf_Cmd cmd, \ - unsigned flags) -version SUNW_0.7 -exception $return == 0 -end - -function elf_flagehdr -include <libelf.h> -declaration unsigned elf_flagehdr(Elf *elf, Elf_Cmd cmd, unsigned flags) -version SUNW_0.7 -exception $return == 0 -end - -function elf_flagelf -include <libelf.h> -declaration unsigned elf_flagelf(Elf *elf, Elf_Cmd cmd, unsigned flags) -version SUNW_0.7 -exception $return == 0 -end - -function elf_flagphdr -include <libelf.h> -declaration unsigned elf_flagphdr(Elf *elf, Elf_Cmd cmd, unsigned flags) -version SUNW_0.7 -exception $return == 0 -end - -function elf_flagscn -include <libelf.h> -declaration unsigned elf_flagscn(Elf_Scn *scn, Elf_Cmd cmd, unsigned flags) -version SUNW_0.7 -exception $return == 0 -end - -function elf_flagshdr -include <libelf.h> -declaration unsigned elf_flagshdr(Elf_Scn *scn, Elf_Cmd cmd, unsigned flags) -version SUNW_0.7 -exception $return == 0 -end - -function elf_getarhdr -include <libelf.h> -declaration Elf_Arhdr *elf_getarhdr(Elf *elf) -version SUNW_0.7 -exception $return == NULL -end - -function elf_getarsym -include <libelf.h> -declaration Elf_Arsym *elf_getarsym(Elf *elf, size_t *ptr) -version SUNW_0.7 -exception $return == NULL -end - -function elf_getbase -include <libelf.h> -declaration off_t elf_getbase(Elf *elf) -version SUNW_0.7 -exception $return == -1 -end - -function elf_getdata -include <libelf.h> -declaration Elf_Data *elf_getdata(Elf_Scn *scn, Elf_Data *data) -version SUNW_0.7 -exception $return == NULL -end - -function elf_newdata -include <libelf.h> -declaration Elf_Data *elf_newdata(Elf_Scn *scn) -version SUNW_0.7 -exception $return == NULL -end - -function elf_rawdata -include <libelf.h> -declaration Elf_Data *elf_rawdata(Elf_Scn *scn, Elf_Data *data) -version SUNW_0.7 -exception $return == NULL -end - -function elf_getident -include <libelf.h> -declaration char *elf_getident(Elf *elf, size_t *ptr) -version SUNW_0.7 -exception $return == NULL -end - -function elf_getscn -include <libelf.h> -declaration Elf_Scn *elf_getscn(Elf *elf, size_t index) -version SUNW_0.7 -exception $return == NULL -end - -function elf_ndxscn -include <libelf.h> -declaration size_t elf_ndxscn(Elf_Scn *scn) -version SUNW_0.7 -exception $return == SHN_UNDEF -end - -function elf_newscn -include <libelf.h> -declaration Elf_Scn *elf_newscn(Elf *elf) -version SUNW_0.7 -exception $return == NULL -end - -function elf_nextscn -include <libelf.h> -declaration Elf_Scn *elf_nextscn(Elf *elf, Elf_Scn *scn) -version SUNW_0.7 -exception $return == NULL -end - -function elf_hash -include <libelf.h> -declaration unsigned long elf_hash(const char *name) -version SUNW_0.7 -end - -function elf_kind -include <libelf.h> -declaration Elf_Kind elf_kind(Elf *elf) -version SUNW_0.7 -exception $return == ELF_K_NONE -end - -function elf_rawfile -include <libelf.h> -declaration char *elf_rawfile(Elf *elf, size_t *ptr) -version SUNW_0.7 -exception $return == NULL -end - -function elf_strptr -include <libelf.h> -declaration char *elf_strptr(Elf *elf, size_t section, size_t offset) -version SUNW_0.7 -exception $return == NULL -end - -function elf_update -include <libelf.h> -declaration off_t elf_update(Elf *elf, Elf_Cmd cmd) -version SUNW_0.7 -exception $return == -1 -end - -function elf_version -include <libelf.h> -declaration unsigned elf_version(unsigned ver) -version SUNW_0.7 -end - -function nlist -include <nlist.h> -declaration int nlist(const char *filename, struct nlist *nl) -version SUNW_0.7 -exception $return == -1 -end - -function _elf_getxoff -version SUNWprivate_1.1 -end - -function _elf_outsync -version SUNWprivate_1.1 -end - -function elf_demangle -arch sparc i386 -version SUNWprivate_1.1 -end diff --git a/usr/src/cmd/sgs/libelf/spec/elf32.spec b/usr/src/cmd/sgs/libelf/spec/elf32.spec deleted file mode 100644 index 43695f4e78..0000000000 --- a/usr/src/cmd/sgs/libelf/spec/elf32.spec +++ /dev/null @@ -1,93 +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 -# -#pragma ident "%Z%%M% %I% %E% SMI" -# -# cmd/sgs/libelf/spec/elf32.spec - -function elf32_checksum -include <libelf.h> -declaration long elf32_checksum(Elf *elf) -version SUNW_1.3 -exception $return == 0 -end - -function elf32_fsize -include <libelf.h> -declaration size_t elf32_fsize(Elf_Type type, size_t count, unsigned ver) -version SUNW_0.7 -exception $return == 0 -end - -function elf32_getphdr -include <libelf.h> -declaration Elf32_Phdr *elf32_getphdr(Elf *elf) -version SUNW_0.7 -exception $return == NULL -end - -function elf32_newphdr -include <libelf.h> -declaration Elf32_Phdr *elf32_newphdr(Elf *elf, size_t count) -version SUNW_0.7 -exception $return == NULL -end - -function elf32_getshdr -include <libelf.h> -declaration Elf32_Shdr *elf32_getshdr(Elf_Scn *scn) -version SUNW_0.7 -exception $return == NULL -end - -function elf32_getehdr -include <libelf.h> -declaration Elf32_Ehdr *elf32_getehdr(Elf *elf) -version SUNW_0.7 -exception $return == NULL -end - -function elf32_newehdr -include <libelf.h> -declaration Elf32_Ehdr *elf32_newehdr(Elf *elf) -version SUNW_0.7 -exception $return == NULL -end - -function elf32_xlatetof -include <libelf.h> -declaration Elf_Data *elf32_xlatetof(Elf_Data *dst, const Elf_Data *src,\ - unsigned encode) -version SUNW_0.7 -exception $return == NULL -end - -function elf32_xlatetom -include <libelf.h> -declaration Elf_Data *elf32_xlatetom(Elf_Data *dst, const Elf_Data *src, \ - unsigned encode) -version SUNW_0.7 -exception $return == NULL -end - diff --git a/usr/src/cmd/sgs/libelf/spec/elf64.spec b/usr/src/cmd/sgs/libelf/spec/elf64.spec deleted file mode 100644 index db77772cc8..0000000000 --- a/usr/src/cmd/sgs/libelf/spec/elf64.spec +++ /dev/null @@ -1,93 +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 -# -#pragma ident "%Z%%M% %I% %E% SMI" -# -# cmd/sgs/libelf/spec/elf64.spec - -function elf64_checksum -include <libelf.h> -declaration long elf64_checksum(Elf *elf) -version SUNW_1.3 -exception $return == 0 -end - -function elf64_fsize -include <libelf.h> -declaration size_t elf64_fsize(Elf_Type type, size_t count, unsigned ver) -version SUNW_1.2 -exception $return == 0 -end - -function elf64_getehdr -include <libelf.h> -declaration Elf64_Ehdr *elf64_getehdr(Elf *elf) -version SUNW_1.2 -exception $return == NULL -end - -function elf64_getphdr -include <libelf.h> -declaration Elf64_Phdr *elf64_getphdr(Elf *elf) -version SUNW_1.2 -exception $return == NULL -end - -function elf64_getshdr -include <libelf.h> -declaration Elf64_Shdr *elf64_getshdr(Elf_Scn *scn) -version SUNW_1.2 -exception $return == NULL -end - -function elf64_newehdr -include <libelf.h> -declaration Elf64_Ehdr *elf64_newehdr(Elf *elf) -version SUNW_1.2 -exception $return == NULL -end - -function elf64_newphdr -include <libelf.h> -declaration Elf64_Phdr *elf64_newphdr(Elf *elf, size_t count) -version SUNW_1.2 -exception $return == NULL -end - -function elf64_xlatetof -include <libelf.h> -declaration Elf_Data *elf64_xlatetof(Elf_Data *dst, const Elf_Data *src,\ - unsigned encode) -version SUNW_1.2 -exception $return == NULL -end - -function elf64_xlatetom -include <libelf.h> -declaration Elf_Data *elf64_xlatetom(Elf_Data *dst, const Elf_Data *src, \ - unsigned encode) -version SUNW_1.2 -exception $return == NULL -end - diff --git a/usr/src/cmd/sgs/libelf/spec/gelf.spec b/usr/src/cmd/sgs/libelf/spec/gelf.spec deleted file mode 100644 index 6ed2934e66..0000000000 --- a/usr/src/cmd/sgs/libelf/spec/gelf.spec +++ /dev/null @@ -1,208 +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" -# -# cmd/sgs/libelf/spec/gelf.spec - -function gelf_getsymshndx -include <gelf.h> -declaration GElf_Sym *gelf_getsymshndx(Elf_Data *symdata, \ - Elf_Data *shndxdata, int ndx, \ - GElf_Sym *symptr, Elf32_Word *xshndx); -version SUNW_1.4 -end - -function gelf_update_symshndx -include <gelf.h> -declaration int gelf_update_symshndx(Elf_Data *symdata, \ - Elf_Data *shndxdata, int ndx, \ - GElf_Sym *symptr, Elf32_Word xshndx); -version SUNW_1.4 -end - -function gelf_checksum -include <gelf.h> -declaration long gelf_checksum(Elf *elf) -version SUNW_1.3 -end - -function gelf_getclass -include <gelf.h> -declaration int gelf_getclass(Elf *elf) -version SUNW_1.2 -end - -function gelf_fsize -include <gelf.h> -declaration size_t gelf_fsize(Elf *elf, Elf_Type type, size_t count, unsigned ver) -version SUNW_1.2 -end - -function gelf_getehdr -include <gelf.h> -declaration GElf_Ehdr *gelf_getehdr(Elf *elf, GElf_Ehdr *dst) -version SUNW_1.2 -end - -function gelf_update_ehdr -include <gelf.h> -declaration int gelf_update_ehdr(Elf *elf, GElf_Ehdr *src) -version SUNW_1.2 -end - -function gelf_newehdr -include <gelf.h> -declaration unsigned long gelf_newehdr(Elf *elf, int elfclass) -version SUNW_1.2 -end - -function gelf_getphdr -include <gelf.h> -declaration GElf_Phdr *gelf_getphdr(Elf *elf, int ndx, GElf_Phdr *dst) -version SUNW_1.2 -end - -function gelf_update_phdr -include <gelf.h> -declaration int gelf_update_phdr(Elf *elf, int ndx, GElf_Phdr *src) -version SUNW_1.2 -end - -function gelf_newphdr -include <gelf.h> -declaration unsigned long gelf_newphdr(Elf *elf, size_t phnum) -version SUNW_1.2 -end - -function gelf_getshdr -include <gelf.h> -declaration GElf_Shdr *gelf_getshdr(Elf_Scn *scn, GElf_Shdr *dst) -version SUNW_1.2 -end - -function gelf_update_shdr -include <gelf.h> -declaration int gelf_update_shdr(Elf_Scn *scn, GElf_Shdr *src) -version SUNW_1.2 -end - -function gelf_xlatetof -include <gelf.h> -declaration Elf_Data *gelf_xlatetof(Elf *elf, Elf_Data *dst, \ - const Elf_Data *src, unsigned encode) -version SUNW_1.2 -end - -function gelf_xlatetom -include <gelf.h> -declaration Elf_Data *gelf_xlatetom(Elf *elf, Elf_Data *dst, \ - const Elf_Data * src, unsigned encode) -version SUNW_1.2 -end - -function gelf_getsym -include <gelf.h> -declaration GElf_Sym *gelf_getsym(Elf_Data *data, int ndx, GElf_Sym *dst) -version SUNW_1.2 -end - -function gelf_update_sym -include <gelf.h> -declaration int gelf_update_sym(Elf_Data *dest, int ndx, GElf_Sym *src) -version SUNW_1.2 -end - -function gelf_getsyminfo -include <gelf.h> -declaration GElf_Syminfo *gelf_getsyminfo(Elf_Data *data, int ndx, GElf_Syminfo *dst) -version SUNW_1.2 -end - -function gelf_getmove -include <gelf.h> -declaration GElf_Move *gelf_getmove(Elf_Data * data, int ndx, GElf_Move *src) -version SUNW_1.2 -end - -function gelf_update_move -include <gelf.h> -declaration int gelf_update_move(Elf_Data *dest, int ndx, GElf_Move *src) -version SUNW_1.2 -end - -function gelf_update_syminfo -include <gelf.h> -declaration int gelf_update_syminfo(Elf_Data *dest, int ndx, \ - GElf_Syminfo *src) -version SUNW_1.2 -end - -function gelf_getdyn -include <gelf.h> -declaration GElf_Dyn *gelf_getdyn(Elf_Data *src, int ndx, GElf_Dyn *dst) -version SUNW_1.2 -end - -function gelf_update_dyn -include <gelf.h> -declaration int gelf_update_dyn(Elf_Data *dst, int ndx, GElf_Dyn *src) -version SUNW_1.2 -end - -function gelf_getrela -include <gelf.h> -declaration GElf_Rela *gelf_getrela(Elf_Data *src, int ndx, GElf_Rela *dst) -version SUNW_1.2 -end - -function gelf_update_rela -include <gelf.h> -declaration int gelf_update_rela(Elf_Data *dst, int ndx, GElf_Rela *src) -version SUNW_1.2 -end - -function gelf_getrel -include <gelf.h> -declaration GElf_Rel *gelf_getrel(Elf_Data *src, int ndx, GElf_Rel *dst) -version SUNW_1.2 -end - -function gelf_update_rel -include <gelf.h> -declaration int gelf_update_rel(Elf_Data *dst, int ndx, GElf_Rel *src) -version SUNW_1.2 -end - -function gelf_getcap -include <gelf.h> -declaration GElf_Cap *gelf_getcap(Elf_Data *dst, int ndx, GElf_Cap *src) -version SUNW_1.5 -end - -function gelf_update_cap -include <gelf.h> -declaration int gelf_update_cap(Elf_Data *dst, int ndx, GElf_Cap *src) -version SUNW_1.5 -end diff --git a/usr/src/cmd/sgs/libelf/spec/i386/Makefile b/usr/src/cmd/sgs/libelf/spec/i386/Makefile deleted file mode 100644 index a55f688aaa..0000000000 --- a/usr/src/cmd/sgs/libelf/spec/i386/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1998-1999 by Sun Microsystems, Inc. -# All rights reserved. -# -# cmd/sgs/libelf/spec/i386/Makefile - -.KEEP_STATE: - -include ../Makefile.targ - -# Add arch specific objects here -OBJECTS += - -include $(SRC)/lib/Makefile.lib - -# Uncomment the following if the linker complains -#i386_C_PICFLAGS = -K PIC - -include $(SRC)/lib/Makefile.spec -ABILLIBC= - -install: $(ROOTABILIB) diff --git a/usr/src/cmd/sgs/libelf/spec/sparc/Makefile b/usr/src/cmd/sgs/libelf/spec/sparc/Makefile deleted file mode 100644 index 8a6fdd131d..0000000000 --- a/usr/src/cmd/sgs/libelf/spec/sparc/Makefile +++ /dev/null @@ -1,45 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1998-1999 by Sun Microsystems, Inc. -# All rights reserved. -# -# cmd/sgs/libelf/spec/sparc/Makefile - -.KEEP_STATE: - -include ../Makefile.targ - -# Add arch specific objects here -OBJECTS += - -include $(SRC)/lib/Makefile.lib - -# Uncomment the following if the linker complains -#sparc_C_PICFLAGS = -K PIC - -include $(SRC)/lib/Makefile.spec -ABILLIBC= - -install: $(ROOTABILIB) diff --git a/usr/src/cmd/sgs/libelf/spec/sparcv9/Makefile b/usr/src/cmd/sgs/libelf/spec/sparcv9/Makefile deleted file mode 100644 index 02c292df9c..0000000000 --- a/usr/src/cmd/sgs/libelf/spec/sparcv9/Makefile +++ /dev/null @@ -1,46 +0,0 @@ -# -# CDDL HEADER START -# -# The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. -# -# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE -# or http://www.opensolaris.org/os/licensing. -# See the License for the specific language governing permissions -# and limitations under the License. -# -# When distributing Covered Code, include this CDDL HEADER in each -# file and include the License file at usr/src/OPENSOLARIS.LICENSE. -# If applicable, add the following below this CDDL HEADER, with the -# fields enclosed by brackets "[]" replaced with your own identifying -# information: Portions Copyright [yyyy] [name of copyright owner] -# -# CDDL HEADER END -# -# -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 1997-1999 by Sun Microsystems, Inc. -# All rights reserved. -# -# cmd/sgs/libelf/spec/sparcv9/Makefile - -.KEEP_STATE: - -include ../Makefile.targ - -# Add arch specific objects here -OBJECTS += - -include $(SRC)/lib/Makefile.lib -include $(SRC)/lib/Makefile.lib.64 - -# Uncomment the following if the linker complains -sparcv9_C_PICFLAGS = -K PIC - -include $(SRC)/lib/Makefile.spec -ABILLIBC= - -install: $(ROOTABILIB64) diff --git a/usr/src/cmd/sgs/libelf/spec/versions b/usr/src/cmd/sgs/libelf/spec/versions deleted file mode 100644 index fa6f63a757..0000000000 --- a/usr/src/cmd/sgs/libelf/spec/versions +++ /dev/null @@ -1,71 +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" -# -# Note: Even though the SUNW_1.1 version now contains no symbols -# beyond what was present at Solaris 2.3, the SUNW_1.1 version MUST be -# present. This is because applications built on 2.6 Beta -# (when it did contain symbols explicitly) may depend on it. -# -sparc { - SUNW_1.6: {SUNW_1.5}; - SUNW_1.5: {SUNW_1.4}; - SUNW_1.4: {SUNW_1.3}; - SUNW_1.3: {SUNW_1.2}; - SUNW_1.2: {SUNW_1.1}; - SUNW_1.1: {SUNW_0.7}; - SUNW_0.7; - SUNWprivate_1.1; -} -sparcv9 { - SUNW_1.6: {SUNW_1.5}; - SUNW_1.5: {SUNW_1.4}; - SUNW_1.4: {SUNW_1.3}; - SUNW_1.3: {SUNW_1.2}; - SUNW_1.2: {SUNW_1.1}; - SUNW_1.1: {SUNW_0.7}; - SUNW_0.7; - SUNWprivate_1.1; -} -i386 { - SUNW_1.6: {SUNW_1.5}; - SUNW_1.5: {SUNW_1.4}; - SUNW_1.4: {SUNW_1.3}; - SUNW_1.3: {SUNW_1.2}; - SUNW_1.2: {SUNW_1.1}; - SUNW_1.1: {SUNW_0.7}; - SUNW_0.7; - SUNWprivate_1.1; -} -amd64 { - SUNW_1.6: {SUNW_1.5}; - SUNW_1.5: {SUNW_1.4}; - SUNW_1.4: {SUNW_1.3}; - SUNW_1.3: {SUNW_1.2}; - SUNW_1.2: {SUNW_1.1}; - SUNW_1.1: {SUNW_0.7}; - SUNW_0.7; - SUNWprivate_1.1; -} diff --git a/usr/src/cmd/sgs/libelf/spec/weak.spec b/usr/src/cmd/sgs/libelf/spec/weak.spec deleted file mode 100644 index d512cfb016..0000000000 --- a/usr/src/cmd/sgs/libelf/spec/weak.spec +++ /dev/null @@ -1,228 +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 -# -#pragma ident "%Z%%M% %I% %E% SMI" -# -# cmd/sgs/libelf/spec/weak.spec - -function _elf_begin -weak elf_begin -version SUNWprivate_1.1 -end - -function _elf_memory -weak elf_memory -version SUNWprivate_1.1 -end - -function _elf_cntl -weak elf_cntl -version SUNWprivate_1.1 -end - -function _elf_end -weak elf_end -version SUNWprivate_1.1 -end - -function _elf_errno -weak elf_errno -version SUNWprivate_1.1 -end - -function _elf_errmsg -weak elf_errmsg -version SUNWprivate_1.1 -end - -function _elf_fill -weak elf_fill -version SUNWprivate_1.1 -end - -function _elf_flagdata -weak elf_flagdata -version SUNWprivate_1.1 -end - -function _elf_flagehdr -weak elf_flagehdr -version SUNWprivate_1.1 -end - -function _elf_flagelf -weak elf_flagelf -version SUNWprivate_1.1 -end - -function _elf_flagphdr -weak elf_flagphdr -version SUNWprivate_1.1 -end - -function _elf_flagscn -weak elf_flagscn -version SUNWprivate_1.1 -end - -function _elf_flagshdr -weak elf_flagshdr -version SUNWprivate_1.1 -end - -function _elf_getarhdr -weak elf_getarhdr -version SUNWprivate_1.1 -end - -function _elf_getarsym -weak elf_getarsym -version SUNWprivate_1.1 -end - -function _elf_getbase -weak elf_getbase -version SUNWprivate_1.1 -end - -function _elf_getdata -weak elf_getdata -version SUNWprivate_1.1 -end - -function _elf32_getehdr -weak elf32_getehdr -version SUNWprivate_1.1 -end - -function _elf_getident -weak elf_getident -version SUNWprivate_1.1 -end - -function _elf32_getphdr -weak elf32_getphdr -version SUNWprivate_1.1 -end - -function _elf_getscn -weak elf_getscn -version SUNWprivate_1.1 -end - -function _elf32_getshdr -weak elf32_getshdr -version SUNWprivate_1.1 -end - -function _elf_hash -weak elf_hash -version SUNWprivate_1.1 -end - -function _elf_kind -weak elf_kind -version SUNWprivate_1.1 -end - -function _elf_ndxscn -weak elf_ndxscn -version SUNWprivate_1.1 -end - -function _elf_newdata -weak elf_newdata -version SUNWprivate_1.1 -end - -function _elf32_newehdr -weak elf32_newehdr -version SUNWprivate_1.1 -end - -function _elf32_newphdr -weak elf32_newphdr -version SUNWprivate_1.1 -end - -function _elf_newscn -weak elf_newscn -version SUNWprivate_1.1 -end - -function _elf_next -weak elf_next -version SUNWprivate_1.1 -end - -function _elf_nextscn -weak elf_nextscn -version SUNWprivate_1.1 -end - -function _elf_rand -weak elf_rand -version SUNWprivate_1.1 -end - -function _elf_rawdata -weak elf_rawdata -version SUNWprivate_1.1 -end - -function _elf_rawfile -weak elf_rawfile -version SUNWprivate_1.1 -end - -function _elf_strptr -weak elf_strptr -version SUNWprivate_1.1 -end - -function _elf_update -weak elf_update -version SUNWprivate_1.1 -end - -function _elf32_fsize -weak elf32_fsize -version SUNWprivate_1.1 -end - -function _elf32_xlatetof -weak elf32_xlatetof -version SUNWprivate_1.1 -end - -function _elf32_xlatetom -weak elf32_xlatetom -version SUNWprivate_1.1 -end - -function _elf_version -weak elf_version -version SUNWprivate_1.1 -end - diff --git a/usr/src/cmd/sgs/libld/Makefile b/usr/src/cmd/sgs/libld/Makefile index 3fb5c9663e..75eeaf1889 100644 --- a/usr/src/cmd/sgs/libld/Makefile +++ b/usr/src/cmd/sgs/libld/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,10 +18,11 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -# Copyright (c) 1996 by Sun Microsystems, Inc. -# All rights reserved. +# ident "%Z%%M% %I% %E% SMI" include $(SRC)/cmd/sgs/Makefile.sub diff --git a/usr/src/cmd/sgs/libld/Makefile.com b/usr/src/cmd/sgs/libld/Makefile.com index 45c510669a..b8e53667c1 100644 --- a/usr/src/cmd/sgs/libld/Makefile.com +++ b/usr/src/cmd/sgs/libld/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,39 +18,51 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -LIBRARY= libld.a -VERS= .2 +LIBRARY = libld.a +VERS = .4 + +COMOBJS = debug.o globals.o util.o + +COMOBJS32 = args32.o entry32.o exit32.o groups32.o \ + ldentry32.o ldlibs32.o ldmain32.o libs32.o \ + files32.o map32.o order32.o outfile32.o \ + place32.o relocate32.o resolve32.o sections32.o \ + sunwmove32.o support32.o syms32.o update32.o \ + version32.o -G_MACHOBJS= doreloc.o -L_MACHOBJS= machrel.o machsym.o +COMOBJS64 = args64.o entry64.o exit64.o groups64.o \ + ldentry64.o ldlibs64.o ldmain64.o libs64.o \ + files64.o map64.o order64.o outfile64.o \ + place64.o relocate64.o resolve64.o sections64.o \ + sunwmove64.o support64.o syms64.o update64.o \ + version64.o -TOOLOBJS= alist.o assfail.o findprime.o string_table.o \ +TOOLOBJS = alist.o assfail.o findprime.o string_table.o \ strhash.o -AVLOBJ= avl.o -COMOBJS= entry.o files.o globals.o libs.o \ - order.o outfile.o place.o relocate.o \ - resolve.o sections.o support.o sunwmove.o \ - syms.o update.o util.o version.o \ - args.o debug.o ldentry.o groups.o \ - ldlibs.o ldmain.o exit.o map.o -COMOBJS64= $(COMOBJS:%.o=%64.o) -BLTOBJ= msg.o -ELFCAPOBJ= elfcap.o - -OBJECTS= $(BLTOBJ) $(G_MACHOBJS) $(L_MACHOBJS) $(COMOBJS) \ - $(TOOLOBJS) $(AVLOBJ) $(ELFCAPOBJ) +AVLOBJ = avl.o + +G_MACHOBJS32 = doreloc32.o +G_MACHOBJS64 = doreloc64.o + +BLTOBJ = msg.o +ELFCAPOBJ = elfcap.o + +OBJECTS = $(BLTOBJ) $(G_MACHOBJS32) $(G_MACHOBJS64) \ + $(L_MACHOBJS32) $(L_MACHOBJS64) \ + $(COMOBJS) $(COMOBJS32) $(COMOBJS64) \ + $(TOOLOBJS) $(E_TOOLOBJS) $(AVLOBJ) $(ELFCAPOBJ) include $(SRC)/lib/Makefile.lib include $(SRC)/cmd/sgs/Makefile.com -PLAT= $(VAR_PLAT_$(BASEPLAT)) MAPFILES= ../common/mapfile-vers MAPOPTS= $(MAPFILES:%=-M%) @@ -65,49 +76,54 @@ DLLIB = $(VAR_DL_LIB) package := DLLIB = $(VAR_PKG_DL_LIB) CPPFLAGS += -DUSE_LIBLD_MALLOC -I$(SRCBASE)/uts/common/krtld \ - -I$(ELFCAP) -D_REENTRANT $(VAR_LIBLD_CPPFLAGS) -LLDLIBS= $(LDDBGLIBDIR) $(LDDBG_LIB) $(ELFLIBDIR) -lelf $(DLLIB) -LDLIBS += $(CONVLIBDIR) -lconv $(LLDLIBS) -lc -LINTFLAGS += -u $(LDDBGLIBDIR) $(CONVLIBDIR) \ - -erroff=E_NAME_DECL_NOT_USED_DEF2 -LINTFLAGS64 += -u $(LDDBGLIBDIR64) $(CONVLIBDIR64) \ - -erroff=E_NAME_DECL_NOT_USED_DEF2 \ - -erroff=E_CAST_INT_TO_SMALL_INT -ORIGIN = '-R$$ORIGIN' -HSONAME = -h$(SONAME) + -I$(ELFCAP) $(VAR_LIBLD_CPPFLAGS) +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) $(LDDBGLIBDIR) $(LDDBG_LIB) \ + $(ELFLIBDIR) -lelf $(DLLIB) -lc + +LINTFLAGS += -u -D_REENTRANT +LINTFLAGS64 += -u -D_REENTRANT + DYNFLAGS += $(BDIRECT) $(VERSREF) \ - $(ZLAZYLOAD) $(MAPOPTS) $(USE_PROTO) $(ORIGIN) + $(ZLAZYLOAD) $(MAPOPTS) $(USE_PROTO) '-R$$ORIGIN' $(VAR_POUND_3)DEFS= $(VAR_POUND_3)native:= MAPOPTS = native:= DYNFLAGS += $(CONVLIBDIR) -BLTDEFS= msg.h -BLTDATA= msg.c -BLTMESG= $(SGSMSGDIR)/libld +BLTDEFS = msg.h +BLTDATA = msg.c +BLTMESG = $(SGSMSGDIR)/libld + +BLTFILES = $(BLTDEFS) $(BLTDATA) $(BLTMESG) -BLTFILES= $(BLTDEFS) $(BLTDATA) $(BLTMESG) +SGSMSGCOM = ../common/libld.msg +SGSMSGSPARC = ../common/libld.sparc.msg +SGSMSGINTEL = ../common/libld.intel.msg +SGSMSGTARG = $(SGSMSGCOM) +SGSMSGALL = $(SGSMSGCOM) $(SGSMSGSPARC) $(SGSMSGINTEL) -SGSMSGCOM= ../common/libld.msg -SGSMSGSPARC= ../common/libld.sparc.msg -SGSMSGINTEL= ../common/libld.intel.msg -SGSMSGTARG= $(SGSMSGCOM) -SGSMSGALL= $(SGSMSGCOM) $(SGSMSGSPARC) $(SGSMSGINTEL) +SGSMSGFLAGS1 = $(SGSMSGFLAGS) -m $(BLTMESG) +SGSMSGFLAGS2 = $(SGSMSGFLAGS) -h $(BLTDEFS) -d $(BLTDATA) -n libld_msg -SGSMSGFLAGS1= $(SGSMSGFLAGS) -m $(BLTMESG) -SGSMSGFLAGS2= $(SGSMSGFLAGS) -h $(BLTDEFS) -d $(BLTDATA) -n libld_msg +CHKSRCS = $(SRCBASE)/uts/common/krtld/reloc.h \ + $(COMOBJS32:%32.o=../common/%.c) \ + $(L_MACHOBJS32:%32.o=../common/%.c) \ + $(L_MACHOBJS64:%64.o=../common/%.c) -SRCS= ../common/llib-lld -LIBSRCS= $(TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \ - $(COMOBJS:%.o=../common/%.c) $(BLTDATA) \ +SRCS = ../common/llib-lld +LIBSRCS = $(TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \ + $(E_TOOLOBJS:%.o=$(SGSTOOLS)/common/%.c) \ + $(COMOBJS:%.o=../common/%.c) \ $(AVLOBJS:%.o=$(VAR_AVLDIR)/%.c) \ - $(G_MACHOBJS:%.o=$(SRCBASE)/uts/$(PLAT)/krtld/%.c) + $(BLTDATA) -LINTSRCS32 = $(L_MACHSRCS32) -LINTSRCS64 = $(L_MACHSRCS64) -LINTSRCS = $(LIBSRCS) +LINTSRCS = $(LIBSRCS) ../common/lintsup.c +LINTSRCS32 = $(COMOBJS32:%32.o=../common/%.c) \ + $(L_MACHOBJS32:%32.o=../common/%.c) +LINTSRCS64 = $(COMOBJS64:%64.o=../common/%.c) \ + $(L_MACHOBJS64:%64.o=../common/%.c) CLEANFILES += $(LINTOUTS) $(BLTFILES) CLOBBERFILES += $(DYNLIB) $(LINTLIBS) $(LIBLINKS) -ROOTFS_DYNLIB= $(DYNLIB:%=$(ROOTFS_LIBDIR)/%) +ROOTFS_DYNLIB = $(DYNLIB:%=$(ROOTFS_LIBDIR)/%) diff --git a/usr/src/cmd/sgs/libld/Makefile.targ b/usr/src/cmd/sgs/libld/Makefile.targ index b62af73753..372eaa1bd3 100644 --- a/usr/src/cmd/sgs/libld/Makefile.targ +++ b/usr/src/cmd/sgs/libld/Makefile.targ @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,37 +18,52 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. -# Use is subject to license terms. -pics64/%.o: ../common/%.c - $(COMPILE.c) -o $@ -D_ELF64 $< +pics/%.o: ../common/%.c + $(COMPILE.c) -o $@ $< $(POST_PROCESS_O) -pics64/%.o: ./%.c - $(COMPILE.c) -o $@ -D_ELF64 $< +pics/%32.o: ../common/%.c + $(COMPILE.c) -o $@ $(ELFTARGET32) $< $(POST_PROCESS_O) -pics/%.o: ../common/%.c - $(COMPILE.c) -o $@ $< +pics/%64.o: ../common/%.c + $(COMPILE.c) -o $@ $(ELFTARGET64) -D_ELF64 $< $(POST_PROCESS_O) -pics64/%.o pics/%.o: \ - $(SGSTOOLS)/common/%.c +pics/%32.o: %.c + $(COMPILE.c) -o $@ $(ELFTARGET32) $< + $(POST_PROCESS_O) + +pics/%64.o: %.c + $(COMPILE.c) -o $@ $(ELFTARGET64) -D_ELF64 $< + $(POST_PROCESS_O) + +pics/%.o: $(SGSTOOLS)/common/%.c $(COMPILE.c) -o $@ $< $(POST_PROCESS_O) -pics64/%.o pics/%.o: \ - $(VAR_AVLDIR)/%.c +pics/%.o: $(VAR_AVLDIR)/%.c $(COMPILE.c) -o $@ $< $(POST_PROCESS_O) -pics64/elfcap.o pics/elfcap.o: \ - $(ELFCAP)/elfcap.c - $(COMPILE.c) -DCAP_LOWERCASE -o $@ $(ELFCAP)/elfcap.c +#pics/%32.o: $(SRCBASE)/uts/$(PLAT)/krtld/%.c +# $(COMPILE.c) -o $@ $(ELFTARGET32) $< +# $(POST_PROCESS_O) +# +#pics/%64.o: $(SRCBASE)/uts/$(PLAT)/krtld/%.c +# $(COMPILE.c) -o $@ $(ELFTARGET64) -D_ELF64 $< +# $(POST_PROCESS_O) + +pics/elfcap.o: $(ELFCAP)/elfcap.c + $(COMPILE.c) -o $@ -DCAP_LOWERCASE $(ELFCAP)/elfcap.c $(POST_PROCESS_O) $(DYNLIB): $(MAPFILES) @@ -60,6 +74,11 @@ $(LIBLINKS): delete: $(RM) $(DYNLIB) +.PARALLEL: $(LINTOUT32) $(LINTOUT64) $(LINTLIB32) $(LINTLIB64) + +lint: $(LINTLIB32) $(LINTOUT32) $(LINTLIB64) $(LINTOUT64) \ + .WAIT $(SGSLINTOUT) + # Special target for native builds (ie. when we need to build a version of ld # to build a version of ld :-). @@ -79,7 +98,7 @@ include $(SRC)/cmd/sgs/Makefile.targ catalog: $(BLTMESG) -chkmsg: $(LIBSRCS) +chkmsg: $(LIBSRCS) $(CHKSRCS) sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS) $(CHKSRCS) $(BLTDEFS) + \ @@ -88,5 +107,3 @@ $(BLTDATA): $(SGSMSGTARG) $(BLTMESG): $(SGSMSGALL) $(SGSMSG) $(SGSMSGFLAGS1) $(SGSMSGALL) - -lint: $(LINTLIB32) $(LINTOUT32) $(SGSLINTOUT) diff --git a/usr/src/cmd/sgs/libld/amd64/Makefile b/usr/src/cmd/sgs/libld/amd64/Makefile index afba3e9318..2456c09155 100644 --- a/usr/src/cmd/sgs/libld/amd64/Makefile +++ b/usr/src/cmd/sgs/libld/amd64/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,123 +18,82 @@ # # CDDL HEADER END # + # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -BASEPLAT= amd64 - -include $(SRC)/cmd/sgs/libld/Makefile.com +E_TOOLOBJS = leb128.o +L_MACHOBJS32 = machrel.intel32.o machsym.intel32.o +L_MACHOBJS64 = machrel.amd64.o machsym.intel64.o unwind.amd64.o -# -# Share machsym.c with the 32-bit i386 directory since -# they both need the Elf32 and the Elf64 code. -# -L_MACHSRCS32= ../i386/machrel.c ../i386/machsym.c -L_MACHSRCS64 = machrel.c ../i386/machsym.c \ - amd64unwind.c ../../tools/common/leb128.c +include ../Makefile.com -CHKSRCS += machrel.c ../i386/machrel.c amd64unwind.c \ - ../../tools/common/leb128.c +.KEEP_STATE: -LIB64= libld.so.3 -$(LIB64) := SONAME = $(LIB64) +ROOTFS_LIBDIR64 = \ + $(VAR_LIBLD_64_ROOTFS_LIBDIR) -DBGLIB = -L ../../liblddbg/$(MACH64) -CONVLIB = -L ../../libconv/$(MACH64) -ELFLIB = -L ../../libelf/$(MACH64) -DYNFLAGS += $(DBGLIB) $(CONVLIB) $(ELFLIB) +ROOTFS_DYNLIB64 = \ + $(DYNLIB:%=$(ROOTFS_LIBDIR64)/%) +SGSMSGCHK = ../common/libld.chk.msg SGSMSGTARG += $(SGSMSGINTEL) -.PARALLEL: $(LINTOUT32) $(LINTOUT64) - -PICS64= $(OBJECTS:%=pics64/%) pics64/amd64unwind.o pics64/leb128.o -$(PICS64) := amd64_CFLAGS += $(C_PICFLAGS) -CTFMERGE_LIB64= $(CTFMERGE) -t -f -L VERSION -o $@ $(PICS64) -$(PICS64) := CFLAGS += $(CTF_FLAGS) -$(PICS64) := CFLAGS64 += $(CTF_FLAGS) -$(PICS64) := CTFCONVERT_POST = $(CTFCONVERT_O) -$(LIB64) := CTFMERGE_POST = $(CTFMERGE_LIB64) -$(PICS64) := CPPFLAGS += -I../../../../uts/intel/amd64/krtld -$(PICS64) := CPPFLAGS += -DELF_TARGET_AMD64 -$(PICS) := CPPFLAGS += -I../../../../uts/intel/ia32/krtld -$(PICS) := CPPFLAGS += -DELF_TARGET_386 +# +# For cross-compilation, it is necessary to trigger the correct include files +# (see sys/elf.h). +# +ELFTARGET64 = -DELF_TARGET_AMD64 +ELFTARGET32 = -DELF_TARGET_386 -.PARALLEL: $(PICS64) +ELFLIBDIR = $(ELFLIBDIR64) +LDDBGLIBDIR = $(LDDBGLIBDIR64) +CONVLIBDIR = $(CONVLIBDIR64) -ROOTFS_LIBDIR= $(VAR_LIBLD_64_ROOTFS_LIBDIR) -ROOTFS_DYNLIB64= $(ROOTFS_LIBDIR)/$(LIB64) $(ROOTFS_DYNLIB64) := FILEMODE= 755 -$(LINTOUT32) := CPPFLAGS += -I../../../../uts/intel/ia32/krtld \ - -DELF_TARGET_386 -$(LINTOUT64) := CPPFLAGS += -I../../../../uts/intel/amd64/krtld \ - -DELF_TARGET_AMD64 -.KEEP_STATE: - -all: $(DYNLIB) $(LIBLINKS) $(LIB64) - - -LINK.LIB64 = $(CC) $(amd64_CFLAGS) -o $@ -G $(DYNFLAGS) $(PICS64) $(LDLIBS) -$(LIB64) $(SGSPROTO)/$(LIB64): pics64 .WAIT $$(PICS64) $(MAPFILES) - $(LINK.LIB64) - $(POST_PROCESS_SO) - -lint: $(LINTLIB64) $(LINTOUT64) - -native: $(SGSPROTO)/$(DYNLIB) $(SGSPROTO)/$(LIB64) +all: $(DYNLIB) $(LIBLINKS) -native-proto: - -@mkdir -p proto/$(MACH) proto/$(MACH64) - -pics64: - -@mkdir -p $@ - - -install package: all $(ROOTFS_DYNLIB) $(ROOTFS_DYNLIB64) +install \ +package: all $(ROOTFS_DYNLIB64) +include ../Makefile.targ +include ../../Makefile.sub.64 -clean: clean64 +# Associate ELF32 and ELF64 objects to the appropriate headers. -clean64: - -$(RM) $(PICS64) +pics/%32.o := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld +pics/%64.o := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld -clobber: clobber64 -clobber64: - -$(RM) $(LIB64) +# Associate the various lint targets with the appropriate headers/files. -delete: - $(RM) $(DYNLIB) $(LIB64) +$(LINTOUT32) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld \ + $(ELFTARGET32) +$(LINTOUT64) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld \ + $(ELFTARGET64) -D_ELF64 +$(LINTLIB32) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld \ + $(ELFTARGET32) +$(LINTLIB64) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld \ + $(ELFTARGET64) -D_ELF64 -# -# Grab 32bit i386 files for libld.so.2 -# -pics/machrel.o: ../i386/machrel.c - $(COMPILE.c) -o $@ -D_ELF32 ../i386/machrel.c - $(POST_PROCESS_O) +LINTSRCS32 += $(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld/%.c) +LINTSRCS64 += $(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld/%.c) -pics/machsym.o: ../i386/machsym.c - $(COMPILE.c) -o $@ -D_ELF32 ../i386/machsym.c - $(POST_PROCESS_O) - -pics64/machsym.o: ../i386/machsym.c - $(COMPILE.c) -o $@ -D_ELF64 ../i386/machsym.c - $(POST_PROCESS_O) - - -include $(SRC)/cmd/sgs/libld/Makefile.targ -include ../../Makefile.sub.64 +# Compensate chkmsg with the doreloc family. -$(LIBLINKS) := DYNLIB=$(LIB64) +CHKSRCS += $(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld/%.c) +CHKSRCS += $(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld/%.c) -pics64/%.o: $(SRCBASE)/uts/intel/amd64/krtld/%.c - $(COMPILE.c) -o $@ -D_ELF64 $< +pics/%32.o: \ + $(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld/%.c + $(COMPILE.c) -o $@ $(ELFTARGET32) $< $(POST_PROCESS_O) -pics/%.o: $(SRCBASE)/uts/intel/ia32/krtld/%.c - $(COMPILE.c) -o $@ $< +pics/%64.o: \ + $(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld/%.c + $(COMPILE.c) -o $@ $(ELFTARGET64) -D_ELF64 $< $(POST_PROCESS_O) diff --git a/usr/src/cmd/sgs/libld/common/_libld.h b/usr/src/cmd/sgs/libld/common/_libld.h index c827e0518b..e7fb0b753d 100644 --- a/usr/src/cmd/sgs/libld/common/_libld.h +++ b/usr/src/cmd/sgs/libld/common/_libld.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. @@ -38,6 +37,7 @@ #pragma ident "%Z%%M% %I% %E% SMI" #include <libld.h> +#include <debug.h> #include <conv.h> #include <msg.h> @@ -176,16 +176,13 @@ typedef enum { #define REL_HOIDESCNO 500 /* high water mark output buckets */ #define REL_LOIDESCNO 10 /* low water mark output buckets */ -extern Ofl_desc Ofl; extern char *Plibpath; extern char *Llibdir; extern char *Ulibdir; -extern Ehdr def_ehdr; extern Ld_heap *ld_heap; extern List lib_support; +extern int demangle_flag; extern const Msg reject[]; -extern uint_t dbg_mask; - extern int Verbose; /* @@ -196,106 +193,352 @@ extern int dz_fd; /* * Local functions. */ -extern uintptr_t add_actrel(Word, Rel_desc *, Ofl_desc *); -extern uintptr_t add_libdir(Ofl_desc *, const char *); -extern uintptr_t add_outrel(Word, Rel_desc *, Ofl_desc *); -extern uintptr_t add_regsym(Sym_desc *, Ofl_desc *); -extern void adj_movereloc(Ofl_desc *, Rel_desc *); -extern void *alist_append(Alist **, const void *, size_t, int); -extern Sym_desc * am_I_partial(Rel_desc *, Xword); -extern Ar_desc * ar_setup(const char *, Elf *, Ofl_desc *); -extern void ar_member(Ar_desc *, Elf_Arsym *, Ar_aux *, Ar_mem *); +extern char *add_string(char *, char *); +extern const char *demangle(const char *); + +extern void lds_atexit(Ofl_desc *, int); + +extern void libld_free(void *); +extern void *libld_malloc(size_t); +extern void *libld_realloc(void *, size_t); + +extern Listnode *list_appendc(List *, const void *); +extern Listnode *list_insertc(List *, const void *, Listnode *); +extern Listnode *list_prependc(List *, const void *); +extern Listnode *list_where(List *, Word num); + +extern Sdf_desc *sdf_add(const char *, List *); +extern Sdf_desc *sdf_find(const char *, List *); + +#if defined(_ELF64) + +#define ld_add_actrel ld64_add_actrel +#define ld_add_libdir ld64_add_libdir +#define ld_add_outrel ld64_add_outrel +#define ld_adj_movereloc ld64_adj_movereloc +#define ld_am_I_partial ld64_am_I_partial +#define ld_ar_member ld64_ar_member +#define ld_ar_setup ld64_ar_setup +#if defined(sparc) +#define ld_allocate_got ld64_allocate_got +#endif +#define ld_assign_got ld64_assign_got +#define ld_assign_gotndx ld64_assign_gotndx +#define ld_assign_plt_ndx ld64_assign_plt_ndx +#define ld_calc_got_offset ld64_calc_got_offset +#define ld_calc_plt_addr ld64_calc_plt_addr +#define ld_disp_errmsg ld64_disp_errmsg +#define ld_do_activerelocs ld64_do_activerelocs +#define ld_ent_check ld64_ent_check +#define ld_exit ld64_exit +#define ld_fillin_gotplt ld64_fillin_gotplt +#define ld_find_gotndx ld64_find_gotndx +#define ld_find_library ld64_find_library +#define ld_finish_libs ld64_finish_libs +#define ld_get_group ld64_get_group +#define ld_lib_setup ld64_lib_setup +#define ld_init ld64_init +#define ld_init_rel ld64_init_rel +#define ld_is_regsym ld64_is_regsym +#define ld_lcm ld64_lcm +#define ld_mach_update_odynamic ld64_mach_update_odynamic +#define ld_mach_eflags ld64_mach_eflags +#define ld_mach_make_dynamic ld64_mach_make_dynamic +#define ld_mach_sym_typecheck ld64_mach_sym_typecheck +#define ld_make_bss ld64_make_bss +#define ld_make_got ld64_make_got +#define ld_map_out ld64_map_out +#define ld_map_parse ld64_map_parse +#define ld_make_sunwbss ld64_make_sunwbss +#define ld_make_sunwdata ld64_make_sunwdata +#define ld_make_sunwmove ld64_make_sunmove +#define ld_open_outfile ld64_open_outfile +#define ld_perform_outreloc ld64_perform_outreloc +#define ld_place_section ld64_place_section +#define ld_process_archive ld64_process_archive +#define ld_process_files ld64_process_files +#define ld_process_flags ld64_process_flags +#define ld_process_ifl ld64_process_ifl +#define ld_process_open ld64_process_open +#define ld_process_ordered ld64_process_ordered +#define ld_process_sym_reloc ld64_process_sym_reloc +#define ld_reloc_local ld64_reloc_local +#define ld_reloc_GOT_relative ld64_reloc_GOT_relative +#define ld_reloc_GOTOP ld64_reloc_GOTOP +#define ld_reloc_plt ld64_reloc_plt +#define ld_reloc_register ld64_reloc_register +#define ld_reloc_remain_entry ld64_reloc_remain_entry +#define ld_reloc_TLS ld64_reloc_TLS +#define ld_reg_check ld64_reg_check +#define ld_reg_enter ld64_reg_enter +#define ld_reg_find ld64_reg_find +#define ld_sec_validate ld64_sec_validate +#define ld_sort_ordered ld64_sort_ordered +#define ld_sort_seg_list ld64_sort_seg_list +#define ld_sunwmove_preprocess ld64_sunwmove_preprocess +#define ld_sup_atexit ld64_sup_atexit +#define ld_sup_file ld64_sup_file +#define ld_sup_loadso ld64_sup_loadso +#define ld_sup_input_done ld64_sup_input_done +#define ld_sup_input_section ld64_sup_input_section +#define ld_sup_section ld64_sup_section +#define ld_sup_start ld64_sup_start +#define ld_sym_add_u ld64_sym_add_u +#define ld_sym_adjust_vis ld64_sym_adjust_vis +#define ld_sym_avl_comp ld64_sym_avl_comp +#define ld_sym_copy ld64_sym_copy +#define ld_sym_enter ld64_sym_enter +#define ld_sym_find ld64_sym_find +#define ld_sym_nodirect ld64_sym_nodirect +#define ld_sym_process ld64_sym_process +#define ld_sym_resolve ld64_sym_resolve +#define ld_sym_spec ld64_sym_spec +#define ld_vers_base ld64_vers_base +#define ld_vers_check_defs ld64_vers_check_defs +#define ld_vers_check_need ld64_vers_check_need +#define ld_vers_def_process ld64_vers_def_process +#define ld_vers_desc ld64_vers_desc +#define ld_vers_find ld64_vers_find +#define ld_vers_need_process ld64_vers_need_process +#define ld_vers_promote ld64_vers_promote +#define ld_vers_sym_process ld64_vers_sym_process +#define ld_vers_verify ld64_vers_verify + +#else + +#define ld_add_actrel ld32_add_actrel +#define ld_add_libdir ld32_add_libdir +#define ld_add_outrel ld32_add_outrel +#define ld_adj_movereloc ld32_adj_movereloc +#define ld_am_I_partial ld32_am_I_partial +#define ld_ar_member ld32_ar_member +#define ld_ar_setup ld32_ar_setup +#if defined(sparc) +#define ld_allocate_got ld32_allocate_got +#endif +#define ld_assign_got ld32_assign_got +#define ld_assign_gotndx ld32_assign_gotndx +#define ld_assign_plt_ndx ld32_assign_plt_ndx +#define ld_calc_got_offset ld32_calc_got_offset +#define ld_calc_plt_addr ld32_calc_plt_addr +#define ld_disp_errmsg ld32_disp_errmsg +#define ld_do_activerelocs ld32_do_activerelocs +#define ld_ent_check ld32_ent_check +#define ld_exit ld32_exit +#define ld_fillin_gotplt ld32_fillin_gotplt +#define ld_find_gotndx ld32_find_gotndx +#define ld_find_library ld32_find_library +#define ld_finish_libs ld32_finish_libs +#define ld_get_group ld32_get_group +#define ld_lib_setup ld32_lib_setup +#define ld_init ld32_init +#define ld_init_rel ld32_init_rel +#define ld_is_regsym ld32_is_regsym +#define ld_lcm ld32_lcm +#define ld_mach_update_odynamic ld32_mach_update_odynamic +#define ld_mach_eflags ld32_mach_eflags +#define ld_mach_make_dynamic ld32_mach_make_dynamic +#define ld_mach_sym_typecheck ld32_mach_sym_typecheck +#define ld_make_bss ld32_make_bss +#define ld_make_got ld32_make_got +#define ld_map_out ld32_map_out +#define ld_map_parse ld32_map_parse +#define ld_make_sunwbss ld32_make_sunwbss +#define ld_make_sunwdata ld32_make_sunwdata +#define ld_make_sunwmove ld32_make_sunmove +#define ld_open_outfile ld32_open_outfile +#define ld_perform_outreloc ld32_perform_outreloc +#define ld_place_section ld32_place_section +#define ld_process_archive ld32_process_archive +#define ld_process_files ld32_process_files +#define ld_process_flags ld32_process_flags +#define ld_process_ifl ld32_process_ifl +#define ld_process_open ld32_process_open +#define ld_process_ordered ld32_process_ordered +#define ld_process_sym_reloc ld32_process_sym_reloc +#define ld_reloc_local ld32_reloc_local +#define ld_reloc_GOT_relative ld32_reloc_GOT_relative +#define ld_reloc_GOTOP ld32_reloc_GOTOP +#define ld_reloc_plt ld32_reloc_plt +#define ld_reloc_register ld32_reloc_register +#define ld_reloc_remain_entry ld32_reloc_remain_entry +#define ld_reloc_TLS ld32_reloc_TLS +#define ld_reg_check ld32_reg_check +#define ld_reg_enter ld32_reg_enter +#define ld_reg_find ld32_reg_find +#define ld_sec_validate ld32_sec_validate +#define ld_sort_ordered ld32_sort_ordered +#define ld_sort_seg_list ld32_sort_seg_list +#define ld_sunwmove_preprocess ld32_sunwmove_preprocess +#define ld_sup_atexit ld32_sup_atexit +#define ld_sup_file ld32_sup_file +#define ld_sup_loadso ld32_sup_loadso +#define ld_sup_input_done ld32_sup_input_done +#define ld_sup_input_section ld32_sup_input_section +#define ld_sup_section ld32_sup_section +#define ld_sup_start ld32_sup_start +#define ld_sym_add_u ld32_sym_add_u +#define ld_sym_adjust_vis ld32_sym_adjust_vis +#define ld_sym_avl_comp ld32_sym_avl_comp +#define ld_sym_copy ld32_sym_copy +#define ld_sym_enter ld32_sym_enter +#define ld_sym_find ld32_sym_find +#define ld_sym_nodirect ld32_sym_nodirect +#define ld_sym_process ld32_sym_process +#define ld_sym_resolve ld32_sym_resolve +#define ld_sym_spec ld32_sym_spec +#define ld_vers_base ld32_vers_base +#define ld_vers_check_defs ld32_vers_check_defs +#define ld_vers_check_need ld32_vers_check_need +#define ld_vers_def_process ld32_vers_def_process +#define ld_vers_desc ld32_vers_desc +#define ld_vers_find ld32_vers_find +#define ld_vers_need_process ld32_vers_need_process +#define ld_vers_promote ld32_vers_promote +#define ld_vers_sym_process ld32_vers_sym_process +#define ld_vers_verify ld32_vers_verify + +#endif + +extern uintptr_t dbg_setup(const char *, Dbg_desc *, const char **, int); + +extern uintptr_t ld_add_actrel(Word, Rel_desc *, Ofl_desc *); +extern uintptr_t ld_add_libdir(Ofl_desc *, const char *); +extern uintptr_t ld_add_outrel(Word, Rel_desc *, Ofl_desc *); +extern void ld_adj_movereloc(Ofl_desc *, Rel_desc *); +extern Sym_desc * ld_am_I_partial(Rel_desc *, Xword); +extern void ld_ar_member(Ar_desc *, Elf_Arsym *, Ar_aux *, + Ar_mem *); +extern Ar_desc *ld_ar_setup(const char *, Elf *, Ofl_desc *); #if defined(sparc) -extern uintptr_t allocate_got(Ofl_desc *); -extern uintptr_t assign_got(Sym_desc *); +extern uintptr_t ld_allocate_got(Ofl_desc *); #endif -extern uintptr_t assign_gotndx(List *, Gotndx *, Gotref, Ofl_desc *, +extern uintptr_t ld_assign_got(Ofl_desc *, Sym_desc *); +extern uintptr_t ld_assign_gotndx(List *, Gotndx *, Gotref, Ofl_desc *, Rel_desc *, Sym_desc *); -extern void assign_plt_ndx(Sym_desc *, Ofl_desc *); -extern Xword calc_got_offset(Rel_desc *, Ofl_desc *); -extern Xword calc_plt_addr(Sym_desc *, Ofl_desc *); -extern int dbg_setup(const char *); -extern const char *demangle(const char *); -extern void disp_errmsg(const char *, Rel_desc *, Ofl_desc *); -extern uintptr_t do_activerelocs(Ofl_desc *); -extern void ent_check(Ofl_desc *); -extern uintptr_t fillin_gotplt1(Ofl_desc *); -extern Addr fillin_gotplt2(Ofl_desc *); -extern Gotndx * find_gotndx(List *, Gotref, Ofl_desc *, Rel_desc *); -extern uintptr_t find_library(const char *, Ofl_desc *); -extern Group_desc * get_group(Ofl_desc *, Is_desc *); -extern Word hashbkts(Word); -extern Xword lcm(Xword, Xword); -extern int ldexit(void); -extern void ldmap_out(Ofl_desc *); -extern uintptr_t lib_setup(Ofl_desc *); -extern Listnode * list_where(List *, Word); -extern void init(); -extern Word init_rel(Rel_desc *, void *); -extern const char *is_regsym(Ifl_desc *, Sym *, const char *, int, Word, - const char *, Word *); -extern void mach_eflags(Ehdr *, Ofl_desc *); -extern void mach_make_dynamic(Ofl_desc *, size_t *); -extern void mach_update_odynamic(Ofl_desc *, Dyn **); -extern int mach_sym_typecheck(Sym_desc *, Sym *, Ifl_desc *, +extern void ld_assign_plt_ndx(Sym_desc *, Ofl_desc *); + +extern Xword ld_calc_got_offset(Rel_desc *, Ofl_desc *); +extern Xword ld_calc_plt_addr(Sym_desc *, Ofl_desc *); + +extern void ld_disp_errmsg(const char *, Rel_desc *, Ofl_desc *); +extern uintptr_t ld_do_activerelocs(Ofl_desc *); + +extern void ld_ent_check(Ofl_desc *); +extern int ld_exit(Ofl_desc *); + +extern uintptr_t ld_fillin_gotplt(Ofl_desc *); +extern Gotndx * ld_find_gotndx(List *, Gotref, Ofl_desc *, Rel_desc *); +extern uintptr_t ld_find_library(const char *, Ofl_desc *); +extern uintptr_t ld_finish_libs(Ofl_desc *); + +extern Group_desc * ld_get_group(Ofl_desc *, Is_desc *); + +extern uintptr_t ld_lib_setup(Ofl_desc *); + +extern void ld_init(Ofl_desc *); +extern Word ld_init_rel(Rel_desc *, void *); +extern const char *ld_is_regsym(Ofl_desc *, Ifl_desc *, Sym *, + const char *, int, Word, const char *, Word *); + +extern Xword ld_lcm(Xword, Xword); + +extern void ld_mach_update_odynamic(Ofl_desc *, Dyn **); +extern void ld_mach_eflags(Ehdr *, Ofl_desc *); +extern void ld_mach_make_dynamic(Ofl_desc *, size_t *); +extern int ld_mach_sym_typecheck(Sym_desc *, Sym *, Ifl_desc *, Ofl_desc *); -extern uintptr_t make_bss(Ofl_desc *, Xword, Xword, Bss_Type); -extern uintptr_t make_got(Ofl_desc *); -extern uintptr_t make_reloc(Ofl_desc *, Os_desc *); -extern uintptr_t make_sunwbss(Ofl_desc *, size_t, Xword); -extern uintptr_t make_sunwdata(Ofl_desc *, size_t, Xword); -extern uintptr_t make_sunwmove(Ofl_desc *, int); -extern uintptr_t map_parse(const char *, Ofl_desc *); -extern uintptr_t perform_outreloc(Rel_desc *, Ofl_desc *); -extern Os_desc * place_section(Ofl_desc *, Is_desc *, int, Word); -extern uintptr_t process_archive(const char *, int, Ar_desc *, +extern uintptr_t ld_make_bss(Ofl_desc *, Xword, Xword, Bss_Type); +extern uintptr_t ld_make_got(Ofl_desc *); +extern void ld_map_out(Ofl_desc *); +extern uintptr_t ld_map_parse(const char *, Ofl_desc *); +extern uintptr_t ld_make_sunwbss(Ofl_desc *, size_t, Xword); +extern uintptr_t ld_make_sunwdata(Ofl_desc *, size_t, Xword); +extern uintptr_t ld_make_sunwmove(Ofl_desc *, int); + +extern uintptr_t ld_open_outfile(Ofl_desc *); + +extern uintptr_t ld_perform_outreloc(Rel_desc *, Ofl_desc *); +extern Os_desc * ld_place_section(Ofl_desc *, Is_desc *, int, Word); +extern uintptr_t ld_process_archive(const char *, int, Ar_desc *, Ofl_desc *); -extern uintptr_t process_flags(Ofl_desc *, int, char **); -extern uintptr_t process_files(Ofl_desc *, int, char **); -extern Ifl_desc * process_ifl(const char *, const char *, int, Elf *, +extern uintptr_t ld_process_files(Ofl_desc *, int, char **); +extern uintptr_t ld_process_flags(Ofl_desc *, int, char **); +extern Ifl_desc *ld_process_ifl(const char *, const char *, int, Elf *, Half, Ofl_desc *, Rej_desc *); -extern uintptr_t process_ordered(Ifl_desc *, Ofl_desc *, Word, Word); -extern uintptr_t process_section(const char *, Ifl_desc *, Shdr *, - Elf_Scn *, Word, int, Ofl_desc *); -extern uintptr_t process_sym_reloc(Ofl_desc *, Rel_desc *, Rel *, +extern Ifl_desc *ld_process_open(const char *, size_t, int, Ofl_desc *, + Half, Rej_desc *); +extern uintptr_t ld_process_ordered(Ifl_desc *, Ofl_desc *, Word, Word); +extern uintptr_t ld_process_sym_reloc(Ofl_desc *, Rel_desc *, Rel *, Is_desc *, const char *); -extern int reg_check(Sym_desc *, Sym *, const char *, Ifl_desc *, + +extern uintptr_t ld_reloc_local(Rel_desc *, Ofl_desc *); +extern uintptr_t ld_reloc_GOT_relative(Boolean, Rel_desc *, Ofl_desc *); +extern uintptr_t ld_reloc_GOTOP(Boolean, Rel_desc *, Ofl_desc *); +extern uintptr_t ld_reloc_plt(Rel_desc *, Ofl_desc *); +extern uintptr_t ld_reloc_register(Rel_desc *, Is_desc *, Ofl_desc *); +extern void ld_reloc_remain_entry(Rel_desc *, Os_desc *, + Ofl_desc *); +extern uintptr_t ld_reloc_TLS(Boolean, Rel_desc *, Ofl_desc *); + +extern int ld_reg_check(Sym_desc *, Sym *, const char *, + Ifl_desc *, Ofl_desc *); +extern int ld_reg_enter(Sym_desc *, Ofl_desc *); +extern Sym_desc * ld_reg_find(Sym *, Ofl_desc *); + +extern void ld_sec_validate(Ofl_desc *); +extern uintptr_t ld_sort_ordered(Ofl_desc *); +extern uintptr_t ld_sort_seg_list(Ofl_desc *); +extern uintptr_t ld_sunwmove_preprocess(Ofl_desc *); +extern void ld_sup_atexit(Ofl_desc *, int); +extern void ld_sup_file(Ofl_desc *, const char *, const Elf_Kind, + int flags, Elf *); +extern uintptr_t ld_sup_loadso(Ofl_desc *, const char *); +extern void ld_sup_input_done(Ofl_desc *); +extern void ld_sup_section(Ofl_desc *, const char *, Shdr *, Word, + Elf_Data *, Elf *); +extern uintptr_t ld_sup_input_section(Ofl_desc*, const char *, Shdr **, + Word, const char *, Elf_Scn *, Elf *); +extern void ld_sup_start(Ofl_desc *, const Half, const char *); +extern Sym_desc *ld_sym_add_u(const char *, Ofl_desc *); +extern void ld_sym_adjust_vis(Sym_desc *, Ofl_desc *); +extern int ld_sym_avl_comp(const void *, const void *); +extern uintptr_t ld_sym_copy(Sym_desc *); +extern Sym_desc *ld_sym_enter(const char *, Sym *, Word, Ifl_desc *, + Ofl_desc *, Word, Word, Word, Half, avl_index_t *); +extern Sym_desc *ld_sym_find(const char *, Word, avl_index_t *, Ofl_desc *); -extern int reg_enter(Sym_desc *, Ofl_desc *); -extern Sym_desc * reg_find(Sym *, Ofl_desc *); -extern uintptr_t reloc_local(Rel_desc *, Ofl_desc *); -extern uintptr_t reloc_plt(Rel_desc *, Ofl_desc *); -extern uintptr_t reloc_register(Rel_desc *, Is_desc *, Ofl_desc *); -extern void reloc_remain_entry(Rel_desc *, Os_desc *, Ofl_desc *); -extern uintptr_t reloc_GOT_relative(Boolean, Rel_desc *, Ofl_desc *); -extern uintptr_t reloc_GOTOP(Boolean, Rel_desc *, Ofl_desc *); -extern uintptr_t reloc_TLS(Boolean, Rel_desc *, Ofl_desc *); -extern uintptr_t sort_ordered(Ofl_desc *); -extern uintptr_t sort_seg_list(Ofl_desc *); -extern void sym_adjust_vis(Sym_desc *, Ofl_desc *); -extern int sym_avl_comp(const void *, const void *); -extern uintptr_t sym_copy(Sym_desc *); -extern uintptr_t sym_nodirect(Is_desc *, Ifl_desc *, Ofl_desc *); -extern uintptr_t sym_process(Is_desc *, Ifl_desc *, Ofl_desc *); -extern uintptr_t sym_resolve(Sym_desc *, Sym *, Ifl_desc *, Ofl_desc *, - int, Word, Word); -extern uintptr_t sym_spec(Ofl_desc *); -extern uintptr_t vers_def_process(Is_desc *, Ifl_desc *, Ofl_desc *); -extern uintptr_t vers_need_process(Is_desc *, Ifl_desc *, Ofl_desc *); -extern int vers_sym_process(Is_desc *, Ifl_desc *); -extern uintptr_t vers_check_need(Ofl_desc *); -extern void vers_promote(Sym_desc *, Word, Ifl_desc *, Ofl_desc *); -extern int vers_verify(Ofl_desc *); +extern uintptr_t ld_sym_nodirect(Is_desc *, Ifl_desc *, Ofl_desc *); +extern uintptr_t ld_sym_process(Is_desc *, Ifl_desc *, Ofl_desc *); +extern uintptr_t ld_sym_resolve(Sym_desc *, Sym *, Ifl_desc *, + Ofl_desc *, int, Word, Word); +extern uintptr_t ld_sym_spec(Ofl_desc *); + +extern Ver_desc *ld_vers_base(Ofl_desc *); +extern uintptr_t ld_vers_check_defs(Ofl_desc *); +extern uintptr_t ld_vers_check_need(Ofl_desc *); +extern uintptr_t ld_vers_def_process(Is_desc *, Ifl_desc *, Ofl_desc *); +extern Ver_desc *ld_vers_desc(const char *, Word, List *); +extern Ver_desc *ld_vers_find(const char *, Word, List *); +extern uintptr_t ld_vers_need_process(Is_desc *, Ifl_desc *, Ofl_desc *); +extern void ld_vers_promote(Sym_desc *, Word, Ifl_desc *, + Ofl_desc *); +extern int ld_vers_sym_process(Lm_list *, Is_desc *, Ifl_desc *); +extern int ld_vers_verify(Ofl_desc *); + +extern uintptr_t add_regsym(Sym_desc *, Ofl_desc *); +extern void *alist_append(Alist **, const void *, size_t, int); +extern Word hashbkts(Word); +extern Xword lcm(Xword, Xword); +extern Listnode * list_where(List *, Word); /* * AMD64 - 64-bit specific functions */ -#if defined(__x86) && defined(_ELF64) +#if (defined(__i386) || defined(__amd64)) && defined(_ELF64) +extern uintptr_t append_amd64_unwind(Os_desc *, Ofl_desc *); extern uintptr_t make_amd64_unwindhdr(Ofl_desc *); -extern uintptr_t process_amd64_unwind(const char *, Ifl_desc *, Shdr *, - Elf_Scn *, Word, int, Ofl_desc *); extern uintptr_t populate_amd64_unwindhdr(Ofl_desc *); -extern uintptr_t append_amd64_unwind(Os_desc *, Ofl_desc *); #endif #ifdef __cplusplus diff --git a/usr/src/cmd/sgs/libld/common/args.c b/usr/src/cmd/sgs/libld/common/args.c index 1c1d75a6ed..2fe92b7b31 100644 --- a/usr/src/cmd/sgs/libld/common/args.c +++ b/usr/src/cmd/sgs/libld/common/args.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. @@ -24,7 +23,7 @@ * Copyright (c) 1988 AT&T * All Rights Reserved * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -54,7 +53,7 @@ #include <errno.h> #include <elf.h> #include <unistd.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" @@ -192,7 +191,7 @@ static uintptr_t check_flags(Ofl_desc * ofl, int argc) { if (Plibpath && (Llibdir || Ulibdir)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_YP), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_YP), Llibdir ? 'L' : 'U'); ofl->ofl_flags |= FLG_OF_FATAL; } @@ -201,8 +200,8 @@ check_flags(Ofl_desc * ofl, int argc) if (dflag == SET_UNKNOWN) dflag = SET_FALSE; if (ofl->ofl_flags1 & FLG_OF1_RELCNT) { - eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_INCOMP), - MSG_ORIG(MSG_ARG_R), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_R), MSG_ORIG(MSG_ARG_ZCOMBRELOC)); ofl->ofl_flags1 &= ~FLG_OF1_RELCNT; } @@ -228,7 +227,7 @@ check_flags(Ofl_desc * ofl, int argc) ofl->ofl_flags1 |= FLG_OF1_AUTOELM; if (Blflag && Beflag) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_BELIMINATE), MSG_ORIG(MSG_ARG_BLOCAL)); ofl->ofl_flags |= FLG_OF_FATAL; } @@ -242,8 +241,9 @@ check_flags(Ofl_desc * ofl, int argc) (FLG_OF_DYNAMIC | FLG_OF_DYNLIBS | FLG_OF_PROCRED); if (aflag) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), - MSG_ORIG(MSG_ARG_DY), MSG_ORIG(MSG_ARG_A)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DY), + MSG_ORIG(MSG_ARG_A)); ofl->ofl_flags |= FLG_OF_FATAL; } @@ -252,7 +252,8 @@ check_flags(Ofl_desc * ofl, int argc) if (Bgflag == TRUE) { if (zdflag == SET_FALSE) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_BGROUP), MSG_ORIG(MSG_ARG_ZNODEF)); ofl->ofl_flags |= FLG_OF_FATAL; @@ -267,7 +268,8 @@ check_flags(Ofl_desc * ofl, int argc) * job running this object. */ if ((ofl->ofl_dtflags_1 & DF_1_NODEFLIB) && !ofl->ofl_rpath) - eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_NODEFLIB)); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_ARG_NODEFLIB)); /* * By default, text relocation warnings are given when building @@ -331,27 +333,30 @@ check_flags(Ofl_desc * ofl, int argc) ofl->ofl_flags |= FLG_OF_NOUNDEF; if (Bsflag) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_DYNINCOMP), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_DYNINCOMP), MSG_ORIG(MSG_ARG_BSYMBOLIC)); ofl->ofl_flags |= FLG_OF_FATAL; } if (ofl->ofl_soname) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_DYNINCOMP), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_DYNINCOMP), MSG_ORIG(MSG_ARG_H)); ofl->ofl_flags |= FLG_OF_FATAL; } if (Btflag) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_DYNINCOMP), - MSG_ORIG(MSG_ARG_BTRANS)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_DYNINCOMP), + MSG_ORIG(MSG_ARG_BTRANS)); ofl->ofl_flags |= FLG_OF_FATAL; } if (ofl->ofl_filtees) { if (ofl->ofl_flags & FLG_OF_AUX) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_DYNINCOMP), MSG_ORIG(MSG_ARG_F)); } else { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_DYNINCOMP), MSG_ORIG(MSG_ARG_CF)); } @@ -397,53 +402,63 @@ check_flags(Ofl_desc * ofl, int argc) ofl->ofl_flags |= FLG_OF_STATIC; if (bflag) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), - MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_B)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN), + MSG_ORIG(MSG_ARG_B)); ofl->ofl_flags |= FLG_OF_FATAL; } if (ofl->ofl_soname) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), - MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_H)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN), + MSG_ORIG(MSG_ARG_H)); ofl->ofl_flags |= FLG_OF_FATAL; } if (ofl->ofl_depaudit) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), - MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_P)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN), + MSG_ORIG(MSG_ARG_P)); ofl->ofl_flags |= FLG_OF_FATAL; } if (ofl->ofl_audit) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), - MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_CP)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN), + MSG_ORIG(MSG_ARG_CP)); ofl->ofl_flags |= FLG_OF_FATAL; } if (ofl->ofl_config) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), - MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_C)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN), + MSG_ORIG(MSG_ARG_C)); ofl->ofl_flags |= FLG_OF_FATAL; } if (ofl->ofl_filtees) { if (ofl->ofl_flags & FLG_OF_AUX) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_F)); } else { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_CF)); } ofl->ofl_flags |= FLG_OF_FATAL; } if (ztflag) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), - MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_ZTEXTALL)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN), + MSG_ORIG(MSG_ARG_ZTEXTALL)); ofl->ofl_flags |= FLG_OF_FATAL; } if (Gflag) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), - MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_CG)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN), + MSG_ORIG(MSG_ARG_CG)); ofl->ofl_flags |= FLG_OF_FATAL; } if (aflag && rflag) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), - MSG_ORIG(MSG_ARG_A), MSG_ORIG(MSG_ARG_R)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_A), + MSG_ORIG(MSG_ARG_R)); ofl->ofl_flags |= FLG_OF_FATAL; } @@ -453,14 +468,16 @@ check_flags(Ofl_desc * ofl, int argc) * if no output relocations will refer to them */ if (sflag) { - eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_STRIP)); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_ARG_STRIP)); } if (ztflag == 0) ofl->ofl_flags1 |= FLG_OF1_TEXTOFF; if (ofl->ofl_interp) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_R), MSG_ORIG(MSG_ARG_CI)); ofl->ofl_flags |= FLG_OF_FATAL; } @@ -486,7 +503,7 @@ check_flags(Ofl_desc * ofl, int argc) * it is only at this point we're sure what the output image will be * (static or dynamic). */ - if (ent_setup(ofl, M_SEGM_ALIGN) == S_ERROR) + if (ld_ent_setup(ofl, M_SEGM_ALIGN) == S_ERROR) return (S_ERROR); /* @@ -498,11 +515,11 @@ check_flags(Ofl_desc * ofl, int argc) const char *name; for (LIST_TRAVERSE(&ofl->ofl_maps, lnp, name)) - if (map_parse(name, ofl) == S_ERROR) + if (ld_map_parse(name, ofl) == S_ERROR) return (S_ERROR); if (ofl->ofl_flags & FLG_OF_SEGSORT) - if (sort_seg_list(ofl) == S_ERROR) + if (ld_sort_seg_list(ofl) == S_ERROR) return (S_ERROR); } @@ -513,7 +530,8 @@ check_flags(Ofl_desc * ofl, int argc) */ if (zlflag) { if ((ofl->ofl_filtees == 0) && (ofl->ofl_dtsfltrs == 0)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_NOFLTR), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_NOFLTR), MSG_ORIG(MSG_ARG_ZLOADFLTR)); ofl->ofl_flags |= FLG_OF_FATAL; } @@ -530,7 +548,8 @@ check_flags(Ofl_desc * ofl, int argc) if (Vflag && (argc == 2)) ofl->ofl_flags1 |= FLG_OF1_DONE; else { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_NOFILES)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_NOFILES)); return (S_ERROR); } } @@ -556,7 +575,7 @@ createargv(Ofl_desc *ofl, int *error) * ld32= or * ld64= */ -#if defined(_LP64) +#if defined(_LP64) if (optarg[2] == '3') return (0); #else @@ -657,7 +676,7 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) int c; while ((c = getopt(argc, argv, MSG_ORIG(MSG_STR_OPTIONS))) != -1) { - DBG_CALL(Dbg_args_flags((optind - 1), c)); + DBG_CALL(Dbg_args_flags(ofl->ofl_lml, (optind - 1), c)); switch (c) { case '6': /* Processed by ld to */ @@ -667,7 +686,8 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) * -6* option is mistakenly passed to us. */ if (optarg[0] != '4') { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLEGAL), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_ILLEGAL), MSG_ORIG(MSG_ARG_6), optarg); ofl->ofl_flags |= FLG_OF_FATAL; } @@ -683,33 +703,35 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) case 'c': if (ofl->ofl_config) - eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_ARG_MTONCE), MSG_ORIG(MSG_ARG_C)); else ofl->ofl_config = optarg; break; case 'C': - ofl->ofl_flags1 |= FLG_OF1_DEMANGL; + demangle_flag = 1; break; case 'd': if ((optarg[0] == 'n') && (optarg[1] == '\0')) { if (dflag != SET_UNKNOWN) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE), MSG_ORIG(MSG_ARG_D)); else dflag = SET_FALSE; } else if ((optarg[0] == 'y') && (optarg[1] == '\0')) { if (dflag != SET_UNKNOWN) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE), MSG_ORIG(MSG_ARG_D)); else dflag = SET_TRUE; } else { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLEGAL), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_ILLEGAL), MSG_ORIG(MSG_ARG_D), optarg); ofl->ofl_flags |= FLG_OF_FATAL; } @@ -717,7 +739,8 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) case 'e': if (ofl->ofl_entry) - eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_ARG_MTONCE), MSG_ORIG(MSG_ARG_E)); else ofl->ofl_entry = (void *)optarg; @@ -726,7 +749,8 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) case 'f': if (ofl->ofl_filtees && (!(ofl->ofl_flags & FLG_OF_AUX))) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_F), MSG_ORIG(MSG_ARG_CF)); ofl->ofl_flags |= FLG_OF_FATAL; } else { @@ -741,7 +765,8 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) case 'F': if (ofl->ofl_filtees && (ofl->ofl_flags & FLG_OF_AUX)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_CF), MSG_ORIG(MSG_ARG_F)); ofl->ofl_flags |= FLG_OF_FATAL; } else { @@ -754,7 +779,8 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) case 'h': if (ofl->ofl_soname) - eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_ARG_MTONCE), MSG_ORIG(MSG_ARG_H)); else ofl->ofl_soname = (const char *)optarg; @@ -766,7 +792,8 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) case 'I': if (ofl->ofl_interp) - eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_ARG_MTONCE), MSG_ORIG(MSG_ARG_CI)); else ofl->ofl_interp = (const char *)optarg; @@ -788,7 +815,8 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) case 'o': if (ofl->ofl_name) - eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_ARG_MTONCE), MSG_ORIG(MSG_ARG_O)); else ofl->ofl_name = (const char *)optarg; @@ -876,7 +904,7 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) } else if ( strcmp(optarg, MSG_ORIG(MSG_ARG_DEFS)) == 0) { if (zdflag != SET_UNKNOWN) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE), MSG_ORIG(MSG_ARG_ZDEFNODEF)); else @@ -884,7 +912,7 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) } else if (strcmp(optarg, MSG_ORIG(MSG_ARG_NODEFS)) == 0) { if (zdflag != SET_UNKNOWN) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE), MSG_ORIG(MSG_ARG_ZDEFNODEF)); else @@ -893,7 +921,7 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) MSG_ORIG(MSG_ARG_TEXT)) == 0) { if (ztflag && (ztflag != MSG_ORIG(MSG_ARG_ZTEXT))) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_ZTEXT), ztflag); @@ -904,7 +932,7 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) MSG_ORIG(MSG_ARG_TEXTOFF)) == 0) { if (ztflag && (ztflag != MSG_ORIG(MSG_ARG_ZTEXTOFF))) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_ZTEXTOFF), ztflag); @@ -915,7 +943,7 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) MSG_ORIG(MSG_ARG_TEXTWARN)) == 0) { if (ztflag && (ztflag != MSG_ORIG(MSG_ARG_ZTEXTWARN))) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_ZTEXTWARN), ztflag); @@ -1016,7 +1044,8 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) strcmp(optarg, MSG_ORIG(MSG_ARG_NOLAZYLOAD)) && strcmp(optarg, MSG_ORIG(MSG_ARG_RECORD)) && strcmp(optarg, MSG_ORIG(MSG_ARG_WEAKEXT))) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLEGAL), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_ILLEGAL), MSG_ORIG(MSG_ARG_Z), optarg); ofl->ofl_flags |= FLG_OF_FATAL; @@ -1034,16 +1063,17 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) * process_files (this allows debugging to be turned * on and off around individual groups of files). */ - if (ofl->ofl_objscnt == 0) - if ((dbg_mask = dbg_setup(optarg)) == - (uint_t)S_ERROR) + if (ofl->ofl_objscnt == 0) { + if (dbg_setup(optarg, dbg_desc, + &ofl->ofl_name, 1) == S_ERROR) return (S_ERROR); + } break; case 'B': if (strcmp(optarg, MSG_ORIG(MSG_ARG_DIRECT)) == 0) { if (Bdflag == SET_FALSE) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_BNODIRECT), MSG_ORIG(MSG_ARG_BDIRECT)); @@ -1053,7 +1083,7 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) } else if (strcmp(optarg, MSG_ORIG(MSG_ARG_NODIRECT)) == 0) { if (Bdflag == SET_TRUE) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_BDIRECT), MSG_ORIG(MSG_ARG_BNODIRECT)); @@ -1077,7 +1107,8 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) Beflag = TRUE; else if (strcmp(optarg, MSG_ORIG(MSG_STR_LD_DYNAMIC)) && strcmp(optarg, MSG_ORIG(MSG_ARG_STATIC))) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLEGAL), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_ILLEGAL), MSG_ORIG(MSG_ARG_CB), optarg); ofl->ofl_flags |= FLG_OF_FATAL; } @@ -1101,20 +1132,21 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) case 'Q': if ((optarg[0] == 'n') && (optarg[1] == '\0')) { if (Qflag != SET_UNKNOWN) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE), MSG_ORIG(MSG_ARG_CQ)); else Qflag = SET_FALSE; } else if ((optarg[0] == 'y') && (optarg[1] == '\0')) { if (Qflag != SET_UNKNOWN) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE), MSG_ORIG(MSG_ARG_CQ)); else Qflag = SET_TRUE; } else { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLEGAL), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_ILLEGAL), MSG_ORIG(MSG_ARG_CQ), optarg); ofl->ofl_flags |= FLG_OF_FATAL; } @@ -1135,7 +1167,7 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) case 'Y': if (strncmp(optarg, MSG_ORIG(MSG_ARG_LCOM), 2) == 0) { if (Llibdir) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE), MSG_ORIG(MSG_ARG_CYL)); else @@ -1143,7 +1175,7 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) } else if (strncmp(optarg, MSG_ORIG(MSG_ARG_UCOM), 2) == 0) { if (Ulibdir) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE), MSG_ORIG(MSG_ARG_CYU)); else @@ -1151,13 +1183,14 @@ parseopt_pass1(Ofl_desc *ofl, int argc, char **argv, int *error) } else if (strncmp(optarg, MSG_ORIG(MSG_ARG_PCOM), 2) == 0) { if (Plibpath) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_ARG_MTONCE), MSG_ORIG(MSG_ARG_CYP)); else Plibpath = optarg + 2; } else { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLEGAL), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_ARG_ILLEGAL), MSG_ORIG(MSG_ARG_CY), optarg); ofl->ofl_flags |= FLG_OF_FATAL; } @@ -1186,10 +1219,10 @@ parseopt_pass2(Ofl_desc *ofl, int argc, char **argv) Ifl_desc *ifl; Sym_desc *sdp; - DBG_CALL(Dbg_args_flags((optind - 1), c)); + DBG_CALL(Dbg_args_flags(ofl->ofl_lml, (optind - 1), c)); switch (c) { case 'l': - if (find_library(optarg, ofl) == S_ERROR) + if (ld_find_library(optarg, ofl) == S_ERROR) return (S_ERROR); break; case 'B': @@ -1199,7 +1232,7 @@ parseopt_pass2(Ofl_desc *ofl, int argc, char **argv) ofl->ofl_flags |= FLG_OF_DYNLIBS; else { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_BDYNAMIC)); @@ -1210,7 +1243,7 @@ parseopt_pass2(Ofl_desc *ofl, int argc, char **argv) ofl->ofl_flags &= ~FLG_OF_DYNLIBS; break; case 'L': - if (add_libdir(ofl, optarg) == S_ERROR) + if (ld_add_libdir(ofl, optarg) == S_ERROR) return (S_ERROR); break; case 'N': @@ -1218,7 +1251,7 @@ parseopt_pass2(Ofl_desc *ofl, int argc, char **argv) * Record DT_NEEDED string */ if (!(ofl->ofl_flags & FLG_OF_DYNAMIC)) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_INCOMP), MSG_ORIG(MSG_ARG_DN), MSG_ORIG(MSG_ARG_CN)); @@ -1236,10 +1269,11 @@ parseopt_pass2(Ofl_desc *ofl, int argc, char **argv) break; case 'D': - dbg_mask = dbg_setup(optarg); + (void) dbg_setup(optarg, dbg_desc, + &ofl->ofl_name, 2); break; case 'u': - if (sym_add_u(optarg, ofl) == + if (ld_sym_add_u(optarg, ofl) == (Sym_desc *)S_ERROR) return (S_ERROR); break; @@ -1291,7 +1325,7 @@ parseopt_pass2(Ofl_desc *ofl, int argc, char **argv) } else if (strncmp(optarg, MSG_ORIG(MSG_ARG_INITARRAY), MSG_ARG_INITARRAY_SIZE) == 0) { - if (((sdp = sym_add_u(optarg + + if (((sdp = ld_sym_add_u(optarg + MSG_ARG_INITARRAY_SIZE, ofl)) == (Sym_desc *)S_ERROR) || (list_appendc(&ofl->ofl_initarray, @@ -1300,7 +1334,7 @@ parseopt_pass2(Ofl_desc *ofl, int argc, char **argv) } else if (strncmp(optarg, MSG_ORIG(MSG_ARG_FINIARRAY), MSG_ARG_FINIARRAY_SIZE) == 0) { - if (((sdp = sym_add_u(optarg + + if (((sdp = ld_sym_add_u(optarg + MSG_ARG_FINIARRAY_SIZE, ofl)) == (Sym_desc *)S_ERROR) || (list_appendc(&ofl->ofl_finiarray, @@ -1309,7 +1343,7 @@ parseopt_pass2(Ofl_desc *ofl, int argc, char **argv) } else if (strncmp(optarg, MSG_ORIG(MSG_ARG_PREINITARRAY), MSG_ARG_PREINITARRAY_SIZE) == 0) { - if (((sdp = sym_add_u(optarg + + if (((sdp = ld_sym_add_u(optarg + MSG_ARG_PREINITARRAY_SIZE, ofl)) == (Sym_desc *)S_ERROR) || (list_appendc(&ofl->ofl_preiarray, @@ -1318,7 +1352,7 @@ parseopt_pass2(Ofl_desc *ofl, int argc, char **argv) } else if (strncmp(optarg, MSG_ORIG(MSG_ARG_RTLDINFO), MSG_ARG_RTLDINFO_SIZE) == 0) { - if (((sdp = sym_add_u(optarg + + if (((sdp = ld_sym_add_u(optarg + MSG_ARG_RTLDINFO_SIZE, ofl)) == (Sym_desc *)S_ERROR) || (list_appendc(&ofl->ofl_rtldinfo, @@ -1327,7 +1361,7 @@ parseopt_pass2(Ofl_desc *ofl, int argc, char **argv) } else if (strncmp(optarg, MSG_ORIG(MSG_ARG_DTRACE), MSG_ARG_DTRACE_SIZE) == 0) { - if ((sdp = sym_add_u(optarg + + if ((sdp = ld_sym_add_u(optarg + MSG_ARG_DTRACE_SIZE, ofl)) == (Sym_desc *)S_ERROR) return (S_ERROR); @@ -1369,7 +1403,7 @@ process_flags_com(Ofl_desc *ofl, int argc, char **argv, int *e) } uintptr_t -process_flags(Ofl_desc *ofl, int argc, char **argv) +ld_process_flags(Ofl_desc *ofl, int argc, char **argv) { int error = 0; /* Collect all argument errors before exit */ @@ -1425,15 +1459,16 @@ process_files_com(Ofl_desc *ofl, int argc, char **argv) if ((fd = open(argv[optind], O_RDONLY)) == -1) { int err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), argv[optind], + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_SYS_OPEN), argv[optind], strerror(err)); ofl->ofl_flags |= FLG_OF_FATAL; continue; } - DBG_CALL(Dbg_args_files(optind, argv[optind])); + DBG_CALL(Dbg_args_files(ofl->ofl_lml, optind, argv[optind])); - ifl = process_open(argv[optind], 0, fd, ofl, + ifl = ld_process_open(argv[optind], 0, fd, ofl, (FLG_IF_CMDLINE | FLG_IF_NEEDED), &rej); (void) close(fd); if (ifl == (Ifl_desc *)S_ERROR) @@ -1443,9 +1478,10 @@ process_files_com(Ofl_desc *ofl, int argc, char **argv) * Check for mismatched input. */ if (rej.rej_type) { - eprintf(ERR_FATAL, MSG_INTL(reject[rej.rej_type]), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(reject[rej.rej_type]), rej.rej_name ? rej.rej_name : - MSG_INTL(MSG_STR_UNKNOWN), conv_reject_str(&rej)); + MSG_INTL(MSG_STR_UNKNOWN), conv_reject_desc(&rej)); ofl->ofl_flags |= FLG_OF_FATAL; return (1); } @@ -1454,7 +1490,7 @@ process_files_com(Ofl_desc *ofl, int argc, char **argv) } uintptr_t -process_files(Ofl_desc *ofl, int argc, char **argv) +ld_process_files(Ofl_desc *ofl, int argc, char **argv) { optind = 1; /* reinitialize optind */ @@ -1472,7 +1508,7 @@ process_files(Ofl_desc *ofl, int argc, char **argv) * any additional `needed' shared object dependencies. */ if (ofl->ofl_soneed.head) - if (finish_libs(ofl) == S_ERROR) + if (ld_finish_libs(ofl) == S_ERROR) return (S_ERROR); /* @@ -1492,7 +1528,7 @@ process_files(Ofl_desc *ofl, int argc, char **argv) ofl->ofl_flags1 &= ~FLG_OF1_EXTRACT; - DBG_CALL(Dbg_file_ar_rescan()); + DBG_CALL(Dbg_file_ar_rescan(ofl->ofl_lml)); for (LIST_TRAVERSE(&ofl->ofl_ars, lnp, adp)) { const char *name = adp->ad_name; @@ -1512,7 +1548,8 @@ process_files(Ofl_desc *ofl, int argc, char **argv) if ((fd = open(name, O_RDONLY)) == -1) { int err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), name, + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_SYS_OPEN), name, strerror(err)); ofl->ofl_flags |= FLG_OF_FATAL; return (S_ERROR); @@ -1524,7 +1561,7 @@ process_files(Ofl_desc *ofl, int argc, char **argv) ofl->ofl_flags1 &= ~MSK_OF1_ARCHIVE; ofl->ofl_flags1 |= (adp->ad_flags & MSK_OF1_ARCHIVE); - error = process_archive(adp->ad_name, fd, adp, ofl); + error = ld_process_archive(adp->ad_name, fd, adp, ofl); (void) close(fd); if (error == S_ERROR) @@ -1549,7 +1586,7 @@ process_files(Ofl_desc *ofl, int argc, char **argv) * version dependencies are satisfied, and version symbols created. */ if (ofl->ofl_verdesc.head) - if (vers_check_defs(ofl) == S_ERROR) + if (ld_vers_check_defs(ofl) == S_ERROR) return (S_ERROR); /* @@ -1557,7 +1594,7 @@ process_files(Ofl_desc *ofl, int argc, char **argv) * are ok. */ if (ofl->ofl_flags & FLG_OF_SEGORDER) - ent_check(ofl); + ld_ent_check(ofl); return (1); } diff --git a/usr/src/cmd/sgs/libld/common/debug.c b/usr/src/cmd/sgs/libld/common/debug.c index 352d32d4f9..36c34fdb25 100644 --- a/usr/src/cmd/sgs/libld/common/debug.c +++ b/usr/src/cmd/sgs/libld/common/debug.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,31 +18,136 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 1999 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> +#include <stdarg.h> +#include <strings.h> #include <dlfcn.h> -#include "debug.h" -#include "_libld.h" +#include <debug.h> +#include "msg.h" /* - * It's possible that dbg_setup may be called more than once. + * dbg_setup() can be called a number of times. The typical use through + * LD_OPTIONS, results in dbg_setup() being called as the first argument to + * ld(1). It's also possible to pass debugging tokens through the compiler, + * for example -Wl,-Dlibs -Wl-Ddetail, in which case multiple dbg_setup() + * calls are made. + * + * A distinction is also made between diagnostics being requested before any + * other ld(1) options are read, or whether the debugging options occur + * between other options on the command line. In the latter case, the + * debugging options can be used to isolate diagnostics around one or more + * input files. The "phase" argument allows us to select which phase of + * dbg_setup() processing we should isolate ourselves to. + * + * dbg_print() can require the output filename for use in the diagnostics + * created. Save the address of the output filename pointer for this use. */ -static int dbg_init = 0; +static const char **Name = 0; +static int Phase = 0; -int -dbg_setup(const char * options) +uintptr_t +dbg_setup(const char *options, Dbg_desc *dbp, const char **name, int phase) { - if (dbg_init) + if (Phase == 0) + Phase = phase; + else if (Phase != phase) return (0); + Name = name; + /* * Call the debugging setup routine to initialize the mask and * debug function array. */ - return (Dbg_setup(options)); + return (Dbg_setup(options, dbp)); +} + +/* PRINTFLIKE2 */ +void +dbg_print(Lm_list *lml, const char *format, ...) +{ + static char *prestr = 0; + va_list args; + +#if defined(lint) + /* + * The lml argument is only meaningful for diagnostics sent to ld.so.1. + * Supress the lint error by making a dummy assignment. + */ + lml = 0; +#endif + /* + * Knock off any newline indicator to signify that a diagnostic has + * been processed. + */ + dbg_desc->d_extra &= ~DBG_E_STDNL; + + if (DBG_ISSNAME()) { + /* + * If the debugging options have requested each diagnostic line + * be prepended by a name create a prefix string. + */ + if ((prestr == 0) && *Name) { + const char *name, *cls; + size_t len; + + /* + * Select the fullname or basename of the output file + * being created. + */ + if (DBG_ISFNAME()) + name = *Name; + else { + if ((name = + strrchr(*Name, '/')) == 0) + name = *Name; + else + name++; + } + len = strlen(name) + + strlen(MSG_INTL(MSG_DBG_NAME_FMT)) + 1; + + /* + * Add the output file class if required. + */ + if (DBG_ISCLASS()) { +#if defined(_ELF64) + len += MSG_DBG_CLS64_FMT_SIZE; + cls = MSG_ORIG(MSG_DBG_CLS64_FMT); +#else + len += MSG_DBG_CLS32_FMT_SIZE; + cls = MSG_ORIG(MSG_DBG_CLS32_FMT); +#endif + } + + /* + * Allocate a string to build the prefix. + */ + if ((prestr = malloc(len)) == 0) + prestr = (char *)MSG_INTL(MSG_DBG_DFLT_FMT); + else { + (void) snprintf(prestr, len, + MSG_INTL(MSG_DBG_NAME_FMT), name); + if (DBG_ISCLASS()) + (void) strcat(prestr, cls); + } + } + if (prestr) + (void) fputs(prestr, stderr); + else + (void) fputs(MSG_INTL(MSG_DBG_AOUT_FMT), stderr); + } else + (void) fputs(MSG_INTL(MSG_DBG_DFLT_FMT), stderr); + + va_start(args, format); + (void) vfprintf(stderr, format, args); + (void) fprintf(stderr, MSG_ORIG(MSG_STR_NL)); + va_end(args); } diff --git a/usr/src/cmd/sgs/libld/common/entry.c b/usr/src/cmd/sgs/libld/common/entry.c index e9f9bbe6c7..bd43203fe9 100644 --- a/usr/src/cmd/sgs/libld/common/entry.c +++ b/usr/src/cmd/sgs/libld/common/entry.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,19 +18,19 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> #include <memory.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" @@ -41,7 +40,7 @@ * segments it can potentially create. Additional segments may be added * using a map file. */ -#ifdef _ELF64 +#if defined(_ELF64) /* Phdr packing changes under Elf64 */ static Sg_desc sg_desc[LD_NUM] = { {{PT_PHDR, PF_R + PF_X, 0, 0, 0, 0, 0, 0}, @@ -183,7 +182,7 @@ static const Ent_desc ent_desc[] = { * the output file descriptor. */ uintptr_t -ent_setup(Ofl_desc * ofl, Xword segalign) +ld_ent_setup(Ofl_desc * ofl, Xword segalign) { Ent_desc * enp; Sg_desc * sgp; @@ -193,15 +192,17 @@ ent_setup(Ofl_desc * ofl, Xword segalign) * Initialize the elf library. */ if (elf_version(EV_CURRENT) == EV_NONE) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ELF_LIBELF), EV_CURRENT); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ELF_LIBELF), + EV_CURRENT); return (S_ERROR); } /* * Initialize internal Global Symbol Table AVL tree */ - avl_create(&ofl->ofl_symavl, &sym_avl_comp, sizeof (Sym_avlnode), - SGSOFFSETOF(Sym_avlnode, sav_node)); + avl_create(&ofl->ofl_symavl, &ld_sym_avl_comp, sizeof (Sym_avlnode), + SGSOFFSETOF(Sym_avlnode, sav_node)); + /* * The datasegment permissions can differ depending on whether * this object is built statically or dynamically. diff --git a/usr/src/cmd/sgs/libld/common/exit.c b/usr/src/cmd/sgs/libld/common/exit.c index 11712fca62..e08fdaeffc 100644 --- a/usr/src/cmd/sgs/libld/common/exit.c +++ b/usr/src/cmd/sgs/libld/common/exit.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 1999-2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -35,7 +34,6 @@ #include <unistd.h> #include <signal.h> #include <locale.h> -#include <errno.h> #include <string.h> #include "msg.h" #include "_libld.h" @@ -44,19 +42,18 @@ * Exit after cleaning up. */ int -ldexit() +ld_exit(Ofl_desc *ofl) { /* * If we have created an output file remove it. */ - if ((Ofl.ofl_fd > 0) && ((Ofl.ofl_flags1 & FLG_OF1_NONREG) == 0)) - (void) unlink(Ofl.ofl_name); + if ((ofl->ofl_fd > 0) && ((ofl->ofl_flags1 & FLG_OF1_NONREG) == 0)) + (void) unlink(ofl->ofl_name); /* * Inform any support library that the link-edit has failed. */ - lds_atexit(1); - + ld_sup_atexit(ofl, 1); return (1); } @@ -69,12 +66,15 @@ typedef struct { void (* defhdl)(); } Signals; -Signals signals[] = { { SIGHUP, SIG_DFL }, - { SIGINT, SIG_IGN }, - { SIGQUIT, SIG_DFL }, - { SIGBUS, SIG_DFL }, - { SIGTERM, SIG_IGN }, - { 0, 0 } }; +static Signals signals[] = { + { SIGHUP, SIG_DFL }, + { SIGINT, SIG_IGN }, + { SIGQUIT, SIG_DFL }, + { SIGBUS, SIG_DFL }, + { SIGTERM, SIG_IGN }, + { 0, 0 } }; + +static Ofl_desc *Ofl = 0; /* * Define our signal handler. @@ -108,9 +108,9 @@ handler(int sig, siginfo_t *sip, void *utp) * error (one instance was a stale NFS handle from an unstable server). * Thus we catch all bus errors and hope we can decode a better error. */ - if ((sig == SIGBUS) && sip && Ofl.ofl_name) { - eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INTERRUPT), Ofl.ofl_name, - strerror(sip->si_errno)); + if ((sig == SIGBUS) && sip && Ofl->ofl_name) { + eprintf(Ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_FIL_INTERRUPT), + Ofl->ofl_name, strerror(sip->si_errno)); } /* * This assert(0) causes DEBUG enabled linkers to produce a core file. @@ -118,19 +118,20 @@ handler(int sig, siginfo_t *sip, void *utp) if ((sig != SIGHUP) && (sig != SIGINT)) assert(0); - exit(ldexit()); + exit(ld_exit(Ofl)); } - /* * Establish a signal handler for all signals we're interested in. */ void -init() +ld_init(Ofl_desc *ofl) { struct sigaction nact, oact; Signals * sigs; + Ofl = ofl; + /* * For each signal we're interested in set up a signal handler that * insures we clean up any output file we're in the middle of creating. diff --git a/usr/src/cmd/sgs/libld/common/files.c b/usr/src/cmd/sgs/libld/common/files.c index 3eb93afb3e..d08ddff166 100644 --- a/usr/src/cmd/sgs/libld/common/files.c +++ b/usr/src/cmd/sgs/libld/common/files.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. @@ -24,7 +23,7 @@ * Copyright (c) 1988 AT&T * All Rights Reserved * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -44,7 +43,6 @@ #include <msg.h> #include <_libld.h> - /* * Decide if we can link against this input file. */ @@ -67,7 +65,7 @@ ifl_verify(Ehdr * ehdr, Ofl_desc * ofl, Rej_desc * rej) rej->rej_info = (uint_t)ehdr->e_ident[EI_DATA]; return (0); } - if (ehdr->e_version > ofl->ofl_libver) { + if (ehdr->e_version > ofl->ofl_dehdr->e_version) { rej->rej_type = SGS_REJ_VERSION; rej->rej_info = (uint_t)ehdr->e_version; return (0); @@ -75,12 +73,11 @@ ifl_verify(Ehdr * ehdr, Ofl_desc * ofl, Rej_desc * rej) return (1); } - /* * Check sanity of file header and allocate an infile descriptor * for the file being processed. */ -Ifl_desc * +static Ifl_desc * ifl_setup(const char *name, Ehdr *ehdr, Elf *elf, Half flags, Ofl_desc *ofl, Rej_desc *rej) { @@ -90,7 +87,7 @@ ifl_setup(const char *name, Ehdr *ehdr, Elf *elf, Half flags, Ofl_desc *ofl, if (ifl_verify(ehdr, ofl, &_rej) == 0) { _rej.rej_name = name; - DBG_CALL(Dbg_file_rejected(&_rej)); + DBG_CALL(Dbg_file_rejected(ofl->ofl_lml, &_rej)); if (rej->rej_type == 0) { *rej = _rej; rej->rej_name = strdup(_rej.rej_name); @@ -117,12 +114,14 @@ ifl_setup(const char *name, Ehdr *ehdr, Elf *elf, Half flags, Ofl_desc *ofl, Shdr *shdr0; if ((scn = elf_getscn(elf, 0)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSCN), name); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETSCN), name); ofl->ofl_flags |= FLG_OF_FATAL; return ((Ifl_desc *)S_ERROR); } if ((shdr0 = elf_getshdr(scn)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR), name); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETSHDR), name); ofl->ofl_flags |= FLG_OF_FATAL; return ((Ifl_desc *)S_ERROR); } @@ -159,7 +158,7 @@ ifl_setup(const char *name, Ehdr *ehdr, Elf *elf, Half flags, Ofl_desc *ofl, * Process a generic section. The appropriate section information is added * to the files input descriptor list. */ -uintptr_t +static uintptr_t process_section(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, Word ndx, int ident, Ofl_desc *ofl) { @@ -180,7 +179,8 @@ process_section(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, /* LINTED */ isp->is_key = (Half)ident; if ((isp->is_indata = elf_getdata(scn, NULL)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETDATA), ifl->ifl_name); + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_GETDATA), + ifl->ifl_name); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } @@ -195,19 +195,21 @@ process_section(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, * to the output section list (some sections like .strtab and * .shstrtab are not added to the output section list). * - * If the section has the SHF_ORDERED flag on, do the place_section() + * If the section has the SHF_ORDERED flag on, do the ld_place_section() * after all input sections from this file are read in. */ ifl->ifl_isdesc[ndx] = isp; if (ident && (shdr->sh_flags & ALL_SHF_ORDER) == 0) - return ((uintptr_t)place_section(ofl, isp, ident, 0)); + return ((uintptr_t)ld_place_section(ofl, isp, ident, 0)); if (ident && (shdr->sh_flags & ALL_SHF_ORDER)) { isp->is_flags |= FLG_IS_ORDERED; isp->is_ident = ident; + if ((ndx != 0) && (ndx == shdr->sh_link) && (shdr->sh_flags & SHF_ORDERED)) - return ((uintptr_t)place_section(ofl, isp, ident, 0)); + return ((uintptr_t)ld_place_section(ofl, isp, + ident, 0)); } return (1); @@ -248,7 +250,8 @@ sf1_cap(Ofl_desc *ofl, Xword val, Ifl_desc *ifl, const char *name) * capabilities, ignore any new input capabilities. */ if (ofl->ofl_flags1 & FLG_OF1_OVSFCAP) { - Dbg_cap_sec_entry(DBG_CAP_IGNORE, CA_SUNW_SF_1, val, M_MACH); + Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_IGNORE, CA_SUNW_SF_1, + val, M_MACH); return; } @@ -264,18 +267,20 @@ sf1_cap(Ofl_desc *ofl, Xword val, Ifl_desc *ifl, const char *name) * an F1_SUNW_FPUSED by itself is viewed as bad practice. */ if ((badval = (val & ~SF1_SUNW_MASK)) != 0) { - eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_BADSF1), + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_FIL_BADSF1), ifl->ifl_name, name, EC_XWORD(badval)); val &= SF1_SUNW_MASK; } if (val == SF1_SUNW_FPUSED) { - eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_BADSF1), + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_FIL_BADSF1), ifl->ifl_name, name, EC_XWORD(val)); return; } - Dbg_cap_sec_entry(DBG_CAP_OLD, CA_SUNW_SF_1, ofl->ofl_sfcap_1, M_MACH); - Dbg_cap_sec_entry(DBG_CAP_NEW, CA_SUNW_SF_1, val, M_MACH); + Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_OLD, CA_SUNW_SF_1, + ofl->ofl_sfcap_1, M_MACH); + Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_NEW, CA_SUNW_SF_1, + val, M_MACH); /* * Determine the resolution of the present frame pointer and the @@ -299,8 +304,8 @@ sf1_cap(Ofl_desc *ofl, Xword val, Ifl_desc *ifl, const char *name) ofl->ofl_sfcap_1 = val; } - Dbg_cap_sec_entry(DBG_CAP_RESOLVED, CA_SUNW_SF_1, ofl->ofl_sfcap_1, - M_MACH); + Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_RESOLVED, CA_SUNW_SF_1, + ofl->ofl_sfcap_1, M_MACH); } /* @@ -317,7 +322,8 @@ hw1_cap(Ofl_desc *ofl, Xword val) * capabilities, ignore any new input capabilities. */ if (ofl->ofl_flags1 & FLG_OF1_OVHWCAP) { - Dbg_cap_sec_entry(DBG_CAP_IGNORE, CA_SUNW_HW_1, val, M_MACH); + Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_IGNORE, CA_SUNW_HW_1, + val, M_MACH); return; } @@ -328,13 +334,14 @@ hw1_cap(Ofl_desc *ofl, Xword val) if (val == 0) return; - Dbg_cap_sec_entry(DBG_CAP_OLD, CA_SUNW_HW_1, ofl->ofl_hwcap_1, M_MACH); - Dbg_cap_sec_entry(DBG_CAP_NEW, CA_SUNW_HW_1, val, M_MACH); + Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_OLD, CA_SUNW_HW_1, + ofl->ofl_hwcap_1, M_MACH); + Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_NEW, CA_SUNW_HW_1, val, M_MACH); ofl->ofl_hwcap_1 |= val; - Dbg_cap_sec_entry(DBG_CAP_RESOLVED, CA_SUNW_HW_1, ofl->ofl_hwcap_1, - M_MACH); + Dbg_cap_sec_entry(ofl->ofl_lml, DBG_CAP_RESOLVED, CA_SUNW_HW_1, + ofl->ofl_hwcap_1, M_MACH); } /* @@ -344,9 +351,9 @@ hw1_cap(Ofl_desc *ofl, Xword val) static void process_cap(const char *name, Ifl_desc *ifl, Is_desc *cisp, Ofl_desc *ofl) { - Cap * cdata; + Cap *cdata; - Dbg_cap_sec_title(ofl->ofl_name); + Dbg_cap_sec_title(ofl); for (cdata = (Cap *)cisp->is_indata->d_buf; cdata->c_tag != CA_SUNW_NULL; cdata++) { @@ -358,7 +365,8 @@ process_cap(const char *name, Ifl_desc *ifl, Is_desc *cisp, Ofl_desc *ofl) sf1_cap(ofl, cdata->c_un.c_val, ifl, name); break; default: - eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_UNKCAP), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_FIL_UNKCAP), ifl->ifl_name, name, cdata->c_tag); } } @@ -370,7 +378,7 @@ process_cap(const char *name, Ifl_desc *ifl, Is_desc *cisp, Ofl_desc *ofl) * list as we will be creating our own replacement sections later (ie. * symtab and relocation). */ -uintptr_t +static uintptr_t /* ARGSUSED5 */ process_input(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, Word ndx, int ident, Ofl_desc *ofl) @@ -384,7 +392,7 @@ process_input(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, * relocations from shared objects to determine if any copy relocation symbol * has a displacement relocation against it. */ -uintptr_t +static uintptr_t /* ARGSUSED5 */ process_reloc(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, Word ndx, int ident, Ofl_desc *ofl) @@ -410,7 +418,7 @@ process_reloc(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, * Process a string table section. A valid section contains an initial and * final null byte. */ -uintptr_t +static uintptr_t process_strtab(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, Word ndx, int ident, Ofl_desc *ofl) { @@ -451,8 +459,8 @@ process_strtab(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, if (size) { data = isp->is_indata->d_buf; if (data[0] != '\0' || data[size - 1] != '\0') - eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_MALSTR), - ifl->ifl_name, name); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_FIL_MALSTR), ifl->ifl_name, name); } else isp->is_indata->d_buf = (void *)MSG_ORIG(MSG_STR_EMPTY); @@ -463,20 +471,21 @@ process_strtab(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, /* * Invalid sections produce a warning and are skipped. */ -uintptr_t +static uintptr_t /* ARGSUSED3 */ invalid_section(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, Word ndx, int ident, Ofl_desc *ofl) { - eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_INVALSEC), ifl->ifl_name, name, - conv_sectyp_str(ofl->ofl_e_machine, (unsigned)shdr->sh_type)); + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_FIL_INVALSEC), + ifl->ifl_name, name, conv_sec_type(ifl->ifl_ehdr->e_machine, + shdr->sh_type)); return (1); } /* * Process a progbits section. */ -uintptr_t +static uintptr_t process_progbits(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, Word ndx, int ident, Ofl_desc *ofl) { @@ -548,7 +557,7 @@ process_progbits(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, /* * Handles the SHT_SUNW_{DEBUG,DEBUGSTR) sections. */ -uintptr_t +static uintptr_t process_debug(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, Word ndx, int ident, Ofl_desc *ofl) { @@ -561,11 +570,10 @@ process_debug(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, return (process_progbits(name, ifl, shdr, scn, ndx, ident, ofl)); } - /* * Process a nobits section. */ -uintptr_t +static uintptr_t process_nobits(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, Word ndx, int ident, Ofl_desc *ofl) { @@ -585,7 +593,7 @@ process_nobits(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, /* * Process a SHT_*_ARRAY section. */ -uintptr_t +static uintptr_t process_array(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, Word ndx, int ident, Ofl_desc *ofl) { @@ -618,7 +626,7 @@ process_array(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, /* * Process a SHT_SYMTAB_SHNDX section. */ -uintptr_t +static uintptr_t process_sym_shndx(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, Word ndx, int ident, Ofl_desc *ofl) { @@ -633,8 +641,9 @@ process_sym_shndx(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, if ((isp == 0) || ((isp->is_shdr->sh_type != SHT_SYMTAB) && (isp->is_shdr->sh_type != SHT_DYNSYM))) { - eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVSHLINK), - ifl->ifl_name, name, EC_XWORD(shdr->sh_link)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_FIL_INVSHLINK), ifl->ifl_name, name, + EC_XWORD(shdr->sh_link)); return (S_ERROR); } isp->is_symshndx = ifl->ifl_isdesc[ndx]; @@ -645,7 +654,7 @@ process_sym_shndx(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, /* * Final processing for SHT_SYMTAB_SHNDX section. */ -uintptr_t +static uintptr_t /* ARGSUSED2 */ sym_shndx_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) { @@ -654,9 +663,9 @@ sym_shndx_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) if ((isp == 0) || ((isp->is_shdr->sh_type != SHT_SYMTAB) && (isp->is_shdr->sh_type != SHT_DYNSYM))) { - eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVSHLINK), - isc->is_file->ifl_name, isc->is_name, - EC_XWORD(isc->is_shdr->sh_link)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_FIL_INVSHLINK), isc->is_file->ifl_name, + isc->is_name, EC_XWORD(isc->is_shdr->sh_link)); return (S_ERROR); } isp->is_symshndx = isc; @@ -672,7 +681,7 @@ sym_shndx_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) * set when libld is called from ld.so.1). */ /*ARGSUSED*/ -uintptr_t +static uintptr_t process_rel_dynamic(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, Word ndx, int ident, Ofl_desc *ofl) { @@ -691,7 +700,8 @@ process_rel_dynamic(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, * Find the string section associated with the .dynamic section. */ if ((strscn = elf_getscn(ifl->ifl_elf, shdr->sh_link)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSCN), ifl->ifl_name); + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_GETSCN), + ifl->ifl_name); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } @@ -975,7 +985,7 @@ expand(const char *parent, const char *name, char **next) * recorded on the `ofl_soneed' list and will be analyzed after all explicit * file processing has been completed (refer finish_libs()). */ -uintptr_t +static uintptr_t process_dynamic(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) { Dyn *data, *dyn; @@ -1120,9 +1130,9 @@ process_dynamic(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) else hint = MSG_ORIG(MSG_STR_EMPTY); - eprintf(ERR_FATAL, MSG_INTL(MSG_REC_OBJCNFLT), - sifl->ifl_name, ifl->ifl_name, - sifl->ifl_soname, hint); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_REC_OBJCNFLT), sifl->ifl_name, + ifl->ifl_name, sifl->ifl_soname, hint); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } @@ -1135,8 +1145,9 @@ process_dynamic(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) */ if (ofl->ofl_soname && (strcmp(ofl->ofl_soname, ifl->ifl_soname) == 0)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REC_OPTCNFLT), - ifl->ifl_name, ifl->ifl_soname); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_REC_OPTCNFLT), ifl->ifl_name, + ifl->ifl_soname); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } @@ -1144,13 +1155,12 @@ process_dynamic(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) return (1); } - /* * Process a relocation entry. At this point all input sections from this * input file have been assigned an input section descriptor which is saved * in the `ifl_isdesc' array. */ -uintptr_t +static uintptr_t rel_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) { Word rndx; @@ -1162,9 +1172,9 @@ rel_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) * Make sure this is a valid relocation we can handle. */ if (shdr->sh_type != M_REL_SHT_TYPE) { - eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVALSEC), ifl->ifl_name, - isc->is_name, conv_sectyp_str(ofl->ofl_e_machine, - (unsigned)shdr->sh_type)); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_FIL_INVALSEC), + ifl->ifl_name, isc->is_name, + conv_sec_type(ifl->ifl_ehdr->e_machine, shdr->sh_type)); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } @@ -1181,7 +1191,7 @@ rel_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) /* * Broken input file. */ - eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVSHINFO), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_FIL_INVSHINFO), ifl->ifl_name, isc->is_name, EC_XWORD(rndx)); ofl->ofl_flags |= FLG_OF_FATAL; return (0); @@ -1208,8 +1218,9 @@ rel_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) return (S_ERROR); return (1); } - eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVRELOC1), - ifl->ifl_name, isc->is_name, risc->is_name); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_FIL_INVRELOC1), ifl->ifl_name, + isc->is_name, risc->is_name); return (0); } if (list_appendc(&osp->os_relisdescs, isc) == 0) @@ -1241,7 +1252,7 @@ process_exclude(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, /* * A conflict, issue an warning message, and ignore the section. */ - eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_EXCLUDE), + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_FIL_EXCLUDE), ifl->ifl_name, name); return (0); } @@ -1252,6 +1263,53 @@ process_exclude(const char *name, Ifl_desc *ifl, Shdr *shdr, Elf_Scn *scn, return (process_section(name, ifl, shdr, scn, ndx, 0, ofl)); } +#if (defined(__i386) || defined(__amd64)) && defined(_ELF64) + +static uintptr_t +process_amd64_unwind(const char *name, Ifl_desc *ifl, Shdr *shdr, + Elf_Scn *scn, Word ndx, int ident, Ofl_desc *ofl) +{ + Os_desc *osp, *eosp; + Is_desc *isp; + Listnode *lnp; + + if (process_section(name, ifl, shdr, scn, ndx, ident, ofl) == S_ERROR) + return (S_ERROR); + + /* + * When producing a relocatable object - just collect the sections. + */ + if (ofl->ofl_flags & FLG_OF_RELOBJ) + return (1); + + /* + * If producing a executable or shared library, keep track of all the + * output UNWIND sections to allow the creation of the appropriate + * frame_hdr information. + * + * If the section hasn't been placed in the output file, then there's + * nothing for us to do. + */ + if (((isp = ifl->ifl_isdesc[ndx]) == 0) || + ((osp = isp->is_osdesc) == 0)) + return (1); + + /* + * Check to see if this output section is already on the list, and if + * not, add it. + */ + for (LIST_TRAVERSE(&ofl->ofl_unwind, lnp, eosp)) + if (osp == eosp) + return (1); + + if (list_appendc(&ofl->ofl_unwind, osp) == 0) + return (S_ERROR); + + return (1); +} + +#endif + /* * Section processing state table. `Initial' describes the required initial * procedure to be called (if any), `Final' describes the final processing @@ -1287,7 +1345,7 @@ static uintptr_t (*Final[SHT_NUM][2])() = { /* SHT_NULL */ NULL, NULL, /* SHT_PROGBITS */ NULL, NULL, -/* SHT_SYMTAB */ sym_process, sym_process, +/* SHT_SYMTAB */ ld_sym_process, ld_sym_process, /* SHT_STRTAB */ NULL, NULL, /* SHT_RELA */ rel_process, NULL, /* SHT_HASH */ NULL, NULL, @@ -1296,7 +1354,7 @@ static uintptr_t (*Final[SHT_NUM][2])() = { /* SHT_NOBITS */ NULL, NULL, /* SHT_REL */ rel_process, NULL, /* SHT_SHLIB */ NULL, NULL, -/* SHT_DYNSYM */ NULL, sym_process, +/* SHT_DYNSYM */ NULL, ld_sym_process, /* SHT_UNKNOWN12 */ NULL, NULL, /* SHT_UNKNOWN13 */ NULL, NULL, /* SHT_INIT_ARRAY */ NULL, NULL, @@ -1313,7 +1371,7 @@ static uintptr_t (*Final[SHT_NUM][2])() = { * table to determine whether it should be processed (saved), ignored, or * is invalid for the type of input file being processed. */ -uintptr_t +static uintptr_t process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl) { Elf_Scn *scn; @@ -1332,33 +1390,36 @@ process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl) * First process the .shstrtab section so that later sections can * reference their name. */ - lds_file(ifl->ifl_name, elf_kind(elf), ifl->ifl_flags, elf); + ld_sup_file(ofl, ifl->ifl_name, elf_kind(elf), ifl->ifl_flags, elf); sndx = ifl->ifl_shstrndx; if ((scn = elf_getscn(elf, (size_t)sndx)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSCN), ifl->ifl_name); + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_GETSCN), + ifl->ifl_name); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } if ((shdr = elf_getshdr(scn)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR), ifl->ifl_name); + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR), + ifl->ifl_name); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } if ((name = elf_strptr(elf, (size_t)sndx, (size_t)shdr->sh_name)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_STRPTR), ifl->ifl_name); + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_STRPTR), + ifl->ifl_name); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } - if (lds_input_section(name, &shdr, sndx, ifl->ifl_name, - scn, elf, ofl) == S_ERROR) + if (ld_sup_input_section(ofl, name, &shdr, sndx, ifl->ifl_name, + scn, elf) == S_ERROR) return (S_ERROR); /* * Reset the name since the shdr->sh_name could have been changed as - * part of lds_input_section(). If there is no name, fabricate one + * part of ld_sup_input_section(). If there is no name, fabricate one * using the section index. */ if (shdr->sh_name == 0) { @@ -1370,7 +1431,8 @@ process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl) } else if ((name = elf_strptr(elf, (size_t)sndx, (size_t)shdr->sh_name)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_STRPTR), ifl->ifl_name); + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_STRPTR), + ifl->ifl_name); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } @@ -1394,7 +1456,7 @@ process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl) ident = M_ID_UNKNOWN; } - DBG_CALL(Dbg_file_generic(ifl)); + DBG_CALL(Dbg_file_generic(ofl->ofl_lml, ifl)); ndx = 0; vdfisp = vndisp = vsyisp = sifisp = capisp = 0; scn = NULL; @@ -1407,21 +1469,21 @@ process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl) continue; if ((shdr = elf_getshdr(scn)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR), - ifl->ifl_name); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETSHDR), ifl->ifl_name); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } name = str + (size_t)(shdr->sh_name); - if (lds_input_section(name, &shdr, ndx, ifl->ifl_name, scn, - elf, ofl) == S_ERROR) + if (ld_sup_input_section(ofl, name, &shdr, ndx, ifl->ifl_name, + scn, elf) == S_ERROR) return (S_ERROR); /* * Reset the name since the shdr->sh_name could have been - * changed as part of lds_input_section(). If there is no name, - * fabricate one using the section index. + * changed as part of ld_sup_input_section(). If there is no + * name, fabricate one using the section index. */ if (shdr->sh_name == 0) { (void) snprintf(_name, MAXNDXSIZE, @@ -1464,10 +1526,11 @@ process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl) * message but do the basic section processing anyway. */ if (row < (Word)SHT_LOSUNW) - eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_INVALSEC), - ifl->ifl_name, name, - conv_sectyp_str(ofl->ofl_e_machine, - (unsigned)shdr->sh_type)); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_FIL_INVALSEC), ifl->ifl_name, + name, + conv_sec_type(ifl->ifl_ehdr->e_machine, + shdr->sh_type)); /* * Handle sections greater than SHT_LOSUNW. @@ -1539,7 +1602,7 @@ process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl) * column == ET_REL */ if (process_amd64_unwind(name, ifl, - shdr, scn, ndx, M_ID_NULL, + shdr, scn, ndx, M_ID_UNWIND, ofl) == S_ERROR) return (S_ERROR); } @@ -1590,7 +1653,7 @@ process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl) * If this is an ordered section, process it. */ cnt++; - if ((osp = (Os_desc *)process_ordered(ifl, ofl, ndx, + if ((osp = (Os_desc *)ld_process_ordered(ifl, ofl, ndx, ifl->ifl_shnum)) == (Os_desc *)S_ERROR) return (S_ERROR); @@ -1650,7 +1713,7 @@ process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl) * .dynamic's NEEDED entries. */ if (vndisp && (ofl->ofl_flags & (FLG_OF_NOUNDEF | FLG_OF_SYMBOLIC))) - if (vers_need_process(vndisp, ifl, ofl) == S_ERROR) + if (ld_vers_need_process(vndisp, ifl, ofl) == S_ERROR) return (S_ERROR); /* @@ -1658,11 +1721,11 @@ process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl) * version sections. */ if (vsyisp) - (void) vers_sym_process(vsyisp, ifl); + (void) ld_vers_sym_process(ofl->ofl_lml, vsyisp, ifl); if (ifl->ifl_versym && (vdfisp || (sdf && (sdf->sdf_flags & FLG_SDF_SELECT)))) - if (vers_def_process(vdfisp, ifl, ofl) == S_ERROR) + if (ld_vers_def_process(vdfisp, ifl, ofl) == S_ERROR) return (S_ERROR); /* @@ -1677,8 +1740,8 @@ process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl) row = isp->is_shdr->sh_type; if ((isp->is_flags & FLG_IS_DISCARD) == 0) - lds_section(isp->is_name, isp->is_shdr, ndx, - isp->is_indata, elf); + ld_sup_section(ofl, isp->is_name, isp->is_shdr, ndx, + isp->is_indata, elf); /* * If this is a ST_SUNW_move section from a @@ -1708,7 +1771,7 @@ process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl) */ if (sifisp && ((ifl->ifl_flags & (FLG_IF_NEEDED | FLG_IF_NODIRECT)) == (FLG_IF_NEEDED | FLG_IF_NODIRECT))) - (void) sym_nodirect(sifisp, ifl, ofl); + (void) ld_sym_nodirect(sifisp, ifl, ofl); return (1); } @@ -1735,7 +1798,7 @@ process_elf(Ifl_desc *ifl, Elf *elf, Ofl_desc *ofl) * recorded as dependencies of the output file being generated. */ Ifl_desc * -process_ifl(const char *name, const char *soname, int fd, Elf *elf, +ld_process_ifl(const char *name, const char *soname, int fd, Elf *elf, Half flags, Ofl_desc * ofl, Rej_desc * rej) { Ifl_desc *ifl; @@ -1775,9 +1838,10 @@ process_ifl(const char *name, const char *soname, int fd, Elf *elf, * original archive descriptor and discard the * new elf descriptor. */ - DBG_CALL(Dbg_file_reuse(name, adp->ad_name)); + DBG_CALL(Dbg_file_reuse(ofl->ofl_lml, name, + adp->ad_name)); (void) elf_end(elf); - return ((Ifl_desc *)process_archive(name, fd, + return ((Ifl_desc *)ld_process_archive(name, fd, adp, ofl)); } } @@ -1786,15 +1850,15 @@ process_ifl(const char *name, const char *soname, int fd, Elf *elf, * As we haven't processed this file before establish a new * archive descriptor. */ - adp = ar_setup(name, elf, ofl); + adp = ld_ar_setup(name, elf, ofl); if ((adp == 0) || (adp == (Ar_desc *)S_ERROR)) return ((Ifl_desc *)adp); adp->ad_stdev = status.st_dev; adp->ad_stino = status.st_ino; - lds_file(name, ELF_K_AR, flags, elf); + ld_sup_file(ofl, name, ELF_K_AR, flags, elf); - return ((Ifl_desc *)process_archive(name, fd, adp, ofl)); + return ((Ifl_desc *)ld_process_archive(name, fd, adp, ofl)); case ELF_K_ELF: /* @@ -1820,7 +1884,7 @@ process_ifl(const char *name, const char *soname, int fd, Elf *elf, _rej.rej_str = elf_errmsg(-1); } _rej.rej_name = name; - DBG_CALL(Dbg_file_rejected(&_rej)); + DBG_CALL(Dbg_file_rejected(ofl->ofl_lml, &_rej)); if (rej->rej_type == 0) { *rej = _rej; rej->rej_name = strdup(_rej.rej_name); @@ -1858,7 +1922,8 @@ process_ifl(const char *name, const char *soname, int fd, Elf *elf, /* * Disregard (skip) this image. */ - DBG_CALL(Dbg_file_skip(name, ifl->ifl_name)); + DBG_CALL(Dbg_file_skip(ofl->ofl_lml, + ifl->ifl_name, name)); (void) elf_end(elf); /* @@ -1884,8 +1949,8 @@ process_ifl(const char *name, const char *soname, int fd, Elf *elf, else errmsg = MSG_INTL(MSG_FIL_MULINC_2); - eprintf(ERR_WARNING, errmsg, name, - ifl->ifl_name); + eprintf(ofl->ofl_lml, ERR_WARNING, + errmsg, name, ifl->ifl_name); } return (ifl); } @@ -1911,14 +1976,14 @@ process_ifl(const char *name, const char *soname, int fd, Elf *elf, switch (ehdr->e_type) { case ET_REL: - mach_eflags(ehdr, ofl); + ld_mach_eflags(ehdr, ofl); error = process_elf(ifl, elf, ofl); break; case ET_DYN: if ((ofl->ofl_flags & FLG_OF_STATIC) || !(ofl->ofl_flags & FLG_OF_DYNLIBS)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_SOINSTAT), - name); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_FIL_SOINSTAT), name); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } @@ -1961,7 +2026,7 @@ process_ifl(const char *name, const char *soname, int fd, Elf *elf, (void) elf_errno(); _rej.rej_type = SGS_REJ_UNKFILE; _rej.rej_name = name; - DBG_CALL(Dbg_file_rejected(&_rej)); + DBG_CALL(Dbg_file_rejected(ofl->ofl_lml, &_rej)); if (rej->rej_type == 0) { *rej = _rej; rej->rej_name = strdup(_rej.rej_name); @@ -1973,7 +2038,7 @@ process_ifl(const char *name, const char *soname, int fd, Elf *elf, (void) elf_errno(); _rej.rej_type = SGS_REJ_UNKFILE; _rej.rej_name = name; - DBG_CALL(Dbg_file_rejected(&_rej)); + DBG_CALL(Dbg_file_rejected(ofl->ofl_lml, &_rej)); if (rej->rej_type == 0) { *rej = _rej; rej->rej_name = strdup(_rej.rej_name); @@ -1993,18 +2058,19 @@ process_ifl(const char *name, const char *soname, int fd, Elf *elf, * archive (see libs.c: process_archive()). */ Ifl_desc * -process_open(const char *path, size_t dlen, int fd, Ofl_desc *ofl, Half flags, - Rej_desc * rej) +ld_process_open(const char *path, size_t dlen, int fd, Ofl_desc *ofl, + Half flags, Rej_desc * rej) { Elf * elf; if ((elf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_BEGIN), path); + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_BEGIN), path); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } - return (process_ifl(&path[0], &path[dlen], fd, elf, flags, ofl, rej)); + return (ld_process_ifl(&path[0], &path[dlen], fd, elf, flags, + ofl, rej)); } /* @@ -2012,7 +2078,7 @@ process_open(const char *path, size_t dlen, int fd, Ofl_desc *ofl, Half flags, * Combine the directory and filename, check the resultant path size, and try * opening the pathname. */ -Ifl_desc * +static Ifl_desc * process_req_lib(Sdf_desc *sdf, const char *dir, const char *file, Ofl_desc * ofl, Rej_desc * rej) { @@ -2032,7 +2098,8 @@ process_req_lib(Sdf_desc *sdf, const char *dir, const char *file, dlen++; plen = dlen + strlen(file) + 1; if (plen > PATH_MAX) { - eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_PTHTOLONG), _dir, file); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_FIL_PTHTOLONG), + _dir, file); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } @@ -2043,7 +2110,8 @@ process_req_lib(Sdf_desc *sdf, const char *dir, const char *file, (void) strcpy(path, _dir); (void) strcat(path, MSG_ORIG(MSG_STR_SLASH)); (void) strcat(path, file); - DBG_CALL(Dbg_libs_req(sdf->sdf_name, sdf->sdf_rfile, path)); + DBG_CALL(Dbg_libs_req(ofl->ofl_lml, sdf->sdf_name, + sdf->sdf_rfile, path)); if ((fd = open(path, O_RDONLY)) == -1) return (0); @@ -2054,7 +2122,7 @@ process_req_lib(Sdf_desc *sdf, const char *dir, const char *file, if ((_path = libld_malloc(strlen(path) + 1)) == 0) return ((Ifl_desc *)S_ERROR); (void) strcpy(_path, path); - ifl = process_open(_path, dlen, fd, ofl, NULL, rej); + ifl = ld_process_open(_path, dlen, fd, ofl, NULL, rej); (void) close(fd); return (ifl); } @@ -2073,7 +2141,7 @@ process_req_lib(Sdf_desc *sdf, const char *dir, const char *file, * o use the default directories, i.e. LIBPATH or -YP. */ uintptr_t -finish_libs(Ofl_desc *ofl) +ld_finish_libs(Ofl_desc *ofl) { Listnode *lnp1; Sdf_desc *sdf; @@ -2119,15 +2187,16 @@ finish_libs(Ofl_desc *ofl) if (*path == '/') break; if (*path) { - DBG_CALL(Dbg_libs_req(sdf->sdf_name, sdf->sdf_rfile, - file)); + DBG_CALL(Dbg_libs_req(ofl->ofl_lml, sdf->sdf_name, + sdf->sdf_rfile, file)); if ((fd = open(file, O_RDONLY)) == -1) { - eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_NOTFOUND), - file, sdf->sdf_rfile); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_FIL_NOTFOUND), file, + sdf->sdf_rfile); } else { Rej_desc _rej = { 0 }; - ifl = process_open(file, sizeof (file) + 1, + ifl = ld_process_open(file, sizeof (file) + 1, fd, ofl, NULL, &_rej); (void) close(fd); @@ -2135,11 +2204,11 @@ finish_libs(Ofl_desc *ofl) return (S_ERROR); } if (_rej.rej_type) { - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(reject[_rej.rej_type]), _rej.rej_name ? rej.rej_name : MSG_INTL(MSG_STR_UNKNOWN), - conv_reject_str(&_rej)); + conv_reject_desc(&_rej)); } else sdf->sdf_file = ifl; } @@ -2181,8 +2250,8 @@ finish_libs(Ofl_desc *ofl) if (rpath == 0) return (S_ERROR); (void) strcpy(rpath, sdf->sdf_rpath); - DBG_CALL(Dbg_libs_path(rpath, LA_SER_RUNPATH, - sdf->sdf_rfile)); + DBG_CALL(Dbg_libs_path(ofl->ofl_lml, rpath, + LA_SER_RUNPATH, sdf->sdf_rfile)); if ((path = strtok_r(rpath, MSG_ORIG(MSG_STR_COLON), &next)) != NULL) { do { @@ -2245,12 +2314,13 @@ finish_libs(Ofl_desc *ofl) * generic "not found" diagnostic. */ if (rej.rej_type) { - eprintf(ERR_WARNING, MSG_INTL(reject[rej.rej_type]), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(reject[rej.rej_type]), rej.rej_name ? rej.rej_name : - MSG_INTL(MSG_STR_UNKNOWN), conv_reject_str(&rej)); + MSG_INTL(MSG_STR_UNKNOWN), conv_reject_desc(&rej)); } else { - eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_NOTFOUND), file, - sdf->sdf_rfile); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_FIL_NOTFOUND), file, sdf->sdf_rfile); } } @@ -2258,5 +2328,5 @@ finish_libs(Ofl_desc *ofl) * Finally, now that all objects have been input, make sure any version * requirements have been met. */ - return (vers_verify(ofl)); + return (ld_vers_verify(ofl)); } diff --git a/usr/src/cmd/sgs/libld/common/globals.c b/usr/src/cmd/sgs/libld/common/globals.c index f059f59126..d21869d89f 100644 --- a/usr/src/cmd/sgs/libld/common/globals.c +++ b/usr/src/cmd/sgs/libld/common/globals.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,12 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -36,13 +35,11 @@ #include "msg.h" #include "_libld.h" -Ofl_desc Ofl; /* provided for signal handler */ -Ld_heap * ld_heap; /* list of allocated blocks for */ +Ld_heap *ld_heap; /* list of allocated blocks for */ /* link-edit dynamic allocations */ -List lib_support; /* List of support libraries specified */ +List lib_support; /* list of support libraries specified */ /* (-S option) */ - -uint_t dbg_mask = 0; /* liblddbg enabled */ +int demangle_flag; /* symbol demangling required */ /* * Paths and directories for library searches. These are used to set up @@ -54,12 +51,12 @@ char *Ulibdir; /* User specified -YU */ Listnode *insert_lib; /* insertion point for -L libraries */ /* - * liblddbg sometimes takes an ehdr in order to figure out the elf class or - * machine type. Symbols that are added by ld, such as _etext, don't have a - * corresponding ehdr, so we pass this instead. + * A default library search path is used if one was not supplied on the command + * line. Note: these strings can not use MSG_ORIG() since they are modified as + * part of the path processing. */ -Ehdr def_ehdr = { { ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3, - M_CLASS, M_DATA }, 0, M_MACH }; +char def64_Plibpath[] = "/lib/64:/usr/lib/64"; +char def32_Plibpath[] = "/usr/ccs/lib:/lib:/usr/lib"; /* * For backward compatibility provide a /dev/zero file descriptor. diff --git a/usr/src/cmd/sgs/libld/common/groups.c b/usr/src/cmd/sgs/libld/common/groups.c index 66af95bf8b..57ba90f21c 100644 --- a/usr/src/cmd/sgs/libld/common/groups.c +++ b/usr/src/cmd/sgs/libld/common/groups.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -29,7 +29,7 @@ #include <stdio.h> #include <string.h> #include <link.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" @@ -73,7 +73,7 @@ gnavl_compare(const void * n1, const void * n2) * Determine whether a (COMDAT) group has already been encountered. If so, * tag the new group having the same name as discardable. */ -uintptr_t +static uintptr_t gpavl_loaded(Ofl_desc *ofl, Group_desc * gdp) { Grp_node gpn, *gpnp; @@ -113,7 +113,7 @@ gpavl_loaded(Ofl_desc *ofl, Group_desc * gdp) } Group_desc * -get_group(Ofl_desc *ofl, Is_desc *isp) +ld_get_group(Ofl_desc *ofl, Is_desc *isp) { Ifl_desc *ifl = isp->is_file; Elf *elf = ifl->ifl_elf; @@ -144,7 +144,8 @@ get_group(Ofl_desc *ofl, Is_desc *isp) */ if ((shdr->sh_link == SHN_UNDEF) || (shdr->sh_link >= ifl->ifl_shnum)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVSHLINK), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_FIL_INVSHLINK), ifl->ifl_name, elf_strptr(elf, ifl->ifl_shstrndx, shdr->sh_name), EC_XWORD(shdr->sh_link)); @@ -153,7 +154,7 @@ get_group(Ofl_desc *ofl, Is_desc *isp) } if (shdr->sh_entsize == 0) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_FIL_INVSHENTSIZE), ifl->ifl_name, elf_strptr(elf, ifl->ifl_shstrndx, shdr->sh_name), @@ -176,7 +177,8 @@ get_group(Ofl_desc *ofl, Is_desc *isp) if ((shdr->sh_info == SHN_UNDEF) || (shdr->sh_info >= (Word)(_shdr->sh_size / _shdr->sh_entsize))) { - eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVSHINFO), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_FIL_INVSHINFO), ifl->ifl_name, elf_strptr(elf, ifl->ifl_shstrndx, shdr->sh_name), EC_XWORD(shdr->sh_info)); @@ -235,8 +237,8 @@ get_group(Ofl_desc *ofl, Is_desc *isp) } } - eprintf(ERR_FATAL, MSG_INTL(MSG_ELF_NOGROUPSECT), ifl->ifl_name, - isp->is_name); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ELF_NOGROUPSECT), + ifl->ifl_name, isp->is_name); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } diff --git a/usr/src/cmd/sgs/libld/common/ldentry.c b/usr/src/cmd/sgs/libld/common/ldentry.c index 0923c1ac79..739c9dabf9 100644 --- a/usr/src/cmd/sgs/libld/common/ldentry.c +++ b/usr/src/cmd/sgs/libld/common/ldentry.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,12 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -54,7 +53,7 @@ sym_muldef_title() } void -ldmap_out(Ofl_desc * ofl) +ld_map_out(Ofl_desc * ofl) { Listnode * lnp1, * lnp2, * lnp3; Os_desc * osp; @@ -168,8 +167,8 @@ ldmap_out(Ofl_desc * ofl) sym_muldef_title(); ducp = sdp->sd_file->ifl_name; - (void) printf(MSG_INTL(MSG_ENT_MUL_ENTRY_1), - demangle(name), ducp); + (void) printf(MSG_INTL(MSG_ENT_MUL_ENTRY_1), demangle(name), + ducp); for (LIST_TRAVERSE(dfiles, lnp2, adcp)) { /* * Ignore the referenced symbol. @@ -185,7 +184,7 @@ ldmap_out(Ofl_desc * ofl) * been met and print error message. (only in the case of reordering) */ void -ent_check(Ofl_desc * ofl) +ld_ent_check(Ofl_desc * ofl) { Listnode * lnp; Ent_desc * enp; @@ -204,11 +203,13 @@ ent_check(Ofl_desc * ofl) if ((_lnp != NULL) && (_lnp->data != NULL) && (char *)(_lnp->data) != NULL) { - eprintf(ERR_WARNING, MSG_INTL(MSG_ENT_NOSEC_1), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_ENT_NOSEC_1), enp->ec_segment->sg_name, enp->ec_name, (const char *)(_lnp->data)); } else { - eprintf(ERR_WARNING, MSG_INTL(MSG_ENT_NOSEC_2), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_ENT_NOSEC_2), enp->ec_segment->sg_name, enp->ec_name); } } diff --git a/usr/src/cmd/sgs/libld/common/ldlibs.c b/usr/src/cmd/sgs/libld/common/ldlibs.c index fbee0bebd5..38843e6194 100644 --- a/usr/src/cmd/sgs/libld/common/ldlibs.c +++ b/usr/src/cmd/sgs/libld/common/ldlibs.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -39,7 +38,7 @@ #include <string.h> #include <limits.h> #include <errno.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" @@ -56,7 +55,7 @@ static Listnode * insert_lib; * documented anymore makes it even more unlikely this processing will occur. */ static char * -compat_YL_YU(char *path, int index) +compat_YL_YU(Ofl_desc *ofl, char *path, int index) { if (index == YLDIR) { if (Llibdir) { @@ -65,7 +64,8 @@ compat_YL_YU(char *path, int index) * corresponds for compatibility to -YL (as defined in * sgs/include/paths.h) */ - DBG_CALL(Dbg_libs_ylu(Llibdir, path, index)); + DBG_CALL(Dbg_libs_ylu(ofl->ofl_lml, Llibdir, + path, index)); return (Llibdir); } } else if (index == YUDIR) { @@ -75,7 +75,8 @@ compat_YL_YU(char *path, int index) * corresponds for compatibility to -YU (as defined in * sgs/include/paths.h) */ - DBG_CALL(Dbg_libs_ylu(Ulibdir, path, index)); + DBG_CALL(Dbg_libs_ylu(ofl->ofl_lml, Ulibdir, + path, index)); return (Ulibdir); } } @@ -83,7 +84,7 @@ compat_YL_YU(char *path, int index) } static char * -process_lib_path(List *list, char *path, Boolean subsflag) +process_lib_path(Ofl_desc *ofl, List *list, char *path, Boolean subsflag) { int i; char *cp; @@ -95,12 +96,12 @@ process_lib_path(List *list, char *path, Boolean subsflag) if (cp == NULL) { if (*path == '\0') { if (seenflg) - if (list_appendc(list, subsflag ? - compat_YL_YU(dot, i) : dot) == 0) - return ((char *)S_ERROR); + if (list_appendc(list, subsflag ? + compat_YL_YU(ofl, dot, i) : dot) == 0) + return ((char *)S_ERROR); } else if (list_appendc(list, subsflag ? - compat_YL_YU(path, i) : path) == 0) + compat_YL_YU(ofl, path, i) : path) == 0) return ((char *)S_ERROR); return (cp); } @@ -109,11 +110,11 @@ process_lib_path(List *list, char *path, Boolean subsflag) *cp = '\0'; if (cp == path) { if (list_appendc(list, subsflag ? - compat_YL_YU(dot, i) : dot) == 0) + compat_YL_YU(ofl, dot, i) : dot) == 0) return ((char *)S_ERROR); } else { if (list_appendc(list, subsflag ? - compat_YL_YU(path, i) : path) == 0) + compat_YL_YU(ofl, path, i) : path) == 0) return ((char *)S_ERROR); } path = cp + 1; @@ -125,12 +126,12 @@ process_lib_path(List *list, char *path, Boolean subsflag) if (cp != path) { if (list_appendc(list, subsflag ? - compat_YL_YU(path, i) : path) == 0) + compat_YL_YU(ofl, path, i) : path) == 0) return ((char *)S_ERROR); } else { if (seenflg) if (list_appendc(list, subsflag ? - compat_YL_YU(dot, i) : dot) == 0) + compat_YL_YU(ofl, dot, i) : dot) == 0) return ((char *)S_ERROR); } return (cp); @@ -143,7 +144,7 @@ process_lib_path(List *list, char *path, Boolean subsflag) * adds the indicated path to those to be searched for libraries. */ uintptr_t -add_libdir(Ofl_desc *ofl, const char *path) +ld_add_libdir(Ofl_desc *ofl, const char *path) { if (insert_lib == NULL) { if (list_prependc(&ofl->ofl_ulibdirs, path) == 0) @@ -158,7 +159,8 @@ add_libdir(Ofl_desc *ofl, const char *path) * As -l and -L options can be interspersed, print the library * search paths each time a new path is added. */ - DBG_CALL(Dbg_libs_update(&ofl->ofl_ulibdirs, &ofl->ofl_dlibdirs)); + DBG_CALL(Dbg_libs_update(ofl->ofl_lml, &ofl->ofl_ulibdirs, + &ofl->ofl_dlibdirs)); return (1); } @@ -194,14 +196,14 @@ find_lib_name(const char *dir, const char *file, Ofl_desc *ofl, Rej_desc *rej) if (ofl->ofl_flags & FLG_OF_DYNLIBS) { (void) snprintf(path, (PATH_MAX + 2), MSG_ORIG(MSG_STR_LIB_SO), _dir, file); - DBG_CALL(Dbg_libs_l(file, path)); + DBG_CALL(Dbg_libs_l(ofl->ofl_lml, file, path)); if ((fd = open(path, O_RDONLY)) != -1) { if ((_path = libld_malloc(strlen(path) + 1)) == 0) return ((Ifl_desc *)S_ERROR); (void) strcpy(_path, path); - ifl = process_open(_path, dlen, fd, ofl, + ifl = ld_process_open(_path, dlen, fd, ofl, FLG_IF_NEEDED, rej); (void) close(fd); return (ifl); @@ -223,14 +225,14 @@ find_lib_name(const char *dir, const char *file, Ofl_desc *ofl, Rej_desc *rej) */ (void) snprintf(path, (PATH_MAX + 2), MSG_ORIG(MSG_STR_LIB_A), _dir, file); - DBG_CALL(Dbg_libs_l(file, path)); + DBG_CALL(Dbg_libs_l(ofl->ofl_lml, file, path)); if ((fd = open(path, O_RDONLY)) != -1) { if ((_path = libld_malloc(strlen(path) + 1)) == 0) return ((Ifl_desc *)S_ERROR); (void) strcpy(_path, path); - ifl = process_open(_path, dlen, fd, ofl, FLG_IF_NEEDED, rej); + ifl = ld_process_open(_path, dlen, fd, ofl, FLG_IF_NEEDED, rej); (void) close(fd); return (ifl); @@ -261,7 +263,7 @@ find_lib_name(const char *dir, const char *file, Ofl_desc *ofl, Rej_desc *rej) * otherwise process the file appropriately depending on its type. */ uintptr_t -find_library(const char *name, Ofl_desc *ofl) +ld_find_library(const char *name, Ofl_desc *ofl) { Listnode *lnp; char *path; @@ -303,11 +305,12 @@ find_library(const char *name, Ofl_desc *ofl) * diagnostic. */ if (rej.rej_type) - eprintf(ERR_FATAL, MSG_INTL(reject[rej.rej_type]), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(reject[rej.rej_type]), rej.rej_name ? rej.rej_name : MSG_INTL(MSG_STR_UNKNOWN), - conv_reject_str(&rej)); + conv_reject_desc(&rej)); else - eprintf(ERR_FATAL, MSG_INTL(MSG_LIB_NOTFOUND), name); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_LIB_NOTFOUND), + name); ofl->ofl_flags |= FLG_OF_FATAL; return (0); @@ -330,7 +333,7 @@ find_library(const char *name, Ofl_desc *ofl) * all taken as dirlist2. */ uintptr_t -lib_setup(Ofl_desc * ofl) +ld_lib_setup(Ofl_desc * ofl) { char *path, *cp = NULL; @@ -350,13 +353,13 @@ lib_setup(Ofl_desc * ofl) if ((path = libld_malloc(strlen(cp) + 1)) == 0) return (S_ERROR); (void) strcpy(path, cp); - DBG_CALL(Dbg_libs_path(path, LA_SER_DEFAULT, 0)); + DBG_CALL(Dbg_libs_path(ofl->ofl_lml, path, LA_SER_DEFAULT, 0)); /* * Process the first path string (anything up to a null or * a `;'); */ - path = process_lib_path(&ofl->ofl_ulibdirs, path, FALSE); + path = process_lib_path(ofl, &ofl->ofl_ulibdirs, path, FALSE); /* @@ -369,25 +372,28 @@ lib_setup(Ofl_desc * ofl) insert_lib = ofl->ofl_ulibdirs.tail; *path = '\0'; ++path; - cp = process_lib_path(&ofl->ofl_ulibdirs, path, FALSE); + cp = process_lib_path(ofl, &ofl->ofl_ulibdirs, path, + FALSE); if (cp == (char *)S_ERROR) return (S_ERROR); else if (cp) - eprintf(ERR_WARNING, MSG_INTL(MSG_LIB_MALFORM)); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_LIB_MALFORM)); } } /* * Add the default LIBPATH or any -YP supplied path. */ - DBG_CALL(Dbg_libs_yp(Plibpath)); - cp = process_lib_path(&ofl->ofl_dlibdirs, Plibpath, TRUE); + DBG_CALL(Dbg_libs_yp(ofl->ofl_lml, Plibpath)); + cp = process_lib_path(ofl, &ofl->ofl_dlibdirs, Plibpath, TRUE); if (cp == (char *)S_ERROR) return (S_ERROR); else if (cp) { - eprintf(ERR_FATAL, MSG_INTL(MSG_LIB_BADYP)); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_LIB_BADYP)); return (S_ERROR); } - DBG_CALL(Dbg_libs_init(&ofl->ofl_ulibdirs, &ofl->ofl_dlibdirs)); + DBG_CALL(Dbg_libs_init(ofl->ofl_lml, &ofl->ofl_ulibdirs, + &ofl->ofl_dlibdirs)); return (1); } diff --git a/usr/src/cmd/sgs/libld/common/ldmain.c b/usr/src/cmd/sgs/libld/common/ldmain.c index 995f8f9625..336e212bc2 100644 --- a/usr/src/cmd/sgs/libld/common/ldmain.c +++ b/usr/src/cmd/sgs/libld/common/ldmain.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,59 +18,68 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" /* * ld -- link/editor main program */ +#include <sys/types.h> +#include <sys/mman.h> #include <string.h> #include <stdio.h> -#include <unistd.h> #include <locale.h> #include <stdarg.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" /* - * default library search path used if one was not supplied - * on the command line. Note: These strings can not - * use MSG_ORIG() since they are modified as part of the - * path processing. + * A default library search path is used if one was not supplied on the command + * line. Note: these strings can not use MSG_ORIG() since they are modified as + * part of the path processing. */ -#ifdef _ELF64 +#if defined(_ELF64) static char def_Plibpath[] = "/lib/64:/usr/lib/64"; #else static char def_Plibpath[] = "/usr/ccs/lib:/lib:/usr/lib"; #endif /* + * A default elf header provides for simplifying diagnostic processing. + */ +static Ehdr def_ehdr = { { ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3, + M_CLASS, M_DATA }, 0, M_MACH, EV_CURRENT }; + +/* * The main program */ int -ld_main(int argc, char ** argv) +ld_main(int argc, char **argv) { char *sgs_support; /* SGS_SUPPORT environment string */ - Ofl_desc *ofl = &Ofl; /* Output file descriptor */ Half etype; uint_t stflags; int suplib = 0; + Ofl_desc *ofl; /* - * Initialize signal handlers, and output file variables. + * Initialize signal handlers, and output file variables. Establish a + * default output ELF header to satisfy diagnostic requirements. */ - init(); - ofl->ofl_libver = EV_CURRENT; - ofl->ofl_e_machine = M_MACH; - ofl->ofl_e_flags = 0; + if ((ofl = libld_calloc(1, sizeof (Ofl_desc))) == 0) + return (1); + + ofl->ofl_dehdr = &def_ehdr; + + ld_init(ofl); /* * Build up linker version string @@ -88,10 +96,10 @@ ld_main(int argc, char ** argv) * would have been completed and the entrance criteria and segment * descriptor lists will be complete. */ - if (process_flags(ofl, argc, argv) == S_ERROR) + if (ld_process_flags(ofl, argc, argv) == S_ERROR) return (1); if (ofl->ofl_flags & FLG_OF_FATAL) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_FLAGS)); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_FLAGS)); return (1); } @@ -135,7 +143,8 @@ ld_main(int argc, char ** argv) char *lib; char *lasts; - DBG_CALL(Dbg_support_req(sgs_support, DBG_SUP_ENVIRON)); + DBG_CALL(Dbg_support_req(ofl->ofl_lml, sgs_support, + DBG_SUP_ENVIRON)); if ((lib = strtok_r(sgs_support, sep, &lasts)) != NULL) { do { if (strcmp(lib, @@ -143,8 +152,8 @@ ld_main(int argc, char ** argv) if (suplib++) continue; } - if (ld_support_loadso(lib) == S_ERROR) - return (ldexit()); + if (ld_sup_loadso(ofl, lib) == S_ERROR) + return (ld_exit(ofl)); } while ((lib = strtok_r(NULL, sep, &lasts)) != NULL); } @@ -154,23 +163,25 @@ ld_main(int argc, char ** argv) char *lib; for (LIST_TRAVERSE(&lib_support, lnp, lib)) { - DBG_CALL(Dbg_support_req(lib, DBG_SUP_CMDLINE)); - if (ld_support_loadso(lib) == S_ERROR) - return (ldexit()); + DBG_CALL(Dbg_support_req(ofl->ofl_lml, lib, + DBG_SUP_CMDLINE)); + if (ld_sup_loadso(ofl, lib) == S_ERROR) + return (ld_exit(ofl)); } } else { if (suplib == 0) { - DBG_CALL(Dbg_support_req(MSG_ORIG(MSG_FIL_LIBSTAB), - DBG_SUP_DEFAULT)); - if (ld_support_loadso(MSG_ORIG(MSG_FIL_LIBSTAB)) == + 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 (ldexit()); + return (ld_exit(ofl)); } } - DBG_CALL(Dbg_ent_print(ofl->ofl_e_machine, &ofl->ofl_ents, - (ofl->ofl_flags & FLG_OF_DYNAMIC))); - DBG_CALL(Dbg_seg_list(ofl->ofl_e_machine, &ofl->ofl_segs)); + DBG_CALL(Dbg_ent_print(ofl->ofl_lml, ofl->ofl_dehdr->e_machine, + &ofl->ofl_ents, (ofl->ofl_flags & FLG_OF_DYNAMIC))); + DBG_CALL(Dbg_seg_list(ofl->ofl_lml, ofl->ofl_dehdr->e_machine, + &ofl->ofl_segs)); /* * The objscnt and soscnt variables were used to estimate the expected @@ -183,8 +194,8 @@ ld_main(int argc, char ** argv) /* * Determine whether we can create the file before going any further. */ - if (open_outfile(ofl) == S_ERROR) - return (ldexit()); + if (ld_open_outfile(ofl) == S_ERROR) + return (ld_exit(ofl)); /* * If the user didn't supply a library path supply a default. And, if @@ -207,8 +218,8 @@ ld_main(int argc, char ** argv) /* * Argument pass two. Input all libraries and objects. */ - if (lib_setup(ofl) == S_ERROR) - return (ldexit()); + if (ld_lib_setup(ofl) == S_ERROR) + return (ld_exit(ofl)); /* * Call ld_start() with the etype of our output file and the @@ -221,27 +232,28 @@ ld_main(int argc, char ** argv) else etype = ET_EXEC; - lds_start(ofl->ofl_name, etype, argv[0]); + ld_sup_start(ofl, etype, argv[0]); /* * Process all input files. */ - if (process_files(ofl, argc, argv) == S_ERROR) - return (ldexit()); + if (ld_process_files(ofl, argc, argv) == S_ERROR) + return (ld_exit(ofl)); if (ofl->ofl_flags & FLG_OF_FATAL) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_FILES), ofl->ofl_name); - return (ldexit()); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_FILES), + ofl->ofl_name); + return (ld_exit(ofl)); } - lds_input_done(); + ld_sup_input_done(ofl); /* * If there were any partially initialized symbol, * do preparation works. */ if (ofl->ofl_ismove.head != 0) { - if (sunwmove_preprocess(ofl) == S_ERROR) - return (ldexit()); + if (ld_sunwmove_preprocess(ofl) == S_ERROR) + return (ld_exit(ofl)); } /* @@ -253,8 +265,8 @@ ld_main(int argc, char ** argv) * it does take a little longer for the user to be told of any undefined * symbol errors). */ - if (reloc_init(ofl) == S_ERROR) - return (ldexit()); + if (ld_reloc_init(ofl) == S_ERROR) + return (ld_exit(ofl)); /* * Now that all symbol processing is complete see if any undefined @@ -264,23 +276,25 @@ ld_main(int argc, char ** argv) * condition is fatal. If creating a shared object with the -Bsymbolic * flag set, this condition is simply a warning. */ - if (sym_validate(ofl) == S_ERROR) - return (ldexit()); + if (ld_sym_validate(ofl) == S_ERROR) + return (ld_exit(ofl)); if (ofl->ofl_flags1 & FLG_OF1_OVRFLW) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_FILES), ofl->ofl_name); - return (ldexit()); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_FILES), + ofl->ofl_name); + return (ld_exit(ofl)); } else if (ofl->ofl_flags & FLG_OF_FATAL) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_SYM_FATAL), ofl->ofl_name); - return (ldexit()); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_ARG_SYM_FATAL), + ofl->ofl_name); + return (ld_exit(ofl)); } else if (ofl->ofl_flags & FLG_OF_WARN) - eprintf(ERR_WARNING, MSG_INTL(MSG_ARG_SYM_WARN)); + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_ARG_SYM_WARN)); /* * Generate any necessary sections. */ - if (make_sections(ofl) == S_ERROR) - return (ldexit()); + if (ld_make_sections(ofl) == S_ERROR) + return (ld_exit(ofl)); /* * Now that all sections have been added to the output file, check to @@ -288,34 +302,33 @@ ld_main(int argc, char ** argv) * if any ordering directives were not matched. * Also, if SHF_ORDERED sections exist, set up sort key values. */ - sec_validate(ofl); + ld_sec_validate(ofl); /* * Having collected all the input data create the initial output file * image, assign virtual addresses to the image, and generate a load * map if the user requested one. */ - if (create_outfile(ofl) == S_ERROR) - return (ldexit()); + if (ld_create_outfile(ofl) == S_ERROR) + return (ld_exit(ofl)); - if (update_outfile(ofl) == S_ERROR) - return (ldexit()); + if (ld_update_outfile(ofl) == S_ERROR) + return (ld_exit(ofl)); if (ofl->ofl_flags & FLG_OF_GENMAP) - ldmap_out(ofl); + ld_map_out(ofl); /* * Build relocation sections and perform any relocation updates. */ - if (reloc_process(ofl) == S_ERROR) - return (ldexit()); + if (ld_reloc_process(ofl) == S_ERROR) + return (ld_exit(ofl)); - -#if defined(__x86) && defined(_ELF64) +#if defined(__x86) && defined(_ELF64) /* * Fill in contents for Unwind Header */ if (populate_amd64_unwindhdr(ofl) == S_ERROR) - return (ldexit()); + return (ld_exit(ofl)); #endif /* * Finally create the files elf checksum. @@ -327,11 +340,12 @@ ld_main(int argc, char ** argv) * We're done, so make sure the updates are flushed to the output file. */ if ((ofl->ofl_size = elf_update(ofl->ofl_welf, ELF_C_WRITE)) == 0) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_UPDATE), ofl->ofl_name); - return (ldexit()); + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_UPDATE), + ofl->ofl_name); + return (ld_exit(ofl)); } - lds_atexit(0); + ld_sup_atexit(ofl, 0); DBG_CALL(Dbg_statistics_ld(ofl)); @@ -349,71 +363,65 @@ ld_main(int argc, char ** argv) return (0); } -/* VARARGS1 */ +/* + * Cleanup an Ifl_desc. + */ +static void +ifl_list_cleanup(List *ifl_list) +{ + Listnode *lnp; + Ifl_desc *ifl; + + for (LIST_TRAVERSE(ifl_list, lnp, ifl)) + if (ifl->ifl_elf) + (void) elf_end(ifl->ifl_elf); + ifl_list->head = 0; + ifl_list->tail = 0; +} + +/* + * Cleanup all memory that has been dynamically allocated during libld + * processing and elf_end() all Elf descriptors that are still open. + */ void -dbg_print(const char *format, ...) +ld_ofl_cleanup(Ofl_desc *ofl) { - static char *prestr = 0; - va_list args; - - if (dbg_mask & DBG_G_SNAME) { - /* - * If the debugging options have requested each diagnostic line - * be prepended by a name create a prefix string. - */ - if ((prestr == 0) && Ofl.ofl_name) { - const char *name, *cls; - size_t len; - - /* - * Select the fullname or basename of the output file - * being created. - */ - if (dbg_mask & DBG_G_FNAME) - name = Ofl.ofl_name; - else { - if ((name = strrchr(Ofl.ofl_name, '/')) == 0) - name = Ofl.ofl_name; - else - name++; + Ld_heap *chp, *php; + Ar_desc *adp; + Listnode *lnp; + + ifl_list_cleanup(&ofl->ofl_objs); + ifl_list_cleanup(&ofl->ofl_sos); + + for (LIST_TRAVERSE(&ofl->ofl_ars, lnp, adp)) { + Ar_aux *aup; + Elf_Arsym *arsym; + + for (arsym = adp->ad_start, aup = adp->ad_aux; + arsym->as_name; ++arsym, ++aup) { + if ((aup->au_mem) && (aup->au_mem != FLG_ARMEM_PROC)) { + (void) elf_end(aup->au_mem->am_elf); + + /* + * Null out all entries to this member so + * that we don't attempt to elf_end() it again. + */ + ld_ar_member(adp, arsym, aup, 0); } - len = strlen(name) + - strlen(MSG_INTL(MSG_DBG_NAME_FMT)) + 1; + } + (void) elf_end(adp->ad_elf); + } - /* - * Add the output file class if required. - */ - if (dbg_mask & DBG_G_CLASS) { -#if defined(_ELF64) - len += MSG_DBG_CLS64_FMT_SIZE; - cls = MSG_ORIG(MSG_DBG_CLS64_FMT); -#else - len += MSG_DBG_CLS32_FMT_SIZE; - cls = MSG_ORIG(MSG_DBG_CLS32_FMT); -#endif - } + (void) elf_end(ofl->ofl_elf); + (void) elf_end(ofl->ofl_welf); - /* - * Allocate a string to build the prefix. - */ - if ((prestr = libld_malloc(len)) == 0) - prestr = (char *)MSG_INTL(MSG_DBG_DFLT_FMT); - else { - (void) snprintf(prestr, len, - MSG_INTL(MSG_DBG_NAME_FMT), name); - if (dbg_mask & DBG_G_CLASS) - (void) strcat(prestr, cls); - } - } - if (prestr) - (void) fputs(prestr, stderr); - else - (void) fputs(MSG_INTL(MSG_DBG_AOUT_FMT), stderr); - } else - (void) fputs(MSG_INTL(MSG_DBG_DFLT_FMT), stderr); - - va_start(args, format); - (void) vfprintf(stderr, format, args); - (void) fprintf(stderr, MSG_ORIG(MSG_STR_NL)); - va_end(args); + for (chp = ld_heap, php = 0; chp; php = chp, chp = chp->lh_next) { + if (php) + (void) munmap((void *)php, + (size_t)php->lh_end - (size_t)php); + } + if (php) + (void) munmap((void *)php, (size_t)php->lh_end - (size_t)php); + + ld_heap = 0; } diff --git a/usr/src/cmd/sgs/libld/common/libld.chk.msg b/usr/src/cmd/sgs/libld/common/libld.chk.msg new file mode 100644 index 0000000000..554c14b729 --- /dev/null +++ b/usr/src/cmd/sgs/libld/common/libld.chk.msg @@ -0,0 +1,42 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +@ _START_ + +# Messages to satisfy chkmsg target. Numerous messages within common code +# (reloc.h) aren't required for each target, but chkmsg has no way of dealing +# with ifdefs, thus this file exists to satisfy common code messages. + +@ MSG_REL_UNIMPL "relocation error: file %s: symbol %s: \ + unimplemented relocation type: %d" +@ MSG_REL_UNNOBITS "relocation error: %s: file %s: symbol %s: \ + unsupported number of bits: %d" +@ MSG_REL_LOSEBITS "relocation error: %s: file %s: symbol %s: \ + value 0x%llx loses %d bits at offset 0x%llx" + +@ _END_ diff --git a/usr/src/cmd/sgs/libld/common/libld.msg b/usr/src/cmd/sgs/libld/common/libld.msg index fe25c54367..82e7a176e3 100644 --- a/usr/src/cmd/sgs/libld/common/libld.msg +++ b/usr/src/cmd/sgs/libld/common/libld.msg @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ # # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" diff --git a/usr/src/cmd/sgs/libld/common/libld.sparc.msg b/usr/src/cmd/sgs/libld/common/libld.sparc.msg index 8f99b76d8c..b2cf46fcb7 100644 --- a/usr/src/cmd/sgs/libld/common/libld.sparc.msg +++ b/usr/src/cmd/sgs/libld/common/libld.sparc.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,6 +18,11 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# # ident "%Z%%M% %I% %E% SMI" @ _START_ @@ -33,7 +34,7 @@ @ MSG_REL_UNNOBITS "relocation error: %s: file %s: symbol %s: \ unsupported number of bits: %d" @ MSG_REL_LOSEBITS "relocation error: %s: file %s: symbol %s: \ - value 0x%llx loses %d bits at offset 0x%llx\n" + value 0x%llx loses %d bits at offset 0x%llx" @ MSG_REL_UNRELREL "relocation error: %s: file %s: symbol %s: \ non-relative PLT relocation can not be used in \ building a shared object" diff --git a/usr/src/cmd/sgs/libld/common/libs.c b/usr/src/cmd/sgs/libld/common/libs.c index 192339c40e..6973e10db9 100644 --- a/usr/src/cmd/sgs/libld/common/libs.c +++ b/usr/src/cmd/sgs/libld/common/libs.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,12 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -34,7 +33,7 @@ */ #include <stdio.h> #include <string.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" @@ -45,7 +44,7 @@ * contains another tentative definition, or a defined function symbol, then it * will not be used. */ -int +static int process_member(Ar_mem *amp, const char *name, unsigned char obind, Ofl_desc *ofl) { @@ -67,8 +66,8 @@ process_member(Ar_mem *amp, const char *name, unsigned char obind, while (scn = elf_nextscn(amp->am_elf, scn)) { if ((shdr = elf_getshdr(scn)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR), - amp->am_path); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETSHDR), amp->am_path); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } @@ -77,8 +76,8 @@ process_member(Ar_mem *amp, const char *name, unsigned char obind, break; } if ((data = elf_getdata(scn, NULL)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETDATA), - amp->am_path); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETDATA), amp->am_path); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } @@ -92,14 +91,14 @@ process_member(Ar_mem *amp, const char *name, unsigned char obind, */ if ((scn = elf_getscn(amp->am_elf, (size_t)shdr->sh_link)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSCN), - amp->am_path); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETSCN), amp->am_path); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } if ((data = elf_getdata(scn, NULL)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETDATA), - amp->am_path); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETDATA), amp->am_path); ofl->ofl_flags |= FLG_OF_FATAL; return (0); } @@ -151,7 +150,7 @@ process_member(Ar_mem *amp, const char *name, unsigned char obind, * pick off where the last processing finished. */ Ar_desc * -ar_setup(const char *name, Elf *elf, Ofl_desc *ofl) +ld_ar_setup(const char *name, Elf *elf, Ofl_desc *ofl) { Ar_desc * adp; size_t number; @@ -163,10 +162,12 @@ ar_setup(const char *name, Elf *elf, Ofl_desc *ofl) */ if ((start = elf_getarsym(elf, &number)) == 0) { if (elf_errno()) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETARSYM), name); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETARSYM), name); ofl->ofl_flags |= FLG_OF_FATAL; } else - eprintf(ERR_WARNING, MSG_INTL(MSG_ELF_ARSYM), name); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_ELF_ARSYM), name); return (0); } @@ -200,11 +201,11 @@ ar_setup(const char *name, Elf *elf, Ofl_desc *ofl) } /* - * For each archive descriptor we maintain an `Ar_aux' table to parallel the - * archive symbol table (returned from elf_getarsym(3e)). We use this table to - * hold the `Sym_desc' for each symbol (thus reducing the number of sym_find()'s - * we have to do), and to hold the `Ar_mem' pointer. The `Ar_mem' element can - * have one of three values indicating the state of the archive member + * For each archive descriptor, maintain an `Ar_aux' table to parallel the + * archive symbol table (returned from elf_getarsym(3e)). Use this table to + * hold a `Sym_desc' for each symbol (thus reducing the number of + * ld_sym_find()'s), and to hold the `Ar_mem' pointer. The `Ar_mem' element + * can have one of three values indicating the state of the archive member * associated with the offset for this symbol table entry: * * 0 indicates that the member has not been processed. @@ -226,7 +227,7 @@ ar_setup(const char *name, Elf *elf, Ofl_desc *ofl) * has its `Ar_mem' pointer set to the member structures address. */ void -ar_member(Ar_desc * adp, Elf_Arsym * arsym, Ar_aux * aup, Ar_mem * amp) +ld_ar_member(Ar_desc * adp, Elf_Arsym * arsym, Ar_aux * aup, Ar_mem * amp) { Elf_Arsym * _arsym = arsym; Ar_aux * _aup = aup; @@ -262,7 +263,7 @@ ar_member(Ar_desc * adp, Elf_Arsym * arsym, Ar_aux * aup, Ar_mem * amp) * through a complete pass without satisfying any unresolved symbols */ uintptr_t -process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl) +ld_process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl) { Elf_Arsym * arsym; Elf_Arhdr * arhdr; @@ -270,7 +271,8 @@ process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl) Ar_aux * aup; Sym_desc * sdp; char *arname, *arpath; - int ndx, found = 0, again = 0; + Xword ndx; + int found, again; int allexrt = ofl->ofl_flags1 & FLG_OF1_ALLEXRT; uintptr_t err; Rej_desc rej = { 0 }; @@ -301,9 +303,10 @@ process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl) * symbol table. If so, and if that symbol is still unresolved or * tentative, process the corresponding archive member. */ + found = again = 0; do { - DBG_CALL(Dbg_file_archive(name, again)); - DBG_CALL(Dbg_syms_ar_title(name, again)); + DBG_CALL(Dbg_file_ar(ofl->ofl_lml, name, again)); + DBG_CALL(Dbg_syms_ar_title(ofl->ofl_lml, name, again)); ndx = again = 0; for (arsym = adp->ad_start, aup = adp->ad_aux; arsym->as_name; @@ -328,10 +331,11 @@ process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl) * (But you skip this if allextract is specified.) */ if ((allexrt == 0) && ((sdp = aup->au_syms) == 0)) { - if ((sdp = sym_find(arsym->as_name, + if ((sdp = ld_sym_find(arsym->as_name, /* LINTED */ (Word)arsym->as_hash, 0, ofl)) == 0) { - DBG_CALL(Dbg_syms_ar_entry(ndx, arsym)); + DBG_CALL(Dbg_syms_ar_entry(ofl->ofl_lml, + ndx, arsym)); continue; } aup->au_syms = sdp; @@ -369,7 +373,8 @@ process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl) (sym->st_shndx != SHN_COMMON) && vers) || ((ELF_ST_BIND(sym->st_info) == STB_WEAK) && (!(ofl->ofl_flags1 & FLG_OF1_WEAKEXT)))) { - DBG_CALL(Dbg_syms_ar_entry(ndx, arsym)); + DBG_CALL(Dbg_syms_ar_entry(ofl->ofl_lml, + ndx, arsym)); continue; } } @@ -390,7 +395,7 @@ process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl) */ if (elf_rand(adp->ad_elf, arsym->as_off) != arsym->as_off) { - eprintf(ERR_ELF, + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_ARMEM), name, EC_WORD(arsym->as_off), ndx, demangle(arsym->as_name)); @@ -399,7 +404,7 @@ process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl) } if ((arelf = elf_begin(fd, ELF_C_READ, adp->ad_elf)) == NULL) { - eprintf(ERR_ELF, + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_BEGIN), name); ofl->ofl_flags |= FLG_OF_FATAL; return (0); @@ -409,7 +414,7 @@ process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl) * Construct the member filename. */ if ((arhdr = elf_getarhdr(arelf)) == NULL) { - eprintf(ERR_ELF, + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_GETARHDR), name); ofl->ofl_flags |= FLG_OF_FATAL; return (0); @@ -450,8 +455,8 @@ process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl) amp->am_name = arname; amp->am_path = arpath; } - DBG_CALL(Dbg_syms_ar_checking(ndx, arsym, - arname)); + DBG_CALL(Dbg_syms_ar_checking(ofl->ofl_lml, + ndx, arsym, arname)); if ((err = process_member(amp, arsym->as_name, bind, ofl)) == S_ERROR) return (S_ERROR); @@ -466,7 +471,8 @@ process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl) */ if (err == 0) { if (aup->au_mem == 0) - ar_member(adp, arsym, aup, amp); + ld_ar_member(adp, arsym, + aup, amp); continue; } } @@ -475,9 +481,9 @@ process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl) * Process the archive member. Retain any error for * return to the caller. */ - DBG_CALL(Dbg_syms_ar_resolve(ndx, arsym, arname, - allexrt)); - if ((err = (uintptr_t)process_ifl(arpath, NULL, fd, + DBG_CALL(Dbg_syms_ar_resolve(ofl->ofl_lml, ndx, arsym, + arname, allexrt)); + if ((err = (uintptr_t)ld_process_ifl(arpath, NULL, fd, arelf, FLG_IF_EXTRACT | FLG_IF_NEEDED, ofl, &_rej)) == S_ERROR) return (S_ERROR); @@ -494,7 +500,7 @@ process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl) rej.rej_info = _rej.rej_info; rej.rej_name = (const char *)arpath; } - ar_member(adp, arsym, aup, FLG_ARMEM_PROC); + ld_ar_member(adp, arsym, aup, FLG_ARMEM_PROC); continue; } @@ -514,8 +520,8 @@ process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl) if (allexrt == 0) again = 1; - ar_member(adp, arsym, aup, FLG_ARMEM_PROC); - DBG_CALL(Dbg_syms_nl()); + ld_ar_member(adp, arsym, aup, FLG_ARMEM_PROC); + DBG_CALL(Dbg_util_nl(ofl->ofl_lml, DBG_NL_STD)); } } while (again); @@ -526,9 +532,10 @@ process_archive(const char *name, int fd, Ar_desc *adp, Ofl_desc *ofl) */ if (found == 0) { if (rej.rej_type) - eprintf(ERR_WARNING, MSG_INTL(reject[rej.rej_type]), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(reject[rej.rej_type]), rej.rej_name ? rej.rej_name : - MSG_INTL(MSG_STR_UNKNOWN), conv_reject_str(&rej)); + MSG_INTL(MSG_STR_UNKNOWN), conv_reject_desc(&rej)); } /* diff --git a/usr/src/cmd/sgs/librtld_db/common/lintsup.c b/usr/src/cmd/sgs/libld/common/lintsup.c index cdd2df348c..0b78730219 100644 --- a/usr/src/cmd/sgs/librtld_db/common/lintsup.c +++ b/usr/src/cmd/sgs/libld/common/lintsup.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,24 +18,17 @@ * * CDDL HEADER END */ -/* LINTLIBRARY */ -/* PROTOLIB1 */ /* - * Copyright (c) 1998 by Sun Microsystems, Inc. - * All rights reserved. - */ + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ -#pragma ident "%Z%%M% %I% %E% SMI" +/* LINTLIBRARY */ +/* PROTOLIB1 */ -/* - * Supplimental definitions for lint that help us avoid - * options like `-x' that filter out things we want to - * know about as well as things we don't. - */ -#include <thread.h> -#include <rtld_db.h> -#include "libld.h" -#include "rtld.h" -#include "msg.h" +#pragma ident "%Z%%M% %I% %E% SMI" +#include <debug.h> +#include <elfcap.h> +#include <_libld.h> diff --git a/usr/src/cmd/sgs/libld/common/llib-lld b/usr/src/cmd/sgs/libld/common/llib-lld index 5da44863f7..4c51b981c5 100644 --- a/usr/src/cmd/sgs/libld/common/llib-lld +++ b/usr/src/cmd/sgs/libld/common/llib-lld @@ -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,7 +22,7 @@ /* PROTOLIB1 */ /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -34,35 +33,22 @@ /* * Generic interface definition for usr/src/lib/libld. */ +uintptr_t ld32_create_outfile(Ofl_desc *); +uintptr_t ld64_create_outfile(Ofl_desc *); -char * add_string(char *, char *); -uintptr_t create_outfile(Ofl_desc *); -uintptr_t ent_setup(Ofl_desc *, Xword); -uintptr_t finish_libs(Ofl_desc *); -int ld_main(int, char **); -uintptr_t ld_support_loadso(const char *); -Listnode * list_appendc(List *, const void *); -Listnode * list_insertc(List *, const void *, Listnode *); -Listnode * list_prependc(List *, const void *); -Listnode * list_where(List *, Word); -uintptr_t make_sections(Ofl_desc *); -void ofl_cleanup(Ofl_desc *); -uintptr_t open_outfile(Ofl_desc *); -Ifl_desc * process_open(const char *, size_t, int, Ofl_desc *, - Half, Rej_desc *); -uintptr_t reloc_init(Ofl_desc *); -uintptr_t reloc_process(Ofl_desc *); -Sdf_desc * sdf_find(const char *, List *); -Sdf_desc * sdf_add(const char *, List *); -void sec_validate(Ofl_desc *); -uintptr_t sunwmove_preprocess(Ofl_desc *); -Sym_desc * sym_add_u(const char *, Ofl_desc *); -Sym_desc * sym_enter(const char *, Sym *, Word, Ifl_desc *, - Ofl_desc *, Word, Word, Word, Half, avl_index_t *); -Sym_desc * sym_find(const char *, Word, avl_index_t *, Ofl_desc *); -uintptr_t sym_validate(Ofl_desc *); -uintptr_t update_outfile(Ofl_desc *); -Ver_desc * vers_base(Ofl_desc *); -uintptr_t vers_check_defs(Ofl_desc *); -Ver_desc * vers_desc(const char *, Word, List *); -Ver_desc * vers_find(const char *, Word, List *); +uintptr_t ld32_ent_setup(Ofl_desc *, Xword); +uintptr_t ld64_ent_setup(Ofl_desc *, Xword); + +int ld32_main(int, char **); +int ld64_main(int, char **); +uintptr_t ld32_make_sections(Ofl_desc *); +uintptr_t ld64_make_sections(Ofl_desc *); + +uintptr_t ld32_reloc_init(Ofl_desc *); +uintptr_t ld64_reloc_process(Ofl_desc *); + +uintptr_t ld32_sym_validate(Ofl_desc *); +uintptr_t ld64_sym_validate(Ofl_desc *); + +uintptr_t ld32_update_outfile(Ofl_desc *); +uintptr_t ld64_update_outfile(Ofl_desc *); diff --git a/usr/src/cmd/sgs/libld/amd64/machrel.c b/usr/src/cmd/sgs/libld/common/machrel.amd.c index eafb8bb533..30acc9bf06 100644 --- a/usr/src/cmd/sgs/libld/amd64/machrel.c +++ b/usr/src/cmd/sgs/libld/common/machrel.amd.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. @@ -32,11 +31,11 @@ #include <sys/elf_amd64.h> #include <debug.h> #include <reloc.h> -#include <msg.h> -#include <_libld.h> +#include "msg.h" +#include "_libld.h" Word -init_rel(Rel_desc *reld, void *reloc) +ld_init_rel(Rel_desc *reld, void *reloc) { Rela * rel = (Rela *)reloc; @@ -52,13 +51,13 @@ init_rel(Rel_desc *reld, void *reloc) } void -mach_eflags(Ehdr *ehdr, Ofl_desc *ofl) +ld_mach_eflags(Ehdr *ehdr, Ofl_desc *ofl) { - ofl->ofl_e_flags |= ehdr->e_flags; + ofl->ofl_dehdr->e_flags |= ehdr->e_flags; } void -mach_make_dynamic(Ofl_desc *ofl, size_t *cnt) +ld_mach_make_dynamic(Ofl_desc *ofl, size_t *cnt) { if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) { /* @@ -70,19 +69,20 @@ mach_make_dynamic(Ofl_desc *ofl, size_t *cnt) } void -mach_update_odynamic(Ofl_desc * ofl, Dyn ** dyn) +ld_mach_update_odynamic(Ofl_desc *ofl, Dyn **dyn) { - if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) { - if (ofl->ofl_pltcnt) { - (*dyn)->d_tag = DT_PLTGOT; - (*dyn)->d_un.d_ptr = fillin_gotplt2(ofl); - (*dyn)++; - } + if (((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) && ofl->ofl_pltcnt) { + (*dyn)->d_tag = DT_PLTGOT; + if (ofl->ofl_osgot) + (*dyn)->d_un.d_ptr = ofl->ofl_osgot->os_shdr->sh_addr; + else + (*dyn)->d_un.d_ptr = 0; + (*dyn)++; } } Xword -calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl) +ld_calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl) { Xword value; @@ -146,9 +146,10 @@ plt_entry(Ofl_desc * ofl, Sym_desc * sdp) !(dtflags1 & DF_1_NORELOC)) { if (do_reloc(R_AMD64_GOTPCREL, &pltent[0x02], &val1, MSG_ORIG(MSG_SYM_PLTENT), - MSG_ORIG(MSG_SPECFIL_PLTENT)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_PLT_PLTNFAIL), - sdp->sd_aux->sa_PLTndx, demangle(sdp->sd_name)); + MSG_ORIG(MSG_SPECFIL_PLTENT), ofl->ofl_lml) == 0) { + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_PLT_PLTNFAIL), sdp->sd_aux->sa_PLTndx, + demangle(sdp->sd_name)); return (S_ERROR); } } @@ -166,9 +167,10 @@ plt_entry(Ofl_desc * ofl, Sym_desc * sdp) !(dtflags1 & DF_1_NORELOC)) { if (do_reloc(R_AMD64_32, &pltent[0x07], &val1, MSG_ORIG(MSG_SYM_PLTENT), - MSG_ORIG(MSG_SPECFIL_PLTENT)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_PLT_PLTNFAIL), - sdp->sd_aux->sa_PLTndx, demangle(sdp->sd_name)); + MSG_ORIG(MSG_SPECFIL_PLTENT), ofl->ofl_lml) == 0) { + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_PLT_PLTNFAIL), sdp->sd_aux->sa_PLTndx, + demangle(sdp->sd_name)); return (S_ERROR); } } @@ -191,9 +193,10 @@ plt_entry(Ofl_desc * ofl, Sym_desc * sdp) !(dtflags1 & DF_1_NORELOC)) { if (do_reloc(R_AMD64_PC32, &pltent[0x0c], &val1, MSG_ORIG(MSG_SYM_PLTENT), - MSG_ORIG(MSG_SPECFIL_PLTENT)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_PLT_PLTNFAIL), - sdp->sd_aux->sa_PLTndx, demangle(sdp->sd_name)); + MSG_ORIG(MSG_SPECFIL_PLTENT), ofl->ofl_lml) == 0) { + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_PLT_PLTNFAIL), sdp->sd_aux->sa_PLTndx, + demangle(sdp->sd_name)); return (S_ERROR); } } @@ -201,7 +204,7 @@ plt_entry(Ofl_desc * ofl, Sym_desc * sdp) } uintptr_t -perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) +ld_perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) { Os_desc * relosp, * osp = 0; Word ndx; @@ -222,7 +225,7 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) if (orsp->rel_isdesc && ((orsp->rel_flags & (FLG_REL_GOT | FLG_REL_BSS | FLG_REL_PLT | FLG_REL_NOINFO)) == 0) && (orsp->rel_isdesc->is_flags & FLG_IS_DISCARD)) { - DBG_CALL(Dbg_reloc_discard(M_MACH, orsp)); + DBG_CALL(Dbg_reloc_discard(ofl->ofl_lml, M_MACH, orsp)); return (1); } @@ -231,7 +234,7 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) * table, adjust the relocation entries. */ if (orsp->rel_move) - adj_movereloc(ofl, orsp); + ld_adj_movereloc(ofl, orsp); /* * If this is a relocation against a section then we need to adjust the @@ -242,8 +245,8 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) if (ofl->ofl_parsym.head && (sdp->sd_isc->is_flags & FLG_IS_RELUPD) && /* LINTED */ - (psym = am_I_partial(orsp, orsp->rel_raddend))) { - DBG_CALL(Dbg_move_outsctadj(psym)); + (psym = ld_am_I_partial(orsp, orsp->rel_raddend))) { + DBG_CALL(Dbg_move_outsctadj(ofl->ofl_lml, psym)); sectmoved = 1; if (ofl->ofl_flags & FLG_OF_RELOBJ) raddend = psym->sd_sym->st_value; @@ -275,7 +278,8 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) */ raddend = 0; osp = ofl->ofl_osgot; - roffset = calc_got_offset(orsp, ofl); + roffset = ld_calc_got_offset(orsp, ofl); + } else if (orsp->rel_flags & FLG_REL_PLT) { /* * Note that relocations for PLT's actually @@ -364,8 +368,8 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) rea.r_info = ELF_R_INFO(ndx, orsp->rel_rtype); rea.r_offset = roffset; rea.r_addend = raddend; - DBG_CALL(Dbg_reloc_out(M_MACH, SHT_RELA, &rea, orsp->rel_sname, - relosp->os_name)); + DBG_CALL(Dbg_reloc_out(ofl, ELF_DBG_LD, SHT_RELA, &rea, relosp->os_name, + orsp->rel_sname)); /* * Assert we haven't walked off the end of our relocation table. @@ -385,7 +389,7 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) if (orsp->rel_rtype == R_AMD64_JUMP_SLOT) osp = ofl->ofl_osgot; - reloc_remain_entry(orsp, osp, ofl); + ld_reloc_remain_entry(orsp, osp, ofl); return (1); } @@ -439,8 +443,8 @@ static uchar_t tlsinstr_ld_le[] = { }; -Fixupret -tls_fixups(Rel_desc *arsp) +static Fixupret +tls_fixups(Ofl_desc *ofl, Rel_desc *arsp) { Sym_desc *sdp = arsp->rel_sym; Word rtype = arsp->rel_rtype; @@ -471,31 +475,29 @@ tls_fixups(Rel_desc *arsp) * 0x09 addq x@gottpoff(%rip), %rax * 0x10 */ - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_AMD64_GOTTPOFF, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, + rtype, R_AMD64_GOTTPOFF, arsp->rel_roffset, + sdp->sd_name)); arsp->rel_rtype = R_AMD64_GOTTPOFF; arsp->rel_roffset += 8; arsp->rel_raddend = (Sxword)-4; + /* * Addjust 'offset' to beginning of instruction * sequence. */ offset -= 4; (void) memcpy(offset, tlsinstr_gd_ie, - sizeof (tlsinstr_gd_ie)); + sizeof (tlsinstr_gd_ie)); return (FIX_RELOC); + case R_AMD64_PLT32: /* * Fixup done via the TLS_GD relocation */ - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_AMD64_NONE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, + rtype, R_AMD64_NONE, arsp->rel_roffset, + sdp->sd_name)); return (FIX_DONE); } } @@ -520,23 +522,21 @@ tls_fixups(Rel_desc *arsp) * 0x09 leaq x@tpoff(%rax), %rax * 0x10 */ - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_AMD64_TPOFF32, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, + rtype, R_AMD64_TPOFF32, arsp->rel_roffset, sdp->sd_name)); arsp->rel_rtype = R_AMD64_TPOFF32; arsp->rel_roffset += 8; arsp->rel_raddend = 0; + /* * Addjust 'offset' to beginning of instruction * sequence. */ offset -= 4; - (void) memcpy(offset, tlsinstr_gd_le, - sizeof (tlsinstr_gd_le)); + (void) memcpy(offset, tlsinstr_gd_le, sizeof (tlsinstr_gd_le)); return (FIX_RELOC); + case R_AMD64_GOTTPOFF: /* * IE -> LE @@ -550,26 +550,25 @@ tls_fixups(Rel_desc *arsp) * 0x09 leaq x@tpoff(%rax), %rax * 0x10 */ - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_AMD64_TPOFF32, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype, + R_AMD64_TPOFF32, arsp->rel_roffset, sdp->sd_name)); arsp->rel_rtype = R_AMD64_TPOFF32; arsp->rel_raddend = 0; + /* * Addjust 'offset' to beginning of instruction * sequence. */ offset -= 12; + /* * Same code sequence used in the GD -> LE * transition. */ - (void) memcpy(offset, tlsinstr_gd_le, - sizeof (tlsinstr_gd_le)); + (void) memcpy(offset, tlsinstr_gd_le, sizeof (tlsinstr_gd_le)); return (FIX_RELOC); + case R_AMD64_TLSLD: /* * LD -> LE @@ -584,15 +583,12 @@ tls_fixups(Rel_desc *arsp) * 0x02 .byte 0x66 * 0x03 movq %fs:0, %rax */ - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_AMD64_NONE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype, + R_AMD64_NONE, arsp->rel_roffset, sdp->sd_name)); offset -= 3; - (void) memcpy(offset, tlsinstr_ld_le, - sizeof (tlsinstr_ld_le)); + (void) memcpy(offset, tlsinstr_ld_le, sizeof (tlsinstr_ld_le)); return (FIX_DONE); + case R_AMD64_DTPOFF32: /* * LD->LE @@ -602,11 +598,8 @@ tls_fixups(Rel_desc *arsp) * To: * 0x00 leaq x1@tpoff(%rax), %rcx */ - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_AMD64_TPOFF32, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype, + R_AMD64_TPOFF32, arsp->rel_roffset, sdp->sd_name)); arsp->rel_rtype = R_AMD64_TPOFF32; arsp->rel_raddend = 0; return (FIX_RELOC); @@ -616,7 +609,7 @@ tls_fixups(Rel_desc *arsp) } uintptr_t -do_activerelocs(Ofl_desc *ofl) +ld_do_activerelocs(Ofl_desc *ofl) { Rel_desc *arsp; Rel_cache *rcp; @@ -625,7 +618,7 @@ do_activerelocs(Ofl_desc *ofl) Word flags = ofl->ofl_flags; Word dtflags1 = ofl->ofl_dtflags_1; - DBG_CALL(Dbg_reloc_doactiverel()); + DBG_CALL(Dbg_reloc_doact_title(ofl->ofl_lml)); /* * Process active relocations. */ @@ -650,7 +643,8 @@ do_activerelocs(Ofl_desc *ofl) ((arsp->rel_flags & (FLG_REL_GOT | FLG_REL_BSS | FLG_REL_PLT | FLG_REL_NOINFO)) == 0)) { - DBG_CALL(Dbg_reloc_discard(M_MACH, arsp)); + DBG_CALL(Dbg_reloc_discard(ofl->ofl_lml, + M_MACH, arsp)); continue; } @@ -678,7 +672,7 @@ do_activerelocs(Ofl_desc *ofl) if (arsp->rel_flags & FLG_REL_TLSFIX) { Fixupret ret; - if ((ret = tls_fixups(arsp)) == FIX_ERROR) + if ((ret = tls_fixups(ofl, arsp)) == FIX_ERROR) return (S_ERROR); if (ret == FIX_DONE) continue; @@ -689,7 +683,7 @@ do_activerelocs(Ofl_desc *ofl) * expanded move table, adjust the relocation entries. */ if (arsp->rel_move) - adj_movereloc(ofl, arsp); + ld_adj_movereloc(ofl, arsp); sdp = arsp->rel_sym; refaddr = arsp->rel_roffset + @@ -706,13 +700,13 @@ do_activerelocs(Ofl_desc *ofl) * The value for a symbol pointing to a SECTION * is based off of that sections position. * - * The second argument of the am_I_partial() is - * the value stored at the target address + * The second argument of the ld_am_I_partial() + * is the value stored at the target address * relocation is going to be applied. */ if ((sdp->sd_isc->is_flags & FLG_IS_RELUPD) && /* LINTED */ - (sym = am_I_partial(arsp, *(Xword *) + (sym = ld_am_I_partial(arsp, *(Xword *) ((uchar_t *) arsp->rel_isdesc->is_indata->d_buf + arsp->rel_roffset)))) { @@ -762,7 +756,7 @@ do_activerelocs(Ofl_desc *ofl) */ if (IS_PLT(arsp->rel_rtype)) { if (sdp->sd_aux && sdp->sd_aux->sa_PLTndx) - value = calc_plt_addr(sdp, ofl); + value = ld_calc_plt_addr(sdp, ofl); } /* @@ -802,7 +796,7 @@ do_activerelocs(Ofl_desc *ofl) * Calculate offset into GOT at which to apply * the relocation. */ - gnp = find_gotndx(&(sdp->sd_GOTndxs), gref, + gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, arsp); assert(gnp); @@ -819,7 +813,8 @@ do_activerelocs(Ofl_desc *ofl) R2addr = R1addr + (uintptr_t) arsp->rel_osdesc->os_outdata->d_buf; - DBG_CALL(Dbg_reloc_doact(M_MACH, + DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml, + ELF_DBG_LD, M_MACH, SHT_RELA, arsp->rel_rtype, R1addr, value, arsp->rel_sname, arsp->rel_osdesc)); @@ -841,7 +836,7 @@ do_activerelocs(Ofl_desc *ofl) * Calculation: * G + GOT + A - P */ - gnp = find_gotndx(&(sdp->sd_GOTndxs), + gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, arsp); assert(gnp); value = (Xword)(ofl->ofl_osgot->os_shdr-> @@ -864,7 +859,7 @@ do_activerelocs(Ofl_desc *ofl) ((flags & FLG_OF_RELOBJ) == 0)) { Gotndx *gnp; - gnp = find_gotndx(&(sdp->sd_GOTndxs), gref, + gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, arsp); assert(gnp); value = (Xword)gnp->gn_gotndx * M_GOT_ENTSIZE; @@ -873,7 +868,7 @@ do_activerelocs(Ofl_desc *ofl) ((flags & FLG_OF_RELOBJ) == 0)) { Gotndx *gnp; - gnp = find_gotndx(&(sdp->sd_GOTndxs), + gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, arsp); assert(gnp); value = (Xword)gnp->gn_gotndx * M_GOT_ENTSIZE; @@ -914,8 +909,9 @@ do_activerelocs(Ofl_desc *ofl) * see this. */ if (arsp->rel_isdesc->is_indata->d_buf == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_EMPTYSEC), - conv_reloc_amd64_type_str(arsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_REL_EMPTYSEC), + conv_reloc_amd64_type(arsp->rel_rtype), ifl_name, demangle(arsp->rel_sname), arsp->rel_isdesc->is_name); return (S_ERROR); @@ -928,28 +924,29 @@ do_activerelocs(Ofl_desc *ofl) (uintptr_t)_elf_getxoff(arsp->rel_isdesc-> is_indata)); - DBG_CALL(Dbg_reloc_doact(M_MACH, arsp->rel_rtype, - (uintptr_t)addr, value, arsp->rel_sname, - arsp->rel_osdesc)); + DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml, ELF_DBG_LD, + M_MACH, SHT_RELA, arsp->rel_rtype, EC_NATPTR(addr), + value, arsp->rel_sname, arsp->rel_osdesc)); addr += (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf; - if ((((uintptr_t)addr - (uintptr_t)ofl->ofl_ehdr) > + if ((((uintptr_t)addr - (uintptr_t)ofl->ofl_nehdr) > ofl->ofl_size) || (arsp->rel_roffset > arsp->rel_osdesc->os_shdr->sh_size)) { int class; if (((uintptr_t)addr - - (uintptr_t)ofl->ofl_ehdr) > ofl->ofl_size) + (uintptr_t)ofl->ofl_nehdr) > ofl->ofl_size) class = ERR_FATAL; else class = ERR_WARNING; - eprintf(class, MSG_INTL(MSG_REL_INVALOFFSET), - conv_reloc_amd64_type_str(arsp->rel_rtype), + eprintf(ofl->ofl_lml, class, + MSG_INTL(MSG_REL_INVALOFFSET), + conv_reloc_amd64_type(arsp->rel_rtype), ifl_name, arsp->rel_isdesc->is_name, demangle(arsp->rel_sname), EC_ADDR((uintptr_t)addr - - (uintptr_t)ofl->ofl_ehdr)); + (uintptr_t)ofl->ofl_nehdr)); if (class == ERR_FATAL) { return_code = S_ERROR; @@ -972,8 +969,8 @@ do_activerelocs(Ofl_desc *ofl) if ((flags & FLG_OF_RELOBJ) || !(dtflags1 & DF_1_NORELOC)) { if (do_reloc((uchar_t)arsp->rel_rtype, - addr, &value, arsp->rel_sname, - ifl_name) == 0) + addr, &value, arsp->rel_sname, ifl_name, + ofl->ofl_lml) == 0) return_code = S_ERROR; } } @@ -982,7 +979,7 @@ do_activerelocs(Ofl_desc *ofl) } uintptr_t -add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) +ld_add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) { Rel_desc *orsp; Rel_cache *rcp; @@ -1113,9 +1110,10 @@ add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) ofl->ofl_dtflags_1 |= DF_1_DISPRELPND; if (ofl->ofl_flags & FLG_OF_VERBOSE) - disp_errmsg(MSG_INTL(MSG_REL_DISPREL4), orsp, ofl); + ld_disp_errmsg(MSG_INTL(MSG_REL_DISPREL4), orsp, ofl); } - DBG_CALL(Dbg_reloc_ors_entry(M_MACH, orsp)); + DBG_CALL(Dbg_reloc_ors_entry(ofl->ofl_lml, ELF_DBG_LD, SHT_RELA, + M_MACH, orsp)); return (1); } @@ -1124,9 +1122,9 @@ add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) */ /* ARGSUSED */ uintptr_t -reloc_register(Rel_desc * rsp, Is_desc * isp, Ofl_desc * ofl) +ld_reloc_register(Rel_desc * rsp, Is_desc * isp, Ofl_desc * ofl) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOREG)); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_NOREG)); return (S_ERROR); } @@ -1134,7 +1132,7 @@ reloc_register(Rel_desc * rsp, Is_desc * isp, Ofl_desc * ofl) * process relocation for a LOCAL symbol */ uintptr_t -reloc_local(Rel_desc * rsp, Ofl_desc * ofl) +ld_reloc_local(Rel_desc * rsp, Ofl_desc * ofl) { Word flags = ofl->ofl_flags; Sym_desc *sdp = rsp->rel_sym; @@ -1162,11 +1160,11 @@ reloc_local(Rel_desc * rsp, Ofl_desc * ofl) * simplify it to a RELATIVE relocation. */ if (reloc_table[ortype].re_fsize != sizeof (Addr)) { - return (add_outrel(NULL, rsp, ofl)); + return (ld_add_outrel(NULL, rsp, ofl)); } rsp->rel_rtype = R_AMD64_RELATIVE; - if (add_outrel(FLG_REL_ADVAL, rsp, ofl) == S_ERROR) + if (ld_add_outrel(FLG_REL_ADVAL, rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_rtype = ortype; return (1); @@ -1199,8 +1197,9 @@ reloc_local(Rel_desc * rsp, Ofl_desc * ofl) if (rsp->rel_osdesc && (rsp->rel_osdesc->os_shdr->sh_type == SHT_SUNW_ANNOTATE)) return (0); - (void) eprintf(ERR_WARNING, MSG_INTL(MSG_REL_EXTERNSYM), - conv_reloc_amd64_type_str(rsp->rel_rtype), + (void) eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_REL_EXTERNSYM), + conv_reloc_amd64_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname), rsp->rel_osdesc->os_name); return (1); @@ -1209,13 +1208,13 @@ reloc_local(Rel_desc * rsp, Ofl_desc * ofl) /* * Perform relocation. */ - return (add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(NULL, rsp, ofl)); } uintptr_t /* ARGSUSED */ -reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) +ld_reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) { /* * Stub routine for common code compatibility, we shouldn't @@ -1225,7 +1224,7 @@ reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) } uintptr_t -reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) +ld_reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) { Word rtype = rsp->rel_rtype; Sym_desc *sdp = rsp->rel_sym; @@ -1238,8 +1237,8 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) */ if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) == (FLG_OF_STATIC | FLG_OF_EXEC)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSSTAT), - conv_reloc_386_type_str(rsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSSTAT), + conv_reloc_amd64_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname)); return (S_ERROR); @@ -1250,11 +1249,12 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) * are illegal. */ if (ELF_ST_TYPE(sdp->sd_sym->st_info) != STT_TLS) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBADSYM), - conv_reloc_386_type_str(rsp->rel_rtype), - rsp->rel_isdesc->is_file->ifl_name, - demangle(rsp->rel_sname), - conv_info_type_str(ofl->ofl_e_machine, + Ifl_desc *ifl = rsp->rel_isdesc->is_file; + + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSBADSYM), + conv_reloc_amd64_type(rsp->rel_rtype), + ifl->ifl_name, demangle(rsp->rel_sname), + conv_sym_info_type(ifl->ifl_ehdr->e_machine, ELF_ST_TYPE(sdp->sd_sym->st_info))); return (S_ERROR); } @@ -1281,8 +1281,9 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) * the current object. */ if (IS_TLS_LD(rtype) || IS_TLS_LE(rtype)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBND), - conv_reloc_amd64_type_str(rsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_REL_TLSBND), + conv_reloc_amd64_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname), sdp->sd_file->ifl_name); @@ -1294,33 +1295,34 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) /* * Assign a GOT entry for static TLS references */ - if ((gnp = find_gotndx(&(sdp->sd_GOTndxs), + if ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, rsp)) == 0) { - if (assign_gotndx(&(sdp->sd_GOTndxs), + if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, gref, ofl, rsp, sdp) == S_ERROR) return (S_ERROR); rsp->rel_rtype = R_AMD64_TPOFF64; - if (add_outrel((FLG_REL_GOT | FLG_REL_STLS), + if (ld_add_outrel((FLG_REL_GOT | FLG_REL_STLS), rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_rtype = rtype; } if (IS_TLS_IE(rtype)) - return (add_actrel(FLG_REL_STLS, rsp, ofl)); + return (ld_add_actrel(FLG_REL_STLS, rsp, ofl)); /* * If (GD or LD) reference models - fixups * are required. */ - return (add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS), + return (ld_add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS), rsp, ofl)); } /* * LE access model */ if (IS_TLS_LE(rtype)) - return (add_actrel(FLG_REL_STLS, rsp, ofl)); - return (add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS), rsp, ofl)); + return (ld_add_actrel(FLG_REL_STLS, rsp, ofl)); + return (ld_add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS), + rsp, ofl)); } /* @@ -1332,8 +1334,8 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) * will work here. */ if (IS_TLS_IE(rtype) || IS_TLS_LE(rtype)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSIE), - conv_reloc_amd64_type_str(rsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSIE), + conv_reloc_amd64_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname)); return (S_ERROR); @@ -1343,8 +1345,8 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) * LD access mode can only bind to local symbols. */ if (!local && IS_TLS_LD(rtype)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBND), - conv_reloc_amd64_type_str(rsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSBND), + conv_reloc_amd64_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname), sdp->sd_file->ifl_name); @@ -1352,37 +1354,38 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) } - if (IS_TLS_LD(rtype) && ((gnp = find_gotndx(&(sdp->sd_GOTndxs), + if (IS_TLS_LD(rtype) && ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), GOT_REF_TLSLD, ofl, rsp)) == 0)) { - if (assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSLD, + if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSLD, ofl, rsp, sdp) == S_ERROR) return (S_ERROR); rflags = FLG_REL_GOT | FLG_REL_MTLS; if (local) rflags |= FLG_REL_SCNNDX; rsp->rel_rtype = R_AMD64_DTPMOD64; - if (add_outrel(rflags, rsp, ofl) == S_ERROR) + if (ld_add_outrel(rflags, rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_rtype = rtype; - } else if (IS_TLS_GD(rtype) && ((gnp = find_gotndx(&(sdp->sd_GOTndxs), - GOT_REF_TLSGD, ofl, rsp)) == 0)) { - if (assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSGD, + } else if (IS_TLS_GD(rtype) && + ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), GOT_REF_TLSGD, ofl, + rsp)) == 0)) { + if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSGD, ofl, rsp, sdp) == S_ERROR) return (S_ERROR); rflags = FLG_REL_GOT | FLG_REL_DTLS; if (local) rflags |= FLG_REL_SCNNDX; rsp->rel_rtype = R_AMD64_DTPMOD64; - if (add_outrel(rflags, rsp, ofl) == S_ERROR) + if (ld_add_outrel(rflags, rsp, ofl) == S_ERROR) return (S_ERROR); if (local == TRUE) { rsp->rel_rtype = R_AMD64_DTPOFF64; - if (add_actrel((FLG_REL_GOT | FLG_REL_DTLS), rsp, + if (ld_add_actrel((FLG_REL_GOT | FLG_REL_DTLS), rsp, ofl) == S_ERROR) return (S_ERROR); } else { rsp->rel_rtype = R_AMD64_DTPOFF64; - if (add_outrel((FLG_REL_GOT | FLG_REL_DTLS), rsp, + if (ld_add_outrel((FLG_REL_GOT | FLG_REL_DTLS), rsp, ofl) == S_ERROR) return (S_ERROR); } @@ -1390,14 +1393,14 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) } if (IS_TLS_LD(rtype)) - return (add_actrel(FLG_REL_MTLS, rsp, ofl)); + return (ld_add_actrel(FLG_REL_MTLS, rsp, ofl)); - return (add_actrel(FLG_REL_DTLS, rsp, ofl)); + return (ld_add_actrel(FLG_REL_DTLS, rsp, ofl)); } /* ARGSUSED3 */ Gotndx * -find_gotndx(List * lst, Gotref gref, Ofl_desc * ofl, Rel_desc * rdesc) +ld_find_gotndx(List * lst, Gotref gref, Ofl_desc * ofl, Rel_desc * rdesc) { Listnode * lnp; Gotndx * gnp; @@ -1417,7 +1420,7 @@ find_gotndx(List * lst, Gotref gref, Ofl_desc * ofl, Rel_desc * rdesc) } Xword -calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl) +ld_calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl) { Os_desc *osp = ofl->ofl_osgot; Sym_desc *sdp = rdesc->rel_sym; @@ -1434,7 +1437,7 @@ calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl) else gref = GOT_REF_GENERIC; - gnp = find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, rdesc); + gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, rdesc); assert(gnp); gotndx = (Xword)gnp->gn_gotndx; @@ -1449,7 +1452,7 @@ calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl) /* ARGSUSED5 */ uintptr_t -assign_gotndx(List * lst, Gotndx * pgnp, Gotref gref, Ofl_desc * ofl, +ld_assign_gotndx(List * lst, Gotndx * pgnp, Gotref gref, Ofl_desc * ofl, Rel_desc * rsp, Sym_desc * sdp) { Xword raddend; @@ -1512,9 +1515,8 @@ assign_gotndx(List * lst, Gotndx * pgnp, Gotref gref, Ofl_desc * ofl, return (1); } - void -assign_plt_ndx(Sym_desc * sdp, Ofl_desc *ofl) +ld_assign_plt_ndx(Sym_desc * sdp, Ofl_desc *ofl) { sdp->sd_aux->sa_PLTndx = 1 + ofl->ofl_pltcnt++; sdp->sd_aux->sa_PLTGOTndx = ofl->ofl_gotcnt++; @@ -1534,7 +1536,7 @@ static uchar_t plt0_template[M_PLT_ENTSIZE] = { * Initializes .got[0] with the _DYNAMIC symbol value. */ uintptr_t -fillin_gotplt1(Ofl_desc * ofl) +ld_fillin_gotplt(Ofl_desc * ofl) { Word flags = ofl->ofl_flags; Word dtflags1 = ofl->ofl_dtflags_1; @@ -1542,7 +1544,7 @@ fillin_gotplt1(Ofl_desc * ofl) if (ofl->ofl_osgot) { Sym_desc * sdp; - if ((sdp = sym_find(MSG_ORIG(MSG_SYM_DYNAMIC_U), + if ((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_DYNAMIC_U), SYM_NOHASH, 0, ofl)) != NULL) { uchar_t *genptr = ((uchar_t *)ofl->ofl_osgot->os_outdata->d_buf + @@ -1589,8 +1591,9 @@ fillin_gotplt1(Ofl_desc * ofl) !(dtflags1 & DF_1_NORELOC)) { if (do_reloc(R_AMD64_GOTPCREL, &pltent[0x02], &val1, MSG_ORIG(MSG_SYM_PLTENT), - MSG_ORIG(MSG_SPECFIL_PLTENT)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_PLT_PLT0FAIL)); + MSG_ORIG(MSG_SPECFIL_PLTENT), ofl->ofl_lml) == 0) { + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_PLT_PLT0FAIL)); return (S_ERROR); } } @@ -1610,23 +1613,12 @@ fillin_gotplt1(Ofl_desc * ofl) !(dtflags1 & DF_1_NORELOC)) { if (do_reloc(R_AMD64_GOTPCREL, &pltent[0x08], &val1, MSG_ORIG(MSG_SYM_PLTENT), - MSG_ORIG(MSG_SPECFIL_PLTENT)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_PLT_PLT0FAIL)); + MSG_ORIG(MSG_SPECFIL_PLTENT), ofl->ofl_lml) == 0) { + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_PLT_PLT0FAIL)); return (S_ERROR); } } } return (1); } - -/* - * Return got[0]. - */ -Addr -fillin_gotplt2(Ofl_desc * ofl) -{ - if (ofl->ofl_osgot) - return (ofl->ofl_osgot->os_shdr->sh_addr); - else - return (0); -} diff --git a/usr/src/cmd/sgs/libld/i386/machrel.c b/usr/src/cmd/sgs/libld/common/machrel.intel.c index 60a06b8165..2ba5568233 100644 --- a/usr/src/cmd/sgs/libld/i386/machrel.c +++ b/usr/src/cmd/sgs/libld/common/machrel.intel.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. @@ -33,13 +32,13 @@ #include <string.h> #include <stdio.h> #include <sys/elf_386.h> -#include "debug.h" -#include "reloc.h" +#include <debug.h> +#include <reloc.h> #include "msg.h" #include "_libld.h" Word -init_rel(Rel_desc *reld, void *reloc) +ld_init_rel(Rel_desc *reld, void *reloc) { Rel * rel = (Rel *)reloc; @@ -53,13 +52,13 @@ init_rel(Rel_desc *reld, void *reloc) } void -mach_eflags(Ehdr *ehdr, Ofl_desc *ofl) +ld_mach_eflags(Ehdr *ehdr, Ofl_desc *ofl) { - ofl->ofl_e_flags |= ehdr->e_flags; + ofl->ofl_dehdr->e_flags |= ehdr->e_flags; } void -mach_make_dynamic(Ofl_desc *ofl, size_t *cnt) +ld_mach_make_dynamic(Ofl_desc *ofl, size_t *cnt) { if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) { /* @@ -71,19 +70,20 @@ mach_make_dynamic(Ofl_desc *ofl, size_t *cnt) } void -mach_update_odynamic(Ofl_desc * ofl, Dyn ** dyn) +ld_mach_update_odynamic(Ofl_desc * ofl, Dyn ** dyn) { - if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) { - if (ofl->ofl_pltcnt) { - (*dyn)->d_tag = DT_PLTGOT; - (*dyn)->d_un.d_ptr = fillin_gotplt2(ofl); - (*dyn)++; - } + if (((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) && ofl->ofl_pltcnt) { + (*dyn)->d_tag = DT_PLTGOT; + if (ofl->ofl_osgot) + (*dyn)->d_un.d_ptr = ofl->ofl_osgot->os_shdr->sh_addr; + else + (*dyn)->d_un.d_ptr = 0; + (*dyn)++; } } Xword -calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl) +ld_calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl) { Xword value; @@ -157,7 +157,7 @@ plt_entry(Ofl_desc * ofl, Word rel_off, Sym_desc * sdp) } uintptr_t -perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) +ld_perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) { Os_desc * relosp, * osp = 0; Word ndx, roffset, value; @@ -175,7 +175,7 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) if (orsp->rel_isdesc && ((orsp->rel_flags & (FLG_REL_GOT | FLG_REL_BSS | FLG_REL_PLT | FLG_REL_NOINFO)) == 0) && (orsp->rel_isdesc->is_flags & FLG_IS_DISCARD)) { - DBG_CALL(Dbg_reloc_discard(M_MACH, orsp)); + DBG_CALL(Dbg_reloc_discard(ofl->ofl_lml, M_MACH, orsp)); return (1); } @@ -184,7 +184,7 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) * table, adjust the relocation entries. */ if (orsp->rel_move) - adj_movereloc(ofl, orsp); + ld_adj_movereloc(ofl, orsp); /* * If this is a relocation against a section using a partial initialized @@ -197,10 +197,10 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) if (ofl->ofl_parsym.head && (sdp->sd_isc->is_flags & FLG_IS_RELUPD) && /* LINTED */ - (psym = am_I_partial(orsp, *(Xword *) + (psym = ld_am_I_partial(orsp, *(Xword *) ((uchar_t *)(orsp->rel_isdesc->is_indata->d_buf) + orsp->rel_roffset)))) { - DBG_CALL(Dbg_move_outsctadj(psym)); + DBG_CALL(Dbg_move_outsctadj(ofl->ofl_lml, psym)); sectmoved = 1; } } @@ -209,7 +209,8 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) if (orsp->rel_flags & FLG_REL_GOT) { osp = ofl->ofl_osgot; - roffset = (Word)calc_got_offset(orsp, ofl); + roffset = (Word)ld_calc_got_offset(orsp, ofl); + } else if (orsp->rel_flags & FLG_REL_PLT) { /* * Note that relocations for PLT's actually @@ -276,8 +277,8 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) rea.r_info = ELF_R_INFO(ndx, orsp->rel_rtype); rea.r_offset = roffset; - DBG_CALL(Dbg_reloc_out(M_MACH, SHT_REL, &rea, orsp->rel_sname, - relosp->os_name)); + DBG_CALL(Dbg_reloc_out(ofl, ELF_DBG_LD, SHT_REL, &rea, relosp->os_name, + orsp->rel_sname)); /* * Assert we haven't walked off the end of our relocation table. @@ -297,7 +298,7 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) if (orsp->rel_rtype == R_386_JMP_SLOT) osp = ofl->ofl_osgot; - reloc_remain_entry(orsp, osp, ofl); + ld_reloc_remain_entry(orsp, osp, ofl); return (1); } @@ -354,9 +355,8 @@ static uchar_t tlsinstr_gd_ie_movgs[] = { #define SIB_MSK_IND 0x38 #define SIB_MSK_BS 0x07 - -Fixupret -tls_fixups(Rel_desc *arsp) +static Fixupret +tls_fixups(Ofl_desc *ofl, Rel_desc *arsp) { Sym_desc *sdp = arsp->rel_sym; Word rtype = arsp->rel_rtype; @@ -381,13 +381,12 @@ tls_fixups(Rel_desc *arsp) * 0x0 movl %gs:0, %eax * 0x6 addl x@gotntpoff(r1), %eax */ - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_386_TLS_GOTIE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, + rtype, R_386_TLS_GOTIE, arsp->rel_roffset, + sdp->sd_name)); arsp->rel_rtype = R_386_TLS_GOTIE; arsp->rel_roffset += 5; + /* * Addjust 'offset' to beginning of instruction * sequence. @@ -395,22 +394,22 @@ tls_fixups(Rel_desc *arsp) offset -= 3; r1 = (offset[2] & SIB_MSK_IND) >> 3; (void) memcpy(offset, tlsinstr_gd_ie, - sizeof (tlsinstr_gd_ie)); + sizeof (tlsinstr_gd_ie)); + /* * set register %r1 into the addl * instruction. */ offset[0x7] |= r1; return (FIX_RELOC); + case R_386_TLS_GD_PLT: /* * Fixup done via the TLS_GD relocation */ - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_386_NONE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, + rtype, R_386_NONE, arsp->rel_roffset, + sdp->sd_name)); return (FIX_DONE); } } @@ -431,39 +430,34 @@ tls_fixups(Rel_desc *arsp) * 0xb nop * 0xc */ - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_386_TLS_LE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, + rtype, R_386_TLS_LE, arsp->rel_roffset, sdp->sd_name)); arsp->rel_rtype = R_386_TLS_LE; arsp->rel_roffset += 4; + /* * Addjust 'offset' to beginning of instruction * sequence. */ offset -= 3; (void) memcpy(offset, tlsinstr_gd_le, - sizeof (tlsinstr_gd_le)); + sizeof (tlsinstr_gd_le)); return (FIX_RELOC); + case R_386_TLS_GD_PLT: case R_386_PLT32: /* * Fixup done via the TLS_GD relocation */ - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_386_NONE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, + rtype, R_386_NONE, arsp->rel_roffset, sdp->sd_name)); return (FIX_DONE); + case R_386_TLS_LDM_PLT: - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_386_NONE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, + rtype, R_386_NONE, arsp->rel_roffset, sdp->sd_name)); + /* * Transition: * call __tls_get_addr() @@ -480,12 +474,11 @@ tls_fixups(Rel_desc *arsp) *(offset + 2) = TLS_NOP; *(offset + 3) = TLS_NOP; return (FIX_DONE); + case R_386_TLS_LDM: - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_386_NONE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, + rtype, R_386_NONE, arsp->rel_roffset, sdp->sd_name)); + /* * Transition: * @@ -497,11 +490,11 @@ tls_fixups(Rel_desc *arsp) * 0x00 movl %gs:0, %eax */ (void) memcpy(offset - 2, tlsinstr_gd_ie_movgs, - sizeof (tlsinstr_gd_ie_movgs)); + sizeof (tlsinstr_gd_ie_movgs)); return (FIX_DONE); + case R_386_TLS_LDO_32: /* - * * Instructions: * * 0x10 leal x1@dtpoff(%eax), %edx R_386_TLS_LDO_32 @@ -511,13 +504,11 @@ tls_fixups(Rel_desc *arsp) */ offset -= 2; - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_386_TLS_LE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, + rtype, R_386_TLS_LE, arsp->rel_roffset, sdp->sd_name)); arsp->rel_rtype = R_386_TLS_LE; return (FIX_RELOC); + case R_386_TLS_GOTIE: /* * These transitions are a little different than the @@ -541,15 +532,12 @@ tls_fixups(Rel_desc *arsp) * 2) addl $foo@ntpoff, %reg2 * 0x81, 0xc0 | reg2, foo@ntpoff * - * * Note: reg1 != 4 (%esp) */ - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_386_TLS_LE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, + rtype, R_386_TLS_LE, arsp->rel_roffset, sdp->sd_name)); arsp->rel_rtype = R_386_TLS_LE; + offset -= 2; r2 = (offset[1] & MODRM_MSK_RO) >> 3; if (offset[0] == 0x8b) { @@ -570,12 +558,13 @@ tls_fixups(Rel_desc *arsp) /* * Unexpected instruction sequence - fatal error. */ - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_BADTLSINS), - conv_reloc_386_type_str(arsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_BADTLSINS), + conv_reloc_386_type(arsp->rel_rtype), arsp->rel_isdesc->is_file->ifl_name, demangle(arsp->rel_sname), arsp->rel_isdesc->is_name, EC_OFF(arsp->rel_roffset)); return (FIX_ERROR); + case R_386_TLS_IE: /* * These transitions are a little different than the @@ -630,8 +619,8 @@ tls_fixups(Rel_desc *arsp) /* * Unexpected instruction sequence - fatal error. */ - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_BADTLSINS), - conv_reloc_386_type_str(arsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_BADTLSINS), + conv_reloc_386_type(arsp->rel_rtype), arsp->rel_isdesc->is_file->ifl_name, demangle(arsp->rel_sname), arsp->rel_isdesc->is_name, EC_OFF(arsp->rel_roffset)); @@ -641,7 +630,7 @@ tls_fixups(Rel_desc *arsp) } uintptr_t -do_activerelocs(Ofl_desc *ofl) +ld_do_activerelocs(Ofl_desc *ofl) { Rel_desc *arsp; Rel_cache *rcp; @@ -650,7 +639,7 @@ do_activerelocs(Ofl_desc *ofl) Word flags = ofl->ofl_flags; Word dtflags1 = ofl->ofl_dtflags_1; - DBG_CALL(Dbg_reloc_doactiverel()); + DBG_CALL(Dbg_reloc_doact_title(ofl->ofl_lml)); /* * Process active relocations. */ @@ -675,7 +664,8 @@ do_activerelocs(Ofl_desc *ofl) ((arsp->rel_flags & (FLG_REL_GOT | FLG_REL_BSS | FLG_REL_PLT | FLG_REL_NOINFO)) == 0)) { - DBG_CALL(Dbg_reloc_discard(M_MACH, arsp)); + DBG_CALL(Dbg_reloc_discard(ofl->ofl_lml, + M_MACH, arsp)); continue; } @@ -703,7 +693,7 @@ do_activerelocs(Ofl_desc *ofl) if (arsp->rel_flags & FLG_REL_TLSFIX) { Fixupret ret; - if ((ret = tls_fixups(arsp)) == FIX_ERROR) + if ((ret = tls_fixups(ofl, arsp)) == FIX_ERROR) return (S_ERROR); if (ret == FIX_DONE) continue; @@ -714,7 +704,7 @@ do_activerelocs(Ofl_desc *ofl) * expanded move table, adjust the relocation entries. */ if (arsp->rel_move) - adj_movereloc(ofl, arsp); + ld_adj_movereloc(ofl, arsp); sdp = arsp->rel_sym; refaddr = arsp->rel_roffset + @@ -730,13 +720,13 @@ do_activerelocs(Ofl_desc *ofl) * The value for a symbol pointing to a SECTION * is based off of that sections position. * - * The second argument of the am_I_partial() is - * the value stored at the target address + * The second argument of the ld_am_I_partial() + * is the value stored at the target address * relocation is going to be applied. */ if ((sdp->sd_isc->is_flags & FLG_IS_RELUPD) && /* LINTED */ - (sym = am_I_partial(arsp, *(Xword *) + (sym = ld_am_I_partial(arsp, *(Xword *) ((uchar_t *) arsp->rel_isdesc->is_indata->d_buf + arsp->rel_roffset)))) { @@ -786,7 +776,7 @@ do_activerelocs(Ofl_desc *ofl) */ if (IS_PLT(arsp->rel_rtype)) { if (sdp->sd_aux && sdp->sd_aux->sa_PLTndx) - value = calc_plt_addr(sdp, ofl); + value = ld_calc_plt_addr(sdp, ofl); } /* @@ -814,7 +804,7 @@ do_activerelocs(Ofl_desc *ofl) * Calculate offset into GOT at which to apply * the relocation. */ - gnp = find_gotndx(&(sdp->sd_GOTndxs), gref, + gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, 0); assert(gnp); @@ -831,7 +821,8 @@ do_activerelocs(Ofl_desc *ofl) R2addr = R1addr + (uintptr_t) arsp->rel_osdesc->os_outdata->d_buf; - DBG_CALL(Dbg_reloc_doact(M_MACH, + DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml, + ELF_DBG_LD, M_MACH, SHT_REL, arsp->rel_rtype, R1addr, value, arsp->rel_sname, arsp->rel_osdesc)); @@ -861,7 +852,7 @@ do_activerelocs(Ofl_desc *ofl) ((flags & FLG_OF_RELOBJ) == 0)) { Gotndx *gnp; - gnp = find_gotndx(&(sdp->sd_GOTndxs), gref, + gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, 0); assert(gnp); value = (Xword)gnp->gn_gotndx * M_GOT_ENTSIZE; @@ -874,7 +865,7 @@ do_activerelocs(Ofl_desc *ofl) ((flags & FLG_OF_RELOBJ) == 0)) { Gotndx *gnp; - gnp = find_gotndx(&(sdp->sd_GOTndxs), + gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), GOT_REF_GENERIC, ofl, 0); assert(gnp); value = (Xword)gnp->gn_gotndx * M_GOT_ENTSIZE; @@ -916,8 +907,9 @@ do_activerelocs(Ofl_desc *ofl) * see this. */ if (arsp->rel_isdesc->is_indata->d_buf == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_EMPTYSEC), - conv_reloc_386_type_str(arsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_REL_EMPTYSEC), + conv_reloc_386_type(arsp->rel_rtype), ifl_name, demangle(arsp->rel_sname), arsp->rel_isdesc->is_name); return (S_ERROR); @@ -930,28 +922,29 @@ do_activerelocs(Ofl_desc *ofl) (uintptr_t)_elf_getxoff(arsp->rel_isdesc-> is_indata)); - DBG_CALL(Dbg_reloc_doact(M_MACH, arsp->rel_rtype, - (uintptr_t)addr, value, arsp->rel_sname, - arsp->rel_osdesc)); + DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml, ELF_DBG_LD, + M_MACH, SHT_REL, arsp->rel_rtype, EC_NATPTR(addr), + value, arsp->rel_sname, arsp->rel_osdesc)); addr += (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf; - if ((((uintptr_t)addr - (uintptr_t)ofl->ofl_ehdr) > + if ((((uintptr_t)addr - (uintptr_t)ofl->ofl_nehdr) > ofl->ofl_size) || (arsp->rel_roffset > arsp->rel_osdesc->os_shdr->sh_size)) { int class; if (((uintptr_t)addr - - (uintptr_t)ofl->ofl_ehdr) > ofl->ofl_size) + (uintptr_t)ofl->ofl_nehdr) > ofl->ofl_size) class = ERR_FATAL; else class = ERR_WARNING; - eprintf(class, MSG_INTL(MSG_REL_INVALOFFSET), - conv_reloc_386_type_str(arsp->rel_rtype), + eprintf(ofl->ofl_lml, class, + MSG_INTL(MSG_REL_INVALOFFSET), + conv_reloc_386_type(arsp->rel_rtype), ifl_name, arsp->rel_isdesc->is_name, demangle(arsp->rel_sname), EC_ADDR((uintptr_t)addr - - (uintptr_t)ofl->ofl_ehdr)); + (uintptr_t)ofl->ofl_nehdr)); if (class == ERR_FATAL) { return_code = S_ERROR; @@ -973,9 +966,9 @@ do_activerelocs(Ofl_desc *ofl) */ if ((flags & FLG_OF_RELOBJ) || !(dtflags1 & DF_1_NORELOC)) { - if (do_reloc((uchar_t)arsp->rel_rtype, - addr, &value, arsp->rel_sname, - ifl_name) == 0) + if (do_reloc((uchar_t)arsp->rel_rtype, addr, + &value, arsp->rel_sname, ifl_name, + ofl->ofl_lml) == 0) return_code = S_ERROR; } } @@ -987,7 +980,7 @@ do_activerelocs(Ofl_desc *ofl) * Add an output relocation record. */ uintptr_t -add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) +ld_add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) { Rel_desc *orsp; Rel_cache *rcp; @@ -1118,9 +1111,10 @@ add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) ofl->ofl_dtflags_1 |= DF_1_DISPRELPND; if (ofl->ofl_flags & FLG_OF_VERBOSE) - disp_errmsg(MSG_INTL(MSG_REL_DISPREL4), orsp, ofl); + ld_disp_errmsg(MSG_INTL(MSG_REL_DISPREL4), orsp, ofl); } - DBG_CALL(Dbg_reloc_ors_entry(M_MACH, orsp)); + DBG_CALL(Dbg_reloc_ors_entry(ofl->ofl_lml, ELF_DBG_LD, SHT_REL, + M_MACH, orsp)); return (1); } @@ -1129,9 +1123,9 @@ add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) */ /* ARGSUSED */ uintptr_t -reloc_register(Rel_desc * rsp, Is_desc * isp, Ofl_desc * ofl) +ld_reloc_register(Rel_desc * rsp, Is_desc * isp, Ofl_desc * ofl) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOREG)); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_NOREG)); return (S_ERROR); } @@ -1139,7 +1133,7 @@ reloc_register(Rel_desc * rsp, Is_desc * isp, Ofl_desc * ofl) * process relocation for a LOCAL symbol */ uintptr_t -reloc_local(Rel_desc * rsp, Ofl_desc * ofl) +ld_reloc_local(Rel_desc * rsp, Ofl_desc * ofl) { Word flags = ofl->ofl_flags; Sym_desc *sdp = rsp->rel_sym; @@ -1162,7 +1156,7 @@ reloc_local(Rel_desc * rsp, Ofl_desc * ofl) Word ortype = rsp->rel_rtype; rsp->rel_rtype = R_386_RELATIVE; - if (add_outrel(NULL, rsp, ofl) == S_ERROR) + if (ld_add_outrel(NULL, rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_rtype = ortype; } @@ -1194,8 +1188,8 @@ reloc_local(Rel_desc * rsp, Ofl_desc * ofl) if (rsp->rel_osdesc && (rsp->rel_osdesc->os_shdr->sh_type == SHT_SUNW_ANNOTATE)) return (0); - (void) eprintf(ERR_WARNING, MSG_INTL(MSG_REL_EXTERNSYM), - conv_reloc_386_type_str(rsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_REL_EXTERNSYM), + conv_reloc_386_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname), rsp->rel_osdesc->os_name); return (1); @@ -1204,12 +1198,12 @@ reloc_local(Rel_desc * rsp, Ofl_desc * ofl) /* * Perform relocation. */ - return (add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(NULL, rsp, ofl)); } uintptr_t /* ARGSUSED */ -reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) +ld_reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) { /* * Stub routine for common code compatibility, we shouldn't @@ -1220,7 +1214,7 @@ reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) } uintptr_t -reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) +ld_reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) { Word rtype = rsp->rel_rtype; Sym_desc *sdp = rsp->rel_sym; @@ -1233,8 +1227,8 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) */ if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) == (FLG_OF_STATIC | FLG_OF_EXEC)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSSTAT), - conv_reloc_386_type_str(rsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSSTAT), + conv_reloc_386_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname)); return (S_ERROR); @@ -1245,11 +1239,12 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) * are illegal. */ if (ELF_ST_TYPE(sdp->sd_sym->st_info) != STT_TLS) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBADSYM), - conv_reloc_386_type_str(rsp->rel_rtype), - rsp->rel_isdesc->is_file->ifl_name, - demangle(rsp->rel_sname), - conv_info_type_str(ofl->ofl_e_machine, + Ifl_desc *ifl = rsp->rel_isdesc->is_file; + + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSBADSYM), + conv_reloc_386_type(rsp->rel_rtype), + ifl->ifl_name, demangle(rsp->rel_sname), + conv_sym_info_type(ifl->ifl_ehdr->e_machine, ELF_ST_TYPE(sdp->sd_sym->st_info))); return (S_ERROR); } @@ -1276,8 +1271,9 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) * the current object. */ if (IS_TLS_LD(rtype) || IS_TLS_LE(rtype)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBND), - conv_reloc_386_type_str(rsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_REL_TLSBND), + conv_reloc_386_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname), sdp->sd_file->ifl_name); @@ -1289,34 +1285,35 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) /* * Assign a GOT entry for static TLS references */ - if ((gnp = find_gotndx(&(sdp->sd_GOTndxs), + if ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, 0)) == 0) { - if (assign_gotndx(&(sdp->sd_GOTndxs), + if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, gref, ofl, rsp, sdp) == S_ERROR) return (S_ERROR); rsp->rel_rtype = R_386_TLS_TPOFF; - if (add_outrel((FLG_REL_GOT | FLG_REL_STLS), + if (ld_add_outrel((FLG_REL_GOT | FLG_REL_STLS), rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_rtype = rtype; } if (IS_TLS_IE(rtype)) - return (add_actrel(FLG_REL_STLS, rsp, ofl)); + return (ld_add_actrel(FLG_REL_STLS, rsp, ofl)); /* * If (GD or LD) reference models - fixups * are required. */ - return (add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS), + return (ld_add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS), rsp, ofl)); } /* * LE access model */ if (IS_TLS_LE(rtype) || (rtype == R_386_TLS_LDO_32)) - return (add_actrel(FLG_REL_STLS, rsp, ofl)); + return (ld_add_actrel(FLG_REL_STLS, rsp, ofl)); - return (add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS), rsp, ofl)); + return (ld_add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS), + rsp, ofl)); } /* @@ -1328,8 +1325,8 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) * will work here. */ if (IS_TLS_IE(rtype) || IS_TLS_LE(rtype)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSIE), - conv_reloc_386_type_str(rsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSIE), + conv_reloc_386_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname)); return (S_ERROR); @@ -1339,8 +1336,8 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) * LD access mode can only bind to local symbols. */ if (!local && IS_TLS_LD(rtype)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBND), - conv_reloc_386_type_str(rsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSBND), + conv_reloc_386_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname), sdp->sd_file->ifl_name); @@ -1348,37 +1345,38 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) } - if (IS_TLS_LD(rtype) && ((gnp = find_gotndx(&(sdp->sd_GOTndxs), + if (IS_TLS_LD(rtype) && ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), GOT_REF_TLSLD, ofl, 0)) == 0)) { - if (assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSLD, + if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSLD, ofl, rsp, sdp) == S_ERROR) return (S_ERROR); rflags = FLG_REL_GOT | FLG_REL_MTLS; if (local) rflags |= FLG_REL_SCNNDX; rsp->rel_rtype = R_386_TLS_DTPMOD32; - if (add_outrel(rflags, rsp, ofl) == S_ERROR) + if (ld_add_outrel(rflags, rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_rtype = rtype; - } else if (IS_TLS_GD(rtype) && ((gnp = find_gotndx(&(sdp->sd_GOTndxs), - GOT_REF_TLSGD, ofl, 0)) == 0)) { - if (assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSGD, + } else if (IS_TLS_GD(rtype) && + ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), GOT_REF_TLSGD, + ofl, 0)) == 0)) { + if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSGD, ofl, rsp, sdp) == S_ERROR) return (S_ERROR); rflags = FLG_REL_GOT | FLG_REL_DTLS; if (local) rflags |= FLG_REL_SCNNDX; rsp->rel_rtype = R_386_TLS_DTPMOD32; - if (add_outrel(rflags, rsp, ofl) == S_ERROR) + if (ld_add_outrel(rflags, rsp, ofl) == S_ERROR) return (S_ERROR); if (local == TRUE) { rsp->rel_rtype = R_386_TLS_DTPOFF32; - if (add_actrel((FLG_REL_GOT | FLG_REL_DTLS), rsp, + if (ld_add_actrel((FLG_REL_GOT | FLG_REL_DTLS), rsp, ofl) == S_ERROR) return (S_ERROR); } else { rsp->rel_rtype = R_386_TLS_DTPOFF32; - if (add_outrel((FLG_REL_GOT | FLG_REL_DTLS), rsp, + if (ld_add_outrel((FLG_REL_GOT | FLG_REL_DTLS), rsp, ofl) == S_ERROR) return (S_ERROR); } @@ -1392,13 +1390,13 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) if ((rtype == R_386_TLS_GD_PLT) || (rtype == R_386_TLS_LDM_PLT)) { Sym_desc * tlsgetsym; - if ((tlsgetsym = sym_add_u(MSG_ORIG(MSG_SYM_TLSGETADDR_UU), + if ((tlsgetsym = ld_sym_add_u(MSG_ORIG(MSG_SYM_TLSGETADDR_UU), ofl)) == (Sym_desc *)S_ERROR) return (S_ERROR); rsp->rel_sym = tlsgetsym; rsp->rel_sname = tlsgetsym->sd_name; rsp->rel_rtype = R_386_PLT32; - if (reloc_plt(rsp, ofl) == S_ERROR) + if (ld_reloc_plt(rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_sym = sdp; rsp->rel_sname = sdp->sd_name; @@ -1407,14 +1405,14 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) } if (IS_TLS_LD(rtype)) - return (add_actrel(FLG_REL_MTLS, rsp, ofl)); + return (ld_add_actrel(FLG_REL_MTLS, rsp, ofl)); - return (add_actrel(FLG_REL_DTLS, rsp, ofl)); + return (ld_add_actrel(FLG_REL_DTLS, rsp, ofl)); } /* ARGSUSED3 */ Gotndx * -find_gotndx(List * lst, Gotref gref, Ofl_desc * ofl, Rel_desc * rdesc) +ld_find_gotndx(List * lst, Gotref gref, Ofl_desc * ofl, Rel_desc * rdesc) { Listnode * lnp; Gotndx * gnp; @@ -1430,7 +1428,7 @@ find_gotndx(List * lst, Gotref gref, Ofl_desc * ofl, Rel_desc * rdesc) } Xword -calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl) +ld_calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl) { Os_desc *osp = ofl->ofl_osgot; Sym_desc *sdp = rdesc->rel_sym; @@ -1447,7 +1445,7 @@ calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl) else gref = GOT_REF_GENERIC; - gnp = find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, 0); + gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, 0); assert(gnp); gotndx = (Xword)gnp->gn_gotndx; @@ -1462,7 +1460,7 @@ calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl) /* ARGSUSED4 */ uintptr_t -assign_gotndx(List * lst, Gotndx * pgnp, Gotref gref, Ofl_desc * ofl, +ld_assign_gotndx(List * lst, Gotndx * pgnp, Gotref gref, Ofl_desc * ofl, Rel_desc * rsp, Sym_desc * sdp) { Gotndx *gnp; @@ -1494,9 +1492,8 @@ assign_gotndx(List * lst, Gotndx * pgnp, Gotref gref, Ofl_desc * ofl, return (1); } - void -assign_plt_ndx(Sym_desc * sdp, Ofl_desc *ofl) +ld_assign_plt_ndx(Sym_desc * sdp, Ofl_desc *ofl) { sdp->sd_aux->sa_PLTndx = 1 + ofl->ofl_pltcnt++; sdp->sd_aux->sa_PLTGOTndx = ofl->ofl_gotcnt++; @@ -1507,12 +1504,12 @@ assign_plt_ndx(Sym_desc * sdp, Ofl_desc *ofl) * Initializes .got[0] with the _DYNAMIC symbol value. */ uintptr_t -fillin_gotplt1(Ofl_desc * ofl) +ld_fillin_gotplt(Ofl_desc * ofl) { if (ofl->ofl_osgot) { Sym_desc * sdp; - if ((sdp = sym_find(MSG_ORIG(MSG_SYM_DYNAMIC_U), + if ((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_DYNAMIC_U), SYM_NOHASH, 0, ofl)) != NULL) { uchar_t *genptr = ((uchar_t *) ofl->ofl_osgot->os_outdata->d_buf + @@ -1569,15 +1566,3 @@ fillin_gotplt1(Ofl_desc * ofl) } return (1); } - -/* - * Return got[0]. - */ -Addr -fillin_gotplt2(Ofl_desc * ofl) -{ - if (ofl->ofl_osgot) - return (ofl->ofl_osgot->os_shdr->sh_addr); - else - return (0); -} diff --git a/usr/src/cmd/sgs/libld/sparc/machrel.c b/usr/src/cmd/sgs/libld/common/machrel.sparc.c index 52fd389425..ced67b0f65 100644 --- a/usr/src/cmd/sgs/libld/sparc/machrel.c +++ b/usr/src/cmd/sgs/libld/common/machrel.sparc.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. @@ -34,8 +33,8 @@ #include <sys/elf_SPARC.h> #include <debug.h> #include <reloc.h> -#include <msg.h> -#include <_libld.h> +#include "msg.h" +#include "_libld.h" /* * Local Variable Definitions @@ -44,7 +43,7 @@ static Sword neggotoffset = 0; /* off. of GOT table from GOT symbol */ static Sword smlgotcnt = M_GOT_XNumber; /* no. of small GOT symbols */ Word -init_rel(Rel_desc *reld, void *reloc) +ld_init_rel(Rel_desc *reld, void *reloc) { Rela * rela = (Rela *)reloc; @@ -60,9 +59,9 @@ init_rel(Rel_desc *reld, void *reloc) } void -mach_eflags(Ehdr *ehdr, Ofl_desc *ofl) +ld_mach_eflags(Ehdr *ehdr, Ofl_desc *ofl) { - Word eflags = ofl->ofl_e_flags; + Word eflags = ofl->ofl_dehdr->e_flags; Word memopt1, memopt2; static int firstpass; @@ -71,7 +70,7 @@ mach_eflags(Ehdr *ehdr, Ofl_desc *ofl) */ if ((ehdr->e_machine == EM_SPARC32PLUS) && (ehdr->e_flags & EF_SPARC_32PLUS)) - ofl->ofl_e_machine = EM_SPARC32PLUS; + ofl->ofl_dehdr->e_machine = EM_SPARC32PLUS; /* * On the first pass, we don't yet have a memory model to compare @@ -79,7 +78,7 @@ mach_eflags(Ehdr *ehdr, Ofl_desc *ofl) * passes will do the comparison described below. */ if (firstpass == 0) { - ofl->ofl_e_flags |= ehdr->e_flags; + ofl->ofl_dehdr->e_flags |= ehdr->e_flags; firstpass++; return; } @@ -108,11 +107,11 @@ mach_eflags(Ehdr *ehdr, Ofl_desc *ofl) else eflags |= EF_SPARCV9_RMO; - ofl->ofl_e_flags = eflags; + ofl->ofl_dehdr->e_flags = eflags; } void -mach_make_dynamic(Ofl_desc *ofl, size_t *cnt) +ld_mach_make_dynamic(Ofl_desc *ofl, size_t *cnt) { if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) { /* @@ -124,21 +123,22 @@ mach_make_dynamic(Ofl_desc *ofl, size_t *cnt) } void -mach_update_odynamic(Ofl_desc * ofl, Dyn ** dyn) +ld_mach_update_odynamic(Ofl_desc * ofl, Dyn ** dyn) { - if (!(ofl->ofl_flags & FLG_OF_RELOBJ)) { - if (ofl->ofl_pltcnt) { - (*dyn)->d_tag = DT_PLTGOT; - (*dyn)->d_un.d_ptr = fillin_gotplt2(ofl); - (*dyn)++; - } + if (((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) && ofl->ofl_pltcnt) { + (*dyn)->d_tag = DT_PLTGOT; + if (ofl->ofl_osplt) + (*dyn)->d_un.d_ptr = ofl->ofl_osplt->os_shdr->sh_addr; + else + (*dyn)->d_un.d_ptr = 0; + (*dyn)++; } } #if defined(_ELF64) Xword -calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl) +ld_calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl) { Xword value, pltndx, farpltndx; @@ -419,7 +419,7 @@ plt_entry(Ofl_desc *ofl, Xword pltndx, Xword *roffset, Sxword *raddend) #else /* Elf 32 */ Xword -calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl) +ld_calc_plt_addr(Sym_desc *sdp, Ofl_desc *ofl) { Xword value, pltndx; @@ -486,7 +486,7 @@ plt_entry(Ofl_desc * ofl, Xword pltndx, Xword *roffset, Sxword *raddend) #endif /* _ELF64 */ uintptr_t -perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) +ld_perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) { Os_desc * relosp, * osp = 0; Xword ndx, roffset, value; @@ -515,8 +515,8 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) ELF_R_TYPE_INFO(orsp->rel_typedata, orsp->rel_rtype)); rea.r_offset = orsp->rel_roffset; rea.r_addend = raddend; - DBG_CALL(Dbg_reloc_out(M_MACH, SHT_RELA, &rea, - orsp->rel_sname, relosp->os_name)); + DBG_CALL(Dbg_reloc_out(ofl, ELF_DBG_LD, SHT_RELA, &rea, + relosp->os_name, orsp->rel_sname)); assert(relosp->os_szoutrels <= relosp->os_shdr->sh_size); (void) memcpy((relbits + relosp->os_szoutrels), @@ -533,7 +533,7 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) if (orsp->rel_isdesc && ((orsp->rel_flags & (FLG_REL_GOT | FLG_REL_BSS | FLG_REL_PLT | FLG_REL_NOINFO)) == 0) && (orsp->rel_isdesc->is_flags & FLG_IS_DISCARD)) { - DBG_CALL(Dbg_reloc_discard(M_MACH, orsp)); + DBG_CALL(Dbg_reloc_discard(ofl->ofl_lml, M_MACH, orsp)); return (1); } @@ -542,7 +542,7 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) * table, adjust the relocation entries. */ if (orsp->rel_move) - adj_movereloc(ofl, orsp); + ld_adj_movereloc(ofl, orsp); /* * If this is a relocation against a section then we need to adjust the @@ -552,11 +552,11 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) if (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION) { if (ofl->ofl_parsym.head && (sdp->sd_isc->is_flags & FLG_IS_RELUPD) && - (psym = am_I_partial(orsp, orsp->rel_raddend))) { + (psym = ld_am_I_partial(orsp, orsp->rel_raddend))) { /* * If the symbol is moved, adjust the value */ - DBG_CALL(Dbg_move_outsctadj(psym)); + DBG_CALL(Dbg_move_outsctadj(ofl->ofl_lml, psym)); sectmoved = 1; if (ofl->ofl_flags & FLG_OF_RELOBJ) raddend = psym->sd_sym->st_value; @@ -581,7 +581,8 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) if (orsp->rel_flags & FLG_REL_GOT) { osp = ofl->ofl_osgot; - roffset = calc_got_offset(orsp, ofl); + roffset = ld_calc_got_offset(orsp, ofl); + } else if (orsp->rel_flags & FLG_REL_PLT) { osp = ofl->ofl_osplt; plt_entry(ofl, sdp->sd_aux->sa_PLTndx, &roffset, &raddend); @@ -628,14 +629,14 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) * alignment requirements of the relocation being processed. */ rep = &reloc_table[orsp->rel_rtype]; - if (((flags & FLG_OF_RELOBJ) || - !(dtflags1 & DF_1_NORELOC)) && + if (((flags & FLG_OF_RELOBJ) || !(dtflags1 & DF_1_NORELOC)) && !(rep->re_flags & FLG_RE_UNALIGN)) { if (((rep->re_fsize == 2) && (roffset & 0x1)) || ((rep->re_fsize == 4) && (roffset & 0x3)) || ((rep->re_fsize == 8) && (roffset & 0x7))) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NONALIGN), - conv_reloc_SPARC_type_str(orsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_REL_NONALIGN), + conv_reloc_SPARC_type(orsp->rel_rtype), orsp->rel_isdesc->is_file->ifl_name, demangle(orsp->rel_sname), EC_XWORD(roffset)); return (S_ERROR); @@ -690,8 +691,8 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) orsp->rel_rtype)); rea.r_offset = roffset; rea.r_addend = raddend; - DBG_CALL(Dbg_reloc_out(M_MACH, SHT_RELA, &rea, orsp->rel_sname, - relosp->os_name)); + DBG_CALL(Dbg_reloc_out(ofl, ELF_DBG_LD, SHT_RELA, &rea, relosp->os_name, + orsp->rel_sname)); /* * Assert we haven't walked off the end of our relocation table. @@ -706,7 +707,7 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) * Determine if this relocation is against a non-writable, allocatable * section. If so we may need to provide a text relocation diagnostic. */ - reloc_remain_entry(orsp, osp, ofl); + ld_reloc_remain_entry(orsp, osp, ofl); return (1); } @@ -714,7 +715,7 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) /* * Sparc Instructions for TLS processing */ -#if defined(_ELF64) +#if defined(_ELF64) #define TLS_GD_IE_LD 0xd0580000 /* ldx [%g0 + %g0], %o0 */ #else #define TLS_GD_IE_LD 0xd0000000 /* ld [%g0 + %g0], %o0 */ @@ -736,9 +737,8 @@ perform_outreloc(Rel_desc * orsp, Ofl_desc * ofl) #define REG_G7 7 /* %g7 register */ - -Fixupret -tls_fixups(Rel_desc *arsp) +static Fixupret +tls_fixups(Ofl_desc *ofl, Rel_desc *arsp) { Sym_desc *sdp = arsp->rel_sym; Word rtype = arsp->rel_rtype; @@ -754,40 +754,33 @@ tls_fixups(Rel_desc *arsp) */ switch (rtype) { case R_SPARC_TLS_GD_HI22: - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_SPARC_TLS_IE_HI22, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, + rtype, R_SPARC_TLS_IE_HI22, arsp->rel_roffset, + sdp->sd_name)); arsp->rel_rtype = R_SPARC_TLS_IE_HI22; return (FIX_RELOC); + case R_SPARC_TLS_GD_LO10: - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_SPARC_TLS_IE_LO10, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, + rtype, R_SPARC_TLS_IE_LO10, arsp->rel_roffset, + sdp->sd_name)); arsp->rel_rtype = R_SPARC_TLS_IE_LO10; return (FIX_RELOC); + case R_SPARC_TLS_GD_ADD: - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_SPARC_NONE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, + rtype, R_SPARC_NONE, arsp->rel_roffset, + sdp->sd_name)); *offset = (TLS_GD_IE_LD | - (*offset & (FM3_REG_MSK_RS1 | - FM3_REG_MSK_RS2))); + (*offset & (FM3_REG_MSK_RS1 | FM3_REG_MSK_RS2))); return (FIX_DONE); + case R_SPARC_TLS_GD_CALL: - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_SPARC_NONE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, + rtype, R_SPARC_NONE, arsp->rel_roffset, + sdp->sd_name)); *offset = TLS_GD_IE_ADD; return (FIX_DONE); - } return (FIX_RELOC); } @@ -799,21 +792,17 @@ tls_fixups(Rel_desc *arsp) case R_SPARC_TLS_IE_HI22: case R_SPARC_TLS_GD_HI22: case R_SPARC_TLS_LDO_HIX22: - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_SPARC_TLS_LE_HIX22, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype, + R_SPARC_TLS_LE_HIX22, arsp->rel_roffset, sdp->sd_name)); arsp->rel_rtype = R_SPARC_TLS_LE_HIX22; return (FIX_RELOC); + case R_SPARC_TLS_LDO_LOX10: - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_SPARC_TLS_LE_LOX10, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype, + R_SPARC_TLS_LE_LOX10, arsp->rel_roffset, sdp->sd_name)); arsp->rel_rtype = R_SPARC_TLS_LE_LOX10; return (FIX_RELOC); + case R_SPARC_TLS_IE_LO10: case R_SPARC_TLS_GD_LO10: /* @@ -828,15 +817,13 @@ tls_fixups(Rel_desc *arsp) * * xor r1, %lox(x), r2 */ - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_SPARC_TLS_LE_LOX10, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype, + R_SPARC_TLS_LE_LOX10, arsp->rel_roffset, sdp->sd_name)); *offset = TLS_GD_LE_XOR | - (*offset & (FM3_REG_MSK_RS1 | FM3_REG_MSK_RD)); + (*offset & (FM3_REG_MSK_RS1 | FM3_REG_MSK_RD)); arsp->rel_rtype = R_SPARC_TLS_LE_LOX10; return (FIX_RELOC); + case R_SPARC_TLS_IE_LD: case R_SPARC_TLS_IE_LDX: /* @@ -847,14 +834,12 @@ tls_fixups(Rel_desc *arsp) * * mov r2, r3 (or %g0, r2, r3) */ - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_SPARC_NONE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype, + R_SPARC_NONE, arsp->rel_roffset, sdp->sd_name)); *offset = ((*offset) & (FM3_REG_MSK_RS2 | FM3_REG_MSK_RD)) | - TLS_IE_LE_OR; + TLS_IE_LE_OR; return (FIX_DONE); + case R_SPARC_TLS_LDO_ADD: case R_SPARC_TLS_GD_ADD: /* @@ -866,32 +851,25 @@ tls_fixups(Rel_desc *arsp) * * add %g7, r2, r3 */ - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_SPARC_NONE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype, + R_SPARC_NONE, arsp->rel_roffset, sdp->sd_name)); *offset = *offset & (~FM3_REG_MSK_RS1); *offset = *offset | (REG_G7 << 14); return (FIX_DONE); + case R_SPARC_TLS_LDM_CALL: - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_SPARC_NONE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype, + R_SPARC_NONE, arsp->rel_roffset, sdp->sd_name)); *offset = TLS_LD_LE_CLRO0; return (FIX_DONE); + case R_SPARC_TLS_LDM_HI22: case R_SPARC_TLS_LDM_LO10: case R_SPARC_TLS_LDM_ADD: case R_SPARC_TLS_IE_ADD: case R_SPARC_TLS_GD_CALL: - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_SPARC_NONE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype, + R_SPARC_NONE, arsp->rel_roffset, sdp->sd_name)); *offset = M_NOP; return (FIX_DONE); } @@ -900,8 +878,8 @@ tls_fixups(Rel_desc *arsp) #define GOTOP_ADDINST 0x80000000 /* add %g0, %g0, %g0 */ -Fixupret -gotop_fixups(Rel_desc *arsp) +static Fixupret +gotop_fixups(Ofl_desc *ofl, Rel_desc *arsp) { Sym_desc *sdp = arsp->rel_sym; Word rtype = arsp->rel_rtype; @@ -910,21 +888,17 @@ gotop_fixups(Rel_desc *arsp) switch (rtype) { case R_SPARC_GOTDATA_OP_HIX22: - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_SPARC_GOTDATA_HIX22, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype, + R_SPARC_GOTDATA_HIX22, arsp->rel_roffset, sdp->sd_name)); arsp->rel_rtype = R_SPARC_GOTDATA_HIX22; return (FIX_RELOC); + case R_SPARC_GOTDATA_OP_LOX10: - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_SPARC_GOTDATA_LOX10, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype, + R_SPARC_GOTDATA_LOX10, arsp->rel_roffset, sdp->sd_name)); arsp->rel_rtype = R_SPARC_GOTDATA_LOX10; return (FIX_RELOC); + case R_SPARC_GOTDATA_OP: /* * Current instruction: @@ -934,18 +908,14 @@ gotop_fixups(Rel_desc *arsp) * * add r1, r2, r3 */ - DBG_CALL(Dbg_reloc_transition(M_MACH, - rtype, - R_SPARC_NONE, - arsp->rel_roffset, - sdp->sd_name)); + DBG_CALL(Dbg_reloc_transition(ofl->ofl_lml, M_MACH, rtype, + R_SPARC_NONE, arsp->rel_roffset, sdp->sd_name)); offset = (uint_t *)(uintptr_t)(arsp->rel_roffset + - _elf_getxoff(arsp->rel_isdesc->is_indata) + - (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf); + _elf_getxoff(arsp->rel_isdesc->is_indata) + + (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf); *offset = ((*offset) & (FM3_REG_MSK_RS1 | - FM3_REG_MSK_RS2 | FM3_REG_MSK_RD)) | - GOTOP_ADDINST; + FM3_REG_MSK_RS2 | FM3_REG_MSK_RD)) | GOTOP_ADDINST; return (FIX_DONE); } /* @@ -955,15 +925,17 @@ gotop_fixups(Rel_desc *arsp) ifl_name = arsp->rel_isdesc->is_file->ifl_name; else ifl_name = MSG_INTL(MSG_STR_NULL); - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_BADGOTFIX), - conv_reloc_SPARC_type_str(arsp->rel_rtype), + + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_BADGOTFIX), + conv_reloc_SPARC_type(arsp->rel_rtype), ifl_name, demangle(arsp->rel_sname)); + assert(0); return (FIX_ERROR); } uintptr_t -do_activerelocs(Ofl_desc *ofl) +ld_do_activerelocs(Ofl_desc *ofl) { Rel_desc *arsp; Rel_cache *rcp; @@ -972,7 +944,7 @@ do_activerelocs(Ofl_desc *ofl) Word flags = ofl->ofl_flags; Word dtflags1 = ofl->ofl_dtflags_1; - DBG_CALL(Dbg_reloc_doactiverel()); + DBG_CALL(Dbg_reloc_doact_title(ofl->ofl_lml)); /* * Process active relocations. */ @@ -995,7 +967,8 @@ do_activerelocs(Ofl_desc *ofl) ((arsp->rel_flags & (FLG_REL_GOT | FLG_REL_BSS | FLG_REL_PLT | FLG_REL_NOINFO)) == 0)) { - DBG_CALL(Dbg_reloc_discard(M_MACH, arsp)); + DBG_CALL(Dbg_reloc_discard(ofl->ofl_lml, + M_MACH, arsp)); continue; } @@ -1005,7 +978,7 @@ do_activerelocs(Ofl_desc *ofl) if (arsp->rel_flags & FLG_REL_TLSFIX) { Fixupret ret; - if ((ret = tls_fixups(arsp)) == FIX_ERROR) + if ((ret = tls_fixups(ofl, arsp)) == FIX_ERROR) return (S_ERROR); if (ret == FIX_DONE) continue; @@ -1017,7 +990,8 @@ do_activerelocs(Ofl_desc *ofl) if (arsp->rel_flags & FLG_REL_GOTFIX) { Fixupret ret; - if ((ret = gotop_fixups(arsp)) == FIX_ERROR) + if ((ret = + gotop_fixups(ofl, arsp)) == FIX_ERROR) return (S_ERROR); if (ret == FIX_DONE) continue; @@ -1028,7 +1002,7 @@ do_activerelocs(Ofl_desc *ofl) * expanded move table, adjust the relocation entries. */ if (arsp->rel_move) - adj_movereloc(ofl, arsp); + ld_adj_movereloc(ofl, arsp); sdp = arsp->rel_sym; refaddr = arsp->rel_roffset + @@ -1046,7 +1020,7 @@ do_activerelocs(Ofl_desc *ofl) * is based off of that sections position. */ if ((sdp->sd_isc->is_flags & FLG_IS_RELUPD) && - (sym = am_I_partial(arsp, + (sym = ld_am_I_partial(arsp, arsp->rel_roffset))) { /* * If the symbol is moved, @@ -1099,7 +1073,7 @@ do_activerelocs(Ofl_desc *ofl) */ if (IS_PLT(arsp->rel_rtype)) { if (sdp->sd_aux && sdp->sd_aux->sa_PLTndx) - value = calc_plt_addr(sdp, ofl); + value = ld_calc_plt_addr(sdp, ofl); } /* @@ -1144,7 +1118,7 @@ do_activerelocs(Ofl_desc *ofl) else gref = GOT_REF_GENERIC; - gnp = find_gotndx(&(sdp->sd_GOTndxs), gref, + gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, arsp); assert(gnp); @@ -1163,7 +1137,8 @@ do_activerelocs(Ofl_desc *ofl) R2addr = R1addr + (uintptr_t) arsp->rel_osdesc->os_outdata->d_buf; - DBG_CALL(Dbg_reloc_doact(M_MACH, + DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml, + ELF_DBG_LD, M_MACH, SHT_RELA, arsp->rel_rtype, R1addr, value, arsp->rel_sname, arsp->rel_osdesc)); @@ -1194,7 +1169,7 @@ do_activerelocs(Ofl_desc *ofl) else if (arsp->rel_flags & FLG_REL_MTLS) gref = GOT_REF_TLSLD; - gnp = find_gotndx(&(sdp->sd_GOTndxs), gref, + gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, arsp); assert(gnp); @@ -1204,7 +1179,7 @@ do_activerelocs(Ofl_desc *ofl) ((flags & FLG_OF_RELOBJ) == 0)) { Gotndx *gnp; - gnp = find_gotndx(&(sdp->sd_GOTndxs), + gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), GOT_REF_GENERIC, ofl, arsp); assert(gnp); @@ -1239,8 +1214,9 @@ do_activerelocs(Ofl_desc *ofl) * see this. */ if (arsp->rel_isdesc->is_indata->d_buf == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_EMPTYSEC), - conv_reloc_SPARC_type_str(arsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_REL_EMPTYSEC), + conv_reloc_SPARC_type(arsp->rel_rtype), ifl_name, demangle(arsp->rel_sname), arsp->rel_isdesc->is_name); return (S_ERROR); @@ -1254,28 +1230,29 @@ do_activerelocs(Ofl_desc *ofl) is_indata)); /*LINTED*/ - DBG_CALL(Dbg_reloc_doact(M_MACH, arsp->rel_rtype, - (Xword)(uintptr_t)addr, value, arsp->rel_sname, - arsp->rel_osdesc)); + DBG_CALL(Dbg_reloc_doact(ofl->ofl_lml, ELF_DBG_LD, + M_MACH, SHT_RELA, arsp->rel_rtype, EC_NATPTR(addr), + value, arsp->rel_sname, arsp->rel_osdesc)); addr += (uintptr_t)arsp->rel_osdesc->os_outdata->d_buf; - if ((((uintptr_t)addr - (uintptr_t)ofl->ofl_ehdr) > + if ((((uintptr_t)addr - (uintptr_t)ofl->ofl_nehdr) > ofl->ofl_size) || (arsp->rel_roffset > arsp->rel_osdesc->os_shdr->sh_size)) { int class; if (((uintptr_t)addr - - (uintptr_t)ofl->ofl_ehdr) > ofl->ofl_size) + (uintptr_t)ofl->ofl_nehdr) > ofl->ofl_size) class = ERR_FATAL; else class = ERR_WARNING; - eprintf(class, MSG_INTL(MSG_REL_INVALOFFSET), - conv_reloc_SPARC_type_str(arsp->rel_rtype), + eprintf(ofl->ofl_lml, class, + MSG_INTL(MSG_REL_INVALOFFSET), + conv_reloc_SPARC_type(arsp->rel_rtype), ifl_name, arsp->rel_isdesc->is_name, demangle(arsp->rel_sname), EC_ADDR((uintptr_t)addr - - (uintptr_t)ofl->ofl_ehdr)); + (uintptr_t)ofl->ofl_nehdr)); if (class == ERR_FATAL) { return_code = S_ERROR; @@ -1290,7 +1267,8 @@ do_activerelocs(Ofl_desc *ofl) if ((flags & FLG_OF_RELOBJ) || !(dtflags1 & DF_1_NORELOC)) { if (do_reloc((uchar_t)arsp->rel_rtype, addr, - &value, arsp->rel_sname, ifl_name) == 0) + &value, arsp->rel_sname, ifl_name, + ofl->ofl_lml) == 0) return_code = S_ERROR; } } @@ -1299,7 +1277,7 @@ do_activerelocs(Ofl_desc *ofl) } uintptr_t -add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) +ld_add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) { Rel_desc *orsp; Rel_cache *rcp; @@ -1329,8 +1307,9 @@ add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) */ if ((rtype == R_SPARC_HIPLT22) || (rtype == R_SPARC_LOPLT10)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_UNRELREL), - conv_reloc_SPARC_type_str(rsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_REL_UNRELREL), + conv_reloc_SPARC_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname)); return (S_ERROR); @@ -1345,8 +1324,9 @@ add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) */ if ((rtype == R_SPARC_H44) || (rtype == R_SPARC_M44) || (rtype == R_SPARC_L44)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_SHOBJABS44), - conv_reloc_SPARC_type_str(rsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_REL_SHOBJABS44), + conv_reloc_SPARC_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname)); return (S_ERROR); @@ -1448,7 +1428,7 @@ add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) if (orsp->rel_rtype == M_R_RELATIVE) ofl->ofl_relocrelcnt++; -#ifdef _ELF64 +#if defined(_ELF64) /* * When building a 64-bit object any R_SPARC_WDISP30 relocation is given * a plt padding entry, unless we're building a relocatable object @@ -1482,9 +1462,10 @@ add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) ofl->ofl_dtflags_1 |= DF_1_DISPRELPND; if (ofl->ofl_flags & FLG_OF_VERBOSE) - disp_errmsg(MSG_INTL(MSG_REL_DISPREL4), orsp, ofl); + ld_disp_errmsg(MSG_INTL(MSG_REL_DISPREL4), orsp, ofl); } - DBG_CALL(Dbg_reloc_ors_entry(M_MACH, orsp)); + DBG_CALL(Dbg_reloc_ors_entry(ofl->ofl_lml, ELF_DBG_LD, SHT_RELA, + M_MACH, orsp)); return (1); } @@ -1500,7 +1481,7 @@ add_outrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) * appropriate. */ uintptr_t -reloc_register(Rel_desc * rsp, Is_desc * isp, Ofl_desc * ofl) +ld_reloc_register(Rel_desc * rsp, Is_desc * isp, Ofl_desc * ofl) { if (ofl->ofl_flags & FLG_OF_MULDEFS) { Ifl_desc * ifl = isp->is_file; @@ -1521,14 +1502,14 @@ reloc_register(Rel_desc * rsp, Is_desc * isp, Ofl_desc * ofl) if (sdp && (sdp->sd_file != ifl)) return (1); } - return (add_outrel((rsp->rel_flags | FLG_REL_REG), rsp, ofl)); + return (ld_add_outrel((rsp->rel_flags | FLG_REL_REG), rsp, ofl)); } /* * process relocation for a LOCAL symbol */ uintptr_t -reloc_local(Rel_desc * rsp, Ofl_desc * ofl) +ld_reloc_local(Rel_desc * rsp, Ofl_desc * ofl) { Word flags = ofl->ofl_flags; Sym_desc *sdp = rsp->rel_sym; @@ -1558,11 +1539,11 @@ reloc_local(Rel_desc * rsp, Ofl_desc * ofl) if ((rsp->rel_rtype != R_SPARC_32) && (rsp->rel_rtype != R_SPARC_PLT32) && (rsp->rel_rtype != R_SPARC_64)) - return (add_outrel((FLG_REL_SCNNDX | FLG_REL_ADVAL), + return (ld_add_outrel((FLG_REL_SCNNDX | FLG_REL_ADVAL), rsp, ofl)); rsp->rel_rtype = R_SPARC_RELATIVE; - if (add_outrel(FLG_REL_ADVAL, rsp, ofl) == S_ERROR) + if (ld_add_outrel(FLG_REL_ADVAL, rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_rtype = ortype; return (1); @@ -1595,8 +1576,9 @@ reloc_local(Rel_desc * rsp, Ofl_desc * ofl) if (rsp->rel_osdesc && (rsp->rel_osdesc->os_shdr->sh_type == SHT_SUNW_ANNOTATE)) return (0); - (void) eprintf(ERR_WARNING, MSG_INTL(MSG_REL_EXTERNSYM), - conv_reloc_SPARC_type_str(rsp->rel_rtype), + (void) eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_REL_EXTERNSYM), + conv_reloc_SPARC_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname), rsp->rel_osdesc->os_name); return (1); @@ -1605,11 +1587,11 @@ reloc_local(Rel_desc * rsp, Ofl_desc * ofl) /* * Perform relocation. */ - return (add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(NULL, rsp, ofl)); } uintptr_t -reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) +ld_reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) { Word rtype = rsp->rel_rtype; @@ -1620,7 +1602,7 @@ reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) */ if (rtype == R_SPARC_GOTDATA_OP) return (1); - return (reloc_GOT_relative(local, rsp, ofl)); + return (ld_reloc_GOT_relative(local, rsp, ofl)); } /* @@ -1630,11 +1612,11 @@ reloc_GOTOP(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) * R_*_GOTDATA_OP_LOX10 -> R_*_GOTDATA_LOX10 * R_*_GOTDATA_OP -> instruction fixup */ - return (add_actrel(FLG_REL_GOTFIX, rsp, ofl)); + return (ld_add_actrel(FLG_REL_GOTFIX, rsp, ofl)); } uintptr_t -reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) +ld_reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) { Word rtype = rsp->rel_rtype; Sym_desc *sdp = rsp->rel_sym; @@ -1647,8 +1629,8 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) */ if ((ofl->ofl_flags & (FLG_OF_STATIC | FLG_OF_EXEC)) == (FLG_OF_STATIC | FLG_OF_EXEC)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSSTAT), - conv_reloc_SPARC_type_str(rsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSSTAT), + conv_reloc_SPARC_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname)); return (S_ERROR); @@ -1659,11 +1641,12 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) * are illegal. */ if (ELF_ST_TYPE(sdp->sd_sym->st_info) != STT_TLS) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBADSYM), - conv_reloc_SPARC_type_str(rsp->rel_rtype), - rsp->rel_isdesc->is_file->ifl_name, - demangle(rsp->rel_sname), - conv_info_type_str(ofl->ofl_e_machine, + Ifl_desc *ifl = rsp->rel_isdesc->is_file; + + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSBADSYM), + conv_reloc_SPARC_type(rsp->rel_rtype), + ifl->ifl_name, demangle(rsp->rel_sname), + conv_sym_info_type(ifl->ifl_ehdr->e_machine, ELF_ST_TYPE(sdp->sd_sym->st_info))); return (S_ERROR); } @@ -1698,8 +1681,9 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) * the current object. */ if (IS_TLS_LD(rtype) || IS_TLS_LE(rtype)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBND), - conv_reloc_SPARC_type_str(rsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_REL_TLSBND), + conv_reloc_SPARC_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname), sdp->sd_file->ifl_name); @@ -1713,33 +1697,33 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) (rtype == R_SPARC_TLS_GD_LO10) || (rtype == R_SPARC_TLS_IE_HI22) || (rtype == R_SPARC_TLS_IE_LO10)) && - ((gnp = find_gotndx(&(sdp->sd_GOTndxs), + ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), GOT_REF_TLSIE, ofl, rsp)) == 0)) { - if (assign_gotndx(&(sdp->sd_GOTndxs), gnp, + if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSIE, ofl, rsp, sdp) == S_ERROR) return (S_ERROR); rsp->rel_rtype = M_R_TPOFF; - if (add_outrel((FLG_REL_GOT | FLG_REL_STLS), + if (ld_add_outrel((FLG_REL_GOT | FLG_REL_STLS), rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_rtype = rtype; } if (IS_TLS_IE(rtype)) - return (add_actrel(FLG_REL_STLS, rsp, ofl)); + return (ld_add_actrel(FLG_REL_STLS, rsp, ofl)); /* * If (GD) reference models - fixups * are required. */ - return (add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS), + return (ld_add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS), rsp, ofl)); } /* * LE access model */ if (IS_TLS_LE(rtype)) - return (add_actrel(FLG_REL_STLS, rsp, ofl)); + return (ld_add_actrel(FLG_REL_STLS, rsp, ofl)); /* * When building a executable - these relocations @@ -1748,7 +1732,8 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) if (rtype == R_SPARC_TLS_IE_ADD) return (1); - return (add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS), rsp, ofl)); + return (ld_add_actrel((FLG_REL_TLSFIX | FLG_REL_STLS), + rsp, ofl)); } /* @@ -1760,8 +1745,8 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) * will work here. */ if (IS_TLS_IE(rtype) || IS_TLS_LE(rtype)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSIE), - conv_reloc_SPARC_type_str(rsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSIE), + conv_reloc_SPARC_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname)); return (S_ERROR); @@ -1771,8 +1756,8 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) * LD access mode can only bind to local symbols. */ if (!local && IS_TLS_LD(rtype)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_TLSBND), - conv_reloc_SPARC_type_str(rsp->rel_rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_TLSBND), + conv_reloc_SPARC_type(rsp->rel_rtype), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname), sdp->sd_file->ifl_name); @@ -1792,9 +1777,9 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) */ if (((rtype == R_SPARC_TLS_LDM_HI22) || (rtype == R_SPARC_TLS_LDM_LO10)) && - ((gnp = find_gotndx(&(sdp->sd_GOTndxs), + ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), GOT_REF_TLSLD, ofl, rsp)) == 0)) { - if (assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSLD, + if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSLD, ofl, rsp, sdp) == S_ERROR) return (S_ERROR); rsp->rel_rtype = M_R_DTPMOD; @@ -1802,15 +1787,15 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) if (local) rflags |= FLG_REL_SCNNDX; - if (add_outrel(rflags, rsp, ofl) == S_ERROR) + if (ld_add_outrel(rflags, rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_rtype = rtype; } else if (((rtype == R_SPARC_TLS_GD_HI22) || (rtype == - R_SPARC_TLS_GD_LO10)) && ((gnp = find_gotndx(&(sdp->sd_GOTndxs), + R_SPARC_TLS_GD_LO10)) && ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), GOT_REF_TLSGD, ofl, rsp)) == 0)) { - if (assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSGD, + if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_TLSGD, ofl, rsp, sdp) == S_ERROR) return (S_ERROR); rsp->rel_rtype = M_R_DTPMOD; @@ -1818,17 +1803,17 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) if (local) rflags |= FLG_REL_SCNNDX; - if (add_outrel(rflags, rsp, ofl) == S_ERROR) + if (ld_add_outrel(rflags, rsp, ofl) == S_ERROR) return (S_ERROR); if (local == TRUE) { rsp->rel_rtype = M_R_DTPOFF; - if (add_actrel((FLG_REL_GOT | FLG_REL_DTLS), rsp, + if (ld_add_actrel((FLG_REL_GOT | FLG_REL_DTLS), rsp, ofl) == S_ERROR) return (S_ERROR); } else { rsp->rel_rtype = M_R_DTPOFF; - if (add_outrel((FLG_REL_GOT | FLG_REL_DTLS), rsp, + if (ld_add_outrel((FLG_REL_GOT | FLG_REL_DTLS), rsp, ofl) == S_ERROR) return (S_ERROR); } @@ -1842,13 +1827,13 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) if ((rtype == R_SPARC_TLS_GD_CALL) || (rtype == R_SPARC_TLS_LDM_CALL)) { Sym_desc * tlsgetsym; - if ((tlsgetsym = sym_add_u(MSG_ORIG(MSG_SYM_TLSGETADDR_U), + if ((tlsgetsym = ld_sym_add_u(MSG_ORIG(MSG_SYM_TLSGETADDR_U), ofl)) == (Sym_desc *)S_ERROR) return (S_ERROR); rsp->rel_sym = tlsgetsym; rsp->rel_sname = tlsgetsym->sd_name; rsp->rel_rtype = R_SPARC_WPLT30; - if (reloc_plt(rsp, ofl) == S_ERROR) + if (ld_reloc_plt(rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_sym = sdp; rsp->rel_sname = sdp->sd_name; @@ -1857,13 +1842,13 @@ reloc_TLS(Boolean local, Rel_desc * rsp, Ofl_desc * ofl) } if (IS_TLS_LD(rtype)) - return (add_actrel(FLG_REL_MTLS, rsp, ofl)); + return (ld_add_actrel(FLG_REL_MTLS, rsp, ofl)); - return (add_actrel(FLG_REL_DTLS, rsp, ofl)); + return (ld_add_actrel(FLG_REL_DTLS, rsp, ofl)); } /* - * allocate_got: if a GOT is to be made, after the section is built this + * ld_allocate_got: if a GOT is to be made, after the section is built this * function is called to allocate all the GOT slots. The allocation is * deferred until after all GOTs have been counted and sorted according * to their size, for only then will we know how to allocate them on @@ -1875,7 +1860,7 @@ static Sword small_index; /* starting index for small GOT entries */ static Sword large_index; /* starting index for large GOT entries */ uintptr_t -assign_got(Sym_desc * sdp) +ld_assign_got(Ofl_desc *ofl, Sym_desc * sdp) { Listnode * lnp; Gotndx * gnp; @@ -1901,7 +1886,8 @@ assign_got(Sym_desc * sdp) large_index += gotents; break; default: - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_ASSIGNGOT), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_REL_ASSIGNGOT), EC_XWORD(gnp->gn_gotndx), demangle(sdp->sd_name)); return (S_ERROR); } @@ -1909,12 +1895,11 @@ assign_got(Sym_desc * sdp) return (1); } - /* * Search the GOT index list for a GOT entry with the proper addend. */ Gotndx * -find_gotndx(List * lst, Gotref gref, Ofl_desc * ofl, Rel_desc * rdesc) +ld_find_gotndx(List * lst, Gotref gref, Ofl_desc * ofl, Rel_desc * rdesc) { Listnode * lnp; Gotndx * gnp; @@ -1931,7 +1916,7 @@ find_gotndx(List * lst, Gotref gref, Ofl_desc * ofl, Rel_desc * rdesc) } Xword -calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl) +ld_calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl) { Os_desc *osp = ofl->ofl_osgot; Sym_desc *sdp = rdesc->rel_sym; @@ -1948,7 +1933,7 @@ calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl) else gref = GOT_REF_GENERIC; - gnp = find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, rdesc); + gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), gref, ofl, rdesc); assert(gnp); gotndx = (Xword)gnp->gn_gotndx; @@ -1962,7 +1947,7 @@ calc_got_offset(Rel_desc * rdesc, Ofl_desc * ofl) } uintptr_t -assign_gotndx(List * lst, Gotndx * pgnp, Gotref gref, Ofl_desc * ofl, +ld_assign_gotndx(List * lst, Gotndx * pgnp, Gotref gref, Ofl_desc * ofl, Rel_desc * rsp, Sym_desc * sdp) { Xword raddend; @@ -2041,14 +2026,14 @@ assign_gotndx(List * lst, Gotndx * pgnp, Gotref gref, Ofl_desc * ofl, } void -assign_plt_ndx(Sym_desc * sdp, Ofl_desc *ofl) +ld_assign_plt_ndx(Sym_desc * sdp, Ofl_desc *ofl) { sdp->sd_aux->sa_PLTndx = 1 + ofl->ofl_pltcnt++; } uintptr_t -allocate_got(Ofl_desc * ofl) +ld_allocate_got(Ofl_desc * ofl) { Sym_desc * sdp; Addr addr; @@ -2057,7 +2042,7 @@ allocate_got(Ofl_desc * ofl) * Sanity check -- is this going to fit at all? */ if (smlgotcnt >= M_GOT_MAXSMALL) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_SMALLGOT), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_SMALLGOT), EC_WORD(smlgotcnt), M_GOT_MAXSMALL); return (S_ERROR); } @@ -2079,9 +2064,9 @@ allocate_got(Ofl_desc * ofl) * Assign bias to GOT symbols. */ addr = -neggotoffset * M_GOT_ENTSIZE; - if (sdp = sym_find(MSG_ORIG(MSG_SYM_GOFTBL), SYM_NOHASH, 0, ofl)) + if (sdp = ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL), SYM_NOHASH, 0, ofl)) sdp->sd_sym->st_value = addr; - if (sdp = sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U), SYM_NOHASH, 0, ofl)) + if (sdp = ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U), SYM_NOHASH, 0, ofl)) sdp->sd_sym->st_value = addr; if (ofl->ofl_tlsldgotndx) { @@ -2096,12 +2081,12 @@ allocate_got(Ofl_desc * ofl) * Initializes .got[0] with the _DYNAMIC symbol value. */ uintptr_t -fillin_gotplt1(Ofl_desc * ofl) +ld_fillin_gotplt(Ofl_desc * ofl) { if (ofl->ofl_osgot) { Sym_desc * sdp; - if ((sdp = sym_find(MSG_ORIG(MSG_SYM_DYNAMIC_U), + if ((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_DYNAMIC_U), SYM_NOHASH, 0, ofl)) != NULL) { uchar_t *genptr = ((uchar_t *) ofl->ofl_osgot->os_outdata->d_buf + @@ -2113,16 +2098,3 @@ fillin_gotplt1(Ofl_desc * ofl) } return (1); } - - -/* - * Return plt[0]. - */ -Addr -fillin_gotplt2(Ofl_desc * ofl) -{ - if (ofl->ofl_osplt) - return (ofl->ofl_osplt->os_shdr->sh_addr); - else - return (0); -} diff --git a/usr/src/cmd/sgs/libld/i386/machsym.c b/usr/src/cmd/sgs/libld/common/machsym.intel.c index 81e4de1325..c336afa3a4 100644 --- a/usr/src/cmd/sgs/libld/i386/machsym.c +++ b/usr/src/cmd/sgs/libld/common/machsym.intel.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,14 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright 1998,2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> -#include "debug.h" +#include <debug.h> #include "_libld.h" @@ -37,7 +37,7 @@ */ /* ARGSUSED */ int -reg_check(Sym_desc *sdp, Sym *nsym, const char *nname, Ifl_desc *ifl, +ld_reg_check(Sym_desc *sdp, Sym *nsym, const char *nname, Ifl_desc *ifl, Ofl_desc * ofl) { return (1); @@ -45,29 +45,29 @@ reg_check(Sym_desc *sdp, Sym *nsym, const char *nname, Ifl_desc *ifl, /* ARGSUSED */ int -mach_sym_typecheck(Sym_desc * sdp, Sym * nsym, Ifl_desc * ifl, Ofl_desc * ofl) +ld_mach_sym_typecheck(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl) { return (0); } /* ARGSUSED */ const char * -is_regsym(Ifl_desc *ifl, Sym *sym, const char *strs, int symndx, Word shndx, - const char *symsecname, Word * flags) +ld_is_regsym(Ofl_desc *ofl, Ifl_desc *ifl, Sym *sym, const char *strs, + int symndx, Word shndx, const char *symsecname, Word * flags) { return (0); } /* ARGSUSED */ Sym_desc * -reg_find(Sym * sym, Ofl_desc * ofl) +ld_reg_find(Sym * sym, Ofl_desc * ofl) { return (0); } /* ARGSUSED */ int -reg_enter(Sym_desc * sdp, Ofl_desc * ofl) +ld_reg_enter(Sym_desc * sdp, Ofl_desc * ofl) { return (0); } diff --git a/usr/src/cmd/sgs/libld/sparc/machsym.c b/usr/src/cmd/sgs/libld/common/machsym.sparc.c index a4fe54d006..2acdd7d98b 100644 --- a/usr/src/cmd/sgs/libld/sparc/machsym.c +++ b/usr/src/cmd/sgs/libld/common/machsym.sparc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2000-2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -29,7 +29,7 @@ #include <string.h> #include <alloca.h> #include <sys/types.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" @@ -55,7 +55,7 @@ * */ int -reg_check(Sym_desc *sdp, Sym *nsym, const char *nname, Ifl_desc *ifl, +ld_reg_check(Sym_desc *sdp, Sym *nsym, const char *nname, Ifl_desc *ifl, Ofl_desc * ofl) { Sym *osym = sdp->sd_sym; @@ -73,8 +73,9 @@ reg_check(Sym_desc *sdp, Sym *nsym, const char *nname, Ifl_desc *ifl, if ((ELF_ST_BIND(osym->st_info) == STB_LOCAL) || (ELF_ST_BIND(nsym->st_info) == STB_LOCAL)) { if (osym->st_value == nsym->st_value) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_INCOMPREG3), - conv_sym_SPARC_value_str((Lword)osym->st_value), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_SYM_INCOMPREG3), + conv_sym_SPARC_value(osym->st_value), sdp->sd_file->ifl_name, demangle(oname), ifl->ifl_name, demangle(nname)); ofl->ofl_flags |= FLG_OF_FATAL; @@ -90,8 +91,9 @@ reg_check(Sym_desc *sdp, Sym *nsym, const char *nname, Ifl_desc *ifl, */ if (((osym->st_name == 0) || (nsym->st_name == 0)) || (strcmp(oname, nname) != 0)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_INCOMPREG1), - conv_sym_SPARC_value_str((Lword)osym->st_value), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_SYM_INCOMPREG1), + conv_sym_SPARC_value(osym->st_value), sdp->sd_file->ifl_name, demangle(oname), ifl->ifl_name, demangle(nname)); ofl->ofl_flags |= FLG_OF_FATAL; @@ -103,8 +105,9 @@ reg_check(Sym_desc *sdp, Sym *nsym, const char *nname, Ifl_desc *ifl, */ if ((osym->st_shndx == SHN_ABS) && (nsym->st_shndx == SHN_ABS)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_MULTINIREG), - conv_sym_SPARC_value_str((Lword)osym->st_value), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_SYM_MULTINIREG), + conv_sym_SPARC_value(osym->st_value), demangle(nname), sdp->sd_file->ifl_name, ifl->ifl_name); ofl->ofl_flags |= FLG_OF_FATAL; @@ -112,11 +115,10 @@ reg_check(Sym_desc *sdp, Sym *nsym, const char *nname, Ifl_desc *ifl, } } else if (strcmp(oname, nname) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_INCOMPREG2), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYM_INCOMPREG2), demangle(sdp->sd_name), sdp->sd_file->ifl_name, - conv_sym_SPARC_value_str((Lword)osym->st_value), - ifl->ifl_name, - conv_sym_SPARC_value_str((Lword)nsym->st_value)); + conv_sym_SPARC_value(osym->st_value), ifl->ifl_name, + conv_sym_SPARC_value(nsym->st_value)); ofl->ofl_flags |= FLG_OF_FATAL; return (1); } @@ -124,7 +126,7 @@ reg_check(Sym_desc *sdp, Sym *nsym, const char *nname, Ifl_desc *ifl, } int -mach_sym_typecheck(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl) +ld_mach_sym_typecheck(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl) { Sym *osym = sdp->sd_sym; Byte otype = ELF_ST_TYPE(osym->st_info); @@ -133,18 +135,20 @@ mach_sym_typecheck(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl) if (otype != ntype) { if ((otype == STT_SPARC_REGISTER) || (ntype == STT_SPARC_REGISTER)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_DIFFTYPE), - demangle(sdp->sd_name)); - eprintf(ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES), - sdp->sd_file->ifl_name, - conv_info_type_str(ofl->ofl_e_machine, otype), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_SYM_DIFFTYPE), demangle(sdp->sd_name)); + eprintf(ofl->ofl_lml, ERR_NONE, + MSG_INTL(MSG_SYM_FILETYPES), + sdp->sd_file->ifl_name, conv_sym_info_type( + sdp->sd_file->ifl_ehdr->e_machine, otype), ifl->ifl_name, - conv_info_type_str(ofl->ofl_e_machine, ntype)); + conv_sym_info_type(ifl->ifl_ehdr->e_machine, + ntype)); ofl->ofl_flags |= FLG_OF_FATAL; return (1); } } else if (otype == STT_SPARC_REGISTER) - return (reg_check(sdp, nsym, sdp->sd_name, ifl, ofl)); + return (ld_reg_check(sdp, nsym, sdp->sd_name, ifl, ofl)); return (0); } @@ -157,8 +161,8 @@ static const char *registers[] = { 0, }; const char * -is_regsym(Ifl_desc *ifl, Sym *sym, const char *strs, int symndx, Word shndx, - const char *symsecname, Word * flags) +ld_is_regsym(Ofl_desc *ofl, Ifl_desc *ifl, Sym *sym, const char *strs, + int symndx, Word shndx, const char *symsecname, Word * flags) { const char *name; @@ -173,8 +177,8 @@ is_regsym(Ifl_desc *ifl, Sym *sym, const char *strs, int symndx, Word shndx, */ if ((sym->st_value < STO_SPARC_REGISTER_G1) || (sym->st_value > STO_SPARC_REGISTER_G7)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_BADREG), ifl->ifl_name, - symsecname, symndx, EC_XWORD(sym->st_value)); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYM_BADREG), + ifl->ifl_name, symsecname, symndx, EC_XWORD(sym->st_value)); return ((const char *)S_ERROR); } @@ -182,8 +186,8 @@ is_regsym(Ifl_desc *ifl, Sym *sym, const char *strs, int symndx, Word shndx, * A register symbol can only be undefined or defined (absolute). */ if ((shndx != SHN_ABS) && (shndx != SHN_UNDEF)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_BADREG), ifl->ifl_name, - symsecname, symndx, EC_XWORD(sym->st_value)); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYM_BADREG), + ifl->ifl_name, symsecname, symndx, EC_XWORD(sym->st_value)); return ((const char *)S_ERROR); } @@ -196,9 +200,10 @@ is_regsym(Ifl_desc *ifl, Sym *sym, const char *strs, int symndx, Word shndx, */ if ((ELF_ST_BIND(sym->st_info) != STB_GLOBAL) || (shndx != SHN_UNDEF)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_BADSCRATCH), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_SYM_BADSCRATCH), ifl->ifl_name, symsecname, symndx, - conv_sym_SPARC_value_str((Lword)sym->st_value)); + conv_sym_SPARC_value(sym->st_value)); return ((const char *)S_ERROR); } @@ -218,7 +223,7 @@ is_regsym(Ifl_desc *ifl, Sym *sym, const char *strs, int symndx, Word shndx, } Sym_desc * -reg_find(Sym * sym, Ofl_desc * ofl) +ld_reg_find(Sym * sym, Ofl_desc * ofl) { if (ofl->ofl_regsyms == 0) return (0); @@ -227,7 +232,7 @@ reg_find(Sym * sym, Ofl_desc * ofl) } int -reg_enter(Sym_desc * sdp, Ofl_desc * ofl) +ld_reg_enter(Sym_desc * sdp, Ofl_desc * ofl) { if (ofl->ofl_regsyms == 0) { ofl->ofl_regsymsno = STO_SPARC_REGISTER_G7 + 1; diff --git a/usr/src/cmd/sgs/libld/common/map.c b/usr/src/cmd/sgs/libld/common/map.c index 9a958369be..b7d69d4cc2 100644 --- a/usr/src/cmd/sgs/libld/common/map.c +++ b/usr/src/cmd/sgs/libld/common/map.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,12 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -42,17 +41,17 @@ #include <dirent.h> #include <ctype.h> #include <elfcap.h> +#include <debug.h> #include "msg.h" -#include "debug.h" #include "_libld.h" -#ifdef _ELF64 +#if defined(_ELF64) #define STRTOADDR strtoull #define XWORD_MAX ULLONG_MAX #else /* Elf32 */ #define STRTOADDR strtoul #define XWORD_MAX UINT_MAX -#endif /* _ELF64 */ +#endif /* _ELF64 */ typedef enum { TK_STRING, TK_COLON, TK_SEMICOLON, TK_EQUAL, @@ -80,7 +79,7 @@ lowercase(char *str) * Get a token from the mapfile. */ static Token -gettoken(const char *mapfile) +gettoken(Ofl_desc *ofl, const char *mapfile) { static char oldchr = '\0'; /* Char at end of current token. */ char *end; /* End of the current token. */ @@ -94,8 +93,9 @@ gettoken(const char *mapfile) if (!isascii(*nextchr) || (!isprint(*nextchr) && !isspace(*nextchr) && (*nextchr != '\0'))) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_ILLCHAR), - mapfile, EC_XWORD(Line_num), *((uchar_t *)nextchr)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_ILLCHAR), mapfile, + EC_XWORD(Line_num), *((uchar_t *)nextchr)); /* LINTED */ return ((Token)S_ERROR); } @@ -143,8 +143,9 @@ gettoken(const char *mapfile) if (((end = strpbrk(nextchr, MSG_ORIG(MSG_MAP_TOK_1))) == NULL) || (*end != '"')) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_NOTERM), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_NOTERM), mapfile, + EC_XWORD(Line_num)); /* LINTED */ return ((Token)S_ERROR); } @@ -194,18 +195,20 @@ map_cap(const char *mapfile, Word type, Ofl_desc *ofl) Xword number; int used = 0; - while ((tok = gettoken(mapfile)) != TK_SEMICOLON) { + while ((tok = gettoken(ofl, mapfile)) != TK_SEMICOLON) { /* LINTED */ if (tok == (Token)S_ERROR) return (S_ERROR); if (tok == TK_EOF) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_PREMEOF), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_PREMEOF), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } if (tok != TK_STRING) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSEGATT), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_EXPSEGATT), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } @@ -255,15 +258,16 @@ map_cap(const char *mapfile, Word type, Ofl_desc *ofl) number = (Xword)strtoul(&Start_tok[1], &end_tok, 0); if (errno) { int err = errno; - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_BADCAPVAL), mapfile, EC_XWORD(Line_num), Start_tok, strerror(err)); return (S_ERROR); } if (end_tok != strchr(Start_tok, '\0')) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_BADCAPVAL), - mapfile, EC_XWORD(Line_num), Start_tok, + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_BADCAPVAL), mapfile, + EC_XWORD(Line_num), Start_tok, MSG_INTL(MSG_MAP_NOBADFRM)); return (S_ERROR); } @@ -280,7 +284,7 @@ map_cap(const char *mapfile, Word type, Ofl_desc *ofl) * We have an unknown token. */ used++; - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNKCAPATTR), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_UNKCAPATTR), mapfile, EC_XWORD(Line_num), Start_tok); return (S_ERROR); } @@ -290,7 +294,7 @@ map_cap(const char *mapfile, Word type, Ofl_desc *ofl) * have been initialized if necessary. */ if (used == 0) { - eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_EMPTYCAP), + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_MAP_EMPTYCAP), mapfile, EC_XWORD(Line_num)); } else if (type == CA_SUNW_SF_1) { Lword badsf1; @@ -305,14 +309,15 @@ map_cap(const char *mapfile, Word type, Ofl_desc *ofl) * capabilities that are known. */ if ((badsf1 = (ofl->ofl_sfcap_1 & ~SF1_SUNW_MASK)) != 0) { - eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_BADSF1), - mapfile, EC_XWORD(Line_num), EC_LWORD(badsf1)); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_MAP_BADSF1), mapfile, + EC_XWORD(Line_num), EC_LWORD(badsf1)); ofl->ofl_sfcap_1 &= SF1_SUNW_MASK; } if (ofl->ofl_sfcap_1 == SF1_SUNW_FPUSED) { - eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_BADSF1), - mapfile, EC_XWORD(Line_num), - EC_LWORD(SF1_SUNW_FPUSED)); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_FIL_BADSF1), mapfile, + EC_XWORD(Line_num), EC_LWORD(SF1_SUNW_FPUSED)); ofl->ofl_sfcap_1 = 0; } } @@ -337,18 +342,20 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) Boolean b_paddr = FALSE; /* True if seg physical addr found. */ Boolean b_align = FALSE; /* True if seg alignment found. */ - while ((tok = gettoken(mapfile)) != TK_SEMICOLON) { + while ((tok = gettoken(ofl, mapfile)) != TK_SEMICOLON) { /* LINTED */ if (tok == (Token)S_ERROR) return (S_ERROR); if (tok == TK_EOF) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_PREMEOF), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_PREMEOF), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } if (tok != TK_STRING) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSEGATT), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_EXPSEGATT), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } @@ -361,23 +368,26 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) */ if (strcmp(Start_tok, MSG_ORIG(MSG_MAP_LOAD)) == 0) { if (b_type) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE), - mapfile, EC_XWORD(Line_num), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_MOREONCE), mapfile, + EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGTYP)); return (S_ERROR); } if ((sgp->sg_flags & FLG_SG_TYPE) && (sgp->sg_phdr.p_type != PT_LOAD)) - eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_REDEFATT), - mapfile, EC_XWORD(Line_num), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_MAP_REDEFATT), mapfile, + EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGTYP), sgp->sg_name); sgp->sg_phdr.p_type = PT_LOAD; sgp->sg_flags |= FLG_SG_TYPE; b_type = TRUE; } else if (strcmp(Start_tok, MSG_ORIG(MSG_MAP_STACK)) == 0) { if (b_type) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE), - mapfile, EC_XWORD(Line_num), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_MOREONCE), mapfile, + EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGTYP)); return (S_ERROR); } @@ -386,15 +396,17 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) b_type = TRUE; } else if (strcmp(Start_tok, MSG_ORIG(MSG_MAP_NOTE)) == 0) { if (b_type) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE), - mapfile, EC_XWORD(Line_num), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_MOREONCE), mapfile, + EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGTYP)); return (S_ERROR); } if ((sgp->sg_flags & FLG_SG_TYPE) && (sgp->sg_phdr.p_type != PT_NOTE)) - eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_REDEFATT), - mapfile, EC_XWORD(Line_num), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_MAP_REDEFATT), mapfile, + EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGTYP), sgp->sg_name); sgp->sg_phdr.p_type = PT_NOTE; sgp->sg_flags |= FLG_SG_TYPE; @@ -409,8 +421,9 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) char *flag_tok = Start_tok + 1; if (b_flags) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE), - mapfile, EC_XWORD(Line_num), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_MOREONCE), mapfile, + EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGFLAG)); return (S_ERROR); } @@ -443,7 +456,7 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) sgp->sg_flags |= FLG_SG_NOHDR; break; default: - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_UNKSEGFLG), mapfile, EC_XWORD(Line_num), *flag_tok); @@ -462,8 +475,9 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) !(sgp->sg_phdr.p_type == PT_LOAD && (tmp_flags & (PF_R|PF_W)) == (PF_R|PF_W) && (tmp_flags ^ sgp->sg_phdr.p_flags) == PF_X)) { - eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_REDEFATT), - mapfile, EC_XWORD(Line_num), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_MAP_REDEFATT), mapfile, + EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGFLAG), sgp->sg_name); } sgp->sg_flags |= FLG_SG_FLAGS; @@ -482,15 +496,17 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) if ((number = (Xword)STRTOADDR(&Start_tok[1], &end_tok, 0)) >= XWORD_MAX) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGADDR), - mapfile, EC_XWORD(Line_num), Start_tok, + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_SEGADDR), mapfile, + EC_XWORD(Line_num), Start_tok, MSG_INTL(MSG_MAP_EXCLIMIT)); return (S_ERROR); } if (end_tok != strchr(Start_tok, '\0')) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGADDR), - mapfile, EC_XWORD(Line_num), Start_tok, + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_SEGADDR), mapfile, + EC_XWORD(Line_num), Start_tok, MSG_INTL(MSG_MAP_NOBADFRM)); return (S_ERROR); } @@ -498,7 +514,7 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) switch (*Start_tok) { case 'l': if (b_len) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE), mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGLEN)); @@ -506,7 +522,7 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) } if ((sgp->sg_flags & FLG_SG_LENGTH) && (sgp->sg_length != number)) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_MAP_REDEFATT), mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGLEN), @@ -517,7 +533,7 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) break; case 'r': if (b_round) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE), mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGROUND)); @@ -525,7 +541,7 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) } if ((sgp->sg_flags & FLG_SG_ROUND) && (sgp->sg_round != number)) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_MAP_REDEFATT), mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGROUND), @@ -536,7 +552,7 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) break; case 'v': if (b_vaddr) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE), mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGVADDR)); @@ -544,7 +560,7 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) } if ((sgp->sg_flags & FLG_SG_VADDR) && (sgp->sg_phdr.p_vaddr != number)) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_MAP_REDEFATT), mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGVADDR), @@ -557,7 +573,7 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) break; case 'p': if (b_paddr) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE), mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGPHYS)); @@ -565,7 +581,7 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) } if ((sgp->sg_flags & FLG_SG_PADDR) && (sgp->sg_phdr.p_paddr != number)) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_MAP_REDEFATT), mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGPHYS), @@ -577,7 +593,7 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) break; case 'a': if (b_align) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE), mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGALIGN)); @@ -585,7 +601,7 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) } if ((sgp->sg_flags & FLG_SG_ALIGN) && (sgp->sg_phdr.p_align != number)) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_MAP_REDEFATT), mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGALIGN), @@ -597,8 +613,9 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) break; } } else { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNKSEGATT), - mapfile, EC_XWORD(Line_num), Start_tok); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_UNKSEGATT), mapfile, + EC_XWORD(Line_num), Start_tok); return (S_ERROR); } } @@ -612,25 +629,29 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) if ((sgp->sg_flags & FLG_SG_EMPTY) && (sgp->sg_phdr.p_type != PT_SUNWSTACK)) { if (!(ofl->ofl_flags & FLG_OF_EXEC)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGEMPEXE), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_SEGEMPEXE), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } if (sgp->sg_phdr.p_flags != 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGEMNOPERM), - mapfile, EC_XWORD(Line_num), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_SEGEMNOPERM), mapfile, + EC_XWORD(Line_num), EC_WORD(sgp->sg_phdr.p_flags)); return (S_ERROR); } if ((sgp->sg_flags & (FLG_SG_LENGTH | FLG_SG_VADDR)) != (FLG_SG_LENGTH | FLG_SG_VADDR)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGEMPATT), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_SEGEMPATT), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } if (sgp->sg_phdr.p_type != PT_LOAD) { - eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_SEGEMPLOAD), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_MAP_SEGEMPLOAD), mapfile, + EC_XWORD(Line_num)); sgp->sg_phdr.p_type = PT_LOAD; } } @@ -639,7 +660,7 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) * All segment attributes have now been scanned. Certain flags do not * make sense if this is not a loadable segment, fix if necessary. * Note, if the segment is of type PT_NULL it must be new, and any - * defaults will be applied back in map_parse(). + * defaults will be applied back in ld_map_parse(). * When clearing an attribute leave the flag set as an indicator for * later entries re-specifying the same segment. */ @@ -654,29 +675,30 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) if ((sgp->sg_flags & FLG_SG_FLAGS) && (sgp->sg_phdr.p_type != PT_SUNWSTACK)) { if (sgp->sg_phdr.p_flags != 0) { - eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_NONLOAD), - mapfile, EC_XWORD(Line_num), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_MAP_NONLOAD), mapfile, + EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGFLAG)); sgp->sg_phdr.p_flags = 0; } } if (sgp->sg_flags & FLG_SG_LENGTH) if (sgp->sg_length != 0) { - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, fmt, mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGLEN)); sgp->sg_length = 0; } if (sgp->sg_flags & FLG_SG_ROUND) if (sgp->sg_round != 0) { - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, fmt, mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGROUND)); sgp->sg_round = 0; } if (sgp->sg_flags & FLG_SG_VADDR) { if (sgp->sg_phdr.p_vaddr != 0) { - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, fmt, mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGVADDR)); sgp->sg_phdr.p_vaddr = 0; @@ -684,14 +706,14 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) } if (sgp->sg_flags & FLG_SG_PADDR) if (sgp->sg_phdr.p_paddr != 0) { - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, fmt, mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGPHYS)); sgp->sg_phdr.p_paddr = 0; } if (sgp->sg_flags & FLG_SG_ALIGN) if (sgp->sg_phdr.p_align != 0) { - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, fmt, mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SEGALIGN)); sgp->sg_phdr.p_align = 0; @@ -707,7 +729,7 @@ map_equal(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) * segment_attribute : section_name section_type section_flags; */ static uintptr_t -map_colon(const char *mapfile, Ent_desc *enp) +map_colon(Ofl_desc *ofl, const char *mapfile, Ent_desc *enp) { Token tok; /* Current token. */ @@ -718,13 +740,15 @@ map_colon(const char *mapfile, Ent_desc *enp) static Xword index = 0; - while ((tok = gettoken(mapfile)) != TK_COLON && tok != TK_SEMICOLON) { + while (((tok = gettoken(ofl, mapfile)) != TK_COLON) && + (tok != TK_SEMICOLON)) { /* LINTED */ if (tok == (Token)S_ERROR) return (S_ERROR); if (tok == TK_EOF) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_PREMEOF), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_PREMEOF), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } @@ -732,8 +756,9 @@ map_colon(const char *mapfile, Ent_desc *enp) if (*Start_tok == '$') { if (b_type) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE), - mapfile, EC_XWORD(Line_num), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_MOREONCE), mapfile, + EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SECTYP)); return (S_ERROR); } @@ -768,8 +793,9 @@ map_colon(const char *mapfile, Ent_desc *enp) MSG_ORIG(MSG_STR_NOBITS)) == 0) enp->ec_type = SHT_NOBITS; else { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNKSECTYP), - mapfile, EC_XWORD(Line_num), Start_tok); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_UNKSECTYP), mapfile, + EC_XWORD(Line_num), Start_tok); return (S_ERROR); } @@ -783,8 +809,9 @@ map_colon(const char *mapfile, Ent_desc *enp) */ } else if (*Start_tok == '?') { if (b_attr) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE), - mapfile, EC_XWORD(Line_num), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_MOREONCE), mapfile, + EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SECFLAG)); return (S_ERROR); } @@ -796,7 +823,7 @@ map_colon(const char *mapfile, Ent_desc *enp) switch (*Start_tok) { case '!': if (b_bang) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_BADFLAG), mapfile, EC_XWORD(Line_num), Start_tok); @@ -806,7 +833,7 @@ map_colon(const char *mapfile, Ent_desc *enp) break; case 'a': if (enp->ec_attrmask & SHF_ALLOC) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_BADFLAG), mapfile, EC_XWORD(Line_num), Start_tok); @@ -819,7 +846,7 @@ map_colon(const char *mapfile, Ent_desc *enp) break; case 'w': if (enp->ec_attrmask & SHF_WRITE) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_BADFLAG), mapfile, EC_XWORD(Line_num), Start_tok); @@ -832,7 +859,7 @@ map_colon(const char *mapfile, Ent_desc *enp) break; case 'x': if (enp->ec_attrmask & SHF_EXECINSTR) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_BADFLAG), mapfile, EC_XWORD(Line_num), Start_tok); @@ -844,7 +871,7 @@ map_colon(const char *mapfile, Ent_desc *enp) b_bang = FALSE; break; default: - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_BADFLAG), mapfile, EC_XWORD(Line_num), Start_tok); @@ -855,8 +882,9 @@ map_colon(const char *mapfile, Ent_desc *enp) */ } else { if (b_name) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE), - mapfile, EC_XWORD(Line_num), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_MOREONCE), mapfile, + EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SECNAME)); return (S_ERROR); } @@ -876,20 +904,22 @@ map_colon(const char *mapfile, Ent_desc *enp) /* * File names. */ - while ((tok = gettoken(mapfile)) != TK_SEMICOLON) { + while ((tok = gettoken(ofl, mapfile)) != TK_SEMICOLON) { char *file; /* LINTED */ if (tok == (Token)S_ERROR) return (S_ERROR); if (tok == TK_EOF) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_PREMEOF), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_PREMEOF), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } if (tok != TK_STRING) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_MALFORM), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_MALFORM), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } if ((file = @@ -947,17 +977,18 @@ map_atsign(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) Token tok; /* Current token. */ avl_index_t where; - if ((tok = gettoken(mapfile)) != TK_STRING) { + if ((tok = gettoken(ofl, mapfile)) != TK_STRING) { /* LINTED */ if (tok != (Token)S_ERROR) - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSYM_1), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_EXPSYM_1), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } if (sgp->sg_sizesym != NULL) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGSIZE), mapfile, - EC_XWORD(Line_num), sgp->sg_name); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_SEGSIZE), + mapfile, EC_XWORD(Line_num), sgp->sg_name); return (S_ERROR); } @@ -973,7 +1004,7 @@ map_atsign(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) * symbol has been scoped or versioned, in which case it does exist * but we can freely update it here. */ - if ((sdp = sym_find(Start_tok, SYM_NOHASH, &where, ofl)) == NULL) { + if ((sdp = ld_sym_find(Start_tok, SYM_NOHASH, &where, ofl)) == NULL) { char *name; Word hval; @@ -987,15 +1018,15 @@ map_atsign(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) sym->st_size = 0; sym->st_info = ELF_ST_INFO(STB_GLOBAL, STT_OBJECT); - DBG_CALL(Dbg_map_size_new(name)); + DBG_CALL(Dbg_map_size_new(ofl->ofl_lml, name)); /* LINTED */ hval = (Word)elf_hash(name); - if ((sdp = sym_enter(name, sym, hval, ifl, ofl, 0, SHN_ABS, + if ((sdp = ld_sym_enter(name, sym, hval, ifl, ofl, 0, SHN_ABS, (FLG_SY_SPECSEC | FLG_SY_GLOBREF), 0, &where)) == (Sym_desc *)S_ERROR) return (S_ERROR); sdp->sd_flags &= ~FLG_SY_CLEAN; - DBG_CALL(Dbg_map_symbol(&def_ehdr, sdp)); + DBG_CALL(Dbg_map_symbol(ofl, sdp)); } else { sym = sdp->sd_sym; @@ -1007,9 +1038,10 @@ map_atsign(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) sdp->sd_flags &= ~FLG_SY_MAPREF; - DBG_CALL(Dbg_map_size_old(&def_ehdr, sdp)); + DBG_CALL(Dbg_map_size_old(ofl, sdp)); } else { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SYMDEF), mapfile, + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_SYMDEF), mapfile, EC_XWORD(Line_num), demangle(sdp->sd_name), sdp->sd_file->ifl_name); return (S_ERROR); @@ -1021,11 +1053,12 @@ map_atsign(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) */ sgp->sg_sizesym = sdp; - if (gettoken(mapfile) != TK_SEMICOLON) { + if (gettoken(ofl, mapfile) != TK_SEMICOLON) { /* LINTED */ if (tok != (Token)S_ERROR) - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSCOL), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_EXPSCOL), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } else return (1); @@ -1033,7 +1066,7 @@ map_atsign(const char *mapfile, Sg_desc *sgp, Ofl_desc *ofl) static uintptr_t -map_pipe(const char *mapfile, Sg_desc *sgp) +map_pipe(Ofl_desc *ofl, const char *mapfile, Sg_desc *sgp) { char *sec_name; /* section name */ Token tok; /* current token. */ @@ -1041,10 +1074,11 @@ map_pipe(const char *mapfile, Sg_desc *sgp) static Word index = 0; /* used to maintain a increasing */ /* index for section ordering. */ - if ((tok = gettoken(mapfile)) != TK_STRING) { + if ((tok = gettoken(ofl, mapfile)) != TK_STRING) { /* LINTED */ if (tok != (Token)S_ERROR) - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSEC), mapfile, + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_EXPSEC), mapfile, EC_XWORD(Line_num)); return (S_ERROR); } @@ -1062,13 +1096,14 @@ map_pipe(const char *mapfile, Sg_desc *sgp) if (list_appendc(&(sgp->sg_secorder), sc_order) == 0) return (S_ERROR); - DBG_CALL(Dbg_map_pipe(sgp, sec_name, index)); + DBG_CALL(Dbg_map_pipe(ofl->ofl_lml, sgp, sec_name, index)); - if ((tok = gettoken(mapfile)) != TK_SEMICOLON) { + if ((tok = gettoken(ofl, mapfile)) != TK_SEMICOLON) { /* LINTED */ if (tok != (Token)S_ERROR) - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSCOL), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_EXPSCOL), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } @@ -1111,18 +1146,20 @@ map_dash(const char *mapfile, char *name, Ofl_desc *ofl) /* * Get the shared object descriptor string. */ - while ((tok = gettoken(mapfile)) != TK_SEMICOLON) { + while ((tok = gettoken(ofl, mapfile)) != TK_SEMICOLON) { /* LINTED */ if (tok == (Token)S_ERROR) return (S_ERROR); if (tok == TK_EOF) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_PREMEOF), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_PREMEOF), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } if ((tok != TK_STRING) && (tok != TK_EQUAL)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSO), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_EXPSO), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } @@ -1131,12 +1168,12 @@ map_dash(const char *mapfile, char *name, Ofl_desc *ofl) * definition. */ if (tok == TK_EQUAL) { - if ((tok = gettoken(mapfile)) != TK_STRING) { + if ((tok = gettoken(ofl, mapfile)) != TK_STRING) { /* LINTED */ if (tok == (Token)S_ERROR) return (S_ERROR); else { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_EXPSO), mapfile, EC_XWORD(Line_num)); return (S_ERROR); @@ -1145,7 +1182,7 @@ map_dash(const char *mapfile, char *name, Ofl_desc *ofl) switch (dolkey) { case MD_NEEDED: if (sdf->sdf_flags & FLG_SDF_SONAME) { - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_MAP_MULSONAME), mapfile, EC_XWORD(Line_num), name, sdf->sdf_soname, Start_tok); @@ -1173,7 +1210,7 @@ map_dash(const char *mapfile, char *name, Ofl_desc *ofl) if ((sdf->sdf_flags & (FLG_SDF_SPECVER | FLG_SDF_ADDVER)) == (FLG_SDF_SPECVER | FLG_SDF_ADDVER)) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_INCOMFLG), mapfile, EC_XWORD(Line_num), sdf->sdf_name); @@ -1189,8 +1226,9 @@ map_dash(const char *mapfile, char *name, Ofl_desc *ofl) return (S_ERROR); break; case MD_NONE: - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNEXTOK), - mapfile, EC_XWORD(Line_num), '='); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_UNEXTOK), mapfile, + EC_XWORD(Line_num), '='); return (S_ERROR); } dolkey = MD_NONE; @@ -1203,8 +1241,9 @@ map_dash(const char *mapfile, char *name, Ofl_desc *ofl) */ if (*Start_tok == '$') { if (dolkey != MD_NONE) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNEXTOK), - mapfile, EC_XWORD(Line_num), '$'); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_UNEXTOK), mapfile, + EC_XWORD(Line_num), '$'); return (S_ERROR); } Start_tok++; @@ -1219,8 +1258,9 @@ map_dash(const char *mapfile, char *name, Ofl_desc *ofl) MSG_ORIG(MSG_MAP_ADDVERS)) == 0) dolkey = MD_ADDVERS; else { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNKSOTYP), - mapfile, EC_XWORD(Line_num), Start_tok); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_UNKSOTYP), mapfile, + EC_XWORD(Line_num), Start_tok); return (S_ERROR); } continue; @@ -1241,7 +1281,7 @@ map_dash(const char *mapfile, char *name, Ofl_desc *ofl) return (S_ERROR); } - DBG_CALL(Dbg_map_dash(name, sdf)); + DBG_CALL(Dbg_map_dash(ofl->ofl_lml, name, sdf)); return (1); } @@ -1311,7 +1351,7 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) * serves to initialize the output version descriptor count. */ if (ofl->ofl_vercnt == 0) { - if (vers_base(ofl) == (Ver_desc *)S_ERROR) + if (ld_vers_base(ofl) == (Ver_desc *)S_ERROR) return (S_ERROR); } @@ -1328,8 +1368,8 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) */ /* LINTED */ hash = (Word)elf_hash(name); - if ((vdp = vers_find(name, hash, &ofl->ofl_verdesc)) == 0) { - if ((vdp = vers_desc(name, hash, + if ((vdp = ld_vers_find(name, hash, &ofl->ofl_verdesc)) == 0) { + if ((vdp = ld_vers_desc(name, hash, &ofl->ofl_verdesc)) == (Ver_desc *)S_ERROR) return (S_ERROR); } @@ -1356,7 +1396,7 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) /* * Scan the mapfile entry picking out scoping and symbol definitions. */ - while ((tok = gettoken(mapfile)) != TK_RIGHTBKT) { + while ((tok = gettoken(ofl, mapfile)) != TK_RIGHTBKT) { Sym_desc * sdp; Word shndx = SHN_UNDEF; uchar_t type = STT_NOTYPE; @@ -1367,8 +1407,9 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) uint_t filter = 0, dftflag; if ((tok != TK_STRING) && (tok != TK_COLON)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSYM_2), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_EXPSYM_2), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } @@ -1378,7 +1419,7 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) if ((tok != TK_COLON) && /* LINTED */ - (tok = gettoken(mapfile)) == (Token)S_ERROR) + (tok = gettoken(ofl, mapfile)) == (Token)S_ERROR) return (S_ERROR); /* @@ -1416,8 +1457,9 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) == 0) scope = FLG_SCOPE_ELIM; else { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNKSYMSCO), - mapfile, EC_XWORD(Line_num), _name); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_UNKSYMSCO), mapfile, + EC_XWORD(Line_num), _name); return (S_ERROR); } continue; @@ -1429,8 +1471,7 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) * alignment specified and then fall through to process * the entire symbols information. */ - while ((tok = gettoken(mapfile)) != TK_SEMICOLON) { - + while ((tok = gettoken(ofl, mapfile)) != TK_SEMICOLON) { /* * If we had previously seen a filter or * auxiliary filter requirement, the next string @@ -1438,7 +1479,7 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) */ if (filter) { if (filtee) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_MULTFILTEE), mapfile, EC_XWORD(Line_num), _name); @@ -1464,7 +1505,7 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) if ((number = (Lword)STRTOADDR( &Start_tok[1], &end_tok, 0)) == XWORD_MAX) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_SEGADDR), mapfile, EC_XWORD(Line_num), Start_tok, @@ -1474,7 +1515,7 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) if (end_tok != strchr(Start_tok, '\0')) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_SEGADDR), mapfile, EC_XWORD(Line_num), Start_tok, @@ -1485,7 +1526,7 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) switch (*Start_tok) { case 'v': if (value) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE), mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SYMVAL)); @@ -1496,7 +1537,7 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) break; case 's': if (size) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_MOREONCE), mapfile, EC_XWORD(Line_num), MSG_INTL(MSG_MAP_SYMSIZE)); @@ -1553,7 +1594,7 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) ofl->ofl_flags |= FLG_OF_SYMINFO; continue; } else { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_UNKSYMDEF), mapfile, EC_XWORD(Line_num), Start_tok); @@ -1592,8 +1633,9 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) */ /* LINTED */ hash = (Word)elf_hash(_name); - DBG_CALL(Dbg_map_version(name, _name, scope)); - if ((sdp = sym_find(_name, hash, &where, + DBG_CALL(Dbg_map_version(ofl->ofl_lml, name, _name, + scope)); + if ((sdp = ld_sym_find(_name, hash, &where, ofl)) == NULL) { if ((sym = libld_calloc(sizeof (Sym), 1)) == 0) return (S_ERROR); @@ -1611,7 +1653,7 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) sym->st_size = size; sym->st_info = ELF_ST_INFO(STB_GLOBAL, type); - if ((sdp = sym_enter(_name, sym, hash, ifl, + if ((sdp = ld_sym_enter(_name, sym, hash, ifl, ofl, 0, shndx, sym_flags, sym_flags1, &where)) == (Sym_desc *)S_ERROR) return (S_ERROR); @@ -1683,7 +1725,7 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) conflict = 7; if (conflict) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_SYMDEF), mapfile, EC_XWORD(Line_num), demangle(_name), sdp->sd_file->ifl_name); @@ -1737,7 +1779,7 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) */ if (type != STT_NOTYPE) ofl->ofl_objscnt++; - DBG_CALL(Dbg_map_symbol(&def_ehdr, sdp)); + DBG_CALL(Dbg_map_symbol(ofl, sdp)); /* * If this symbol has an associated filtee, record the @@ -1746,8 +1788,9 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) * information with the necessary .dynamic entry. */ if (filter && (filtee == 0)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_NOFILTER), - mapfile, EC_XWORD(Line_num), _name); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_NOFILTER), mapfile, + EC_XWORD(Line_num), _name); return (S_ERROR); } @@ -1801,8 +1844,9 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) break; default: - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSCOL), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_EXPSCOL), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } } @@ -1811,22 +1855,24 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) * Determine if any version references are provided after the close * bracket. */ - while ((tok = gettoken(mapfile)) != TK_SEMICOLON) { + while ((tok = gettoken(ofl, mapfile)) != TK_SEMICOLON) { Ver_desc *_vdp; char *_name; if (tok != TK_STRING) { /* LINTED */ if (tok != (Token)S_ERROR) - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPVERS), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_EXPVERS), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } name = Start_tok; if (vdp->vd_ndx == VER_NDX_GLOBAL) { - eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_UNEXDEP), - mapfile, EC_XWORD(Line_num), name); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_MAP_UNEXDEP), mapfile, + EC_XWORD(Line_num), name); continue; } @@ -1836,12 +1882,12 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) */ /* LINTED */ hash = (Word)elf_hash(name); - if ((_vdp = vers_find(name, hash, &ofl->ofl_verdesc)) == 0) { + if ((_vdp = ld_vers_find(name, hash, &ofl->ofl_verdesc)) == 0) { if ((_name = libld_malloc(strlen(name) + 1)) == 0) return (S_ERROR); (void) strcpy(_name, name); - if ((_vdp = vers_desc(_name, hash, + if ((_vdp = ld_vers_desc(_name, hash, &ofl->ofl_verdesc)) == (Ver_desc *)S_ERROR) return (S_ERROR); } @@ -1852,7 +1898,7 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) * first reference (used for error disgnostics if undefined * version dependencies remain). */ - if (vers_find(name, hash, &vdp->vd_deps) == 0) + if (ld_vers_find(name, hash, &vdp->vd_deps) == 0) if (list_appendc(&vdp->vd_deps, _vdp) == 0) return (S_ERROR); @@ -1866,7 +1912,7 @@ map_version(const char *mapfile, char *name, Ofl_desc *ofl) * Sort the segment list by increasing virtual address. */ uintptr_t -sort_seg_list(Ofl_desc *ofl) +ld_sort_seg_list(Ofl_desc *ofl) { List seg1, seg2; Listnode *lnp1, *lnp2, *lnp3; @@ -1890,7 +1936,7 @@ sort_seg_list(Ofl_desc *ofl) * Add the loadable segments to another list in sorted order. */ for (LIST_TRAVERSE(&ofl->ofl_segs, lnp1, sgp1)) { - DBG_CALL(Dbg_map_sort_orig(sgp1)); + DBG_CALL(Dbg_map_sort_orig(ofl->ofl_lml, sgp1)); if (sgp1->sg_phdr.p_type != PT_LOAD) continue; if (!(sgp1->sg_flags & FLG_SG_VADDR) || @@ -1936,7 +1982,7 @@ sort_seg_list(Ofl_desc *ofl) sgp2->sg_phdr.p_vaddr) { lnp3 = lnp2; } else { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_SEGSAME), sgp1->sg_name, sgp2->sg_name); return (S_ERROR); @@ -1974,7 +2020,7 @@ sort_seg_list(Ofl_desc *ofl) * segment/section ordering information if present. */ for (LIST_TRAVERSE(&seg1, lnp1, sgp1)) { - DBG_CALL(Dbg_map_sort_fini(sgp1)); + DBG_CALL(Dbg_map_sort_fini(ofl->ofl_lml, sgp1)); if (list_appendc(&ofl->ofl_segs, sgp1) == 0) return (S_ERROR); } @@ -1987,7 +2033,7 @@ sort_seg_list(Ofl_desc *ofl) * Parse the mapfile. */ uintptr_t -map_parse(const char *mapfile, Ofl_desc *ofl) +ld_map_parse(const char *mapfile, Ofl_desc *ofl) { struct stat stat_buf; /* stat of mapfile */ int mapfile_fd; /* descriptor for mapfile */ @@ -2004,15 +2050,15 @@ map_parse(const char *mapfile, Ofl_desc *ofl) static int num_stack = 0; /* number of stack segment */ int err; - DBG_CALL(Dbg_map_parse(mapfile)); + DBG_CALL(Dbg_map_parse(ofl->ofl_lml, mapfile)); /* * Determine if we're dealing with a file or a directory. */ if (stat(mapfile, &stat_buf) == -1) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_STAT), mapfile, - strerror(err)); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYS_STAT), + mapfile, strerror(err)); return (S_ERROR); } if (S_ISDIR(stat_buf.st_mode)) { @@ -2037,13 +2083,14 @@ map_parse(const char *mapfile, Ofl_desc *ofl) continue; (void) snprintf(path, PATH_MAX, MSG_ORIG(MSG_STR_PATH), mapfile, denp->d_name); - if (map_parse(path, ofl) == S_ERROR) + if (ld_map_parse(path, ofl) == S_ERROR) return (S_ERROR); } (void) closedir(dirp); return (1); } else if (!S_ISREG(stat_buf.st_mode)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_NOTREG), mapfile); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYS_NOTREG), + mapfile); return (S_ERROR); } @@ -2054,15 +2101,15 @@ map_parse(const char *mapfile, Ofl_desc *ofl) return (S_ERROR); if ((mapfile_fd = open(mapfile, O_RDONLY)) == -1) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), mapfile, - strerror(err)); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), + mapfile, strerror(err)); return (S_ERROR); } if (read(mapfile_fd, Mapspace, stat_buf.st_size) != stat_buf.st_size) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_READ), mapfile, - strerror(err)); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYS_READ), + mapfile, strerror(err)); return (S_ERROR); } Mapspace[stat_buf.st_size] = '\0'; @@ -2076,7 +2123,7 @@ map_parse(const char *mapfile, Ofl_desc *ofl) /* * We now parse the mapfile until the gettoken routine returns EOF. */ - while ((tok = gettoken(mapfile)) != TK_EOF) { + while ((tok = gettoken(ofl, mapfile)) != TK_EOF) { int ndx = -1; /* @@ -2098,8 +2145,9 @@ map_parse(const char *mapfile, Ofl_desc *ofl) if (tok != TK_STRING) { /* LINTED */ if (tok != (Token)S_ERROR) - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPSEGNAM), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_EXPSEGNAM), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } @@ -2115,7 +2163,7 @@ map_parse(const char *mapfile, Ofl_desc *ofl) * and `{' characters do not involve any segment manipulation so * we handle them first. */ - if ((tok = gettoken(mapfile)) == TK_DASH) { + if ((tok = gettoken(ofl, mapfile)) == TK_DASH) { if (map_dash(mapfile, name, ofl) == S_ERROR) return (S_ERROR); continue; @@ -2148,11 +2196,12 @@ map_parse(const char *mapfile, Ofl_desc *ofl) */ if (tok == TK_PIPE) { if (sgp1 == NULL) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SECINSEG), - mapfile, EC_XWORD(Line_num), name); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_SECINSEG), mapfile, + EC_XWORD(Line_num), name); return (S_ERROR); } else { - if (map_pipe(mapfile, sgp1) == S_ERROR) + if (map_pipe(ofl, mapfile, sgp1) == S_ERROR) return (S_ERROR); continue; } @@ -2176,8 +2225,9 @@ map_parse(const char *mapfile, Ofl_desc *ofl) if ((strcmp(sgp1->sg_name, MSG_ORIG(MSG_STR_INTERP)) == 0) || (strcmp(sgp1->sg_name, MSG_ORIG(MSG_STR_LD_DYNAMIC)) == 0)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGRESV), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_SEGRESV), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } @@ -2190,20 +2240,22 @@ map_parse(const char *mapfile, Ofl_desc *ofl) if (map_cap(mapfile, CA_SUNW_HW_1, ofl) == S_ERROR) return (S_ERROR); - Dbg_cap_mapfile(CA_SUNW_HW_1, ofl->ofl_hwcap_1, - M_MACH); + DBG_CALL(Dbg_cap_mapfile(ofl->ofl_lml, + CA_SUNW_HW_1, ofl->ofl_hwcap_1, M_MACH)); + } else if (strcmp(sgp1->sg_name, MSG_ORIG(MSG_STR_SFCAP_1)) == 0) { if (map_cap(mapfile, CA_SUNW_SF_1, ofl) == S_ERROR) return (S_ERROR); - Dbg_cap_mapfile(CA_SUNW_SF_1, ofl->ofl_sfcap_1, - M_MACH); + DBG_CALL(Dbg_cap_mapfile(ofl->ofl_lml, + CA_SUNW_SF_1, ofl->ofl_sfcap_1, M_MACH)); + } else { if (map_equal(mapfile, sgp1, ofl) == S_ERROR) return (S_ERROR); ofl->ofl_flags |= FLG_OF_SEGSORT; - DBG_CALL(Dbg_map_equal(new_segment)); + DBG_CALL(Dbg_map_set_equal(new_segment)); } } else if (tok == TK_COLON) { /* @@ -2212,8 +2264,9 @@ map_parse(const char *mapfile, Ofl_desc *ofl) */ if ((new_segment == FALSE) && (sgp1->sg_flags & FLG_SG_EMPTY)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_SEGEMPSEC), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_SEGEMPSEC), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } @@ -2236,19 +2289,21 @@ map_parse(const char *mapfile, Ofl_desc *ofl) return (S_ERROR); } - if (map_colon(mapfile, enp) == S_ERROR) + if (map_colon(ofl, mapfile, enp) == S_ERROR) return (S_ERROR); ofl->ofl_flags |= FLG_OF_SEGSORT; - DBG_CALL(Dbg_map_ent(new_segment, enp, ofl)); + DBG_CALL(Dbg_map_ent(ofl->ofl_lml, new_segment, + enp, ofl)); } else if (tok == TK_ATSIGN) { if (map_atsign(mapfile, sgp1, ofl) == S_ERROR) return (S_ERROR); - DBG_CALL(Dbg_map_atsign(new_segment)); + DBG_CALL(Dbg_map_set_atsign(new_segment)); } else { /* LINTED */ if (tok != (Token)S_ERROR) { - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_EXPEQU), - mapfile, EC_XWORD(Line_num)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_EXPEQU), mapfile, + EC_XWORD(Line_num)); return (S_ERROR); } } @@ -2295,7 +2350,7 @@ map_parse(const char *mapfile, Ofl_desc *ofl) * Currently the number of sunw_stack * segment is limited to 1. */ - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_MAP_NOSTACK2), mapfile, EC_XWORD(Line_num)); continue; @@ -2305,8 +2360,9 @@ map_parse(const char *mapfile, Ofl_desc *ofl) src_type = 9; break; default: - eprintf(ERR_FATAL, MSG_INTL(MSG_MAP_UNKSEGTYP), - mapfile, EC_XWORD(Line_num), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_MAP_UNKSEGTYP), mapfile, + EC_XWORD(Line_num), EC_WORD(sgp1->sg_phdr.p_type)); return (S_ERROR); } @@ -2351,7 +2407,7 @@ map_parse(const char *mapfile, Ofl_desc *ofl) dst_type = 12; break; default: - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_MAP_UNKSEGTYP), mapfile, EC_XWORD(Line_num), EC_WORD(sgp2->sg_phdr.p_type)); @@ -2372,7 +2428,7 @@ map_parse(const char *mapfile, Ofl_desc *ofl) lnp2 = lnp1; } } - DBG_CALL(Dbg_map_seg(ofl->ofl_e_machine, ndx, sgp1)); + DBG_CALL(Dbg_map_seg(ofl, ndx, sgp1)); } /* diff --git a/usr/src/cmd/sgs/libld/common/mapfile-vers b/usr/src/cmd/sgs/libld/common/mapfile-vers index ad45bc847d..2870e38efa 100644 --- a/usr/src/cmd/sgs/libld/common/mapfile-vers +++ b/usr/src/cmd/sgs/libld/common/mapfile-vers @@ -1,15 +1,9 @@ # -#pragma ident "%Z%%M% %I% %E% SMI" -# -# 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. +# 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. @@ -24,6 +18,13 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# # Generic interface definition for usr/src/cmd/sgs/libld. # # For information regarding the establishment of versioned definitions see: @@ -36,43 +37,41 @@ # definitions see: # Policy for Shared Library Version Names and Interface Definitions -{ - global: - eprintf = FUNCTION extern; -}; - -SUNWprivate_2.14 { +SUNWprivate_4.1 { global: - add_string; - create_outfile; dbg_print; - ent_setup; - finish_libs; - ld_main; - ld_support_loadso; - list_appendc; - list_insertc; - list_prependc; - list_where; - make_sections; - ofl_cleanup; - open_outfile; - process_open; - reloc_init; - reloc_process; - sdf_add; - sdf_find; - sec_validate; + + ld32_main; + ld64_main; + + ld32_create_outfile; + ld64_create_outfile; + ld32_ent_setup; + ld64_ent_setup; + ld32_make_sections; + ld64_make_sections; + ld32_ofl_cleanup; + ld64_ofl_cleanup; + ld32_process_open; + ld64_process_open; + ld32_reloc_init; + ld64_reloc_init; + ld32_reloc_process; + ld64_reloc_process; + ld32_sym_validate; + ld64_sym_validate; + ld32_update_outfile; + ld64_update_outfile; + st_new; - sym_add_u; - sym_enter; - sym_find; - sym_validate; - update_outfile; - vers_base; - vers_check_defs; - vers_desc; - vers_find; local: *; }; + +# The following functions must be provided by our caller, or one of the +# callers dependencies. + +{ + global: + eprintf = FUNCTION extern; +}; diff --git a/usr/src/cmd/sgs/libld/common/order.c b/usr/src/cmd/sgs/libld/common/order.c index d5724158c8..724ae2a22a 100644 --- a/usr/src/cmd/sgs/libld/common/order.c +++ b/usr/src/cmd/sgs/libld/common/order.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -30,10 +30,9 @@ * Processing of SHF_ORDERED sections. */ #include <stdio.h> -#include <string.h> #include <fcntl.h> #include <link.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" @@ -67,7 +66,7 @@ is_keylink_ok(Ifl_desc *ifl, Word keylink, Word limit) } static Word -get_shfordered_dest(Ifl_desc *ifl, Word ndx, Word limit) +get_shfordered_dest(Ofl_desc *ofl, Ifl_desc *ifl, Word ndx, Word limit) { Word t1_link = ndx, t2_link, ret_link; Is_desc *isp, *isp1, *isp2; @@ -140,7 +139,7 @@ get_shfordered_dest(Ifl_desc *ifl, Word ndx, Word limit) if (error != 0) { ret_link = 0; - DBG_CALL(Dbg_sec_order_error(ifl, ndx, error)); + DBG_CALL(Dbg_sec_order_error(ofl->ofl_lml, ifl, ndx, error)); } return (ret_link); } @@ -150,7 +149,7 @@ get_shfordered_dest(Ifl_desc *ifl, Word ndx, Word limit) * This routine does the input processing of the ordered sections. */ uintptr_t -process_ordered(Ifl_desc *ifl, Ofl_desc *ofl, Word ndx, Word limit) +ld_process_ordered(Ifl_desc *ifl, Ofl_desc *ofl, Word ndx, Word limit) { Is_desc * isp2, * isp = ifl->ifl_isdesc[ndx]; Xword shflags = isp->is_shdr->sh_flags; @@ -174,10 +173,10 @@ process_ordered(Ifl_desc *ifl, Ofl_desc *ofl, Word ndx, Word limit) keylink = isp->is_shdr->sh_link; if ((error = is_keylink_ok(ifl, keylink, limit)) != 0) { - DBG_CALL(Dbg_sec_order_error(ifl, ndx, error)); + DBG_CALL(Dbg_sec_order_error(ofl->ofl_lml, ifl, ndx, error)); isp->is_flags &= ~FLG_IS_ORDERED; if (isp->is_osdesc == NULL) - return ((uintptr_t)place_section(ofl, isp, + return ((uintptr_t)ld_place_section(ofl, isp, isp->is_key, 0)); return ((uintptr_t)isp->is_osdesc); } @@ -188,10 +187,11 @@ process_ordered(Ifl_desc *ifl, Ofl_desc *ofl, Word ndx, Word limit) * we follow the default rules for the desitination section. */ if (shflags & SHF_ORDERED) { - if ((dest_ndx = get_shfordered_dest(ifl, ndx, limit)) == 0) { + if ((dest_ndx = get_shfordered_dest(ofl, ifl, + ndx, limit)) == 0) { isp->is_flags &= ~FLG_IS_ORDERED; if (isp->is_osdesc == NULL) - return ((uintptr_t)place_section(ofl, isp, + return ((uintptr_t)ld_place_section(ofl, isp, isp->is_key, 0)); return ((uintptr_t)isp->is_osdesc); } @@ -207,8 +207,8 @@ process_ordered(Ifl_desc *ifl, Ofl_desc *ofl, Word ndx, Word limit) * Place the section into it's output section. */ if ((osp = isp->is_osdesc) == NULL) { - if ((osp = place_section(ofl, isp, isp->is_ident, dest_ndx)) == - (Os_desc *)S_ERROR) + if ((osp = ld_place_section(ofl, isp, isp->is_ident, + dest_ndx)) == (Os_desc *)S_ERROR) return ((uintptr_t)S_ERROR); if (!osp) return (0); @@ -245,10 +245,10 @@ process_ordered(Ifl_desc *ifl, Ofl_desc *ofl, Word ndx, Word limit) st->st_ordercnt++; isp2 = ifl->ifl_isdesc[keylink]; if (isp2->is_flags & FLG_IS_DISCARD) { - eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_BADORDREF), - ifl->ifl_name, isp->is_name, isp->is_scnndx, - isp2->is_name, isp2->is_scnndx); - + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_FIL_BADORDREF), ifl->ifl_name, + isp->is_name, isp->is_scnndx, isp2->is_name, + isp2->is_scnndx); return (S_ERROR); } osp2 = isp2->is_osdesc; @@ -270,7 +270,7 @@ process_ordered(Ifl_desc *ifl, Ofl_desc *ofl, Word ndx, Word limit) * there are any SHF_ORDERED key sections, and if so set up sort key values. */ void -sec_validate(Ofl_desc * ofl) +ld_sec_validate(Ofl_desc * ofl) { Listnode * lnp1; Sg_desc * sgp; @@ -283,7 +283,8 @@ sec_validate(Ofl_desc * ofl) for (LIST_TRAVERSE(&sgp->sg_secorder, lnp2, scop)) if (!(scop->sco_flags & FLG_SGO_USED)) - eprintf(ERR_WARNING, MSG_INTL(MSG_MAP_SECORDER), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_MAP_SECORDER), sgp->sg_name, scop->sco_secname); if ((sgp->sg_flags & FLG_SG_KEY) == 0) @@ -391,7 +392,7 @@ comp(const void *ss1, const void *ss2) } uintptr_t -sort_ordered(Ofl_desc *ofl) +ld_sort_ordered(Ofl_desc *ofl) { Listnode *lnp1; Os_desc *osp; diff --git a/usr/src/cmd/sgs/libld/common/outfile.c b/usr/src/cmd/sgs/libld/common/outfile.c index dd73aadcad..c384124ada 100644 --- a/usr/src/cmd/sgs/libld/common/outfile.c +++ b/usr/src/cmd/sgs/libld/common/outfile.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,12 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -41,15 +40,41 @@ #include <errno.h> #include <string.h> #include <limits.h> +#include <debug.h> #include "msg.h" #include "_libld.h" -#include <debug.h> + +/* + * Determine a least common multiplier. Input sections contain an alignment + * requirement, which elf_update() uses to insure that the section is aligned + * correctly off of the base of the elf image. We must also insure that the + * sections mapping is congruent with this alignment requirement. For each + * input section associated with a loadable segment determine whether the + * segments alignment must be adjusted to compensate for a sections alignment + * requirements. + */ +Xword +ld_lcm(Xword a, Xword b) +{ + Xword _r, _a, _b; + + if ((_a = a) == 0) + return (b); + if ((_b = b) == 0) + return (a); + + if (_a > _b) + _a = b, _b = a; + while ((_r = _b % _a) != 0) + _b = _a, _a = _r; + return ((a / _a) * b); +} /* * Open the output file and insure the correct access modes. */ uintptr_t -open_outfile(Ofl_desc * ofl) +ld_open_outfile(Ofl_desc * ofl) { mode_t mask, mode; struct stat status; @@ -79,8 +104,8 @@ open_outfile(Ofl_desc * ofl) mode)) < 0) { int err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), ofl->ofl_name, - strerror(err)); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), + ofl->ofl_name, strerror(err)); return (S_ERROR); } @@ -120,7 +145,7 @@ open_outfile(Ofl_desc * ofl) * * o NOBITS sections must be converted into allocated, null filled sections. */ -uintptr_t +static uintptr_t pad_outfile(Ofl_desc * ofl) { Listnode * lnp1, * lnp2; @@ -135,11 +160,13 @@ pad_outfile(Ofl_desc * ofl) * section headers and data buffers as they relate to the new image. */ if (elf_update(ofl->ofl_welf, ELF_C_NULL) == -1) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_UPDATE), ofl->ofl_name); + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_UPDATE), + ofl->ofl_name); return (S_ERROR); } if ((ehdr = elf_getehdr(ofl->ofl_welf)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETEHDR), ofl->ofl_name); + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_GETEHDR), + ofl->ofl_name); return (S_ERROR); } @@ -170,8 +197,8 @@ pad_outfile(Ofl_desc * ofl) offset); if ((data = elf_newdata(oscn)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_NEWDATA), - ofl->ofl_name); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_NEWDATA), ofl->ofl_name); return (S_ERROR); } if ((data->d_buf = libld_calloc(size, 1)) == 0) @@ -180,7 +207,7 @@ pad_outfile(Ofl_desc * ofl) data->d_type = ELF_T_BYTE; data->d_size = size; data->d_align = 1; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; } /* @@ -234,7 +261,7 @@ pad_outfile(Ofl_desc * ofl) * becomes a linked list of input data buffers). */ uintptr_t -create_outfile(Ofl_desc * ofl) +ld_create_outfile(Ofl_desc * ofl) { Listnode * lnp1, * lnp2, * lnp3; Sg_desc * sgp; @@ -268,27 +295,30 @@ create_outfile(Ofl_desc * ofl) /* * If there are any ordered section, handle them here. */ - if ((ofl->ofl_ordered.head != NULL) && (sort_ordered(ofl) == S_ERROR)) + if ((ofl->ofl_ordered.head != NULL) && + (ld_sort_ordered(ofl) == S_ERROR)) return (S_ERROR); /* * Tell the access library about our new temporary file. */ if ((ofl->ofl_welf = elf_begin(fd, cmd, 0)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_BEGIN), ofl->ofl_name); + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_BEGIN), + ofl->ofl_name); return (S_ERROR); } /* * Obtain a new Elf header. */ - if ((ofl->ofl_ehdr = elf_newehdr(ofl->ofl_welf)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_NEWEHDR), ofl->ofl_name); + if ((ofl->ofl_nehdr = elf_newehdr(ofl->ofl_welf)) == NULL) { + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_NEWEHDR), + ofl->ofl_name); return (S_ERROR); } - ofl->ofl_ehdr->e_machine = ofl->ofl_e_machine; + ofl->ofl_nehdr->e_machine = ofl->ofl_dehdr->e_machine; - DBG_CALL(Dbg_util_nl()); + DBG_CALL(Dbg_util_nl(ofl->ofl_lml, DBG_NL_STD)); for (LIST_TRAVERSE(&ofl->ofl_segs, lnp1, sgp)) { int frst = 0; Phdr *phdr = &(sgp->sg_phdr); @@ -375,8 +405,8 @@ create_outfile(Ofl_desc * ofl) * Get a section descriptor for the section. */ if ((scn = elf_newscn(ofl->ofl_welf)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_NEWSCN), - ofl->ofl_name); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_NEWSCN), ofl->ofl_name); return (S_ERROR); } osp->os_scn = scn; @@ -388,8 +418,8 @@ create_outfile(Ofl_desc * ofl) * (refer place_section()) we might as well free it up. */ if ((shdr = elf_getshdr(scn)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR), - ofl->ofl_name); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETSHDR), ofl->ofl_name); return (S_ERROR); } *shdr = *(osp->os_shdr); @@ -443,12 +473,14 @@ create_outfile(Ofl_desc * ofl) ((ptype == PT_LOAD) && ((isp->is_flags & FLG_IS_SECTREF) == 0) && (isp->is_shdr->sh_size > 0)))) { + Lm_list *lml = ofl->ofl_lml; + if (ifl->ifl_flags & FLG_IF_IGNORE) { - isp->is_flags |= FLG_IS_DISCARD; - DBG_CALL(Dbg_unused_sec(isp)); - continue; + isp->is_flags |= FLG_IS_DISCARD; + DBG_CALL(Dbg_unused_sec(lml, isp)); + continue; } else - DBG_CALL(Dbg_unused_sec(isp)); + DBG_CALL(Dbg_unused_sec(lml, isp)); } dataidx++; @@ -481,7 +513,7 @@ create_outfile(Ofl_desc * ofl) * the old data. */ if ((data = elf_newdata(scn)) == NULL) { - eprintf(ERR_ELF, + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_NEWDATA), ofl->ofl_name); return (S_ERROR); @@ -504,7 +536,8 @@ create_outfile(Ofl_desc * ofl) (isp->is_shdr->sh_flags & SHF_TLS)) { if (tlsdata == 0) tlsdata = data; - tlsdata->d_align = lcm(tlsdata->d_align, + tlsdata->d_align = + ld_lcm(tlsdata->d_align, isp->is_shdr->sh_addralign); } @@ -569,8 +602,8 @@ create_outfile(Ofl_desc * ofl) if (nseg) { if ((ofl->ofl_phdr = elf_newphdr(ofl->ofl_welf, nseg)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_NEWPHDR), - ofl->ofl_name); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_NEWPHDR), ofl->ofl_name); return (S_ERROR); } } @@ -606,7 +639,8 @@ create_outfile(Ofl_desc * ofl) */ if ((ofl->ofl_size = (size_t)elf_update(ofl->ofl_welf, ELF_C_WRIMAGE)) == (size_t)-1) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_UPDATE), ofl->ofl_name); + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_UPDATE), + ofl->ofl_name); return (S_ERROR); } @@ -619,17 +653,19 @@ create_outfile(Ofl_desc * ofl) */ if ((ofl->ofl_elf = elf_begin(0, ELF_C_IMAGE, ofl->ofl_welf)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_BEGIN), ofl->ofl_name); + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_BEGIN), + ofl->ofl_name); return (S_ERROR); } - if ((ofl->ofl_ehdr = elf_getehdr(ofl->ofl_elf)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETEHDR), ofl->ofl_name); + if ((ofl->ofl_nehdr = elf_getehdr(ofl->ofl_elf)) == NULL) { + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_GETEHDR), + ofl->ofl_name); return (S_ERROR); } if (!(flags & FLG_OF_RELOBJ)) if ((ofl->ofl_phdr = elf_getphdr(ofl->ofl_elf)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETPHDR), - ofl->ofl_name); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETPHDR), ofl->ofl_name); return (S_ERROR); } @@ -645,14 +681,15 @@ create_outfile(Ofl_desc * ofl) for (LIST_TRAVERSE(&(sgp->sg_osdescs), lnp2, osp)) { if ((osp->os_scn = elf_getscn(ofl->ofl_elf, ++ndx)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSCN), - ofl->ofl_name, ndx); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETSCN), ofl->ofl_name, + ndx); return (S_ERROR); } if ((osp->os_shdr = elf_getshdr(osp->os_scn)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR), - ofl->ofl_name); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETSHDR), ofl->ofl_name); return (S_ERROR); } if ((fixalign == TRUE) && (sgp->sg_fscn != 0) && @@ -661,7 +698,7 @@ create_outfile(Ofl_desc * ofl) scn = sgp->sg_fscn; if ((fndx = elf_ndxscn(scn)) == SHN_UNDEF) { - eprintf(ERR_ELF, + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_NDXSCN), ofl->ofl_name); return (S_ERROR); @@ -674,8 +711,8 @@ create_outfile(Ofl_desc * ofl) if ((osp->os_outdata = elf_getdata(osp->os_scn, NULL)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETDATA), - ofl->ofl_name); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETDATA), ofl->ofl_name); return (S_ERROR); } @@ -684,7 +721,7 @@ create_outfile(Ofl_desc * ofl) * that the segments alignment is appropriate. */ if (_phdr->p_type == PT_LOAD) { - _phdr->p_align = (Xword)lcm(_phdr->p_align, + _phdr->p_align = ld_lcm(_phdr->p_align, osp->os_shdr->sh_addralign); } } diff --git a/usr/src/cmd/sgs/libld/common/place.c b/usr/src/cmd/sgs/libld/common/place.c index bb0bfedaf4..10529de287 100644 --- a/usr/src/cmd/sgs/libld/common/place.c +++ b/usr/src/cmd/sgs/libld/common/place.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,12 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -34,21 +33,19 @@ */ #include <stdio.h> #include <string.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" /* * Each time a section is placed, the function set_addralign() - * is called. This function performs: - * *) if the section is from an external file, - * check if this is empty or not. If not, - * we know the segment this section will belong - * needs a program header. (Of course, the program - * needed only if this section falls into a - * loadable segment.) - * *) compute the Least Common Multiplier for setting - * the segment alignment. + * is called. This function performs: + * + * . if the section is from an external file, check if this is empty or not. + * If not, we know the segment this section will belong needs a program + * header. (Of course, the program is needed only if this section falls + * into a loadable segment.) + * . compute the Least Common Multiplier for setting the segment alignment. */ static void set_addralign(Ofl_desc *ofl, Os_desc *osp, Is_desc *isp) @@ -67,8 +64,8 @@ set_addralign(Ofl_desc *ofl, Os_desc *osp, Is_desc *isp) (osp->os_sgdesc->sg_phdr).p_type != PT_LOAD) return; - osp->os_sgdesc->sg_addralign = lcm(osp->os_sgdesc->sg_addralign, - shdr->sh_addralign); + osp->os_sgdesc->sg_addralign = + ld_lcm(osp->os_sgdesc->sg_addralign, shdr->sh_addralign); } /* @@ -76,8 +73,8 @@ set_addralign(Ofl_desc *ofl, Os_desc *osp, Is_desc *isp) * os_txtndx. This information is derived from the Sg_desc->sg_segorder * list that was built up from the Mapfile. */ -int -set_os_txtndx(Is_desc *isp, Sg_desc * sgp) +static int +set_os_txtndx(Is_desc *isp, Sg_desc *sgp) { Listnode * lnp; Sec_order * scop; @@ -95,7 +92,7 @@ set_os_txtndx(Is_desc *isp, Sg_desc * sgp) * Place a section into the appropriate segment. */ Os_desc * -place_section(Ofl_desc * ofl, Is_desc * isp, int ident, Word link) +ld_place_section(Ofl_desc * ofl, Is_desc * isp, int ident, Word link) { Listnode * lnp1, * lnp2; Ent_desc * enp; @@ -106,16 +103,16 @@ place_section(Ofl_desc * ofl, Is_desc * isp, int ident, Word link) Xword shflagmask, shflags = shdr->sh_flags; Ifl_desc * ifl = isp->is_file; - DBG_CALL(Dbg_sec_in(isp)); + DBG_CALL(Dbg_sec_in(ofl->ofl_lml, isp)); if ((shflags & SHF_GROUP) || (shdr->sh_type == SHT_GROUP)) { Group_desc * gdesc; - if ((gdesc = get_group(ofl, isp)) == (Group_desc *)S_ERROR) + if ((gdesc = ld_get_group(ofl, isp)) == (Group_desc *)S_ERROR) return ((Os_desc *)S_ERROR); if (gdesc) { - DBG_CALL(Dbg_sec_group(isp, gdesc)); + DBG_CALL(Dbg_sec_group(ofl->ofl_lml, isp, gdesc)); /* * If this group is marked as discarded, then this @@ -249,20 +246,20 @@ place_section(Ofl_desc * ofl, Is_desc * isp, int ident, Word link) osp = isp->is_file->ifl_isdesc[link]->is_osdesc; /* * If this is a COMDAT section, then see if this - * section is a keeper and/or if it is to - * be discarded. + * section is a keeper and/or if it is to be discarded. */ if (shdr->sh_type == SHT_SUNW_COMDAT) { Listnode * clist; Is_desc * cisp; for (LIST_TRAVERSE(&(osp->os_comdats), clist, cisp)) { - if (strcmp(isp->is_basename, - cisp->is_basename) == 0) { - isp->is_flags |= FLG_IS_DISCARD; - DBG_CALL(Dbg_sec_discarded(isp, cisp)); - return (0); - } + if (strcmp(isp->is_basename, cisp->is_basename)) + continue; + + isp->is_flags |= FLG_IS_DISCARD; + DBG_CALL(Dbg_sec_discarded(ofl->ofl_lml, + isp, cisp)); + return (0); } /* @@ -281,7 +278,7 @@ place_section(Ofl_desc * ofl, Is_desc * isp, int ident, Word link) return ((Os_desc *)S_ERROR); isp->is_osdesc = osp; sgp = osp->os_sgdesc; - DBG_CALL(Dbg_sec_added(osp, sgp)); + DBG_CALL(Dbg_sec_added(ofl->ofl_lml, osp, sgp)); return (osp); } @@ -332,12 +329,13 @@ place_section(Ofl_desc * ofl, Is_desc * isp, int ident, Word link) for (LIST_TRAVERSE(&(osp->os_comdats), clist, cisp)) { if (strcmp(isp->is_basename, - cisp->is_basename) == 0) { - isp->is_flags |= FLG_IS_DISCARD; - DBG_CALL(Dbg_sec_discarded(isp, - cisp)); - return (0); - } + cisp->is_basename)) + continue; + + isp->is_flags |= FLG_IS_DISCARD; + DBG_CALL(Dbg_sec_discarded(ofl->ofl_lml, + isp, cisp)); + return (0); } /* @@ -397,14 +395,14 @@ place_section(Ofl_desc * ofl, Is_desc * isp, int ident, Word link) * section below. */ if (((ifl && (ifl->ifl_flags & FLG_IF_IGNORE)) || - dbg_mask) && + DBG_ENABLED) && (osp->os_flags & FLG_OS_SECTREF)) { isp->is_flags |= FLG_IS_SECTREF; if (ifl) ifl->ifl_flags |= FLG_IF_FILEREF; } - DBG_CALL(Dbg_sec_added(osp, sgp)); + DBG_CALL(Dbg_sec_added(ofl->ofl_lml, osp, sgp)); return (osp); } @@ -512,7 +510,7 @@ place_section(Ofl_desc * ofl, Is_desc * isp, int ident, Word link) (strcmp(osp->os_name, MSG_ORIG(MSG_SCN_JCR)) == 0)) { osp->os_flags |= FLG_OS_SECTREF; - if ((ifl && (ifl->ifl_flags & FLG_IF_IGNORE)) || dbg_mask) { + if ((ifl && (ifl->ifl_flags & FLG_IF_IGNORE)) || DBG_ENABLED) { isp->is_flags |= FLG_IS_SECTREF; if (ifl) ifl->ifl_flags |= FLG_IF_FILEREF; @@ -544,8 +542,9 @@ place_section(Ofl_desc * ofl, Is_desc * isp, int ident, Word link) */ if (sgp->sg_phdr.p_type == PT_LOAD) { if (!(osp->os_shdr->sh_flags & SHF_ALLOC)) { - eprintf(ERR_WARNING, MSG_INTL(MSG_SCN_NONALLOC), - ofl->ofl_name, osp->os_name); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_SCN_NONALLOC), ofl->ofl_name, + osp->os_name); osp->os_shdr->sh_flags |= SHF_ALLOC; } } @@ -566,7 +565,7 @@ place_section(Ofl_desc * ofl, Is_desc * isp, int ident, Word link) if (list_appendc(&(osp->os_isdescs), isp) == 0) return ((Os_desc *)S_ERROR); - DBG_CALL(Dbg_sec_created(osp, sgp)); + DBG_CALL(Dbg_sec_created(ofl->ofl_lml, osp, sgp)); isp->is_osdesc = osp; if (lnp2) { if (list_insertc(&(sgp->sg_osdescs), osp, lnp2) == 0) diff --git a/usr/src/cmd/sgs/libld/common/relocate.c b/usr/src/cmd/sgs/libld/common/relocate.c index ca4f995e30..a6fd3b83e1 100644 --- a/usr/src/cmd/sgs/libld/common/relocate.c +++ b/usr/src/cmd/sgs/libld/common/relocate.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. @@ -35,8 +34,8 @@ #include <string.h> #include <stdio.h> #include <alloca.h> -#include "debug.h" -#include "reloc.h" +#include <reloc.h> +#include <debug.h> #include "msg.h" #include "_libld.h" @@ -72,8 +71,8 @@ is_disp_copied(Ofl_desc *ofl, Copy_rel *cpy) */ if ((ifl->ifl_flags & FLG_IF_DISPDONE) && (ofl->ofl_flags & FLG_OF_VERBOSE)) - eprintf(ERR_WARNING, MSG_INTL(MSG_REL_DISPREL2), - conv_reloc_type_str(ifl->ifl_ehdr->e_machine, M_R_COPY), + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_REL_DISPREL2), + conv_reloc_type(ifl->ifl_ehdr->e_machine, M_R_COPY), ifl->ifl_name, demangle(sdp->sd_name)); if ((ifl->ifl_flags & FLG_IF_DISPPEND) == 0) @@ -128,9 +127,9 @@ is_disp_copied(Ofl_desc *ofl, Copy_rel *cpy) (void) strcpy(_str, str); str = (const char *)_str; } - eprintf(ERR_WARNING, MSG_INTL(MSG_REL_DISPREL1), - conv_reloc_type_str( - ifl->ifl_ehdr->e_machine, + eprintf(ofl->ofl_lml, + ERR_WARNING, MSG_INTL(MSG_REL_DISPREL1), + conv_reloc_type(ifl->ifl_ehdr->e_machine, (uint_t)ELF_R_TYPE(reloc->r_info)), ifl->ifl_name, str, MSG_INTL(MSG_STR_UNKNOWN), @@ -157,8 +156,9 @@ is_disp_copied(Ofl_desc *ofl, Copy_rel *cpy) (void) strcpy(_str, str); str = (const char *)_str; } - eprintf(ERR_WARNING, MSG_INTL(MSG_REL_DISPREL1), - conv_reloc_type_str(ifl->ifl_ehdr->e_machine, + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_REL_DISPREL1), + conv_reloc_type(ifl->ifl_ehdr->e_machine, (uint_t)ELF_R_TYPE(reloc->r_info)), ifl->ifl_name, demangle(rsdp->sd_name), str, EC_XWORD(reloc->r_offset), str); @@ -296,7 +296,7 @@ disp_scansyms(Ifl_desc * ifl, Rel_desc *rld, Boolean rlocal, int inspect, } void -disp_errmsg(const char *msg, Rel_desc *rsp, Ofl_desc *ofl) +ld_disp_errmsg(const char *msg, Rel_desc *rsp, Ofl_desc *ofl) { Sym_desc *sdp; const char *str; @@ -307,9 +307,9 @@ disp_errmsg(const char *msg, Rel_desc *rsp, Ofl_desc *ofl) else str = MSG_INTL(MSG_STR_UNKNOWN); - eprintf(ERR_WARNING, msg, conv_reloc_type_str(ifl->ifl_ehdr->e_machine, - rsp->rel_rtype), ifl->ifl_name, rsp->rel_sname, str, - EC_OFF(rsp->rel_roffset)); + eprintf(ofl->ofl_lml, ERR_WARNING, msg, + conv_reloc_type(ifl->ifl_ehdr->e_machine, rsp->rel_rtype), + ifl->ifl_name, rsp->rel_sname, str, EC_OFF(rsp->rel_roffset)); } /* @@ -424,7 +424,7 @@ disp_inspect(Ofl_desc *ofl, Rel_desc *rld, Boolean rlocal) * Add an active relocation record. */ uintptr_t -add_actrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) +ld_add_actrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) { Rel_desc *arsp; Rel_cache *rcp; @@ -492,15 +492,16 @@ add_actrel(Word flags, Rel_desc *rsp, Ofl_desc *ofl) ofl->ofl_dtflags_1 |= DF_1_DISPRELDNE; if (ofl->ofl_flags & FLG_OF_VERBOSE) - disp_errmsg(MSG_INTL(MSG_REL_DISPREL3), arsp, ofl); + ld_disp_errmsg(MSG_INTL(MSG_REL_DISPREL3), arsp, ofl); } - DBG_CALL(Dbg_reloc_ars_entry(M_MACH, arsp)); + DBG_CALL(Dbg_reloc_ars_entry(ofl->ofl_lml, ELF_DBG_LD, + arsp->rel_isdesc->is_shdr->sh_type, M_MACH, arsp)); return (1); } uintptr_t -reloc_GOT_relative(Boolean local, Rel_desc *rsp, Ofl_desc *ofl) +ld_reloc_GOT_relative(Boolean local, Rel_desc *rsp, Ofl_desc *ofl) { Sym_desc *sdp; Word flags = ofl->ofl_flags; @@ -513,11 +514,11 @@ reloc_GOT_relative(Boolean local, Rel_desc *rsp, Ofl_desc *ofl) * relocation we need to assign it a GOT token. Once we've got * all of the GOT's assigned we can assign the actual indexes. */ - if ((gnp = find_gotndx(&(sdp->sd_GOTndxs), GOT_REF_GENERIC, + if ((gnp = ld_find_gotndx(&(sdp->sd_GOTndxs), GOT_REF_GENERIC, ofl, rsp)) == 0) { Word rtype = rsp->rel_rtype; - if (assign_gotndx(&(sdp->sd_GOTndxs), 0, GOT_REF_GENERIC, + if (ld_assign_gotndx(&(sdp->sd_GOTndxs), 0, GOT_REF_GENERIC, ofl, rsp, sdp) == S_ERROR) return (S_ERROR); @@ -540,7 +541,7 @@ reloc_GOT_relative(Boolean local, Rel_desc *rsp, Ofl_desc *ofl) */ if (local == TRUE) { if (flags & FLG_OF_SHAROBJ) { - if (add_actrel((FLG_REL_GOT | FLG_REL_GOTCL), + if (ld_add_actrel((FLG_REL_GOT | FLG_REL_GOTCL), rsp, ofl) == S_ERROR) return (S_ERROR); @@ -552,25 +553,25 @@ reloc_GOT_relative(Boolean local, Rel_desc *rsp, Ofl_desc *ofl) (sdp->sd_shndx != SHN_ABS)) || (sdp->sd_aux && sdp->sd_aux->sa_symspec)) { rsp->rel_rtype = M_R_RELATIVE; - if (add_outrel((FLG_REL_GOT | + if (ld_add_outrel((FLG_REL_GOT | FLG_REL_ADVAL), rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_rtype = rtype; } } else { - if (add_actrel(FLG_REL_GOT, rsp, + if (ld_add_actrel(FLG_REL_GOT, rsp, ofl) == S_ERROR) return (S_ERROR); } } else { rsp->rel_rtype = M_R_GLOB_DAT; - if (add_outrel(FLG_REL_GOT, rsp, ofl) == S_ERROR) + if (ld_add_outrel(FLG_REL_GOT, rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_rtype = rtype; } } else { - if (assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_GENERIC, + if (ld_assign_gotndx(&(sdp->sd_GOTndxs), gnp, GOT_REF_GENERIC, ofl, rsp, sdp) == S_ERROR) return (S_ERROR); } @@ -578,7 +579,7 @@ reloc_GOT_relative(Boolean local, Rel_desc *rsp, Ofl_desc *ofl) /* * Perform relocation to GOT table entry. */ - return (add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(NULL, rsp, ofl)); } @@ -586,30 +587,28 @@ reloc_GOT_relative(Boolean local, Rel_desc *rsp, Ofl_desc *ofl) * Perform relocations for PLT's */ uintptr_t -reloc_plt(Rel_desc *rsp, Ofl_desc *ofl) +ld_reloc_plt(Rel_desc *rsp, Ofl_desc *ofl) { Sym_desc *sdp = rsp->rel_sym; -#if defined(__i386) || defined(__amd64) -#if defined(_ELF64) +#if defined(__i386) || defined(__amd64) +#if defined(_ELF64) /* - * AMD64 TLS code sequences do not use a unique - * TLS relocation to reference the __tls_get_addr() - * function call. + * AMD64 TLS code sequences do not use a unique TLS relocation to + * reference the __tls_get_addr() function call. */ if ((ofl->ofl_flags & FLG_OF_EXEC) && (strcmp(sdp->sd_name, MSG_ORIG(MSG_SYM_TLSGETADDR_U)) == 0)) { - return (add_actrel(FLG_REL_TLSFIX, rsp, ofl)); + return (ld_add_actrel(FLG_REL_TLSFIX, rsp, ofl)); } #else /* - * GNUC IA32 TLS code sequences do not use a unique - * TLS relocation to reference the ___tls_get_addr() - * function call. + * GNUC IA32 TLS code sequences do not use a unique TLS relocation to + * reference the ___tls_get_addr() function call. */ if ((ofl->ofl_flags & FLG_OF_EXEC) && (strcmp(sdp->sd_name, MSG_ORIG(MSG_SYM_TLSGETADDR_UU)) == 0)) { - return (add_actrel(FLG_REL_TLSFIX, rsp, ofl)); + return (ld_add_actrel(FLG_REL_TLSFIX, rsp, ofl)); } #endif #endif /* __i386 && __amd64 */ @@ -624,7 +623,7 @@ reloc_plt(Rel_desc *rsp, Ofl_desc *ofl) if (sdp->sd_aux->sa_PLTndx == 0) { Word ortype = rsp->rel_rtype; - assign_plt_ndx(sdp, ofl); + ld_assign_plt_ndx(sdp, ofl); /* * If this symbol is binding to a LAZYLOADED object then @@ -637,7 +636,7 @@ reloc_plt(Rel_desc *rsp, Ofl_desc *ofl) sdp->sd_flags |= FLG_SY_LAZYLD; rsp->rel_rtype = M_R_JMP_SLOT; - if (add_outrel(FLG_REL_PLT, rsp, ofl) == S_ERROR) + if (ld_add_outrel(FLG_REL_PLT, rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_rtype = ortype; } @@ -650,18 +649,18 @@ reloc_plt(Rel_desc *rsp, Ofl_desc *ofl) Word ortype = rsp->rel_rtype; rsp->rel_rtype = M_R_RELATIVE; - if (add_outrel(FLG_REL_ADVAL, rsp, ofl) == S_ERROR) + if (ld_add_outrel(FLG_REL_ADVAL, rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_rtype = ortype; return (1); } else - return (add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(NULL, rsp, ofl)); } /* * process GLOBAL undefined and ref_dyn_need symbols. */ -uintptr_t +static uintptr_t reloc_exec(Rel_desc *rsp, Ofl_desc *ofl) { Sym_desc *_sdp, *sdp = rsp->rel_sym; @@ -673,21 +672,21 @@ reloc_exec(Rel_desc *rsp, Ofl_desc *ofl) * Reference is to a function so simply create a plt entry for it. */ if (ELF_ST_TYPE(sym->st_info) == STT_FUNC) - return (reloc_plt(rsp, ofl)); + return (ld_reloc_plt(rsp, ofl)); /* * Catch absolutes - these may cause a text relocation. */ if ((sdp->sd_flags & FLG_SY_SPECSEC) && (sdp->sd_shndx == SHN_ABS)) { if ((ofl->ofl_flags1 & FLG_OF1_ABSEXEC) == 0) - return (add_outrel(NULL, rsp, ofl)); + return (ld_add_outrel(NULL, rsp, ofl)); + /* - * If -zabsexec is set then promote the ABSOLUTE - * symbol to current the current object and - * perform the relocation now. + * If -zabsexec is set then promote the ABSOLUTE symbol to + * current the current object and perform the relocation now. */ sdp->sd_ref = REF_REL_NEED; - return (add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(NULL, rsp, ofl)); } /* @@ -701,24 +700,24 @@ reloc_exec(Rel_desc *rsp, Ofl_desc *ofl) if ((ELF_ST_TYPE(sym->st_info) == STT_OBJECT) && (rsp->rel_osdesc->os_shdr->sh_flags & SHF_WRITE)) { if (sdp->sd_flags & FLG_SY_MVTOCOMM) - return (add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(NULL, rsp, ofl)); else - return (add_outrel(NULL, rsp, ofl)); + return (ld_add_outrel(NULL, rsp, ofl)); } /* - * If the reference isn't to an object (normally because some idiot - * hasn't defined a .type directive in some assembler source), then - * simply apply a generic relocation (this has a tendency to result in - * text relocations). + * If the reference isn't to an object (normally because a .type + * directive hasn't defined in some assembler source), then simply apply + * a generic relocation (this has a tendency to result in text + * relocations). */ if (ELF_ST_TYPE(sym->st_info) != STT_OBJECT) { - eprintf(ERR_WARNING, MSG_INTL(MSG_REL_UNEXPSYM), - conv_info_type_str(ofl->ofl_e_machine, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_REL_UNEXPSYM), + conv_sym_info_type(sdp->sd_file->ifl_ehdr->e_machine, ELF_ST_TYPE(sym->st_info)), rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname), sdp->sd_file->ifl_name); - return (add_outrel(NULL, rsp, ofl)); + return (ld_add_outrel(NULL, rsp, ofl)); } /* @@ -826,7 +825,7 @@ reloc_exec(Rel_desc *rsp, Ofl_desc *ofl) */ _sdp = rsp->rel_usym; stval = _sdp->sd_sym->st_value; - if (sym_copy(_sdp) == S_ERROR) + if (ld_sym_copy(_sdp) == S_ERROR) return (S_ERROR); _sdp->sd_shndx = _sdp->sd_sym->st_shndx = SHN_COMMON; _sdp->sd_flags |= FLG_SY_SPECSEC; @@ -861,7 +860,7 @@ reloc_exec(Rel_desc *rsp, Ofl_desc *ofl) return (S_ERROR); rsp->rel_rtype = M_R_COPY; - if (add_outrel(FLG_REL_BSS, rsp, ofl) == S_ERROR) + if (ld_add_outrel(FLG_REL_BSS, rsp, ofl) == S_ERROR) return (S_ERROR); rsp->rel_rtype = rtype; @@ -869,39 +868,40 @@ reloc_exec(Rel_desc *rsp, Ofl_desc *ofl) * If this symbol is a protected symbol, warn it. */ if (_sdp->sd_flags & FLG_SY_PROT) - eprintf(ERR_WARNING, MSG_INTL(MSG_REL_COPY), - conv_reloc_type_str(_sdp->sd_file->ifl_ehdr->e_machine, + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_REL_COPY), + conv_reloc_type(_sdp->sd_file->ifl_ehdr->e_machine, M_R_COPY), _sdp->sd_file->ifl_name, _sdp->sd_name); - DBG_CALL(Dbg_syms_reloc(sdp->sd_file->ifl_ehdr, sdp)); + DBG_CALL(Dbg_syms_reloc(ofl, sdp)); } - return (add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(NULL, rsp, ofl)); } /* * All relocations should have been handled by the other routines. This - * routine is hear as a catch all, if we do enter it we've goofed - but + * routine is here as a catch all, if we do enter it we've goofed - but * we'll try and to the best we can. */ -uintptr_t +static uintptr_t reloc_generic(Rel_desc *rsp, Ofl_desc *ofl) { - Word flags = ofl->ofl_flags; + Ifl_desc *ifl = rsp->rel_isdesc->is_file; - eprintf(ERR_WARNING, MSG_INTL(MSG_REL_UNEXPREL), - conv_reloc_type_str(ofl->ofl_e_machine, rsp->rel_rtype), - rsp->rel_isdesc->is_file->ifl_name, demangle(rsp->rel_sname)); + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_REL_UNEXPREL), + conv_reloc_type(ifl->ifl_ehdr->e_machine, rsp->rel_rtype), + ifl->ifl_name, demangle(rsp->rel_sname)); /* * If building a shared object then put the relocation off * until runtime. */ - if (flags & FLG_OF_SHAROBJ) - return (add_outrel(NULL, rsp, ofl)); + if (ofl->ofl_flags & FLG_OF_SHAROBJ) + return (ld_add_outrel(NULL, rsp, ofl)); /* * Otherwise process relocation now. */ - return (add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(NULL, rsp, ofl)); } /* @@ -927,12 +927,12 @@ reloc_relobj(Boolean local, Rel_desc *rsp, Ofl_desc *ofl) if (local && !IS_GOT_RELATIVE(rtype) && !IS_GOT_BASED(rtype) && !IS_GOT_PC(rtype) && IS_PC_RELATIVE(rtype) && ((sdp->sd_isc) && (sdp->sd_isc->is_osdesc == isp->is_osdesc))) - return (add_actrel(NULL, rsp, ofl)); + return (ld_add_actrel(NULL, rsp, ofl)); /* * If -zredlocsym is in effect, translate all local symbol relocations - * to be against section symbols, since section symbols are the only - * symbols which will be added to the .symtab. + * to be against against section symbols, since section symbols are + * the only symbols which will be added to the .symtab. */ if (local && (((ofl->ofl_flags1 & FLG_OF1_REDLSYM) && (ELF_ST_BIND(sdp->sd_sym->st_info) == STB_LOCAL)) || @@ -944,9 +944,10 @@ reloc_relobj(Boolean local, Rel_desc *rsp, Ofl_desc *ofl) if (IS_GOT_RELATIVE(rsp->rel_rtype)) { Ifl_desc *ifl = rsp->rel_isdesc->is_file; - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_PICREDLOC), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_REL_PICREDLOC), demangle(rsp->rel_sname), ifl->ifl_name, - conv_reloc_type_str(ifl->ifl_ehdr->e_machine, + conv_reloc_type(ifl->ifl_ehdr->e_machine, rsp->rel_rtype)); return (S_ERROR); } @@ -974,15 +975,15 @@ reloc_relobj(Boolean local, Rel_desc *rsp, Ofl_desc *ofl) */ if ((ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION) || (oflags == FLG_REL_SCNNDX)) - if (add_actrel(NULL, rsp, ofl) == S_ERROR) + if (ld_add_actrel(NULL, rsp, ofl) == S_ERROR) return (S_ERROR); #endif - return (add_outrel(oflags, rsp, ofl)); + return (ld_add_outrel(oflags, rsp, ofl)); } uintptr_t -process_sym_reloc(Ofl_desc * ofl, Rel_desc * reld, Rel * reloc, - Is_desc * isp, const char *isname) +ld_process_sym_reloc(Ofl_desc *ofl, Rel_desc *reld, Rel *reloc, Is_desc *isp, + const char *isname) { Word rtype = reld->rel_rtype; Word flags = ofl->ofl_flags; @@ -990,8 +991,8 @@ process_sym_reloc(Ofl_desc * ofl, Rel_desc * reld, Rel * reloc, Sym_aux *sap; Boolean local; - DBG_CALL(Dbg_reloc_in(M_MACH, M_REL_SHT_TYPE, (void *)reloc, - reld->rel_sname, isname)); + DBG_CALL(Dbg_reloc_in(ofl->ofl_lml, ELF_DBG_LD, M_MACH, M_REL_SHT_TYPE, + (void *)reloc, isname, reld->rel_sname)); /* * Indicate this symbol is being used for relocation and therefore must @@ -1095,10 +1096,11 @@ process_sym_reloc(Ofl_desc * ofl, Rel_desc * reld, Rel * reloc, * object - give a appropriate error message. */ if (!local && !(flags & FLG_OF_RELOBJ) && IS_GOT_BASED(rtype)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_BADGOTBASED), - conv_reloc_type_str(ofl->ofl_e_machine, rtype), - reld->rel_isdesc->is_file->ifl_name, - demangle(sdp->sd_name)); + Ifl_desc *ifl = reld->rel_isdesc->is_file; + + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_BADGOTBASED), + conv_reloc_type(ifl->ifl_ehdr->e_machine, rtype), + ifl->ifl_name, demangle(sdp->sd_name)); return (S_ERROR); } @@ -1111,10 +1113,12 @@ process_sym_reloc(Ofl_desc * ofl, Rel_desc * reld, Rel * reloc, * non-allocable. */ if (reld->rel_osdesc->os_shdr->sh_flags & SHF_ALLOC) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_BADTLS), - conv_reloc_type_str(ofl->ofl_e_machine, rtype), - reld->rel_isdesc->is_file->ifl_name, - demangle(sdp->sd_name)); + Ifl_desc *ifl = reld->rel_isdesc->is_file; + + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_REL_BADTLS), + conv_reloc_type(ifl->ifl_ehdr->e_machine, rtype), + ifl->ifl_name, demangle(sdp->sd_name)); return (S_ERROR); } } @@ -1123,30 +1127,30 @@ process_sym_reloc(Ofl_desc * ofl, Rel_desc * reld, Rel * reloc, * Select the relocation to perform. */ if (IS_REGISTER(rtype)) - return (reloc_register(reld, isp, ofl)); + return (ld_reloc_register(reld, isp, ofl)); if (flags & FLG_OF_RELOBJ) return (reloc_relobj(local, reld, ofl)); if (IS_TLS_INS(rtype)) - return (reloc_TLS(local, reld, ofl)); + return (ld_reloc_TLS(local, reld, ofl)); if (IS_GOT_INS(rtype)) - return (reloc_GOTOP(local, reld, ofl)); + return (ld_reloc_GOTOP(local, reld, ofl)); if (IS_GOT_RELATIVE(rtype)) - return (reloc_GOT_relative(local, reld, ofl)); + return (ld_reloc_GOT_relative(local, reld, ofl)); if (local) - return (reloc_local(reld, ofl)); + return (ld_reloc_local(reld, ofl)); if ((IS_PLT(rtype)) && ((flags & FLG_OF_BFLAG) == 0)) - return (reloc_plt(reld, ofl)); + return (ld_reloc_plt(reld, ofl)); if ((sdp->sd_ref == REF_REL_NEED) || (flags & FLG_OF_BFLAG) || (flags & FLG_OF_SHAROBJ) || (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_NOTYPE)) - return (add_outrel(NULL, reld, ofl)); + return (ld_add_outrel(NULL, reld, ofl)); if (sdp->sd_ref == REF_DYN_NEED) return (reloc_exec(reld, ofl)); @@ -1172,8 +1176,8 @@ process_reld(Ofl_desc *ofl, Is_desc *isp, Rel_desc *reld, Word rsndx, * Make sure the relocation is in the valid range. */ if (rtype >= M_R_NUM) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_INVALRELT), ifl->ifl_name, - isp->is_name, rtype); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_INVALRELT), + ifl->ifl_name, isp->is_name, rtype); return (S_ERROR); } @@ -1188,9 +1192,10 @@ process_reld(Ofl_desc *ofl, Is_desc *isp, Rel_desc *reld, Word rsndx, reld->rel_sym = 0; reld->rel_sname = MSG_ORIG(MSG_STR_EMPTY); - DBG_CALL(Dbg_reloc_in(M_MACH, isp->is_shdr->sh_type, - (void *)reloc, reld->rel_sname, isp->is_name)); - return (reloc_register(reld, isp, ofl)); + DBG_CALL(Dbg_reloc_in(ofl->ofl_lml, ELF_DBG_LD, M_MACH, + isp->is_shdr->sh_type, (void *)reloc, isp->is_name, + reld->rel_sname)); + return (ld_reloc_register(reld, isp, ofl)); } /* @@ -1216,16 +1221,17 @@ process_reld(Ofl_desc *ofl, Is_desc *isp, Rel_desc *reld, Word rsndx, * state some time). Normal users should never see this error. */ if (rtype == M_R_NONE) { - DBG_CALL(Dbg_reloc_in(M_MACH, M_REL_SHT_TYPE, (void *)reloc, - reld->rel_sname, isp->is_name)); - eprintf(ERR_WARNING, MSG_INTL(MSG_REL_NULL), ifl->ifl_name, - isp->is_name); + DBG_CALL(Dbg_reloc_in(ofl->ofl_lml, ELF_DBG_LD, M_MACH, + M_REL_SHT_TYPE, (void *)reloc, isp->is_name, + reld->rel_sname)); + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_REL_NULL), + ifl->ifl_name, isp->is_name); return (1); } if (((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) && IS_NOTSUP(rtype)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOTSUP), - conv_reloc_type_str(ifl->ifl_ehdr->e_machine, rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_NOTSUP), + conv_reloc_type(ifl->ifl_ehdr->e_machine, rtype), ifl->ifl_name, isp->is_name); return (S_ERROR); } @@ -1235,8 +1241,8 @@ process_reld(Ofl_desc *ofl, Is_desc *isp, Rel_desc *reld, Word rsndx, * symbol. If no symbol is assigned, this is a fatal error. */ if (sdp == NULL) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOSYMBOL), - conv_reloc_type_str(ifl->ifl_ehdr->e_machine, rtype), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYMBOL), + conv_reloc_type(ifl->ifl_ehdr->e_machine, rtype), isp->is_name, ifl->ifl_name, EC_XWORD(reloc->r_offset)); return (S_ERROR); } @@ -1253,10 +1259,11 @@ process_reld(Ofl_desc *ofl, Is_desc *isp, Rel_desc *reld, Word rsndx, if ((reld->rel_sname != sdp->sd_name) || (ELF_ST_BIND(sdp->sd_sym->st_info) == STB_LOCAL) || - ((nsdp = sym_find(sdp->sd_name, SYM_NOHASH, 0, + ((nsdp = ld_sym_find(sdp->sd_name, SYM_NOHASH, 0, ofl)) == 0)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_SYMDISC), - ifl->ifl_name, isp->is_name, demangle(sdp->sd_name), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_REL_SYMDISC), ifl->ifl_name, + isp->is_name, demangle(sdp->sd_name), sdp->sd_isc->is_name); return (S_ERROR); } @@ -1268,7 +1275,7 @@ process_reld(Ofl_desc *ofl, Is_desc *isp, Rel_desc *reld, Word rsndx, * adjusting. */ if (sdp->sd_aux && ((sdp->sd_flags & FLG_SY_VISIBLE) == 0)) - sym_adjust_vis(sdp, ofl); + ld_sym_adjust_vis(sdp, ofl); /* * Ignore any relocation against a section that will not be in the @@ -1286,15 +1293,15 @@ process_reld(Ofl_desc *ofl, Is_desc *isp, Rel_desc *reld, Word rsndx, */ if ((sdp->sd_flags & FLG_SY_INVALID) || (rsndx == 0) || (rsndx >= ifl->ifl_symscnt)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_UNKNWSYM), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_UNKNWSYM), M_REL_CONTYPSTR(rtype), ifl->ifl_name, isp->is_name, - demangle(reld->rel_sname), EC_XWORD(reloc->r_offset), - EC_WORD(rsndx)); + demangle(reld->rel_sname), + EC_XWORD(reloc->r_offset), EC_WORD(rsndx)); return (S_ERROR); } reld->rel_sym = sdp; - return (process_sym_reloc(ofl, reld, reloc, isp, isp->is_name)); + return (ld_process_sym_reloc(ofl, reld, reloc, isp, isp->is_name)); } static uintptr_t @@ -1336,7 +1343,7 @@ reloc_section(Ofl_desc *ofl, Is_desc *isect, Is_desc *rsect, Os_desc *osect) if (shdr->sh_info == 0) flags |= FLG_REL_NOINFO; - DBG_CALL(Dbg_reloc_proc(osect, isect, rsect)); + DBG_CALL(Dbg_reloc_proc(ofl->ofl_lml, osect, isect, rsect)); for (rend = (Rel *)((uintptr_t)reloc + (uintptr_t)rsize); reloc < rend; @@ -1350,7 +1357,7 @@ reloc_section(Ofl_desc *ofl, Is_desc *isect, Is_desc *rsect, Os_desc *osect) * relocation records processing. */ reld.rel_flags = flags; - rsndx = init_rel(&reld, (void *)reloc); + rsndx = ld_init_rel(&reld, (void *)reloc); if (process_reld(ofl, rsect, &reld, rsndx, reloc) == S_ERROR) return (S_ERROR); @@ -1358,8 +1365,7 @@ reloc_section(Ofl_desc *ofl, Is_desc *isect, Is_desc *rsect, Os_desc *osect) return (1); } - -uintptr_t +static uintptr_t reloc_segments(int wr_flag, Ofl_desc *ofl) { Listnode *lnp1; @@ -1494,7 +1500,7 @@ process_movereloc(Ofl_desc *ofl, Is_desc *rsect) * Initialize the relocation record information. */ reld.rel_flags = FLG_REL_LOAD; - rsndx = init_rel(&reld, (void *)reloc); + rsndx = ld_init_rel(&reld, (void *)reloc); if (((mp = get_move_entry(rsect, reloc->r_offset)) == 0) || ((reld.rel_move = libld_malloc(sizeof (Mv_desc))) == 0)) @@ -1569,7 +1575,7 @@ reloc_movesections(Ofl_desc *ofl) * the relocation structures for later processing. */ uintptr_t -reloc_init(Ofl_desc *ofl) +ld_reloc_init(Ofl_desc *ofl) { Listnode *lnp; Is_desc *isp; @@ -1579,7 +1585,7 @@ reloc_init(Ofl_desc *ofl) * sure we add any absolute (internal) symbols before continuing with * any relocation processing. */ - if (sym_spec(ofl) == S_ERROR) + if (ld_sym_spec(ofl) == S_ERROR) return (S_ERROR); ofl->ofl_gotcnt = M_GOT_XNumber; @@ -1644,15 +1650,17 @@ reloc_init(Ofl_desc *ofl) */ if (((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) && ((ofl->ofl_flags & FLG_OF_BLDGOT) || - (sym_find(MSG_ORIG(MSG_SYM_GOFTBL), SYM_NOHASH, 0, ofl) != 0) || - (sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U), SYM_NOHASH, 0, ofl) != 0))) { - if (make_got(ofl) == S_ERROR) + (ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL), + SYM_NOHASH, 0, ofl) != 0) || + (ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U), + SYM_NOHASH, 0, ofl) != 0))) { + if (ld_make_got(ofl) == S_ERROR) return (S_ERROR); -#if defined(sparc) || defined(__sparcv9) - if (allocate_got(ofl) == S_ERROR) +#if defined(sparc) || defined(__sparcv9) + if (ld_allocate_got(ofl) == S_ERROR) return (S_ERROR); -#elif defined(i386) || defined(__amd64) +#elif defined(i386) || defined(__amd64) /* nothing to do */ #else #error Unknown architecture! @@ -1676,7 +1684,7 @@ reloc_init(Ofl_desc *ofl) * This provides the most efficient traversal of the relocation * table at run-time. */ -int +static int reloc_compare(Reloc_list *i, Reloc_list *j) { @@ -1711,8 +1719,7 @@ reloc_compare(Reloc_list *i, Reloc_list *j) return (0); } - -uintptr_t +static uintptr_t do_sorted_outrelocs(Ofl_desc *ofl) { Rel_desc *orsp; @@ -1744,7 +1751,8 @@ do_sorted_outrelocs(Ofl_desc *ofl) for (orsp = (Rel_desc *)(rcp + 1); orsp < rcp->rc_free; orsp++) { if (debug == 0) { - DBG_CALL(Dbg_reloc_dooutrel(M_REL_SHT_TYPE)); + DBG_CALL(Dbg_reloc_dooutrel(ofl->ofl_lml, + M_REL_SHT_TYPE)); debug = 1; } @@ -1753,7 +1761,7 @@ do_sorted_outrelocs(Ofl_desc *ofl) * order that it was originally processed. */ if (orsp->rel_flags & FLG_REL_PLT) { - if (perform_outreloc(orsp, ofl) == S_ERROR) + if (ld_perform_outreloc(orsp, ofl) == S_ERROR) error = S_ERROR; continue; } @@ -1773,7 +1781,7 @@ do_sorted_outrelocs(Ofl_desc *ofl) if (orsp->rel_flags & FLG_REL_GOT) sorted_list[index].rl_key3 = - calc_got_offset(orsp, ofl); + ld_calc_got_offset(orsp, ofl); else { if (orsp->rel_rtype == M_R_REGISTER) sorted_list[index].rl_key3 = 0; @@ -1800,7 +1808,7 @@ do_sorted_outrelocs(Ofl_desc *ofl) * and process each relocation. */ for (index = 0; index < ofl->ofl_reloccnt; index++) { - if (perform_outreloc(sorted_list[index].rl_rsp, ofl) == + if (ld_perform_outreloc(sorted_list[index].rl_rsp, ofl) == S_ERROR) error = S_ERROR; } @@ -1813,7 +1821,7 @@ do_sorted_outrelocs(Ofl_desc *ofl) * section and invokes reloc_sec() to relocate that section. */ uintptr_t -reloc_process(Ofl_desc *ofl) +ld_reloc_process(Ofl_desc *ofl) { Listnode *lnp1; Sg_desc *sgp; @@ -1846,7 +1854,7 @@ reloc_process(Ofl_desc *ofl) if (do_sorted_outrelocs(ofl) == S_ERROR) return (S_ERROR); - if (do_activerelocs(ofl) == S_ERROR) + if (ld_do_activerelocs(ofl) == S_ERROR) return (S_ERROR); if ((ofl->ofl_flags1 & FLG_OF1_RELCNT) == 0) { @@ -1910,7 +1918,7 @@ reloc_process(Ofl_desc *ofl) */ if ((flags & (FLG_OF_PURETXT | FLG_OF_TEXTREL)) == (FLG_OF_PURETXT | FLG_OF_TEXTREL)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_REMAIN_3)); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_REL_REMAIN_3)); return (S_ERROR); } @@ -1919,7 +1927,7 @@ reloc_process(Ofl_desc *ofl) * .dynamic section (_DYNAMIC). */ if (flags & FLG_OF_DYNAMIC) { - if (fillin_gotplt1(ofl) == S_ERROR) + if (ld_fillin_gotplt(ofl) == S_ERROR) return (S_ERROR); } @@ -1944,9 +1952,8 @@ reloc_process(Ofl_desc *ofl) * anything to fix the error - thus we've chosen not to give the user an error, * or warning, for this case. */ - -void -reloc_remain_title(int warning) +static void +reloc_remain_title(Ofl_desc *ofl, int warning) { const char *str1; @@ -1955,7 +1962,7 @@ reloc_remain_title(int warning) else str1 = MSG_INTL(MSG_REL_RMN_ITM_11); - eprintf(ERR_NONE, MSG_INTL(MSG_REL_REMAIN_FMT_1), + eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_REL_REMAIN_FMT_1), str1, MSG_INTL(MSG_REL_RMN_ITM_31), MSG_INTL(MSG_REL_RMN_ITM_12), @@ -1965,7 +1972,7 @@ reloc_remain_title(int warning) } void -reloc_remain_entry(Rel_desc *orsp, Os_desc *osp, Ofl_desc *ofl) +ld_reloc_remain_entry(Rel_desc *orsp, Os_desc *osp, Ofl_desc *ofl) { static Boolean reloc_title = TRUE; @@ -1999,14 +2006,15 @@ reloc_remain_entry(Rel_desc *orsp, Os_desc *osp, Ofl_desc *ofl) * building a executable then only emit a 'warning'. */ if (ofl->ofl_flags & FLG_OF_PURETXT) - reloc_remain_title(0); + reloc_remain_title(ofl, 0); else - reloc_remain_title(1); + reloc_remain_title(ofl, 1); reloc_title = FALSE; } - eprintf(ERR_NONE, MSG_INTL(MSG_REL_REMAIN_2), demangle(orsp->rel_sname), - EC_OFF(orsp->rel_roffset), orsp->rel_isdesc->is_file->ifl_name); + eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_REL_REMAIN_2), + demangle(orsp->rel_sname), EC_OFF(orsp->rel_roffset), + orsp->rel_isdesc->is_file->ifl_name); } /* @@ -2052,7 +2060,7 @@ newroffset_for_move(Sym_desc *symd, } void -adj_movereloc(Ofl_desc *ofl, Rel_desc *arsp) +ld_adj_movereloc(Ofl_desc *ofl, Rel_desc *arsp) { Move *move = arsp->rel_move->mvd_move; Sym_desc *psdp = arsp->rel_move->mvd_sym; @@ -2064,19 +2072,18 @@ adj_movereloc(Ofl_desc *ofl, Rel_desc *arsp) */ (void) newroffset_for_move(psdp, move, arsp->rel_roffset, &newoffset); - DBG_CALL(Dbg_move_adjmovereloc(arsp->rel_roffset, newoffset, - psdp->sd_name)); + DBG_CALL(Dbg_move_adjmovereloc(ofl->ofl_lml, arsp->rel_roffset, + newoffset, psdp->sd_name)); arsp->rel_roffset = newoffset; } else { /* * We are expanding the partial symbol. So we are generating * the relocation entry relocating the expanded partial symbol. */ - arsp->rel_roffset += - psdp->sd_sym->st_value - + arsp->rel_roffset += psdp->sd_sym->st_value - ofl->ofl_issunwdata1->is_osdesc->os_shdr->sh_addr; - DBG_CALL(Dbg_move_adjexpandreloc(arsp->rel_roffset, - psdp->sd_name)); + DBG_CALL(Dbg_move_adjexpandreloc(ofl->ofl_lml, + arsp->rel_roffset, psdp->sd_name)); } } @@ -2087,7 +2094,7 @@ adj_movereloc(Ofl_desc *ofl, Rel_desc *arsp) * at the relocation target address. */ Sym_desc * -am_I_partial(Rel_desc *reld, Xword val) +ld_am_I_partial(Rel_desc *reld, Xword val) { Ifl_desc * ifile = reld->rel_sym->sd_isc->is_file; int nlocs = ifile->ifl_locscnt, i; diff --git a/usr/src/cmd/sgs/libld/common/resolve.c b/usr/src/cmd/sgs/libld/common/resolve.c index 9762660e76..499c25161b 100644 --- a/usr/src/cmd/sgs/libld/common/resolve.c +++ b/usr/src/cmd/sgs/libld/common/resolve.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" /* SVR4 6.2/18.2 */ @@ -33,7 +32,7 @@ * Symbol table resolution */ #include <stdio.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" @@ -72,7 +71,7 @@ sym_typecheck(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, /* * Perform any machine specific type checking. */ - if (mach_sym_typecheck(sdp, nsym, ifl, ofl)) + if (ld_mach_sym_typecheck(sdp, nsym, ifl, ofl)) return; /* @@ -100,11 +99,12 @@ sym_typecheck(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, if ((otype == ntype) || (otype == STT_NOTYPE) || (ntype == STT_NOTYPE)) return; - eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFTYPE), + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_SYM_DIFFTYPE), demangle(sdp->sd_name)); - eprintf(ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES), sdp->sd_file->ifl_name, - conv_info_type_str(ofl->ofl_e_machine, otype), ifl->ifl_name, - conv_info_type_str(ofl->ofl_e_machine, ntype)); + eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES), + sdp->sd_file->ifl_name, + conv_sym_info_type(ofl->ofl_dehdr->e_machine, otype), ifl->ifl_name, + conv_sym_info_type(ofl->ofl_dehdr->e_machine, ntype)); } /*ARGSUSED4*/ @@ -115,7 +115,7 @@ sym_mach_check(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, /* * Perform any machine specific type checking. */ - (void) mach_sym_typecheck(sdp, nsym, ifl, ofl); + (void) ld_mach_sym_typecheck(sdp, nsym, ifl, ofl); } /* @@ -326,8 +326,9 @@ sym_override(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, */ if (((nsymflags & FLG_SY_SPECSEC) == 0) && (nshndx != SHN_UNDEF)) if ((sdp->sd_isc = ifl->ifl_isdesc[nshndx]) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_NOSECDEF), - demangle(sdp->sd_name), ifl->ifl_name); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_SYM_NOSECDEF), demangle(sdp->sd_name), + ifl->ifl_name); ofl->ofl_flags |= FLG_OF_FATAL; } } @@ -383,13 +384,13 @@ sym_tworeals(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, */ if ((ofile == ET_REL) && (nfile == ET_REL) && (obind != STB_WEAK) && (nbind != STB_WEAK) && (!(ofl->ofl_flags & FLG_OF_MULDEFS))) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_MULDEF), + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYM_MULDEF), demangle(sdp->sd_name)); - eprintf(ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES), + eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES), sdp->sd_file->ifl_name, - conv_info_type_str(ofl->ofl_e_machine, otype), + conv_sym_info_type(ofl->ofl_dehdr->e_machine, otype), ifl->ifl_name, - conv_info_type_str(ofl->ofl_e_machine, ntype)); + conv_sym_info_type(ofl->ofl_dehdr->e_machine, ntype)); ofl->ofl_flags |= FLG_OF_FATAL; return; } @@ -397,27 +398,28 @@ sym_tworeals(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, /* * Perform any machine specific type checking. */ - if (mach_sym_typecheck(sdp, nsym, ifl, ofl)) + if (ld_mach_sym_typecheck(sdp, nsym, ifl, ofl)) return; /* * Check the symbols type and size. */ if (otype != ntype) { - eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFTYPE), + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_SYM_DIFFTYPE), demangle(sdp->sd_name)); - eprintf(ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES), + eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES), sdp->sd_file->ifl_name, - conv_info_type_str(ofl->ofl_e_machine, otype), - ifl->ifl_name, conv_info_type_str(ofl->ofl_e_machine, + conv_sym_info_type(ofl->ofl_dehdr->e_machine, otype), + ifl->ifl_name, conv_sym_info_type(ofl->ofl_dehdr->e_machine, ntype)); warn++; } else if ((otype == STT_OBJECT) && (osym->st_size != nsym->st_size)) { if (!(ofl->ofl_flags & FLG_OF_NOWARN)) { - eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFATTR), - demangle(sdp->sd_name), MSG_INTL(MSG_STR_SIZES), - sdp->sd_file->ifl_name, EC_XWORD(osym->st_size), - ifl->ifl_name, EC_XWORD(nsym->st_size)); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_SYM_DIFFATTR), demangle(sdp->sd_name), + MSG_INTL(MSG_STR_SIZES), sdp->sd_file->ifl_name, + EC_XWORD(osym->st_size), ifl->ifl_name, + EC_XWORD(nsym->st_size)); warn++; } } @@ -440,20 +442,20 @@ sym_tworeals(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, */ if ((sdp->sd_flags & FLG_SY_SOFOUND) && (nfile == ET_DYN)) { if (warn) - eprintf(ERR_NONE, MSG_INTL(MSG_SYM_DEFTAKEN), - sdp->sd_file->ifl_name); + eprintf(ofl->ofl_lml, ERR_NONE, + MSG_INTL(MSG_SYM_DEFTAKEN), sdp->sd_file->ifl_name); return; } else if ((nfile == ET_REL) && ((ofile == ET_DYN) || ((obind == STB_WEAK) && (nbind != STB_WEAK)))) { if (warn) - eprintf(ERR_NONE, MSG_INTL(MSG_SYM_DEFTAKEN), - ifl->ifl_name); + eprintf(ofl->ofl_lml, ERR_NONE, + MSG_INTL(MSG_SYM_DEFTAKEN), ifl->ifl_name); sym_override(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags); return; } else { if (warn) - eprintf(ERR_NONE, MSG_INTL(MSG_SYM_DEFTAKEN), - sdp->sd_file->ifl_name); + eprintf(ofl->ofl_lml, ERR_NONE, + MSG_INTL(MSG_SYM_DEFTAKEN), sdp->sd_file->ifl_name); sym_promote(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags); return; } @@ -494,19 +496,19 @@ sym_realtent(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, if ((ofile == ET_REL) && (nfile == ET_REL) && (obind == nbind) && ((otype == STT_FUNC) || (ntype == STT_FUNC))) { if (ofl->ofl_flags & FLG_OF_MULDEFS) { - eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFTYPE), - demangle(sdp->sd_name)); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_SYM_DIFFTYPE), demangle(sdp->sd_name)); sym_promote(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags); } else { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_MULDEF), - demangle(sdp->sd_name)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_SYM_MULDEF), demangle(sdp->sd_name)); ofl->ofl_flags |= FLG_OF_FATAL; } - eprintf(ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES), + eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES), sdp->sd_file->ifl_name, - conv_info_type_str(ofl->ofl_e_machine, otype), - ifl->ifl_name, conv_info_type_str(ofl->ofl_e_machine, + conv_sym_info_type(ofl->ofl_dehdr->e_machine, otype), + ifl->ifl_name, conv_sym_info_type(ofl->ofl_dehdr->e_machine, ntype)); return; } else if (ofile != nfile) { @@ -541,12 +543,12 @@ sym_realtent(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, * Check the symbols type and size. */ if (otype != ntype) { - eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFTYPE), + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_SYM_DIFFTYPE), demangle(sdp->sd_name)); - eprintf(ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES), + eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_SYM_FILETYPES), sdp->sd_file->ifl_name, - conv_info_type_str(ofl->ofl_e_machine, otype), - ifl->ifl_name, conv_info_type_str(ofl->ofl_e_machine, + conv_sym_info_type(ofl->ofl_dehdr->e_machine, otype), + ifl->ifl_name, conv_sym_info_type(ofl->ofl_dehdr->e_machine, ntype)); warn++; } else if (osym->st_size != nsym->st_size) { @@ -561,15 +563,18 @@ sym_realtent(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, (obind == nbind)) && ((otent && (osym->st_size > nsym->st_size)) || (ntent && (osym->st_size < nsym->st_size)))) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_DIFFATTR), - demangle(sdp->sd_name), MSG_INTL(MSG_STR_SIZES), - sdp->sd_file->ifl_name, EC_XWORD(osym->st_size), - ifl->ifl_name, EC_XWORD(nsym->st_size)); - eprintf(ERR_NONE, MSG_INTL(MSG_SYM_TENTERR)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_SYM_DIFFATTR), demangle(sdp->sd_name), + MSG_INTL(MSG_STR_SIZES), sdp->sd_file->ifl_name, + EC_XWORD(osym->st_size), ifl->ifl_name, + EC_XWORD(nsym->st_size)); + eprintf(ofl->ofl_lml, ERR_NONE, + MSG_INTL(MSG_SYM_TENTERR)); ofl->ofl_flags |= FLG_OF_FATAL; } else { if (!(ofl->ofl_flags & FLG_OF_NOWARN)) { - eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFATTR), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_SYM_DIFFATTR), demangle(sdp->sd_name), MSG_INTL(MSG_STR_SIZES), sdp->sd_file->ifl_name, @@ -614,22 +619,22 @@ sym_realtent(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, if ((sdp->sd_flags & FLG_SY_SOFOUND) && (nfile == ET_DYN)) { if (warn) - eprintf(ERR_NONE, MSG_INTL(MSG_SYM_DEFTAKEN), - sdp->sd_file->ifl_name); + eprintf(ofl->ofl_lml, ERR_NONE, + MSG_INTL(MSG_SYM_DEFTAKEN), sdp->sd_file->ifl_name); return; } if (((otent) && (!((obind != STB_WEAK) && (nbind == STB_WEAK)))) || ((obind == STB_WEAK) && (nbind != STB_WEAK))) { if (warn) - eprintf(ERR_NONE, MSG_INTL(MSG_SYM_DEFTAKEN), - ifl->ifl_name); + eprintf(ofl->ofl_lml, ERR_NONE, + MSG_INTL(MSG_SYM_DEFTAKEN), ifl->ifl_name); sym_override(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags); return; } else { if (warn) - eprintf(ERR_NONE, MSG_INTL(MSG_SYM_DEFTAKEN), - sdp->sd_file->ifl_name); + eprintf(ofl->ofl_lml, ERR_NONE, + MSG_INTL(MSG_SYM_DEFTAKEN), sdp->sd_file->ifl_name); sym_promote(sdp, nsym, ifl, ofl, ndx, nshndx, nsymflags); return; } @@ -716,8 +721,8 @@ sym_twotent(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, alignscompliment = 0; if (!(ofl->ofl_flags & FLG_OF_NOWARN) && !alignscompliment) - eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFATTR), - demangle(sdp->sd_name), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_SYM_DIFFATTR), demangle(sdp->sd_name), MSG_INTL(MSG_STR_ALIGNMENTS), sdp->sd_file->ifl_name, EC_XWORD(osym->st_value), ifl->ifl_name, EC_XWORD(nsym->st_value)); @@ -742,7 +747,7 @@ sym_twotent(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, value = balign; } if (!(ofl->ofl_flags & FLG_OF_NOWARN) && !alignscompliment) - eprintf(ERR_NONE, emsg, file); + eprintf(ofl->ofl_lml, ERR_NONE, emsg, file); } /* @@ -753,10 +758,11 @@ sym_twotent(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, const char *file; if (!(ofl->ofl_flags & FLG_OF_NOWARN)) - eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_DIFFATTR), - demangle(sdp->sd_name), MSG_INTL(MSG_STR_SIZES), - sdp->sd_file->ifl_name, EC_XWORD(osym->st_size), - ifl->ifl_name, EC_XWORD(nsym->st_size)); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_SYM_DIFFATTR), demangle(sdp->sd_name), + MSG_INTL(MSG_STR_SIZES), sdp->sd_file->ifl_name, + EC_XWORD(osym->st_size), ifl->ifl_name, + EC_XWORD(nsym->st_size)); /* @@ -765,7 +771,7 @@ sym_twotent(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, */ if ((sdp->sd_flags & FLG_SY_SOFOUND) && (nfile == ET_DYN)) { if (!(ofl->ofl_flags & FLG_OF_NOWARN)) - eprintf(ERR_NONE, emsg, + eprintf(ofl->ofl_lml, ERR_NONE, emsg, sdp->sd_file->ifl_name); return; } @@ -814,7 +820,7 @@ sym_twotent(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, file = sdp->sd_file->ifl_name; } if (!(ofl->ofl_flags & FLG_OF_NOWARN)) - eprintf(ERR_NONE, emsg, file); + eprintf(ofl->ofl_lml, ERR_NONE, emsg, file); if (size) sdp->sd_sym->st_size = (Xword)size; } else { @@ -884,8 +890,8 @@ static void (*Action[REF_NUM * SYM_NUM * 2][SYM_NUM])(Sym_desc *, }; uintptr_t -sym_resolve(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, int ndx, - Word nshndx, Word nsymflags) +ld_sym_resolve(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, int ndx, + Word nshndx, Word nsymflags) { int row, column; /* State table coordinates */ Sym *osym = sdp->sd_sym; @@ -953,8 +959,8 @@ sym_resolve(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, int ndx, } } - DBG_CALL(Dbg_syms_resolving1(ndx, sdp->sd_name, row, column)); - DBG_CALL(Dbg_syms_resolving2(ifl->ifl_ehdr, osym, nsym, sdp, ifl)); + DBG_CALL(Dbg_syms_resolving(ofl, ndx, sdp->sd_name, row, column, + osym, nsym, sdp, ifl)); /* * Record the input filename on the defined files list for possible @@ -980,7 +986,7 @@ sym_resolve(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, int ndx, */ if ((sdp->sd_file == ifl) && (nfile == ET_REL) && (ifl->ifl_versym) && (nshndx != SHN_UNDEF)) - vers_promote(sdp, ndx, ifl, ofl); + ld_vers_promote(sdp, ndx, ifl, ofl); /* * Determine whether a mapfile reference has been satisfied. Mapfile @@ -1009,7 +1015,7 @@ sym_resolve(Sym_desc *sdp, Sym *nsym, Ifl_desc *ifl, Ofl_desc *ofl, int ndx, sdp->sd_flags |= FLG_SY_MAPUSED; } - DBG_CALL(Dbg_syms_resolved(ifl->ifl_ehdr, sdp)); + DBG_CALL(Dbg_syms_resolved(ofl, sdp)); return (1); } diff --git a/usr/src/cmd/sgs/libld/common/sections.c b/usr/src/cmd/sgs/libld/common/sections.c index 51e059f8e5..aaf92180b6 100644 --- a/usr/src/cmd/sgs/libld/common/sections.c +++ b/usr/src/cmd/sgs/libld/common/sections.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. @@ -24,7 +23,7 @@ * Copyright (c) 1988 AT&T * All Rights Reserved * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -35,9 +34,8 @@ #include <string.h> #include <strings.h> #include <stdio.h> -#include <unistd.h> #include <link.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" @@ -58,7 +56,7 @@ * So even if -zignore is in effect, if the section is not allocatable, * we do not eliminate it. */ -uintptr_t +static uintptr_t ignore_section_processing(Ofl_desc *ofl) { Listnode *lnp; @@ -72,7 +70,8 @@ ignore_section_processing(Ofl_desc *ofl) * Diagnose (-D unused) a completely unreferenced file. */ if ((ifl->ifl_flags & FLG_IF_FILEREF) == 0) - DBG_CALL(Dbg_unused_file(ifl->ifl_name, 0, 0)); + DBG_CALL(Dbg_unused_file(ofl->ofl_lml, + ifl->ifl_name, 0, 0)); if (((ofl->ofl_flags1 & FLG_OF1_IGNPRC) == 0) || ((ifl->ifl_flags & FLG_IF_IGNORE) == 0)) continue; @@ -85,7 +84,7 @@ ignore_section_processing(Ofl_desc *ofl) discard = 0; if (ifl->ifl_flags & FLG_IF_FILEREF) { for (num = 1; num < ifl->ifl_shnum; num++) { - Is_desc *isp; + Is_desc *isp = ifl->ifl_isdesc[num]; Os_desc *osp; Sg_desc *sgp; @@ -161,9 +160,9 @@ ignore_section_processing(Ofl_desc *ofl) * the symbol is being defined in - skip it. */ if ((sdp->sd_isc->is_flags & FLG_IS_SECTREF) || - (((ifl->ifl_flags & FLG_IF_FILEREF) && + ((ifl->ifl_flags & FLG_IF_FILEREF) && ((osp = sdp->sd_isc->is_osdesc) != 0) && - (osp->os_sgdesc->sg_phdr.p_type != PT_LOAD)))) + (osp->os_sgdesc->sg_phdr.p_type != PT_LOAD))) continue; /* @@ -182,7 +181,8 @@ ignore_section_processing(Ofl_desc *ofl) } sdp->sd_flags |= FLG_SY_ISDISC; } - DBG_CALL(Dbg_syms_discarded(sdp, sdp->sd_isc)); + DBG_CALL(Dbg_syms_discarded(ofl->ofl_lml, + sdp, sdp->sd_isc)); continue; } @@ -201,7 +201,8 @@ ignore_section_processing(Ofl_desc *ofl) sdp->sd_flags1 |= FLG_SY1_ELIM; } - DBG_CALL(Dbg_syms_discarded(sdp, sdp->sd_isc)); + DBG_CALL(Dbg_syms_discarded(ofl->ofl_lml, + sdp, sdp->sd_isc)); continue; } } @@ -269,7 +270,7 @@ ignore_section_processing(Ofl_desc *ofl) * section required to represent them. */ uintptr_t -make_bss(Ofl_desc *ofl, Xword size, Xword align, Bss_Type which) +ld_make_bss(Ofl_desc *ofl, Xword size, Xword align, Bss_Type which) { Shdr *shdr; Elf_Data *data; @@ -286,7 +287,7 @@ make_bss(Ofl_desc *ofl, Xword size, Xword align, Bss_Type which) data->d_type = ELF_T_BYTE; data->d_size = (size_t)size; data->d_align = (size_t)align; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -330,7 +331,7 @@ make_bss(Ofl_desc *ofl, Xword size, Xword align, Bss_Type which) * Retain this .bss input section as this will be where global * symbol references are added. */ - if ((osp = place_section(ofl, isec, ident, 0)) == (Os_desc *)S_ERROR) + if ((osp = ld_place_section(ofl, isec, ident, 0)) == (Os_desc *)S_ERROR) return (S_ERROR); /* @@ -361,7 +362,7 @@ make_bss(Ofl_desc *ofl, Xword size, Xword align, Bss_Type which) * Build a SHT_{INIT|FINI|PREINIT}ARRAY section (specified via * ld -z *array=name */ -uintptr_t +static uintptr_t make_array(Ofl_desc *ofl, Word shtype, const char *sectname, List *list) { uint_t entcount; @@ -391,7 +392,7 @@ make_array(Ofl_desc *ofl, Word shtype, const char *sectname, List *list) data->d_type = ELF_T_ADDR; data->d_size = sizeof (Addr) * entcount; data->d_align = sizeof (Addr); - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -413,7 +414,7 @@ make_array(Ofl_desc *ofl, Word shtype, const char *sectname, List *list) isec->is_shdr = shdr; isec->is_indata = data; - if (place_section(ofl, isec, M_ID_ARRAY, 0) == (Os_desc *)S_ERROR) + if (ld_place_section(ofl, isec, M_ID_ARRAY, 0) == (Os_desc *)S_ERROR) return (S_ERROR); osp = isec->is_osdesc; @@ -451,12 +452,12 @@ make_array(Ofl_desc *ofl, Word shtype, const char *sectname, List *list) reloc.r_info = ELF_R_INFO(0, M_R_ARRAYADDR); reloc.r_addend = 0; - DBG_CALL(Dbg_reloc_generate(osp, M_REL_SHT_TYPE)); + DBG_CALL(Dbg_reloc_generate(ofl->ofl_lml, osp, M_REL_SHT_TYPE)); for (LIST_TRAVERSE(list, lnp, sdp)) { reld.rel_sname = sdp->sd_name; reld.rel_sym = sdp; - if (process_sym_reloc(ofl, &reld, (Rel *)&reloc, isec, + if (ld_process_sym_reloc(ofl, &reld, (Rel *)&reloc, isec, MSG_INTL(MSG_STR_COMMAND)) == S_ERROR) return (S_ERROR); @@ -470,7 +471,7 @@ make_array(Ofl_desc *ofl, Word shtype, const char *sectname, List *list) /* * Build a comment section (-Qy option). */ -uintptr_t +static uintptr_t make_comment(Ofl_desc *ofl) { Shdr *shdr; @@ -486,7 +487,7 @@ make_comment(Ofl_desc *ofl) data->d_buf = (void *)ofl->ofl_sgsid; data->d_size = strlen(ofl->ofl_sgsid) + 1; data->d_align = 1; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -506,7 +507,7 @@ make_comment(Ofl_desc *ofl) isec->is_shdr = shdr; isec->is_indata = data; - return ((uintptr_t)place_section(ofl, isec, M_ID_NOTE, 0)); + return ((uintptr_t)ld_place_section(ofl, isec, M_ID_NOTE, 0)); } /* @@ -514,7 +515,7 @@ make_comment(Ofl_desc *ofl) * within this structure, they will be added to the global string table * (.dynstr). This routine should be called before make_dynstr(). */ -uintptr_t +static uintptr_t make_dynamic(Ofl_desc *ofl) { Shdr *shdr; @@ -539,13 +540,13 @@ make_dynamic(Ofl_desc *ofl) if (!(flags & FLG_OF_RELOBJ)) shdr->sh_flags |= SHF_ALLOC; shdr->sh_addralign = M_WORD_ALIGN; - shdr->sh_entsize = (Xword)elf_fsize(ELF_T_DYN, 1, ofl->ofl_libver); - if (shdr->sh_entsize == 0) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_FSIZE), ofl->ofl_name); + if ((shdr->sh_entsize = (Xword)elf_fsize(ELF_T_DYN, 1, + ofl->ofl_dehdr->e_version)) == 0) { + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_FSIZE), + ofl->ofl_name); return (S_ERROR); } - /* * Allocate and initialize the Elf_Data structure. */ @@ -554,7 +555,7 @@ make_dynamic(Ofl_desc *ofl) data->d_type = ELF_T_DYN; data->d_size = 0; data->d_align = M_WORD_ALIGN; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Is_desc structure. @@ -566,7 +567,7 @@ make_dynamic(Ofl_desc *ofl) isec->is_shdr = shdr; isec->is_indata = data; - osp = ofl->ofl_osdynamic = place_section(ofl, isec, M_ID_DYNAMIC, 0); + osp = ofl->ofl_osdynamic = ld_place_section(ofl, isec, M_ID_DYNAMIC, 0); /* * Reserve entries for any needed dependencies. @@ -589,8 +590,8 @@ make_dynamic(Ofl_desc *ofl) if ((ifl->ifl_flags & FLG_IF_NEEDSTR) || ((ifl->ifl_flags & FLG_IF_DEPREQD) == 0)) { if (unused++ == 0) - DBG_CALL(Dbg_util_nl()); - DBG_CALL(Dbg_unused_file(ifl->ifl_soname, + DBG_CALL(Dbg_util_nl(ofl->ofl_lml, DBG_NL_STD)); + DBG_CALL(Dbg_unused_file(ofl->ofl_lml, ifl->ifl_soname, (ifl->ifl_flags & FLG_IF_NEEDSTR), 0)); if (ifl->ifl_flags & FLG_IF_NEEDSTR) @@ -629,7 +630,7 @@ make_dynamic(Ofl_desc *ofl) } if (unused) - DBG_CALL(Dbg_util_nl()); + DBG_CALL(Dbg_util_nl(ofl->ofl_lml, DBG_NL_STD)); /* * Reserve entries for any per-symbol auxiliary/filter strings. @@ -646,12 +647,12 @@ make_dynamic(Ofl_desc *ofl) /* * Reserve entries for any _init() and _fini() section addresses. */ - if (((sdp = sym_find(MSG_ORIG(MSG_SYM_INIT_U), + if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_INIT_U), SYM_NOHASH, 0, ofl)) != NULL) && sdp->sd_ref == REF_REL_NEED) { sdp->sd_flags |= FLG_SY_UPREQD; cnt++; } - if (((sdp = sym_find(MSG_ORIG(MSG_SYM_FINI_U), + if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_FINI_U), SYM_NOHASH, 0, ofl)) != NULL) && sdp->sd_ref == REF_REL_NEED) { sdp->sd_flags |= FLG_SY_UPREQD; cnt++; @@ -824,9 +825,9 @@ make_dynamic(Ofl_desc *ofl) cnt++; /* SYMBOLIC */ /* - * Account for Architecture dependent .dynamic entries, and defaults + * Account for Architecture dependent .dynamic entries, and defaults. */ - mach_make_dynamic(ofl, &cnt); + ld_mach_make_dynamic(ofl, &cnt); cnt += 3; /* DT_FLAGS, DT_FLAGS_1, */ /* and DT_NULL */ @@ -846,7 +847,7 @@ make_dynamic(Ofl_desc *ofl) * Build the GOT section and its associated relocation entries. */ uintptr_t -make_got(Ofl_desc *ofl) +ld_make_got(Ofl_desc *ofl) { Shdr *shdr; Elf_Data *data; @@ -862,7 +863,7 @@ make_got(Ofl_desc *ofl) data->d_type = ELF_T_BYTE; data->d_size = size; data->d_align = M_WORD_ALIGN; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -884,7 +885,7 @@ make_got(Ofl_desc *ofl) isec->is_shdr = shdr; isec->is_indata = data; - if ((ofl->ofl_osgot = place_section(ofl, isec, M_ID_GOT, 0)) == + if ((ofl->ofl_osgot = ld_place_section(ofl, isec, M_ID_GOT, 0)) == (Os_desc *)S_ERROR) return (S_ERROR); @@ -896,7 +897,7 @@ make_got(Ofl_desc *ofl) /* * Build an interp section. */ -uintptr_t +static uintptr_t make_interp(Ofl_desc *ofl) { Shdr *shdr; @@ -919,13 +920,13 @@ make_interp(Ofl_desc *ofl) * In the case of a dynamic executable supply a default interpretor * if a specific interpreter has not been specified. */ - if (!iname) { - if (ofl->ofl_e_machine == EM_SPARCV9) + if (iname == 0) { + if (ofl->ofl_dehdr->e_machine == EM_SPARCV9) iname = ofl->ofl_interp = - MSG_ORIG(MSG_PTH_RTLD_SPARCV9); - else if (ofl->ofl_e_machine == EM_AMD64) + MSG_ORIG(MSG_PTH_RTLD_SPARCV9); + else if (ofl->ofl_dehdr->e_machine == EM_AMD64) iname = ofl->ofl_interp = - MSG_ORIG(MSG_PTH_RTLD_AMD64); + MSG_ORIG(MSG_PTH_RTLD_AMD64); else iname = ofl->ofl_interp = MSG_ORIG(MSG_PTH_RTLD); } @@ -939,7 +940,7 @@ make_interp(Ofl_desc *ofl) return (S_ERROR); data->d_type = ELF_T_BYTE; data->d_size = size; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -959,14 +960,14 @@ make_interp(Ofl_desc *ofl) isec->is_shdr = shdr; isec->is_indata = data; - ofl->ofl_osinterp = place_section(ofl, isec, M_ID_INTERP, 0); + ofl->ofl_osinterp = ld_place_section(ofl, isec, M_ID_INTERP, 0); return ((uintptr_t)ofl->ofl_osinterp); } /* * Build a hardware/software capabilities section. */ -uintptr_t +static uintptr_t make_cap(Ofl_desc *ofl) { Shdr *shdr; @@ -993,7 +994,7 @@ make_cap(Ofl_desc *ofl) if ((data = libld_calloc(sizeof (Elf_Data), 1)) == 0) return (S_ERROR); data->d_type = ELF_T_CAP; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; data->d_align = M_WORD_ALIGN; /* @@ -1004,9 +1005,10 @@ make_cap(Ofl_desc *ofl) shdr->sh_type = SHT_SUNW_cap; shdr->sh_flags = SHF_ALLOC; shdr->sh_addralign = M_WORD_ALIGN; - shdr->sh_entsize = (Xword)elf_fsize(ELF_T_CAP, 1, ofl->ofl_libver); - if (shdr->sh_entsize == 0) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_FSIZE), ofl->ofl_name); + if ((shdr->sh_entsize = (Xword)elf_fsize(ELF_T_CAP, 1, + ofl->ofl_dehdr->e_version)) == 0) { + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_FSIZE), + ofl->ofl_name); return (S_ERROR); } @@ -1046,7 +1048,7 @@ make_cap(Ofl_desc *ofl) * If we're not creating a relocatable object, save the output section * to trigger the creation of an associated a program header. */ - osec = place_section(ofl, isec, M_ID_CAP, 0); + osec = ld_place_section(ofl, isec, M_ID_CAP, 0); if ((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) ofl->ofl_oscap = osec; @@ -1056,7 +1058,7 @@ make_cap(Ofl_desc *ofl) /* * Build the PLT section and its associated relocation entries. */ -uintptr_t +static uintptr_t make_plt(Ofl_desc *ofl) { Shdr *shdr; @@ -1067,7 +1069,7 @@ make_plt(Ofl_desc *ofl) (size_t)ofl->ofl_pltpad) * M_PLT_ENTSIZE); size_t rsize = (size_t)ofl->ofl_relocpltsz; -#if defined(sparc) +#if defined(sparc) /* * Account for the NOP at the end of the plt. */ @@ -1082,7 +1084,7 @@ make_plt(Ofl_desc *ofl) data->d_type = ELF_T_BYTE; data->d_size = size; data->d_align = M_PLT_ALIGN; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -1104,7 +1106,7 @@ make_plt(Ofl_desc *ofl) isec->is_shdr = shdr; isec->is_indata = data; - if ((ofl->ofl_osplt = place_section(ofl, isec, M_ID_PLT, 0)) == + if ((ofl->ofl_osplt = ld_place_section(ofl, isec, M_ID_PLT, 0)) == (Os_desc *)S_ERROR) return (S_ERROR); @@ -1118,7 +1120,7 @@ make_plt(Ofl_desc *ofl) * libraries, and provides hashed lookup into the global symbol table * (.dynsym) for the run-time linker to resolve symbol lookups. */ -uintptr_t +static uintptr_t make_hash(Ofl_desc *ofl) { Shdr *shdr; @@ -1135,7 +1137,7 @@ make_hash(Ofl_desc *ofl) return (S_ERROR); data->d_type = ELF_T_WORD; data->d_align = M_WORD_ALIGN; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -1145,9 +1147,10 @@ make_hash(Ofl_desc *ofl) shdr->sh_type = SHT_HASH; shdr->sh_flags = SHF_ALLOC; shdr->sh_addralign = M_WORD_ALIGN; - shdr->sh_entsize = (Xword)elf_fsize(ELF_T_WORD, 1, ofl->ofl_libver); - if (shdr->sh_entsize == 0) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_FSIZE), ofl->ofl_name); + if ((shdr->sh_entsize = (Xword)elf_fsize(ELF_T_WORD, 1, + ofl->ofl_dehdr->e_version)) == 0) { + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_FSIZE), + ofl->ofl_name); return (S_ERROR); } @@ -1164,7 +1167,7 @@ make_hash(Ofl_desc *ofl) * Place the section first since it will affect the local symbol * count. */ - if ((ofl->ofl_oshash = place_section(ofl, isec, M_ID_HASH, 0)) == + if ((ofl->ofl_oshash = ld_place_section(ofl, isec, M_ID_HASH, 0)) == (Os_desc *)S_ERROR) return (S_ERROR); @@ -1200,7 +1203,7 @@ make_hash(Ofl_desc *ofl) * Generate the standard symbol table. Contains all locals and globals, * and resides in a non-allocatable section (ie. it can be stripped). */ -uintptr_t +static uintptr_t make_symtab(Ofl_desc *ofl) { Shdr *shdr; @@ -1217,7 +1220,7 @@ make_symtab(Ofl_desc *ofl) return (S_ERROR); data->d_type = ELF_T_SYM; data->d_align = M_WORD_ALIGN; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -1226,9 +1229,10 @@ make_symtab(Ofl_desc *ofl) return (S_ERROR); shdr->sh_type = SHT_SYMTAB; shdr->sh_addralign = M_WORD_ALIGN; - shdr->sh_entsize = (Xword)elf_fsize(ELF_T_SYM, 1, ofl->ofl_libver); - if (shdr->sh_entsize == 0) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_FSIZE), ofl->ofl_name); + if ((shdr->sh_entsize = (Xword)elf_fsize(ELF_T_SYM, 1, + ofl->ofl_dehdr->e_version)) == 0) { + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_FSIZE), + ofl->ofl_name); return (S_ERROR); } @@ -1245,7 +1249,7 @@ make_symtab(Ofl_desc *ofl) * Place the section first since it will affect the local symbol * count. */ - if ((ofl->ofl_ossymtab = place_section(ofl, isec, M_ID_SYMTAB, 0)) == + if ((ofl->ofl_ossymtab = ld_place_section(ofl, isec, M_ID_SYMTAB, 0)) == (Os_desc *)S_ERROR) return (S_ERROR); @@ -1262,7 +1266,7 @@ make_symtab(Ofl_desc *ofl) return (S_ERROR); xdata->d_type = ELF_T_WORD; xdata->d_align = M_WORD_ALIGN; - xdata->d_version = ofl->ofl_libver; + xdata->d_version = ofl->ofl_dehdr->e_version; if ((xshdr = libld_calloc(sizeof (Shdr), 1)) == 0) return (S_ERROR); xshdr->sh_type = SHT_SYMTAB_SHNDX; @@ -1273,7 +1277,7 @@ make_symtab(Ofl_desc *ofl) xisec->is_name = MSG_ORIG(MSG_SCN_SYMTAB_SHNDX); xisec->is_shdr = xshdr; xisec->is_indata = xdata; - if ((ofl->ofl_ossymshndx = place_section(ofl, xisec, + if ((ofl->ofl_ossymshndx = ld_place_section(ofl, xisec, M_ID_SYMTAB_NDX, 0)) == (Os_desc *)S_ERROR) return (S_ERROR); } @@ -1309,7 +1313,7 @@ make_symtab(Ofl_desc *ofl) * Build a dynamic symbol table. Contains only globals symbols and resides * in the text segment of a dynamic executable or shared library. */ -uintptr_t +static uintptr_t make_dynsym(Ofl_desc *ofl) { Shdr *shdr; @@ -1325,7 +1329,7 @@ make_dynsym(Ofl_desc *ofl) return (S_ERROR); data->d_type = ELF_T_SYM; data->d_align = M_WORD_ALIGN; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -1335,9 +1339,10 @@ make_dynsym(Ofl_desc *ofl) shdr->sh_type = SHT_DYNSYM; shdr->sh_flags = SHF_ALLOC; shdr->sh_addralign = M_WORD_ALIGN; - shdr->sh_entsize = (Xword)elf_fsize(ELF_T_SYM, 1, ofl->ofl_libver); - if (shdr->sh_entsize == 0) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_FSIZE), ofl->ofl_name); + if ((shdr->sh_entsize = (Xword)elf_fsize(ELF_T_SYM, 1, + ofl->ofl_dehdr->e_version)) == 0) { + eprintf(ofl->ofl_lml, ERR_ELF, MSG_INTL(MSG_ELF_FSIZE), + ofl->ofl_name); return (S_ERROR); } @@ -1354,7 +1359,7 @@ make_dynsym(Ofl_desc *ofl) * Place the section first since it will affect the local symbol * count. */ - if ((ofl->ofl_osdynsym = place_section(ofl, isec, M_ID_DYNSYM, 0)) == + if ((ofl->ofl_osdynsym = ld_place_section(ofl, isec, M_ID_DYNSYM, 0)) == (Os_desc *)S_ERROR) return (S_ERROR); @@ -1376,7 +1381,7 @@ make_dynsym(Ofl_desc *ofl) /* * Build a SHT_SYMTAB_SHNDX for the .dynsym */ -uintptr_t +static uintptr_t make_dynsym_shndx(Ofl_desc *ofl) { Is_desc *isec; @@ -1391,7 +1396,7 @@ make_dynsym_shndx(Ofl_desc *ofl) return (S_ERROR); data->d_type = ELF_T_WORD; data->d_align = M_WORD_ALIGN; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate the Shdr structure. @@ -1411,7 +1416,7 @@ make_dynsym_shndx(Ofl_desc *ofl) isec->is_shdr = shdr; isec->is_indata = data; - if ((ofl->ofl_osdynshndx = place_section(ofl, isec, + if ((ofl->ofl_osdynshndx = ld_place_section(ofl, isec, M_ID_DYNSYM_NDX, 0)) == (Os_desc *)S_ERROR) return (S_ERROR); @@ -1429,7 +1434,7 @@ make_dynsym_shndx(Ofl_desc *ofl) /* * Build a string table for the section headers. */ -uintptr_t +static uintptr_t make_shstrtab(Ofl_desc *ofl) { Shdr *shdr; @@ -1444,7 +1449,7 @@ make_shstrtab(Ofl_desc *ofl) return (S_ERROR); data->d_type = ELF_T_BYTE; data->d_align = 1; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate the Shdr structure. @@ -1468,7 +1473,7 @@ make_shstrtab(Ofl_desc *ofl) * Place the section first, as it may effect the number of section * headers to account for. */ - if ((ofl->ofl_osshstrtab = place_section(ofl, isec, M_ID_NOTE, 0)) == + if ((ofl->ofl_osshstrtab = ld_place_section(ofl, isec, M_ID_NOTE, 0)) == (Os_desc *)S_ERROR) return (S_ERROR); @@ -1486,7 +1491,7 @@ make_shstrtab(Ofl_desc *ofl) /* * Build a string section for the standard symbol table. */ -uintptr_t +static uintptr_t make_strtab(Ofl_desc *ofl) { Shdr *shdr; @@ -1513,7 +1518,7 @@ make_strtab(Ofl_desc *ofl) data->d_size = size; data->d_type = ELF_T_BYTE; data->d_align = 1; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate the Shdr structure. @@ -1534,14 +1539,14 @@ make_strtab(Ofl_desc *ofl) isec->is_shdr = shdr; isec->is_indata = data; - ofl->ofl_osstrtab = place_section(ofl, isec, M_ID_STRTAB, 0); + ofl->ofl_osstrtab = ld_place_section(ofl, isec, M_ID_STRTAB, 0); return ((uintptr_t)ofl->ofl_osstrtab); } /* * Build a string table for the dynamic symbol table. */ -uintptr_t +static uintptr_t make_dynstr(Ofl_desc *ofl) { Shdr *shdr; @@ -1597,7 +1602,7 @@ make_dynstr(Ofl_desc *ofl) data->d_type = ELF_T_BYTE; data->d_size = size; data->d_align = 1; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate the Shdr structure. @@ -1621,7 +1626,7 @@ make_dynstr(Ofl_desc *ofl) isec->is_shdr = shdr; isec->is_indata = data; - ofl->ofl_osdynstr = place_section(ofl, isec, M_ID_DYNSTR, 0); + ofl->ofl_osdynstr = ld_place_section(ofl, isec, M_ID_DYNSTR, 0); return ((uintptr_t)ofl->ofl_osdynstr); } @@ -1632,7 +1637,7 @@ make_dynstr(Ofl_desc *ofl) * If (osp == NULL) then we are creating the coalesced relocation section * for an executable and/or a shared object. */ -uintptr_t +static uintptr_t make_reloc(Ofl_desc *ofl, Os_desc *osp) { Shdr *shdr; @@ -1689,7 +1694,7 @@ make_reloc(Ofl_desc *ofl, Os_desc *osp) data->d_type = M_REL_ELF_TYPE; data->d_size = size; data->d_align = M_WORD_ALIGN; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -1729,7 +1734,7 @@ make_reloc(Ofl_desc *ofl, Os_desc *osp) * Associate this relocation section to the section its going to * relocate. */ - if ((rosp = place_section(ofl, isec, M_ID_REL, 0)) == + if ((rosp = ld_place_section(ofl, isec, M_ID_REL, 0)) == (Os_desc *)S_ERROR) return (S_ERROR); @@ -1773,7 +1778,7 @@ make_reloc(Ofl_desc *ofl, Os_desc *osp) /* * Generate version needed section. */ -uintptr_t +static uintptr_t make_verneed(Ofl_desc *ofl) { Shdr *shdr; @@ -1789,7 +1794,7 @@ make_verneed(Ofl_desc *ofl) data->d_type = ELF_T_BYTE; data->d_size = size; data->d_align = M_WORD_ALIGN; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -1810,7 +1815,7 @@ make_verneed(Ofl_desc *ofl) isec->is_shdr = shdr; isec->is_indata = data; - ofl->ofl_osverneed = place_section(ofl, isec, M_ID_VERSION, 0); + ofl->ofl_osverneed = ld_place_section(ofl, isec, M_ID_VERSION, 0); return ((uintptr_t)ofl->ofl_osverneed); } @@ -1820,7 +1825,7 @@ make_verneed(Ofl_desc *ofl) * o the SHT_SUNW_verdef section defines the versions that exist within this * image. */ -uintptr_t +static uintptr_t make_verdef(Ofl_desc *ofl) { Shdr *shdr; @@ -1856,7 +1861,7 @@ make_verdef(Ofl_desc *ofl) data->d_type = ELF_T_BYTE; data->d_size = size; data->d_align = M_WORD_ALIGN; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -1877,7 +1882,7 @@ make_verdef(Ofl_desc *ofl) isec->is_shdr = shdr; isec->is_indata = data; - ofl->ofl_osverdef = place_section(ofl, isec, M_ID_VERSION, 0); + ofl->ofl_osverdef = ld_place_section(ofl, isec, M_ID_VERSION, 0); return ((uintptr_t)ofl->ofl_osverdef); } @@ -1886,7 +1891,7 @@ make_verdef(Ofl_desc *ofl) * section and the SHT_SUNW_syminfo section. Each of these sections * provides additional symbol information. */ -Os_desc * +static Os_desc * make_sym_sec(Ofl_desc *ofl, const char *sectname, Word entsize, Word stype, int ident) { @@ -1902,7 +1907,7 @@ make_sym_sec(Ofl_desc *ofl, const char *sectname, Word entsize, return ((Os_desc *)S_ERROR); data->d_type = ELF_T_BYTE; data->d_align = M_WORD_ALIGN; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -1931,14 +1936,14 @@ make_sym_sec(Ofl_desc *ofl, const char *sectname, Word entsize, isec->is_shdr = shdr; isec->is_indata = data; - return (place_section(ofl, isec, ident, 0)); + return (ld_place_section(ofl, isec, ident, 0)); } /* * Build a .sunwbss section for allocation of tentative definitions. */ uintptr_t -make_sunwbss(Ofl_desc *ofl, size_t size, Xword align) +ld_make_sunwbss(Ofl_desc *ofl, size_t size, Xword align) { Shdr *shdr; Elf_Data *data; @@ -1952,7 +1957,7 @@ make_sunwbss(Ofl_desc *ofl, size_t size, Xword align) data->d_type = ELF_T_BYTE; data->d_size = size; data->d_align = align; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -1978,7 +1983,7 @@ make_sunwbss(Ofl_desc *ofl, size_t size, Xword align) * symbol references are added. */ ofl->ofl_issunwbss = isec; - if (place_section(ofl, isec, 0, 0) == (Os_desc *)S_ERROR) + if (ld_place_section(ofl, isec, 0, 0) == (Os_desc *)S_ERROR) return (S_ERROR); return (1); @@ -1988,7 +1993,7 @@ make_sunwbss(Ofl_desc *ofl, size_t size, Xword align) * This routine is called when -z nopartial is in effect. */ uintptr_t -make_sunwdata(Ofl_desc *ofl, size_t size, Xword align) +ld_make_sunwdata(Ofl_desc *ofl, size_t size, Xword align) { Shdr *shdr; Elf_Data *data; @@ -2005,7 +2010,7 @@ make_sunwdata(Ofl_desc *ofl, size_t size, Xword align) if ((data->d_buf = libld_calloc(size, 1)) == 0) return (S_ERROR); data->d_align = (size_t)M_WORD_ALIGN; - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -2035,7 +2040,7 @@ make_sunwdata(Ofl_desc *ofl, size_t size, Xword align) * symbol references are added. */ ofl->ofl_issunwdata1 = isec; - if ((osp = place_section(ofl, isec, M_ID_DATA, 0)) == + if ((osp = ld_place_section(ofl, isec, M_ID_DATA, 0)) == (Os_desc *)S_ERROR) return (S_ERROR); @@ -2050,7 +2055,7 @@ make_sunwdata(Ofl_desc *ofl, size_t size, Xword align) * Make .sunwmove section */ uintptr_t -make_sunwmove(Ofl_desc *ofl, int mv_nums) +ld_make_sunwmove(Ofl_desc *ofl, int mv_nums) { Shdr *shdr; Elf_Data *data; @@ -2075,7 +2080,7 @@ make_sunwmove(Ofl_desc *ofl, int mv_nums) return (S_ERROR); data->d_size = size; data->d_align = sizeof (Lword); - data->d_version = ofl->ofl_libver; + data->d_version = ofl->ofl_dehdr->e_version; /* * Allocate and initialize the Shdr structure. @@ -2116,7 +2121,7 @@ make_sunwmove(Ofl_desc *ofl, int mv_nums) cnt++; } } - if ((ofl->ofl_osmove = place_section(ofl, isec, 0, 0)) == + if ((ofl->ofl_osmove = ld_place_section(ofl, isec, 0, 0)) == (Os_desc *)S_ERROR) return (S_ERROR); @@ -2132,7 +2137,7 @@ make_sunwmove(Ofl_desc *ofl, int mv_nums) * individual routines can compensate for later, known, additions. */ uintptr_t -make_sections(Ofl_desc *ofl) +ld_make_sections(Ofl_desc *ofl) { Word flags = ofl->ofl_flags; Listnode *lnp1; @@ -2178,7 +2183,7 @@ make_sections(Ofl_desc *ofl) * -Dunused a diagnostic for any unused components is generated, under * -zignore the component is removed from the final output. */ - if (dbg_mask || (ofl->ofl_flags1 & FLG_OF1_IGNPRC)) { + if (DBG_ENABLED || (ofl->ofl_flags1 & FLG_OF1_IGNPRC)) { if (ignore_section_processing(ofl) == S_ERROR) return (S_ERROR); } diff --git a/usr/src/cmd/sgs/libld/common/sunwmove.c b/usr/src/cmd/sgs/libld/common/sunwmove.c index 8c3127fab9..e761b3d135 100644 --- a/usr/src/cmd/sgs/libld/common/sunwmove.c +++ b/usr/src/cmd/sgs/libld/common/sunwmove.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,14 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <string.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" @@ -87,16 +87,16 @@ make_mvsections(Ofl_desc *ofl) } if (mv_nums != 0) { - if (make_sunwmove(ofl, mv_nums) == S_ERROR) + if (ld_make_sunwmove(ofl, mv_nums) == S_ERROR) return (S_ERROR); } /* - * Generate the .sunwbss section now - * that we know its size and alignment. + * Generate the .sunwbss section now that we know its size and + * alignment. */ if (size_sunwbss) { - if (make_sunwbss(ofl, size_sunwbss, + if (ld_make_sunwbss(ofl, size_sunwbss, align_sunwbss) == S_ERROR) return (S_ERROR); } @@ -109,7 +109,7 @@ make_mvsections(Ofl_desc *ofl) */ if (size_sunwdata1) { /* LINTED */ - if (make_sunwdata(ofl, size_sunwdata1, + if (ld_make_sunwdata(ofl, size_sunwdata1, align_sunwdata1) == S_ERROR) return (S_ERROR); } @@ -121,7 +121,7 @@ make_mvsections(Ofl_desc *ofl) * psymp. */ static uintptr_t -insert_mvitm(Psym_info *psymp, Mv_itm *itm) +insert_mvitm(Ofl_desc *ofl, Psym_info *psymp, Mv_itm *itm) { Listnode * lnpc, *lnpp, *new; Mv_itm * mvp; @@ -166,7 +166,8 @@ insert_mvitm(Psym_info *psymp, Mv_itm *itm) if ((itm->mv_start == mvp->mv_start) || (small->mv_start + small->mv_length > large->mv_start)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_PSYM_OVERLAP), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_PSYM_OVERLAP), psymp->psym_symd->sd_file->ifl_name, itm->mv_isp->is_name, demangle(psymp->psym_symd->sd_name)); @@ -216,7 +217,7 @@ insert_mvitm(Psym_info *psymp, Mv_itm *itm) * If overlapping occurs, mark it at psymp->psym_flags */ static uintptr_t -install_mv(Psym_info *psymp, Move *mv, Is_desc *isp) +install_mv(Ofl_desc *ofl, Psym_info *psymp, Move *mv, Is_desc *isp) { Mv_itm * mvitmp; int cnt = mv->m_repeat; @@ -238,7 +239,7 @@ install_mv(Psym_info *psymp, Move *mv, Is_desc *isp) /* * Insert the item */ - if (insert_mvitm(psymp, mvitmp) == S_ERROR) + if (insert_mvitm(ofl, psymp, mvitmp) == S_ERROR) return (S_ERROR); mvitmp++; } @@ -363,7 +364,7 @@ insert_psym(Ofl_desc *ofl, Psym_info *p1) * */ uintptr_t -sunwmove_preprocess(Ofl_desc *ofl) +ld_sunwmove_preprocess(Ofl_desc *ofl) { Listnode * lnp; Is_desc * isp; @@ -376,11 +377,12 @@ sunwmove_preprocess(Ofl_desc *ofl) Ifl_desc * ifile = isp->is_file; Xword i, num; - DBG_CALL(Dbg_move_input1(ifile->ifl_name)); + DBG_CALL(Dbg_move_input(ofl->ofl_lml, ifile->ifl_name)); mv = (Move *) isp->is_indata->d_buf; if (isp->is_shdr->sh_entsize == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVSHENTSIZE), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_FIL_INVSHENTSIZE), isp->is_file->ifl_name, isp->is_name, EC_XWORD(0)); return (S_ERROR); } @@ -390,19 +392,23 @@ sunwmove_preprocess(Ofl_desc *ofl) if ((ndx >= (Xword) isp->is_file->ifl_symscnt) || (ndx == 0)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_PSYM_INVMINFO1), - isp->is_file->ifl_name, isp->is_name, i, - EC_XWORD(mv->m_info)); - return (S_ERROR); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_PSYM_INVMINFO1), + isp->is_file->ifl_name, isp->is_name, i, + EC_XWORD(mv->m_info)); + return (S_ERROR); } if (mv->m_repeat == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_PSYM_INVMREPEAT), - isp->is_file->ifl_name, isp->is_name, i, - EC_XWORD(mv->m_repeat)); - return (S_ERROR); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_PSYM_INVMREPEAT), + isp->is_file->ifl_name, isp->is_name, i, + EC_XWORD(mv->m_repeat)); + return (S_ERROR); } + sdp = isp->is_file->ifl_oldndx[ndx]; - DBG_CALL(Dbg_move_mventry(0, mv, sdp)); + DBG_CALL(Dbg_move_entry1(ofl->ofl_lml, 0, mv, sdp)); + /* * Check if this entry has a valid size of not */ @@ -411,24 +417,24 @@ sunwmove_preprocess(Ofl_desc *ofl) case 1: case 2: case 4: case 8: break; default: - eprintf(ERR_FATAL, MSG_INTL(MSG_PSYM_INVMINFO2), - isp->is_file->ifl_name, isp->is_name, i, - EC_XWORD(mv->m_info)); - return (S_ERROR); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_PSYM_INVMINFO2), + isp->is_file->ifl_name, isp->is_name, i, + EC_XWORD(mv->m_info)); + return (S_ERROR); } /* - * If this is a global symbol, adjust the visibility + * If this is a global symbol, adjust the visibility. */ if (sdp->sd_aux && ((sdp->sd_flags & FLG_SY_VISIBLE) == 0)) - sym_adjust_vis(sdp, ofl); + ld_sym_adjust_vis(sdp, ofl); if (sdp->sd_psyminfo == (Psym_info *)NULL) { /* - * Mark the symbol as partial - * and intall the symbol in - * partial symbol list. + * Mark the symbol as partial, and install the + * symbol in the partial symbol list. */ if ((psym = libld_calloc(sizeof (Psym_info), 1)) == 0) @@ -437,9 +443,9 @@ sunwmove_preprocess(Ofl_desc *ofl) sdp->sd_psyminfo = psym; /* - * Even if the -zredlocsym is in effect, - * the local symbol used for partial - * initialization will be kept. + * Even if the -zredlocsym is in effect, the + * local symbol used for partial initialization + * is kept. */ if ((ofl->ofl_flags1 & FLG_OF1_REDLSYM) && (ELF_ST_BIND(sdp->sd_sym->st_info) == @@ -485,7 +491,7 @@ sunwmove_preprocess(Ofl_desc *ofl) } else psym = sdp->sd_psyminfo; - if (install_mv(psym, mv, isp) == S_ERROR) + if (install_mv(ofl, psym, mv, isp) == S_ERROR) return (S_ERROR); if ((psym->psym_flag & FLG_PSYM_OVERLAP) != 0) errcnt++; @@ -525,7 +531,7 @@ sunwmove_preprocess(Ofl_desc *ofl) if (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION) { errcnt++; - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_PSYM_CANNOTEXPND), psym->psym_symd->sd_file->ifl_name, isp->is_name, i, @@ -536,7 +542,7 @@ sunwmove_preprocess(Ofl_desc *ofl) } else if ((ofl->ofl_flags1 & FLG_OF1_NOPARTI) != 0) { if (ELF_ST_TYPE(sdp->sd_sym->st_info) == STT_SECTION) { - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_PSYM_CANNOTEXPND), psym->psym_symd->sd_file->ifl_name, isp->is_name, i, diff --git a/usr/src/cmd/sgs/libld/common/support.c b/usr/src/cmd/sgs/libld/common/support.c index 204a3961fa..ac49ea518c 100644 --- a/usr/src/cmd/sgs/libld/common/support.c +++ b/usr/src/cmd/sgs/libld/common/support.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,22 +18,22 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ + #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> #include <dlfcn.h> #include <libelf.h> #include <link.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" - - /* * Table which defines the default functions to be called by the library * SUPPORT (-S <libname>). These functions can be redefined by the @@ -43,13 +42,13 @@ static Support_list support[LDS_NUM] = { {MSG_ORIG(MSG_SUP_VERSION), { 0, 0 }}, /* LDS_VERSION */ {MSG_ORIG(MSG_SUP_INPUT_DONE), { 0, 0 }}, /* LDS_INPUT_DONE */ -#ifdef _ELF64 +#if defined(_ELF64) {MSG_ORIG(MSG_SUP_START_64), { 0, 0 }}, /* LDS_START64 */ {MSG_ORIG(MSG_SUP_ATEXIT_64), { 0, 0 }}, /* LDS_ATEXIT64 */ {MSG_ORIG(MSG_SUP_FILE_64), { 0, 0 }}, /* LDS_FILE64 */ {MSG_ORIG(MSG_SUP_INP_SECTION_64), { 0, 0 }}, /* LDS_INP_SECTION64 */ {MSG_ORIG(MSG_SUP_SECTION_64), { 0, 0 }} /* LDS_SECTION64 */ -#else /* Elf32 */ +#else /* Elf32 */ {MSG_ORIG(MSG_SUP_START), { 0, 0 }}, /* LDS_START */ {MSG_ORIG(MSG_SUP_ATEXIT), { 0, 0 }}, /* LDS_ATEXIT */ {MSG_ORIG(MSG_SUP_FILE), { 0, 0 }}, /* LDS_FILE */ @@ -62,13 +61,9 @@ static Support_list support[LDS_NUM] = { * Loads in a support shared object specified using the SGS_SUPPORT environment * variable or the -S ld option, and determines which interface functions are * provided by that object. - * - * return values for ld_support_loadso: - * 1 - shared object loaded sucessfully - * S_ERROR - aww, damn! */ uintptr_t -ld_support_loadso(const char *obj) +ld_sup_loadso(Ofl_desc *ofl, const char *obj) { void *handle; void (*fptr)(); @@ -81,7 +76,8 @@ ld_support_loadso(const char *obj) * with a fatal error. */ if ((handle = dlopen(obj, RTLD_LAZY)) == NULL) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SUP_NOLOAD), obj, dlerror()); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SUP_NOLOAD), + obj, dlerror()); return (S_ERROR); } @@ -89,25 +85,25 @@ ld_support_loadso(const char *obj) for (i = 0; i < LDS_NUM; i++) { if (fptr = (void (*)())dlsym(handle, support[i].sup_name)) { - if ((flp = (Func_list *) - libld_malloc(sizeof (Func_list))) == NULL) + if ((flp = libld_malloc(sizeof (Func_list))) == NULL) return (S_ERROR); flp->fl_obj = obj; flp->fl_fptr = fptr; - DBG_CALL(Dbg_support_load(obj, support[i].sup_name)); + DBG_CALL(Dbg_support_load(ofl->ofl_lml, obj, + support[i].sup_name)); + if (i == LDS_VERSION) { - DBG_CALL(Dbg_support_action(flp->fl_obj, - support[LDS_VERSION].sup_name, + DBG_CALL(Dbg_support_action(ofl->ofl_lml, + flp->fl_obj, support[LDS_VERSION].sup_name, LDS_VERSION, 0)); ver_level = ((uint_t(*)()) flp->fl_fptr)(LD_SUP_VCURRENT); if ((ver_level == LD_SUP_VNONE) || (ver_level > LD_SUP_VCURRENT)) { - eprintf(ERR_FATAL, - MSG_INTL(MSG_SUP_BADVERSION), - LD_SUP_VCURRENT, - ver_level); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_SUP_BADVERSION), + LD_SUP_VCURRENT, ver_level); (void) dlclose(handle); return (S_ERROR); } @@ -121,40 +117,38 @@ ld_support_loadso(const char *obj) return (1); } - /* * Wrapper routines for the ld support library calls. */ void -lds_start(const char *ofile, const Half etype, const char *caller) +ld_sup_start(Ofl_desc *ofl, const Half etype, const char *caller) { Func_list *flp; Listnode *lnp; for (LIST_TRAVERSE(&support[LDS_START].sup_funcs, lnp, flp)) { - DBG_CALL(Dbg_support_action(flp->fl_obj, - support[LDS_START].sup_name, LDS_START, ofile)); - (*flp->fl_fptr)(ofile, etype, caller); + DBG_CALL(Dbg_support_action(ofl->ofl_lml, flp->fl_obj, + support[LDS_START].sup_name, LDS_START, ofl->ofl_name)); + (*flp->fl_fptr)(ofl->ofl_name, etype, caller); } } - void -lds_atexit(int exit_code) +ld_sup_atexit(Ofl_desc *ofl, int ecode) { Func_list *flp; Listnode *lnp; for (LIST_TRAVERSE(&support[LDS_ATEXIT].sup_funcs, lnp, flp)) { - DBG_CALL(Dbg_support_action(flp->fl_obj, + DBG_CALL(Dbg_support_action(ofl->ofl_lml, flp->fl_obj, support[LDS_ATEXIT].sup_name, LDS_ATEXIT, 0)); - (*flp->fl_fptr)(exit_code); + (*flp->fl_fptr)(ecode); } } - void -lds_file(const char *ifile, const Elf_Kind ekind, int flags, Elf *elf) +ld_sup_file(Ofl_desc *ofl, const char *ifile, const Elf_Kind ekind, int flags, + Elf *elf) { Func_list *flp; Listnode *lnp; @@ -169,15 +163,15 @@ lds_file(const char *ifile, const Elf_Kind ekind, int flags, Elf *elf) if (flags & FLG_IF_EXTRACT) _flags |= LD_SUP_EXTRACTED; - DBG_CALL(Dbg_support_action(flp->fl_obj, + DBG_CALL(Dbg_support_action(ofl->ofl_lml, flp->fl_obj, support[LDS_FILE].sup_name, LDS_FILE, ifile)); (*flp->fl_fptr)(ifile, ekind, _flags, elf); } } uintptr_t -lds_input_section(const char *scnname, Shdr **shdr, Word ndx, - const char *file, Elf_Scn *scn, Elf *elf, Ofl_desc *ofl) +ld_sup_input_section(Ofl_desc * ofl, const char *scnname, Shdr **shdr, Word ndx, + const char *file, Elf_Scn *scn, Elf *elf) { Func_list *flp; Listnode *lnp; @@ -186,21 +180,20 @@ lds_input_section(const char *scnname, Shdr **shdr, Word ndx, for (LIST_TRAVERSE(&support[LDS_INP_SECTION].sup_funcs, lnp, flp)) { /* - * This interface was introduced in VERSION2 - so only - * call it for libraries reporting support for - * version 2 or above. + * This interface was introduced in VERSION2 - so only call it + * for libraries reporting support for * version 2 or above. */ if (flp->fl_version < LD_SUP_VERSION2) continue; if ((data == NULL) && ((data = elf_getdata(scn, NULL)) == NULL)) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETDATA), - file); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETDATA), file); ofl->ofl_flags |= FLG_OF_FATAL; return (S_ERROR); } - DBG_CALL(Dbg_support_action(flp->fl_obj, + DBG_CALL(Dbg_support_action(ofl->ofl_lml, flp->fl_obj, support[LDS_INP_SECTION].sup_name, LDS_INP_SECTION, scnname)); (*flp->fl_fptr)(scnname, shdr, ndx, data, elf, &flags); @@ -209,21 +202,21 @@ lds_input_section(const char *scnname, Shdr **shdr, Word ndx, } void -lds_section(const char *scn, Shdr *shdr, Word ndx, +ld_sup_section(Ofl_desc *ofl, const char *scn, Shdr *shdr, Word ndx, Elf_Data *data, Elf *elf) { Func_list *flp; Listnode *lnp; for (LIST_TRAVERSE(&support[LDS_SECTION].sup_funcs, lnp, flp)) { - DBG_CALL(Dbg_support_action(flp->fl_obj, + DBG_CALL(Dbg_support_action(ofl->ofl_lml, flp->fl_obj, support[LDS_SECTION].sup_name, LDS_SECTION, scn)); (*flp->fl_fptr)(scn, shdr, ndx, data, elf); } } void -lds_input_done(void) +ld_sup_input_done(Ofl_desc *ofl) { Func_list *flp; Listnode *lnp; @@ -231,13 +224,12 @@ lds_input_done(void) for (LIST_TRAVERSE(&support[LDS_INPUT_DONE].sup_funcs, lnp, flp)) { /* - * This interface was introduced in VERSION2 - so only - * call it for libraries reporting support for - * version 2 or above. + * This interface was introduced in VERSION2 - so only call it + * for libraries reporting support for version 2 or above. */ if (flp->fl_version < LD_SUP_VERSION2) continue; - DBG_CALL(Dbg_support_action(flp->fl_obj, + DBG_CALL(Dbg_support_action(ofl->ofl_lml, flp->fl_obj, support[LDS_INPUT_DONE].sup_name, LDS_INPUT_DONE, 0)); (*flp->fl_fptr)(&flags); } diff --git a/usr/src/cmd/sgs/libld/common/syms.c b/usr/src/cmd/sgs/libld/common/syms.c index 91412f8c3f..0e49fef5b0 100644 --- a/usr/src/cmd/sgs/libld/common/syms.c +++ b/usr/src/cmd/sgs/libld/common/syms.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,13 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -34,7 +34,7 @@ */ #include <stdio.h> #include <string.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" @@ -45,7 +45,7 @@ * key of the symbol name itself. */ int -sym_avl_comp(const void *elem1, const void *elem2) +ld_sym_avl_comp(const void *elem1, const void *elem2) { int res; Sym_avlnode *sav1 = (Sym_avlnode *)elem1; @@ -73,22 +73,25 @@ sym_avl_comp(const void *elem1, const void *elem2) /* * Focal point for verifying symbol names. */ -const char * -string(Ifl_desc *ifl, Sym *sym, const char *strs, size_t strsize, int symndx, - Word shndx, const char *symsecname, const char *strsecname, Word * flags) +static const char * +string(Ofl_desc *ofl, Ifl_desc *ifl, Sym *sym, const char *strs, size_t strsize, + int symndx, Word shndx, const char *symsecname, const char *strsecname, + Word *flags) { const char *regname; Word name = sym->st_name; if (name) { if ((ifl->ifl_flags & FLG_IF_HSTRTAB) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_NOSTRTABLE), - ifl->ifl_name, symsecname, symndx, EC_XWORD(name)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_FIL_NOSTRTABLE), ifl->ifl_name, + symsecname, symndx, EC_XWORD(name)); return (0); } if (name >= (Word)strsize) { - eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_EXCSTRTABLE), - ifl->ifl_name, symsecname, symndx, EC_XWORD(name), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_FIL_EXCSTRTABLE), ifl->ifl_name, + symsecname, symndx, EC_XWORD(name), strsecname, EC_XWORD(strsize)); return (0); } @@ -98,7 +101,7 @@ string(Ifl_desc *ifl, Sym *sym, const char *strs, size_t strsize, int symndx, * Determine if we're dealing with a register and if so validate it. * If it's a scratch register, a fabricated name will be returned. */ - if ((regname = is_regsym(ifl, sym, strs, symndx, shndx, + if ((regname = ld_is_regsym(ofl, ifl, sym, strs, symndx, shndx, symsecname, flags)) == (const char *)S_ERROR) { return (0); } @@ -114,7 +117,7 @@ string(Ifl_desc *ifl, Sym *sym, const char *strs, size_t strsize, int symndx, * world and hasn't, as yet, been a problem. */ if ((name == 0) && (ELF_ST_BIND(sym->st_info) != STB_LOCAL)) { - eprintf(ERR_WARNING, MSG_INTL(MSG_FIL_NONAMESYM), + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_FIL_NONAMESYM), ifl->ifl_name, symsecname, symndx, EC_XWORD(name)); } return (strs + name); @@ -128,7 +131,7 @@ string(Ifl_desc *ifl, Sym *sym, const char *strs, size_t strsize, int symndx, * referenced, mark it so that we don't directly bind to it. */ uintptr_t -sym_nodirect(Is_desc * isp, Ifl_desc * ifl, Ofl_desc * ofl) +ld_sym_nodirect(Is_desc * isp, Ifl_desc * ifl, Ofl_desc * ofl) { Shdr *sifshdr, *symshdr; Syminfo *sifdata; @@ -170,7 +173,7 @@ sym_nodirect(Is_desc * isp, Ifl_desc * ifl, Ofl_desc * ofl) sym = (Sym *)(symdata + _cnt); str = (char *)(strdata + sym->st_name); - if (sdp = sym_find(str, SYM_NOHASH, 0, ofl)) { + if (sdp = ld_sym_find(str, SYM_NOHASH, 0, ofl)) { if (ifl != sdp->sd_file) continue; @@ -195,7 +198,7 @@ sym_nodirect(Is_desc * isp, Ifl_desc * ifl, Ofl_desc * ofl) * of reference and hence performance, and thus this copying is not necessary. */ uintptr_t -sym_copy(Sym_desc *sdp) +ld_sym_copy(Sym_desc *sdp) { Sym *nsym; @@ -215,7 +218,7 @@ sym_copy(Sym_desc *sdp) * Sym_desc entry is returned, or NULL if the symbol is not found. */ Sym_desc * -sym_find(const char *name, Word hash, avl_index_t *where, Ofl_desc *ofl) +ld_sym_find(const char *name, Word hash, avl_index_t *where, Ofl_desc *ofl) { Sym_avlnode qsav; Sym_avlnode *sav; @@ -253,8 +256,9 @@ sym_find(const char *name, Word hash, avl_index_t *where, Ofl_desc *ofl) * has been internally generated (ie. _etext, _edata, etc.). */ Sym_desc * -sym_enter(const char *name, Sym *osym, Word hash, Ifl_desc *ifl, Ofl_desc *ofl, - Word ndx, Word shndx, Word sdflags, Half sdflags1, avl_index_t *where) +ld_sym_enter(const char *name, Sym *osym, Word hash, Ifl_desc *ifl, + Ofl_desc *ofl, Word ndx, Word shndx, Word sdflags, Half sdflags1, + avl_index_t *where) { Sym_desc *sdp; Sym_aux *sap; @@ -262,7 +266,6 @@ sym_enter(const char *name, Sym *osym, Word hash, Ifl_desc *ifl, Ofl_desc *ofl, char *_name; Sym *nsym; Half etype; - Ehdr *ehdr; avl_index_t _where; /* @@ -312,7 +315,7 @@ sym_enter(const char *name, Sym *osym, Word hash, Ifl_desc *ifl, Ofl_desc *ofl, /* LINTED */ Sym_avlnode *_savl; /* - * If a previous sym_find() hasn't initialized 'where' do it + * If a previous ld_sym_find() hasn't initialized 'where' do it * now. */ where = &_where; @@ -340,8 +343,9 @@ sym_enter(const char *name, Sym *osym, Word hash, Ifl_desc *ifl, Ofl_desc *ofl, * out as many error conditions as possible. */ if ((etype == ET_REL) && (sdp->sd_isc == 0)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_INVSEC), name, - ifl->ifl_name, EC_XWORD(shndx)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_SYM_INVSEC), name, ifl->ifl_name, + EC_XWORD(shndx)); ofl->ofl_flags |= FLG_OF_FATAL; return (sdp); } @@ -480,7 +484,7 @@ sym_enter(const char *name, Sym *osym, Word hash, Ifl_desc *ifl, Ofl_desc *ofl, * promoted to the versioning of the output file. */ if (ifl->ifl_versym) - vers_promote(sdp, ndx, ifl, ofl); + ld_vers_promote(sdp, ndx, ifl, ofl); } if ((ofl->ofl_flags & FLG_OF_GENMAP) && @@ -489,12 +493,7 @@ sym_enter(const char *name, Sym *osym, Word hash, Ifl_desc *ifl, Ofl_desc *ofl, return ((Sym_desc *)S_ERROR); } - if (sdp->sd_file) - ehdr = sdp->sd_file->ifl_ehdr; - else - ehdr = &def_ehdr; - DBG_CALL(Dbg_syms_entered(ehdr, nsym, sdp)); - + DBG_CALL(Dbg_syms_entered(ofl, nsym, sdp)); return (sdp); } @@ -531,7 +530,7 @@ sym_add_spec(const char *name, const char *uname, Word sdaux_id, /* LINTED */ hash = (Word)elf_hash(uname); - if (usdp = sym_find(uname, hash, &where, ofl)) { + if (usdp = ld_sym_find(uname, hash, &where, ofl)) { /* * If the underscore symbol exists and is undefined, or was * defined in a shared library, convert it to a local symbol. @@ -570,10 +569,10 @@ sym_add_spec(const char *name, const char *uname, Word sdaux_id, if (usdp->sd_flags & FLG_SY_MAPREF) usdp->sd_flags |= FLG_SY_MAPUSED; - DBG_CALL(Dbg_syms_updated((ofl->ofl_ehdr) ? - ofl->ofl_ehdr : &def_ehdr, usdp, uname)); + DBG_CALL(Dbg_syms_updated(ofl, usdp, uname)); } else - eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_RESERVE), uname, + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_SYM_RESERVE), uname, usdp->sd_file->ifl_name); } else { /* @@ -585,8 +584,8 @@ sym_add_spec(const char *name, const char *uname, Word sdaux_id, sym->st_info = ELF_ST_INFO(STB_GLOBAL, STT_OBJECT); sym->st_size = 0; sym->st_value = 0; - DBG_CALL(Dbg_syms_created(uname)); - if ((usdp = sym_enter(uname, sym, hash, (Ifl_desc *)NULL, + DBG_CALL(Dbg_syms_created(ofl->ofl_lml, uname)); + if ((usdp = ld_sym_enter(uname, sym, hash, (Ifl_desc *)NULL, ofl, 0, SHN_ABS, FLG_SY_SPECSEC, 0, &where)) == (Sym_desc *)S_ERROR) return (S_ERROR); @@ -600,7 +599,7 @@ sym_add_spec(const char *name, const char *uname, Word sdaux_id, usdp->sd_flags1 |= flags1; } - if (name && (sdp = sym_find(name, SYM_NOHASH, 0, ofl)) && + if (name && (sdp = ld_sym_find(name, SYM_NOHASH, 0, ofl)) && (sdp->sd_shndx == SHN_UNDEF)) { uchar_t bind; @@ -646,8 +645,7 @@ sym_add_spec(const char *name, const char *uname, Word sdaux_id, if (sdp->sd_flags & FLG_SY_MAPREF) sdp->sd_flags |= FLG_SY_MAPUSED; - DBG_CALL(Dbg_syms_updated((ofl->ofl_ehdr) ? ofl->ofl_ehdr : - &def_ehdr, sdp, name)); + DBG_CALL(Dbg_syms_updated(ofl, sdp, name)); } return (1); } @@ -658,10 +656,10 @@ sym_add_spec(const char *name, const char *uname, Word sdaux_id, */ static Boolean undef_title = TRUE; -void -sym_undef_title() +static void +sym_undef_title(Ofl_desc *ofl) { - eprintf(ERR_NONE, MSG_INTL(MSG_SYM_FMT_UNDEF), + eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_SYM_FMT_UNDEF), MSG_INTL(MSG_SYM_UNDEF_ITM_11), MSG_INTL(MSG_SYM_UNDEF_ITM_21), MSG_INTL(MSG_SYM_UNDEF_ITM_12), @@ -702,15 +700,15 @@ static const Msg format[] = { MSG_SYM_UND_BNDLOCAL /* MSG_INTL(MSG_SYM_UND_BNDLOCAL) */ }; -void -sym_undef_entry(Sym_desc *sdp, Type type) +static void +sym_undef_entry(Ofl_desc *ofl, Sym_desc *sdp, Type type) { const char *name1, *name2, *name3; Ifl_desc *ifl = sdp->sd_file; Sym_aux *sap = sdp->sd_aux; if (undef_title) - sym_undef_title(); + sym_undef_title(ofl); switch (type) { case UNDEF: @@ -733,8 +731,8 @@ sym_undef_entry(Sym_desc *sdp, Type type) return; } - eprintf(ERR_NONE, MSG_INTL(format[type]), demangle(sdp->sd_name), - name1, name2, name3); + eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(format[type]), + demangle(sdp->sd_name), name1, name2, name3); } /* @@ -743,13 +741,13 @@ sym_undef_entry(Sym_desc *sdp, Type type) * symbols. */ uintptr_t -sym_spec(Ofl_desc *ofl) +ld_sym_spec(Ofl_desc *ofl) { Word flags = ofl->ofl_flags; if (!(flags & FLG_OF_RELOBJ)) { - DBG_CALL(Dbg_syms_spec_title()); + DBG_CALL(Dbg_syms_spec_title(ofl->ofl_lml)); if (sym_add_spec(MSG_ORIG(MSG_SYM_ETEXT), MSG_ORIG(MSG_SYM_ETEXT_U), SDAUX_ID_ETEXT, @@ -788,7 +786,7 @@ sym_spec(Ofl_desc *ofl) FLG_SY1_GLOB, ofl) == S_ERROR) return (S_ERROR); - if (sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U), SYM_NOHASH, 0, ofl)) + if (ld_sym_find(MSG_ORIG(MSG_SYM_GOFTBL_U), SYM_NOHASH, 0, ofl)) if (sym_add_spec(MSG_ORIG(MSG_SYM_GOFTBL), MSG_ORIG(MSG_SYM_GOFTBL_U), SDAUX_ID_GOT, FLG_SY1_GLOB, ofl) == S_ERROR) @@ -803,7 +801,7 @@ sym_spec(Ofl_desc *ofl) * reloc_init() or sym_validate(). */ void -sym_adjust_vis(Sym_desc *sdp, Ofl_desc *ofl) +ld_sym_adjust_vis(Sym_desc *sdp, Ofl_desc *ofl) { Word symvis, oflags = ofl->ofl_flags, oflags1 = ofl->ofl_flags1; Sym *sym = sdp->sd_sym; @@ -895,7 +893,7 @@ sym_adjust_vis(Sym_desc *sdp, Ofl_desc *ofl) * first symbol that it will contain). */ uintptr_t -sym_validate(Ofl_desc *ofl) +ld_sym_validate(Ofl_desc *ofl) { Sym_avlnode *sav; Sym_desc *sdp; @@ -984,7 +982,8 @@ sym_validate(Ofl_desc *ofl) if ((isp == 0) || (isp->is_shdr == 0) || ((isp->is_shdr->sh_flags & SHF_TLS) == 0)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_TLS), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_SYM_TLS), demangle(sdp->sd_name), ifl->ifl_name); ofl->ofl_flags |= FLG_OF_FATAL; continue; @@ -992,13 +991,12 @@ sym_validate(Ofl_desc *ofl) } if ((sdp->sd_flags & FLG_SY_VISIBLE) == 0) - sym_adjust_vis(sdp, ofl); + ld_sym_adjust_vis(sdp, ofl); if ((sdp->sd_flags & FLG_SY_REDUCED) && (oflags & FLG_OF_PROCRED)) { - DBG_CALL(Dbg_syms_reduce(DBG_SYM_REDUCE_GLOBAL, - (ofl->ofl_ehdr) ? ofl->ofl_ehdr : - &def_ehdr, sdp, 0, 0)); + DBG_CALL(Dbg_syms_reduce(ofl, DBG_SYM_REDUCE_GLOBAL, + sdp, 0, 0)); } /* @@ -1009,7 +1007,7 @@ sym_validate(Ofl_desc *ofl) if (!(oflags & FLG_OF_RELOBJ) && ELF_ST_VISIBILITY(sym->st_other) && (shndx == SHN_UNDEF) && (ELF_ST_BIND(sym->st_info) != STB_WEAK)) { - sym_undef_entry(sdp, BNDLOCAL); + sym_undef_entry(ofl, sdp, BNDLOCAL); ofl->ofl_flags |= FLG_OF_FATAL; continue; } @@ -1070,7 +1068,7 @@ sym_validate(Ofl_desc *ofl) FLG_SY_MAPREF) && ((sdp->sd_flags1 & (FLG_SY1_LOCL | FLG_SY1_PROT)) == 0)))) { - sym_undef_entry(sdp, UNDEF); + sym_undef_entry(ofl, sdp, UNDEF); ofl->ofl_flags |= undef; undeferr = 1; } @@ -1089,7 +1087,7 @@ sym_validate(Ofl_desc *ofl) if ((sdp->sd_flags & (FLG_SY_MAPREF | FLG_SY_MAPUSED)) == FLG_SY_MAPREF) { - sym_undef_entry(sdp, UNDEF); + sym_undef_entry(ofl, sdp, UNDEF); ofl->ofl_flags |= FLG_OF_WARN; undeferr = 1; } @@ -1123,7 +1121,7 @@ sym_validate(Ofl_desc *ofl) if (vip->vi_flags & FLG_VER_AVAIL) { vip->vi_flags |= FLG_VER_REFER; } else { - sym_undef_entry(sdp, NOTAVAIL); + sym_undef_entry(ofl, sdp, NOTAVAIL); ofl->ofl_flags |= FLG_OF_FATAL; continue; } @@ -1138,7 +1136,7 @@ sym_validate(Ofl_desc *ofl) if (needed && !undeferr && (sdp->sd_flags & FLG_SY_GLOBREF) && (sdp->sd_ref == REF_DYN_NEED) && (sdp->sd_flags & FLG_SY_NOTAVAIL)) { - sym_undef_entry(sdp, IMPLICIT); + sym_undef_entry(ofl, sdp, IMPLICIT); ofl->ofl_flags |= needed; continue; } @@ -1150,7 +1148,7 @@ sym_validate(Ofl_desc *ofl) */ if ((sdp->sd_ref == REF_DYN_NEED) && (sdp->sd_flags1 & (FLG_SY1_LOCL | FLG_SY1_PROT))) { - sym_undef_entry(sdp, BNDLOCAL); + sym_undef_entry(ofl, sdp, BNDLOCAL); ofl->ofl_flags |= FLG_OF_FATAL; continue; } @@ -1163,7 +1161,7 @@ sym_validate(Ofl_desc *ofl) (shndx != SHN_UNDEF) && (!(sdp->sd_flags1 & FLG_SY1_LOCL)) && (sdp->sd_aux->sa_overndx == 0)) { - sym_undef_entry(sdp, NOVERSION); + sym_undef_entry(ofl, sdp, NOVERSION); ofl->ofl_flags |= verdesc; continue; } @@ -1346,16 +1344,16 @@ sym_validate(Ofl_desc *ofl) * Generate the .bss section now that we know its size and alignment. */ if (bsssize || !(oflags & FLG_OF_RELOBJ)) { - if (make_bss(ofl, bsssize, bssalign, MAKE_BSS) == S_ERROR) + if (ld_make_bss(ofl, bsssize, bssalign, MAKE_BSS) == S_ERROR) return (S_ERROR); } if (tlssize) { - if (make_bss(ofl, tlssize, tlsalign, MAKE_TLS) == S_ERROR) + if (ld_make_bss(ofl, tlssize, tlsalign, MAKE_TLS) == S_ERROR) return (S_ERROR); } #if (defined(__i386) || defined(__amd64)) && defined(_ELF64) if (lbsssize && !(oflags & FLG_OF_RELOBJ)) { - if (make_bss(ofl, lbsssize, lbssalign, MAKE_LBSS) == S_ERROR) + if (ld_make_bss(ofl, lbsssize, lbssalign, MAKE_LBSS) == S_ERROR) return (S_ERROR); } #endif @@ -1368,9 +1366,10 @@ sym_validate(Ofl_desc *ofl) * option first, or the default entry points `_start' and `main'. */ if (ofl->ofl_entry) { - if (((sdp = sym_find(ofl->ofl_entry, SYM_NOHASH, 0, ofl)) == + if (((sdp = ld_sym_find(ofl->ofl_entry, SYM_NOHASH, 0, ofl)) == NULL) || (sdp->sd_ref != REF_REL_NEED)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_ENTRY), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_SYM_ENTRY), demangle((char *)ofl->ofl_entry)); return (S_ERROR); } @@ -1380,7 +1379,7 @@ sym_validate(Ofl_desc *ofl) sdp->sd_isc->is_flags |= FLG_IS_SECTREF; sdp->sd_isc->is_file->ifl_flags |= FLG_IF_FILEREF; } - } else if (((sdp = sym_find(MSG_ORIG(MSG_SYM_START), + } else if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_START), SYM_NOHASH, 0, ofl)) != NULL) && (sdp->sd_ref == REF_REL_NEED)) { ofl->ofl_entry = (void *)sdp; sdp->sd_flags |= FLG_SY_UPREQD; @@ -1388,7 +1387,7 @@ sym_validate(Ofl_desc *ofl) sdp->sd_isc->is_flags |= FLG_IS_SECTREF; sdp->sd_isc->is_file->ifl_flags |= FLG_IF_FILEREF; } - } else if (((sdp = sym_find(MSG_ORIG(MSG_SYM_MAIN), + } else if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_MAIN), SYM_NOHASH, 0, ofl)) != NULL) && (sdp->sd_ref == REF_REL_NEED)) { ofl->ofl_entry = (void *)sdp; sdp->sd_flags |= FLG_SY_UPREQD; @@ -1405,8 +1404,9 @@ sym_validate(Ofl_desc *ofl) if ((sdp = ofl->ofl_dtracesym) != 0) { if ((sdp->sd_ref != REF_REL_NEED) || (sdp->sd_shndx == SHN_UNDEF)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYM_DTRACE), - demangle((char *)sdp->sd_name)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_SYM_DTRACE), + demangle((char *)sdp->sd_name)); return (S_ERROR); } sdp->sd_flags |= FLG_SY_UPREQD; @@ -1421,7 +1421,7 @@ sym_validate(Ofl_desc *ofl) * information calculate it now that all symbols have been validated. */ if ((oflags & (FLG_OF_VERNEED | FLG_OF_NOVERSEC)) == FLG_OF_VERNEED) - return (vers_check_need(ofl)); + return (ld_vers_check_need(ofl)); else return (1); } @@ -1488,7 +1488,7 @@ compare(const void * sdpp1, const void * sdpp2) * resolution function is called upon to resolve the conflict. */ uintptr_t -sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) +ld_sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) { Sym *sym = (Sym *)isc->is_indata->d_buf; Word *symshndx = 0; @@ -1513,7 +1513,7 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) if (isc->is_symshndx) symshndx = isc->is_symshndx->is_indata->d_buf; - DBG_CALL(Dbg_syms_process(ifl)); + DBG_CALL(Dbg_syms_process(ofl->ofl_lml, ifl)); if (isc->is_name) symsecname = isc->is_name; @@ -1527,7 +1527,8 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) if (ifl->ifl_flags & FLG_IF_HSTRTAB) { ndx = shdr->sh_link; if ((ndx == 0) || (ndx >= ifl->ifl_shnum)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_FIL_INVSHLINK), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_FIL_INVSHLINK), ifl->ifl_name, symsecname, EC_XWORD(ndx)); return (S_ERROR); } @@ -1599,7 +1600,7 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) /* * Check if st_name has a valid value or not. */ - if ((name = string(ifl, sym, strs, strsize, ndx, + if ((name = string(ofl, ifl, sym, strs, strsize, ndx, shndx, symsecname, strsecname, &sdflags)) == 0) { ofl->ofl_flags |= FLG_OF_FATAL; continue; @@ -1616,14 +1617,14 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) */ rsdp = sdp = 0; if (sdflags & FLG_SY_REGSYM) { - if ((rsdp = reg_find(sym, ofl)) != 0) { + if ((rsdp = ld_reg_find(sym, ofl)) != 0) { /* * The fact that another register def- * inition has been found is fatal. * Call the verification routine to get * the error message and move on. */ - (void) reg_check(rsdp, sym, name, + (void) ld_reg_check(rsdp, sym, name, ifl, ofl); continue; } @@ -1653,7 +1654,7 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) ifl->ifl_oldndx[ndx] = sdp; } - DBG_CALL(Dbg_syms_entry(ndx, sdp)); + DBG_CALL(Dbg_syms_entry(ofl->ofl_lml, ndx, sdp)); /* * Reclassify any SHN_SUNW_IGNORE symbols to SHN_UNDEF @@ -1674,14 +1675,14 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) * register symbol, as this can be useful if a * register conflict is later discovered. */ - DBG_CALL(Dbg_syms_entered(ifl->ifl_ehdr, - sym, sdp)); + DBG_CALL(Dbg_syms_entered(ofl, sym, sdp)); /* * If this register symbol hasn't already been * recorded, enter it now. */ - if ((rsdp == 0) && (reg_enter(sdp, ofl) == 0)) + if ((rsdp == 0) && + (ld_reg_enter(sdp, ofl) == 0)) return (S_ERROR); } @@ -1700,7 +1701,8 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) if (sdp->sd_isc && (sdp->sd_isc->is_flags & FLG_IS_DISCARD)) { sdp->sd_flags |= FLG_SY_ISDISC; - DBG_CALL(Dbg_syms_discarded(sdp, sdp->sd_isc)); + DBG_CALL(Dbg_syms_discarded(ofl->ofl_lml, + sdp, sdp->sd_isc)); continue; } @@ -1710,11 +1712,11 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) */ if ((type = ELF_ST_TYPE(sym->st_info)) == STT_SECTION) { if (shndx == SHN_UNDEF) { - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_SYM_INVSHNDX), demangle(sdp->sd_name), ifl->ifl_name, - conv_shndx_str(shndx)); + conv_sym_shndx(shndx)); } continue; } @@ -1728,7 +1730,7 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) if ((isp == 0) || (isp->is_shdr == 0) || ((isp->is_shdr->sh_flags & SHF_TLS) == 0)) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_SYM_TLS), demangle(sdp->sd_name), ifl->ifl_name); @@ -1749,9 +1751,10 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) ((shndx == SHN_COMMON)) || ((type == STT_FILE) && (shndx != SHN_ABS))) || (sdp->sd_isc && (sdp->sd_isc->is_osdesc == 0))) { - eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_INVSHNDX), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_SYM_INVSHNDX), demangle(sdp->sd_name), ifl->ifl_name, - conv_shndx_str(shndx)); + conv_sym_shndx(shndx)); sdp->sd_isc = NULL; sdp->sd_flags |= FLG_SY_INVALID; continue; @@ -1800,7 +1803,7 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) /* * Check if st_name has a valid value or not. */ - if ((name = string(ifl, sym, strs, strsize, ndx, shndx, + if ((name = string(ofl, ifl, sym, strs, strsize, ndx, shndx, symsecname, strsecname, &sdflags)) == 0) { ofl->ofl_flags |= FLG_OF_FATAL; continue; @@ -1832,9 +1835,9 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) */ bind = ELF_ST_BIND(sym->st_info); if ((bind != STB_GLOBAL) && (bind != STB_WEAK)) { - eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_NONGLOB), - demangle(name), ifl->ifl_name, - conv_info_bind_str(bind)); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_SYM_NONGLOB), demangle(name), + ifl->ifl_name, conv_sym_info_bind(bind)); continue; } @@ -1853,9 +1856,9 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) * the output file, which won't be a problem * unless a relocation is required against it. */ - eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_INVSHNDX), - demangle(name), ifl->ifl_name, - conv_shndx_str(shndx)); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_SYM_INVSHNDX), demangle(name), + ifl->ifl_name, conv_sym_shndx(shndx)); continue; } @@ -1877,7 +1880,8 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) sdp->sd_flags = FLG_SY_ISDISC; ifl->ifl_oldndx[ndx] = sdp; - DBG_CALL(Dbg_syms_discarded(sdp, sdp->sd_isc)); + DBG_CALL(Dbg_syms_discarded(ofl->ofl_lml, sdp, + sdp->sd_isc)); continue; } } @@ -1890,13 +1894,13 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) */ /* LINTED */ hash = (Word)elf_hash((const char *)name); - if ((sdp = sym_find(name, hash, &where, ofl)) == NULL) { - DBG_CALL(Dbg_syms_global(ndx, name)); - if ((sdp = sym_enter(name, sym, hash, ifl, ofl, ndx, + if ((sdp = ld_sym_find(name, hash, &where, ofl)) == NULL) { + DBG_CALL(Dbg_syms_global(ofl->ofl_lml, ndx, name)); + if ((sdp = ld_sym_enter(name, sym, hash, ifl, ofl, ndx, shndx, sdflags, 0, &where)) == (Sym_desc *)S_ERROR) return (S_ERROR); - } else if (sym_resolve(sdp, sym, ifl, ofl, ndx, shndx, + } else if (ld_sym_resolve(sdp, sym, ifl, ofl, ndx, shndx, sdflags) == S_ERROR) return (S_ERROR); @@ -1924,11 +1928,11 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) if (sdp->sd_flags & FLG_SY_REGSYM) { Sym_desc *rsdp; - if ((rsdp = reg_find(sdp->sd_sym, ofl)) == 0) { - if (reg_enter(sdp, ofl) == 0) + if ((rsdp = ld_reg_find(sdp->sd_sym, ofl)) == 0) { + if (ld_reg_enter(sdp, ofl) == 0) return (S_ERROR); } else if (rsdp != sdp) { - (void) reg_check(rsdp, sdp->sd_sym, + (void) ld_reg_check(rsdp, sdp->sd_sym, sdp->sd_name, ifl, ofl); } } @@ -2025,7 +2029,7 @@ sym_process(Is_desc *isc, Ifl_desc *ifl, Ofl_desc *ofl) * Add an undefined symbol to the symbol table (ie. from -u name option) */ Sym_desc * -sym_add_u(const char *name, Ofl_desc *ofl) +ld_sym_add_u(const char *name, Ofl_desc *ofl) { Sym *sym; Ifl_desc *ifl = 0, *_ifl; @@ -2041,7 +2045,7 @@ sym_add_u(const char *name, Ofl_desc *ofl) */ /* LINTED */ hash = (Word)elf_hash(name); - if (sdp = sym_find(name, hash, &where, ofl)) { + if (sdp = ld_sym_find(name, hash, &where, ofl)) { if (sdp->sd_ref == REF_DYN_SEEN) sdp->sd_ref = REF_DYN_NEED; return (sdp); @@ -2085,9 +2089,10 @@ sym_add_u(const char *name, Ofl_desc *ofl) sym->st_info = ELF_ST_INFO(STB_GLOBAL, STT_NOTYPE); sym->st_shndx = SHN_UNDEF; - DBG_CALL(Dbg_syms_process(ifl)); - DBG_CALL(Dbg_syms_global(0, name)); - sdp = sym_enter(name, sym, hash, ifl, ofl, 0, SHN_UNDEF, 0, 0, &where); + DBG_CALL(Dbg_syms_process(ofl->ofl_lml, ifl)); + DBG_CALL(Dbg_syms_global(ofl->ofl_lml, 0, name)); + sdp = ld_sym_enter(name, sym, hash, ifl, ofl, 0, SHN_UNDEF, + 0, 0, &where); sdp->sd_flags &= ~FLG_SY_CLEAN; sdp->sd_flags |= FLG_SY_CMDREF; diff --git a/usr/src/cmd/sgs/libld/amd64/amd64unwind.c b/usr/src/cmd/sgs/libld/common/unwind.amd.c index ae823da604..dffff8c292 100644 --- a/usr/src/cmd/sgs/libld/amd64/amd64unwind.c +++ b/usr/src/cmd/sgs/libld/common/unwind.amd.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -315,7 +315,7 @@ make_amd64_unwindhdr(Ofl_desc *ofl) return (S_ERROR); elfdata->d_type = ELF_T_BYTE; elfdata->d_align = M_WORD_ALIGN; - elfdata->d_version = ofl->ofl_libver; + elfdata->d_version = ofl->ofl_dehdr->e_version; /* @@ -338,7 +338,7 @@ make_amd64_unwindhdr(Ofl_desc *ofl) isec->is_indata = elfdata; - if ((ofl->ofl_unwindhdr = place_section(ofl, isec, + if ((ofl->ofl_unwindhdr = ld_place_section(ofl, isec, M_ID_UNWINDHDR, 0)) == (Os_desc *)S_ERROR) return (S_ERROR); @@ -393,11 +393,10 @@ make_amd64_unwindhdr(Ofl_desc *ofl) cieversion = data[off + ndx]; ndx += 1; if (cieversion != 1) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_UNW_BADCIEVERS), isp->is_file->ifl_name, - isp->is_name, - off); + isp->is_name, off); return (S_ERROR); } } else @@ -614,7 +613,7 @@ populate_amd64_unwindhdr(Ofl_desc *ofl) (void) dwarf_ehe_extract( &fdata[foff + fndx], &fndx, ciePflag, - ofl->ofl_ehdr->e_ident, + ofl->ofl_dehdr->e_ident, shdr->sh_addr + foff + fndx); break; case 'R': @@ -644,7 +643,7 @@ populate_amd64_unwindhdr(Ofl_desc *ofl) fdeaddr = shdr->sh_addr + foff; initloc = dwarf_ehe_extract(&fdata[foff], - &fndx, cieRflag, ofl->ofl_ehdr->e_ident, + &fndx, cieRflag, ofl->ofl_dehdr->e_ident, shdr->sh_addr + foff + fndx); binarytable[bintabndx] = (uint_t)(initloc - hdraddr); @@ -705,35 +704,3 @@ append_amd64_unwind(Os_desc *osp, Ofl_desc * ofl) return (S_ERROR); return (1); } - -uintptr_t -process_amd64_unwind(const char *name, Ifl_desc *ifl, Shdr *shdr, - Elf_Scn *scn, Word ndx, int ident, Ofl_desc *ofl) -{ - Os_desc *osp; - Is_desc *isp; - - ident = M_ID_UNWIND; - if (process_section(name, ifl, shdr, scn, ndx, ident, ofl) == - S_ERROR) - return (S_ERROR); - /* - * When producing a relocatable object - just collect - * the sections. - */ - if (ofl->ofl_flags & FLG_OF_RELOBJ) - return (1); - /* - * If we are producing a executable or shared library, we need - * to keep track of all the output UNWIND sections - so that - * we can create the appropriate frame_hdr information. - * - * If the section hasn't been placed in the output file, - * then there's nothing for us to do. - */ - if (((isp = ifl->ifl_isdesc[ndx]) == 0) || - ((osp = isp->is_osdesc) == 0)) - return (1); - - return (append_amd64_unwind(osp, ofl)); -} diff --git a/usr/src/cmd/sgs/libld/common/update.c b/usr/src/cmd/sgs/libld/common/update.c index 5e881dc1b0..ec834d5e19 100644 --- a/usr/src/cmd/sgs/libld/common/update.c +++ b/usr/src/cmd/sgs/libld/common/update.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,12 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -36,7 +35,7 @@ */ #include <stdio.h> #include <string.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" @@ -57,7 +56,7 @@ sym_hash_compare(Sym_s_list * s1, Sym_s_list * s2) * file images to the output image and their values and index's updated in the * output image. */ -Addr +static Addr update_osym(Ofl_desc *ofl) { Listnode *lnp1, *lnp2; @@ -171,7 +170,7 @@ update_osym(Ofl_desc *ofl) strtab = ofl->ofl_strtab; dynstr = ofl->ofl_dynstrtab; - DBG_CALL(Dbg_syms_sec_title()); + DBG_CALL(Dbg_syms_sec_title(ofl->ofl_lml)); /* * Add the output file name to the first .symtab symbol. @@ -195,7 +194,7 @@ update_osym(Ofl_desc *ofl) * If we are to display GOT summary information, then allocate * the buffer to 'cache' the GOT symbols into now. */ - if (dbg_mask) { + if (DBG_ENABLED) { if ((_gottable = gottable = libld_calloc(ofl->ofl_gotcnt, sizeof (Gottable))) == 0) return ((Addr)S_ERROR); @@ -256,9 +255,9 @@ update_osym(Ofl_desc *ofl) if ((dynsym == 0) || (osp->os_flags & FLG_OS_OUTREL)) { if (versym) versym[*symndx - 1] = 0; - DBG_CALL(Dbg_syms_sec_entry(*symndx - 1, - sgp, osp)); osp->os_scnsymndx = *symndx - 1; + DBG_CALL(Dbg_syms_sec_entry(ofl->ofl_lml, + osp->os_scnsymndx, sgp, osp)); } /* @@ -334,7 +333,7 @@ update_osym(Ofl_desc *ofl) etext_ndx = SHN_ABS; etext_abs = 1; if (ofl->ofl_flags & FLG_OF_VERBOSE) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_UPD_NOREADSEG)); } if (dsgp) { @@ -344,7 +343,7 @@ update_osym(Ofl_desc *ofl) edata_ndx = SHN_ABS; edata_abs = 1; if (ofl->ofl_flags & FLG_OF_VERBOSE) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_UPD_NORDWRSEG)); } @@ -394,11 +393,12 @@ update_osym(Ofl_desc *ofl) end = (Addr) 0; end_ndx = SHN_ABS; end_abs = 1; - eprintf(ERR_WARNING, MSG_INTL(MSG_UPD_NOSEG)); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_UPD_NOSEG)); } } - DBG_CALL(Dbg_syms_up_title(ofl->ofl_ehdr)); + DBG_CALL(Dbg_syms_up_title(ofl->ofl_lml)); /* * Initialize the scoped symbol table entry point. This is for all @@ -448,18 +448,18 @@ update_osym(Ofl_desc *ofl) sdp = ifl->ifl_oldndx[lndx]; sym = sdp->sd_sym; -#if defined(sparc) || defined(__sparcv9) +#if defined(sparc) || defined(__sparcv9) /* * Assign a got offset if necessary. */ - if (assign_got(sdp) == S_ERROR) + if (ld_assign_got(ofl, sdp) == S_ERROR) return ((Addr)S_ERROR); #elif defined(i386) || defined(__amd64) /* nothing to do */ #else #error Unknown architecture! #endif - if (dbg_mask) { + if (DBG_ENABLED) { for (LIST_TRAVERSE(&sdp->sd_GOTndxs, lnp2, gnp)) { _gottable->gt_sym = sdp; _gottable->gt_gndx.gn_gotndx = gnp->gn_gotndx; @@ -532,7 +532,7 @@ update_osym(Ofl_desc *ofl) (sym->st_shndx == SHN_ABS)) continue; - if (sym_copy(sdp) == S_ERROR) + if (ld_sym_copy(sdp) == S_ERROR) return ((Addr)S_ERROR); sym = sdp->sd_sym; } @@ -608,19 +608,19 @@ update_osym(Ofl_desc *ofl) * the `.init' and `.fini' sections. In this case determine the size of * these sections and updated the symbols value accordingly. */ - if (((sdp = sym_find(MSG_ORIG(MSG_SYM_INIT_U), SYM_NOHASH, 0, + if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_INIT_U), SYM_NOHASH, 0, ofl)) != NULL) && (sdp->sd_ref == REF_REL_NEED) && sdp->sd_isc && (strcmp(sdp->sd_isc->is_name, MSG_ORIG(MSG_SCN_INIT)) == 0)) { - if (sym_copy(sdp) == S_ERROR) + if (ld_sym_copy(sdp) == S_ERROR) return ((Addr)S_ERROR); sdp->sd_sym->st_size = sdp->sd_isc->is_osdesc->os_shdr->sh_size; } - if (((sdp = sym_find(MSG_ORIG(MSG_SYM_FINI_U), SYM_NOHASH, 0, + if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_FINI_U), SYM_NOHASH, 0, ofl)) != NULL) && (sdp->sd_ref == REF_REL_NEED) && sdp->sd_isc && (strcmp(sdp->sd_isc->is_name, MSG_ORIG(MSG_SCN_FINI)) == 0)) { - if (sym_copy(sdp) == S_ERROR) + if (ld_sym_copy(sdp) == S_ERROR) return ((Addr)S_ERROR); sdp->sd_sym->st_size = sdp->sd_isc->is_osdesc->os_shdr->sh_size; @@ -701,8 +701,8 @@ update_osym(Ofl_desc *ofl) * just be dropped from the output image. */ if (sdp->sd_flags & FLG_SY_INVALID) { - DBG_CALL(Dbg_syms_old(ofl->ofl_ehdr, sdp)); - DBG_CALL(Dbg_syms_ignore(ofl->ofl_ehdr, sdp)); + DBG_CALL(Dbg_syms_old(ofl, sdp)); + DBG_CALL(Dbg_syms_ignore(ofl, sdp)); continue; } @@ -872,15 +872,15 @@ update_osym(Ofl_desc *ofl) /* * Assign a got offset if necessary. */ -#if defined(sparc) || defined(__sparcv9) - if (assign_got(sdp) == S_ERROR) +#if defined(sparc) || defined(__sparcv9) + if (ld_assign_got(ofl, sdp) == S_ERROR) return ((Addr)S_ERROR); -#elif defined(i386) || defined(__amd64) +#elif defined(i386) || defined(__amd64) /* nothing to do */ #else #error Unknown architecture! #endif - if (dbg_mask) { + if (DBG_ENABLED) { for (LIST_TRAVERSE(&sdp->sd_GOTndxs, lnp2, gnp)) { _gottable->gt_sym = sdp; _gottable->gt_gndx.gn_gotndx = gnp->gn_gotndx; @@ -1203,7 +1203,7 @@ update_osym(Ofl_desc *ofl) } } - DBG_CALL(Dbg_syms_old(ofl->ofl_ehdr, sdp)); + DBG_CALL(Dbg_syms_old(ofl, sdp)); spec = NULL; /* @@ -1213,7 +1213,8 @@ update_osym(Ofl_desc *ofl) if (sectndx == SHN_UNDEF) { if (((sdp->sd_flags & FLG_SY_REGSYM) == 0) && (sym->st_value != 0)) { - eprintf(ERR_WARNING, MSG_INTL(MSG_SYM_NOTNULL), + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_SYM_NOTNULL), demangle(name), sdp->sd_file->ifl_name); } @@ -1382,7 +1383,7 @@ update_osym(Ofl_desc *ofl) (ELF_ST_TYPE(sym->st_info) == STT_FUNC) && !(flags & FLG_OF_BFLAG)) { if (sap->sa_PLTndx) - sym->st_value = calc_plt_addr(sdp, ofl); + sym->st_value = ld_calc_plt_addr(sdp, ofl); } /* @@ -1442,7 +1443,7 @@ update_osym(Ofl_desc *ofl) dynsym_ndx++; } - DBG_CALL(Dbg_syms_new(ofl->ofl_ehdr, sym, sdp)); + DBG_CALL(Dbg_syms_new(ofl, sym, sdp)); } /* @@ -1478,7 +1479,7 @@ update_osym(Ofl_desc *ofl) else bind = STB_WEAK; - DBG_CALL(Dbg_syms_old(ofl->ofl_ehdr, sdp)); + DBG_CALL(Dbg_syms_old(ofl, sdp)); if ((sym = wkp->wk_symtab) != 0) { sym = wkp->wk_symtab; sym->st_value = _sym->st_value; @@ -1499,13 +1500,13 @@ update_osym(Ofl_desc *ofl) ELF_ST_TYPE(sym->st_info)); __sym = sym; } - DBG_CALL(Dbg_syms_new(ofl->ofl_ehdr, __sym, sdp)); + DBG_CALL(Dbg_syms_new(ofl, __sym, sdp)); } /* - * Now display GOT debugging information if required + * Now display GOT debugging information if required. */ - DBG_CALL(Dbg_got_display(gottable, ofl)); + DBG_CALL(Dbg_got_display(ofl, gottable)); /* * Update the section headers information. @@ -1549,7 +1550,7 @@ update_osym(Ofl_desc *ofl) /* * Build the dynamic section. */ -int +static int update_odynamic(Ofl_desc *ofl) { Listnode *lnp; @@ -1617,14 +1618,14 @@ update_odynamic(Ofl_desc *ofl) dyn++; } } - if (((sdp = sym_find(MSG_ORIG(MSG_SYM_INIT_U), + if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_INIT_U), SYM_NOHASH, 0, ofl)) != NULL) && sdp->sd_ref == REF_REL_NEED) { dyn->d_tag = DT_INIT; dyn->d_un.d_ptr = sdp->sd_sym->st_value; dyn++; } - if (((sdp = sym_find(MSG_ORIG(MSG_SYM_FINI_U), + if (((sdp = ld_sym_find(MSG_ORIG(MSG_SYM_FINI_U), SYM_NOHASH, 0, ofl)) != NULL) && sdp->sd_ref == REF_REL_NEED) { dyn->d_tag = DT_FINI; @@ -1915,7 +1916,7 @@ update_odynamic(Ofl_desc *ofl) dyn->d_un.d_val = ofl->ofl_dtflags_1; dyn++; - mach_update_odynamic(ofl, &dyn); + ld_mach_update_odynamic(ofl, &dyn); dyn->d_tag = DT_NULL; dyn->d_un.d_val = 0; @@ -1926,7 +1927,7 @@ update_odynamic(Ofl_desc *ofl) /* * Build the version definition section */ -int +static int update_overdef(Ofl_desc *ofl) { Listnode *lnp1, *lnp2; @@ -1964,7 +1965,7 @@ update_overdef(Ofl_desc *ofl) vdp->vd_name = (const char *)(uintptr_t)stoff; } } else { - sdp = sym_find(vdp->vd_name, vdp->vd_hash, 0, ofl); + sdp = ld_sym_find(vdp->vd_name, vdp->vd_hash, 0, ofl); /* LINTED */ vdp->vd_name = (const char *) (uintptr_t)sdp->sd_sym->st_name; @@ -2060,7 +2061,7 @@ update_overdef(Ofl_desc *ofl) /* * Build the version needed section */ -int +static int update_overneed(Ofl_desc *ofl) { Listnode *lnp; @@ -2190,7 +2191,7 @@ update_overneed(Ofl_desc *ofl) /* * Update syminfo section. */ -uintptr_t +static uintptr_t update_osyminfo(Ofl_desc * ofl) { Os_desc * symosp, * infosp = ofl->ofl_ossyminfo; @@ -2244,9 +2245,9 @@ update_osyminfo(Ofl_desc * ofl) /* * Display debugging information about section. */ - DBG_CALL(Dbg_syminfo_title()); - if (dbg_mask) { - size_t _cnt, cnt = shdr->sh_size / shdr->sh_entsize; + DBG_CALL(Dbg_syminfo_title(ofl->ofl_lml)); + if (DBG_ENABLED) { + Word _cnt, cnt = shdr->sh_size / shdr->sh_entsize; Sym * symtab = symosp->os_outdata->d_buf; Dyn * dyn; @@ -2258,7 +2259,7 @@ update_osyminfo(Ofl_desc * ofl) for (_cnt = 1; _cnt < cnt; _cnt++) { if (sip[_cnt].si_flags || sip[_cnt].si_boundto) /* LINTED */ - DBG_CALL(Dbg_syminfo_entry((int)_cnt, + DBG_CALL(Dbg_syminfo_entry(ofl->ofl_lml, _cnt, &sip[_cnt], &symtab[_cnt], strtab, dyn)); } } @@ -2268,10 +2269,10 @@ update_osyminfo(Ofl_desc * ofl) /* * Build the output elf header. */ -uintptr_t +static uintptr_t update_oehdr(Ofl_desc * ofl) { - Ehdr * ehdr = ofl->ofl_ehdr; + Ehdr *ehdr = ofl->ofl_nehdr; /* * If an entry point symbol has already been established (refer @@ -2289,15 +2290,16 @@ update_oehdr(Ofl_desc * ofl) * machine dependent section. */ ehdr->e_ident[EI_DATA] = M_DATA; - if (ofl->ofl_e_machine != M_MACH) { - if (ofl->ofl_e_machine != M_MACHPLUS) + ehdr->e_machine = ofl->ofl_dehdr->e_machine; + ehdr->e_flags = ofl->ofl_dehdr->e_flags; + ehdr->e_version = ofl->ofl_dehdr->e_version; + + if (ehdr->e_machine != M_MACH) { + if (ehdr->e_machine != M_MACHPLUS) return (S_ERROR); - if ((ofl->ofl_e_flags & M_FLAGSPLUS) == 0) + if ((ehdr->e_flags & M_FLAGSPLUS) == 0) return (S_ERROR); } - ehdr->e_machine = ofl->ofl_e_machine; - ehdr->e_flags = ofl->ofl_e_flags; - ehdr->e_version = ofl->ofl_libver; if (ofl->ofl_flags & FLG_OF_SHAROBJ) ehdr->e_type = ET_DYN; @@ -2334,7 +2336,8 @@ expand_move(Ofl_desc *ofl, Sym_desc *sdp, Move *u1) taddr = taddr + mv->m_poffset; for (i = 0; i < mv->m_repeat; i++) { /* LINTED */ - DBG_CALL(Dbg_move_expanding(mv, (Addr)(taddr - taddr0))); + DBG_CALL(Dbg_move_expand(ofl->ofl_lml, mv, + (Addr)(taddr - taddr0))); stride = (unsigned int)mv->m_stride + 1; /* LINTED */ switch (ELF_M_SIZE(mv->m_info)) { @@ -2373,7 +2376,7 @@ expand_move(Ofl_desc *ofl, Sym_desc *sdp, Move *u1) /* * Update Move sections. */ -uintptr_t +static uintptr_t update_move(Ofl_desc *ofl) { Word ndx = 0; @@ -2422,13 +2425,15 @@ update_move(Ofl_desc *ofl) s = MSG_INTL(MSG_PSYM_EXPREASON2); else s = MSG_INTL(MSG_PSYM_EXPREASON3); - DBG_CALL(Dbg_move_parexpn(psym->psym_symd->sd_name, s)); + DBG_CALL(Dbg_move_parexpn(ofl->ofl_lml, + psym->psym_symd->sd_name, s)); for (LIST_TRAVERSE(&(psym->psym_mvs), lnp2, mvp)) { if ((mvp->mv_flag & FLG_MV_OUTSECT) == 0) continue; mv2 = mvp->mv_ientry; sdp = psym->psym_symd; - DBG_CALL(Dbg_move_mventry(0, mv2, sdp)); + DBG_CALL(Dbg_move_entry1(ofl->ofl_lml, 0, + mv2, sdp)); (void) expand_move(ofl, sdp, mv2); } continue; @@ -2437,8 +2442,8 @@ update_move(Ofl_desc *ofl) /* * Process move table */ - DBG_CALL(Dbg_move_outmove((const unsigned char *) - psym->psym_symd->sd_name)); + DBG_CALL(Dbg_move_outmove(ofl->ofl_lml, + psym->psym_symd->sd_name)); for (LIST_TRAVERSE(&(psym->psym_mvs), lnp2, mvp)) { int idx = 1; if ((mvp->mv_flag & FLG_MV_OUTSECT) == 0) @@ -2448,7 +2453,7 @@ update_move(Ofl_desc *ofl) sdp = isp->is_file->ifl_oldndx[ ELF_M_SYM(mv2->m_info)]; - DBG_CALL(Dbg_move_mventry(0, mv2, sdp)); + DBG_CALL(Dbg_move_entry1(ofl->ofl_lml, 0, mv2, sdp)); *mv1 = *mv2; if ((ofl->ofl_flags & FLG_OF_RELOBJ) == 0) { if (ELF_ST_BIND(sdp->sd_sym->st_info) == @@ -2487,9 +2492,8 @@ update_move(Ofl_desc *ofl) mv1->m_poffset += sdp->sd_sym->st_value; } else { if (isredloc) - DBG_CALL(Dbg_syms_reduce( - DBG_SYM_REDUCE_RETAIN, - ofl->ofl_ehdr, sdp, + DBG_CALL(Dbg_syms_reduce(ofl, + DBG_SYM_REDUCE_RETAIN, sdp, idx, ofl->ofl_osmove->os_name)); mv1->m_info = @@ -2497,7 +2501,7 @@ update_move(Ofl_desc *ofl) ELF_M_INFO(sdp->sd_symndx, mv2->m_info); } } - DBG_CALL(Dbg_move_mventry(1, mv1, sdp)); + DBG_CALL(Dbg_move_entry1(ofl->ofl_lml, 1, mv1, sdp)); mv1++; idx++; } @@ -2510,7 +2514,7 @@ update_move(Ofl_desc *ofl) * Scan through the SHT_GROUP output sections. Update their * sh_link/sh_info fields as well as the section contents. */ -uintptr_t +static uintptr_t update_ogroup(Ofl_desc * ofl) { Listnode *lnp; @@ -2553,9 +2557,9 @@ update_ogroup(Ofl_desc * ofl) * for the file it came from. */ if (gdata[i] >= ifl->ifl_shnum) { - eprintf(ERR_FATAL, MSG_INTL(MSG_GRP_INVALNDX), - isp->is_name, ifl->ifl_name, i, - gdata[i]); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_GRP_INVALNDX), isp->is_name, + ifl->ifl_name, i, gdata[i]); error = S_ERROR; gdata[i] = 0; continue; @@ -2576,8 +2580,7 @@ update_ogroup(Ofl_desc * ofl) return (error); } - -void +static void update_ostrtab(Os_desc *osp, Str_tbl *stp) { Elf_Data *data; @@ -2593,8 +2596,8 @@ update_ostrtab(Os_desc *osp, Str_tbl *stp) * Translate the shdr->sh_{link, info} from its input section value to that * of the corresponding shdr->sh_{link, info} output section value. */ -Word -translate_link(Os_desc * osp, Word link, const char *msg) +static Word +translate_link(Ofl_desc *ofl, Os_desc *osp, Word link, const char *msg) { Is_desc * isp; Ifl_desc * ifl; @@ -2619,7 +2622,7 @@ translate_link(Os_desc * osp, Word link, const char *msg) * is within range for the input file. */ if (link >= ifl->ifl_shnum) { - eprintf(ERR_WARNING, msg, ifl->ifl_name, + eprintf(ofl->ofl_lml, ERR_WARNING, msg, ifl->ifl_name, isp->is_name, EC_XWORD(link)); return (link); } @@ -2659,14 +2662,14 @@ translate_link(Os_desc * osp, Word link, const char *msg) * expect this behavior). */ uintptr_t -update_outfile(Ofl_desc *ofl) +ld_update_outfile(Ofl_desc *ofl) { Addr size, etext, vaddr = ofl->ofl_segorigin; Listnode *lnp1, *lnp2; Sg_desc *sgp; Os_desc *osp; int phdrndx = 0, capndx = 0, segndx = -1, secndx; - Ehdr *ehdr = ofl->ofl_ehdr; + Ehdr *ehdr = ofl->ofl_nehdr; List osecs; Shdr *hshdr; Phdr *_phdr = 0, *dtracephdr = 0; @@ -2678,7 +2681,7 @@ update_outfile(Ofl_desc *ofl) /* * Loop through the segment descriptors and pick out what we need. */ - DBG_CALL(Dbg_seg_title()); + DBG_CALL(Dbg_seg_title(ofl->ofl_lml)); for (LIST_TRAVERSE(&ofl->ofl_segs, lnp1, sgp)) { Phdr * phdr = &(sgp->sg_phdr); Xword p_align; @@ -2699,8 +2702,7 @@ update_outfile(Ofl_desc *ofl) if (ofl->ofl_osinterp) { phdr->p_offset = ehdr->e_phoff; phdr->p_filesz = phdr->p_memsz = phdrsz; - DBG_CALL(Dbg_seg_entry(ofl->ofl_e_machine, - segndx, sgp)); + DBG_CALL(Dbg_seg_entry(ofl, segndx, sgp)); ofl->ofl_phdr[phdrndx++] = *phdr; } continue; @@ -2712,8 +2714,7 @@ update_outfile(Ofl_desc *ofl) phdr->p_vaddr = phdr->p_memsz = 0; phdr->p_offset = shdr->sh_offset; phdr->p_filesz = shdr->sh_size; - DBG_CALL(Dbg_seg_entry(ofl->ofl_e_machine, - segndx, sgp)); + DBG_CALL(Dbg_seg_entry(ofl, segndx, sgp)); ofl->ofl_phdr[phdrndx++] = *phdr; } continue; @@ -2750,8 +2751,7 @@ update_outfile(Ofl_desc *ofl) phdr->p_offset = shdr->sh_offset; phdr->p_filesz = shdr->sh_size; phdr->p_flags = PF_R; - DBG_CALL(Dbg_seg_entry(ofl->ofl_e_machine, - segndx, sgp)); + DBG_CALL(Dbg_seg_entry(ofl, segndx, sgp)); capndx = phdrndx; ofl->ofl_phdr[phdrndx++] = *phdr; } @@ -2773,13 +2773,12 @@ update_outfile(Ofl_desc *ofl) phdr->p_offset = shdr->sh_offset; phdr->p_filesz = shdr->sh_size; phdr->p_flags = M_DATASEG_PERM; - DBG_CALL(Dbg_seg_entry(ofl->ofl_e_machine, - segndx, sgp)); + DBG_CALL(Dbg_seg_entry(ofl, segndx, sgp)); ofl->ofl_phdr[phdrndx++] = *phdr; } continue; } -#if defined(__x86) && defined(_ELF64) +#if defined(__x86) && defined(_ELF64) if (phdr->p_type == PT_SUNW_UNWIND) { Shdr *shdr; if (ofl->ofl_unwindhdr == 0) @@ -2828,8 +2827,7 @@ update_outfile(Ofl_desc *ofl) phdr->p_memsz = lastmemshdr->sh_offset + lastmemshdr->sh_size - phdr->p_offset; - DBG_CALL(Dbg_seg_entry(ofl->ofl_e_machine, - segndx, sgp)); + DBG_CALL(Dbg_seg_entry(ofl, segndx, sgp)); ofl->ofl_tlsphdr = phdr; ofl->ofl_phdr[phdrndx++] = *phdr; @@ -2849,8 +2847,7 @@ update_outfile(Ofl_desc *ofl) vaddr = phdr->p_vaddr; phdr->p_memsz = sgp->sg_length; - DBG_CALL(Dbg_seg_entry(ofl->ofl_e_machine, - segndx, sgp)); + DBG_CALL(Dbg_seg_entry(ofl, segndx, sgp)); ofl->ofl_phdr[phdrndx++] = *phdr; if (phdr->p_type != PT_LOAD) @@ -2870,12 +2867,10 @@ update_outfile(Ofl_desc *ofl) p_e = p_s + (ofl->ofl_phdr[i]).p_memsz; if (((p_s <= vaddr) && (p_e > vaddr)) || ((vaddr <= p_s) && (v_e > p_s))) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_UPD_SEGOVERLAP), - ofl->ofl_name, - EC_ADDR(p_e), - sgp->sg_name, - EC_ADDR(vaddr)); + ofl->ofl_name, EC_ADDR(p_e), + sgp->sg_name, EC_ADDR(vaddr)); } continue; } @@ -2914,7 +2909,7 @@ update_outfile(Ofl_desc *ofl) offset += shdr->sh_size; if (shdr->sh_type != SHT_NOBITS) { if (nobits) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_UPD_NOBITS)); return (S_ERROR); } @@ -2974,7 +2969,7 @@ update_outfile(Ofl_desc *ofl) if ((sgp->sg_flags & FLG_SG_VADDR)) { if (_phdr && (vaddr > phdr->p_vaddr) && (phdr->p_type == PT_LOAD)) - eprintf(ERR_WARNING, + eprintf(ofl->ofl_lml, ERR_WARNING, MSG_INTL(MSG_UPD_SEGOVERLAP), ofl->ofl_name, EC_ADDR(vaddr), sgp->sg_name, @@ -3046,7 +3041,7 @@ update_outfile(Ofl_desc *ofl) (phdr->p_flags & PF_X)) ehdr->e_entry = vaddr; - DBG_CALL(Dbg_seg_entry(ofl->ofl_e_machine, segndx, sgp)); + DBG_CALL(Dbg_seg_entry(ofl, segndx, sgp)); /* * Traverse the output section descriptors for this segment so @@ -3062,12 +3057,12 @@ update_outfile(Ofl_desc *ofl) if (shdr->sh_link) shdr->sh_link = - translate_link(osp, shdr->sh_link, + translate_link(ofl, osp, shdr->sh_link, MSG_INTL(MSG_FIL_INVSHLINK)); if (shdr->sh_info && (shdr->sh_flags & SHF_INFO_LINK)) shdr->sh_info = - translate_link(osp, shdr->sh_info, + translate_link(ofl, osp, shdr->sh_info, MSG_INTL(MSG_FIL_INVSHINFO)); if (!(flags & FLG_OF_RELOBJ) && @@ -3099,9 +3094,9 @@ update_outfile(Ofl_desc *ofl) * haven't exceeded any maximum segment length specification. */ if ((sgp->sg_length != 0) && (sgp->sg_length < phdr->p_memsz)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_UPD_LARGSIZE), - ofl->ofl_name, sgp->sg_name, - EC_XWORD(phdr->p_memsz), + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_UPD_LARGSIZE), ofl->ofl_name, + sgp->sg_name, EC_XWORD(phdr->p_memsz), EC_XWORD(sgp->sg_length)); return (S_ERROR); } @@ -3199,9 +3194,12 @@ update_outfile(Ofl_desc *ofl) /* * Emit Strtab diagnostics. */ - DBG_CALL(Dbg_sec_strtab(ofl->ofl_osshstrtab, ofl->ofl_shdrsttab)); - DBG_CALL(Dbg_sec_strtab(ofl->ofl_osstrtab, ofl->ofl_strtab)); - DBG_CALL(Dbg_sec_strtab(ofl->ofl_osdynstr, ofl->ofl_dynstrtab)); + DBG_CALL(Dbg_sec_strtab(ofl->ofl_lml, ofl->ofl_osshstrtab, + ofl->ofl_shdrsttab)); + DBG_CALL(Dbg_sec_strtab(ofl->ofl_lml, ofl->ofl_osstrtab, + ofl->ofl_strtab)); + DBG_CALL(Dbg_sec_strtab(ofl->ofl_lml, ofl->ofl_osdynstr, + ofl->ofl_dynstrtab)); /* * Initialize the section headers string table index within the elf @@ -3210,7 +3208,7 @@ update_outfile(Ofl_desc *ofl) /* LINTED */ if ((shscnndx = elf_ndxscn(ofl->ofl_osshstrtab->os_scn)) < SHN_LORESERVE) { - ofl->ofl_ehdr->e_shstrndx = + ofl->ofl_nehdr->e_shstrndx = /* LINTED */ (Half)shscnndx; } else { @@ -3220,17 +3218,18 @@ update_outfile(Ofl_desc *ofl) */ Elf_Scn *scn; Shdr *shdr0; + if ((scn = elf_getscn(ofl->ofl_elf, 0)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSCN), - ofl->ofl_name); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETSCN), ofl->ofl_name); return (S_ERROR); } if ((shdr0 = elf_getshdr(scn)) == NULL) { - eprintf(ERR_ELF, MSG_INTL(MSG_ELF_GETSHDR), - ofl->ofl_name); + eprintf(ofl->ofl_lml, ERR_ELF, + MSG_INTL(MSG_ELF_GETSHDR), ofl->ofl_name); return (S_ERROR); } - ofl->ofl_ehdr->e_shstrndx = SHN_XINDEX; + ofl->ofl_nehdr->e_shstrndx = SHN_XINDEX; shdr0->sh_link = shscnndx; } diff --git a/usr/src/cmd/sgs/libld/common/util.c b/usr/src/cmd/sgs/libld/common/util.c index a995203e9c..bf85c4de0e 100644 --- a/usr/src/cmd/sgs/libld/common/util.c +++ b/usr/src/cmd/sgs/libld/common/util.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -34,11 +33,13 @@ */ #include <unistd.h> #include <stdio.h> +#include <stdarg.h> #include <string.h> #include <fcntl.h> #include <sys/types.h> #include <sys/mman.h> #include <errno.h> +#include <sgs.h> #include <debug.h> #include "msg.h" #include "_libld.h" @@ -80,7 +81,7 @@ * by libld_malloc() must be 8 byte-aligned. Even in a 32-bit environment, * u_longlog_t pointers are employed. * - * MAP_ANON arrived un Solaris 8, thus a fall-back is provided for older + * MAP_ANON arrived in Solaris 8, thus a fall-back is provided for older * systems. */ static void * @@ -89,7 +90,7 @@ dz_map(size_t size) void *addr; int err; -#if defined(MAP_ANON) +#if defined(MAP_ANON) static int noanon = 0; if (noanon == 0) { @@ -99,7 +100,7 @@ dz_map(size_t size) if ((errno != EBADF) && (errno != EINVAL)) { err = errno; - (void) eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAPANON), + eprintf(0, ERR_FATAL, MSG_INTL(MSG_SYS_MMAPANON), MSG_ORIG(MSG_PTH_DEVZERO), strerror(err)); return (MAP_FAILED); } else @@ -109,7 +110,7 @@ dz_map(size_t size) if (dz_fd == -1) { if ((dz_fd = open(MSG_ORIG(MSG_PTH_DEVZERO), O_RDONLY)) == -1) { err = errno; - (void) eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), + eprintf(0, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), MSG_ORIG(MSG_PTH_DEVZERO), strerror(err)); return (MAP_FAILED); } @@ -118,7 +119,7 @@ dz_map(size_t size) if ((addr = mmap(0, size, (PROT_READ | PROT_WRITE | PROT_EXEC), MAP_PRIVATE, dz_fd, 0)) == MAP_FAILED) { err = errno; - (void) eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), + eprintf(0, ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), MSG_ORIG(MSG_PTH_DEVZERO), strerror(err)); return (MAP_FAILED); } @@ -395,96 +396,6 @@ sdf_add(const char *name, List *lst) } /* - * Determine a least common multiplier. Input sections contain an alignment - * requirement, which elf_update() uses to insure that the section is aligned - * correctly off of the base of the elf image. We must also insure that the - * sections mapping is congruent with this alignment requirement. For each - * input section associated with a loadable segment determine whether the - * segments alignment must be adjusted to compensate for a sections alignment - * requirements. - */ -Xword -lcm(Xword a, Xword b) -{ - Xword _r, _a, _b; - - if ((_a = a) == 0) - return (b); - if ((_b = b) == 0) - return (a); - - if (_a > _b) - _a = b, _b = a; - while ((_r = _b % _a) != 0) - _b = _a, _a = _r; - return ((a / _a) * b); -} - -/* - * Cleanup an Ifl_desc - */ -void -ifl_list_cleanup(List *ifl_list) -{ - Listnode *lnp; - Ifl_desc *ifl; - - for (LIST_TRAVERSE(ifl_list, lnp, ifl)) - if (ifl->ifl_elf) - (void) elf_end(ifl->ifl_elf); - ifl_list->head = 0; - ifl_list->tail = 0; -} - -/* - * Cleanup all memory that has been dynamically allocated - * durring libld processing and elf_end() all Elf descriptors that - * are still open. - */ -void -ofl_cleanup(Ofl_desc *ofl) -{ - Ld_heap *chp, *php; - Ar_desc *adp; - Listnode *lnp; - - ifl_list_cleanup(&ofl->ofl_objs); - ifl_list_cleanup(&ofl->ofl_sos); - - for (LIST_TRAVERSE(&ofl->ofl_ars, lnp, adp)) { - Ar_aux *aup; - Elf_Arsym *arsym; - - for (arsym = adp->ad_start, aup = adp->ad_aux; - arsym->as_name; ++arsym, ++aup) { - if ((aup->au_mem) && (aup->au_mem != FLG_ARMEM_PROC)) { - (void) elf_end(aup->au_mem->am_elf); - - /* - * Null out all entries to this member so - * that we don't attempt to elf_end() it again. - */ - ar_member(adp, arsym, aup, 0); - } - } - (void) elf_end(adp->ad_elf); - } - - (void) elf_end(ofl->ofl_elf); - (void) elf_end(ofl->ofl_welf); - - for (chp = ld_heap, php = 0; chp; php = chp, chp = chp->lh_next) { - if (php) - (void) munmap((void *)php, - (size_t)php->lh_end - (size_t)php); - } - if (php) - (void) munmap((void *)php, (size_t)php->lh_end - (size_t)php); - - ld_heap = 0; -} - -/* * Add a string, separated by a colon, to an existing string. Typically used * to maintain filter, rpath and audit names, of which there is normally only * one string supplied anyway. @@ -524,7 +435,6 @@ add_string(char *old, char *str) return (new); } - /* * Messaging support - funnel everything through _dgettext() as this provides * a stub binding to libc, or a real binding to libintl. @@ -543,8 +453,8 @@ _libld_msg(Msg mid) const char * demangle(const char *name) { - if (Ofl.ofl_flags1 & FLG_OF1_DEMANGL) - return (Gelf_sym_dem(name)); + if (demangle_flag) + return (Elf_demangle_name(name)); else return (name); } diff --git a/usr/src/cmd/sgs/libld/common/version.c b/usr/src/cmd/sgs/libld/common/version.c index 2c8ae15512..d793dc61c2 100644 --- a/usr/src/cmd/sgs/libld/common/version.c +++ b/usr/src/cmd/sgs/libld/common/version.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,15 +18,16 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <string.h> #include <stdio.h> -#include "debug.h" +#include <debug.h> #include "msg.h" #include "_libld.h" @@ -36,7 +36,7 @@ * Locate a version descriptor. */ Ver_desc * -vers_find(const char *name, Word hash, List *lst) +ld_vers_find(const char *name, Word hash, List *lst) { Listnode *lnp; Ver_desc *vdp; @@ -57,7 +57,7 @@ vers_find(const char *name, Word hash, List *lst) * until it is determined a descriptor need be created (see map_symbol())). */ Ver_desc * -vers_desc(const char *name, Word hash, List *lst) +ld_vers_desc(const char *name, Word hash, List *lst) { Ver_desc *vdp; @@ -88,7 +88,7 @@ typedef struct { } Ver_Stack; static uintptr_t -vers_visit_children(Ver_desc *vp, int flag) +vers_visit_children(Ofl_desc *ofl, Ver_desc *vp, int flag) { Listnode *lnp1; Ver_desc *vdp; @@ -121,23 +121,23 @@ vers_visit_children(Ver_desc *vp, int flag) * cyclic dependency. */ if (err == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_VER_CYCLIC)); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_VER_CYCLIC)); err = 1; } for (tmp_sp = 0; tmp_sp < ver_stk.ver_sp; tmp_sp++) { v = ver_stk.ver_stk[tmp_sp]; if ((v->vd_flags & FLG_VER_CYCLIC) == 0) { v->vd_flags |= FLG_VER_CYCLIC; - eprintf(ERR_NONE, - MSG_INTL(MSG_VER_ADDVER), - v->vd_name); + eprintf(ofl->ofl_lml, ERR_NONE, + MSG_INTL(MSG_VER_ADDVER), + v->vd_name); } } if ((vp->vd_flags & FLG_VER_CYCLIC) == 0) { vp->vd_flags |= FLG_VER_CYCLIC; - eprintf(ERR_NONE, - MSG_INTL(MSG_VER_ADDVER), - vp->vd_name); + eprintf(ofl->ofl_lml, ERR_NONE, + MSG_INTL(MSG_VER_ADDVER), vp->vd_name); } return (err); } @@ -159,7 +159,7 @@ vers_visit_children(Ver_desc *vp, int flag) * Now visit children. */ for (LIST_TRAVERSE(&vp->vd_deps, lnp1, vdp)) - if (vers_visit_children(vdp, 1) == S_ERROR) + if (vers_visit_children(ofl, vdp, 1) == S_ERROR) return (S_ERROR); /* @@ -171,20 +171,20 @@ vers_visit_children(Ver_desc *vp, int flag) } uintptr_t -vers_check_defs(Ofl_desc *ofl) +ld_vers_check_defs(Ofl_desc *ofl) { Listnode *lnp1, *lnp2; Ver_desc *vdp; uintptr_t is_cyclic = 0; - DBG_CALL(Dbg_ver_def_title(ofl->ofl_name)); + DBG_CALL(Dbg_ver_def_title(ofl->ofl_lml, ofl->ofl_name)); /* * First check if there are any cyclic dependency */ for (LIST_TRAVERSE(&ofl->ofl_verdesc, lnp1, vdp)) - if ((is_cyclic = vers_visit_children(vdp, 0)) == S_ERROR) + if ((is_cyclic = vers_visit_children(ofl, vdp, 0)) == S_ERROR) return (S_ERROR); if (is_cyclic) ofl->ofl_flags |= FLG_OF_FATAL; @@ -199,14 +199,14 @@ vers_check_defs(Ofl_desc *ofl) avl_index_t where; if (vdp->vd_ndx == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_VER_UNDEF), name, - vdp->vd_ref->vd_name, + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_VER_UNDEF), name, vdp->vd_ref->vd_name, vdp->vd_ref->vd_file->ifl_name); ofl->ofl_flags |= FLG_OF_FATAL; continue; } - DBG_CALL(Dbg_ver_desc_entry(vdp)); + DBG_CALL(Dbg_ver_desc_entry(ofl->ofl_lml, vdp)); /* * If a version definition contains no symbols this is possibly @@ -214,7 +214,8 @@ vers_check_defs(Ofl_desc *ofl) */ if ((vdp->vd_flags & (VER_FLG_BASE | VER_FLG_WEAK | FLG_VER_REFER)) == 0) - DBG_CALL(Dbg_ver_nointerface(vdp->vd_name)); + DBG_CALL(Dbg_ver_nointerface(ofl->ofl_lml, + vdp->vd_name)); /* * Update the version entry count to account for this new @@ -249,7 +250,7 @@ vers_check_defs(Ofl_desc *ofl) else bind = STB_GLOBAL; - if (sdp = sym_find(name, vdp->vd_hash, &where, ofl)) { + if (sdp = ld_sym_find(name, vdp->vd_hash, &where, ofl)) { /* * If the symbol already exists and is undefined or was * defined in a shared library, convert it to an @@ -275,8 +276,9 @@ vers_check_defs(Ofl_desc *ofl) } else if ((sdp->sd_flags & FLG_SY_SPECSEC) && (sdp->sd_shndx != SHN_ABS) && (sdp->sd_ref == REF_REL_NEED)) { - eprintf(ERR_WARNING, MSG_INTL(MSG_VER_DEFINED), - name, sdp->sd_file->ifl_name); + eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_VER_DEFINED), name, + sdp->sd_file->ifl_name); } } else { /* @@ -286,8 +288,8 @@ vers_check_defs(Ofl_desc *ofl) return (S_ERROR); sym->st_shndx = SHN_ABS; sym->st_info = ELF_ST_INFO(bind, STT_OBJECT); - DBG_CALL(Dbg_ver_symbol(name)); - if ((sdp = sym_enter(name, sym, vdp->vd_hash, + DBG_CALL(Dbg_ver_symbol(ofl->ofl_lml, name)); + if ((sdp = ld_sym_enter(name, sym, vdp->vd_hash, vdp->vd_file, ofl, 0, SHN_ABS, FLG_SY_SPECSEC, FLG_SY1_GLOB, &where)) == (Sym_desc *)S_ERROR) return (S_ERROR); @@ -301,7 +303,7 @@ vers_check_defs(Ofl_desc *ofl) /* * Dereference dependencies as a part of normalizing (allows recursion). */ -void +static void vers_derefer(Ifl_desc *ifl, Ver_desc *vdp, int weak) { Listnode *lnp; @@ -326,7 +328,7 @@ vers_derefer(Ifl_desc *ifl, Ver_desc *vdp, int weak) * required. */ uintptr_t -vers_check_need(Ofl_desc *ofl) +ld_vers_check_need(Ofl_desc *ofl) { Listnode *lnp1; Ifl_desc *ifl; @@ -455,22 +457,22 @@ vers_check_need(Ofl_desc *ofl) /* * Indicate dependency selection (allows recursion). */ -void -vers_select(Ifl_desc *ifl, Ver_desc *vdp, const char *ref) +static void +vers_select(Ofl_desc *ofl, Ifl_desc *ifl, Ver_desc *vdp, const char *ref) { Listnode *lnp; Ver_desc *_vdp; Ver_index *vip = &ifl->ifl_verndx[vdp->vd_ndx]; vip->vi_flags |= FLG_VER_AVAIL; - DBG_CALL(Dbg_ver_avail_entry(vip, ref)); + DBG_CALL(Dbg_ver_avail_entry(ofl->ofl_lml, vip, ref)); for (LIST_TRAVERSE(&vdp->vd_deps, lnp, _vdp)) - vers_select(ifl, _vdp, ref); + vers_select(ofl, ifl, _vdp, ref); } -Ver_index * -vers_index(Ifl_desc *ifl, int avail) +static Ver_index * +vers_index(Ofl_desc *ofl, Ifl_desc *ifl, int avail) { Listnode *lnp; Ver_desc *vdp; @@ -535,12 +537,12 @@ vers_index(Ifl_desc *ifl, int avail) if (!(sdv->sdv_flags & FLG_SDV_MATCHED)) { if (fail == 0) { fail++; - eprintf(ERR_NONE, + eprintf(ofl->ofl_lml, ERR_NONE, MSG_INTL(MSG_VER_ADDVERS), sdf->sdf_rfile, sdf->sdf_name); } - eprintf(ERR_NONE, MSG_INTL(MSG_VER_ADDVER), - sdv->sdv_name); + eprintf(ofl->ofl_lml, ERR_NONE, + MSG_INTL(MSG_VER_ADDVER), sdv->sdv_name); } } if (fail) @@ -554,23 +556,23 @@ vers_index(Ifl_desc *ifl, int avail) * Process a version symbol index section. */ int -vers_sym_process(Is_desc *isp, Ifl_desc *ifl) +ld_vers_sym_process(Lm_list *lml, Is_desc *isp, Ifl_desc *ifl) { Shdr *symshdr; Shdr *vershdr = isp->is_shdr; + /* - * Verify that the versym is the same size as the - * linked symbol table. If these two get out of sync - * the file is considered corrupted. + * Verify that the versym is the same size as the linked symbol table. + * If these two get out of sync the file is considered corrupted. */ symshdr = ifl->ifl_isdesc[vershdr->sh_link]->is_shdr; if ((symshdr->sh_size / symshdr->sh_entsize) != (vershdr->sh_size / vershdr->sh_entsize)) { - eprintf(ERR_WARNING, MSG_INTL(MSG_ELF_VERSYM), ifl->ifl_name, - isp->is_name, - EC_WORD(vershdr->sh_size / vershdr->sh_entsize), - ifl->ifl_isdesc[vershdr->sh_link]->is_name, - EC_WORD(symshdr->sh_size / symshdr->sh_entsize)); + eprintf(lml, ERR_WARNING, MSG_INTL(MSG_ELF_VERSYM), + ifl->ifl_name, isp->is_name, + EC_WORD(vershdr->sh_size / vershdr->sh_entsize), + ifl->ifl_isdesc[vershdr->sh_link]->is_name, + EC_WORD(symshdr->sh_size / symshdr->sh_entsize)); return (1); } ifl->ifl_versym = (Versym *)isp->is_indata->d_buf; @@ -585,7 +587,7 @@ vers_sym_process(Is_desc *isp, Ifl_desc *ifl) * descriptors will be promoted (concatenated) to the output files image. */ uintptr_t -vers_def_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) +ld_vers_def_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) { const char *str, *file = ifl->ifl_name; Sdf_desc *sdf = ifl->ifl_sdfdesc; @@ -602,8 +604,9 @@ vers_def_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) Listnode *lnp; for (LIST_TRAVERSE(&sdf->sdf_vers, lnp, sdv)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_VER_NOEXIST), - ifl->ifl_name, sdv->sdv_name, sdv->sdv_ref); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_VER_NOEXIST), ifl->ifl_name, + sdv->sdv_name, sdv->sdv_ref); ofl->ofl_flags |= FLG_OF_FATAL; } return (0); @@ -617,8 +620,9 @@ vers_def_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) * data section will be of the same revision. */ if (vdf->vd_version > VER_DEF_CURRENT) - (void) eprintf(ERR_WARNING, MSG_INTL(MSG_VER_HIGHER), - ifl->ifl_name, vdf->vd_version, VER_DEF_CURRENT); + (void) eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_VER_HIGHER), ifl->ifl_name, vdf->vd_version, + VER_DEF_CURRENT); num = isp->is_shdr->sh_info; @@ -629,7 +633,7 @@ vers_def_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) else relobj = 0; - DBG_CALL(Dbg_ver_def_title(file)); + DBG_CALL(Dbg_ver_def_title(ofl->ofl_lml, file)); /* * Loop through the version information setting up a version descriptor @@ -655,8 +659,8 @@ vers_def_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) name = (char *)(str + vdap->vda_name); /* LINTED */ hash = (Word)elf_hash(name); - if ((ivdp = vers_find(name, hash, &ifl->ifl_verdesc)) == 0) { - if ((ivdp = vers_desc(name, hash, + if ((ivdp = ld_vers_find(name, hash, &ifl->ifl_verdesc)) == 0) { + if ((ivdp = ld_vers_desc(name, hash, &ifl->ifl_verdesc)) == (Ver_desc *)S_ERROR) return (S_ERROR); } @@ -687,14 +691,14 @@ vers_def_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) * descriptor count. */ if (ofl->ofl_vercnt == 0) { - if (vers_base(ofl) == + if (ld_vers_base(ofl) == (Ver_desc *)S_ERROR) return (S_ERROR); } ofl->ofl_flags |= FLG_OF_VERDEF; - if ((ovdp = vers_find(name, hash, + if ((ovdp = ld_vers_find(name, hash, &ofl->ofl_verdesc)) == 0) { - if ((ovdp = vers_desc(name, hash, + if ((ovdp = ld_vers_desc(name, hash, &ofl->ofl_verdesc)) == (Ver_desc *)S_ERROR) return (S_ERROR); @@ -727,9 +731,9 @@ vers_def_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) /* LINTED */ hash = (Word)elf_hash(name); - if ((_ivdp = vers_find(name, hash, + if ((_ivdp = ld_vers_find(name, hash, &ifl->ifl_verdesc)) == 0) { - if ((_ivdp = vers_desc(name, hash, + if ((_ivdp = ld_vers_desc(name, hash, &ifl->ifl_verdesc)) == (Ver_desc *)S_ERROR) return (S_ERROR); @@ -737,14 +741,15 @@ vers_def_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) if (list_appendc(&ivdp->vd_deps, _ivdp) == 0) return (S_ERROR); } - DBG_CALL(Dbg_ver_desc_entry(ivdp)); + DBG_CALL(Dbg_ver_desc_entry(ofl->ofl_lml, ivdp)); } /* * Now that we know the total number of version definitions for this * file, build an index array for fast access when processing symbols. */ - if ((ifl->ifl_verndx = vers_index(ifl, relobj)) == (Ver_index *)S_ERROR) + if ((ifl->ifl_verndx = + vers_index(ofl, ifl, relobj)) == (Ver_index *)S_ERROR) return (S_ERROR); if (relobj) @@ -756,7 +761,7 @@ vers_def_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) * symbol bindings can occur. Otherwise simply mark all versions as * available. */ - DBG_CALL(Dbg_ver_avail_title(file)); + DBG_CALL(Dbg_ver_avail_title(ofl->ofl_lml, file)); if (sdf && (sdf->sdf_flags & FLG_SDF_SELECT)) { Listnode *lnp1; @@ -773,10 +778,11 @@ vers_def_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) } } if (found) - vers_select(ifl, vdp, sdv->sdv_ref); + vers_select(ofl, ifl, vdp, sdv->sdv_ref); else { - eprintf(ERR_FATAL, MSG_INTL(MSG_VER_NOEXIST), - ifl->ifl_name, sdv->sdv_name, sdv->sdv_ref); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_VER_NOEXIST), ifl->ifl_name, + sdv->sdv_name, sdv->sdv_ref); ofl->ofl_flags |= FLG_OF_FATAL; } } @@ -787,7 +793,7 @@ vers_def_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) for (cnt = VER_NDX_GLOBAL; cnt <= ifl->ifl_vercnt; cnt++) { vip = &ifl->ifl_verndx[cnt]; vip->vi_flags |= FLG_VER_AVAIL; - DBG_CALL(Dbg_ver_avail_entry(vip, 0)); + DBG_CALL(Dbg_ver_avail_entry(ofl->ofl_lml, vip, 0)); } } @@ -806,7 +812,7 @@ vers_def_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) * Process a version needed section. */ uintptr_t -vers_need_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) +ld_vers_need_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) { const char *str, *file = ifl->ifl_name; Word num, _num; @@ -819,15 +825,16 @@ vers_need_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) * structure as it is assumed all other version structures in this * data section will be of the same revision. */ - if (vnd->vn_version > VER_DEF_CURRENT) - (void) eprintf(ERR_WARNING, MSG_INTL(MSG_VER_HIGHER), - ifl->ifl_name, vnd->vn_version, VER_DEF_CURRENT); - + if (vnd->vn_version > VER_DEF_CURRENT) { + (void) eprintf(ofl->ofl_lml, ERR_WARNING, + MSG_INTL(MSG_VER_HIGHER), ifl->ifl_name, vnd->vn_version, + VER_DEF_CURRENT); + } num = isp->is_shdr->sh_info; str = (char *)ifl->ifl_isdesc[isp->is_shdr->sh_link]->is_indata->d_buf; - DBG_CALL(Dbg_ver_need_title(file)); + DBG_CALL(Dbg_ver_need_title(ofl->ofl_lml, file)); /* * Loop through the version information setting up a version descriptor @@ -867,7 +874,8 @@ vers_need_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) sdv->sdv_ref = file; if (list_appendc(&sdf->sdf_vers, sdv) == 0) return (S_ERROR); - DBG_CALL(Dbg_ver_need_entry(_cnt, name, sdv->sdv_name)); + DBG_CALL(Dbg_ver_need_entry(ofl->ofl_lml, _cnt, name, + sdv->sdv_name)); } } @@ -880,7 +888,7 @@ vers_need_process(Is_desc *isp, Ifl_desc *ifl, Ofl_desc *ofl) * represented in the output file. */ void -vers_promote(Sym_desc *sdp, Word ndx, Ifl_desc *ifl, Ofl_desc *ofl) +ld_vers_promote(Sym_desc *sdp, Word ndx, Ifl_desc *ifl, Ofl_desc *ofl) { Half vndx; @@ -915,8 +923,8 @@ vers_promote(Sym_desc *sdp, Word ndx, Ifl_desc *ifl, Ofl_desc *ofl) * version definition. */ if ((ifl->ifl_verndx == 0) || (vndx > ifl->ifl_vercnt)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_VER_INVALNDX), sdp->sd_name, - ifl->ifl_name, vndx); + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_VER_INVALNDX), + sdp->sd_name, ifl->ifl_name, vndx); ofl->ofl_flags |= FLG_OF_FATAL; return; } @@ -942,7 +950,7 @@ vers_promote(Sym_desc *sdp, Word ndx, Ifl_desc *ifl, Ofl_desc *ofl) * assigned to represent the file itself. Known as the base version. */ Ver_desc * -vers_base(Ofl_desc *ofl) +ld_vers_base(Ofl_desc *ofl) { Ver_desc *vdp; const char *name; @@ -967,8 +975,8 @@ vers_base(Ofl_desc *ofl) * Generate the version descriptor. */ /* LINTED */ - if ((vdp = vers_desc(name, (Word)elf_hash(name), &ofl->ofl_verdesc)) == - (Ver_desc *)S_ERROR) + if ((vdp = ld_vers_desc(name, (Word)elf_hash(name), + &ofl->ofl_verdesc)) == (Ver_desc *)S_ERROR) return ((Ver_desc *)S_ERROR); /* @@ -990,7 +998,7 @@ vers_base(Ofl_desc *ofl) * themselves (ie,. NEEDED dependencies). */ int -vers_verify(Ofl_desc *ofl) +ld_vers_verify(Ofl_desc *ofl) { Listnode *lnp1; Sdf_desc *sdf; @@ -1050,15 +1058,16 @@ vers_verify(Ofl_desc *ofl) vip = &ifl->ifl_verndx[vdp->vd_ndx]; if (!(vip->vi_flags & FLG_VER_AVAIL)) { - eprintf(ERR_FATAL, + eprintf(ofl->ofl_lml, ERR_FATAL, MSG_INTL(MSG_VER_UNAVAIL), ifl->ifl_name, sdv->sdv_name, sdv->sdv_ref); ofl->ofl_flags |= FLG_OF_FATAL; } } else { - eprintf(ERR_FATAL, MSG_INTL(MSG_VER_NOEXIST), - ifl->ifl_name, sdv->sdv_name, sdv->sdv_ref); + eprintf(ofl->ofl_lml, ERR_FATAL, + MSG_INTL(MSG_VER_NOEXIST), ifl->ifl_name, + sdv->sdv_name, sdv->sdv_ref); ofl->ofl_flags |= FLG_OF_FATAL; } } diff --git a/usr/src/cmd/sgs/libld/i386/Makefile b/usr/src/cmd/sgs/libld/i386/Makefile index a200cc4ec9..cf4a8605a2 100644 --- a/usr/src/cmd/sgs/libld/i386/Makefile +++ b/usr/src/cmd/sgs/libld/i386/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,104 +18,69 @@ # # CDDL HEADER END # + # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -BASEPLAT= i386 - -include $(SRC)/cmd/sgs/libld/Makefile.com -COPTFLAG= - -LIB64= libld.so.3 -$(LIB64) := SONAME = $(LIB64) - -L_MACHSRCS32= machrel.c machsym.c -L_MACHSRCS64= ../amd64/machrel.c machsym.c ../amd64/amd64unwind.c \ - ../../tools/common/leb128.c - -CHKSRCS = machrel.c ../amd64/machrel.c ../amd64/amd64unwind.c \ - ../../tools/common/leb128.c - -PICS64= $(OBJECTS:%=pics64/%) pics64/amd64unwind.o pics64/leb128.o -$(PICS64) := i386_CFLAGS += $(C_PICFLAGS) -CTFMERGE_LIB64= $(CTFMERGE) -t -f -L VERSION -o $@ $(PICS64) -$(PICS64) := CFLAGS += $(CTF_FLAGS) -$(PICS64) := CFLAGS64 += $(CTF_FLAGS) -$(PICS64) := CTFCONVERT_POST = $(CTFCONVERT_O) -$(LIB64) := CTFMERGE_POST = $(CTFMERGE_LIB64) -$(PICS64) := CPPFLAGS += -I../../../../uts/intel/amd64/krtld -$(PICS64) := CPPFLAGS += -DELF_TARGET_AMD64 +E_TOOLOBJS = leb128.o +L_MACHOBJS32 = machrel.intel32.o machsym.intel32.o +L_MACHOBJS64 = machrel.amd64.o machsym.intel64.o unwind.amd64.o -SGSMSGTARG += $(SGSMSGINTEL) - -.PARALLEL: $(PICS64) - -ROOTFS_DYNLIB64= $(ROOTFS_LIBDIR)/$(LIB64) -$(ROOTFS_DYNLIB64) := FILEMODE= 755 - -$(PICS) := CPPFLAGS += -I../../../../uts/$(PLAT)/krtld -$(LINTOUT32) := CPPFLAGS += -I../../../../uts/$(PLAT)/krtld -$(LINTOUT64) := CPPFLAGS += -I../../../../uts/$(PLAT)/krtld \ - -DELF_TARGET_AMD64 +include ../Makefile.com .KEEP_STATE: -all: $(DYNLIB) $(LIBLINKS) $(LIB64) - -$(LIB64) $(SGSPROTO)/$(LIB64): \ - pics64 .WAIT $$(PICS64) $(MAPFILES) - $(CC) -o $@ $(GSHARED) $(DYNFLAGS) $(PICS64) $(LDLIBS) - $(POST_PROCESS_SO) - -native: $(SGSPROTO)/$(DYNLIB) $(SGSPROTO)/$(LIB64) - -native-proto: - -@mkdir -p proto/$(MACH) proto/$(MACH64) +SGSMSGCHK = ../common/libld.chk.msg +SGSMSGTARG += $(SGSMSGINTEL) +# +# For cross-compilation, it is necessary to trigger the correct include files +# (see sys/elf.h). +# +ELFTARGET64 = -DELF_TARGET_AMD64 +ELFTARGET32 = -DELF_TARGET_386 -lint: $(LINTLIB64) $(LINTOUT64) -.PARALLEL: $(LINTOUT32) $(LINTOUT64) +all: $(DYNLIB) $(LIBLINKS) -pics64: - -@mkdir -p $@ +install \ +package: all $(ROOTFS_DYNLIB) -clean: clean64 +include ../Makefile.targ -clean64: - -$(RM) $(PICS64) +# Associate ELF32 and ELF64 objects to the appropriate headers. -clobber: clobber64 +pics/%32.o := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld +pics/%64.o := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld -clobber64: - -$(RM) $(LIB64) +# Associate the various lint targets with the appropriate headers/files. -delete: - $(RM) $(DYNLIB) $(LIB64) +$(LINTOUT32) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld \ + $(ELFTARGET32) +$(LINTOUT64) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld \ + $(ELFTARGET64) -D_ELF64 +$(LINTLIB32) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld \ + $(ELFTARGET32) +$(LINTLIB64) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld \ + $(ELFTARGET64) -D_ELF64 -install \ -package: all $(ROOTFS_DYNLIB) $(ROOTFS_DYNLIB64) +LINTSRCS32 += $(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld/%.c) +LINTSRCS64 += $(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld/%.c) -# -# Grab 64bit amd64 files for libld.so.3 -# -pics64/amd64unwind.o: ../amd64/amd64unwind.c - $(COMPILE.c) -o $@ -D_ELF64 ../amd64/amd64unwind.c - $(POST_PROCESS_O) - -pics64/machrel.o: ../amd64/machrel.c - $(COMPILE.c) -o $@ -D_ELF64 ../amd64/machrel.c - $(POST_PROCESS_O) +# Compensate chkmsg with the doreloc family. -include $(SRC)/cmd/sgs/libld/Makefile.targ +CHKSRCS += $(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld/%.c) +CHKSRCS += $(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld/%.c) -pics64/%.o: $(SRCBASE)/uts/intel/amd64/krtld/%.c - $(COMPILE.c) -o $@ -D_ELF64 $< +pics/%32.o: \ + $(SRCBASE)/uts/$(VAR_PLAT_i386)/krtld/%.c + $(COMPILE.c) -o $@ $(ELFTARGET32) $< $(POST_PROCESS_O) -pics/%.o: $(SRCBASE)/uts/$(PLAT)/krtld/%.c - $(COMPILE.c) -o $@ $< +pics/%64.o: \ + $(SRCBASE)/uts/$(VAR_PLAT_amd64)/krtld/%.c + $(COMPILE.c) -o $@ $(ELFTARGET64) -D_ELF64 $< $(POST_PROCESS_O) diff --git a/usr/src/cmd/sgs/libld/sparc/Makefile b/usr/src/cmd/sgs/libld/sparc/Makefile index a5134a1ba2..de7cd9e37e 100644 --- a/usr/src/cmd/sgs/libld/sparc/Makefile +++ b/usr/src/cmd/sgs/libld/sparc/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,84 +18,60 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -BASEPLAT= sparc -include $(SRC)/cmd/sgs/libld/Makefile.com - -L_MACHSRCS32= machrel.c machsym.c -L_MACHSRCS64= $(L_MACHSRCS32) -CHKSRCS= $(SRCBASE)/uts/common/krtld/reloc.h $(L_MACHSRCS32) - -LIB64= libld.so.3 -$(LIB64) := SONAME = $(LIB64) - -PICS64= $(OBJECTS:%=pics64/%) -$(PICS64) := sparc_CFLAGS += -xregs=no%appl -K pic -$(PICS64) := CFLAGS += $(CTF_FLAGS) -$(PICS64) := CFLAGS64 += $(CTF_FLAGS) -$(PICS64) := CTFCONVERT_POST = $(CTFCONVERT_O) -CTFMERGE_LIB64= $(CTFMERGE) -t -f -L VERSION -o $@ $(PICS64) -$(LIB64) := CTFMERGE_POST = $(CTFMERGE_LIB64) -CPPFLAGS += -I../../../../uts/sparc/krtld - -SGSMSGTARG += $(SGSMSGSPARC) - -.PARALLEL: $(PICS64) +L_MACHOBJS32 = machrel.sparc32.o machsym.sparc32.o +L_MACHOBJS64 = machrel.sparc64.o machsym.sparc64.o -ROOTFS_DYNLIB64= $(ROOTFS_LIBDIR)/$(LIB64) -$(ROOTFS_DYNLIB64) := FILEMODE= 755 +include ../Makefile.com .KEEP_STATE: -all: $(DYNLIB) $(LIBLINKS) .WAIT $(LIB64) - - -$(LIB64) $(SGSPROTO)/$(LIB64): \ - pics64 .WAIT $$(PICS64) $(MAPFILES) - $(CC) -o $@ -G $(DYNFLAGS) $(PICS64) $(LDLIBS) - $(POST_PROCESS_SO) - -native: $(SGSPROTO)/$(DYNLIB) $(SGSPROTO)/$(LIB64) - -native-proto: - -@mkdir -p proto/$(MACH) proto/$(MACH64) - -lint: $(LINTLIB64) $(LINTOUT64) -.PARALLEL: $(LINTOUT32) $(LINTOUT64) +SGSMSGTARG += $(SGSMSGSPARC) -pics64: - -@mkdir -p $@ +all: $(DYNLIB) $(LIBLINKS) install \ -package: all $(ROOTFS_DYNLIB) $(ROOTFS_DYNLIB64) +package: all $(ROOTFS_DYNLIB) +include ../Makefile.targ -clean: clean64 +# Associate ELF32 and ELF64 objects to the appropriate headers. -clean64: - -$(RM) $(PICS64) +pics/%32.o := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld +pics/%64.o := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld -clobber: clobber64 +# Associate the various lint targets with the appropriate headers/files. -clobber64: - -$(RM) $(LIB64) +$(LINTOUT32) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \ + $(ELFTARGET32) +$(LINTOUT64) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \ + $(ELFTARGET64) -D_ELF64 +$(LINTLIB32) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \ + $(ELFTARGET32) +$(LINTLIB64) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \ + $(ELFTARGET64) -D_ELF64 -delete: - $(RM) $(DYNLIB) $(LIB64) +LINTSRCS32 += $(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c) +LINTSRCS64 += $(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c) +# Compensate chkmsg with the doreloc family. -include $(SRC)/cmd/sgs/libld/Makefile.targ +CHKSRCS += $(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c) +CHKSRCS += $(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c) -pics64/%.o: $(SRCBASE)/uts/sparc/krtld/%.c - $(COMPILE.c) -o $@ -D_ELF64 $< +pics/%32.o: \ + $(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c + $(COMPILE.c) -o $@ $(ELFTARGET32) $< $(POST_PROCESS_O) -pics/%.o: $(SRCBASE)/uts/sparc/krtld/%.c - $(COMPILE.c) -o $@ $< +pics/%64.o: \ + $(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c + $(COMPILE.c) -o $@ $(ELFTARGET64) -D_ELF64 $< $(POST_PROCESS_O) diff --git a/usr/src/cmd/sgs/libld/sparcv9/Makefile b/usr/src/cmd/sgs/libld/sparcv9/Makefile index 54a745a4d0..d7d2658d65 100644 --- a/usr/src/cmd/sgs/libld/sparcv9/Makefile +++ b/usr/src/cmd/sgs/libld/sparcv9/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,119 +18,72 @@ # # CDDL HEADER END # + # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -BASEPLAT= sparc -include $(SRC)/cmd/sgs/libld/Makefile.com - -# -# Share machrel.c with the 32-bit sparc directory since -# they both need the Elf32 and the Elf64 code. -# -L_MACHSRCS32= ../$(MACH)/machrel.c ../$(MACH)/machsym.c -L_MACHSRCS64= $(L_MACHSRCS32) -CHKSRCS= $(SRCBASE)/uts/common/krtld/reloc.h $(L_MACHSRCS32) +L_MACHOBJS32 = machrel.sparc32.o machsym.sparc32.o +L_MACHOBJS64 = machrel.sparc64.o machsym.sparc64.o -LIB64= libld.so.3 -$(LIB64) := SONAME = $(LIB64) +include ../Makefile.com -DBGLIB = -L ../../liblddbg/$(MACH64) -ELFLIB = -L ../../libelf/$(MACH64) - -CONVLIBDIR= $(CONVLIBDIR64) -LDDBGLIBDIR= $(LDDBGLIBDIR64) -ELFLIBDIR= $(ELFLIBDIR64) +.KEEP_STATE: -LINTFLAGS64 += $(VAR_LINTFLAGS64) +ROOTFS_LIBDIR64 = \ + $(VAR_LIBLD_64_ROOTFS_LIBDIR) +ROOTFS_DYNLIB64 = \ + $(DYNLIB:%=$(ROOTFS_LIBDIR64)/%) SGSMSGTARG += $(SGSMSGSPARC) -.PARALLEL: $(LINTOUT32) $(LINTOUT64) - -PICS64= $(OBJECTS:%=pics64/%) -$(PICS64) := sparcv9_CFLAGS += -xregs=no%appl -K pic -CPPFLAGS += -I../../../../uts/sparc/krtld -CTFMERGE_LIB64= $(CTFMERGE) -t -f -L VERSION -o $@ $(PICS64) -$(PICS64) := CFLAGS += $(CTF_FLAGS) -$(PICS64) := CFLAGS64 += $(CTF_FLAGS) -$(PICS64) := CTFCONVERT_POST = $(CTFCONVERT_O) -$(LIB64) := CTFMERGE_POST = $(CTFMERGE_LIB64) +ELFLIBDIR = $(ELFLIBDIR64) +LDDBGLIBDIR = $(LDDBGLIBDIR64) +CONVLIBDIR = $(CONVLIBDIR64) -.PARALLEL: $(PICS64) - -ROOTFS_LIBDIR= $(VAR_LIBLD_64_ROOTFS_LIBDIR) -ROOTFS_DYNLIB64= $(ROOTFS_LIBDIR)/$(LIB64) $(ROOTFS_DYNLIB64) := FILEMODE= 755 -.KEEP_STATE: - -all: $(DYNLIB) $(LIBLINKS) .WAIT $(LIB64) - -$(LIB64) $(SGSPROTO)/$(LIB64): \ - pics64 .WAIT $$(PICS64) $(MAPFILES) - $(CC) $(sparcv9_XARCH) -o $@ -G $(DYNFLAGS) $(PICS64) $(LDLIBS) - $(POST_PROCESS_SO) +all: $(DYNLIB) $(LIBLINKS) -lint: $(LINTLIB64) $(LINTOUT64) +install \ +package: all $(ROOTFS_DYNLIB64) -# -# Share machrel.c with the base architecture, since they -# both need all the Elf32 and Elf64 code. -# -pics/machrel.o: ../sparc/machrel.c - $(COMPILE.c) -o $@ ../sparc/machrel.c - $(POST_PROCESS_O) - -pics64/machrel.o: ../sparc/machrel.c - $(COMPILE.c) -D_ELF64 -o $@ ../sparc/machrel.c - $(POST_PROCESS_O) - -pics/machsym.o: ../sparc/machsym.c - $(COMPILE.c) -o $@ ../sparc/machsym.c - $(POST_PROCESS_O) - -pics64/machsym.o: ../sparc/machsym.c - $(COMPILE.c) -D_ELF64 -o $@ ../sparc/machsym.c - $(POST_PROCESS_O) - -native: $(SGSPROTO)/$(DYNLIB) $(SGSPROTO)/$(LIB64) - -native-proto: - -@mkdir -p proto/$(MACH) proto/$(MACH64) - -pics64: - -@mkdir -p $@ - - -install package: all $(ROOTFS_DYNLIB) $(ROOTFS_DYNLIB64) +include ../Makefile.targ +include ../../Makefile.sub.64 +# Associate ELF32 and ELF64 objects to the appropriate headers. -clean: clean64 +pics/%32.o := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld +pics/%64.o := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld -clean64: - -$(RM) $(PICS64) +# Associate the various lint targets with the appropriate headers/files. -clobber: clobber64 -clobber64: - -$(RM) $(LIB64) +$(LINTOUT32) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \ + $(ELFTARGET32) +$(LINTOUT64) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \ + $(ELFTARGET64) -D_ELF64 +$(LINTLIB32) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \ + $(ELFTARGET32) +$(LINTLIB64) := CPPFLAGS += -I$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld \ + $(ELFTARGET64) -D_ELF64 -delete: - $(RM) $(DYNLIB) $(LIB64) +LINTSRCS32 += $(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c) +LINTSRCS64 += $(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c) -include $(SRC)/cmd/sgs/libld/Makefile.targ -include ../../Makefile.sub.64 +# Compensate chkmsg with the doreloc family. -$(LIBLINKS) := DYNLIB=$(LIB64) +CHKSRCS += $(G_MACHOBJS32:%32.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c) +CHKSRCS += $(G_MACHOBJS64:%64.o=$(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c) -pics64/%.o: $(SRCBASE)/uts/sparc/krtld/%.c - $(COMPILE.c) -o $@ -D_ELF64 $< +pics/%32.o: \ + $(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c + $(COMPILE.c) -o $@ $(ELFTARGET32) $< $(POST_PROCESS_O) -pics/%.o: $(SRCBASE)/uts/sparc/krtld/%.c - $(COMPILE.c) -o $@ $< +pics/%64.o: \ + $(SRCBASE)/uts/$(VAR_PLAT_sparc)/krtld/%.c + $(COMPILE.c) -o $@ $(ELFTARGET64) -D_ELF64 $< $(POST_PROCESS_O) diff --git a/usr/src/cmd/sgs/liblddbg/Makefile b/usr/src/cmd/sgs/liblddbg/Makefile index 3fb5c9663e..2f70df00c7 100644 --- a/usr/src/cmd/sgs/liblddbg/Makefile +++ b/usr/src/cmd/sgs/liblddbg/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,10 +18,12 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" # -# Copyright (c) 1996 by Sun Microsystems, Inc. -# All rights reserved. include $(SRC)/cmd/sgs/Makefile.sub diff --git a/usr/src/cmd/sgs/liblddbg/Makefile.com b/usr/src/cmd/sgs/liblddbg/Makefile.com index bbad06d3f3..6b6a0d43b9 100644 --- a/usr/src/cmd/sgs/liblddbg/Makefile.com +++ b/usr/src/cmd/sgs/liblddbg/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,74 +18,87 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -LIBRARY= liblddbg.a -VERS= .4 +LIBRARY = liblddbg.a +VERS = .4 + +COMOBJS = args.o audit.o debug.o syminfo.o \ + tls.o + +COMOBJS32 = bindings32.o cap32.o dynamic32.o elf32.o \ + entry32.o files32.o got32.o libs32.o \ + map32.o move32.o phdr32.o relocate32.o \ + sections32.o segments32.o shdr32.o statistics32.o \ + support32.o syms32.o unused32.o util32.o \ + version32.o + +COMOBJS64 = bindings64.o cap64.o dynamic64.o elf64.o \ + entry64.o files64.o got64.o libs64.o \ + map64.o move64.o phdr64.o relocate64.o \ + sections64.o segments64.o shdr64.o statistics64.o \ + support64.o syms64.o unused64.o util64.o \ + version64.o + +BLTOBJ = msg.o -COMOBJS= args.o bindings.o cap.o debug.o \ - dynamic.o entry.o elf.o files.o \ - libs.o map.o phdr.o \ - relocate.o sections.o segments.o shdr.o \ - support.o syms.o audit.o util.o \ - version.o got.o move.o statistics.o \ - tls.o unused.o -COMOBJS64= files64.o map64.o relocate64.o sections64.o \ - segments64.o syms64.o audit64.o got64.o \ - move64.o version64.o statistics64.o tls64.o \ - unused64.o cap64.o -BLTOBJ= msg.o +TOOLOBJ = alist.o + +OBJECTS = $(BLTOBJ) $(COMOBJS) $(COMOBJS32) $(COMOBJS64) $(TOOLOBJ) -OBJECTS= $(BLTOBJ) $(COMOBJS) $(COMOBJS64) include $(SRC)/lib/Makefile.lib include $(SRC)/cmd/sgs/Makefile.com -MAPFILES= ../common/mapfile-vers -MAPOPTS= $(MAPFILES:%=-M%) +MAPFILES += ../common/mapfile-vers +MAPOPTS = $(MAPFILES:%=-M%) +LINTFLAGS += -u -D_REENTRANT +LINTFLAGS64 += -u -D_REENTRANT CPPFLAGS += -I$(SRCBASE)/lib/libc/inc $(VAR_LIBLDDBG_CPPFLAGS) -DYNFLAGS += $(VERSREF) $(CONVLIBDIR) $(ZLAZYLOAD) -LDLIBS += -lconv -lc -LINTFLAGS += -u $(CONVLIBDIR) -D_REENTRANT -LINTFLAGS64 += -u $(CONVLIBDIR64) -D_REENTRANT -erroff=E_CAST_INT_TO_SMALL_INT - +DYNFLAGS += $(VERSREF) $(MAPOPTS) $(ZLAZYLOAD) -R/usr/tmp '-R$$ORIGIN' +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) -lc # A bug in pmake causes redundancy when '+=' is conditionally assigned, so # '=' is used with extra variables. -# $(DYNLIB) := DYNFLAGS += -Yl,$(SGSPROTO) +# $(DYNLIB) := DYNFLAGS += $(USE_PROTO) # XXXFLAGS= -$(DYNLIB) := XXXFLAGS= $(USE_PROTO) $(MAPOPTS) +$(DYNLIB) := XXXFLAGS= $(USE_PROTO) DYNFLAGS += $(XXXFLAGS) native := MAPOPTS= native := DYNFLAGS += $(CONVLIBDIR) -BLTDEFS= msg.h -BLTDATA= msg.c -BLTMESG= $(SGSMSGDIR)/liblddbg - -BLTFILES= $(BLTDEFS) $(BLTDATA) $(BLTMESG) +BLTDEFS = msg.h +BLTDATA = msg.c +BLTMESG = $(SGSMSGDIR)/liblddbg -SGSMSGCOM= ../common/liblddbg.msg -SGSMSGTARG= $(SGSMSGCOM) -SGSMSGALL= $(SGSMSGCOM) +BLTFILES = $(BLTDEFS) $(BLTDATA) $(BLTMESG) +SGSMSGCOM = ../common/liblddbg.msg +SGSMSGALL = $(SGSMSGCOM) +SGSMSGTARG = $(SGSMSGCOM) SGSMSGFLAGS += -h $(BLTDEFS) -d $(BLTDATA) -m $(BLTMESG) -n liblddbg_msg -SRCS= ../common/llib-llddbg -LIBSRCS= $(COMOBJS:%.o=../common/%.c) $(BLTDATA) -LIBSRCS64= $(COMOBJS64:%64.o=%.c) -LINTSRCS= $(LIBSRCS) ../common/lintsup.c +CHKSRCS = $(COMOBJS32:%32.o=../common/%.c) + +SRCS = ../common/llib-llddbg +LIBSRCS = $(COMOBJS:%.o=../common/%.c) \ + $(TOOLOBJ:%.o=$(SGSTOOLS)/common/%.c) $(BLTDATA) + +LINTSRCS = $(LIBSRCS) ../common/lintsup.c +LINTSRCS32 = $(COMOBJS32:%32.o=../common/%.c) +LINTSRCS64 = $(COMOBJS64:%64.o=../common/%.c) -CLEANFILES += $(LINTOUTS) $(LINTLIBS) $(BLTFILES) -CLOBBERFILES += $(DYNLIB) $(LINTLIBS) $(LIBLINKS) +CLEANFILES += $(LINTOUTS) $(BLTFILES) +CLOBBERFILES += $(DYNLIB) $(LINTLIBS) $(LIBLINKS) -ROOTFS_DYNLIB= $(DYNLIB:%=$(ROOTFS_LIBDIR)/%) +ROOTFS_DYNLIB = $(DYNLIB:%=$(ROOTFS_LIBDIR)/%) diff --git a/usr/src/cmd/sgs/liblddbg/Makefile.targ b/usr/src/cmd/sgs/liblddbg/Makefile.targ index 2605da3b18..1802dc3cf4 100644 --- a/usr/src/cmd/sgs/liblddbg/Makefile.targ +++ b/usr/src/cmd/sgs/liblddbg/Makefile.targ @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,17 +18,26 @@ # # CDDL HEADER END # + # -# Copyright (c) 2001 by Sun Microsystems, Inc. -# All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" # pics/%.o: ../common/%.c $(COMPILE.c) -o $@ $< $(POST_PROCESS_O) +pics/%.o: $(SGSTOOLS)/common/%.c + $(COMPILE.c) -o $@ $< + $(POST_PROCESS_O) + +pics/%32.o: ../common/%.c + $(COMPILE.c) -o $@ $< + $(POST_PROCESS_O) + pics/%64.o: ../common/%.c $(COMPILE.c) -D_ELF64 -o $@ $< $(POST_PROCESS_O) @@ -42,6 +50,11 @@ $(LIBLINKS): delete: $(RM) $(DYNLIB) +.PARALLEL: $(LINTOUT32) $(LINTOUT64) $(LINTLIB32) $(LINTLIB64) + +lint: $(LINTLIB32) $(LINTOUT32) $(LINTLIB64) $(LINTOUT64) \ + .WAIT $(SGSLINTOUT) + # Special target for native builds (ie. when we need to build a version of ld # to build a version of ld :-). @@ -57,19 +70,14 @@ $(SGSPROTO)/$(DYNLIB): \ include $(SRC)/lib/Makefile.targ include $(SRC)/cmd/sgs/Makefile.targ -# Derived source and header files (messaging) +# Derived source and header files (messaging). catalog: $(BLTMESG) -chkmsg: $(LIBSRCS) - sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS) +chkmsg: $(LIBSRCS) $(CHKSRCS) + sh $(CHKMSG) $(CHKMSGFLAGS) $(LIBSRCS) $(CHKSRCS) $(BLTDEFS) + \ $(BLTDATA) + \ $(BLTMESG): $(SGSMSGALL) $(SGSMSG) $(SGSMSGFLAGS) $(SGSMSGALL) - -.PARALLEL: $(LINTOUT32) $(LINTOUT64) $(LINTLIB32) $(LINTLIB64) - -lint: $(LINTLIB32) $(LINTOUT32) $(LINTLIB64) $(LINTOUT64) \ - $(SGSLINTOUT) diff --git a/usr/src/cmd/sgs/liblddbg/amd64/Makefile b/usr/src/cmd/sgs/liblddbg/amd64/Makefile index a3b13ca9e4..16c74125d7 100644 --- a/usr/src/cmd/sgs/liblddbg/amd64/Makefile +++ b/usr/src/cmd/sgs/liblddbg/amd64/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,27 +18,33 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -include $(SRC)/cmd/sgs/liblddbg/Makefile.com +include ../Makefile.com + +ROOTFS_LIBDIR64 = \ + $(VAR_LIBLDDBG_V9_ROOTFS_LIBDIR) +ROOTFS_DYNLIB64 = \ + $(DYNLIB:%=$(ROOTFS_LIBDIR64)/%) -ROOTFS_LIBDIR= $(VAR_LIBLDDBG_V9_ROOTFS_LIBDIR) -ROOTFS_DYNLIB64= $(DYNLIB:%=$(ROOTFS_LIBDIR)/%) +CONVLIBDIR = $(CONVLIBDIR64) + +LINTFLAGS64 += $(VAR_LINTFLAGS64) .KEEP_STATE: +$(ROOTFS_DYNLIB64) := FILEMODE= 755 + all: $(DYNLIB) $(LIBLINKS) -install: all $(ROOTFS_DYNLIB64) +install \ +package: all $(ROOTFS_DYNLIB64) -include $(SRC)/cmd/sgs/liblddbg/Makefile.targ +include ../Makefile.targ include ../../Makefile.sub.64 - -CONVLIBDIR = $(CONVLIBDIR64) - -LINTFLAGS64 += $(VAR_LINTFLAGS64) diff --git a/usr/src/cmd/sgs/liblddbg/common/_debug.h b/usr/src/cmd/sgs/liblddbg/common/_debug.h index bec52738ec..9a1f172fae 100644 --- a/usr/src/cmd/sgs/liblddbg/common/_debug.h +++ b/usr/src/cmd/sgs/liblddbg/common/_debug.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -36,69 +36,173 @@ extern "C" { #endif -extern uint_t _Dbg_mask; - - /* * Debugging is enabled by various tokens (see debug.c) that result in an - * internal bit mask (_Dbg_mask) being initialized. Each debugging function is + * internal bit mask (d_class) being initialized. Each debugging function is * appropriate for one or more of the classes specified by the bit mask. Each * debugging function validates whether it is appropriate for the present * classes before printing anything. */ -#define DBG_NOTCLASS(c) !(_Dbg_mask & DBG_MSK_CLASS & (c)) -#define DBG_NOTDETAIL() !(_Dbg_mask & DBG_DETAIL) -#define DBG_NOTLONG() !(_Dbg_mask & DBG_LONG) - -#define DBG_GLOBAL 0xf0000000 /* see include/debug.h */ -#define DBG_LOCAL 0x0fffffff -#define DBG_MSK_CLASS 0x00ffffff - -#define DBG_DETAIL 0x01000000 -#define DBG_LONG 0x02000000 - -#define DBG_ARGS 0x00000001 -#define DBG_BASIC 0x00000002 -#define DBG_BINDINGS 0x00000004 -#define DBG_ENTRY 0x00000008 -#define DBG_FILES 0x00000010 -#define DBG_HELP 0x00000020 -#define DBG_LIBS 0x00000040 -#define DBG_MAP 0x00000080 -#define DBG_RELOC 0x00000100 -#define DBG_SECTIONS 0x00000200 -#define DBG_SEGMENTS 0x00000400 -#define DBG_SYMBOLS 0x00000800 -#define DBG_SUPPORT 0x00001000 -#define DBG_VERSIONS 0x00002000 -#define DBG_AUDITING 0x00004000 -#define DBG_GOT 0x00008000 -#define DBG_MOVE 0x00010000 -#define DBG_DEMANGLE 0x00020000 -#define DBG_TLS 0x00040000 -#define DBG_STRTAB 0x00080000 -#define DBG_STATISTICS 0x00100000 -#define DBG_UNUSED 0x00200000 -#define DBG_CAP 0x00400000 -#define DBG_INIT 0x00800000 - -typedef struct options { +#define DBG_NOTCLASS(c) !(dbg_desc->d_class & (c)) + +#define DBG_C_ARGS 0x00000001 +#define DBG_C_BASIC 0x00000002 +#define DBG_C_BINDINGS 0x00000004 +#define DBG_C_ENTRY 0x00000008 +#define DBG_C_FILES 0x00000010 +#define DBG_C_HELP 0x00000020 +#define DBG_C_LIBS 0x00000040 +#define DBG_C_MAP 0x00000080 +#define DBG_C_RELOC 0x00000100 +#define DBG_C_SECTIONS 0x00000200 +#define DBG_C_SEGMENTS 0x00000400 +#define DBG_C_SYMBOLS 0x00000800 +#define DBG_C_SUPPORT 0x00001000 +#define DBG_C_VERSIONS 0x00002000 +#define DBG_C_AUDITING 0x00004000 +#define DBG_C_GOT 0x00008000 +#define DBG_C_MOVE 0x00010000 +#define DBG_C_DEMANGLE 0x00020000 +#define DBG_C_TLS 0x00040000 +#define DBG_C_STRTAB 0x00080000 +#define DBG_C_STATS 0x00100000 +#define DBG_C_UNUSED 0x00200000 +#define DBG_C_CAP 0x00400000 +#define DBG_C_INIT 0x00800000 + +#define DBG_C_ALL 0xffffffff + +typedef struct { const char *o_name; /* command line argument name */ - uint_t o_mask; /* associated bit mask for this name */ -} DBG_options, *DBG_opts; + uint_t o_class; /* associated class for this name */ + uint_t o_extra; /* associated extra for this name */ +} DBG_options; +#define AL_CNT_DEBUG 4 /* - * Internal debugging routines. + * Some Dbg_*() format strings differ depending on whether they are used for + * 32-bit or 64-bit values. */ -#ifdef _ELF64 -#define _Dbg_seg_desc_entry _Dbg_seg_desc_entry64 +#if defined(_ELF64) + +#define MSG_EDATA_TITLE MSG_EDATA_TITLE_64 +#define MSG_EDATA_ENTRY MSG_EDATA_ENTRY_64 + +#else + +#define MSG_EDATA_TITLE MSG_EDATA_TITLE_32 +#define MSG_EDATA_ENTRY MSG_EDATA_ENTRY_32 + #endif -extern const char *_Dbg_sym_dem(const char *); -extern void _Dbg_elf_data_in(Os_desc *, Is_desc *); -extern void _Dbg_elf_data_out(Os_desc *); -extern void _Dbg_ent_entry(Half, Ent_desc * enp); -extern void _Dbg_seg_desc_entry(Half, int, Sg_desc *); + +/* + * Some Elf_*() format strings differ depending on whether they are used for + * 32-bit or 64-bit values. + */ +#if defined(_ELF64) + +#define MSG_GOT_TITLE MSG_GOT_TITLE_64 +#define MSG_GOT_ENTRY_RE MSG_GOT_ENTRY_RE_64 +#define MSG_GOT_ENTRY_NR MSG_GOT_ENTRY_NR_64 + +#define MSG_PHD_VADDR MSG_PHD_VADDR_64 +#define MSG_PHD_PADDR MSG_PHD_PADDR_64 +#define MSG_PHD_FILESZ MSG_PHD_FILESZ_64 +#define MSG_PHD_OFFSET MSG_PHD_OFFSET_64 + +#define MSG_REL_EFSA_TITLE MSG_REL_EFSA_TITLE_64 +#define MSG_REL_EFLA_TITLE MSG_REL_EFLA_TITLE_64 +#define MSG_REL_EFSN_TITLE MSG_REL_EFSN_TITLE_64 +#define MSG_REL_EFLN_TITLE MSG_REL_EFLN_TITLE_64 +#define MSG_REL_EFSA_ENTRY MSG_REL_EFSA_ENTRY_64 +#define MSG_REL_EFLA_ENTRY MSG_REL_EFLA_ENTRY_64 +#define MSG_REL_EFSN_ENTRY MSG_REL_EFSN_ENTRY_64 +#define MSG_REL_EFLN_ENTRY MSG_REL_EFLN_ENTRY_64 +#define MSG_REL_RT_APLREG MSG_REL_RT_APLREG_64 +#define MSG_REL_RT_APLVAL MSG_REL_RT_APLVAL_64 +#define MSG_REL_RTA_TITLE MSG_REL_RTA_TITLE_64 +#define MSG_REL_RTN_TITLE MSG_REL_RTN_TITLE_64 +#define MSG_REL_RTV_TITLE MSG_REL_RTV_TITLE_64 +#define MSG_REL_RTA_ENTRY MSG_REL_RTA_ENTRY_64 +#define MSG_REL_RTN_ENTRY MSG_REL_RTN_ENTRY_64 +#define MSG_REL_LDSA_TITLE MSG_REL_LDSA_TITLE_64 +#define MSG_REL_LDSN_TITLE MSG_REL_LDSN_TITLE_64 +#define MSG_REL_LDSV_TITLE MSG_REL_LDSV_TITLE_64 +#define MSG_REL_LDSA_ENTRY MSG_REL_LDSA_ENTRY_64 +#define MSG_REL_LDSN_ENTRY MSG_REL_LDSN_ENTRY_64 +#define MSG_REL_LDLA_TITLE MSG_REL_LDLA_TITLE_64 +#define MSG_REL_LDLN_TITLE MSG_REL_LDLN_TITLE_64 +#define MSG_REL_LDLV_TITLE MSG_REL_LDLV_TITLE_64 +#define MSG_REL_LDLA_ENTRY MSG_REL_LDLA_ENTRY_64 +#define MSG_REL_LDLN_ENTRY MSG_REL_LDLN_ENTRY_64 + +#define MSG_SHD_ADDR MSG_SHD_ADDR_64 +#define MSG_SHD_SIZE MSG_SHD_SIZE_64 +#define MSG_SHD_OFFSET MSG_SHD_OFFSET_64 +#define MSG_SHD_ALIGN MSG_SHD_ALIGN_64 +#define MSG_SHD_LINK MSG_SHD_LINK_64 + +#define MSG_SYM_EFS_ENTRY MSG_SYM_EFS_ENTRY_64 +#define MSG_SYM_EFL_ENTRY MSG_SYM_EFL_ENTRY_64 +#define MSG_SYM_EFS_TITLE MSG_SYM_EFS_TITLE_64 +#define MSG_SYM_EFL_TITLE MSG_SYM_EFL_TITLE_64 +#define MSG_SYM_LDS_TITLE MSG_SYM_LDS_TITLE_64 +#define MSG_SYM_LDL_TITLE MSG_SYM_LDL_TITLE_64 + +#else + +#define MSG_GOT_TITLE MSG_GOT_TITLE_32 +#define MSG_GOT_ENTRY_RE MSG_GOT_ENTRY_RE_32 +#define MSG_GOT_ENTRY_NR MSG_GOT_ENTRY_NR_32 + +#define MSG_PHD_VADDR MSG_PHD_VADDR_32 +#define MSG_PHD_PADDR MSG_PHD_PADDR_32 +#define MSG_PHD_FILESZ MSG_PHD_FILESZ_32 +#define MSG_PHD_OFFSET MSG_PHD_OFFSET_32 + +#define MSG_REL_EFSA_TITLE MSG_REL_EFSA_TITLE_32 +#define MSG_REL_EFLA_TITLE MSG_REL_EFLA_TITLE_32 +#define MSG_REL_EFSN_TITLE MSG_REL_EFSN_TITLE_32 +#define MSG_REL_EFLN_TITLE MSG_REL_EFLN_TITLE_32 +#define MSG_REL_EFSA_ENTRY MSG_REL_EFSA_ENTRY_32 +#define MSG_REL_EFLA_ENTRY MSG_REL_EFLA_ENTRY_32 +#define MSG_REL_EFSN_ENTRY MSG_REL_EFSN_ENTRY_32 +#define MSG_REL_EFLN_ENTRY MSG_REL_EFLN_ENTRY_32 +#define MSG_REL_RT_APLREG MSG_REL_RT_APLREG_32 +#define MSG_REL_RT_APLVAL MSG_REL_RT_APLVAL_32 +#define MSG_REL_RTA_TITLE MSG_REL_RTA_TITLE_32 +#define MSG_REL_RTN_TITLE MSG_REL_RTN_TITLE_32 +#define MSG_REL_RTV_TITLE MSG_REL_RTV_TITLE_32 +#define MSG_REL_RTA_ENTRY MSG_REL_RTA_ENTRY_32 +#define MSG_REL_RTN_ENTRY MSG_REL_RTN_ENTRY_32 +#define MSG_REL_LDSA_TITLE MSG_REL_LDSA_TITLE_32 +#define MSG_REL_LDSN_TITLE MSG_REL_LDSN_TITLE_32 +#define MSG_REL_LDSV_TITLE MSG_REL_LDSV_TITLE_32 +#define MSG_REL_LDSA_ENTRY MSG_REL_LDSA_ENTRY_32 +#define MSG_REL_LDSN_ENTRY MSG_REL_LDSN_ENTRY_32 +#define MSG_REL_LDLA_TITLE MSG_REL_LDLA_TITLE_32 +#define MSG_REL_LDLN_TITLE MSG_REL_LDLN_TITLE_32 +#define MSG_REL_LDLV_TITLE MSG_REL_LDLV_TITLE_32 +#define MSG_REL_LDLA_ENTRY MSG_REL_LDLA_ENTRY_32 +#define MSG_REL_LDLN_ENTRY MSG_REL_LDLN_ENTRY_32 + +#define MSG_SHD_ADDR MSG_SHD_ADDR_32 +#define MSG_SHD_SIZE MSG_SHD_SIZE_32 +#define MSG_SHD_OFFSET MSG_SHD_OFFSET_32 +#define MSG_SHD_ALIGN MSG_SHD_ALIGN_32 +#define MSG_SHD_LINK MSG_SHD_LINK_32 + +#define MSG_SYM_EFS_ENTRY MSG_SYM_EFS_ENTRY_32 +#define MSG_SYM_EFL_ENTRY MSG_SYM_EFL_ENTRY_32 +#define MSG_SYM_EFS_TITLE MSG_SYM_EFS_TITLE_32 +#define MSG_SYM_EFL_TITLE MSG_SYM_EFL_TITLE_32 +#define MSG_SYM_LDS_TITLE MSG_SYM_LDS_TITLE_32 +#define MSG_SYM_LDL_TITLE MSG_SYM_LDL_TITLE_32 + +#endif + +#define INDEX_STR_SIZE 10 #ifdef __cplusplus } diff --git a/usr/src/cmd/sgs/liblddbg/common/_synonyms.h b/usr/src/cmd/sgs/liblddbg/common/_synonyms.h index 08c79a3624..659921632e 100644 --- a/usr/src/cmd/sgs/liblddbg/common/_synonyms.h +++ b/usr/src/cmd/sgs/liblddbg/common/_synonyms.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright 1996-2002 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #ifndef _SYNONYMS_DOT_H @@ -33,6 +33,8 @@ extern "C" { #endif +#if !defined(__lint) + /* * Some synonyms definitions - ld.so.1 exports sufficient functions from its * libc contents for liblddbg to bind. The intention is insure that liblddbg @@ -43,6 +45,8 @@ extern "C" { #define open _open #define write _write +#endif + #ifdef __cplusplus } #endif diff --git a/usr/src/cmd/sgs/liblddbg/common/args.c b/usr/src/cmd/sgs/liblddbg/common/args.c index 6a8105c0b3..38fd8f3cc1 100644 --- a/usr/src/cmd/sgs/liblddbg/common/args.c +++ b/usr/src/cmd/sgs/liblddbg/common/args.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,29 +18,32 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 1998 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 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> #include "_debug.h" +#include "msg.h" void -Dbg_args_flags(int ndx, int c) +Dbg_args_flags(Lm_list *lml, int ndx, int c) { - if (DBG_NOTCLASS(DBG_ARGS)) + if (DBG_NOTCLASS(DBG_C_ARGS)) return; - dbg_print(MSG_INTL(MSG_ARG_FLAG), ndx, c); + dbg_print(lml, MSG_INTL(MSG_ARG_FLAG), ndx, c); } void -Dbg_args_files(int ndx, char * file) +Dbg_args_files(Lm_list *lml, int ndx, char *file) { - if (DBG_NOTCLASS(DBG_ARGS)) + if (DBG_NOTCLASS(DBG_C_ARGS)) return; - dbg_print(MSG_INTL(MSG_ARG_FILE), ndx, file); + dbg_print(lml, MSG_INTL(MSG_ARG_FILE), ndx, file); } diff --git a/usr/src/cmd/sgs/liblddbg/common/audit.c b/usr/src/cmd/sgs/liblddbg/common/audit.c index dfece92b40..19ef8a2225 100644 --- a/usr/src/cmd/sgs/liblddbg/common/audit.c +++ b/usr/src/cmd/sgs/liblddbg/common/audit.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -31,54 +31,53 @@ #include "msg.h" #include "libld.h" - void -Dbg_audit_version(const char *lib, ulong_t version) +Dbg_audit_version(Lm_list *lml, const char *lib, ulong_t version) { - if (DBG_NOTCLASS(DBG_AUDITING)) + if (DBG_NOTCLASS(DBG_C_AUDITING)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_AUD_VERSION), lib, (int)version); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_AUD_VERSION), lib, (int)version); } void -Dbg_audit_lib(const char *lib) +Dbg_audit_lib(Lm_list *lml, const char *lib) { - if (DBG_NOTCLASS(DBG_AUDITING)) + if (DBG_NOTCLASS(DBG_C_AUDITING)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_AUD_INIT), lib); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_AUD_INIT), lib); } void -Dbg_audit_interface(const char *lib, const char *interface) +Dbg_audit_interface(Lm_list *lml, const char *lib, const char *interface) { - if (DBG_NOTCLASS(DBG_AUDITING)) + if (DBG_NOTCLASS(DBG_C_AUDITING)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_AUD_INTERFACE), lib, interface); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_AUD_INTERFACE), lib, interface); } void -Dbg_audit_object(const char *lib, const char *obj) +Dbg_audit_object(Lm_list *lml, const char *lib, const char *obj) { - if (DBG_NOTCLASS(DBG_AUDITING)) + if (DBG_NOTCLASS(DBG_C_AUDITING)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_AUD_OBJECT), lib, obj); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_AUD_OBJECT), lib, obj); } void -Dbg_audit_symval(const char *lib, const char *func, const char *sym, - Addr pval, Addr nval) +Dbg_audit_symval(Lm_list *lml, const char *lib, const char *func, + const char *sym, Addr pval, Addr nval) { char mesg[100]; - if (DBG_NOTCLASS(DBG_AUDITING)) + if (DBG_NOTCLASS(DBG_C_AUDITING)) return; if (DBG_NOTDETAIL()) return; @@ -88,6 +87,6 @@ Dbg_audit_symval(const char *lib, const char *func, const char *sym, else (void) sprintf(mesg, MSG_INTL(MSG_AUD_SYMNEW), EC_XWORD(nval)); - dbg_print(MSG_INTL(MSG_AUD_SYM), lib, func, _Dbg_sym_dem(sym), + dbg_print(lml, MSG_INTL(MSG_AUD_SYM), lib, func, Dbg_demangle_name(sym), EC_XWORD(pval), mesg); } diff --git a/usr/src/cmd/sgs/liblddbg/common/bindings.c b/usr/src/cmd/sgs/liblddbg/common/bindings.c index 78dc8f6a62..101023864d 100644 --- a/usr/src/cmd/sgs/liblddbg/common/bindings.c +++ b/usr/src/cmd/sgs/liblddbg/common/bindings.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -28,31 +28,35 @@ #include <sys/types.h> #include <string.h> -#include "msg.h" +#include <debug.h> +#include <conv.h> #include "_debug.h" +#include "msg.h" void -Dbg_bind_plt_summary(Half mach, Word pltcnt21d, Word pltcnt24d, Word pltcntu32, - Word pltcntu44, Word pltcntfull, Word pltcntfar) +Dbg_bind_plt_summary(Lm_list *lml, Half mach, Word pltcnt21d, Word pltcnt24d, + Word pltcntu32, Word pltcntu44, Word pltcntfull, Word pltcntfar) { Word plttotal = pltcnt21d + pltcnt24d + pltcntu32 + pltcntu44 + pltcntfull + pltcntfar; - if (DBG_NOTCLASS(DBG_BINDINGS)) + if (DBG_NOTCLASS(DBG_C_BINDINGS)) return; switch (mach) { case EM_SPARC: - dbg_print(MSG_INTL(MSG_BND_PSUM_SPARC), EC_WORD(pltcnt21d), + dbg_print(lml, MSG_INTL(MSG_BND_PSUM_SPARC), EC_WORD(pltcnt21d), EC_WORD(pltcnt24d), EC_WORD(pltcntfull), EC_WORD(plttotal)); break; case EM_SPARCV9: - dbg_print(MSG_INTL(MSG_BND_PSUM_SPARCV9), EC_WORD(pltcnt21d), - EC_WORD(pltcnt24d), EC_WORD(pltcntu32), EC_WORD(pltcntu44), - EC_WORD(pltcntfull), EC_WORD(pltcntfar), EC_WORD(plttotal)); + dbg_print(lml, MSG_INTL(MSG_BND_PSUM_SPARCV9), + EC_WORD(pltcnt21d), EC_WORD(pltcnt24d), EC_WORD(pltcntu32), + EC_WORD(pltcntu44), EC_WORD(pltcntfull), EC_WORD(pltcntfar), + EC_WORD(plttotal)); break; default: - dbg_print(MSG_INTL(MSG_BND_PSUM_DEFAULT), EC_WORD(plttotal)); + dbg_print(lml, MSG_INTL(MSG_BND_PSUM_DEFAULT), + EC_WORD(plttotal)); break; }; } @@ -68,99 +72,56 @@ static const char *pltbindtypes[PLT_T_NUM] = { }; #define BINFOSZ MSG_BINFO_START_SIZE + \ - MSG_BINFO_DIRECT_SIZE + \ - MSG_BINFO_SEP_SIZE + \ - MSG_BINFO_COPYREF_SIZE + \ - MSG_BINFO_SEP_SIZE + \ - MSG_BINFO_FILTEE_SIZE + \ - MSG_BINFO_SEP_SIZE + \ + MSG_BINFO_DIRECT_SIZE + MSG_BINFO_SEP_SIZE + \ + MSG_BINFO_INTERPOSE_SIZE + MSG_BINFO_SEP_SIZE + \ + MSG_BINFO_COPYREF_SIZE + MSG_BINFO_SEP_SIZE + \ + MSG_BINFO_FILTEE_SIZE + MSG_BINFO_SEP_SIZE + \ MSG_BINFO_PLTADDR_SIZE + \ - MSG_BINFO_END_SIZE + 1 + CONV_INV_STRSIZE + MSG_BINFO_END_SIZE + -/* - * Normally we don't want to display any ld.so.1 bindings (i.e. the bindings - * to these calls themselves). So, if a Dbg_bind_global() originates from - * ld.so.1 don't print anything. If we really want to see the ld.so.1 bindings, - * simply give the run-time linker a different SONAME. - */ void -Dbg_bind_global(const char *ffile, caddr_t fabs, caddr_t frel, Xword pltndx, - Pltbindtype pbtype, const char *tfile, caddr_t tabs, caddr_t trel, +Dbg_bind_global(Rt_map *flmp, Addr fabs, Off foff, Xword pltndx, + Pltbindtype pbtype, Rt_map *tlmp, Addr tabs, Off toff, const char *sym, uint_t binfo) { - const char *rfile; + static Val_desc vda[] = { + { DBG_BINFO_DIRECT, MSG_ORIG(MSG_BINFO_DIRECT) }, + { DBG_BINFO_INTERPOSE, MSG_ORIG(MSG_BINFO_INTERPOSE) }, + { DBG_BINFO_COPYREF, MSG_ORIG(MSG_BINFO_COPYREF) }, + { DBG_BINFO_FILTEE, MSG_ORIG(MSG_BINFO_FILTEE) }, + { DBG_BINFO_PLTADDR, MSG_ORIG(MSG_BINFO_PLTADDR) }, + { 0, 0 } + }; char binfostr[BINFOSZ]; + const char *ffile = NAME(flmp); + const char *tfile = NAME(tlmp); + Lm_list *lml = LIST(flmp); - if (DBG_NOTCLASS(DBG_BINDINGS)) - return; - - if ((rfile = strrchr(ffile, '/')) == NULL) - rfile = ffile; - else - rfile++; - - if (strcmp(rfile, MSG_ORIG(MSG_FIL_RTLD)) == 0) + if (DBG_NOTCLASS(DBG_C_BINDINGS)) return; if (DBG_NOTDETAIL()) { - dbg_print(MSG_INTL(MSG_BND_BASIC), ffile, tfile, - _Dbg_sym_dem(sym)); + dbg_print(lml, MSG_INTL(MSG_BND_BASIC), ffile, tfile, + Dbg_demangle_name(sym)); return; } /* * Determine if this binding has any associated information, such as - * and interposition, direct binding, copy-relocations, etc. + * interposition, direct binding, copy-relocations, etc. */ binfo &= ~DBG_BINFO_FOUND; binfo &= DBG_BINFO_MSK; if (binfo) { - int _binfo = 0; - - (void) strcpy(binfostr, MSG_ORIG(MSG_BINFO_START)); - if (binfo & DBG_BINFO_DIRECT) { - _binfo |= DBG_BINFO_DIRECT; - (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_DIRECT)); - } - if (binfo & DBG_BINFO_INTERPOSE) { - if (_binfo) - (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_SEP)); - _binfo |= DBG_BINFO_INTERPOSE; - (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_INTERPOSE)); - } - if (binfo & DBG_BINFO_COPYREF) { - if (_binfo) - (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_SEP)); - _binfo |= DBG_BINFO_COPYREF; - (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_COPYREF)); - } - if (binfo & DBG_BINFO_FILTEE) { - if (_binfo) - (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_SEP)); - _binfo |= DBG_BINFO_FILTEE; - (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_FILTEE)); - } - if (binfo & DBG_BINFO_PLTADDR) { - if (_binfo) - (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_SEP)); - _binfo |= DBG_BINFO_PLTADDR; - (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_PLTADDR)); - } - if (binfo & ~_binfo) { - size_t len; - - if (_binfo) - (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_SEP)); - - len = strlen(binfostr); - conv_invalid_str(&binfostr[len], (BINFOSZ - len), - (Lword)(binfo & ~_binfo), 0); - } - (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_END)); + (void) strlcpy(binfostr, MSG_ORIG(MSG_BINFO_START), BINFOSZ); + + if (conv_expn_field(binfostr, BINFOSZ, vda, binfo, binfo, + MSG_ORIG(MSG_BINFO_SEP), 0)) + (void) strcat(binfostr, MSG_ORIG(MSG_BINFO_END)); } else binfostr[0] = '\0'; - if (pltndx != (Xword)-1) { const char *pltstring; @@ -172,48 +133,71 @@ Dbg_bind_global(const char *ffile, caddr_t fabs, caddr_t frel, Xword pltndx, /* * Called from a plt offset. */ - dbg_print(MSG_INTL(MSG_BND_PLT), ffile, EC_ADDR(fabs), - EC_ADDR(frel), EC_WORD(pltndx), pltstring, tfile, - EC_ADDR(tabs), EC_ADDR(trel), _Dbg_sym_dem(sym), binfostr); + dbg_print(lml, MSG_INTL(MSG_BND_PLT), ffile, EC_ADDR(fabs), + EC_OFF(foff), EC_XWORD(pltndx), pltstring, tfile, + EC_ADDR(tabs), EC_OFF(toff), Dbg_demangle_name(sym), + binfostr); - } else if ((fabs == 0) && (frel == 0)) { + } else if ((fabs == 0) && (foff == 0)) { /* * Called from a dlsym(). We're not performing a relocation, * but are handing the address of the symbol back to the user. */ - dbg_print(MSG_INTL(MSG_BND_DLSYM), ffile, tfile, EC_ADDR(tabs), - EC_ADDR(trel), _Dbg_sym_dem(sym), binfostr); - + dbg_print(lml, MSG_INTL(MSG_BND_DLSYM), ffile, tfile, + EC_ADDR(tabs), EC_OFF(toff), Dbg_demangle_name(sym), + binfostr); } else { /* * Standard relocation. */ - dbg_print(MSG_INTL(MSG_BND_DEFAULT), ffile, EC_ADDR(fabs), - EC_ADDR(frel), tfile, EC_ADDR(tabs), EC_ADDR(trel), - _Dbg_sym_dem(sym), binfostr); + dbg_print(lml, MSG_INTL(MSG_BND_DEFAULT), ffile, EC_ADDR(fabs), + EC_OFF(foff), tfile, EC_ADDR(tabs), EC_OFF(toff), + Dbg_demangle_name(sym), binfostr); } } void -Dbg_bind_weak(const char *ffile, caddr_t fabs, caddr_t frel, const char *sym) +Dbg_bind_weak(Rt_map *flmp, Addr fabs, Addr frel, const char *sym) { - if (DBG_NOTCLASS(DBG_BINDINGS)) + Lm_list *lml = LIST(flmp); + const char *ffile = NAME(flmp); + + if (DBG_NOTCLASS(DBG_C_BINDINGS)) return; if (DBG_NOTDETAIL()) - dbg_print(MSG_INTL(MSG_BND_WEAK_1), ffile, _Dbg_sym_dem(sym)); + dbg_print(lml, MSG_INTL(MSG_BND_WEAK_1), ffile, + Dbg_demangle_name(sym)); else - dbg_print(MSG_INTL(MSG_BND_WEAK_2), ffile, EC_ADDR(fabs), - EC_ADDR(frel), _Dbg_sym_dem(sym)); + dbg_print(lml, MSG_INTL(MSG_BND_WEAK_2), ffile, EC_ADDR(fabs), + EC_ADDR(frel), Dbg_demangle_name(sym)); +} + +#if defined(_ELF64) + +void +Dbg_bind_pltpad_to(Rt_map *lmp, Addr pltpad, const char *dfile, + const char *sname) +{ + if (DBG_NOTCLASS(DBG_C_RELOC)) + return; + if (DBG_NOTDETAIL()) + return; + + dbg_print(LIST(lmp), MSG_INTL(MSG_BND_PLTPAD_TO), EC_ADDR(pltpad), + NAME(lmp), dfile, sname); } void -Dbg_bind_profile(uint_t ndx, uint_t count) +Dbg_bind_pltpad_from(Rt_map *lmp, Addr pltpad, const char *sname) { - if (DBG_NOTCLASS(DBG_BINDINGS)) + if (DBG_NOTCLASS(DBG_C_RELOC)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_INTL(MSG_BND_PROFILE), EC_WORD(ndx), EC_WORD(count)); + dbg_print(LIST(lmp), MSG_INTL(MSG_BND_PLTPAD_FROM), EC_ADDR(pltpad), + NAME(lmp), sname); } + +#endif diff --git a/usr/src/cmd/sgs/liblddbg/common/cap.c b/usr/src/cmd/sgs/liblddbg/common/cap.c index 341138002e..2cc101851d 100644 --- a/usr/src/cmd/sgs/liblddbg/common/cap.c +++ b/usr/src/cmd/sgs/liblddbg/common/cap.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,71 +18,49 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" -#include "_synonyms.h" - +#include <debug.h> +#include <libld.h> +#include <conv.h> #include "msg.h" #include "_debug.h" -#include "libld.h" - -#if !defined(_ELF64) void -Dbg_cap_hw_candidate(const char *name) +Dbg_cap_hw_candidate(Lm_list *lml, const char *name) { - if (DBG_NOTCLASS(DBG_CAP | DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_CAP | DBG_C_FILES)) return; - dbg_print(MSG_INTL(MSG_CAP_HW_CANDIDATE), name); + dbg_print(lml, MSG_INTL(MSG_CAP_HW_CANDIDATE), name); } void -Dbg_cap_hw_filter(const char *dir, const char *filtee) +Dbg_cap_hw_filter(Lm_list *lml, const char *dir, Rt_map *flmp) { - if (DBG_NOTCLASS(DBG_CAP | DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_CAP | DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - if (filtee) - dbg_print(MSG_INTL(MSG_CAP_HWFILTR_1), dir, filtee); + Dbg_util_nl(lml, DBG_NL_STD); + if (flmp) + dbg_print(lml, MSG_INTL(MSG_CAP_HWFILTR_1), dir, NAME(flmp)); else - dbg_print(MSG_INTL(MSG_CAP_HWFILTR_2), dir); -} - -void -Dbg_cap_sec_title(const char *file) -{ - if (DBG_NOTCLASS(DBG_CAP)) - return; - - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_CAP_SEC_TITLE), file); + dbg_print(lml, MSG_INTL(MSG_CAP_HWFILTR_2), dir); } void -Gelf_cap_title(void) +Dbg_cap_val_hw1(Lm_list *lml, Xword val, Half mach) { - dbg_print(MSG_INTL(MSG_CAP_ELF_TITLE)); -} - -void -Gelf_cap_print(GElf_Cap * cap, int ndx, Half mach) -{ - char index[10]; - - (void) sprintf(index, MSG_ORIG(MSG_FMT_INDEX), ndx); - dbg_print(MSG_INTL(MSG_CAP_ELF_ENTRY), index, - conv_captag_str(cap->c_tag), - conv_capval_str(cap->c_tag, cap->c_un.c_val, mach)); + Dbg_util_nl(lml, DBG_NL_FRC); + dbg_print(lml, MSG_INTL(MSG_CAP_VAL_HW1), conv_cap_val_hw1(val, mach)); + Dbg_util_nl(lml, DBG_NL_FRC); } -#endif - static const Msg captype[] = { MSG_STR_INITIAL, /* MSG_INTL(MSG_STR_INITIAL) */ MSG_STR_IGNORE, /* MSG_INTL(MSG_STR_IGNORE) */ @@ -93,29 +70,50 @@ static const Msg captype[] = { }; void -Dbg_cap_sec_entry(uint_t type, Xword tag, Xword val, Half mach) +Dbg_cap_mapfile(Lm_list *lml, Xword tag, Xword val, Half mach) { - if (DBG_NOTCLASS(DBG_CAP)) + if (DBG_NOTCLASS(DBG_C_MAP | DBG_C_CAP)) return; - dbg_print(MSG_INTL(MSG_CAP_SEC_ENTRY), MSG_INTL(captype[type]), - conv_captag_str(tag), conv_capval_str(tag, val, mach)); + dbg_print(lml, MSG_INTL(MSG_MAP_CAP)); + Dbg_cap_sec_entry(lml, DBG_CAP_INITIAL, tag, val, mach); } void -Dbg_cap_mapfile(Xword tag, Xword val, Half mach) +Dbg_cap_sec_entry(Lm_list *lml, uint_t type, Xword tag, Xword val, Half mach) { - if (DBG_NOTCLASS(DBG_MAP | DBG_CAP)) + if (DBG_NOTCLASS(DBG_C_CAP)) return; - dbg_print(MSG_INTL(MSG_MAP_CAP)); - Dbg_cap_sec_entry(DBG_CAP_INITIAL, tag, val, mach); + dbg_print(lml, MSG_INTL(MSG_CAP_SEC_ENTRY), MSG_INTL(captype[type]), + conv_cap_tag(tag), conv_cap_val(tag, val, mach)); } void -Dbg_cap_hw_1(Xword val, Half mach) +Dbg_cap_sec_title(Ofl_desc *ofl) { - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_CAP_HW_1), conv_hwcap_1_str(val, mach)); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Lm_list *lml = ofl->ofl_lml; + + if (DBG_NOTCLASS(DBG_C_CAP)) + return; + + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_CAP_SEC_TITLE), ofl->ofl_name); +} + +void +Elf_cap_title(Lm_list *lml) +{ + dbg_print(lml, MSG_INTL(MSG_CAP_ELF_TITLE)); +} + +void +Elf_cap_entry(Lm_list *lml, Cap *cap, int ndx, Half mach) +{ + char index[INDEX_STR_SIZE]; + + (void) snprintf(index, INDEX_STR_SIZE, MSG_ORIG(MSG_FMT_INDEX), ndx); + dbg_print(lml, MSG_INTL(MSG_CAP_ELF_ENTRY), index, + conv_cap_tag(cap->c_tag), + conv_cap_val(cap->c_tag, cap->c_un.c_val, mach)); } diff --git a/usr/src/cmd/sgs/liblddbg/common/debug.c b/usr/src/cmd/sgs/liblddbg/common/debug.c index 01a5a9f05c..bc45db0638 100644 --- a/usr/src/cmd/sgs/liblddbg/common/debug.c +++ b/usr/src/cmd/sgs/liblddbg/common/debug.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,144 +18,203 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" +#define dgettext _dgettext + +#include <libintl.h> +#include <sys/varargs.h> #include <stdio.h> #include <string.h> #include <stdlib.h> -#include "_debug.h" -#include "msg.h" +#include <alist.h> +#include <debug.h> +#include <_debug.h> +#include <msg.h> -uint_t _Dbg_mask; -static int _Dbg_count = 0; +/* + * Define a debug descriptor. Note, although this provides the default + * definition to which most users bind, ld.so.1 must provide its own definition, + * and thus interposition is expected. This item should be defined NODIRECT. + */ +static Dbg_desc _dbg_desc = { 0, 0, 0 }; +Dbg_desc *dbg_desc = &_dbg_desc; +int _Dbg_cnt = 0; /* - * Debugging initialization and processing. The options structure defines + * Debugging initialization and processing. The dbg_options[] array defines * a set of option strings that can be specified using the -D flag or from an - * environment variable. For each option, a class is enabled in the _Dbg_mask - * bit mask. + * environment variable. For each option, a class is enabled in the d_class + * bit mask, or an extra flag is enabled in the d_extra bit mask. */ -static DBG_options _Dbg_options[] = { - {MSG_ORIG(MSG_TOK_NAME), DBG_G_SNAME}, - {MSG_ORIG(MSG_TOK_FULLNAME), DBG_G_SNAME | DBG_G_FNAME}, - {MSG_ORIG(MSG_TOK_CLASS), DBG_G_SNAME | DBG_G_CLASS}, - - {MSG_ORIG(MSG_TOK_ALL), DBG_LOCAL}, - {MSG_ORIG(MSG_TOK_ARGS), DBG_ARGS}, - {MSG_ORIG(MSG_TOK_BASIC), DBG_BASIC}, - {MSG_ORIG(MSG_TOK_BINDINGS), DBG_BINDINGS}, - {MSG_ORIG(MSG_TOK_DETAIL), DBG_DETAIL}, - {MSG_ORIG(MSG_TOK_ENTRY), DBG_ENTRY}, - {MSG_ORIG(MSG_TOK_FILES), DBG_FILES}, - {MSG_ORIG(MSG_TOK_HELP), DBG_HELP}, - {MSG_ORIG(MSG_TOK_LIBS), DBG_LIBS}, - {MSG_ORIG(MSG_TOK_LONG), DBG_LONG}, - {MSG_ORIG(MSG_TOK_MAP), DBG_MAP}, - {MSG_ORIG(MSG_TOK_RELOC), DBG_RELOC}, - {MSG_ORIG(MSG_TOK_SECTIONS), DBG_SECTIONS}, - {MSG_ORIG(MSG_TOK_SEGMENTS), DBG_SEGMENTS}, - {MSG_ORIG(MSG_TOK_SUPPORT), DBG_SUPPORT}, - {MSG_ORIG(MSG_TOK_SYMBOLS), DBG_SYMBOLS}, - {MSG_ORIG(MSG_TOK_TLS), DBG_TLS}, - {MSG_ORIG(MSG_TOK_AUDIT), DBG_AUDITING}, - {MSG_ORIG(MSG_TOK_VERSIONS), DBG_VERSIONS}, - {MSG_ORIG(MSG_TOK_GOT), DBG_GOT}, - {MSG_ORIG(MSG_TOK_MOVE), DBG_MOVE}, - {MSG_ORIG(MSG_TOK_STRTAB), DBG_STRTAB}, - {MSG_ORIG(MSG_TOK_STATISTICS), DBG_STATISTICS}, - {MSG_ORIG(MSG_TOK_UNUSED), DBG_UNUSED}, +DBG_options _Dbg_options[] = { + {MSG_ORIG(MSG_TOK_DETAIL), 0, DBG_E_DETAIL}, + {MSG_ORIG(MSG_TOK_LONG), 0, DBG_E_LONG}, + {MSG_ORIG(MSG_TOK_NAME), 0, DBG_E_SNAME}, + {MSG_ORIG(MSG_TOK_FULLNAME), 0, DBG_E_SNAME | DBG_E_FNAME}, + {MSG_ORIG(MSG_TOK_CLASS), 0, DBG_E_SNAME | DBG_E_CLASS}, + {MSG_ORIG(MSG_TOK_LMID), 0, DBG_E_LMID}, + + {MSG_ORIG(MSG_TOK_ALL), DBG_C_ALL, 0}, + {MSG_ORIG(MSG_TOK_ARGS), DBG_C_ARGS, 0}, + {MSG_ORIG(MSG_TOK_BASIC), DBG_C_BASIC, 0}, + {MSG_ORIG(MSG_TOK_BINDINGS), DBG_C_BINDINGS, 0}, + {MSG_ORIG(MSG_TOK_ENTRY), DBG_C_ENTRY, 0}, + {MSG_ORIG(MSG_TOK_FILES), DBG_C_FILES, 0}, + {MSG_ORIG(MSG_TOK_HELP), DBG_C_HELP, 0}, + {MSG_ORIG(MSG_TOK_LIBS), DBG_C_LIBS, 0}, + {MSG_ORIG(MSG_TOK_MAP), DBG_C_MAP, 0}, + {MSG_ORIG(MSG_TOK_RELOC), DBG_C_RELOC, 0}, + {MSG_ORIG(MSG_TOK_SECTIONS), DBG_C_SECTIONS, 0}, + {MSG_ORIG(MSG_TOK_SEGMENTS), DBG_C_SEGMENTS, 0}, + {MSG_ORIG(MSG_TOK_SUPPORT), DBG_C_SUPPORT, 0}, + {MSG_ORIG(MSG_TOK_SYMBOLS), DBG_C_SYMBOLS, 0}, + {MSG_ORIG(MSG_TOK_TLS), DBG_C_TLS, 0}, + {MSG_ORIG(MSG_TOK_AUDIT), DBG_C_AUDITING, 0}, + {MSG_ORIG(MSG_TOK_VERSIONS), DBG_C_VERSIONS, 0}, + {MSG_ORIG(MSG_TOK_GOT), DBG_C_GOT, 0}, + {MSG_ORIG(MSG_TOK_MOVE), DBG_C_MOVE, 0}, + {MSG_ORIG(MSG_TOK_STRTAB), DBG_C_STRTAB, 0}, + {MSG_ORIG(MSG_TOK_STATS), DBG_C_STATS, 0}, + {MSG_ORIG(MSG_TOK_UNUSED), DBG_C_UNUSED, 0}, #ifdef DEMANGLE - {MSG_ORIG(MSG_TOK_DEMANGLE), DBG_DEMANGLE}, + {MSG_ORIG(MSG_TOK_DEMANGLE), DBG_C_DEMANGLE, 0}, #endif - {MSG_ORIG(MSG_TOK_CAP), DBG_CAP}, - {MSG_ORIG(MSG_TOK_INIT), DBG_INIT}, + {MSG_ORIG(MSG_TOK_CAP), DBG_C_CAP, 0}, + {MSG_ORIG(MSG_TOK_INIT), DBG_C_INIT, 0}, {NULL, NULL}, }; /* + * Tokens may also define identifiers for diagnostics. Presently, only ld.so.1 + * uses these strings to identify, or isolate its output to selected link-map + * lists. See ld.so.1:dbg_print(). + */ +const char *_Dbg_strs[] = { + MSG_ORIG(MSG_TOK_BASE), MSG_ORIG(MSG_TOK_LDSO), + MSG_ORIG(MSG_TOK_NEWLM), NULL +}; + +/* * Provide a debugging usage message */ -static void -_Dbg_usage() +void +Dbg_usage() { - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_USE_RTLD_A)); - dbg_print(MSG_INTL(MSG_USE_RTLD_B)); - dbg_print(MSG_INTL(MSG_USE_RTLD_C)); - dbg_print(MSG_INTL(MSG_USE_RTLD_D)); - dbg_print(MSG_INTL(MSG_USE_RTLD_E)); - dbg_print(MSG_INTL(MSG_USE_RTLD_F)); - dbg_print(MSG_INTL(MSG_USE_RTLD_G)); - - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_USE_LD_A)); - dbg_print(MSG_INTL(MSG_USE_LD_B)); - dbg_print(MSG_INTL(MSG_USE_LD_C)); - dbg_print(MSG_INTL(MSG_USE_LD_D)); - dbg_print(MSG_INTL(MSG_USE_LD_E)); - dbg_print(MSG_INTL(MSG_USE_LD_F)); - dbg_print(MSG_INTL(MSG_USE_LD_G)); - dbg_print(MSG_INTL(MSG_USE_LD_H)); - dbg_print(MSG_INTL(MSG_USE_LD_I)); - dbg_print(MSG_INTL(MSG_USE_LD_J)); - - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_USE_ARGS)); - dbg_print(MSG_INTL(MSG_USE_AUDIT)); - dbg_print(MSG_INTL(MSG_USE_BASIC)); - dbg_print(MSG_INTL(MSG_USE_BINDINGS)); - dbg_print(MSG_INTL(MSG_USE_BINDINGS_2)); - dbg_print(MSG_INTL(MSG_USE_CAP)); - dbg_print(MSG_INTL(MSG_USE_DETAIL)); + Dbg_util_nl(0, DBG_NL_FRC); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_A)); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_B)); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_C)); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_D)); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_E)); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_F)); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_G)); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_H)); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_I)); + Dbg_util_nl(0, DBG_NL_FRC); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_J)); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_K)); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_L)); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_M)); + Dbg_util_nl(0, DBG_NL_FRC); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_N)); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_O)); + Dbg_util_nl(0, DBG_NL_FRC); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_P)); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_Q)); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_R)); + dbg_print(0, MSG_INTL(MSG_USE_RTLD_S)); + + Dbg_util_nl(0, DBG_NL_FRC); + dbg_print(0, MSG_INTL(MSG_USE_LD_A)); + dbg_print(0, MSG_INTL(MSG_USE_LD_B)); + dbg_print(0, MSG_INTL(MSG_USE_LD_C)); + dbg_print(0, MSG_INTL(MSG_USE_LD_D)); + dbg_print(0, MSG_INTL(MSG_USE_LD_E)); + dbg_print(0, MSG_INTL(MSG_USE_LD_F)); + dbg_print(0, MSG_INTL(MSG_USE_LD_G)); + dbg_print(0, MSG_INTL(MSG_USE_LD_H)); + Dbg_util_nl(0, DBG_NL_FRC); + dbg_print(0, MSG_INTL(MSG_USE_LD_I)); + Dbg_util_nl(0, DBG_NL_FRC); + dbg_print(0, MSG_INTL(MSG_USE_LD_J)); + dbg_print(0, MSG_INTL(MSG_USE_LD_K)); + Dbg_util_nl(0, DBG_NL_FRC); + dbg_print(0, MSG_INTL(MSG_USE_LD_L)); + Dbg_util_nl(0, DBG_NL_FRC); + dbg_print(0, MSG_INTL(MSG_USE_LD_M)); + dbg_print(0, MSG_INTL(MSG_USE_LD_N)); + dbg_print(0, MSG_INTL(MSG_USE_LD_O)); + + Dbg_util_nl(0, DBG_NL_FRC); + Dbg_util_nl(0, DBG_NL_FRC); + dbg_print(0, MSG_INTL(MSG_USE_ARGS)); + dbg_print(0, MSG_INTL(MSG_USE_AUDIT)); + dbg_print(0, MSG_INTL(MSG_USE_BASIC)); + dbg_print(0, MSG_INTL(MSG_USE_BINDINGS)); + dbg_print(0, MSG_INTL(MSG_USE_BINDINGS_2)); + dbg_print(0, MSG_INTL(MSG_USE_CAP)); + dbg_print(0, MSG_INTL(MSG_USE_DETAIL)); #ifdef DEMANGLE - dbg_print(MSG_INTL(MSG_USE_DEMANGLE)); + dbg_print(0, MSG_INTL(MSG_USE_DEMANGLE)); #endif - dbg_print(MSG_INTL(MSG_USE_ENTRY)); - dbg_print(MSG_INTL(MSG_USE_FILES)); - dbg_print(MSG_INTL(MSG_USE_GOT)); - dbg_print(MSG_INTL(MSG_USE_HELP)); - dbg_print(MSG_INTL(MSG_USE_INIT)); - dbg_print(MSG_INTL(MSG_USE_LIBS)); - dbg_print(MSG_INTL(MSG_USE_LIBS_2)); - dbg_print(MSG_INTL(MSG_USE_LONG)); - dbg_print(MSG_INTL(MSG_USE_MAP)); - dbg_print(MSG_INTL(MSG_USE_MOVE)); - dbg_print(MSG_INTL(MSG_USE_RELOC)); - dbg_print(MSG_INTL(MSG_USE_SECTIONS)); - dbg_print(MSG_INTL(MSG_USE_SEGMENTS)); - dbg_print(MSG_INTL(MSG_USE_SEGMENTS_2)); - dbg_print(MSG_INTL(MSG_USE_STATISTICS)); - dbg_print(MSG_INTL(MSG_USE_STRTAB)); - dbg_print(MSG_INTL(MSG_USE_STRTAB_2)); - dbg_print(MSG_INTL(MSG_USE_SUPPORT)); - dbg_print(MSG_INTL(MSG_USE_SYMBOLS)); - dbg_print(MSG_INTL(MSG_USE_SYMBOLS_2)); - dbg_print(MSG_INTL(MSG_USE_TLS)); - dbg_print(MSG_INTL(MSG_USE_UNUSED)); - dbg_print(MSG_INTL(MSG_USE_UNUSED_2)); - dbg_print(MSG_INTL(MSG_USE_VERSIONS)); + dbg_print(0, MSG_INTL(MSG_USE_ENTRY)); + dbg_print(0, MSG_INTL(MSG_USE_FILES)); + dbg_print(0, MSG_INTL(MSG_USE_GOT)); + dbg_print(0, MSG_INTL(MSG_USE_HELP)); + dbg_print(0, MSG_INTL(MSG_USE_INIT)); + dbg_print(0, MSG_INTL(MSG_USE_LIBS)); + dbg_print(0, MSG_INTL(MSG_USE_LIBS_2)); + dbg_print(0, MSG_INTL(MSG_USE_LMID)); + dbg_print(0, MSG_INTL(MSG_USE_LONG)); + dbg_print(0, MSG_INTL(MSG_USE_MAP)); + dbg_print(0, MSG_INTL(MSG_USE_MOVE)); + dbg_print(0, MSG_INTL(MSG_USE_RELOC)); + dbg_print(0, MSG_INTL(MSG_USE_SECTIONS)); + dbg_print(0, MSG_INTL(MSG_USE_SEGMENTS)); + dbg_print(0, MSG_INTL(MSG_USE_SEGMENTS_2)); + dbg_print(0, MSG_INTL(MSG_USE_STATS)); + dbg_print(0, MSG_INTL(MSG_USE_STRTAB)); + dbg_print(0, MSG_INTL(MSG_USE_STRTAB_2)); + dbg_print(0, MSG_INTL(MSG_USE_SUPPORT)); + dbg_print(0, MSG_INTL(MSG_USE_SYMBOLS)); + dbg_print(0, MSG_INTL(MSG_USE_SYMBOLS_2)); + dbg_print(0, MSG_INTL(MSG_USE_TLS)); + dbg_print(0, MSG_INTL(MSG_USE_UNUSED)); + dbg_print(0, MSG_INTL(MSG_USE_UNUSED_2)); + dbg_print(0, MSG_INTL(MSG_USE_VERSIONS)); + Dbg_util_nl(0, DBG_NL_FRC); +} + +/* + * Messaging support - funnel everything through dgettext() as this provides + * the real binding to libc. + */ +const char * +_liblddbg_msg(Msg mid) +{ + return (dgettext(MSG_ORIG(MSG_SUNW_OST_SGS), MSG_ORIG(mid))); } /* * Validate and enable the appropriate debugging classes. */ -uint_t -Dbg_setup(const char *string) +uintptr_t +Dbg_setup(const char *string, Dbg_desc *dbp) { - char *name, *_name; /* Temporary buffer in which to */ - /* perform strtok_r() operations. */ + char *name, *_name; /* buffer in which to perform */ + /* strtok_r() operations. */ char *lasts; - DBG_opts opts; /* Ptr to cycle thru _Dbg_options[]. */ const char *delimit = MSG_ORIG(MSG_STR_DELIMIT); if ((_name = (char *)malloc(strlen(string) + 1)) == 0) - return (0); + return (S_ERROR); (void) strcpy(_name, string); /* @@ -165,66 +223,117 @@ Dbg_setup(const char *string) * flagged. */ if ((name = strtok_r(_name, delimit, &lasts)) != NULL) { - Boolean found, set; do { - found = FALSE; - set = TRUE; + DBG_options *opt; + const char *str; + Boolean set, found = FALSE; + int ndx = 0; + if (name[0] == '!') { set = FALSE; name++; + } else + set = TRUE; + + /* + * First, determine if the token represents a class or + * extra. + */ + for (opt = _Dbg_options; opt->o_name != NULL; opt++) { + if (strcmp(name, opt->o_name) != 0) + continue; + + if (set == TRUE) { + if (opt->o_class) + dbp->d_class |= opt->o_class; + if (opt->o_extra) + dbp->d_extra |= opt->o_extra; + } else { + if (opt->o_class) + dbp->d_class &= ~(opt->o_class); + if (opt->o_extra) + dbp->d_extra &= ~(opt->o_extra); + } + found = TRUE; + break; } - for (opts = _Dbg_options; opts->o_name != NULL; - opts++) { - if (strcmp(name, opts->o_name) == 0) { - if (set == TRUE) - _Dbg_mask |= opts->o_mask; - else - _Dbg_mask &= ~(opts->o_mask); - found = TRUE; - break; + if (found == TRUE) + continue; + + /* + * Second, determine if the token represents a known + * diagnostic identifier. Note, newlm identifiers are + * typically followed by a numeric id, for example + * newlm1, newlm2 ... Thus we only compare the + * initial text of the string. + */ + while ((str = _Dbg_strs[ndx++]) != NULL) { + char *tup; + + if (strncmp(name, str, strlen(str)) != 0) + continue; + + /* + * Translate lmid identifier to uppercase. + */ + for (tup = name; *tup; tup++) { + if ((*tup >= 'a') && (*tup <= 'z')) + *tup = *tup - ('a' - 'A'); } + + /* + * Save this lmid. The whole token buffer has + * been reallocated, so these names will remain + * once this routine returns. + */ + if (alist_append(&(dbp->d_list), &name, + sizeof (char *), AL_CNT_DEBUG) == 0) + return (S_ERROR); + + found = TRUE; + break; } + if (found == FALSE) - dbg_print(MSG_INTL(MSG_USE_UNRECOG), name); + dbg_print(0, MSG_INTL(MSG_USE_UNRECOG), name); + } while ((name = strtok_r(NULL, delimit, &lasts)) != NULL); } - (void) free(_name); /* * If the debug help option was specified dump a usage message. If - * this is the only debug option return an indication that the user + * this is the only debug class, return an indication that the user * should exit. */ - if ((_Dbg_mask & DBG_HELP) && !_Dbg_count) { - _Dbg_usage(); - if (_Dbg_mask == DBG_HELP) - /* LINTED */ - return ((uint_t)S_ERROR); + if ((_Dbg_cnt++ == 0) && (dbp->d_class & DBG_C_HELP)) { + Dbg_usage(); + if (dbp->d_class == DBG_C_HELP) + return (0); } - - _Dbg_count++; - - return (_Dbg_mask); + return (1); } /* - * Set the specified flags to _Dbg_mask. + * Define our own printing routine. This provides a basic fallback, as ld(1) + * and ld.so.1(1) provide their own routines that augment their diagnostic + * output, and direct the output to stderr. This item should be defined + * NODIRECT. */ +/* PRINTFLIKE2 */ void -Dbg_set(uint_t flags) +dbg_print(Lm_list *lml, const char *format, ...) { - _Dbg_mask = flags; -} + va_list ap; - -/* - * Messaging support - funnel everything through _dgettext() as this provides - * a stub binding to libc, or a real binding to libintl. - */ -extern char *_dgettext(const char *, const char *); - -const char * -_liblddbg_msg(Msg mid) -{ - return (_dgettext(MSG_ORIG(MSG_SUNW_OST_SGS), MSG_ORIG(mid))); +#if defined(lint) + /* + * The lml argument is only meaningful for diagnostics sent to ld.so.1. + * Supress the lint error by making a dummy assignment. + */ + lml = 0; +#endif + va_start(ap, format); + (void) vprintf(format, ap); + (void) printf(MSG_ORIG(MSG_STR_NL)); + va_end(ap); } diff --git a/usr/src/cmd/sgs/liblddbg/common/dynamic.c b/usr/src/cmd/sgs/liblddbg/common/dynamic.c index a40fb45b81..7c33c08a32 100644 --- a/usr/src/cmd/sgs/liblddbg/common/dynamic.c +++ b/usr/src/cmd/sgs/liblddbg/common/dynamic.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,34 +18,35 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 2000,2001 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" -#include <link.h> +#include <sgs.h> #include <stdio.h> -#include "msg.h" -#include "_debug.h" +#include <debug.h> +#include <conv.h> +#include <_debug.h> +#include <msg.h> /* * Print out the dynamic section entries. */ void -Gelf_dyn_title() +Elf_dyn_title(Lm_list *lml) { - dbg_print(MSG_INTL(MSG_DYN_TITLE)); + dbg_print(lml, MSG_INTL(MSG_DYN_TITLE)); } void -Gelf_dyn_print(GElf_Dyn * dyn, int ndx, const char * name, Half mach) +Elf_dyn_entry(Lm_list *lml, Dyn *dyn, int ndx, const char *name, Half mach) { - char index[10]; + char index[INDEX_STR_SIZE]; - (void) sprintf(index, MSG_ORIG(MSG_FMT_INDEX), ndx); - dbg_print(MSG_INTL(MSG_DYN_ENTRY), index, - /* LINTED */ - conv_dyntag_str((Sword)dyn->d_tag, mach), - EC_XWORD(dyn->d_un.d_val), name); + (void) snprintf(index, INDEX_STR_SIZE, MSG_ORIG(MSG_FMT_INDEX), ndx); + dbg_print(lml, MSG_INTL(MSG_DYN_ENTRY), index, + conv_dyn_tag(dyn->d_tag, mach), EC_XWORD(dyn->d_un.d_val), name); } diff --git a/usr/src/cmd/sgs/liblddbg/common/elf.c b/usr/src/cmd/sgs/liblddbg/common/elf.c index 91cabd9e21..3c91535de7 100644 --- a/usr/src/cmd/sgs/liblddbg/common/elf.c +++ b/usr/src/cmd/sgs/liblddbg/common/elf.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,151 +18,88 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" -#include "msg.h" -#include "_debug.h" -#include "libld.h" - - -static void -Elf_elf_data(const char *str1, Addr addr, Elf_Data *data, const char *file, - const char *str2) -{ - dbg_print(MSG_INTL(MSG_ELF_ENTRY), str1, EC_ADDR(addr), - conv_d_type_str(data->d_type), EC_XWORD(data->d_size), - EC_OFF(data->d_off), EC_XWORD(data->d_align), file, str2); -} - -void -Gelf_elf_data_title() -{ - dbg_print(MSG_INTL(MSG_ELF_TITLE)); -} - -void -_Dbg_elf_data_in(Os_desc *osp, Is_desc *isp) -{ - Shdr *shdr = osp->os_shdr; - Elf_Data *data = isp->is_indata; - const char *file, *str; - Addr addr; - - if (isp->is_flags & FLG_IS_DISCARD) { - str = MSG_INTL(MSG_ELF_IGNSCN); - addr = 0; - } else { - str = MSG_ORIG(MSG_STR_EMPTY); - addr = (Addr)(shdr->sh_addr + data->d_off); - } - - if (isp->is_file && isp->is_file->ifl_name) - file = isp->is_file->ifl_name; - else - file = MSG_ORIG(MSG_STR_EMPTY); - - Elf_elf_data(MSG_INTL(MSG_STR_IN), addr, data, file, str); -} - -void -_Dbg_elf_data_out(Os_desc *osp) -{ - Shdr *shdr = osp->os_shdr; - Elf_Data *data = osp->os_outdata; - - Elf_elf_data(MSG_INTL(MSG_STR_OUT), shdr->sh_addr, - data, MSG_ORIG(MSG_STR_EMPTY), MSG_ORIG(MSG_STR_EMPTY)); -} +#include <sgs.h> +#include <_debug.h> +#include <conv.h> +#include <msg.h> void -Gelf_elf_header(GElf_Ehdr *ehdr, GElf_Shdr *shdr0) +Elf_ehdr(Lm_list *lml, Ehdr *ehdr, Shdr *shdr0) { Byte *byte = &(ehdr->e_ident[0]); const char *flgs; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_ELF_HEADER)); + dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(lml, MSG_INTL(MSG_ELF_HEADER)); - dbg_print(MSG_ORIG(MSG_ELF_MAGIC), byte[EI_MAG0], + dbg_print(lml, MSG_ORIG(MSG_ELF_MAGIC), byte[EI_MAG0], (byte[EI_MAG1] ? byte[EI_MAG1] : '0'), (byte[EI_MAG2] ? byte[EI_MAG2] : '0'), (byte[EI_MAG3] ? byte[EI_MAG3] : '0')); - dbg_print(MSG_ORIG(MSG_ELF_CLASS), - conv_eclass_str(ehdr->e_ident[EI_CLASS]), - conv_edata_str(ehdr->e_ident[EI_DATA])); - dbg_print(MSG_ORIG(MSG_ELF_MACHINE), - conv_emach_str(ehdr->e_machine), conv_ever_str(ehdr->e_version)); - dbg_print(MSG_ORIG(MSG_ELF_TYPE), conv_etype_str(ehdr->e_type)); + dbg_print(lml, MSG_ORIG(MSG_ELF_CLASS), + conv_ehdr_class(ehdr->e_ident[EI_CLASS]), + conv_ehdr_data(ehdr->e_ident[EI_DATA])); + dbg_print(lml, MSG_ORIG(MSG_ELF_MACHINE), + conv_ehdr_mach(ehdr->e_machine), conv_ehdr_vers(ehdr->e_version)); + dbg_print(lml, MSG_ORIG(MSG_ELF_TYPE), conv_ehdr_type(ehdr->e_type)); /* - * Line up the flags differently depending on wether we - * received a numeric (e.g. "0x200") or text represent- - * ation (e.g. "[ EF_SPARC_SUN_US1 ]"). + * Line up the flags differently depending on wether we received a + * numeric (e.g. "0x200") or text representation (e.g. + * "[ EF_SPARC_SUN_US1 ]"). */ - flgs = conv_eflags_str(ehdr->e_machine, ehdr->e_flags); + flgs = conv_ehdr_flags(ehdr->e_machine, ehdr->e_flags); if (flgs[0] == '[') - dbg_print(MSG_ORIG(MSG_ELF_FLAGS_FMT), flgs); + dbg_print(lml, MSG_ORIG(MSG_ELF_FLAGS_FMT), flgs); else - dbg_print(MSG_ORIG(MSG_ELF_FLAGS), flgs); + dbg_print(lml, MSG_ORIG(MSG_ELF_FLAGS), flgs); if ((ehdr->e_shnum == 0) && (ehdr->e_shstrndx == SHN_XINDEX)) - dbg_print(MSG_ORIG(MSG_ELFX_ESIZE), EC_ADDR(ehdr->e_entry), - ehdr->e_ehsize); + dbg_print(lml, MSG_ORIG(MSG_ELFX_ESIZE), + EC_ADDR(ehdr->e_entry), ehdr->e_ehsize); else - dbg_print(MSG_ORIG(MSG_ELF_ESIZE), EC_ADDR(ehdr->e_entry), + dbg_print(lml, MSG_ORIG(MSG_ELF_ESIZE), EC_ADDR(ehdr->e_entry), ehdr->e_ehsize, ehdr->e_shstrndx); if ((ehdr->e_shnum == 0) && shdr0 && (shdr0->sh_size != 0)) - dbg_print(MSG_ORIG(MSG_ELFX_SHOFF), EC_OFF(ehdr->e_shoff), + dbg_print(lml, MSG_ORIG(MSG_ELFX_SHOFF), EC_OFF(ehdr->e_shoff), ehdr->e_shentsize); else - dbg_print(MSG_ORIG(MSG_ELF_SHOFF), EC_OFF(ehdr->e_shoff), + dbg_print(lml, MSG_ORIG(MSG_ELF_SHOFF), EC_OFF(ehdr->e_shoff), ehdr->e_shentsize, ehdr->e_shnum); - if (ehdr->e_phnum == PN_XNUM) - dbg_print(MSG_ORIG(MSG_ELFX_PHOFF), EC_OFF(ehdr->e_phoff), - ehdr->e_phentsize); - else - dbg_print(MSG_ORIG(MSG_ELF_PHOFF), EC_OFF(ehdr->e_phoff), - ehdr->e_phentsize, ehdr->e_phnum); + dbg_print(lml, MSG_ORIG(MSG_ELF_PHOFF), EC_OFF(ehdr->e_phoff), + ehdr->e_phentsize, ehdr->e_phnum); - if (shdr0 == NULL || - (ehdr->e_phnum != PN_XNUM && - (ehdr->e_shnum != 0 || shdr0->sh_size))) + if ((ehdr->e_shnum != 0) || (shdr0 == NULL) || + (shdr0->sh_size == 0)) return; /* * If we have Extended ELF headers - print shdr0 */ - dbg_print(MSG_ORIG(MSG_SHD0_TITLE)); - dbg_print(MSG_ORIG(MSG_SHD_ADDR), EC_ADDR(shdr0->sh_addr), - /* LINTED */ - conv_secflg_str(ehdr->e_machine, shdr0->sh_flags)); - if (ehdr->e_shnum == 0) - dbg_print(MSG_ORIG(MSG_SHD0_SIZE), EC_XWORD(shdr0->sh_size), - conv_sectyp_str(ehdr->e_machine, shdr0->sh_type)); - else - dbg_print(MSG_ORIG(MSG_SHD_SIZE), EC_XWORD(shdr0->sh_size), - conv_sectyp_str(ehdr->e_machine, shdr0->sh_type)); - dbg_print(MSG_ORIG(MSG_SHD_OFFSET), EC_OFF(shdr0->sh_offset), + dbg_print(lml, MSG_ORIG(MSG_SHD0_TITLE)); + dbg_print(lml, MSG_ORIG(MSG_SHD_ADDR), EC_ADDR(shdr0->sh_addr), + conv_sec_flags(shdr0->sh_flags)); + dbg_print(lml, MSG_ORIG(MSG_SHD0_SIZE), EC_XWORD(shdr0->sh_size), + conv_sec_type(ehdr->e_machine, shdr0->sh_type)); + dbg_print(lml, MSG_ORIG(MSG_SHD_OFFSET), EC_OFF(shdr0->sh_offset), EC_XWORD(shdr0->sh_entsize)); - if (ehdr->e_shstrndx == SHN_XINDEX && ehdr->e_phnum == PN_XNUM) - dbg_print(MSG_ORIG(MSG_SHD0_LINK1), EC_WORD(shdr0->sh_link), - EC_WORD(shdr0->sh_info)); - else if (ehdr->e_shstrndx == SHN_XINDEX) - dbg_print(MSG_ORIG(MSG_SHD0_LINK2), EC_WORD(shdr0->sh_link), - EC_WORD(shdr0->sh_info)); - else if (ehdr->e_phnum == PN_XNUM) - dbg_print(MSG_ORIG(MSG_SHD0_LINK3), EC_WORD(shdr0->sh_link), - EC_WORD(shdr0->sh_info)); + if (ehdr->e_shstrndx == SHN_XINDEX) + dbg_print(lml, MSG_ORIG(MSG_SHD0_LINK), + EC_WORD(shdr0->sh_link), conv_sec_info(shdr0->sh_info, + shdr0->sh_flags)); else - dbg_print(MSG_ORIG(MSG_SHD0_LINK4), EC_WORD(shdr0->sh_link), - EC_WORD(shdr0->sh_info)); + dbg_print(lml, MSG_ORIG(MSG_SHD_LINK), EC_WORD(shdr0->sh_link), + conv_sec_info(shdr0->sh_info, shdr0->sh_flags)); - dbg_print(MSG_ORIG(MSG_SHD_ALIGN), EC_XWORD(shdr0->sh_addralign)); + dbg_print(lml, MSG_ORIG(MSG_SHD_ALIGN), EC_XWORD(shdr0->sh_addralign)); } diff --git a/usr/src/cmd/sgs/liblddbg/common/entry.c b/usr/src/cmd/sgs/liblddbg/common/entry.c index fdb3da24cb..6a815e0967 100644 --- a/usr/src/cmd/sgs/liblddbg/common/entry.c +++ b/usr/src/cmd/sgs/liblddbg/common/entry.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 1998-1999 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -33,50 +33,48 @@ * Print out a single `entry descriptor' entry. */ void -_Dbg_ent_entry(Half mach, Ent_desc *enp) +Dbg_ent_entry(Lm_list *lml, Half mach, Ent_desc *enp) { Listnode *lnp; char *cp; - dbg_print(MSG_ORIG(MSG_ECR_NAME), + dbg_print(lml, MSG_ORIG(MSG_ECR_NAME), (enp->ec_name ? enp->ec_name : MSG_INTL(MSG_STR_NULL)), - conv_secflg_str(mach, enp->ec_attrmask)); + conv_sec_flags(enp->ec_attrmask)); - dbg_print(MSG_ORIG(MSG_ECR_SEGMENT), + dbg_print(lml, MSG_ORIG(MSG_ECR_SEGMENT), (enp->ec_segment->sg_name ? enp->ec_segment->sg_name : - MSG_INTL(MSG_STR_NULL)), conv_secflg_str(mach, enp->ec_attrbits)); + MSG_INTL(MSG_STR_NULL)), conv_sec_flags(enp->ec_attrbits)); - dbg_print(MSG_ORIG(MSG_ECR_NDX), - EC_WORD(enp->ec_ndx), conv_sectyp_str(mach, enp->ec_type)); + dbg_print(lml, MSG_ORIG(MSG_ECR_NDX), + EC_WORD(enp->ec_ndx), conv_sec_type(mach, enp->ec_type)); if (enp->ec_files.head) { - dbg_print(MSG_ORIG(MSG_ECR_FILES)); + dbg_print(lml, MSG_ORIG(MSG_ECR_FILES)); for (LIST_TRAVERSE(&(enp->ec_files), lnp, cp)) - dbg_print(MSG_ORIG(MSG_ECR_FILE), cp); + dbg_print(lml, MSG_ORIG(MSG_ECR_FILE), cp); } } - /* * Print out all `entrance descriptor' entries. */ void -Dbg_ent_print(Half mach, List *len, Boolean dmode) +Dbg_ent_print(Lm_list *lml, Half mach, List *len, Boolean dmode) { Listnode *lnp; Ent_desc *enp; int ndx = 1; - if (DBG_NOTCLASS(DBG_ENTRY)) + if (DBG_NOTCLASS(DBG_C_ENTRY)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_ECR_TITLE), - (dmode ? MSG_INTL(MSG_ECR_DYNAMIC) : MSG_INTL(MSG_ECR_STATIC))); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_ECR_TITLE), + (dmode ? MSG_INTL(MSG_ECR_DYNAMIC) : MSG_INTL(MSG_ECR_STATIC))); for (LIST_TRAVERSE(len, lnp, enp)) { - dbg_print(MSG_INTL(MSG_ECR_DESC), ndx); - _Dbg_ent_entry(mach, enp); - ndx++; + dbg_print(lml, MSG_INTL(MSG_ECR_DESC), ndx++); + Dbg_ent_entry(lml, mach, enp); } } diff --git a/usr/src/cmd/sgs/liblddbg/common/files.c b/usr/src/cmd/sgs/liblddbg/common/files.c index 8ac5bc2434..29a39c9d99 100644 --- a/usr/src/cmd/sgs/liblddbg/common/files.c +++ b/usr/src/cmd/sgs/liblddbg/common/files.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,150 +20,114 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" -#include "_synonyms.h" - #include <sys/auxv.h> #include <string.h> #include <unistd.h> #include <fcntl.h> #include <limits.h> #include <stdio.h> +#include <libld.h> +#include <rtld.h> +#include <conv.h> #include "msg.h" #include "_debug.h" -#include "libld.h" -#include "rtld.h" - void -Dbg_file_generic(Ifl_desc *ifl) +Dbg_file_analyze(Rt_map *lmp) { - if (DBG_NOTCLASS(DBG_FILES)) - return; - - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_BASIC), ifl->ifl_name, - conv_etype_str(ifl->ifl_ehdr->e_type)); -} + Lm_list *lml = LIST(lmp); -void -Dbg_file_skip(const char *nname, const char *oname) -{ - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; - if (oname && strcmp(nname, oname)) - dbg_print(MSG_INTL(MSG_FIL_SKIP_1), nname, oname); - else - dbg_print(MSG_INTL(MSG_FIL_SKIP_2), nname); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_ANALYZE), NAME(lmp), + conv_dl_mode(MODE(lmp), 1)); } void -Dbg_file_reuse(const char *nname, const char *oname) +Dbg_file_aout(Lm_list *lml, const char *name, ulong_t dynamic, ulong_t base, + ulong_t size, const char *lmid, Aliste lmco) { - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_INTL(MSG_FIL_REUSE), nname, oname); + dbg_print(lml, MSG_INTL(MSG_FIL_AOUT), name); + dbg_print(lml, MSG_INTL(MSG_FIL_DATA_DB), EC_XWORD(dynamic), + EC_ADDR(base)); + dbg_print(lml, MSG_INTL(MSG_FIL_DATA_S), EC_XWORD(size)); + dbg_print(lml, MSG_INTL(MSG_FIL_DATA_LL), lmid, EC_XWORD(lmco)); } void -Dbg_file_archive(const char *name, int again) +Dbg_file_elf(Lm_list *lml, const char *name, ulong_t dynamic, ulong_t base, + ulong_t size, ulong_t entry, const char *lmid, Aliste lmco) { const char *str; - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; - if (again) - str = MSG_INTL(MSG_STR_AGAIN); + if (base == 0) + str = MSG_INTL(MSG_STR_TEMPORARY); else str = MSG_ORIG(MSG_STR_EMPTY); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_ARCHIVE), name, str); + dbg_print(lml, MSG_INTL(MSG_FIL_ELF), name, str); + dbg_print(lml, MSG_INTL(MSG_FIL_DATA_DB), EC_XWORD(dynamic), + EC_ADDR(base)); + dbg_print(lml, MSG_INTL(MSG_FIL_DATA_SE), EC_XWORD(size), + EC_XWORD(entry)); + dbg_print(lml, MSG_INTL(MSG_FIL_DATA_LL), lmid, EC_XWORD(lmco)); } void -Dbg_file_analyze(Rt_map * lmp) +Dbg_file_ldso(Rt_map *lmp, char **envp, auxv_t *auxv, const char *lmid, + Aliste lmco) { - if (DBG_NOTCLASS(DBG_FILES)) - return; + Lm_list *lml = LIST(lmp); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_ANALYZE), NAME(lmp), - conv_dlmode_str(MODE(lmp), 1)); -} - -void -Dbg_file_aout(const char *name, ulong_t dynamic, ulong_t base, ulong_t size) -{ - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_INTL(MSG_FIL_AOUT), name); - dbg_print(MSG_INTL(MSG_FIL_DATA_1), EC_XWORD(dynamic), - EC_ADDR(base), EC_XWORD(size)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_LDSO), PATHNAME(lmp)); + dbg_print(lml, MSG_INTL(MSG_FIL_DATA_DB), EC_NATPTR(DYN(lmp)), + EC_ADDR(ADDR(lmp))); + dbg_print(lml, MSG_INTL(MSG_FIL_DATA_EA), EC_NATPTR(envp), + EC_NATPTR(auxv)); + dbg_print(lml, MSG_INTL(MSG_FIL_DATA_LL), lmid, EC_XWORD(lmco)); + Dbg_util_nl(lml, DBG_NL_STD); } -void -Dbg_file_elf(const char *name, ulong_t dynamic, ulong_t base, - ulong_t size, ulong_t entry, Lmid_t lmid, Aliste lmco) -{ - const char *str; - - if (DBG_NOTCLASS(DBG_FILES)) - return; - - if (base == 0) - str = MSG_INTL(MSG_STR_TEMPORARY); - else - str = MSG_ORIG(MSG_STR_EMPTY); - - dbg_print(MSG_INTL(MSG_FIL_ELF), name, str); - dbg_print(MSG_INTL(MSG_FIL_DATA_1), EC_XWORD(dynamic), - EC_ADDR(base), EC_XWORD(size)); - dbg_print(MSG_INTL(MSG_FIL_DATA_2), EC_XWORD(entry), - EC_XWORD(lmid), EC_XWORD(lmco)); -} void -Dbg_file_ldso(const char *name, ulong_t dynamic, ulong_t base, char **envp, - auxv_t *auxv) +Dbg_file_prot(Rt_map *lmp, int prot) { - if (DBG_NOTCLASS(DBG_FILES)) - return; + Lm_list *lml = LIST(lmp); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_LDSO), name); - dbg_print(MSG_INTL(MSG_FIL_DATA_3), EC_XWORD(dynamic), - EC_ADDR(base)); - dbg_print(MSG_INTL(MSG_FIL_DATA_4), EC_ADDR(envp), EC_ADDR(auxv)); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); -} - -void -Dbg_file_prot(const char *name, int prot) -{ - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_PROT), name, (prot ? '+' : '-')); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_PROT), NAME(lmp), (prot ? '+' : '-')); } void -Dbg_file_delete(const char *name) +Dbg_file_delete(Rt_map *lmp) { - if (DBG_NOTCLASS(DBG_FILES)) + Lm_list *lml = LIST(lmp); + + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_DELETE), name); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_DELETE), NAME(lmp)); } static int hdl_title = 0; @@ -173,7 +136,7 @@ static Msg hdl_str = 0; void Dbg_file_hdl_title(int type) { - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; if (DBG_NOTDETAIL()) return; @@ -198,43 +161,45 @@ Dbg_file_hdl_title(int type) } void -Dbg_file_hdl_collect(Grp_hdl * ghp, const char *name) +Dbg_file_hdl_collect(Grp_hdl *ghp, const char *name) { - const char *str; + Lm_list *lml = ghp->gh_ownlml; + const char *str; - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; if (DBG_NOTDETAIL()) return; - if (ghp->gh_owner) - str = NAME(ghp->gh_owner); + if (ghp->gh_ownlmp) + str = NAME(ghp->gh_ownlmp); else str = MSG_INTL(MSG_STR_ORPHAN); if (hdl_title) { hdl_title = 0; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); } if (name) - dbg_print(MSG_INTL(MSG_FIL_HDL_RETAIN), str, name); + dbg_print(lml, MSG_INTL(MSG_FIL_HDL_RETAIN), str, name); else - dbg_print(MSG_INTL(MSG_FIL_HDL_COLLECT), str, - conv_grphdrflags_str(ghp->gh_flags)); + dbg_print(lml, MSG_INTL(MSG_FIL_HDL_COLLECT), str, + conv_grphdl_flags(ghp->gh_flags)); } void -Dbg_file_hdl_action(Grp_hdl * ghp, Rt_map * lmp, int type) +Dbg_file_hdl_action(Grp_hdl *ghp, Rt_map *lmp, int type) { + Lm_list *lml = LIST(lmp); Msg str; - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; if (DBG_NOTDETAIL()) return; if (hdl_title) { - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); if (hdl_str) { const char *name; @@ -242,12 +207,12 @@ Dbg_file_hdl_action(Grp_hdl * ghp, Rt_map * lmp, int type) * Protect ourselves in case this handle has no * originating owner. */ - if (ghp->gh_owner) - name = NAME(ghp->gh_owner); + if (ghp->gh_ownlmp) + name = NAME(ghp->gh_ownlmp); else name = MSG_INTL(MSG_STR_UNKNOWN); - dbg_print(MSG_INTL(hdl_str), name); + dbg_print(lml, MSG_INTL(hdl_str), name); } hdl_title = 0; } @@ -277,14 +242,14 @@ Dbg_file_hdl_action(Grp_hdl * ghp, Rt_map * lmp, int type) else mode = MSG_ORIG(MSG_STR_EMPTY); - dbg_print(MSG_INTL(str), NAME(lmp), mode); + dbg_print(lml, MSG_INTL(str), NAME(lmp), mode); } } void -Dbg_file_bind_entry(Bnd_desc *bdp) +Dbg_file_bind_entry(Lm_list *lml, Bnd_desc *bdp) { - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; if (DBG_NOTDETAIL()) return; @@ -292,20 +257,21 @@ Dbg_file_bind_entry(Bnd_desc *bdp) /* * Print the dependency together with the modes of the binding. */ - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_BND_ADD), NAME(bdp->b_caller)); - dbg_print(MSG_INTL(MSG_FIL_BND_FILE), NAME(bdp->b_depend), - conv_bindent_str(bdp->b_flags)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_BND_ADD), NAME(bdp->b_caller)); + dbg_print(lml, MSG_INTL(MSG_FIL_BND_FILE), NAME(bdp->b_depend), + conv_bnd_type(bdp->b_flags)); } void -Dbg_file_bindings(Rt_map *lmp, int flag, Word lmflags) +Dbg_file_bindings(Rt_map *lmp, int flag) { const char *str; Rt_map *tlmp; + Lm_list *lml = LIST(lmp); int next = 0; - if (DBG_NOTCLASS(DBG_INIT)) + if (DBG_NOTCLASS(DBG_C_INIT)) return; if (DBG_NOTDETAIL()) return; @@ -315,12 +281,13 @@ Dbg_file_bindings(Rt_map *lmp, int flag, Word lmflags) else str = MSG_ORIG(MSG_SCN_FINI); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_DEP_TITLE), str, conv_binding_str(lmflags)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_DEP_TITLE), str, + conv_bnd_obj(lml->lm_flags)); /* LINTED */ for (tlmp = lmp; tlmp; tlmp = (Rt_map *)NEXT(tlmp)) { - Bnd_desc ** bdpp; + Bnd_desc **bdpp; Aliste off; /* @@ -346,40 +313,42 @@ Dbg_file_bindings(Rt_map *lmp, int flag, Word lmflags) } if (next++) - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); if (DEPENDS(tlmp) == 0) - dbg_print(MSG_INTL(MSG_FIL_DEP_NONE), NAME(tlmp)); + dbg_print(lml, MSG_INTL(MSG_FIL_DEP_NONE), NAME(tlmp)); else { - dbg_print(MSG_INTL(MSG_FIL_DEP_ENT), NAME(tlmp)); + dbg_print(lml, MSG_INTL(MSG_FIL_DEP_ENT), NAME(tlmp)); for (ALIST_TRAVERSE(DEPENDS(tlmp), off, bdpp)) { - dbg_print(MSG_INTL(MSG_FIL_BND_FILE), + dbg_print(lml, MSG_INTL(MSG_FIL_BND_FILE), NAME((*bdpp)->b_depend), - conv_bindent_str((*bdpp)->b_flags)); + conv_bnd_type((*bdpp)->b_flags)); } } } - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); } void -Dbg_file_dlopen(const char *name, const char *from, int mode) +Dbg_file_dlopen(Rt_map *clmp, const char *name, int mode) { - if (DBG_NOTCLASS(DBG_FILES)) + Lm_list *lml = LIST(clmp); + + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_DLOPEN), name, from, - conv_dlmode_str(mode, 1)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_DLOPEN), name, NAME(clmp), + conv_dl_mode(mode, 1)); } void -Dbg_file_dlclose(const char *name, int flag) +Dbg_file_dlclose(Lm_list *lml, const char *name, int flag) { const char *str; - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; if (flag == DBG_DLCLOSE_IGNORE) @@ -387,104 +356,102 @@ Dbg_file_dlclose(const char *name, int flag) else str = MSG_ORIG(MSG_STR_EMPTY); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_DLCLOSE), name, str); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_DLCLOSE), name, str); } void -Dbg_file_dldump(const char *ipath, const char *opath, int flags) +Dbg_file_dldump(Rt_map *lmp, const char *path, int flags) { - if (DBG_NOTCLASS(DBG_FILES)) - return; + Lm_list *lml = LIST(lmp); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_DLDUMP), ipath, opath, - conv_dlflag_str(flags, 0)); -} - -void -Dbg_file_lazyload(const char *file, const char *from, const char *symname) -{ - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_LAZYLOAD), file, from, - _Dbg_sym_dem(symname)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_DLDUMP), NAME(lmp), path, + conv_dl_flag(flags, 0)); } void -Dbg_file_nl() +Dbg_file_lazyload(Rt_map *clmp, const char *fname, const char *sname) { - if (DBG_NOTCLASS(DBG_FILES)) - return; - if (DBG_NOTDETAIL()) + Lm_list *lml = LIST(clmp); + + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_LAZYLOAD), fname, NAME(clmp), + Dbg_demangle_name(sname)); } void -Dbg_file_preload(const char *name) +Dbg_file_preload(Lm_list *lml, const char *name) { - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_INTL(MSG_FIL_PRELOAD), name); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_PRELOAD), name); } void -Dbg_file_needed(const char *name, const char *parent) +Dbg_file_needed(Rt_map *lmp, const char *name) { - if (DBG_NOTCLASS(DBG_FILES)) + Lm_list *lml = LIST(lmp); + + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_NEEDED), name, parent); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_NEEDED), name, NAME(lmp)); } void -Dbg_file_filter(const char *filter, const char *filtee, int config) +Dbg_file_filter(Lm_list *lml, const char *filter, const char *filtee, + int config) { - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); if (config) - dbg_print(MSG_INTL(MSG_FIL_FILTER_1), filter, filtee); + dbg_print(lml, MSG_INTL(MSG_FIL_FILTER_1), filter, filtee); else - dbg_print(MSG_INTL(MSG_FIL_FILTER_2), filter, filtee); + dbg_print(lml, MSG_INTL(MSG_FIL_FILTER_2), filter, filtee); } void -Dbg_file_filtee(const char *filter, const char *filtee, int audit) +Dbg_file_filtee(Lm_list *lml, const char *filter, const char *filtee, int audit) { if (audit) { - if (DBG_NOTCLASS(DBG_AUDITING | DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_AUDITING | DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_FILTEE_3), filtee); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_FILTEE_3), filtee); } else { - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); if (filter) - dbg_print(MSG_INTL(MSG_FIL_FILTEE_1), filtee, filter); + dbg_print(lml, MSG_INTL(MSG_FIL_FILTEE_1), filtee, + filter); else - dbg_print(MSG_INTL(MSG_FIL_FILTEE_2), filtee); + dbg_print(lml, MSG_INTL(MSG_FIL_FILTEE_2), filtee); } } void -Dbg_file_fixname(const char *oname, const char *nname) +Dbg_file_fixname(Lm_list *lml, const char *oname, const char *nname) { - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_FIXNAME), oname, nname); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_FIXNAME), oname, nname); } void @@ -494,7 +461,7 @@ Dbg_file_output(Ofl_desc *ofl) char *oname, *nname, *ofile; int fd; - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; if (DBG_NOTDETAIL()) return; @@ -514,20 +481,20 @@ Dbg_file_output(Ofl_desc *ofl) * write out the present Elf memory image. As this is debugging we * ignore all errors. */ - if ((nname = (char *)malloc(strlen(prefix) + strlen(ofile) + 1)) != 0) { + if ((nname = malloc(strlen(prefix) + strlen(ofile) + 1)) != 0) { (void) strcpy(nname, prefix); (void) strcat(nname, ofile); if ((fd = open(nname, O_RDWR | O_CREAT | O_TRUNC, 0666)) != -1) { - (void) write(fd, ofl->ofl_ehdr, ofl->ofl_size); - close(fd); + (void) write(fd, ofl->ofl_nehdr, ofl->ofl_size); + (void) close(fd); } free(nname); } } void -Dbg_file_config_dis(const char *config, int features) +Dbg_file_config_dis(Lm_list *lml, const char *config, int features) { const char *str; int error = features & ~CONF_FEATMSK; @@ -541,19 +508,20 @@ Dbg_file_config_dis(const char *config, int features) else if (error == DBG_CONF_CORRUPT) str = MSG_INTL(MSG_FIL_CONFIG_ERR_4); else - str = conv_config_str(features); + str = conv_config_feat(features); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_CONFIG_ERR), config, str); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_FRC); + dbg_print(lml, MSG_INTL(MSG_FIL_CONFIG_ERR), config, str); + Dbg_util_nl(lml, DBG_NL_FRC); } void -Dbg_file_config_obj(const char *dir, const char *file, const char *config) +Dbg_file_config_obj(Lm_list *lml, const char *dir, const char *file, + const char *config) { char *name, _name[PATH_MAX]; - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; if (file) { @@ -563,98 +531,144 @@ Dbg_file_config_obj(const char *dir, const char *file, const char *config) } else name = (char *)dir; - dbg_print(MSG_INTL(MSG_FIL_CONFIG), name, config); + dbg_print(lml, MSG_INTL(MSG_FIL_CONFIG), name, config); } -#if !defined(_ELF64) +void +Dbg_file_del_rescan(Lm_list *lml) +{ + if (DBG_NOTCLASS(DBG_C_FILES)) + return; -const Msg -reject[] = { - MSG_STR_EMPTY, - MSG_REJ_MACH, /* MSG_INTL(MSG_REJ_MACH) */ - MSG_REJ_CLASS, /* MSG_INTL(MSG_REJ_CLASS) */ - MSG_REJ_DATA, /* MSG_INTL(MSG_REJ_DATA) */ - MSG_REJ_TYPE, /* MSG_INTL(MSG_REJ_TYPE) */ - MSG_REJ_BADFLAG, /* MSG_INTL(MSG_REJ_BADFLAG) */ - MSG_REJ_MISFLAG, /* MSG_INTL(MSG_REJ_MISFLAG) */ - MSG_REJ_VERSION, /* MSG_INTL(MSG_REJ_VERSION) */ - MSG_REJ_HAL, /* MSG_INTL(MSG_REJ_HAL) */ - MSG_REJ_US3, /* MSG_INTL(MSG_REJ_US3) */ - MSG_REJ_STR, /* MSG_INTL(MSG_REJ_STR) */ - MSG_REJ_UNKFILE, /* MSG_INTL(MSG_REJ_UNKFILE) */ - MSG_REJ_HWCAP_1, /* MSG_INTL(MSG_REJ_HWCAP_1) */ -}; + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_DEL_RESCAN)); +} void -Dbg_file_rejected(Rej_desc *rej) +Dbg_file_mode_promote(Rt_map *lmp, int mode) { - if (DBG_NOTCLASS(DBG_FILES)) + Lm_list *lml = LIST(lmp); + + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(reject[rej->rej_type]), rej->rej_name ? - rej->rej_name : MSG_INTL(MSG_STR_UNKNOWN), conv_reject_str(rej)); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_PROMOTE), NAME(lmp), + conv_dl_mode(mode, 0)); + Dbg_util_nl(lml, DBG_NL_STD); } void -Dbg_file_del_rescan(void) +Dbg_file_cntl(Lm_list *lml, Aliste flmco, Aliste tlmco) { - if (DBG_NOTCLASS(DBG_FILES)) + Lm_cntl *lmc; + Aliste off; + + if (DBG_NOTCLASS(DBG_C_FILES)) return; + if (DBG_NOTDETAIL()) + return; + + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_CNTL_TITLE), EC_XWORD(flmco), + EC_XWORD(tlmco)); + + for (ALIST_TRAVERSE(lml->lm_lists, off, lmc)) { + Rt_map *lmp; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_DEL_RESCAN)); + /* LINTED */ + for (lmp = lmc->lc_head; lmp; lmp = (Rt_map *)NEXT(lmp)) + dbg_print(lml, MSG_ORIG(MSG_CNTL_ENTRY), EC_XWORD(off), + NAME(lmp)); + } + Dbg_util_nl(lml, DBG_NL_STD); } void -Dbg_file_ar_rescan(void) +Dbg_file_ar_rescan(Lm_list *lml) { - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_AR_RESCAN)); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_AR_RESCAN)); + Dbg_util_nl(lml, DBG_NL_STD); } void -Dbg_file_mode_promote(const char *file, int mode) +Dbg_file_ar(Lm_list *lml, const char *name, int again) { - if (DBG_NOTCLASS(DBG_FILES)) + const char *str; + + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_FIL_PROMOTE), file, conv_dlmode_str(mode, 0)); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + if (again) + str = MSG_INTL(MSG_STR_AGAIN); + else + str = MSG_ORIG(MSG_STR_EMPTY); + + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_ARCHIVE), name, str); } void -Dbg_file_cntl(Lm_list *lml, Aliste flmco, Aliste tlmco) +Dbg_file_generic(Lm_list *lml, Ifl_desc *ifl) { - Lm_cntl *lmc; - Aliste off; + if (DBG_NOTCLASS(DBG_C_FILES)) + return; + + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_FIL_BASIC), ifl->ifl_name, + conv_ehdr_type(ifl->ifl_ehdr->e_type)); +} + +static const Msg +reject[] = { + MSG_STR_EMPTY, + MSG_REJ_MACH, /* MSG_INTL(MSG_REJ_MACH) */ + MSG_REJ_CLASS, /* MSG_INTL(MSG_REJ_CLASS) */ + MSG_REJ_DATA, /* MSG_INTL(MSG_REJ_DATA) */ + MSG_REJ_TYPE, /* MSG_INTL(MSG_REJ_TYPE) */ + MSG_REJ_BADFLAG, /* MSG_INTL(MSG_REJ_BADFLAG) */ + MSG_REJ_MISFLAG, /* MSG_INTL(MSG_REJ_MISFLAG) */ + MSG_REJ_VERSION, /* MSG_INTL(MSG_REJ_VERSION) */ + MSG_REJ_HAL, /* MSG_INTL(MSG_REJ_HAL) */ + MSG_REJ_US3, /* MSG_INTL(MSG_REJ_US3) */ + MSG_REJ_STR, /* MSG_INTL(MSG_REJ_STR) */ + MSG_REJ_UNKFILE, /* MSG_INTL(MSG_REJ_UNKFILE) */ + MSG_REJ_HWCAP_1, /* MSG_INTL(MSG_REJ_HWCAP_1) */ +}; - if (DBG_NOTCLASS(DBG_FILES)) +void +Dbg_file_rejected(Lm_list *lml, Rej_desc *rej) +{ + if (DBG_NOTCLASS(DBG_C_FILES)) return; - if (DBG_NOTDETAIL()) + + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(reject[rej->rej_type]), rej->rej_name ? + rej->rej_name : MSG_INTL(MSG_STR_UNKNOWN), conv_reject_desc(rej)); + Dbg_util_nl(lml, DBG_NL_STD); +} + +void +Dbg_file_reuse(Lm_list *lml, const char *nname, const char *oname) +{ + if (DBG_NOTCLASS(DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_CNTL_TITLE), EC_XWORD(flmco), EC_XWORD(tlmco)); + dbg_print(lml, MSG_INTL(MSG_FIL_REUSE), nname, oname); +} - for (ALIST_TRAVERSE(lml->lm_lists, off, lmc)) { - Rt_map *lmp; +void +Dbg_file_skip(Lm_list *lml, const char *oname, const char *nname) +{ + if (DBG_NOTCLASS(DBG_C_FILES)) + return; - if (lmc->lc_head == 0) { - dbg_print(MSG_ORIG(MSG_CNTL_ENTRY), EC_XWORD(off), - MSG_ORIG(MSG_STR_EMPTY)); - continue; - } - for (lmp = lmc->lc_head; lmp; lmp = (Rt_map *)NEXT(lmp)) - dbg_print(MSG_ORIG(MSG_CNTL_ENTRY), EC_XWORD(off), - NAME(lmp)); - } - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + if (oname && strcmp(nname, oname)) + dbg_print(lml, MSG_INTL(MSG_FIL_SKIP_1), nname, oname); + else + dbg_print(lml, MSG_INTL(MSG_FIL_SKIP_2), nname); } -#endif diff --git a/usr/src/cmd/sgs/liblddbg/common/got.c b/usr/src/cmd/sgs/liblddbg/common/got.c index ba2281f306..878a38c549 100644 --- a/usr/src/cmd/sgs/liblddbg/common/got.c +++ b/usr/src/cmd/sgs/liblddbg/common/got.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -32,10 +32,10 @@ static int -comparegotsym(Gottable * gtp1, Gottable * gtp2) +Dbg_got_compare(Gottable *gtp1, Gottable *gtp2) { - Gotndx * gnp1 = >p1->gt_gndx; - Gotndx * gnp2 = >p2->gt_gndx; + Gotndx *gnp1 = >p1->gt_gndx; + Gotndx *gnp2 = >p2->gt_gndx; if (gnp1->gn_gotndx > gnp2->gn_gotndx) return (1); @@ -46,26 +46,27 @@ comparegotsym(Gottable * gtp1, Gottable * gtp2) } void -Dbg_got_display(Gottable * gtp, Ofl_desc *ofl) +Dbg_got_display(Ofl_desc *ofl, Gottable *gtp) { + Lm_list *lml = ofl->ofl_lml; Word gotndx; - if (DBG_NOTCLASS(DBG_GOT)) + if (DBG_NOTCLASS(DBG_C_GOT)) return; if (ofl->ofl_gotcnt == M_GOT_XNumber) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_GOT_TITLE), EC_WORD(ofl->ofl_gotcnt)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_GOT_INFO), EC_WORD(ofl->ofl_gotcnt)); if (DBG_NOTDETAIL()) return; qsort((char *)gtp, ofl->ofl_gotcnt, sizeof (Gottable), - (int(*)(const void *, const void *))comparegotsym); + (int(*)(const void *, const void *))Dbg_got_compare); - dbg_print(MSG_ORIG(MSG_GOT_COLUMNS)); + dbg_print(lml, MSG_ORIG(MSG_GOT_COLUMNS)); for (gotndx = 0; gotndx < ofl->ofl_gotcnt; gotndx++, gtp++) { Sym_desc *sdp; @@ -78,20 +79,20 @@ Dbg_got_display(Gottable * gtp, Ofl_desc *ofl) if (sdp->sd_flags & FLG_SY_SMGOT) refstr = MSG_ORIG(MSG_GOT_SMALL_PIC); else - refstr = MSG_ORIG(MSG_GOT_PIC); + refstr = MSG_ORIG(MSG_GOT_BIG_PIC); if (sdp->sd_name) - name = _Dbg_sym_dem(sdp->sd_name); + name = Dbg_demangle_name(sdp->sd_name); else name = MSG_INTL(MSG_STR_UNKNOWN); if ((sdp->sd_sym->st_shndx == SHN_UNDEF) || (sdp->sd_file == 0)) { - dbg_print(MSG_ORIG(MSG_GOT_FORMAT1), + dbg_print(lml, MSG_ORIG(MSG_GOT_FORMAT1), EC_SWORD(gnp->gn_gotndx), refstr, EC_LWORD(gnp->gn_addend), name); } else { - dbg_print(MSG_ORIG(MSG_GOT_FORMAT2), + dbg_print(lml, MSG_ORIG(MSG_GOT_FORMAT2), EC_SWORD(gnp->gn_gotndx), refstr, EC_LWORD(gnp->gn_addend), sdp->sd_file->ifl_name, name); @@ -99,54 +100,41 @@ Dbg_got_display(Gottable * gtp, Ofl_desc *ofl) } } - -#if !defined(_ELF64) void -Gelf_got_title(uchar_t class) +Elf_got_title(Lm_list *lml) { - if (class == ELFCLASS64) - dbg_print(MSG_ORIG(MSG_GOT_ECOLUMNS_64)); - else - dbg_print(MSG_ORIG(MSG_GOT_ECOLUMNS)); + dbg_print(lml, MSG_INTL(MSG_GOT_TITLE)); } void -Gelf_got_entry(GElf_Ehdr *ehdr, Sword gotndx, GElf_Addr addr, GElf_Xword value, - GElf_Word rshtype, void *rel, const char *sname) +Elf_got_entry(Lm_list *lml, Sword ndx, Addr addr, Xword value, Half mach, + Word type, void *reloc, const char *name) { - GElf_Word rtype; - GElf_Sxword addend; - const char *rstring, * fmt; - - if (rel) { - if (rshtype == SHT_RELA) { - /* LINTED */ - rtype = (GElf_Word)GELF_R_TYPE( - ((GElf_Rela *)rel)->r_info); - addend = ((GElf_Rela *)rel)->r_addend; + Rela *rela; + Rel *rel; + const char *str; + char index[INDEX_STR_SIZE]; + + (void) snprintf(index, INDEX_STR_SIZE, MSG_ORIG(MSG_GOT_INDEX), + EC_SWORD(ndx)); + + if (reloc) { + if (type == SHT_RELA) { + rela = (Rela *)reloc; + str = conv_reloc_type(mach, ELF_R_TYPE(rela->r_info)); } else { - /* LINTED */ - rtype = (GElf_Word)GELF_R_TYPE( - ((GElf_Rel *)rel)->r_info); - addend = 0; + rel = (Rel *)reloc; + str = conv_reloc_type(mach, ELF_R_TYPE(rel->r_info)); } - rstring = conv_reloc_type_str(ehdr->e_machine, rtype); - } else { - addend = 0; - rstring = MSG_ORIG(MSG_STR_EMPTY); - } - if (sname) - sname = _Dbg_sym_dem(sname); - else - sname = MSG_ORIG(MSG_STR_EMPTY); - - if ((int)ehdr->e_ident[EI_CLASS] == ELFCLASS64) - fmt = MSG_ORIG(MSG_GOT_EFORMAT_64); - else - fmt = MSG_ORIG(MSG_GOT_EFORMAT); + if (name) + name = Elf_demangle_name(name); + else + name = MSG_ORIG(MSG_STR_EMPTY); - dbg_print(fmt, EC_SWORD(gotndx), EC_ADDR(addr), EC_XWORD(value), - rstring, EC_SXWORD(addend), sname); + dbg_print(lml, MSG_INTL(MSG_GOT_ENTRY_RE), index, EC_ADDR(addr), + EC_XWORD(value), str, name); + } else + dbg_print(lml, MSG_INTL(MSG_GOT_ENTRY_NR), index, EC_ADDR(addr), + EC_XWORD(value)); } -#endif /* !defined(_ELF64) */ diff --git a/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg b/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg index 1fbfa5981f..c1b0bdce60 100644 --- a/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg +++ b/usr/src/cmd/sgs/liblddbg/common/liblddbg.msg @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ # # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -40,71 +39,114 @@ # TRANSLATION_NOTE - Use the following output in C as a reference, 1. # -# For debugging the runtime linking of an application: -# LD_DEBUG=token1,token2 prog -# enables diagnostics to the stderr. The additional option: -# LD_DEBUG_OUTPUT=file -# redirects the diagnostics to an output file created using -# the specified name and the process id as a suffix. All -# diagnostics are prepended with the process id. -# -# For debugging the link-editing of an application: -# LD_OPTIONS=-Dtoken1,token2 cc -o prog ... -# or, -# ld -Dtoken1,token2 -o prog ... -# where placement of -D on the command line is significant, -# and options can be switched off by prepending with `!'. All -# diagnostics are prepended with the string `debug', and -# optionally with the output file basename or fullname, and -# its class, if the `name' or `fullname', and `class' tokens -# are specified respectively. +# Runtime Linking +# Diagnostics that trace the runtime linking of an application can be +# enabled to stderr by using the environment variable setting: +# LD_DEBUG=token1,token2 +# Alternatively, the diagnostics can be redirected to an output file +# using the additional environment variable: +# LD_DEBUG_OUTPUT=file +# The output file is given the specified name and the process id as a +# suffix. # -# The next 13 messages makes the above output in C locale. -# Use the tabs as alignment characters as needed. +# By default, all diagnostics are prepended with the process id, +# together with the thread id. Note, all applications are effectively +# thread aware, and once thread capabilities are enabled, even a single +# threaded application is labeled as thread 1. # -@ MSG_USE_RTLD_A "\t\t For debugging the runtime linking of an \ - application:" +# The token `lmid' prepends a link-map list identifier to each +# diagnostic. # -# Be warned that the next two messages make a sentence. -# That is: -# LD_DEBUG=token1,token2 prog -# enables diagnostics to the stderr. The additional option: -# So do not translate the msgid separately, but handle them together -# Same kind of sentences appear in this block of messages. +# The tokens `base', `ldso' and `newlm[0-9]*' can be used to isolate +# diagnostics to the associated link-map lists. Note, by default, any +# diagnostics associated with loading components for the runtime linker +# itself are suppressed, unless `ldso' is explicitly specified. +# +# Link-Editing +# Diagnostics that trace the link-editing of an application can be +# enabled to stderr using the -D option: +# ld -Dtoken1,token2 -o prog ... +# As the -D option can also be meaningful to compiler drivers, an +# alternative mechanism to enable diagnostics is to use the environment +# variable: +# LD_OPTIONS=-Dtoken1,token2 cc -o prog ... # -@ MSG_USE_RTLD_B "\t\t\tLD_DEBUG=token1,token2 prog" -@ MSG_USE_RTLD_C "\t\t enables diagnostics to the stderr. \ - The additional option:" -@ MSG_USE_RTLD_D "\t\t\tLD_DEBUG_OUTPUT=file" -@ MSG_USE_RTLD_E "\t\t redirects the diagnostics to an output file \ - created using" -@ MSG_USE_RTLD_F "\t\t the specified name and the process id as a \ - suffix. All" -@ MSG_USE_RTLD_G "\t\t diagnostics are prepended with the process id." - -@ MSG_USE_LD_A "\t\t For debugging the link-editing of an application:" -@ MSG_USE_LD_B "\t\t\tLD_OPTIONS=-Dtoken1,token2 cc -o prog ..." -@ MSG_USE_LD_C "\t\t or," -@ MSG_USE_LD_D "\t\t\tld -Dtoken1,token2 -o prog ..." -@ MSG_USE_LD_E "\t\t where placement of -D on the command line is \ - significant," -@ MSG_USE_LD_F "\t\t and options can be switched off by prepending \ - with `!'. All" -@ MSG_USE_LD_G "\t\t diagnostics are prepended with the string \ - `debug', and" -@ MSG_USE_LD_H "\t\t optionally with the output file basename or \ - fullname, and" -@ MSG_USE_LD_I "\t\t its class, if the `name' or `fullname', and \ - `class' tokens" -@ MSG_USE_LD_J "\t\t are specified respectively." +# The use of -D on the link-edit command line is significant. +# Diagnostics are enabled when a debug token is first encountered, and +# can be switched off by prepending the token with `!'. # -# END OF reference 1 +# By default, all diagnostics are prepended with the string `debug'. # +# The tokens `name', `fullname' and `class' can be used to prepend the +# output file basename, fullname, and class respectively, to each +# diagnostic. -# TRANSLATION_NOTE -# The next 23 messages make the following usage table. -# Tabs are used for alignment. +# TRANSLATION_NOTE - The next series of messages makes the above output in C +# locale. Use tabs and space alignment characters as needed. +# +@ MSG_USE_RTLD_A "Runtime Linking" +@ MSG_USE_RTLD_B " Diagnostics that trace the runtime linking of an \ + application can be" +@ MSG_USE_RTLD_C " enabled to stderr by using the environment \ + variable setting:" +@ MSG_USE_RTLD_D " LD_DEBUG=token1,token2 app ..." +@ MSG_USE_RTLD_E " Alternatively, the diagnostics can be redirected \ + to an output file" +@ MSG_USE_RTLD_F " using the additional environment variable:" +@ MSG_USE_RTLD_G " LD_DEBUG_OUTPUT=file" +@ MSG_USE_RTLD_H " The output file is given the specified name and \ + the process id as a" +@ MSG_USE_RTLD_I " suffix." +@ MSG_USE_RTLD_J " By default, all diagnostics are prepended with \ + the process id," +@ MSG_USE_RTLD_K " together with the thread id. Note, all \ + applications are effectively" +@ MSG_USE_RTLD_L " thread aware, and once thread capabilities are \ + enabled, even a single" +@ MSG_USE_RTLD_M " threaded application is labeled as thread 1." +@ MSG_USE_RTLD_N " The token `lmid' prepends a link-map list \ + identifier to each" +@ MSG_USE_RTLD_O " diagnostic." +@ MSG_USE_RTLD_P " The tokens `base', `ldso' and `newlm[0-9]*' can \ + be used to isolate" +@ MSG_USE_RTLD_Q " diagnostics to the associated link-map lists. \ + Note, by default, any" +@ MSG_USE_RTLD_R " diagnostics associated with loading components \ + for the runtime linker" +@ MSG_USE_RTLD_S " itself are suppressed, unless `ldso' is \ + explicitly specified." + +@ MSG_USE_LD_A "Link-Editing" +@ MSG_USE_LD_B " Diagnostics that trace the link-editing of an \ + application can be" +@ MSG_USE_LD_C " enabled to stderr using the -D option:" +@ MSG_USE_LD_D " ld -Dtoken1,token2 -o prog ..." +@ MSG_USE_LD_E " As the -D option can also be meaningful to \ + compiler drivers, an" +@ MSG_USE_LD_F " alternative mechanism to enable diagnostics is to \ + use the environment" +@ MSG_USE_LD_G " variable:" +@ MSG_USE_LD_H " LD_OPTIONS=-Dtoken1,token2 cc -o prog ..." +@ MSG_USE_LD_I " The use of -D on the link-edit command line is \ + significant." +@ MSG_USE_LD_J " Diagnostics are enabled when a debug token is \ + first encountered, and" +@ MSG_USE_LD_K " can be switched off by prepending the token \ + with `!'." +@ MSG_USE_LD_L " By default, all diagnostics are prepended with \ + the string `debug'." +@ MSG_USE_LD_M " The tokens `name', `fullname' and `class' can be \ + used to prepend" +@ MSG_USE_LD_N " the output file basename, fullname, and class \ + respectively, to each" +@ MSG_USE_LD_O " diagnostic." + +# TRANSLATION_NOTE - End of reference 1 + + +# TRANSLATION_NOTE - The next series of messages makes the following usage +# table. Use tabs and space alignment characters as needed. # # args display input argument processing (ld only) # audit display runtime link-audit processing (ld.so.1 only) @@ -190,6 +232,10 @@ shows actual" @ MSG_USE_LIBS_2 "\t\t library lookup (-l) processing" +# TRANSLATION_NOTE -- do not translate the first token `lmid'. +@ MSG_USE_LMID "lmid\t display link-map list identifier \ + (ld.so.1 only)" + # TRANSLATION_NOTE -- do not translate the first token `long'. @ MSG_USE_LONG "long\t display long object names without truncation" @@ -219,7 +265,7 @@ @ MSG_USE_SYMBOLS_2 "\t\t symbol table addition and resolution (ld only)" # TRANSLATION_NOTE -- do not translate the first token `statistics'. -@ MSG_USE_STATISTICS "statistics display processing statistics (ld only)" +@ MSG_USE_STATS "statistics display processing statistics (ld only)" # TRANSLATION_NOTE -- do not translate the first token `strtab'. @ MSG_USE_STRTAB "strtab\t display information about string table \ @@ -247,7 +293,7 @@ # NOTE: these are used by appcert(1) and lari(1), use care when changing. @ MSG_BND_BASIC "binding file=%s to file=%s: symbol `%s'" -@ MSG_BND_PLT "binding file=%s (%#llx:%#llx) at plt[%d]:%s to \ +@ MSG_BND_PLT "binding file=%s (%#llx:%#llx) at plt[%lld]:%s to \ file=%s (%#llx:%#llx): symbol `%s'%s" @ MSG_BND_DLSYM "binding file=%s (dlsym) to file=%s \ (%#llx:%#llx): symbol `%s'%s" @@ -257,7 +303,9 @@ @ MSG_BND_WEAK_2 "binding file=%s (%#llx:%#llx) to 0x0 \ (undefined weak): symbol `%s'" -@ MSG_BND_PROFILE " profiling symbol[%d]; call count=%d" +@ MSG_BND_PLTPAD_TO " pltpad: %#llx: file=%s bound to file=%s: \ + symbol `%s'" +@ MSG_BND_PLTPAD_FROM " pltpad: %#llx: bound from file=%s: symbol `%s'" @ MSG_BND_PSUM_SPARCV9 "Summary of PLT types bound: 21d=%d, 24d=%d, u32=%d, \ u44=%d, full=%d, far=%d, Total=%d" @@ -271,12 +319,15 @@ @ MSG_REL_COLLECT "collecting input relocations: section=%s, file=%s" @ MSG_REL_ACTIVE "performing active relocations" @ MSG_REL_CREATING "creating output relocations" -@ MSG_REL_RELOC_START "relocation processing: file=%s%s" -@ MSG_REL_RELOC_FINISH "relocation processing: file=%s; finished%s" -@ MSG_REL_RELOC_NONE "relocation processing: file=%s%s; nothing to do" +@ MSG_REL_START "relocation processing: file=%s%s" +@ MSG_REL_FINISH "relocation processing: file=%s; finished%s" +@ MSG_REL_NONE "relocation processing: file=%s%s; nothing to do" -@ MSG_REL_RELOC_PLT " (plt processing only)" -@ MSG_REL_RELOC_FAIL " (failed)" +@ MSG_REL_PLT " (plt processing only)" +@ MSG_REL_FAIL " (failed)" + +@ MSG_REL_BADROFFSET "<offset lies outside memory image; \ + relocation discarded>" @ MSG_REL_TRANS "relocation transition: offset: %#llx old reloc: %s \ new reloc: %s symbol `%s'" @@ -284,11 +335,6 @@ relocation type=%s offset=0x%llx; relocation discarded" @ MSG_REL_COPY "copy data from file=%s to file=%s: symbol `%s'%s" -# Dynamic section messages - -@ MSG_DYN_TITLE " index tag value" -@ MSG_DYN_ENTRY "%10.10s %-15.15s %-#14llx %s" - # Entrance criteria messages @ MSG_ECR_TITLE "%s Entrance Descriptor List (available)" @@ -297,13 +343,21 @@ @ MSG_ECR_DESC "entrance descriptor[%d]" -# Elf section messages +# Elf Data (section) messages +# TRANSLATION_NOTE - the following two entries provide for a series of one or +# more standard 32-bit Elf_Data entries that align with the initial title. -@ MSG_ELF_TITLE " addr type size offset al file" -@ MSG_ELF_ENTRY " %3s %#10llx %-5s %#10llx %#8llx %2lld %s%s" -@ MSG_ELF_HEADER "ELF Header" -@ MSG_ELF_IGNSCN " (section ignored)" +@ MSG_EDATA_TITLE_32 " addr type size offset al file" +@ MSG_EDATA_ENTRY_32 " %3s %#10llx %-5s %#10llx %#8llx %2lld %s%s" + +# TRANSLATION_NOTE - the following two entries provide for a series of one or +# more standard 64-bit Elf_Data entries that align with the initial title. +@ MSG_EDATA_TITLE_64 " addr type \ + size offset al file" +@ MSG_EDATA_ENTRY_64 " %3s %#18llx %-5s %#18llx %#8llx %2lld %s%s" + +@ MSG_EDATA_IGNSCN " (section ignored)" # File messages @@ -336,10 +390,11 @@ @ MSG_FIL_CONFIG "file=%s [ ELF ]; configuration alternate found: %s" -@ MSG_FIL_DATA_1 " dynamic: %#10llx base: %#10llx size: %#10llx" -@ MSG_FIL_DATA_2 " entry: %#10llx lmid: %#10llx lmco: %#10llx" -@ MSG_FIL_DATA_3 " dynamic: %#10llx base: %#10llx" -@ MSG_FIL_DATA_4 " envp: %#10llx auxv: %#10llx" +@ MSG_FIL_DATA_DB " dynamic: %#18llx base: %#18llx" +@ MSG_FIL_DATA_SE " size: %#18llx entry: %#18llx" +@ MSG_FIL_DATA_S " size: %#18llx" +@ MSG_FIL_DATA_LL " lmid: %18.18s lmco: %#18llx" +@ MSG_FIL_DATA_EA " envp: %#18llx auxv: %#18llx" @ MSG_FIL_BND_ADD "file=%s; add binding to:" @ MSG_FIL_BND_FILE " file=%s %s" @@ -444,20 +499,21 @@ # Move messages -@ MSG_MV_ADJEXPAND1 "for symbol=%s new roffset=0x%llx" -@ MSG_MV_ADJMOVE1 "for symbol=%s roffset(from/to)=\ - (0x%llx/0x%llx)" -@ MSG_MV_OUTSCTADJ1 "adjusting addend for symbol=%s" -@ MSG_MV_MOVEDATA "file=%s processing move data" -@ MSG_MV_EXPAND0 "expanding %s into .SUNW_data1: %s" -@ MSG_MV_OUTMOVE0 "copying move entries for %s into .SUNW_move" -@ MSG_MV_EXPAND1 "\t 0x%llx\t0x%llx (expanded)" +@ MSG_MOVE_FILE "file=%s processing move data" +@ MSG_MOVE_TITLE2 " address value repeat stride symbol" +@ MSG_MOVE_ENTRY2 " in %#10llx %#10llx %6d %6d %s" +@ MSG_MOVE_EXPAND " %#10llx %#10llx (expanded)" + +@ MSG_MOVE_ADJEXPAND "for symbol=%s roffset: new=0x%llx" +@ MSG_MOVE_ADJMOVE "for symbol=%s roffset: from=0x%llx, to=0x%llx" +@ MSG_MOVE_OUTSCTADJ "adjusting addend for symbol=%s" +@ MSG_MOVE_PAREXPN "expanding %s into .SUNW_data1: %s" +@ MSG_MOVE_OUTMOVE "copying move entries for %s into .SUNW_move" +@ MSG_MOVE_INPUT "collecting move entries: file=%s" -@ MSG_MOVE_INPUT1 "collecting move entries: file=%s" @ MSG_MOVE_TITLE1 "\t i/o offset\tvalue\trepeat\tstride\tsymbol" -@ MSG_MOVE_TITLE2 "\t address\tvalue\trepeat\tstride\tsymbol" -@ MSG_MOVE_MVENTRY1 "\t in 0x%llx\t0x%llx\t0x%x\t0x%x\t%s" -@ MSG_MOVE_MVENTRY2 "\t out 0x%llx\t0x%llx\t0x%x\t0x%x\t%s" +@ MSG_MOVE_ENTRY1IN "\t in 0x%llx\t0x%llx\t0x%x\t0x%x\t%s" +@ MSG_MOVE_ENTRY1OUT "\t out 0x%llx\t0x%llx\t0x%x\t0x%x\t%s" # Section messages @@ -533,10 +589,10 @@ @ MSG_SYM_RETAINING "symbol table processing; retaining local symbols" @ MSG_SYM_VERSION "symbol table processing; adding version symbols" -@ MSG_SYM_BASIC "symbol[%lld]=%s" -@ MSG_SYM_ADDING "symbol[%lld]=%s (global); adding" +@ MSG_SYM_BASIC "symbol[%d]=%s" +@ MSG_SYM_ADDING "symbol[%d]=%s (global); adding" @ MSG_SYM_SECTION "symbol[%d]=%s (section); segment=%s" -@ MSG_SYM_RESOLVING "symbol[%lld]=%s (global); resolving [%d][%d]" +@ MSG_SYM_RESOLVING "symbol[%d]=%s (global); resolving [%d][%d]" @ MSG_SYM_UPDATE "symbol=%s; updated" @ MSG_SYM_CREATE "symbol=%s; creating" @ MSG_SYM_REDUCING "symbol=%s; reducing to local" @@ -554,19 +610,16 @@ @ MSG_SYM_LAZY_RESCAN "rescanning for lazy dependencies for symbol: %s" -# Syminfo strings -@ MSG_SYMI_TITLE1 "syminfo information" -@ MSG_SYMI_TITLE2 " index flgs bound to symbol" -@ MSG_SYMI_SELF "<self>" -@ MSG_SYMI_PARENT "<parent>" -@ MSG_SYMI_EXTERN "<extern>" +# Syminfo string + +@ MSG_SYMINFO_INFO "syminfo information" # Version strings @ MSG_VER_AVAIL_1 "version availability: file=%s" @ MSG_VER_AVAIL_2 " available version selected from" -@ MSG_VER_DEF_1 "version definition processing: file=%s" -@ MSG_VER_NEED_1 "version needed processing: file=%s" +@ MSG_VER_DEF_TITLE "version definition processing: file=%s" +@ MSG_VER_NEED_TITLE "version needed processing: file=%s" @ MSG_VER_NOINTERFACE "version definition has no interface symbols: %s" # SHF_ORDERED related messages. Token used is sections. @@ -601,7 +654,7 @@ # GOT Messages -@ MSG_GOT_TITLE "Global Offset Table information: (%u entries)" +@ MSG_GOT_INFO "Global Offset Table information: (%u entries)" # TRANSLATION_NOTE # Do not translate .init or .fini, they represent reserved section names. @@ -642,7 +695,6 @@ @ MSG_STR_INITIAL "initialized" @ MSG_STR_IN " in" @ MSG_STR_OUT "out" -@ MSG_STR_ERROR "error" @ MSG_STR_ACT "act" @ MSG_STR_OLD "old" @ MSG_STR_NEW "new" @@ -662,12 +714,6 @@ @ MSG_STR_COPYZERO " (copy zero's unnecessary)" @ MSG_STR_TEMPORARY " (temporary)" -# PLT padding messages - -@ MSG_REL_PADBOUNDTO " pltpad file=%s pad: 0x%8.8llx bound to \ - file=%s symbol `%s'" -@ MSG_REL_PADBINDTO " pltpad file=%s symbol `%s' binds to pad: 0x%8.8llx" - # TLS related messages @ MSG_TLS_STATBLOCK1 "static TLS module: [%2d] %s" @@ -692,10 +738,8 @@ @ MSG_STATS_RELOCS_IN " Relocations input: records=%-10lld applied=%lld" # Hardware/Software capabilities messages -@ MSG_CAP_ELF_TITLE " index tag value" -@ MSG_CAP_ELF_ENTRY "%10.10s %-15.15s %s" -@ MSG_CAP_HW_1 "hardware capabilities - %s" +@ MSG_CAP_VAL_HW1 "hardware capabilities - %s" @ MSG_CAP_SEC_TITLE "hardware/software capabilities; input file=%s" @ MSG_CAP_SEC_ENTRY "%12.12s %-15.15s %s" @@ -705,6 +749,241 @@ @ MSG_CAP_HWFILTR_1 "dir=%s; hardware capability directory filtered by %s" @ MSG_CAP_HWFILTR_2 "dir=%s; no hardware capability objects found" + + +@ MSG_ELF_HEADER "ELF Header" + +# Capabilities entries. +# TRANSLATION_NOTE - the following two entries provide for a series of one or +# more capabilities table entries that align with the initial title. + +@ MSG_CAP_ELF_TITLE " index tag value" +@ MSG_CAP_ELF_ENTRY "%10.10s %-15.15s %s" + + +# Dynamic entries. +# TRANSLATION_NOTE - the following two entries provide for a series of one or +# more dynamic table entries that align with the initial title. + +@ MSG_DYN_TITLE " index tag value" +@ MSG_DYN_ENTRY "%10.10s %-16.16s %-#16llx %s" + + +# Symbol table entries. +# TRANSLATION_NOTE - the following entries provide for a series of one or more +# standard 32-bit symbol table entries that align with the initial title. + +@ MSG_SYM_EFS_TITLE_32 " index value size type bind \ + oth ver shndx name" +@ MSG_SYM_LDS_TITLE_32 " value size type bind \ + oth ver shndx" +@ MSG_SYM_EFS_ENTRY_32 "%10.10s %10.10s 0x%8.8x %4s %4s %2s %4d \ + %-14.14s %s" + +# TRANSLATION_NOTE - the following entries provide for a series of one or more +# long 32-bit symbol table entries that align with the initial title. + +@ MSG_SYM_EFL_TITLE_32 " index value size type bind \ + oth ver shndx / name" +@ MSG_SYM_LDL_TITLE_32 " value size type bind \ + oth ver shndx" +@ MSG_SYM_EFL_ENTRY_32 "%10.10s %10.10s 0x%8.8x %4s %4s %2s %4d \ + %-14s %s" + +# TRANSLATION_NOTE - the following entries provide for a series of one or more +# standard 64-bit symbol table entries that align with the initial title. + +@ MSG_SYM_EFS_TITLE_64 " index value size \ + type bind oth ver shndx name" +@ MSG_SYM_LDS_TITLE_64 " value size \ + type bind oth ver shndx" +@ MSG_SYM_EFS_ENTRY_64 "%10.10s %18.18s 0x%16.16llx %4s %4s %2s %4d \ + %-14.14s %s" + +# TRANSLATION_NOTE - the following entries provide for a series of one or more +# long 64-bit symbol table entries that align with the initial title. + +@ MSG_SYM_EFL_TITLE_64 " index value size \ + type bind oth ver shndx / name" +@ MSG_SYM_LDL_TITLE_64 " value size \ + type bind oth ver shndx" +@ MSG_SYM_EFL_ENTRY_64 "%10.10s %18.18s 0x%16.16llx %4s %4s %2s %4d \ + %-14s %s" + + +# Syminfo entries. +# TRANSLATION_NOTE - the following two entries provide for a series of one or +# more symbol information table entries that align with the initial title. + +@ MSG_SYMINFO_TITLE " index flags \ + bound to symbol" +@ MSG_SYMINFO_ENTRY "%10.10s %-4s %7s %-24s %s" + +@ MSG_SYMINFO_SELF "<self>" +@ MSG_SYMINFO_PARENT "<parent>" +@ MSG_SYMINFO_EXTERN "<extern>" + + +# Global offset table entries. +# TRANSLATION_NOTE - the following two entries provide for a series of one or +# more 32-bit got table entries that align with the initial title. + +@ MSG_GOT_TITLE_32 " index addr value \ + pending relocation" +@ MSG_GOT_ENTRY_RE_32 "%10.10s 0x%08llx 0x%08llx %-24s %s" +@ MSG_GOT_ENTRY_NR_32 "%10.10s 0x%08llx 0x%08llx" + +# TRANSLATION_NOTE - the following two entries provide for a series of one or +# more 64-bit got table entries that align with the initial title. + +@ MSG_GOT_TITLE_64 " index addr \ + value pending relocation" +@ MSG_GOT_ENTRY_RE_64 "%10.10s 0x%016llx 0x%016llx %-24s %s" +@ MSG_GOT_ENTRY_NR_64 "%10.10s 0x%016llx 0x%016llx" + + +# Version table entries. +@ MSG_VER_DEF " index version dependency" +@ MSG_VER_NEED " file version" + +@ MSG_VER_LINE_1 "%10.10s %-26.26s %-20s %s" +@ MSG_VER_LLINE_1 "%10s %-26s %-20s %s" +@ MSG_VER_LINE_2 "%47s %s" +@ MSG_VER_LINE_3 "%38s %-20s %s" +@ MSG_VER_LINE_4 " %s" +@ MSG_VER_LINE_5 " %-26.26s %s" +@ MSG_VER_LLINE_5 " %-26s %s" + + +# Relocation entries. +# TRANSLATION_NOTE - the following strings are used by elfdump(1). These +# strings provide for a series of one or more 32-bit relocation table entries, +# using truncated section names, that align with one of the initial titles. + +@ MSG_REL_EFSA_TITLE_32 " type offset addend \ + section symbol" +@ MSG_REL_EFSN_TITLE_32 " type offset \ + section symbol" +@ MSG_REL_EFSA_ENTRY_32 " %-24s %#10llx %#10llx %-14.14s %s" +@ MSG_REL_EFSN_ENTRY_32 " %-24s %#10llx %-14.14s %s" + +# TRANSLATION_NOTE - the following strings are used by elfdump(1). These +# strings provide for a series of one or more 32-bit relocation table entries, +# using long section names, that align with one of the initial titles. + +@ MSG_REL_EFLA_TITLE_32 " type offset addend \ + section / symbol" +@ MSG_REL_EFLN_TITLE_32 " type offset \ + section / symbol" +@ MSG_REL_EFLA_ENTRY_32 " %-24s %#10llx %#10llx %-14s %s" +@ MSG_REL_EFLN_ENTRY_32 " %-24s %#10llx %-14s %s" + + +# TRANSLATION_NOTE - the following strings are used by ld.so.1(1). These +# strings provide for a series of one or more 32-bit relocation table entries, +# that align with the initial titles. + +@ MSG_REL_RTA_TITLE_32 " type offset \ + addend symbol" +@ MSG_REL_RTN_TITLE_32 " type offset \ + value symbol" +@ MSG_REL_RTV_TITLE_32 " value" +@ MSG_REL_RTA_ENTRY_32 " %5s %-24s %#10llx %#10llx %s" +@ MSG_REL_RTN_ENTRY_32 " %5s %-24s %#10llx %s" +@ MSG_REL_RT_APLVAL_32 " apply %#10llx %#10llx" +@ MSG_REL_RT_APLREG_32 " apply %10.10s %#10llx" + + +# TRANSLATION_NOTE - the following strings are used by ld(1). These strings +# provide for a series of one or more 32-bit relocation table entries, using +# truncated section names, that align with one of the initial titles. + +@ MSG_REL_LDSA_TITLE_32 " type \ + offset addend section symbol" +@ MSG_REL_LDSN_TITLE_32 " type \ + offset section symbol" +@ MSG_REL_LDSV_TITLE_32 " type \ + offset value section symbol" +@ MSG_REL_LDSA_ENTRY_32 " %5s %-24s %#10llx %#10llx %-14.14s %s %s" +@ MSG_REL_LDSN_ENTRY_32 " %5s %-24s %#10llx %-14.14s %s %s" + +# TRANSLATION_NOTE - the following strings are used by ld(1). These strings +# provide for a series of one or more 32-bit relocation table entries, using +# long section names, that align with one of the initial titles. + +@ MSG_REL_LDLA_TITLE_32 " type \ + offset addend section / symbol" +@ MSG_REL_LDLN_TITLE_32 " type \ + offset section / symbol" +@ MSG_REL_LDLV_TITLE_32 " type \ + offset value section / symbol" +@ MSG_REL_LDLA_ENTRY_32 " %5s %-24s %#10llx %#10llx %-14s %s %s" +@ MSG_REL_LDLN_ENTRY_32 " %5s %-24s %#10llx %-14s %s %s" + + +# TRANSLATION_NOTE - the following strings are used by elfdump(1). These +# strings provide for a series of one or more 64-bit relocation table entries, +# using truncated section names, that align with one of the initial titles. + +@ MSG_REL_EFSA_TITLE_64 " type \ + offset addend section symbol" +@ MSG_REL_EFSN_TITLE_64 " type \ + offset section symbol" +@ MSG_REL_EFSA_ENTRY_64 " %-24s %#18llx %#18llx %-14.14s %s" +@ MSG_REL_EFSN_ENTRY_64 " %-24s %#18llx %-14.14s %s" + +# TRANSLATION_NOTE - the following strings are used by elfdump(1). These +# strings provide for a series of one or more 64-bit relocation table entries, +# using long section names, that align with one of the initial titles. + +@ MSG_REL_EFLA_TITLE_64 " type \ + offset addend section / symbol" +@ MSG_REL_EFLN_TITLE_64 " type \ + offset section / symbol" +@ MSG_REL_EFLA_ENTRY_64 " %-24s %#18llx %#18llx %-14s %s" +@ MSG_REL_EFLN_ENTRY_64 " %-24s %#18llx %-14s %s" + + +# TRANSLATION_NOTE - the following strings are used by ld.so.1(1). These +# strings provide for a series of one or more 64-bit relocation table entries, +# that align with the initial titles. + +@ MSG_REL_RTA_TITLE_64 " type \ + offset addend symbol" +@ MSG_REL_RTN_TITLE_64 " type \ + offset value symbol" +@ MSG_REL_RTV_TITLE_64 " value" +@ MSG_REL_RTA_ENTRY_64 " %5s %-24s %#18llx %#18llx %s" +@ MSG_REL_RTN_ENTRY_64 " %5s %-24s %#18llx %s" +@ MSG_REL_RT_APLVAL_64 " apply %#18llx %#18llx" +@ MSG_REL_RT_APLREG_64 " apply %18.18s %#18llx" + +# TRANSLATION_NOTE - the following strings are used by ld(1). These strings +# provide for a series of one or more 64-bit relocation table entries, using +# truncated section names, that align with one of the initial titles. + +@ MSG_REL_LDSA_TITLE_64 " type \ + offset addend section symbol" +@ MSG_REL_LDSN_TITLE_64 " type \ + offset section symbol" +@ MSG_REL_LDSV_TITLE_64 " type \ + offset value section symbol" +@ MSG_REL_LDSA_ENTRY_64 " %5s %-24s %#18llx %#18llx %-14.14s %s %s" +@ MSG_REL_LDSN_ENTRY_64 " %5s %-24s %#18llx %-14.14s %s %s" + +# TRANSLATION_NOTE - the following strings are used by ld(1). These strings +# provide for a series of one or more 64-bit relocation table entries, using +# long section names, that align with one of the initial titles. + +@ MSG_REL_LDLA_TITLE_64 " type \ + offset addend section / symbol" +@ MSG_REL_LDLN_TITLE_64 " type \ + offset section / symbol" +@ MSG_REL_LDLV_TITLE_64 " type \ + offset value section / symbol" +@ MSG_REL_LDLA_ENTRY_64 " %5s %-24s %#18llx %#18llx %-14s %s %s" +@ MSG_REL_LDLN_ENTRY_64 " %5s %-24s %#18llx %-14s %s %s" + @ _END_ # Debug enabling tokens (for now these are untranslated) @@ -714,13 +993,11 @@ @ MSG_TOK_BINDINGS "bindings" @ MSG_TOK_CAP "cap" @ MSG_TOK_BASIC "basic" -@ MSG_TOK_DETAIL "detail" @ MSG_TOK_ENTRY "entry" @ MSG_TOK_FILES "files" @ MSG_TOK_HELP "help" @ MSG_TOK_INIT "init" @ MSG_TOK_LIBS "libs" -@ MSG_TOK_LONG "long" @ MSG_TOK_MAP "map" @ MSG_TOK_RELOC "reloc" @ MSG_TOK_SECTIONS "sections" @@ -734,12 +1011,18 @@ @ MSG_TOK_MOVE "move" @ MSG_TOK_DEMANGLE "demangle" @ MSG_TOK_STRTAB "strtab" -@ MSG_TOK_STATISTICS "statistics" +@ MSG_TOK_STATS "statistics" @ MSG_TOK_UNUSED "unused" +@ MSG_TOK_DETAIL "detail" +@ MSG_TOK_LONG "long" @ MSG_TOK_NAME "name" @ MSG_TOK_FULLNAME "fullname" @ MSG_TOK_CLASS "class" +@ MSG_TOK_LMID "lmid" +@ MSG_TOK_BASE "base" +@ MSG_TOK_LDSO "ldso" +@ MSG_TOK_NEWLM "newlm" # The following strings represent reserved words, files, pathnames and symbols. # Reference to this strings is via the MSG_ORIG() macro, and thus no message @@ -764,7 +1047,6 @@ @ MSG_FMT_PATH "%s/%s" @ MSG_PTH_OBJECT "/tmp/ld.so-OBJECT-" -@ MSG_FIL_RTLD "ld.so.1" @ MSG_SUNW_OST_SGS "SUNW_OST_SGS" @@ -776,55 +1058,10 @@ @ MSG_ECR_FILES " ec_files:" @ MSG_ECR_FILE " %s" -# Elf section messages - -@ MSG_ELF_MAGIC " ei_magic: { 0x%x, %c, %c, %c }" -@ MSG_ELF_CLASS " ei_class: %-18s ei_data: %s" -@ MSG_ELF_MACHINE " e_machine: %-18s e_version: %s" -@ MSG_ELF_TYPE " e_type: %s" -@ MSG_ELF_FLAGS " e_flags: %18s" -@ MSG_ELF_FLAGS_FMT " e_flags: %s" -@ MSG_ELF_ESIZE " e_entry: %#18llx e_ehsize: %2d \ - e_shstrndx: %2d" -@ MSG_ELFX_ESIZE " e_entry: %#18llx e_ehsize: %2d \ - e_shstrndx: [sh[0].sh_link]" -@ MSG_ELF_SHOFF " e_shoff: %#18llx e_shentsize: %2d \ - e_shnum: %2d" -@ MSG_ELFX_SHOFF " e_shoff: %#18llx e_shentsize: %2d \ - e_shnum: [sh[0].sh_size]" -@ MSG_ELF_PHOFF " e_phoff: %#18llx e_phentsize: %2d \ - e_phnum: %2d" -@ MSG_ELFX_PHOFF " e_phoff: %#18llx e_phentsize: %2d \ - e_phnum: [sh[0].sh_info]" - -# Shdr[0] messages -@ MSG_SHD0_TITLE "Section Header[0]: {ELF Ehdr extensions}" -@ MSG_SHD0_SIZE " sh_size: %-6lld [shnum] sh_type: %s" -@ MSG_SHD0_LINK1 " sh_link: %-6d [strndx] sh_info: %d [phnum]" -@ MSG_SHD0_LINK2 " sh_link: %-6d [strndx] sh_info: %d" -@ MSG_SHD0_LINK3 " sh_link: %-14d sh_info: %d [phnum]" -@ MSG_SHD0_LINK4 " sh_link: %-14d sh_info: %d" - -# Section header messages - -@ MSG_SHD_ADDR " sh_addr: %#-14llx sh_flags: %s" -@ MSG_SHD_SIZE " sh_size: %#-14llx sh_type: %s" -@ MSG_SHD_OFFSET " sh_offset: %#-14llx sh_entsize: %#llx" -@ MSG_SHD_ALIGN " sh_addralign: %#-14llx" -@ MSG_SHD_LINK " sh_link: %-14d sh_info: %s" - # Libs messages @ MSG_LIB_FILE " %s" -# Program header messages - -@ MSG_PHD_VADDR " p_vaddr: %#-14llx p_flags: %s" -@ MSG_PHD_PADDR " p_paddr: %#-14llx p_type: %s" -@ MSG_PHD_FILESZ " p_filesz: %#-14llx p_memsz: %#llx" -@ MSG_PHD_OFFSET " p_offset: %#-14llx p_align: %#llx" - - # PLT binding methods @ MSG_PLT_21D "21d" @@ -883,81 +1120,80 @@ @ MSG_UTL_STA_DELETE "RT_DELETE" @ MSG_UTL_STA_CONSIST "RT_CONSISTENT" -# -# The following messages are placed here because: -# *) it is difficult to keep the table aligned, and to document them, -# *) the information here are mainly for programmers, and not for -# regular end-users. -# - -# Relocation messages -@ MSG_REL_TITLE_1 " type \ - offset value section symbol" -@ MSG_REL_REL_TITLE_2 " type \ - offset section symbol" -@ MSG_REL_RELA_TITLE_2 " type \ - offset addend section symbol" -@ MSG_REL_REL_TITLE_3 " type \ - offset value symbol" -@ MSG_REL_RELA_TITLE_3 " type \ - offset addend symbol" -@ MSG_REL_RELA_TITLE_4 " \ - value" -@ MSG_REL_ARGS_2 " %#14llx %#10llx" -@ MSG_REL_ARGS_6 " %5s %-21s %#14llx %#10llx %-14.14s %s %s" -@ MSG_REL_L_ARGS_6 " %5s %-21s %#14llx %#10llx %-14s %s %s" -@ MSG_REL_ARGS_5 " %5s %-21s %#14llx %-14.14s %s %s" -@ MSG_REL_L_ARGS_5 " %5s %-21s %#14llx %-14s %s %s" -@ MSG_REL_REGSYM " %14.14s %#10llx" - -# Symbol strings -@ MSG_SYM_TITLE "%10.10s value size type bind \ - oth ver shndx %s" -@ MSG_SYM_L_TITLE "%10.10s value size type bind \ - oth ver shndx/%s" -@ MSG_SYM_ENTRY "%10.10s %10.10s 0x%8.8llx %4s %4s %2s %4d \ - %-11.11s %s" -@ MSG_SYM_L_ENTRY "%10.10s %10.10s 0x%8.8llx %4s %4s %2s %4d \ - %-11s %s" - -@ MSG_SYM_TITLE_64 "%10.10s value size type bind \ - oth ver shndx %s" -@ MSG_SYM_L_TITLE_64 "%10.10s value size type bind \ - oth ver shndx/%s" -@ MSG_SYM_ENTRY_64 "%10.10s %14.14s 0x%12.12llx %4s %4s %2s %4d \ - %-11.11s %s" -@ MSG_SYM_L_ENTRY_64 "%10.10s %14.14s 0x%12.12llx %4s %4s %2s %4d \ - %-11s %s" - # Version messages + @ MSG_VER_SELECTED " SELECTED %-26.26s %s" @ MSG_VER_L_SELECTED " SELECTED %-26s %s" @ MSG_VER_ALL " ALL %-26.26s" @ MSG_VER_L_ALL " ALL %-26s" -@ MSG_VER_DEF_2 " index version dependency" -@ MSG_VER_NEED_2 " file version" -@ MSG_VER_LINE_1 "%10.10s %-26.26s %-20s %s" -@ MSG_VER_L_LINE_1 "%10s %-26s %-20s %s" -@ MSG_VER_LINE_2 "%47s %s" -@ MSG_VER_LINE_3 "%38s %-20s %s" -@ MSG_VER_LINE_4 "%38s %s" -@ MSG_VER_LINE_5 " %-26.26s %s" -@ MSG_VER_L_LINE_5 " %-26s %s" - # GOT messages -@ MSG_GOT_COLUMNS "index\tref\taddend\t\tsymbol" + +@ MSG_GOT_COLUMNS "index ref addend symbol" @ MSG_GOT_SMALL_PIC "pic" -@ MSG_GOT_PIC "PIC" +@ MSG_GOT_BIG_PIC "PIC" @ MSG_GOT_FORMAT1 "[%05d] %3s 0x%08llx %s" @ MSG_GOT_FORMAT2 "[%05d] %3s 0x%08llx %s:%s" -@ MSG_GOT_ECOLUMNS " ndx addr value reloc \ - addend symbol" -@ MSG_GOT_ECOLUMNS_64 " ndx addr value reloc \ - addend symbol" -@ MSG_GOT_EFORMAT "[%05d] %08llx %08llx %-18s %08llx %s" -@ MSG_GOT_EFORMAT_64 "[%05d] %012llx %012llx %-18s %012llx %s" - -@ MSG_SYMI_FMT "%10.10s %-4s %7s %-18s %s" @ MSG_CNTL_ENTRY " [0x%llx] %s" + +@ MSG_STR_EMPTY "" +@ MSG_STR_NL "\n" + +@ MSG_GOT_INDEX " [%ld]" +@ MSG_FMT_INDEX " [%d]" + +@ MSG_SUNW_OST_SGS "SUNW_OST_SGS" + +@ MSG_ELF_MAGIC " ei_magic: { 0x%x, %c, %c, %c }" +@ MSG_ELF_CLASS " ei_class: %-18s ei_data: %s" +@ MSG_ELF_MACHINE " e_machine: %-18s e_version: %s" +@ MSG_ELF_TYPE " e_type: %s" +@ MSG_ELF_FLAGS " e_flags: %18s" +@ MSG_ELF_FLAGS_FMT " e_flags: %s" +@ MSG_ELF_ESIZE " e_entry: %#18llx e_ehsize: %2d \ + e_shstrndx: %2d" +@ MSG_ELFX_ESIZE " e_entry: %#18llx e_ehsize: %2d \ + e_shstrndx: [sh[0].sh_link]" +@ MSG_ELF_SHOFF " e_shoff: %#18llx e_shentsize: %2d \ + e_shnum: %2d" +@ MSG_ELFX_SHOFF " e_shoff: %#18llx e_shentsize: %2d \ + e_shnum: [sh[0].sh_size]" +@ MSG_ELF_PHOFF " e_phoff: %#18llx e_phentsize: %2d \ + e_phnum: %2d" + +# Shdr[0] messages + +@ MSG_SHD0_TITLE "Section Header[0]: {ELF Ehdr extensions}" +@ MSG_SHD0_SIZE " sh_size: %-6lld [shnum] sh_type: %s" +@ MSG_SHD0_LINK " sh_link: %-6d [strndx] sh_info: %s" + +# Section header messages + +@ MSG_SHD_ADDR_32 " sh_addr: %#-10llx sh_flags: %s" +@ MSG_SHD_SIZE_32 " sh_size: %#-10llx sh_type: %s" +@ MSG_SHD_OFFSET_32 " sh_offset: %#-10llx sh_entsize: %#llx" +@ MSG_SHD_ALIGN_32 " sh_addralign: %#-10llx" +@ MSG_SHD_LINK_32 " sh_link: %-10d sh_info: %s" + +@ MSG_SHD_ADDR_64 " sh_addr: %#-18llx sh_flags: %s" +@ MSG_SHD_SIZE_64 " sh_size: %#-18llx sh_type: %s" +@ MSG_SHD_OFFSET_64 " sh_offset: %#-18llx sh_entsize: %#llx" +@ MSG_SHD_ALIGN_64 " sh_addralign: %#-18llx" +@ MSG_SHD_LINK_64 " sh_link: %-18d sh_info: %s" + +# Program header messages + +@ MSG_PHD_VADDR_32 " p_vaddr: %#-10llx p_flags: %s" +@ MSG_PHD_PADDR_32 " p_paddr: %#-10llx p_type: %s" +@ MSG_PHD_FILESZ_32 " p_filesz: %#-10llx p_memsz: %#llx" +@ MSG_PHD_OFFSET_32 " p_offset: %#-10llx p_align: %#llx" + +@ MSG_PHD_VADDR_64 " p_vaddr: %#-18llx p_flags: %s" +@ MSG_PHD_PADDR_64 " p_paddr: %#-18llx p_type: %s" +@ MSG_PHD_FILESZ_64 " p_filesz: %#-18llx p_memsz: %#llx" +@ MSG_PHD_OFFSET_64 " p_offset: %#-18llx p_align: %#llx" + +# Syminfo formats + +@ MSG_SYMINFO_UNKFLAG " 0x%x" diff --git a/usr/src/cmd/sgs/liblddbg/common/libs.c b/usr/src/cmd/sgs/liblddbg/common/libs.c index df1b7efdbc..eebc8c4b82 100644 --- a/usr/src/cmd/sgs/liblddbg/common/libs.c +++ b/usr/src/cmd/sgs/liblddbg/common/libs.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -29,47 +29,89 @@ #include "_debug.h" #include "libld.h" +void +Dbg_libs_audit(Lm_list *lml, const char *opath, const char *npath) +{ + if (DBG_NOTCLASS(DBG_C_LIBS | DBG_C_AUDITING)) + return; + + if (npath == opath) + return; + else if (npath == 0) + dbg_print(lml, MSG_INTL(MSG_LIB_SKIP), opath); + else + dbg_print(lml, MSG_INTL(MSG_LIB_ALTER), npath); +} + +void +Dbg_libs_find(Lm_list *lml, const char *name) +{ + if (DBG_NOTCLASS(DBG_C_LIBS)) + return; + + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_LIB_FIND), name); +} + +void +Dbg_libs_found(Lm_list *lml, const char *path, int alter) +{ + if (DBG_NOTCLASS(DBG_C_LIBS)) + return; + + dbg_print(lml, MSG_INTL(MSG_LIB_TRYING), path, alter ? + MSG_INTL(MSG_STR_ALTER) : MSG_ORIG(MSG_STR_EMPTY)); +} + +void +Dbg_libs_ignore(Lm_list *lml, const char *path) +{ + if (DBG_NOTCLASS(DBG_C_LIBS)) + return; + + dbg_print(lml, MSG_INTL(MSG_LIB_IGNORE), path); +} + static void -Dbg_lib_dir_print(List * libdir) +Dbg_lib_dir_print(Lm_list *lml, List *libdir) { Listnode *lnp; char *cp; - for (LIST_TRAVERSE(libdir, lnp, cp)) { - dbg_print(MSG_ORIG(MSG_LIB_FILE), cp); - } + for (LIST_TRAVERSE(libdir, lnp, cp)) + dbg_print(lml, MSG_ORIG(MSG_LIB_FILE), cp); } void -Dbg_libs_init(List * ulibdir, List * dlibdir) +Dbg_libs_init(Lm_list *lml, List *ulibdir, List *dlibdir) { - if (DBG_NOTCLASS(DBG_LIBS)) + if (DBG_NOTCLASS(DBG_C_LIBS)) return; - dbg_print(MSG_INTL(MSG_LIB_INITPATH)); - Dbg_lib_dir_print(ulibdir); - Dbg_lib_dir_print(dlibdir); + dbg_print(lml, MSG_INTL(MSG_LIB_INITPATH)); + Dbg_lib_dir_print(lml, ulibdir); + Dbg_lib_dir_print(lml, dlibdir); } void -Dbg_libs_l(const char *name, const char *path) +Dbg_libs_l(Lm_list *lml, const char *name, const char *path) { - if (DBG_NOTCLASS(DBG_LIBS)) + if (DBG_NOTCLASS(DBG_C_LIBS)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_INTL(MSG_LIB_LOPT), name, path); + dbg_print(lml, MSG_INTL(MSG_LIB_LOPT), name, path); } void -Dbg_libs_path(const char *path, Half orig, const char *obj) +Dbg_libs_path(Lm_list *lml, const char *path, Half orig, const char *obj) { const char *fmt; if (path == (const char *)0) return; - if (DBG_NOTCLASS(DBG_LIBS)) + if (DBG_NOTCLASS(DBG_C_LIBS)) return; if (orig & LA_SER_LIBPATH) { @@ -85,89 +127,47 @@ Dbg_libs_path(const char *path, Half orig, const char *obj) else fmt = MSG_INTL(MSG_LIB_DEFAULT); } - dbg_print(fmt, path, obj); + dbg_print(lml, fmt, path, obj); } void -Dbg_libs_req(const char *so_name, const char *ref_file, const char *name) +Dbg_libs_req(Lm_list *lml, const char *so_name, const char *ref_file, + const char *name) { - if (DBG_NOTCLASS(DBG_LIBS)) + if (DBG_NOTCLASS(DBG_C_LIBS)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_INTL(MSG_LIB_REQUIRED), so_name, name, ref_file); -} - -void -Dbg_libs_update(List * ulibdir, List * dlibdir) -{ - if (DBG_NOTCLASS(DBG_LIBS)) - return; - - dbg_print(MSG_INTL(MSG_LIB_UPPATH)); - Dbg_lib_dir_print(ulibdir); - Dbg_lib_dir_print(dlibdir); -} - -void -Dbg_libs_yp(const char *path) -{ - if (DBG_NOTCLASS(DBG_LIBS)) - return; - - dbg_print(MSG_INTL(MSG_LIB_LIBPATH), path); -} - -void -Dbg_libs_ylu(const char *path, const char *orig, int index) -{ - if (DBG_NOTCLASS(DBG_LIBS)) - return; - - dbg_print(MSG_INTL(MSG_LIB_YPATH), path, orig, - (index == YLDIR) ? 'L' : 'U'); + dbg_print(lml, MSG_INTL(MSG_LIB_REQUIRED), so_name, name, ref_file); } void -Dbg_libs_find(const char *name) +Dbg_libs_update(Lm_list *lml, List *ulibdir, List *dlibdir) { - if (DBG_NOTCLASS(DBG_LIBS)) + if (DBG_NOTCLASS(DBG_C_LIBS)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_LIB_FIND), name); + dbg_print(lml, MSG_INTL(MSG_LIB_UPPATH)); + Dbg_lib_dir_print(lml, ulibdir); + Dbg_lib_dir_print(lml, dlibdir); } void -Dbg_libs_found(const char *path, int alter) +Dbg_libs_yp(Lm_list *lml, const char *path) { - if (DBG_NOTCLASS(DBG_LIBS)) + if (DBG_NOTCLASS(DBG_C_LIBS)) return; - dbg_print(MSG_INTL(MSG_LIB_TRYING), path, alter ? - MSG_INTL(MSG_STR_ALTER) : MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(lml, MSG_INTL(MSG_LIB_LIBPATH), path); } void -Dbg_libs_ignore(const char *path) +Dbg_libs_ylu(Lm_list *lml, const char *path, const char *orig, int index) { - if (DBG_NOTCLASS(DBG_LIBS)) + if (DBG_NOTCLASS(DBG_C_LIBS)) return; - dbg_print(MSG_INTL(MSG_LIB_IGNORE), path); -} - -void -Dbg_libs_audit(const char *opath, const char *npath) -{ - if (DBG_NOTCLASS(DBG_LIBS | DBG_AUDITING)) - return; - - if (npath == opath) - return; - else if (npath == 0) - dbg_print(MSG_INTL(MSG_LIB_SKIP), opath); - else - dbg_print(MSG_INTL(MSG_LIB_ALTER), npath); + dbg_print(lml, MSG_INTL(MSG_LIB_YPATH), path, orig, + (index == YLDIR) ? 'L' : 'U'); } diff --git a/usr/src/cmd/sgs/liblddbg/common/lintsup.c b/usr/src/cmd/sgs/liblddbg/common/lintsup.c index 13dad62ac0..0d5b13435a 100644 --- a/usr/src/cmd/sgs/liblddbg/common/lintsup.c +++ b/usr/src/cmd/sgs/liblddbg/common/lintsup.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,22 +18,28 @@ * * CDDL HEADER END */ -/* LINTLIBRARY */ -/* PROTOLIB1 */ /* - * Copyright (c) 1998 by Sun Microsystems, Inc. - * All rights reserved. - */ + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ #pragma ident "%Z%%M% %I% %E% SMI" +/* LINTLIBRARY */ +/* PROTOLIB1 */ + /* - * Supplimental definitions for lint that help us avoid - * options like `-x' that filter out things we want to - * know about as well as things we don't. + * Supplemental definitions for lint that help us avoid options like `-x' that + * filter out things we want to know about as well as things we don't. */ -#include "libld.h" +#include <libelf.h> +#include <link.h> +#include <sgs.h> +#include <libld.h> +#include <rtld.h> +#include <conv.h> +#include <msg.h> /* * Get the Elf32 side to think that the _ELF64 side @@ -42,11 +47,11 @@ */ #if defined(_ELF64) #undef _ELF64 -#include "debug.h" +#include <debug.h> #define _ELF64 #else #define _ELF64 -#include "debug.h" +#include <debug.h> #undef _ELF64 #endif diff --git a/usr/src/cmd/sgs/liblddbg/common/llib-llddbg b/usr/src/cmd/sgs/liblddbg/common/llib-llddbg index d6425a24a3..5508fbd656 100644 --- a/usr/src/cmd/sgs/liblddbg/common/llib-llddbg +++ b/usr/src/cmd/sgs/liblddbg/common/llib-llddbg @@ -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,7 +22,7 @@ /* PROTOLIB1 */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -31,314 +30,450 @@ #include <sys/types.h> #include <sys/auxv.h> -#include <gelf.h> -#include "debug.h" - -uint_t Dbg_setup(const char *); -void Dbg_set(uint_t); - -void Dbg_args_files(int, char *); -void Dbg_args_flags(int, int); -void Dbg_audit_interface(const char *, const char *); -void Dbg_audit_interface64(const char *, const char *); -void Dbg_audit_lib(const char *); -void Dbg_audit_lib64(const char *); -void Dbg_audit_object(const char *, const char *); -void Dbg_audit_object64(const char *, const char *); -void Dbg_audit_symval(const char *, const char *, const char *, Addr, Addr); -void Dbg_audit_symval64(const char *, const char *, const char *, Addr, Addr); -void Dbg_audit_version(const char *, ulong_t); -void Dbg_audit_version64(const char *, ulong_t); -void Dbg_bind_global(const char *, caddr_t, caddr_t, Xword, Pltbindtype, - const char *, caddr_t, caddr_t, const char *, uint_t); -void Dbg_bind_profile(uint_t, uint_t); -void Dbg_bind_weak(const char *, caddr_t, caddr_t, const char *); -void Dbg_cap_hw_candidate(const char *); -void Dbg_cap_hw_filter(const char *, const char *); -void Dbg_cap_hw_1(Xword, Half); -void Dbg_cap_sec_entry(uint_t, Xword, Xword, Half); -void Dbg_cap_sec_title(const char *); -void Dbg_ent_print(Half, List *, Boolean); -void Dbg_file_analyze(Rt_map *); -void Dbg_file_analyze64(Rt_map *); -void Dbg_file_aout(const char *, ulong_t, ulong_t, ulong_t); -void Dbg_file_aout64(const char *, ulong_t, ulong_t, ulong_t); -void Dbg_file_archive(const char *, int); -void Dbg_file_archive64(const char *, int); -void Dbg_file_bind_entry(Bnd_desc *); -void Dbg_file_bind_entry64(Bnd_desc *); -void Dbg_file_bindings(Rt_map *, int, Word); -void Dbg_file_bindings64(Rt_map *, int, Word); -void Dbg_file_bind_title(int); -void Dbg_file_bind_title64(int); -void Dbg_file_cntl(Lm_list *, Aliste, Aliste); -void Dbg_file_config_dis(const char *, int); -void Dbg_file_config_dis64(const char *, int); -void Dbg_file_config_obj(const char *, const char *, const char *); -void Dbg_file_config_obj64(const char *, const char *, const char *); -void Dbg_file_delete(const char *); -void Dbg_file_delete64(const char *); -void Dbg_file_dlclose(const char *, int); -void Dbg_file_dlclose64(const char *, int); -void Dbg_file_dldump(const char *, const char *, int); -void Dbg_file_dldump64(const char *, const char *, int); -void Dbg_file_dlopen(const char *, const char *, int); -void Dbg_file_dlopen64(const char *, const char *, int); -void Dbg_file_elf(const char *, ulong_t, ulong_t, ulong_t, ulong_t, Lmid_t, - Aliste); -void Dbg_file_elf64(const char *, ulong_t, ulong_t, ulong_t, ulong_t, Lmid_t, - Aliste); -void Dbg_file_filtee(const char *, const char *, int); -void Dbg_file_filtee64(const char *, const char *, int); -void Dbg_file_filter(const char *, const char *, int); -void Dbg_file_filter64(const char *, const char *, int); -void Dbg_file_fixname(const char *, const char *); -void Dbg_file_fixname64(const char *, const char *); -void Dbg_file_generic(Ifl_desc *); -void Dbg_file_generic64(Ifl_desc *); -void Dbg_file_handle_collect(Grp_hdl *, const char *); -void Dbg_file_handle_collect64(Grp_hdl *, const char *); -void Dbg_file_handle(Grp_hdl *, Rt_map *, int); -void Dbg_file_handle64(Grp_hdl *, Rt_map *, int); -void Dbg_file_lazyload(const char *, const char *, const char *); -void Dbg_file_lazyload64(const char *, const char *, const char *); -void Dbg_file_ldso(const char *, ulong_t, ulong_t, char **, auxv_t *); -void Dbg_file_ldso64(const char *, ulong_t, ulong_t, char **, auxv_t *); -void Dbg_file_mode_promote(const char *, int); -void Dbg_file_needed(const char *, const char *); -void Dbg_file_needed64(const char *, const char *); -void Dbg_file_nl(void); -void Dbg_file_nl64(void); -void Dbg_file_output(Ofl_desc *); -void Dbg_file_output64(Ofl_desc *); -void Dbg_file_preload(const char *); -void Dbg_file_preload64(const char *); -void Dbg_file_prot(const char *, int); -void Dbg_file_prot64(const char *, int); -void Dbg_file_rejected(Rej_desc *); -void Dbg_file_reuse(const char *, const char *); -void Dbg_file_reuse64(const char *, const char *); -void Dbg_file_ar_rescan(void); -void Dbg_file_del_rescan(void); -void Dbg_file_skip(const char *, const char *); -void Dbg_file_skip64(const char *, const char *); -void Dbg_got_display(Gottable *, Ofl_desc *); -void Dbg_got_display64(Gottable *, Ofl_desc *); -void Dbg_libs_audit(const char *, const char *); -void Dbg_libs_ignore(const char *); -void Dbg_libs_init(List *, List *); -void Dbg_libs_l(const char *, const char *); -void Dbg_libs_path(const char *, Half, const char *); -void Dbg_libs_req(const char *, const char *, const char *); -void Dbg_libs_update(List *, List *); -void Dbg_libs_yp(const char *); -void Dbg_libs_ylu(const char *, const char *, int); -void Dbg_libs_find(const char *); -void Dbg_libs_found(const char *, int); -void Dbg_map_atsign(Boolean); -void Dbg_map_atsign64(Boolean); -void Dbg_map_dash(const char *, Sdf_desc *); -void Dbg_map_dash64(const char *, Sdf_desc *); -void Dbg_map_ent(Boolean, Ent_desc *, Ofl_desc *); -void Dbg_map_ent64(Boolean, Ent_desc *, Ofl_desc *); -void Dbg_map_equal(Boolean); -void Dbg_map_equal64(Boolean); -void Dbg_map_parse(const char *); -void Dbg_map_parse64(const char *); -void Dbg_map_pipe(Sg_desc *, const char *, const Word); -void Dbg_map_pipe64(Sg_desc *, const char *, const Word); -void Dbg_map_seg(Half, int, Sg_desc *); -void Dbg_map_seg64(Half, int, Sg_desc *); -void Dbg_map_size_new(const char *); -void Dbg_map_size_new64(const char *); -void Dbg_map_size_old(Ehdr *, Sym_desc *); -void Dbg_map_size_old64(Ehdr *, Sym_desc *); -void Dbg_map_sort_fini(Sg_desc *); -void Dbg_map_sort_fini64(Sg_desc *); -void Dbg_map_sort_orig(Sg_desc *); -void Dbg_map_sort_orig64(Sg_desc *); -void Dbg_map_symbol(Ehdr *, Sym_desc *); -void Dbg_map_symbol64(Ehdr *, Sym_desc *); -void Dbg_map_version(const char *, const char *, int); -void Dbg_map_version64(const char *, const char *, int); -void Dbg_move_adjexpandreloc(ulong_t, const char *); -void Dbg_move_adjmovereloc(ulong_t, ulong_t, const char *); -void Dbg_move_data(const char *); -void Dbg_move_expanding(Move *, Addr); -void Dbg_move_input1(const char *); -void Dbg_move_mventry(int, Move *, Sym_desc *); -void Dbg_move_mventry64(int, Move *, Sym_desc *); -void Dbg_move_mventry2(Move *, Word, char *); -void Dbg_move_mventry264(Move *, Word, char *); -void Dbg_move_outmove(const uchar_t *); -void Dbg_move_outsctadj(Sym_desc *); -void Dbg_move_outsctadj64(Sym_desc *); -void Dbg_move_parexpn(const char *, const char *); -void Dbg_pltpad_bindto64(const char *, const char *, Addr); -void Dbg_pltpad_boundto64(const char *, Addr, const char *, const char *); -void Dbg_reloc_apply(unsigned long long, unsigned long long); -void Dbg_reloc_ars_entry(Half, Rel_desc *); -void Dbg_reloc_ars_entry64(Half, Rel_desc *); -void Dbg_reloc_copy(const char *, const char *, const char *, int); -void Dbg_reloc_discard(Half, Rel_desc *); -void Dbg_reloc_discard64(Half, Rel_desc *); -void Dbg_reloc_doact(Half, Word, Xword, Xword, const char *, Os_desc *); -void Dbg_reloc_doact64(Half, Word, Xword, Xword, const char *, Os_desc *); -void Dbg_reloc_doactiverel(void); -void Dbg_reloc_dooutrel(GElf_Word); -void Dbg_reloc_dooutrel64(GElf_Word); -void Dbg_reloc_in(Half, Word, void *, const char *, const char *); -void Dbg_reloc_in64(Half, Word, void *, const char *, const char *); -void Dbg_reloc_ors_entry(Half, Rel_desc *); -void Dbg_reloc_ors_entry64(Half, Rel_desc *); -void Dbg_reloc_out(Half, Word, void *, const char *, const char *); -void Dbg_reloc_out64(Half, Word, void *, const char *, const char *); -void Dbg_reloc_proc(Os_desc *, Is_desc *, Is_desc *); -void Dbg_reloc_proc64(Os_desc *, Is_desc *, Is_desc *); -void Dbg_reloc_run(const char *, uint_t, int, int); -void Dbg_reloc_reg_apply(unsigned long long, unsigned long long); -void Dbg_reloc_reg_apply64(unsigned long long, unsigned long long); -void Dbg_sec_added(Os_desc *, Sg_desc *); -void Dbg_sec_added64(Os_desc *, Sg_desc *); -void Dbg_sec_created(Os_desc *, Sg_desc *); -void Dbg_sec_created64(Os_desc *, Sg_desc *); -void Dbg_sec_group(Is_desc *, Group_desc *); -void Dbg_sec_group64(Is_desc *, Group_desc *); -void Dbg_sec_in(Is_desc *); -void Dbg_sec_in64(Is_desc *); -void Dbg_sec_order_list(Ofl_desc *, int); -void Dbg_sec_order_list64(Ofl_desc *, int); -void Dbg_sec_order_error(Ifl_desc *, Word, int); -void Dbg_sec_order_error64(Ifl_desc *, Word, int); -void Dbg_seg_entry(Half, int, Sg_desc *); -void Dbg_seg_entry64(Half, int, Sg_desc *); -void Dbg_seg_list(Half, List *); -void Dbg_seg_list64(Half, List *); -void Dbg_seg_os(Ofl_desc *, Os_desc *, int); -void Dbg_seg_os64(Ofl_desc *, Os_desc *, int); -void Dbg_seg_title(void); -void Dbg_seg_title64(void); -void Dbg_statistics_ld(Ofl_desc *); -void Dbg_statistics_ld64(Ofl_desc *); -void Dbg_statistics_ar(Ofl_desc *); -void Dbg_statistics_ar64(Ofl_desc *); -void Dbg_syms_ar_checking(Xword, Elf_Arsym *, const char *); -void Dbg_syms_ar_checking64(Xword, Elf_Arsym *, const char *); -void Dbg_syms_ar_entry(Xword, Elf_Arsym *); -void Dbg_syms_ar_entry64(Xword, Elf_Arsym *); -void Dbg_syms_ar_resolve(Xword, Elf_Arsym *, const char *, int); -void Dbg_syms_ar_resolve64(Xword, Elf_Arsym *, const char *, int); -void Dbg_syms_ar_title(const char *, int); -void Dbg_syms_ar_title64(const char *, int); -void Dbg_syms_created(const char *); -void Dbg_syms_created64(const char *); -void Dbg_syms_entered(Ehdr *, Sym *, Sym_desc *); -void Dbg_syms_entered64(Ehdr *, Sym *, Sym_desc *); -void Dbg_syms_entry(Xword, Sym_desc *); -void Dbg_syms_entry64(Xword, Sym_desc *); -void Dbg_syms_global(Xword, const char *); -void Dbg_syms_global64(Xword, const char *); -void Dbg_syms_new(Ehdr *, Sym *, Sym_desc *); -void Dbg_syms_new64(Ehdr *, Sym *, Sym_desc *); -void Dbg_syms_nl(void); -void Dbg_syms_nl64(void); -void Dbg_syms_old(Ehdr *, Sym_desc *); -void Dbg_syms_old64(Ehdr *, Sym_desc *); -void Dbg_syms_process(Ifl_desc *); -void Dbg_syms_process64(Ifl_desc *); -void Dbg_syms_reduce(int, Ehdr *, Sym_desc *, int, const char *); -void Dbg_syms_reduce64(int, Ehdr *, Sym_desc *, int, const char *); -void Dbg_syms_reloc(Ehdr *, Sym_desc *); -void Dbg_syms_reloc64(Ehdr *, Sym_desc *); -void Dbg_syms_resolved(Ehdr *, Sym_desc *); -void Dbg_syms_resolved64(Ehdr *, Sym_desc *); -void Dbg_syms_resolving1(Xword, const char *, int, int); -void Dbg_syms_resolving164(Xword, const char *, int, int); -void Dbg_syms_resolving2(Ehdr *, Sym *, Sym *, Sym_desc *, Ifl_desc *); -void Dbg_syms_resolving264(Ehdr *, Sym *, Sym *, Sym_desc *, Ifl_desc *); -void Dbg_syms_sec_entry(int, Sg_desc *, Os_desc *); -void Dbg_syms_sec_entry64(int, Sg_desc *, Os_desc *); -void Dbg_syms_sec_title(void); -void Dbg_syms_sec_title64(void); -void Dbg_syms_sec_unused(Is_desc *, uint_t); -void Dbg_syms_sec_unused64(Is_desc *, uint_t); -void Dbg_syms_spec_title(void); -void Dbg_syms_spec_title64(void); -void Dbg_syms_up_title(Ehdr *); -void Dbg_syms_up_title64(Ehdr *); -void Dbg_syms_updated(Ehdr *, Sym_desc *, const char *); -void Dbg_syms_updated64(Ehdr *, Sym_desc *, const char *); -void Dbg_syms_dlsym(const char *, const char *, const char *, int); -void Dbg_syms_dlsym64(const char *, const char *, const char *, int); -void Dbg_syms_lookup_aout(const char *); -void Dbg_syms_lookup_aout64(const char *); -void Dbg_syms_lookup(const char *, const char *, const char *); -void Dbg_syms_lookup64(const char *, const char *, const char *); -void Dbg_syminfo_entry(int, Syminfo *, Sym *, const char *, Dyn *); -void Dbg_syminfo_entry64(int, Syminfo *, Sym *, const char *, Dyn *); -void Dbg_syminfo_title(void); -void Dbg_syminfo_title64(void); -void Dbg_support_action(const char *, const char *, Support_ndx, const char *); -void Dbg_support_load(const char *, const char *); -void Dbg_support_req(const char *, int); -void Dbg_unused_file(const char *, int, int); -void Dbg_unused_rtldinfo(const char *, const char *); -void Dbg_unused_sec(Is_desc *); -void Dbg_unused_sec64(Is_desc *); -void Dbg_unused_unref(const char *, const char *); -void Dbg_util_broadcast(const char *name); -void Dbg_util_call_array(const char *libname, void *addr, uint_t ndx, - uint_t shtype); -void Dbg_util_call_fini(const char *name); -void Dbg_util_call_init(const char *name, int flag); -void Dbg_util_call_main(const char *name); -void Dbg_util_collect(const char *name, int flag, int ndx); -void Dbg_util_dbnotify(rd_event_e event, r_state_e state); -void Dbg_util_edge_in(Rt_map *clmp, uint_t flags, Rt_map *dlmp, int ndx, int flag); -void Dbg_util_edge_out(const char *cname, int ndx, const char *dname); -void Dbg_util_intoolate(const char *name); -void Dbg_util_nl(); -void Dbg_util_no_init(const char *name); -void Dbg_util_scc_entry(uint_t idx, const char *name); -void Dbg_util_scc_title(int sec); -void Dbg_util_str(const char *name); -void Dbg_util_wait(int what, const char *cname, const char *dname); -void Dbg_ver_avail_entry(Ver_index *, const char *); -void Dbg_ver_avail_entry64(Ver_index *, const char *); -void Dbg_ver_avail_title(const char *); -void Dbg_ver_def_title(const char *); -void Dbg_ver_desc_entry(Ver_desc *); -void Dbg_ver_desc_entry64(Ver_desc *); -void Dbg_ver_need_title(const char *); -void Dbg_ver_need_entry(Half, const char *, const char *); -void Dbg_ver_symbol(const char *); +#include <debug.h> -/* - * Gelf related functions, used by elfdump - */ -const char * Gelf_sym_dem(const char *); - -void Gelf_cap_print(GElf_Cap *, int, Half); -void Gelf_cap_title(void); -void Gelf_dyn_print(GElf_Dyn *, int ndx, const char *, Half); -void Gelf_dyn_title(void); -void Gelf_elf_data_title(void); -void Gelf_elf_header(GElf_Ehdr *, GElf_Shdr *); -void Gelf_got_title(uchar_t); -void Gelf_got_entry(GElf_Ehdr *, Sword, GElf_Addr, GElf_Xword, - GElf_Word, void *, const char *); -void Gelf_note_entry(GElf_Word *, GElf_Word); -void Gelf_phdr_entry(Half, GElf_Phdr *); -void Gelf_reloc_entry(const char *, GElf_Half, GElf_Word, - GElf_Rela *, const char *, const char *); -void Gelf_shdr_entry(Half, GElf_Shdr *); -void Gelf_sym_table_entry(const char *, GElf_Ehdr *, GElf_Sym *, - GElf_Word, const char *, const char *); -void Gelf_sym_table_title(GElf_Ehdr *, const char *, const char *); -void Gelf_syminfo_entry(int, GElf_Syminfo *, const char *, const char *); -void Gelf_syminfo_title(void); -void Gelf_ver_def_title(void); -void Gelf_ver_need_title(void); -void Gelf_ver_line_1(const char *, const char *, const char *, const char *); -void Gelf_ver_line_2(const char *, const char *); -void Gelf_ver_line_3(const char *, const char *, const char *); +uintptr_t + Dbg_setup(const char *, Dbg_desc *); +const char * + Dbg_demangle_name(const char *); + +void Dbg_args_files(Lm_list *, int, char *); +void Dbg_args_flags(Lm_list *, int, int); +void Dbg_audit_interface(Lm_list *, const char *, const char *); +void Dbg_audit_lib(Lm_list *, const char *); +void Dbg_audit_object(Lm_list *, const char *, const char *); +void Dbg_audit_symval(Lm_list *, const char *, const char *, const char *, + Addr, Addr); +void Dbg_audit_version(Lm_list *, const char *, ulong_t); + +void Dbg32_bind_global(Rt_map *, Elf32_Addr, Elf32_Off, Elf32_Word, + Pltbindtype, Rt_map *, Elf32_Addr, Elf32_Off, const char *, uint_t); +void Dbg64_bind_global(Rt_map *, Elf64_Addr, Elf64_Off, Elf64_Xword, + Pltbindtype, Rt_map *, Elf64_Addr, Elf64_Off, const char *, uint_t); +void Dbg64_bind_pltpad_to(Rt_map *, Addr, const char *, const char *); +void Dbg64_bind_pltpad_from(Rt_map *, Addr, const char *); +void Dbg32_bind_weak(Rt_map *, Elf32_Addr, Elf32_Addr, const char *); +void Dbg64_bind_weak(Rt_map *, Elf64_Addr, Elf64_Addr, const char *); + +void Dbg32_cap_hw_candidate(Lm_list *, const char *); +void Dbg64_cap_hw_candidate(Lm_list *, const char *); +void Dbg32_cap_hw_filter(Lm_list *, const char *, Rt_map *); +void Dbg64_cap_hw_filter(Lm_list *, const char *, Rt_map *); +void Dbg32_cap_mapfile(Lm_list *, Elf32_Word, Elf32_Word, Elf32_Half); +void Dbg64_cap_mapfile(Lm_list *, Elf64_Xword, Elf64_Xword, Elf64_Half); +void Dbg32_cap_sec_entry(Lm_list *, uint_t, Elf32_Word, Elf32_Word, + Elf32_Half); +void Dbg64_cap_sec_entry(Lm_list *, uint_t, Elf64_Xword, Elf64_Xword, + Elf64_Half); +void Dbg32_cap_sec_title(Ofl_desc *); +void Dbg64_cap_sec_title(Ofl_desc *); +void Dbg32_cap_val_hw1(Lm_list *, Elf32_Word, Elf32_Half); +void Dbg64_cap_val_hw1(Lm_list *, Elf64_Xword, Elf64_Half); + +void Dbg32_ent_print(Lm_list *, Elf32_Half, List *, Boolean); +void Dbg64_ent_print(Lm_list *, Elf64_Half, List *, Boolean); + +void Dbg32_file_analyze(Rt_map *); +void Dbg64_file_analyze64(Rt_map *); +void Dbg32_file_aout(Lm_list *, const char *, ulong_t, ulong_t, ulong_t, + const char *, Aliste); +void Dbg64_file_aout(Lm_list *, const char *, ulong_t, ulong_t, ulong_t, + const char *, Aliste); +void Dbg32_file_archive(Lm_list *, const char *, int); +void Dbg64_file_archive(Lm_list *, const char *, int); +void Dbg32_file_bind_entry(Lm_list *, Bnd_desc *); +void Dbg64_file_bind_entry(Lm_list *, Bnd_desc *); +void Dbg32_file_bindings(Rt_map *, int); +void Dbg64_file_bindings(Rt_map *, int); +void Dbg32_file_config_dis(Lm_list *, const char *, int); +void Dbg64_file_config_dis(Lm_list *, const char *, int); +void Dbg32_file_config_obj(Lm_list *, const char *, const char *, + const char *); +void Dbg64_file_config_obj(Lm_list *, const char *, const char *, + const char *); +void Dbg32_file_cntl(Lm_list *, Aliste, Aliste); +void Dbg64_file_cntl(Lm_list *, Aliste, Aliste); +void Dbg32_file_del_rescan(Lm_list *); +void Dbg64_file_del_rescan(Lm_list *); +void Dbg32_file_delete(Rt_map *); +void Dbg64_file_delete(Rt_map *); +void Dbg32_file_dlclose(Lm_list *, const char *, int); +void Dbg64_file_dlclose(Lm_list *, const char *, int); +void Dbg32_file_dldump(Rt_map *, const char *, int); +void Dbg64_file_dldump(Rt_map *, const char *, int); +void Dbg32_file_dlopen(Rt_map *, const char *, int); +void Dbg64_file_dlopen(Rt_map *, const char *, int); +void Dbg32_file_elf(Lm_list *, const char *, ulong_t, ulong_t, ulong_t, + ulong_t, const char *, Aliste); +void Dbg64_file_elf(Lm_list *, const char *, ulong_t, ulong_t, ulong_t, + ulong_t, const char *, Aliste); +void Dbg32_file_filtee(Lm_list *, const char *, const char *, int); +void Dbg64_file_filtee(Lm_list *, const char *, const char *, int); +void Dbg32_file_filter(Lm_list *, const char *, const char *, int); +void Dbg64_file_filter(Lm_list *, const char *, const char *, int); +void Dbg64_file_fixname(Lm_list *, const char *, const char *); +void Dbg32_file_fixname(Lm_list *, const char *, const char *); +void Dbg32_file_hdl_action(Grp_hdl *, Rt_map *, int); +void Dbg64_file_hdl_action(Grp_hdl *, Rt_map *, int); +void Dbg32_file_hdl_collect(Grp_hdl *, const char *); +void Dbg64_file_hdl_collect(Grp_hdl *, const char *); +void Dbg32_file_hdl_title(int); +void Dbg64_file_hdl_title(int); +void Dbg64_file_lazyload(Rt_map *, const char *, const char *); +void Dbg32_file_lazyload(Rt_map *, const char *, const char *); +void Dbg32_file_ldso(Rt_map *, char **, auxv_t *, const char *, Aliste); +void Dbg64_file_ldso(Rt_map *, char **, auxv_t *, const char *, Aliste); +void Dbg32_file_mode_promote(Rt_map *, int); +void Dbg64_file_mode_promote(Rt_map *, int); +void Dbg32_file_needed(Rt_map *, const char *); +void Dbg64_file_needed(Rt_map *, const char *); +void Dbg32_file_output(Ofl_desc *); +void Dbg64_file_output64(Ofl_desc *); +void Dbg32_file_preload(Lm_list *, const char *); +void Dbg64_file_preload(Lm_list *, const char *); +void Dbg32_file_prot(Rt_map *, int); +void Dbg64_file_prot(Rt_map *, int); +void Dbg32_file_rejected(Lm_list *, Rej_desc *); +void Dbg64_file_rejected(Lm_list *, Rej_desc *); +void Dbg32_file_reuse(Lm_list *, const char *, const char *); +void Dbg64_file_reuse(Lm_list *, const char *, const char *); +void Dbg32_file_skip(Lm_list *, const char *, const char *); +void Dbg64_file_skip(Lm_list *, const char *, const char *); + +void Dbg32_got_display(Ofl_desc *, Gottable *); +void Dbg64_got_display(Ofl_desc *, Gottable *); + +void Dbg32_libs_audit(Lm_list *, const char *, const char *); +void Dbg64_libs_audit(Lm_list *, const char *, const char *); +void Dbg32_libs_find(Lm_list *, const char *); +void Dbg64_libs_find(Lm_list *, const char *); +void Dbg32_libs_found(Lm_list *, const char *, int); +void Dbg64_libs_found(Lm_list *, const char *, int); +void Dbg32_libs_ignore(Lm_list *, const char *); +void Dbg64_libs_ignore(Lm_list *, const char *); +void Dbg32_libs_init(Lm_list *, List *, List *); +void Dbg64_libs_init(Lm_list *, List *, List *); +void Dbg32_libs_l(Lm_list *, const char *, const char *); +void Dbg64_libs_l(Lm_list *, const char *, const char *); +void Dbg32_libs_path(Lm_list *, const char *, Half, const char *); +void Dbg64_libs_path(Lm_list *, const char *, Half, const char *); +void Dbg32_libs_req(Lm_list *, const char *, const char *, const char *); +void Dbg64_libs_req(Lm_list *, const char *, const char *, const char *); +void Dbg32_libs_update(Lm_list *, List *, List *); +void Dbg64_libs_update(Lm_list *, List *, List *); +void Dbg32_libs_yp(Lm_list *, const char *); +void Dbg64_libs_yp(Lm_list *, const char *); +void Dbg32_libs_ylu(Lm_list *, const char *, const char *, int); +void Dbg64_libs_ylu(Lm_list *, const char *, const char *, int); + +void Dbg32_map_dash(Lm_list *, const char *, Sdf_desc *); +void Dbg64_map_dash(Lm_list *, const char *, Sdf_desc *); +void Dbg32_map_ent(Lm_list *, Boolean, Ent_desc *, Ofl_desc *); +void Dbg64_map_ent(Lm_list *, Boolean, Ent_desc *, Ofl_desc *); +void Dbg32_map_parse(Lm_list *, const char *); +void Dbg64_map_parse(Lm_list *, const char *); +void Dbg32_map_pipe(Lm_list *, Sg_desc *, const char *, Elf32_Word); +void Dbg64_map_pipe(Lm_list *, Sg_desc *, const char *, Elf64_Word); +void Dbg32_map_set_atsign(Boolean); +void Dbg64_map_set_atsign(Boolean); +void Dbg32_map_seg(Ofl_desc *, int, Sg_desc *); +void Dbg64_map_seg(Ofl_desc *, int, Sg_desc *); +void Dbg32_map_set_equal(Boolean); +void Dbg64_map_set_equal(Boolean); +void Dbg32_map_size_new(Lm_list *, const char *); +void Dbg64_map_size_new(Lm_list *, const char *); +void Dbg32_map_size_old(Ofl_desc *, Sym_desc *); +void Dbg64_map_size_old(Ofl_desc *, Sym_desc *); +void Dbg32_map_sort_fini(Lm_list *, Sg_desc *); +void Dbg64_map_sort_fini(Lm_list *, Sg_desc *); +void Dbg32_map_sort_orig(Lm_list *, Sg_desc *); +void Dbg64_map_sort_orig(Lm_list *, Sg_desc *); +void Dbg32_map_symbol(Ofl_desc *, Sym_desc *); +void Dbg64_map_symbol(Ofl_desc *, Sym_desc *); +void Dbg32_map_version(Lm_list *, const char *, const char *, int); +void Dbg64_map_version(Lm_list *, const char *, const char *, int); + +void Dbg32_move_adjexpandreloc(Lm_list *, Elf32_Word, const char *); +void Dbg64_move_adjexpandreloc(Lm_list *, Elf64_Xword, const char *); +void Dbg32_move_adjmovereloc(Lm_list *, Elf32_Word, Elf32_Word, + const char *); +void Dbg64_move_adjmovereloc(Lm_list *, Elf64_Xword, Elf64_Xword, + const char *); +void Dbg32_move_data(Rt_map *); +void Dbg64_move_data(Rt_map *); +void Dbg32_move_entry1(Lm_list *, int, Move *, Sym_desc *); +void Dbg64_move_entry1(Lm_list *, int, Move *, Sym_desc *); +void Dbg32_move_entry2(Lm_list *, Elf32_Move *, Elf32_Word, const char *); +void Dbg64_move_entry2(Lm_list *, Elf64_Move *, Elf64_Word, const char *); +void Dbg32_move_expand(Lm_list *, Elf32_Move *, Elf32_Addr); +void Dbg64_move_expand(Lm_list *, Elf64_Move *, Elf64_Addr); +void Dbg32_move_input(Lm_list *, const char *); +void Dbg64_move_input(Lm_list *, const char *); +void Dbg32_move_outmove(Lm_list *, const char *); +void Dbg64_move_outmove(Lm_list *, const char *); +void Dbg32_move_outsctadj(Lm_list *, Sym_desc *); +void Dbg64_move_outsctadj(Lm_list *, Sym_desc *); +void Dbg32_move_parexpn(Lm_list *, const char *, const char *); +void Dbg64_move_parexpn(Lm_list *, const char *, const char *); + +void Dbg32_reloc_apply_reg(Lm_list *, int, Elf32_Half, Elf32_Word, + Elf32_Word); +void Dbg64_reloc_apply_reg(Lm_list *, int, Elf64_Half, Elf64_Xword, + Elf64_Xword); +void Dbg32_reloc_apply_val(Lm_list *, int, Elf32_Word, Elf32_Word); +void Dbg64_reloc_apply_val(Lm_list *, int, Elf64_Xword, Elf64_Xword); +void Dbg32_reloc_ars_entry(Lm_list *, int, Elf32_Word, Elf32_Half, Rel_desc *); +void Dbg64_reloc_ars_entry(Lm_list *, int, Elf64_Word, Elf64_Half, Rel_desc *); +void Dbg32_reloc_copy(Rt_map *, Rt_map *, const char *, int); +void Dbg64_reloc_copy(Rt_map *, Rt_map *, const char *, int); +void Dbg32_reloc_discard(Lm_list *, Elf32_Half, Rel_desc *); +void Dbg64_reloc_discard(Lm_list *, Elf64_Half, Rel_desc *); +void Dbg32_reloc_doact(Lm_list *, int, Elf32_Half, Elf32_Word, Elf32_Word, + Elf32_Word, Elf32_Word, const char *, Os_desc *); +void Dbg64_reloc_doact(Lm_list *, int, Elf64_Half, Elf64_Word, Elf64_Word, + Elf64_Xword, Elf64_Xword, const char *, Os_desc *); +void Dbg32_reloc_doact_title(Lm_list *); +void Dbg64_reloc_doact_title(Lm_list *); +void Dbg32_reloc_dooutrel(Lm_list *, Elf32_Word); +void Dbg64_reloc_dooutrel(Lm_list *, Elf64_Word); +void Dbg32_reloc_entry(Lm_list *, const char *, Elf32_Half, Elf32_Word, + void *, const char *, const char *, const char *); +void Dbg64_reloc_entry(Lm_list *, const char *, Elf64_Half, Elf64_Word, + void *, const char *, const char *, const char *); +void Dbg32_reloc_error(Lm_list *, int, Elf32_Half, Elf32_Word, void *, + const char *); +void Dbg64_reloc_error(Lm_list *, int, Elf64_Half, Elf64_Word, void *, + const char *); +void Dbg32_reloc_generate(Lm_list *, Os_desc *, Elf32_Word); +void Dbg64_reloc_generate(Lm_list *, Os_desc *, Elf64_Word); +void Dbg32_reloc_in(Lm_list *, int, Elf32_Half, Elf32_Word, void *, + const char *, const char *); +void Dbg64_reloc_in(Lm_list *, int, Elf64_Half, Elf64_Word, void *, + const char *, const char *); +void Dbg32_reloc_ors_entry(Lm_list *, int, Elf32_Word, Elf32_Half, Rel_desc *); +void Dbg64_reloc_ors_entry(Lm_list *, int, Elf64_Word, Elf64_Half, Rel_desc *); +void Dbg32_reloc_out(Ofl_desc *, int, Elf32_Word, void *, const char *, + const char *); +void Dbg64_reloc_out(Ofl_desc *, int, Elf64_Word, void *, const char *, + const char *); +void Dbg32_reloc_proc(Lm_list *, Os_desc *, Is_desc *, Is_desc *); +void Dbg64_reloc_proc(Lm_list *, Os_desc *, Is_desc *, Is_desc *); +void Dbg32_reloc_run(Rt_map *, uint_t, int, int); +void Dbg64_reloc_run(Rt_map *, uint_t, int, int); +void Dbg32_reloc_transition(Lm_list *, Elf32_Half, Elf32_Word, Elf32_Word, + Elf32_Word, const char *); +void Dbg64_reloc_transition(Lm_list *, Elf64_Half, Elf64_Word, Elf64_Word, + Elf64_Xword, const char *); + +void Dbg32_sec_added(Lm_list *, Os_desc *, Sg_desc *); +void Dbg64_sec_added(Lm_list *, Os_desc *, Sg_desc *); +void Dbg32_sec_created(Lm_list *, Os_desc *, Sg_desc *); +void Dbg64_sec_created(Lm_list *, Os_desc *, Sg_desc *); +void Dbg32_sec_discarded(Lm_list *, Is_desc *, Is_desc *); +void Dbg64_sec_discarded(Lm_list *, Is_desc *, Is_desc *); +void Dbg32_sec_group(Lm_list *, Is_desc *, Group_desc *); +void Dbg64_sec_group(Lm_list *, Is_desc *, Group_desc *); +void Dbg32_sec_in(Lm_list *, Is_desc *); +void Dbg64_sec_in(Lm_list *, Is_desc *); +void Dbg32_sec_order_error(Lm_list *, Ifl_desc *, Elf32_Word, int); +void Dbg64_sec_order_error(Lm_list *, Ifl_desc *, Elf64_Word, int); +void Dbg32_sec_order_list(Ofl_desc *, int); +void Dbg64_sec_order_list(Ofl_desc *, int); +void Dbg32_sec_strtab(Lm_list *, Os_desc *, Str_tbl *); +void Dbg64_sec_strtab(Lm_list *, Os_desc *, Str_tbl *); + +void Dbg32_seg_desc_entry(Lm_list *, Elf32_Half, int, Sg_desc *); +void Dbg64_seg_desc_entry(Lm_list *, Elf64_Half, int, Sg_desc *); +void Dbg32_seg_entry(Ofl_desc *, int, Sg_desc *); +void Dbg64_seg_entry(Ofl_desc *, int, Sg_desc *); +void Dbg32_seg_list(Lm_list *, Elf32_Half, List *); +void Dbg64_seg_list(Lm_list *, Elf64_Half, List *); +void Dbg32_seg_os(Ofl_desc *, Os_desc *, int); +void Dbg64_seg_os(Ofl_desc *, Os_desc *, int); +void Dbg32_seg_title(Lm_list *); +void Dbg64_seg_title(Lm_list *); + +void Dbg32_statistics_ar(Ofl_desc *); +void Dbg64_statistics_ar(Ofl_desc *); +void Dbg32_statistics_ld(Ofl_desc *); +void Dbg64_statistics_ld(Ofl_desc *); + +void Dbg32_support_action(Lm_list *, const char *, const char *, Support_ndx, + const char *); +void Dbg64_support_action(Lm_list *, const char *, const char *, Support_ndx, + const char *); +void Dbg32_support_load(Lm_list *, const char *, const char *); +void Dbg64_support_load(Lm_list *, const char *, const char *); +void Dbg32_support_req(Lm_list *, const char *, int); +void Dbg64_support_req(Lm_list *, const char *, int); + +void Dbg32_syminfo_entry(Lm_list *, Elf32_Word, Syminfo *, Sym *, const char *, + Dyn *); +void Dbg64_syminfo_entry(Lm_list *, Elf64_Word, Syminfo *, Sym *, const char *, + Dyn *); +void Dbg32_syminfo_title(Lm_list *); +void Dbg64_syminfo_title(Lm_list *); + +void Dbg32_syms_ar_checking(Lm_list *, Xword, Elf_Arsym *, const char *); +void Dbg64_syms_ar_checking(Lm_list *, Xword, Elf_Arsym *, const char *); +void Dbg32_syms_ar_entry(Lm_list *, Xword, Elf_Arsym *); +void Dbg64_syms_ar_entry(Lm_list *, Xword, Elf_Arsym *); +void Dbg32_syms_ar_resolve(Lm_list *, Xword, Elf_Arsym *, const char *, int); +void Dbg64_syms_ar_resolve(Lm_list *, Xword, Elf_Arsym *, const char *, int); +void Dbg32_syms_ar_title(Lm_list *, const char *, int); +void Dbg64_syms_ar_title(Lm_list *, const char *, int); +void Dbg32_syms_created(Lm_list *, const char *); +void Dbg64_syms_created(Lm_list *, const char *); +void Dbg32_syms_discarded(Lm_list *, Sym_desc *, Is_desc *); +void Dbg64_syms_discarded(Lm_list *, Sym_desc *, Is_desc *); +void Dbg32_syms_dlsym(Rt_map *, const char *, const char *, int); +void Dbg64_syms_dlsym(Rt_map *, const char *, const char *, int); +void Dbg32_syms_entered(Ofl_desc *, Sym *, Sym_desc *); +void Dbg64_syms_entered(Ofl_desc *, Sym *, Sym_desc *); +void Dbg32_syms_entry(Lm_list *, Elf32_Word, Sym_desc *); +void Dbg64_syms_entry(Lm_list *, Elf64_Word, Sym_desc *); +void Dbg32_syms_global(Lm_list *, Elf32_Word, const char *); +void Dbg64_syms_global(Lm_list *, Elf64_Word, const char *); +void Dbg32_syms_ignore(Ofl_desc *, Sym_desc *); +void Dbg64_syms_ignore(Ofl_desc *, Sym_desc *); +void Dbg32_syms_lazy_rescan(Lm_list *, const char *); +void Dbg64_syms_lazy_rescan(Lm_list *, const char *); +void Dbg32_syms_lookup(Rt_map *, const char *, const char *); +void Dbg64_syms_lookup(Rt_map *, const char *, const char *); +void Dbg32_syms_lookup_aout(Lm_list *, const char *); +void Dbg32_syms_new(Ofl_desc *, Sym *, Sym_desc *); +void Dbg64_syms_new(Ofl_desc *, Sym *, Sym_desc *); +void Dbg32_syms_old(Ofl_desc *, Sym_desc *); +void Dbg64_syms_old(Ofl_desc *, Sym_desc *); +void Dbg32_syms_process(Lm_list *, Ifl_desc *); +void Dbg64_syms_process(Lm_list *, Ifl_desc *); +void Dbg32_syms_reduce(Ofl_desc *, int, Sym_desc *, int, const char *); +void Dbg64_syms_reduce(Ofl_desc *, int, Sym_desc *, int, const char *); +void Dbg32_syms_reloc(Ofl_desc *, Sym_desc *); +void Dbg64_syms_reloc(Ofl_desc *, Sym_desc *); +void Dbg32_syms_resolved(Ofl_desc *, Sym_desc *); +void Dbg64_syms_resolved(Ofl_desc *, Sym_desc *); +void Dbg32_syms_resolving(Ofl_desc *, Elf32_Word, const char *, int, int, + Sym *, Sym *, Sym_desc *, Ifl_desc *); +void Dbg64_syms_resolving(Ofl_desc *, Elf64_Word, const char *, int, int, + Sym *, Sym *, Sym_desc *, Ifl_desc *); +void Dbg32_syms_sec_entry(Lm_list *, Elf32_Word, Sg_desc *, Os_desc *); +void Dbg64_syms_sec_entry(Lm_list *, Elf64_Word, Sg_desc *, Os_desc *); +void Dbg32_syms_sec_title(Lm_list *); +void Dbg64_syms_sec_title(Lm_list *); +void Dbg32_syms_spec_title(Lm_list *); +void Dbg64_syms_spec_title(Lm_list *); +void Dbg32_syms_updated(Ofl_desc *, Sym_desc *, const char *); +void Dbg64_syms_updated(Ofl_desc *, Sym_desc *, const char *); +void Dbg32_syms_up_title(Lm_list *); +void Dbg64_syms_up_title(Lm_list *); + +void Dbg32_util_broadcast(Rt_map *); +void Dbg64_util_broadcast(Rt_map *); +void Dbg32_util_call_array(Rt_map *, void *, int, Elf32_Word); +void Dbg64_util_call_array(Rt_map *, void *, int, Elf64_Word); +void Dbg32_util_call_fini(Rt_map *); +void Dbg64_util_call_fini(Rt_map *); +void Dbg32_util_call_init(Rt_map *, int); +void Dbg64_util_call_init(Rt_map *, int); +void Dbg32_util_call_main(Rt_map *); +void Dbg64_util_call_main(Rt_map *); +void Dbg32_util_collect(Rt_map *, int, int); +void Dbg64_util_collect(Rt_map *, int, int); +void Dbg32_util_dbnotify(Lm_list *, rd_event_e, r_state_e); +void Dbg64_util_dbnotify(Lm_list *, rd_event_e, r_state_e); +void Dbg32_util_edge_in(Lm_list *, Rt_map *, uint_t, Rt_map *, int, int); +void Dbg64_util_edge_in(Lm_list *, Rt_map *, uint_t, Rt_map *, int, int); +void Dbg32_util_edge_out(Rt_map *, Rt_map *); +void Dbg64_util_edge_out(Rt_map *, Rt_map *); +void Dbg32_util_intoolate(Rt_map *); +void Dbg64_util_intoolate(Rt_map *); +void Dbg32_util_nl(Lm_list *, int); +void Dbg64_util_nl(Lm_list *, int); +void Dbg32_util_no_init(Rt_map *); +void Dbg64_util_no_init(Rt_map *); +void Dbg32_util_scc_entry(Rt_map *, uint_t); +void Dbg64_util_scc_entry(Rt_map *, uint_t); +void Dbg32_util_scc_title(Lm_list *, int); +void Dbg64_util_scc_title(Lm_list *, int); +void Dbg32_util_str(Lm_list *, const char *); +void Dbg64_util_str(Lm_list *, const char *); +void Dbg32_util_wait(Rt_map *, Rt_map *, int); +void Dbg64_util_wait(Rt_map *, Rt_map *, int); + +void Dbg32_unused_file(Lm_list *, const char *, int, uint_t); +void Dbg64_unused_file(Lm_list *, const char *, int, uint_t); +void Dbg32_unused_rtldinfo(Rt_map *); +void Dbg64_unused_rtldinfo(Rt_map *); +void Dbg32_unused_sec(Lm_list *, Is_desc *); +void Dbg64_unused_sec(Lm_list *, Is_desc *); +void Dbg32_unused_unref(Rt_map *, const char *); +void Dbg64_unused_unref(Rt_map *, const char *); + +void Dbg32_ver_need_entry(Lm_list *, Half, const char *, const char *); +void Dbg64_ver_need_entry(Lm_list *, Half, const char *, const char *); +void Dbg32_ver_need_title(Lm_list *, const char *); +void Dbg64_ver_need_title(Lm_list *, const char *); + +const char *Elf_demangle_name(const char *); + +void Elf_syminfo_entry(Lm_list *, Word, Syminfo *, const char *, const char *); +void Elf_syminfo_title(Lm_list *); +void Elf_ver_def_title(Lm_list *); +void Elf_ver_need_title(Lm_list *); +void Elf_ver_line_1(Lm_list *, const char *, const char *, const char *, + const char *); +void Elf_ver_line_2(Lm_list *, const char *, const char *); +void Elf_ver_line_3(Lm_list *, const char *, const char *, const char *); +void Elf_ver_line_4(Lm_list *, const char *); +void Elf_ver_line_5(Lm_list *, const char *, const char *); + +void Elf64_cap_entry(Lm_list *, Elf64_Cap *, int ndx, Elf64_Half); +void Elf32_cap_entry(Lm_list *, Elf32_Cap *, int ndx, Elf32_Half); +void Elf64_cap_title(Lm_list *); +void Elf32_cap_title(Lm_list *); + +void Elf64_dyn_entry(Lm_list *, Elf64_Dyn *, int, const char *, Elf64_Half); +void Elf32_dyn_entry(Lm_list *, Elf32_Dyn *, int, const char *, Elf32_Half); +void Elf64_dyn_title(Lm_list *); +void Elf32_dyn_title(Lm_list *); + +void Elf64_ehdr(Lm_list *, Elf64_Ehdr *, Elf64_Shdr *); +void Elf32_ehdr(Lm_list *, Elf32_Ehdr *, Elf32_Shdr *); + +void Elf64_got_entry(Lm_list *, Elf64_Sword, Elf64_Addr, Elf64_Xword, + Elf64_Half, Elf64_Word, void *, const char *); +void Elf32_got_entry(Lm_list *, Elf32_Sword, Elf32_Addr, Elf32_Word, + Elf32_Half, Elf32_Word, void *, const char *); +void Elf64_got_title(Lm_list *); +void Elf32_got_title(Lm_list *); + +void Elf64_phdr(Lm_list *, Elf64_Half, Elf64_Phdr *); +void Elf32_phdr(Lm_list *, Elf32_Half, Elf32_Phdr *); + +void Elf64_reloc_apply_reg(Lm_list *, int, Elf64_Half, Elf64_Xword, + Elf64_Xword); +void Elf32_reloc_apply_reg(Lm_list *, int, Elf32_Half, Elf32_Word, + Elf32_Word); +void Elf64_reloc_apply_val(Lm_list *, int, Elf64_Xword, Elf64_Xword); +void Elf32_reloc_apply_val(Lm_list *, int, Elf32_Word, Elf32_Word); +void Elf64_reloc_entry_1(Lm_list *, int, const char *, Elf64_Half, Word, void *, + const char *, const char *, const char *); +void Elf32_reloc_entry_1(Lm_list *, int, const char *, Elf32_Half, Word, void *, + const char *, const char *, const char *); +void Elf64_reloc_entry_2(Lm_list *, int, const char *, Word, const char *, + Elf64_Addr, Elf64_Sxword, const char *, const char *, const char *); +void Elf32_reloc_entry_2(Lm_list *, int, const char *, Word, const char *, + Elf32_Addr, Elf32_Sword, const char *, const char *, const char *); +void Elf64_reloc_title(Lm_list *, int, Word); +void Elf32_reloc_title(Lm_list *, int, Word); + +void Elf64_shdr(Lm_list *, Elf64_Half, Elf64_Shdr *); +void Elf32_shdr(Lm_list *, Elf32_Half, Elf32_Shdr *); + +void Elf64_syms_table_entry(Lm_list *, int, const char *, Elf64_Half, + Elf64_Sym *, Elf64_Word, const char *, const char *); +void Elf32_syms_table_entry(Lm_list *, int, const char *, Elf32_Half, + Elf32_Sym *, Elf32_Word, const char *, const char *); +void Elf64_syms_table_title(Lm_list *, int); +void Elf32_syms_table_title(Lm_list *, int); diff --git a/usr/src/cmd/sgs/liblddbg/common/map.c b/usr/src/cmd/sgs/liblddbg/common/map.c index 1d05a9f440..e00c5a762b 100644 --- a/usr/src/cmd/sgs/liblddbg/common/map.c +++ b/usr/src/cmd/sgs/liblddbg/common/map.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 2000 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -30,14 +30,38 @@ #include "libld.h" static const char - *_Dbg_decl = NULL; + *Dbg_decl = NULL; + +void +Dbg_map_set_atsign(Boolean new) +{ + if (DBG_NOTCLASS(DBG_C_MAP)) + return; + + if (new) + Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_4); + else + Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_5); +} void -Dbg_map_version(const char *version, const char *name, int scope) +Dbg_map_set_equal(Boolean new) +{ + if (DBG_NOTCLASS(DBG_C_MAP)) + return; + + if (new) + Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_1); + else + Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_2); +} + +void +Dbg_map_version(Lm_list *lml, const char *version, const char *name, int scope) { const char *str, *scp; - if (DBG_NOTCLASS(DBG_MAP | DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_MAP | DBG_C_SYMBOLS)) return; str = MSG_INTL(MSG_MAP_SYM_SCOPE); @@ -47,65 +71,70 @@ Dbg_map_version(const char *version, const char *name, int scope) scp = MSG_ORIG(MSG_SYM_LOCAL); if (version) - dbg_print(MSG_INTL(MSG_MAP_SYM_VER_1), str, version, - _Dbg_sym_dem(name), scp); + dbg_print(lml, MSG_INTL(MSG_MAP_SYM_VER_1), str, version, + Dbg_demangle_name(name), scp); else - dbg_print(MSG_INTL(MSG_MAP_SYM_VER_2), str, - _Dbg_sym_dem(name), scp); + dbg_print(lml, MSG_INTL(MSG_MAP_SYM_VER_2), str, + Dbg_demangle_name(name), scp); } void -Dbg_map_size_new(const char *name) +Dbg_map_size_new(Lm_list *lml, const char *name) { - if (DBG_NOTCLASS(DBG_MAP)) + if (DBG_NOTCLASS(DBG_C_MAP)) return; - dbg_print(MSG_INTL(MSG_MAP_SYM_SIZE), _Dbg_sym_dem(name), + dbg_print(lml, MSG_INTL(MSG_MAP_SYM_SIZE), Dbg_demangle_name(name), MSG_INTL(MSG_STR_ADD)); } void -Dbg_map_size_old(Ehdr *ehdr, Sym_desc *sdp) +Dbg_map_size_old(Ofl_desc *ofl, Sym_desc *sdp) { - if (DBG_NOTCLASS(DBG_MAP)) + Lm_list *lml = ofl->ofl_lml; + + if (DBG_NOTCLASS(DBG_C_MAP)) return; - dbg_print(MSG_INTL(MSG_MAP_SYM_SIZE), sdp->sd_name, + dbg_print(lml, MSG_INTL(MSG_MAP_SYM_SIZE), sdp->sd_name, MSG_INTL(MSG_STR_UP_1)); if (DBG_NOTDETAIL()) return; - Elf_sym_table_entry(MSG_INTL(MSG_STR_UP_2), ehdr, sdp->sd_sym, + Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_INTL(MSG_STR_UP_2), + ofl->ofl_dehdr->e_machine, sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL, - conv_deftag_str(sdp->sd_ref)); + conv_def_tag(sdp->sd_ref)); } -/* - * Provide for printing mapfile entered symbols when symbol debugging hasn't - * been enabled. - */ void -Dbg_map_symbol(Ehdr *ehdr, Sym_desc *sdp) +Dbg_map_symbol(Ofl_desc *ofl, Sym_desc *sdp) { - if (DBG_NOTCLASS(DBG_MAP)) + Lm_list *lml = ofl->ofl_lml; + + if (DBG_NOTCLASS(DBG_C_MAP)) return; if (DBG_NOTDETAIL()) return; - if (DBG_NOTCLASS(DBG_SYMBOLS)) - Elf_sym_table_entry(MSG_INTL(MSG_STR_ENTERED), ehdr, - sdp->sd_sym, + /* + * Provide for printing mapfile entered symbols when symbol debugging + * hasn't been enabled. + */ + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) + Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_INTL(MSG_STR_ENTERED), + ofl->ofl_dehdr->e_machine, sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL, - conv_deftag_str(sdp->sd_ref)); + conv_def_tag(sdp->sd_ref)); } void -Dbg_map_dash(const char *name, Sdf_desc *sdf) +Dbg_map_dash(Lm_list *lml, const char *name, Sdf_desc *sdf) { const char *str; - if (DBG_NOTCLASS(DBG_MAP)) + if (DBG_NOTCLASS(DBG_C_MAP)) return; if (sdf->sdf_flags & FLG_SDF_SONAME) @@ -113,15 +142,15 @@ Dbg_map_dash(const char *name, Sdf_desc *sdf) else str = MSG_INTL(MSG_MAP_CNT_DEF_2); - dbg_print(str, name, sdf->sdf_soname); + dbg_print(lml, str, name, sdf->sdf_soname); } void -Dbg_map_sort_orig(Sg_desc *sgp) +Dbg_map_sort_orig(Lm_list *lml, Sg_desc *sgp) { const char *str; - if (DBG_NOTCLASS(DBG_MAP)) + if (DBG_NOTCLASS(DBG_C_MAP)) return; if (DBG_NOTDETAIL()) return; @@ -131,15 +160,15 @@ Dbg_map_sort_orig(Sg_desc *sgp) else str = MSG_INTL(MSG_STR_NULL); - dbg_print(MSG_INTL(MSG_MAP_SORTSEG), str); + dbg_print(lml, MSG_INTL(MSG_MAP_SORTSEG), str); } void -Dbg_map_sort_fini(Sg_desc *sgp) +Dbg_map_sort_fini(Lm_list *lml, Sg_desc *sgp) { const char *str; - if (DBG_NOTCLASS(DBG_MAP)) + if (DBG_NOTCLASS(DBG_C_MAP)) return; if (DBG_NOTDETAIL()) return; @@ -149,75 +178,54 @@ Dbg_map_sort_fini(Sg_desc *sgp) else str = MSG_INTL(MSG_STR_NULL); - dbg_print(MSG_INTL(MSG_MAP_SEGSORT), str); -} - -void -Dbg_map_parse(const char *file) -{ - if (DBG_NOTCLASS(DBG_MAP)) - return; - - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_MAP_MAPFILE), file); + dbg_print(lml, MSG_INTL(MSG_MAP_SEGSORT), str); } void -Dbg_map_equal(Boolean new) +Dbg_map_parse(Lm_list *lml, const char *file) { - if (DBG_NOTCLASS(DBG_MAP)) + if (DBG_NOTCLASS(DBG_C_MAP)) return; - if (new) - _Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_1); - else - _Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_2); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_MAP_MAPFILE), file); } void -Dbg_map_ent(Boolean new, Ent_desc *enp, Ofl_desc *ofl) +Dbg_map_ent(Lm_list *lml, Boolean new, Ent_desc *enp, Ofl_desc *ofl) { - if (DBG_NOTCLASS(DBG_MAP)) + if (DBG_NOTCLASS(DBG_C_MAP)) return; - dbg_print(MSG_INTL(MSG_MAP_MAP_DIR)); - _Dbg_ent_entry(ofl->ofl_e_machine, enp); + dbg_print(lml, MSG_INTL(MSG_MAP_MAP_DIR)); + Dbg_ent_entry(lml, ofl->ofl_dehdr->e_machine, enp); if (new) - _Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_3); + Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_3); } void -Dbg_map_atsign(Boolean new) +Dbg_map_pipe(Lm_list *lml, Sg_desc *sgp, const char *sec_name, const Word ndx) { - if (DBG_NOTCLASS(DBG_MAP)) + if (DBG_NOTCLASS(DBG_C_MAP)) return; - if (new) - _Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_4); - else - _Dbg_decl = MSG_INTL(MSG_MAP_SEG_DECL_5); -} - -void -Dbg_map_pipe(Sg_desc *sgp, const char *sec_name, const Word ndx) -{ - if (DBG_NOTCLASS(DBG_MAP)) - return; - - dbg_print(MSG_INTL(MSG_MAP_SEC_ORDER), sgp->sg_name, sec_name, + dbg_print(lml, MSG_INTL(MSG_MAP_SEC_ORDER), sgp->sg_name, sec_name, EC_WORD(ndx)); } void -Dbg_map_seg(Half mach, int ndx, Sg_desc *sgp) +Dbg_map_seg(Ofl_desc *ofl, int ndx, Sg_desc *sgp) { - if (DBG_NOTCLASS(DBG_MAP)) + Lm_list *lml = ofl->ofl_lml; + + if (DBG_NOTCLASS(DBG_C_MAP)) return; - if (_Dbg_decl) { - dbg_print(MSG_ORIG(MSG_FMT_STR), _Dbg_decl); - _Dbg_seg_desc_entry(mach, ndx, sgp); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - _Dbg_decl = NULL; + if (Dbg_decl) { + dbg_print(lml, MSG_ORIG(MSG_FMT_STR), Dbg_decl); + Dbg_seg_desc_entry(ofl->ofl_lml, + ofl->ofl_dehdr->e_machine, ndx, sgp); + Dbg_util_nl(lml, DBG_NL_STD); + Dbg_decl = NULL; } } diff --git a/usr/src/cmd/sgs/liblddbg/common/mapfile-vers b/usr/src/cmd/sgs/liblddbg/common/mapfile-vers index 67c1d7c3da..5c0809a945 100644 --- a/usr/src/cmd/sgs/liblddbg/common/mapfile-vers +++ b/usr/src/cmd/sgs/liblddbg/common/mapfile-vers @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ # # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -39,8 +38,11 @@ # Policy for Shared Library Version Names and Interface Definitions -SUNWprivate_4.47 { +SUNWprivate_4.50 { global: + dbg_desc = NODIRECT; # interposed - ld.so.1(1) + dbg_print = NODIRECT; # interposed - ld(1) and ld.so.1(1) + Dbg_args_files; Dbg_args_flags; Dbg_audit_interface; @@ -48,294 +50,369 @@ SUNWprivate_4.47 { Dbg_audit_object; Dbg_audit_symval; Dbg_audit_version; - Dbg_bind_global; - Dbg_bind_profile; - Dbg_bind_weak; - Dbg_bind_plt_summary; - Dbg_cap_hw_candidate; - Dbg_cap_hw_filter; - Dbg_cap_hw_1; - Dbg_cap_hw_164; - Dbg_cap_mapfile; - Dbg_cap_mapfile64; - Dbg_cap_sec_entry; - Dbg_cap_sec_entry64; - Dbg_cap_sec_title; - Dbg_ent_print; - Dbg_file_analyze; - Dbg_file_aout; - Dbg_file_archive; - Dbg_file_ar_rescan; - Dbg_file_bind_entry; - Dbg_file_bindings; - Dbg_file_cntl; - Dbg_file_config_dis; - Dbg_file_config_obj; - Dbg_file_delete; - Dbg_file_dlclose; - Dbg_file_dldump; - Dbg_file_dlopen; - Dbg_file_elf; - Dbg_file_filtee; - Dbg_file_filter; - Dbg_file_fixname; - Dbg_file_generic; - Dbg_file_hdl_action; - Dbg_file_hdl_collect; - Dbg_file_hdl_title; - Dbg_file_lazyload; - Dbg_file_ldso; - Dbg_file_mode_promote; - Dbg_file_needed; - Dbg_file_nl; - Dbg_file_output; - Dbg_file_preload; - Dbg_file_prot; - Dbg_file_rejected; - Dbg_file_del_rescan; - Dbg_file_reuse; - Dbg_file_skip; - Dbg_got_display; - Dbg_libs_audit; - Dbg_libs_ignore; - Dbg_libs_init; - Dbg_libs_l; - Dbg_libs_path; - Dbg_libs_req; - Dbg_libs_update; - Dbg_libs_yp; - Dbg_libs_ylu; - Dbg_libs_find; - Dbg_libs_found; - Dbg_map_atsign; - Dbg_map_dash; - Dbg_map_ent; - Dbg_map_equal; - Dbg_map_parse; - Dbg_map_pipe; - Dbg_map_seg; - Dbg_map_size_new; - Dbg_map_size_old; - Dbg_map_sort_fini; - Dbg_map_sort_orig; - Dbg_map_symbol; - Dbg_map_version; - Dbg_move_adjexpandreloc; - Dbg_move_adjmovereloc; - Dbg_move_data; - Dbg_move_expanding; - Dbg_move_input1; - Dbg_move_outsctadj; - Dbg_move_outsctadj64; - Dbg_move_outmove; - Dbg_move_mventry; - Dbg_move_mventry64; - Dbg_move_mventry2; - Dbg_move_mventry264; - Dbg_move_parexpn; - Dbg_reloc_apply; - Dbg_reloc_ars_entry; - Dbg_reloc_copy; - Dbg_reloc_discard; - Dbg_reloc_doact; - Dbg_reloc_doactiverel; - Dbg_reloc_dooutrel; - Dbg_reloc_error; - Dbg_reloc_generate; - Dbg_reloc_in; - Dbg_reloc_ors_entry; - Dbg_reloc_out; - Dbg_reloc_proc; - Dbg_reloc_reg_apply; - Dbg_reloc_run; - Dbg_reloc_transition; - Dbg_sec_added; - Dbg_sec_created; - Dbg_sec_discarded; - Dbg_sec_group; - Dbg_sec_in; - Dbg_sec_order_list; - Dbg_sec_order_error; - Dbg_sec_strtab; - Dbg_seg_entry; - Dbg_seg_list; - Dbg_seg_os; - Dbg_seg_title; + Dbg_setup; - Dbg_statistics_ar; - Dbg_statistics_ld; - Dbg_syms_ar_checking; - Dbg_syms_ar_entry; - Dbg_syms_ar_resolve; - Dbg_syms_ar_title; - Dbg_syms_created; - Dbg_syms_discarded; - Dbg_syms_entered; - Dbg_syms_entry; - Dbg_syms_global; - Dbg_syms_ignore; - Dbg_syms_lazy_rescan; - Dbg_syms_new; - Dbg_syms_nl; - Dbg_syms_old; - Dbg_syms_process; - Dbg_syms_reduce; - Dbg_syms_reloc; - Dbg_syms_resolved; - Dbg_syms_resolving1; - Dbg_syms_resolving2; - Dbg_syms_sec_entry; - Dbg_syms_sec_title; - Dbg_syms_spec_title; - Dbg_syms_up_title; - Dbg_syms_updated; - Dbg_syms_dlsym; - Dbg_syms_lookup_aout; - Dbg_syms_lookup; - Dbg_syminfo_entry; - Dbg_syminfo_title; - Dbg_support_action; - Dbg_support_load; - Dbg_support_req; + + Dbg32_bind_global; + Dbg64_bind_global; + Dbg32_bind_plt_summary; + Dbg64_bind_plt_summary; + Dbg64_bind_pltpad_from; + Dbg64_bind_pltpad_to; + Dbg32_bind_weak; + Dbg64_bind_weak; + + Dbg32_cap_hw_candidate; + Dbg64_cap_hw_candidate; + Dbg32_cap_hw_filter; + Dbg64_cap_hw_filter; + Dbg32_cap_mapfile; + Dbg64_cap_mapfile; + Dbg32_cap_sec_entry; + Dbg64_cap_sec_entry; + Dbg32_cap_sec_title; + Dbg64_cap_sec_title; + Dbg32_cap_val_hw1; + Dbg64_cap_val_hw1; + + Dbg32_demangle_name; + Dbg64_demangle_name; + + Dbg32_ent_print; + Dbg64_ent_print; + + Dbg32_file_analyze; + Dbg64_file_analyze; + Dbg32_file_aout; + Dbg64_file_aout; + Dbg32_file_ar; + Dbg64_file_ar; + Dbg32_file_ar_rescan; + Dbg64_file_ar_rescan; + Dbg32_file_bind_entry; + Dbg64_file_bind_entry; + Dbg32_file_bindings; + Dbg64_file_bindings; + Dbg32_file_cntl; + Dbg64_file_cntl; + Dbg32_file_config_dis; + Dbg64_file_config_dis; + Dbg32_file_config_obj; + Dbg64_file_config_obj; + Dbg32_file_del_rescan; + Dbg64_file_del_rescan; + Dbg32_file_delete; + Dbg64_file_delete; + Dbg32_file_dlclose; + Dbg64_file_dlclose; + Dbg32_file_dldump; + Dbg64_file_dldump; + Dbg32_file_dlopen; + Dbg64_file_dlopen; + Dbg32_file_elf; + Dbg64_file_elf; + Dbg32_file_filtee; + Dbg64_file_filtee; + Dbg32_file_filter; + Dbg64_file_filter; + Dbg32_file_fixname; + Dbg64_file_fixname; + Dbg32_file_generic; + Dbg64_file_generic; + Dbg32_file_hdl_action; + Dbg64_file_hdl_action; + Dbg32_file_hdl_collect; + Dbg64_file_hdl_collect; + Dbg32_file_hdl_title; + Dbg64_file_hdl_title; + Dbg32_file_lazyload; + Dbg64_file_lazyload; + Dbg32_file_ldso; + Dbg64_file_ldso; + Dbg32_file_mode_promote; + Dbg64_file_mode_promote; + Dbg32_file_needed; + Dbg64_file_needed; + Dbg32_file_output; + Dbg64_file_output; + Dbg32_file_preload; + Dbg64_file_preload; + Dbg32_file_prot; + Dbg64_file_prot; + Dbg32_file_rejected; + Dbg64_file_rejected; + Dbg32_file_reuse; + Dbg64_file_reuse; + Dbg32_file_skip; + Dbg64_file_skip; + + Dbg32_got_display; + Dbg64_got_display; + + Dbg32_libs_audit; + Dbg64_libs_audit; + Dbg32_libs_find; + Dbg64_libs_find; + Dbg32_libs_found; + Dbg64_libs_found; + Dbg32_libs_ignore; + Dbg64_libs_ignore; + Dbg32_libs_init; + Dbg64_libs_init; + Dbg32_libs_l; + Dbg64_libs_l; + Dbg32_libs_path; + Dbg64_libs_path; + Dbg32_libs_req; + Dbg64_libs_req; + Dbg32_libs_update; + Dbg64_libs_update; + Dbg32_libs_yp; + Dbg64_libs_yp; + Dbg32_libs_ylu; + Dbg64_libs_ylu; + + Dbg32_map_dash; + Dbg64_map_dash; + Dbg32_map_ent; + Dbg64_map_ent; + Dbg32_map_parse; + Dbg64_map_parse; + Dbg32_map_pipe; + Dbg64_map_pipe; + Dbg32_map_set_atsign; + Dbg64_map_set_atsign; + Dbg32_map_seg; + Dbg64_map_seg; + Dbg32_map_set_equal; + Dbg64_map_set_equal; + Dbg32_map_size_new; + Dbg64_map_size_new; + Dbg32_map_size_old; + Dbg64_map_size_old; + Dbg32_map_sort_fini; + Dbg64_map_sort_fini; + Dbg32_map_sort_orig; + Dbg64_map_sort_orig; + Dbg32_map_symbol; + Dbg64_map_symbol; + Dbg32_map_version; + Dbg64_map_version; + + Dbg32_move_adjexpandreloc; + Dbg64_move_adjexpandreloc; + Dbg32_move_adjmovereloc; + Dbg64_move_adjmovereloc; + Dbg32_move_data; + Dbg64_move_data; + Dbg32_move_entry1; + Dbg64_move_entry1; + Dbg32_move_entry2; + Dbg64_move_entry2; + Dbg32_move_expand; + Dbg64_move_expand; + Dbg32_move_input; + Dbg64_move_input; + Dbg32_move_outmove; + Dbg64_move_outmove; + Dbg32_move_outsctadj; + Dbg64_move_outsctadj; + Dbg32_move_parexpn; + Dbg64_move_parexpn; + + Dbg32_reloc_apply_reg; + Dbg64_reloc_apply_reg; + Dbg32_reloc_apply_val; + Dbg64_reloc_apply_val; + Dbg32_reloc_ars_entry; + Dbg64_reloc_ars_entry; + Dbg32_reloc_copy; + Dbg64_reloc_copy; + Dbg32_reloc_discard; + Dbg64_reloc_discard; + Dbg32_reloc_doact; + Dbg64_reloc_doact; + Dbg32_reloc_doact_title; + Dbg64_reloc_doact_title; + Dbg32_reloc_dooutrel; + Dbg64_reloc_dooutrel; + Dbg32_reloc_entry; + Dbg64_reloc_entry; + Dbg32_reloc_error; + Dbg64_reloc_error; + Dbg32_reloc_generate; + Dbg64_reloc_generate; + Dbg32_reloc_in; + Dbg64_reloc_in; + Dbg32_reloc_ors_entry; + Dbg64_reloc_ors_entry; + Dbg32_reloc_out; + Dbg64_reloc_out; + Dbg32_reloc_proc; + Dbg64_reloc_proc; + Dbg32_reloc_run; + Dbg64_reloc_run; + Dbg32_reloc_transition; + Dbg64_reloc_transition; + + Dbg32_sec_added; + Dbg64_sec_added; + Dbg32_sec_created; + Dbg64_sec_created; + Dbg32_sec_discarded; + Dbg64_sec_discarded; + Dbg32_sec_group; + Dbg64_sec_group; + Dbg32_sec_in; + Dbg64_sec_in; + Dbg32_sec_order_error; + Dbg64_sec_order_error; + Dbg32_sec_order_list; + Dbg64_sec_order_list; + Dbg32_sec_strtab; + Dbg64_sec_strtab; + + Dbg32_seg_entry; + Dbg64_seg_entry; + Dbg32_seg_list; + Dbg64_seg_list; + Dbg32_seg_os; + Dbg64_seg_os; + Dbg32_seg_title; + Dbg64_seg_title; + + Dbg32_statistics_ar; + Dbg64_statistics_ar; + Dbg32_statistics_ld; + Dbg64_statistics_ld; + + Dbg32_support_action; + Dbg64_support_action; + Dbg32_support_load; + Dbg64_support_load; + Dbg32_support_req; + Dbg64_support_req; + + Dbg32_syminfo_entry; + Dbg64_syminfo_entry; + Dbg32_syminfo_title; + Dbg64_syminfo_title; + + Dbg32_syms_ar_checking; + Dbg64_syms_ar_checking; + Dbg32_syms_ar_entry; + Dbg64_syms_ar_entry; + Dbg32_syms_ar_resolve; + Dbg64_syms_ar_resolve; + Dbg32_syms_ar_title; + Dbg64_syms_ar_title; + Dbg32_syms_created; + Dbg64_syms_created; + Dbg32_syms_discarded; + Dbg64_syms_discarded; + Dbg32_syms_dlsym; + Dbg64_syms_dlsym; + Dbg32_syms_entered; + Dbg64_syms_entered; + Dbg32_syms_entry; + Dbg64_syms_entry; + Dbg32_syms_global; + Dbg64_syms_global; + Dbg32_syms_ignore; + Dbg64_syms_ignore; + Dbg32_syms_lazy_rescan; + Dbg64_syms_lazy_rescan; + Dbg32_syms_lookup; + Dbg64_syms_lookup; + Dbg32_syms_lookup_aout; + Dbg32_syms_new; + Dbg64_syms_new; + Dbg32_syms_old; + Dbg64_syms_old; + Dbg32_syms_process; + Dbg64_syms_process; + Dbg32_syms_reduce; + Dbg64_syms_reduce; + Dbg32_syms_reloc; + Dbg64_syms_reloc; + Dbg32_syms_resolved; + Dbg64_syms_resolved; + Dbg32_syms_resolving; + Dbg64_syms_resolving; + Dbg32_syms_sec_entry; + Dbg64_syms_sec_entry; + Dbg32_syms_sec_title; + Dbg64_syms_sec_title; + Dbg32_syms_spec_title; + Dbg64_syms_spec_title; + Dbg32_syms_updated; + Dbg64_syms_updated; + Dbg32_syms_up_title; + Dbg64_syms_up_title; + Dbg_tls_modactivity; Dbg_tls_static_block; - Dbg_unused_file; - Dbg_unused_rtldinfo; - Dbg_unused_sec; - Dbg_unused_unref; - Dbg_util_broadcast; - Dbg_util_call_array; - Dbg_util_call_fini; - Dbg_util_call_init; - Dbg_util_call_main; - Dbg_util_collect; - Dbg_util_dbnotify; - Dbg_util_edge_in; - Dbg_util_edge_out; - Dbg_util_intoolate; - Dbg_util_nl; - Dbg_util_no_init; - Dbg_util_scc_entry; - Dbg_util_scc_title; - Dbg_util_str; - Dbg_util_wait; - Dbg_ver_avail_entry; - Dbg_ver_avail_entry64; - Dbg_ver_avail_title; - Dbg_ver_def_title; - Dbg_ver_desc_entry; - Dbg_ver_desc_entry64; - Dbg_ver_need_title; - Dbg_ver_need_entry; - Dbg_ver_nointerface; - Dbg_ver_symbol; - Dbg_audit_interface64; - Dbg_audit_lib64; - Dbg_audit_object64; - Dbg_audit_symval64; - Dbg_audit_version64; - Dbg_file_analyze64; - Dbg_file_aout64; - Dbg_file_archive64; - Dbg_file_bind_entry64; - Dbg_file_bindings64; - Dbg_file_config_dis64; - Dbg_file_config_obj64; - Dbg_file_delete64; - Dbg_file_dlclose64; - Dbg_file_dldump64; - Dbg_file_dlopen64; - Dbg_file_elf64; - Dbg_file_filtee64; - Dbg_file_filter64; - Dbg_file_fixname64; - Dbg_file_generic64; - Dbg_file_hdl_action64; - Dbg_file_hdl_collect64; - Dbg_file_hdl_title64; - Dbg_file_lazyload64; - Dbg_file_ldso64; - Dbg_file_needed64; - Dbg_file_nl64; - Dbg_file_output64; - Dbg_file_preload64; - Dbg_file_prot64; - Dbg_file_reuse64; - Dbg_file_skip64; - Dbg_got_display64; - Dbg_map_atsign64; - Dbg_map_dash64; - Dbg_map_ent64; - Dbg_map_equal64; - Dbg_map_parse64; - Dbg_map_pipe64; - Dbg_map_seg64; - Dbg_map_size_new64; - Dbg_map_size_old64; - Dbg_map_sort_fini64; - Dbg_map_sort_orig64; - Dbg_map_symbol64; - Dbg_map_version64; - Dbg_pltpad_bindto64; - Dbg_pltpad_boundto64; - Dbg_reloc_ars_entry64; - Dbg_reloc_discard64; - Dbg_reloc_doact64; - Dbg_reloc_dooutrel64; - Dbg_reloc_error64; - Dbg_reloc_generate64; - Dbg_reloc_in64; - Dbg_reloc_ors_entry64; - Dbg_reloc_out64; - Dbg_reloc_proc64; - Dbg_reloc_reg_apply64; - Dbg_reloc_transition64; - Dbg_sec_added64; - Dbg_sec_created64; - Dbg_sec_discarded64; - Dbg_sec_group64; - Dbg_sec_in64; - Dbg_sec_order_list64; - Dbg_sec_order_error64; - Dbg_sec_strtab64; - Dbg_seg_entry64; - Dbg_seg_list64; - Dbg_seg_os64; - Dbg_seg_title64; - Dbg_statistics_ar64; - Dbg_statistics_ld64; - Dbg_syminfo_entry64; - Dbg_syminfo_title64; - Dbg_syms_ar_entry64; - Dbg_syms_ar_resolve64; - Dbg_syms_ar_checking64; - Dbg_syms_created64; - Dbg_syms_discarded64; - Dbg_syms_entered64; - Dbg_syms_entry64; - Dbg_syms_global64; - Dbg_syms_ignore64; - Dbg_syms_new64; - Dbg_syms_nl64; - Dbg_syms_old64; - Dbg_syms_process64; - Dbg_syms_reduce64; - Dbg_syms_reloc64; - Dbg_syms_resolved64; - Dbg_syms_resolving164; - Dbg_syms_resolving264; - Dbg_syms_sec_entry64; - Dbg_syms_sec_title64; - Dbg_syms_spec_title64; - Dbg_syms_up_title64; - Dbg_syms_updated64; - Dbg_syms_dlsym64; - Dbg_syms_lookup_aout64; - Dbg_syms_lookup64; - Dbg_tls_modactivity64; - Dbg_tls_static_block64; - Dbg_unused_sec64; -} SUNWprivate_3.10; + + Dbg32_util_broadcast; + Dbg64_util_broadcast; + Dbg32_util_call_array; + Dbg64_util_call_array; + Dbg32_util_call_fini; + Dbg64_util_call_fini; + Dbg32_util_call_init; + Dbg64_util_call_init; + Dbg32_util_call_main; + Dbg64_util_call_main; + Dbg32_util_collect; + Dbg64_util_collect; + Dbg32_util_dbnotify; + Dbg64_util_dbnotify; + Dbg32_util_edge_in; + Dbg64_util_edge_in; + Dbg32_util_edge_out; + Dbg64_util_edge_out; + Dbg32_util_intoolate; + Dbg64_util_intoolate; + Dbg32_util_nl; + Dbg64_util_nl; + Dbg32_util_no_init; + Dbg64_util_no_init; + Dbg32_util_scc_entry; + Dbg64_util_scc_entry; + Dbg32_util_scc_title; + Dbg64_util_scc_title; + Dbg32_util_str; + Dbg64_util_str; + Dbg32_util_wait; + Dbg64_util_wait; + + Dbg32_unused_file; + Dbg64_unused_file; + Dbg32_unused_rtldinfo; + Dbg64_unused_rtldinfo; + Dbg32_unused_sec; + Dbg64_unused_sec; + Dbg32_unused_unref; + Dbg64_unused_unref; + + Dbg32_ver_avail_entry; + Dbg64_ver_avail_entry; + Dbg32_ver_avail_title; + Dbg64_ver_avail_title; + Dbg32_ver_def_title; + Dbg64_ver_def_title; + Dbg32_ver_desc_entry; + Dbg64_ver_desc_entry; + Dbg32_ver_need_entry; + Dbg64_ver_need_entry; + Dbg32_ver_need_title; + Dbg64_ver_need_title; + Dbg32_ver_nointerface; + Dbg64_ver_nointerface; + Dbg32_ver_symbol; + Dbg64_ver_symbol; + +} SUNWprivate_3.20; # The following interfaces are used by various parts of the link-editors and @@ -344,30 +421,67 @@ SUNWprivate_4.47 { # this interface, and thus by separating in from the ever changing Dbg_* # interfaces we can provide a stable verioning environment for this utility. -SUNWprivate_3.10 { +SUNWprivate_3.20 { global: - Dbg_set; - Gelf_cap_print; - Gelf_cap_title; - Gelf_dyn_print; - Gelf_dyn_title; - Gelf_elf_data_title; - Gelf_elf_header; - Gelf_got_entry; - Gelf_got_title; - Gelf_phdr_entry; - Gelf_reloc_entry; - Gelf_shdr_entry; - Gelf_sym_dem; - Gelf_sym_table_entry; - Gelf_syminfo_entry; - Gelf_syminfo_title; - Gelf_sym_table_title; - Gelf_ver_def_title; - Gelf_ver_need_title; - Gelf_ver_line_1; - Gelf_ver_line_2; - Gelf_ver_line_3; + Elf_syminfo_entry; + Elf_syminfo_title; + + Elf32_cap_entry; + Elf64_cap_entry; + Elf32_cap_title; + Elf64_cap_title; + + Elf32_demangle_name; + Elf64_demangle_name; + Elf32_dyn_entry; + Elf64_dyn_entry; + Elf32_dyn_title; + Elf64_dyn_title; + + Elf32_ehdr; + Elf64_ehdr; + + Elf32_got_entry; + Elf64_got_entry; + Elf32_got_title; + Elf64_got_title; + + Elf32_phdr; + Elf64_phdr; + + Elf32_reloc_apply_reg; + Elf64_reloc_apply_reg; + Elf32_reloc_apply_val; + Elf64_reloc_apply_val; + Elf32_reloc_entry_1; + Elf64_reloc_entry_1; + Elf32_reloc_entry_2; + Elf64_reloc_entry_2; + Elf32_reloc_title; + Elf64_reloc_title; + + Elf32_shdr; + Elf64_shdr; + + Elf32_syms_table_title; + Elf64_syms_table_title; + Elf32_syms_table_entry; + Elf64_syms_table_entry; + + Elf32_ver_def_title; + Elf64_ver_def_title; + Elf32_ver_line_1; + Elf64_ver_line_1; + Elf32_ver_line_2; + Elf64_ver_line_2; + Elf32_ver_line_3; + Elf64_ver_line_3; + Elf32_ver_line_4; + Elf64_ver_line_4; + Elf32_ver_line_5; + Elf64_ver_line_5; + Elf32_ver_need_title; + Elf64_ver_need_title; local: *; @@ -383,16 +497,14 @@ SUNWprivate_3.10 { # we're capable of doing, rather than an admission that its really worth it :-). { - dbg_print = FUNCTION parent; - free = FUNCTION parent; - malloc = FUNCTION parent; - _dgettext = FUNCTION extern; _close = FUNCTION extern; _open = FUNCTION extern; _write = FUNCTION extern; dlopen = FUNCTION extern; dlsym = FUNCTION extern; + free = FUNCTION parent; + malloc = FUNCTION parent; memcpy = FUNCTION extern; qsort = FUNCTION extern; snprintf = FUNCTION extern; diff --git a/usr/src/cmd/sgs/liblddbg/common/move.c b/usr/src/cmd/sgs/liblddbg/common/move.c index b848b049d0..bc897c0457 100644 --- a/usr/src/cmd/sgs/liblddbg/common/move.c +++ b/usr/src/cmd/sgs/liblddbg/common/move.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -29,149 +29,142 @@ #include "_debug.h" #include "libld.h" -/* - * Debug functions - */ - -#if !defined(_ELF64) void -Dbg_move_adjexpandreloc(ulong_t offset, const char *name) +Dbg_move_data(Rt_map *lmp) { - if (DBG_NOTCLASS(DBG_MOVE|DBG_RELOC)) + Lm_list *lml = LIST(lmp); + + if (DBG_NOTCLASS(DBG_C_MOVE)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_INTL(MSG_MV_ADJEXPAND1), _Dbg_sym_dem(name), - EC_XWORD(offset)); + dbg_print(lml, MSG_INTL(MSG_MOVE_FILE), NAME(lmp)); + dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE2)); } void -Dbg_move_adjmovereloc(ulong_t offset1, ulong_t offset2, const char *name) +Dbg_move_adjexpandreloc(Lm_list *lml, Xword offset, const char *name) { - if (DBG_NOTCLASS(DBG_MOVE|DBG_RELOC)) + if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_INTL(MSG_MV_ADJMOVE1), _Dbg_sym_dem(name), - EC_XWORD(offset1), EC_XWORD(offset2)); + dbg_print(lml, MSG_INTL(MSG_MOVE_ADJEXPAND), Dbg_demangle_name(name), + EC_XWORD(offset)); } -#endif /* !defined(_ELF64) */ void -Dbg_move_outsctadj(Sym_desc * sdp) +Dbg_move_adjmovereloc(Lm_list *lml, Xword offset1, Xword offset2, + const char *name) { - if (DBG_NOTCLASS(DBG_MOVE|DBG_RELOC)) + if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_INTL(MSG_MV_OUTSCTADJ1), _Dbg_sym_dem(sdp->sd_name)); + dbg_print(lml, MSG_INTL(MSG_MOVE_ADJMOVE), Dbg_demangle_name(name), + EC_XWORD(offset1), EC_XWORD(offset2)); } -#if !defined(_ELF64) void -Dbg_move_parexpn(const char *name, const char *reason) +Dbg_move_outsctadj(Lm_list *lml, Sym_desc *sdp) { - if (DBG_NOTCLASS(DBG_MOVE)) + if (DBG_NOTCLASS(DBG_C_MOVE | DBG_C_RELOC)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_MV_EXPAND0), name, reason); - dbg_print(MSG_INTL(MSG_MOVE_TITLE1)); + dbg_print(lml, MSG_INTL(MSG_MOVE_OUTSCTADJ), + Dbg_demangle_name(sdp->sd_name)); } void -Dbg_move_outmove(const unsigned char *name) +Dbg_move_parexpn(Lm_list *lml, const char *name, const char *reason) { - if (DBG_NOTCLASS(DBG_MOVE)) + if (DBG_NOTCLASS(DBG_C_MOVE)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_MV_OUTMOVE0), name); - dbg_print(MSG_INTL(MSG_MOVE_TITLE1)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_MOVE_PAREXPN), name, reason); + dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1)); } void -Dbg_move_expanding(Move *mv, Addr addr) +Dbg_move_outmove(Lm_list *lml, const char *name) { - if (DBG_NOTCLASS(DBG_MOVE)) + if (DBG_NOTCLASS(DBG_C_MOVE)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_INTL(MSG_MV_EXPAND1), EC_ADDR(addr), - EC_LWORD(mv->m_value)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_MOVE_OUTMOVE), name); + dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1)); } - void -Dbg_move_input1(const char *name) +Dbg_move_expand(Lm_list *lml, Move *mv, Addr addr) { - if (DBG_NOTCLASS(DBG_MOVE)) + if (DBG_NOTCLASS(DBG_C_MOVE)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_MOVE_INPUT1), name); - dbg_print(MSG_INTL(MSG_MOVE_TITLE1)); + + dbg_print(lml, MSG_INTL(MSG_MOVE_EXPAND), EC_ADDR(addr), + EC_LWORD(mv->m_value)); } void -Dbg_move_data(const char *name) +Dbg_move_input(Lm_list *lml, const char *name) { - if (DBG_NOTCLASS(DBG_MOVE)) + if (DBG_NOTCLASS(DBG_C_MOVE)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_INTL(MSG_MV_MOVEDATA), _Dbg_sym_dem(name)); - dbg_print(MSG_INTL(MSG_MOVE_TITLE2)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_MOVE_INPUT), name); + dbg_print(lml, MSG_INTL(MSG_MOVE_TITLE1)); } -#endif /* !defined(_ELF64) */ void -Dbg_move_mventry(int which, Move *mv, Sym_desc *s) +Dbg_move_entry1(Lm_list *lml, int which, Move *mv, Sym_desc *s) { const char *str; - if (DBG_NOTCLASS(DBG_MOVE)) + if (DBG_NOTCLASS(DBG_C_MOVE)) return; if (DBG_NOTDETAIL()) return; if (which) - str = MSG_INTL(MSG_MOVE_MVENTRY2); + str = MSG_INTL(MSG_MOVE_ENTRY1IN); else - str = MSG_INTL(MSG_MOVE_MVENTRY1); + str = MSG_INTL(MSG_MOVE_ENTRY1OUT); - dbg_print(str, EC_XWORD(mv->m_poffset), EC_LWORD(mv->m_value), - mv->m_repeat, mv->m_stride, s->sd_name); + dbg_print(lml, str, EC_XWORD(mv->m_poffset), EC_LWORD(mv->m_value), + mv->m_repeat, mv->m_stride, s->sd_name); } void -Dbg_move_mventry2(Move *mv, Word st_name, char *name) +Dbg_move_entry2(Lm_list *lml, Move *mv, Word st_name, const char *name) { const char *sname; + if (DBG_NOTCLASS(DBG_C_MOVE)) + return; + if (DBG_NOTDETAIL()) + return; + if (st_name) - sname = (const char *)name; + sname = name; else sname = MSG_INTL(MSG_STR_UNKNOWN); - if (DBG_NOTCLASS(DBG_MOVE)) - return; - if (DBG_NOTDETAIL()) - return; - dbg_print(MSG_INTL(MSG_MOVE_MVENTRY1), - EC_XWORD(mv->m_poffset), - EC_LWORD(mv->m_value), - mv->m_repeat, - mv->m_stride, - sname); + dbg_print(lml, MSG_INTL(MSG_MOVE_ENTRY2), EC_XWORD(mv->m_poffset), + EC_LWORD(mv->m_value), mv->m_repeat, mv->m_stride, sname); } diff --git a/usr/src/cmd/sgs/liblddbg/common/phdr.c b/usr/src/cmd/sgs/liblddbg/common/phdr.c index b3999d0ec6..90dd465d50 100644 --- a/usr/src/cmd/sgs/liblddbg/common/phdr.c +++ b/usr/src/cmd/sgs/liblddbg/common/phdr.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,46 +18,27 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 1998 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 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" - - -#if !(defined(_ELF64) && defined(lint)) - +#include <sgs.h> +#include <_debug.h> +#include <conv.h> +#include <msg.h> -/* - * Print out a single `program header' entry. - */ void -Elf_phdr_entry(Half mach, Elf32_Phdr * phdr) +Elf_phdr(Lm_list *lml, Half mach, Phdr *phdr) { - dbg_print(MSG_ORIG(MSG_PHD_VADDR), EC_ADDR(phdr->p_vaddr), - conv_phdrflg_str(phdr->p_flags)); - dbg_print(MSG_ORIG(MSG_PHD_PADDR), EC_ADDR(phdr->p_paddr), - conv_phdrtyp_str(mach, phdr->p_type)); - dbg_print(MSG_ORIG(MSG_PHD_FILESZ), EC_XWORD(phdr->p_filesz), + dbg_print(lml, MSG_ORIG(MSG_PHD_VADDR), EC_ADDR(phdr->p_vaddr), + conv_phdr_flags(phdr->p_flags)); + dbg_print(lml, MSG_ORIG(MSG_PHD_PADDR), EC_ADDR(phdr->p_paddr), + conv_phdr_type(mach, phdr->p_type)); + dbg_print(lml, MSG_ORIG(MSG_PHD_FILESZ), EC_XWORD(phdr->p_filesz), EC_XWORD(phdr->p_memsz)); - dbg_print(MSG_ORIG(MSG_PHD_OFFSET), EC_OFF(phdr->p_offset), + dbg_print(lml, MSG_ORIG(MSG_PHD_OFFSET), EC_OFF(phdr->p_offset), EC_XWORD(phdr->p_align)); } - -void -Gelf_phdr_entry(Half mach, GElf_Phdr * phdr) -{ - dbg_print(MSG_ORIG(MSG_PHD_VADDR), EC_ADDR(phdr->p_vaddr), - conv_phdrflg_str(phdr->p_flags)); - dbg_print(MSG_ORIG(MSG_PHD_PADDR), EC_ADDR(phdr->p_paddr), - conv_phdrtyp_str(mach, phdr->p_type)); - dbg_print(MSG_ORIG(MSG_PHD_FILESZ), EC_XWORD(phdr->p_filesz), - EC_XWORD(phdr->p_memsz)); - dbg_print(MSG_ORIG(MSG_PHD_OFFSET), EC_OFF(phdr->p_offset), - EC_XWORD(phdr->p_align)); -} - -#endif /* !(defined(_ELF64) && defined(lint)) */ diff --git a/usr/src/cmd/sgs/liblddbg/common/relocate.c b/usr/src/cmd/sgs/liblddbg/common/relocate.c index 36830bb9a9..291503507b 100644 --- a/usr/src/cmd/sgs/liblddbg/common/relocate.c +++ b/usr/src/cmd/sgs/liblddbg/common/relocate.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,487 +18,575 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" -#include "msg.h" -#include "_debug.h" -#include "libld.h" #include <sys/elf_SPARC.h> - - -void _gelf_reloc_entry(const char *prestr, GElf_Half mach, - GElf_Word type, void *reloc, - const char *sec, const char *name, const char *com); +#include <debug.h> +#include <libld.h> +#include <conv.h> +#include "_debug.h" +#include "msg.h" void -Dbg_reloc_generate(Os_desc * osp, Word relshtype) +Dbg_reloc_apply_reg(Lm_list *lml, int caller, Half mach, Xword off, Xword value) { - if (DBG_NOTCLASS(DBG_RELOC)) + if (DBG_NOTCLASS(DBG_C_RELOC)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_REL_GENERATE), osp->os_name); if (DBG_NOTDETAIL()) return; - if (relshtype == SHT_RELA) - dbg_print(MSG_ORIG(MSG_REL_RELA_TITLE_2)); - else - dbg_print(MSG_ORIG(MSG_REL_REL_TITLE_2)); + + /* + * Print the actual relocation being applied to the specified output + * section, the offset represents the actual relocation address, and the + * value is the new data being written to that address. + */ + Elf_reloc_apply_reg(lml, caller, mach, off, value); } void -Dbg_reloc_proc(Os_desc *osp, Is_desc *isp, Is_desc *risp) +Dbg_reloc_apply_val(Lm_list *lml, int caller, Xword off, Xword value) { - const char *str1, *str2; - - if (DBG_NOTCLASS(DBG_RELOC)) + if (DBG_NOTCLASS(DBG_C_RELOC)) return; - - if (osp && osp->os_name) - str1 = osp->os_name; - else - str1 = MSG_INTL(MSG_STR_NULL); - - if (isp && isp->is_file) - str2 = isp->is_file->ifl_name; - else if (risp && risp->is_file) - str2 = risp->is_file->ifl_name; - else - str2 = MSG_INTL(MSG_STR_NULL); - - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_REL_COLLECT), str1, str2); if (DBG_NOTDETAIL()) return; /* - * Determine the relocation titles from the sections type. + * Print the actual relocation being applied to the specified output + * section, the offset represents the actual relocation address, and the + * value is the new data being written to that address. */ - if (risp->is_shdr->sh_type == SHT_RELA) - dbg_print(MSG_ORIG(MSG_REL_RELA_TITLE_2)); - else - dbg_print(MSG_ORIG(MSG_REL_REL_TITLE_2)); + Elf_reloc_apply_val(lml, caller, off, value); } -#if !defined(_ELF64) void -Dbg_reloc_doactiverel() +Dbg_reloc_error(Lm_list *lml, int caller, Half mach, Word type, void *reloc, + const char *sname) { - if (DBG_NOTCLASS(DBG_RELOC)) + if (DBG_NOTCLASS(DBG_C_RELOC)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_REL_ACTIVE)); - dbg_print(MSG_ORIG(MSG_REL_TITLE_1)); + Elf_reloc_entry_1(lml, caller, MSG_INTL(MSG_STR_IN), mach, type, reloc, + NULL, sname, MSG_INTL(MSG_REL_BADROFFSET)); +} + +void +Dbg_reloc_run(Rt_map *lmp, uint_t rtype, int info, int dtype) +{ + Lm_list *lml = LIST(lmp); + const char *str, *name = NAME(lmp); + + if (DBG_NOTCLASS(DBG_C_RELOC)) + return; + + if (dtype == DBG_REL_FINISH) { + if (info) + str = MSG_ORIG(MSG_STR_EMPTY); + else + str = MSG_INTL(MSG_REL_FAIL); + } else { + if (info) + str = MSG_INTL(MSG_REL_PLT); + else + str = MSG_ORIG(MSG_STR_EMPTY); + } + + if (dtype == DBG_REL_START) { + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_REL_START), name, str); + + if (DBG_NOTDETAIL()) + return; + + Elf_reloc_title(lml, ELF_DBG_RTLD, rtype); + + } else { + if (dtype == DBG_REL_NONE) { + dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(lml, MSG_INTL(MSG_REL_NONE), name, str); + } else + dbg_print(lml, MSG_INTL(MSG_REL_FINISH), name, + str); + + Dbg_util_nl(lml, DBG_NL_STD); + } } -#endif /* !defined(_ELF64) */ void -Dbg_reloc_doact(Half mach, Word rtype, Xword off, Xword value, const char *sym, - Os_desc *osp) +Dbg_reloc_copy(Rt_map *dlmp, Rt_map *nlmp, const char *name, int zero) { - const char *sec; - const char *msg; + const char *str; - if (DBG_NOTCLASS(DBG_RELOC)) + if (DBG_NOTCLASS(DBG_C_RELOC)) return; if (DBG_NOTDETAIL()) return; - if (DBG_NOTLONG()) - msg = MSG_ORIG(MSG_REL_ARGS_6); - else - msg = MSG_ORIG(MSG_REL_L_ARGS_6); - if (osp) { - sec = osp->os_name; - off += osp->os_shdr->sh_offset; - } else - sec = MSG_ORIG(MSG_STR_EMPTY); + if (zero) + str = MSG_INTL(MSG_STR_COPYZERO); + else + str = MSG_ORIG(MSG_STR_EMPTY); - dbg_print(msg, MSG_ORIG(MSG_STR_EMPTY), - conv_reloc_type_str(mach, rtype), EC_OFF(off), EC_XWORD(value), - sec, _Dbg_sym_dem(sym), MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(LIST(dlmp), MSG_INTL(MSG_REL_COPY), NAME(dlmp), NAME(nlmp), + name, str); } void -Dbg_reloc_dooutrel(GElf_Word type) +Dbg_reloc_generate(Lm_list *lml, Os_desc *osp, Word type) { - if (DBG_NOTCLASS(DBG_RELOC)) + if (DBG_NOTCLASS(DBG_C_RELOC)) return; + + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_REL_GENERATE), osp->os_name); + if (DBG_NOTDETAIL()) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_REL_CREATING)); - - if (type == SHT_RELA) - dbg_print(MSG_ORIG(MSG_REL_RELA_TITLE_2)); - else - dbg_print(MSG_ORIG(MSG_REL_REL_TITLE_2)); + Elf_reloc_title(lml, ELF_DBG_LD, type); } void -Dbg_reloc_discard(Half mach, Rel_desc *rsp) +Dbg_reloc_proc(Lm_list *lml, Os_desc *osp, Is_desc *isp, Is_desc *risp) { - if (DBG_NOTCLASS(DBG_RELOC)) + const char *str1, *str2; + + if (DBG_NOTCLASS(DBG_C_RELOC)) return; + + if (osp && osp->os_name) + str1 = osp->os_name; + else + str1 = MSG_INTL(MSG_STR_NULL); + + if (isp && isp->is_file) + str2 = isp->is_file->ifl_name; + else if (risp && risp->is_file) + str2 = risp->is_file->ifl_name; + else + str2 = MSG_INTL(MSG_STR_NULL); + + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_REL_COLLECT), str1, str2); + if (DBG_NOTDETAIL()) return; - dbg_print(MSG_INTL(MSG_REL_DISCARDED), rsp->rel_isdesc->is_basename, - rsp->rel_isdesc->is_file->ifl_name, - conv_reloc_type_str(mach, rsp->rel_rtype), - EC_OFF(rsp->rel_roffset)); + Elf_reloc_title(lml, ELF_DBG_LD, risp->is_shdr->sh_type); } void -Dbg_reloc_transition(Half mach, Word oldrtype, Word newrtype, Xword off, - const char *sym) +Dbg_reloc_doact_title(Lm_list *lml) { - if (DBG_NOTCLASS(DBG_RELOC)) + if (DBG_NOTCLASS(DBG_C_RELOC)) return; - dbg_print(MSG_INTL(MSG_REL_TRANS), EC_OFF(off), - conv_reloc_type_str(mach, oldrtype) + M_R_STR_LEN, - conv_reloc_type_str(mach, newrtype) + M_R_STR_LEN, - sym); + if (DBG_NOTDETAIL()) + return; + + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_REL_ACTIVE)); + Elf_reloc_title(lml, ELF_DBG_LD, 0); } void -Dbg_reloc_reg_apply(unsigned long long off, unsigned long long value) +Dbg_reloc_doact(Lm_list *lml, int caller, Half mach, Word type, Word rtype, + Xword off, Xword value, const char *symname, Os_desc *osp) { - if (DBG_NOTCLASS(DBG_RELOC)) + const char *secname; + + if (DBG_NOTCLASS(DBG_C_RELOC)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_ORIG(MSG_REL_REGSYM), -#if defined(_ELF64) - conv_sym_value_str(EM_SPARCV9, STT_SPARC_REGISTER, off), -#else - conv_sym_value_str(EM_SPARC, STT_SPARC_REGISTER, off), -#endif - value); + + if (osp) { + secname = osp->os_name; + off += osp->os_shdr->sh_offset; + } else + secname = MSG_ORIG(MSG_STR_EMPTY); + + Elf_reloc_entry_2(lml, caller, MSG_ORIG(MSG_STR_EMPTY), type, + conv_reloc_type(mach, rtype), off, value, secname, symname, + MSG_ORIG(MSG_STR_EMPTY)); } -#if !defined(_ELF64) void -Dbg_reloc_apply(unsigned long long off, unsigned long long value) +Dbg_reloc_dooutrel(Lm_list *lml, Word type) { - if (DBG_NOTCLASS(DBG_RELOC)) + if (DBG_NOTCLASS(DBG_C_RELOC)) return; if (DBG_NOTDETAIL()) return; - /* - * Print the actual relocation being applied to the specified output - * section, the offset represents the actual relocation address, and the - * value is the new data being written to that address). - */ - dbg_print(MSG_ORIG(MSG_REL_ARGS_2), off, value); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_REL_CREATING)); + Elf_reloc_title(lml, ELF_DBG_LD, type); } -#endif /* !defined(_ELF64) */ void -Dbg_reloc_out(Half mach, Word type, void *rel, const char *name, - const char *relsectname) +Dbg_reloc_discard(Lm_list *lml, Half mach, Rel_desc *rsp) { - if (DBG_NOTCLASS(DBG_RELOC)) + if (DBG_NOTCLASS(DBG_C_RELOC)) return; if (DBG_NOTDETAIL()) return; - _gelf_reloc_entry(MSG_ORIG(MSG_STR_EMPTY), mach, type, rel, - relsectname, _Dbg_sym_dem(name), MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(lml, MSG_INTL(MSG_REL_DISCARDED), + rsp->rel_isdesc->is_basename, rsp->rel_isdesc->is_file->ifl_name, + conv_reloc_type(mach, rsp->rel_rtype), EC_OFF(rsp->rel_roffset)); } void -Dbg_reloc_in(Half mach, Word type, void *rel, const char *name, - const char *iname) +Dbg_reloc_transition(Lm_list *lml, Half mach, Word oldrtype, Word newrtype, + Xword off, const char *sym) { - if (DBG_NOTCLASS(DBG_RELOC)) + if (DBG_NOTCLASS(DBG_C_RELOC)) + return; + + dbg_print(lml, MSG_INTL(MSG_REL_TRANS), EC_OFF(off), + conv_reloc_type(mach, oldrtype) + M_R_STR_LEN, + conv_reloc_type(mach, newrtype) + M_R_STR_LEN, sym); +} + +void +Dbg_reloc_out(Ofl_desc *ofl, int caller, Word type, void *reloc, + const char *secname, const char *symname) +{ + if (DBG_NOTCLASS(DBG_C_RELOC)) return; if (DBG_NOTDETAIL()) return; - _gelf_reloc_entry(MSG_INTL(MSG_STR_IN), mach, type, rel, - (iname ? iname : MSG_ORIG(MSG_STR_EMPTY)), - (name ? _Dbg_sym_dem(name) : MSG_ORIG(MSG_STR_EMPTY)), + Elf_reloc_entry_1(ofl->ofl_lml, caller, MSG_ORIG(MSG_STR_EMPTY), + ofl->ofl_dehdr->e_machine, type, reloc, secname, symname, MSG_ORIG(MSG_STR_EMPTY)); } void -Dbg_reloc_error(Half mach, Word type, void *rel, const char *name, - const char *com) +Dbg_reloc_in(Lm_list *lml, int caller, Half mach, Word type, void *reloc, + const char *secname, const char *symname) { - if (DBG_NOTCLASS(DBG_RELOC)) + if (DBG_NOTCLASS(DBG_C_RELOC)) return; if (DBG_NOTDETAIL()) return; - _gelf_reloc_entry(MSG_INTL(MSG_STR_ERROR), mach, type, rel, - MSG_ORIG(MSG_STR_EMPTY), - (name ? _Dbg_sym_dem(name) : MSG_ORIG(MSG_STR_EMPTY)), - (com ? com : MSG_ORIG(MSG_STR_EMPTY))); + Elf_reloc_entry_1(lml, caller, MSG_INTL(MSG_STR_IN), mach, type, reloc, + secname, symname, MSG_ORIG(MSG_STR_EMPTY)); } /* - * Print a output relocation structure(Rel_desc). + * Print a output relocation structure (Rel_desc). */ void -Dbg_reloc_ors_entry(Half mach, Rel_desc *orsp) +Dbg_reloc_ors_entry(Lm_list *lml, int caller, Word type, Half mach, + Rel_desc *orsp) { - const char *os_name; - const char *sym_name; - const char *msg; + const char *secname, *symname; - if (DBG_NOTCLASS(DBG_RELOC)) + if (DBG_NOTCLASS(DBG_C_RELOC)) return; if (DBG_NOTDETAIL()) return; - if (DBG_NOTLONG()) - msg = MSG_ORIG(MSG_REL_ARGS_5); - else - msg = MSG_ORIG(MSG_REL_L_ARGS_5); if (orsp->rel_flags & (FLG_REL_GOT | FLG_REL_RFPTR1 | FLG_REL_RFPTR2)) - os_name = MSG_ORIG(MSG_SCN_GOT); + secname = MSG_ORIG(MSG_SCN_GOT); else if (orsp->rel_flags & FLG_REL_PLT) - os_name = MSG_ORIG(MSG_SCN_PLT); + secname = MSG_ORIG(MSG_SCN_PLT); else if (orsp->rel_flags & FLG_REL_BSS) - os_name = MSG_ORIG(MSG_SCN_BSS); + secname = MSG_ORIG(MSG_SCN_BSS); else if (orsp->rel_osdesc) - os_name = orsp->rel_osdesc->os_name; + secname = orsp->rel_osdesc->os_name; else - os_name = MSG_INTL(MSG_STR_NULL); + secname = MSG_INTL(MSG_STR_NULL); /* - * Register symbols can be relocated/initialized - * to a constant, which is a special case where - * the symbol index is 0. + * Register symbols can be relocated/initialized to a constant, which + * is a special case where the symbol index is 0. */ if (orsp->rel_sym != NULL) - sym_name = orsp->rel_sym->sd_name; + symname = orsp->rel_sym->sd_name; else - sym_name = MSG_ORIG(MSG_STR_EMPTY); + symname = MSG_ORIG(MSG_STR_EMPTY); - dbg_print(msg, MSG_INTL(MSG_STR_OUT), - conv_reloc_type_str(mach, orsp->rel_rtype), - EC_OFF(orsp->rel_roffset), os_name, - _Dbg_sym_dem(sym_name), MSG_ORIG(MSG_STR_EMPTY)); + Elf_reloc_entry_2(lml, caller, MSG_INTL(MSG_STR_OUT), type, + conv_reloc_type(mach, orsp->rel_rtype), orsp->rel_roffset, + orsp->rel_raddend, secname, symname, MSG_ORIG(MSG_STR_EMPTY)); } /* * Print a Active relocation structure (Rel_desc). */ void -Dbg_reloc_ars_entry(Half mach, Rel_desc *arsp) +Dbg_reloc_ars_entry(Lm_list *lml, int caller, Word type, Half mach, + Rel_desc *arsp) { - const char *os_name; - const char *msg; + const char *secname; - if (DBG_NOTCLASS(DBG_RELOC)) + if (DBG_NOTCLASS(DBG_C_RELOC)) return; if (DBG_NOTDETAIL()) return; - if (DBG_NOTLONG()) - msg = MSG_ORIG(MSG_REL_ARGS_5); - else - msg = MSG_ORIG(MSG_REL_L_ARGS_5); if (arsp->rel_flags & (FLG_REL_GOT | FLG_REL_FPTR)) - os_name = MSG_ORIG(MSG_SCN_GOT); + secname = MSG_ORIG(MSG_SCN_GOT); else - os_name = arsp->rel_osdesc->os_name; + secname = arsp->rel_osdesc->os_name; - dbg_print(msg, MSG_INTL(MSG_STR_ACT), - conv_reloc_type_str(mach, arsp->rel_rtype), - EC_OFF(arsp->rel_roffset), os_name, - _Dbg_sym_dem(arsp->rel_sym->sd_name), MSG_ORIG(MSG_STR_EMPTY)); + Elf_reloc_entry_2(lml, caller, MSG_INTL(MSG_STR_ACT), type, + conv_reloc_type(mach, arsp->rel_rtype), arsp->rel_roffset, + arsp->rel_raddend, secname, arsp->rel_sym->sd_name, + MSG_ORIG(MSG_STR_EMPTY)); } -#if !defined(_ELF64) void -Dbg_reloc_run(const char *file, uint_t rel, int info, int type) +Dbg_reloc_entry(Lm_list *lml, const char *prestr, Half mach, Word type, + void *reloc, const char *secname, const char *symname, const char *poststr) { - const char *str; - - if (DBG_NOTCLASS(DBG_RELOC)) - return; - - if (type == DBG_REL_FINISH) { - if (info) - str = MSG_ORIG(MSG_STR_EMPTY); - else - str = MSG_INTL(MSG_REL_RELOC_FAIL); - } else { - if (info) - str = MSG_INTL(MSG_REL_RELOC_PLT); - else - str = MSG_ORIG(MSG_STR_EMPTY); - } + /* + * Register relocations can use a constant initializer, in which case + * the associated symbol is 0. + */ + if (symname == NULL) + symname = MSG_ORIG(MSG_STR_EMPTY); - if (type == DBG_REL_START) { - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_REL_RELOC_START), file, str); + Elf_reloc_entry_1(lml, ELF_DBG_LD, prestr, mach, type, reloc, secname, + symname, poststr); +} - if (DBG_NOTDETAIL()) - return; +#if defined(_ELF64) - if (rel == SHT_RELA) { - dbg_print(MSG_ORIG(MSG_REL_RELA_TITLE_3)); - dbg_print(MSG_ORIG(MSG_REL_RELA_TITLE_4)); - } else - dbg_print(MSG_ORIG(MSG_REL_REL_TITLE_3)); - } else { - if (type == DBG_REL_NONE) { - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_REL_RELOC_NONE), file, str); - } else - dbg_print(MSG_INTL(MSG_REL_RELOC_FINISH), file, str); +void +Dbg64_pltpad_to(Lm_list *lml, const char *file, Addr pltpad, + const char *dfile, const char *symname) +{ + if (DBG_NOTCLASS(DBG_C_RELOC)) + return; + if (DBG_NOTDETAIL()) + return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - } + dbg_print(lml, MSG_INTL(MSG_BND_PLTPAD_TO), EC_ADDR(pltpad), file, + dfile, symname); } void -Dbg_reloc_copy(const char *dname, const char *rname, const char *sname, - int zero) +Dbg64_pltpad_from(Lm_list *lml, const char *file, const char *sname, + Addr pltpad) { - const char *str; - - if (DBG_NOTCLASS(DBG_RELOC)) + if (DBG_NOTCLASS(DBG_C_RELOC)) return; if (DBG_NOTDETAIL()) return; - if (zero) - str = MSG_INTL(MSG_STR_COPYZERO); - else - str = MSG_ORIG(MSG_STR_EMPTY); - - dbg_print(MSG_INTL(MSG_REL_COPY), dname, rname, sname, str); + dbg_print(lml, MSG_INTL(MSG_BND_PLTPAD_FROM), EC_ADDR(pltpad), file, + Dbg_demangle_name(sname)); } +#endif + /* - * Print a relocation entry. This can either be an input or output - * relocation record, and specifies the relocation section for which is - * associated. + * Relocation output can differ depending on the caller and the type of + * relocation record. However, the final diagnostic is maintained here so + * that the various message strings remain consistent. + * + * elfdump: + * type offset addend section symbol + * X X X X X (Rela) + * + * type offset section symbol + * X X X X (Rel) + * + * Note, it could be argued that the section name output with elfdump(1) is + * unnecessary, as the table itself is identified with a title that reveals + * the section name. However, the output does provide for grep(1)'ing for + * individual entries and obtaining the section name with this type of input. + * + * ld.so.1: + * (prestr) type offset addend symbol + * value + * in X X X X (Rela) + * apply X X + * + * (prestr) type offset value symbol + * in X X X (Rel) + * apply X X + * + * ld: + * (prestr) type offset addend section symbol + * in X X X X X (Rela) + * act X X X X + * out X X X X + * + * (prestr) type offset section symbol + * in X X X X (Rel) + * act X X X X + * out X X X X + * + * Both Rela and Rel active relocations are printed as: + * + * type offset value section symbol + * X X X X X */ void -Gelf_reloc_entry(const char *prestr, GElf_Half mach, GElf_Word type, - GElf_Rela *rel, const char *sec, const char *name) +Elf_reloc_title(Lm_list *lml, int caller, Word type) { - const char *msg; - - if (type == SHT_RELA) { - if (DBG_NOTLONG()) - msg = MSG_ORIG(MSG_REL_ARGS_6); - else - msg = MSG_ORIG(MSG_REL_L_ARGS_6); - } else { - if (DBG_NOTLONG()) - msg = MSG_ORIG(MSG_REL_ARGS_5); - else - msg = MSG_ORIG(MSG_REL_L_ARGS_5); + if (caller == ELF_DBG_ELFDUMP) { + if (type == SHT_RELA) { + if (DBG_NOTLONG()) + dbg_print(lml, MSG_INTL(MSG_REL_EFSA_TITLE)); + else + dbg_print(lml, MSG_INTL(MSG_REL_EFLA_TITLE)); + } else { + if (DBG_NOTLONG()) + dbg_print(lml, MSG_INTL(MSG_REL_EFSN_TITLE)); + else + dbg_print(lml, MSG_INTL(MSG_REL_EFLN_TITLE)); + } + return; + } + if (caller == ELF_DBG_RTLD) { + if (type == SHT_RELA) { + dbg_print(lml, MSG_INTL(MSG_REL_RTA_TITLE)); + dbg_print(lml, MSG_INTL(MSG_REL_RTV_TITLE)); + } else + dbg_print(lml, MSG_INTL(MSG_REL_RTN_TITLE)); + return; + } + if (caller == ELF_DBG_LD) { + if (type == 0) { + if (DBG_NOTLONG()) + dbg_print(lml, MSG_INTL(MSG_REL_LDSV_TITLE)); + else + dbg_print(lml, MSG_INTL(MSG_REL_LDLV_TITLE)); + return; + } + if (type == SHT_RELA) { + if (DBG_NOTLONG()) + dbg_print(lml, MSG_INTL(MSG_REL_LDSA_TITLE)); + else + dbg_print(lml, MSG_INTL(MSG_REL_LDLA_TITLE)); + } else { + if (DBG_NOTLONG()) + dbg_print(lml, MSG_INTL(MSG_REL_LDSN_TITLE)); + else + dbg_print(lml, MSG_INTL(MSG_REL_LDLN_TITLE)); + } } - - if (type == SHT_RELA) - dbg_print(msg, prestr, - conv_reloc_type_str(mach, (uint_t)GELF_R_TYPE(rel->r_info)), - EC_ADDR(rel->r_offset), EC_XWORD(rel->r_addend), - sec, _Dbg_sym_dem(name), MSG_ORIG(MSG_STR_EMPTY)); - else - dbg_print(msg, prestr, - conv_reloc_type_str(mach, (uint_t)GELF_R_TYPE(rel->r_info)), - EC_ADDR(rel->r_offset), sec, _Dbg_sym_dem(name), - MSG_ORIG(MSG_STR_EMPTY)); } void -_gelf_reloc_entry(const char *prestr, GElf_Half mach, GElf_Word type, - void *reloc, const char *sec, const char *name, const char *com) +Elf_reloc_entry_2(Lm_list *lml, int caller, const char *prestr, Word type, + const char *typestr, Addr off, Sxword add, const char *secname, + const char *symname, const char *poststr) { - const char *msg; - - /* - * Register relocations can use a constant initialzer, - * in which case the associated symbol is 0. - */ - if (name == NULL) - name = MSG_ORIG(MSG_STR_EMPTY); - - if (type == SHT_RELA) { - if (DBG_NOTLONG()) - msg = MSG_ORIG(MSG_REL_ARGS_6); - else - msg = MSG_ORIG(MSG_REL_L_ARGS_6); - } else { - if (DBG_NOTLONG()) - msg = MSG_ORIG(MSG_REL_ARGS_5); - else - msg = MSG_ORIG(MSG_REL_L_ARGS_5); - } - - if ((mach == EM_SPARCV9) || (mach == EM_AMD64)) { - Elf64_Rela * rel = (Elf64_Rela *)reloc; + if (symname) + symname = Elf_demangle_name(symname); + else + symname = MSG_ORIG(MSG_STR_EMPTY); + if (caller == ELF_DBG_ELFDUMP) { if (type == SHT_RELA) { - dbg_print(msg, prestr, - conv_reloc_type_str(mach, - (uint_t)ELF64_R_TYPE(rel->r_info)), - EC_ADDR(rel->r_offset), - EC_XWORD(rel->r_addend), - sec, name, com); + if (DBG_NOTLONG()) + dbg_print(lml, MSG_INTL(MSG_REL_EFSA_ENTRY), + typestr, EC_OFF(off), EC_SXWORD(add), + secname, symname); + else + dbg_print(lml, MSG_INTL(MSG_REL_EFLA_ENTRY), + typestr, EC_OFF(off), EC_SXWORD(add), + secname, symname); } else { - dbg_print(msg, prestr, - conv_reloc_type_str(mach, - (uint_t)ELF64_R_TYPE(rel->r_info)), - EC_ADDR(rel->r_offset), sec, name, com); + if (DBG_NOTLONG()) + dbg_print(lml, MSG_INTL(MSG_REL_EFSN_ENTRY), + typestr, EC_OFF(off), secname, symname); + else + dbg_print(lml, MSG_INTL(MSG_REL_EFLN_ENTRY), + typestr, EC_OFF(off), secname, symname); } - } else { - Elf32_Rela * rel = (Elf32_Rela *)reloc; - + return; + } + if (caller == ELF_DBG_RTLD) { + if (type == SHT_RELA) + dbg_print(lml, MSG_INTL(MSG_REL_RTA_ENTRY), prestr, + typestr, EC_OFF(off), EC_SXWORD(add), symname); + else + dbg_print(lml, MSG_INTL(MSG_REL_RTN_ENTRY), prestr, + typestr, EC_OFF(off), symname); + return; + } + if (caller == ELF_DBG_LD) { if (type == SHT_RELA) { - dbg_print(msg, prestr, - conv_reloc_type_str(mach, - ELF32_R_TYPE(rel->r_info)), - EC_ADDR(rel->r_offset), EC_XWORD(rel->r_addend), - sec, name, com); + if (DBG_NOTLONG()) + dbg_print(lml, MSG_INTL(MSG_REL_LDSA_ENTRY), + prestr, typestr, EC_OFF(off), + EC_SXWORD(add), secname, symname, poststr); + else + dbg_print(lml, MSG_INTL(MSG_REL_LDLA_ENTRY), + prestr, typestr, EC_OFF(off), + EC_SXWORD(add), secname, symname, poststr); } else { - dbg_print(msg, prestr, - conv_reloc_type_str(mach, - ELF32_R_TYPE(rel->r_info)), - EC_ADDR(rel->r_offset), sec, name, com); + if (DBG_NOTLONG()) + dbg_print(lml, MSG_INTL(MSG_REL_LDSN_ENTRY), + prestr, typestr, EC_OFF(off), secname, + symname, poststr); + else + dbg_print(lml, MSG_INTL(MSG_REL_LDLN_ENTRY), + prestr, typestr, EC_OFF(off), secname, + symname, poststr); } } } -#endif /* !defined(_ELF64) */ -#if defined(_ELF64) void -Dbg_pltpad_boundto64(const char *file, Addr pltpad, const char *dfile, - const char *symname) +Elf_reloc_entry_1(Lm_list *lml, int caller, const char *prestr, Half mach, + Word type, void *reloc, const char *secname, const char *symname, + const char *poststr) { - if (DBG_NOTCLASS(DBG_RELOC)) - return; - if (DBG_NOTDETAIL()) - return; - dbg_print(MSG_INTL(MSG_REL_PADBOUNDTO), file, EC_ADDR(pltpad), - dfile, symname); + Addr off; + Sxword add; + const char *str; + + if (type == SHT_RELA) { + Rela *rela = (Rela *)reloc; + + str = conv_reloc_type(mach, ELF_R_TYPE(rela->r_info)); + off = rela->r_offset; + add = rela->r_addend; + } else { + Rel *rel = (Rel *)reloc; + + str = conv_reloc_type(mach, ELF_R_TYPE(rel->r_info)); + off = rel->r_offset; + add = 0; + } + Elf_reloc_entry_2(lml, caller, prestr, type, str, off, add, secname, + symname, poststr); } +/* + * Display any applied relocations. Presently, these are only called from + * ld.so.1, but the interfaces are maintained here to insure consistency with + * other relocation diagnostics. + */ void -Dbg_pltpad_bindto64(const char *file, const char *sname, Addr pltpad) +Elf_reloc_apply_val(Lm_list *lml, int caller, Xword offset, Xword value) { - if (DBG_NOTCLASS(DBG_RELOC)) - return; - if (DBG_NOTDETAIL()) - return; - dbg_print(MSG_INTL(MSG_REL_PADBINDTO), file, _Dbg_sym_dem(sname), - EC_ADDR(pltpad)); + if (caller == ELF_DBG_RTLD) + dbg_print(lml, MSG_INTL(MSG_REL_RT_APLVAL), EC_XWORD(offset), + EC_XWORD(value)); +} +void +Elf_reloc_apply_reg(Lm_list *lml, int caller, Half mach, Xword offset, + Xword value) +{ + if (caller == ELF_DBG_RTLD) + dbg_print(lml, MSG_INTL(MSG_REL_RT_APLREG), + conv_sym_value(mach, STT_SPARC_REGISTER, offset), + EC_XWORD(value)); } -#endif diff --git a/usr/src/cmd/sgs/liblddbg/common/sections.c b/usr/src/cmd/sgs/liblddbg/common/sections.c index 8ab8cb5336..807ac460b0 100644 --- a/usr/src/cmd/sgs/liblddbg/common/sections.c +++ b/usr/src/cmd/sgs/liblddbg/common/sections.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -42,49 +42,50 @@ static const Msg order_errors[] = { }; void -Dbg_sec_strtab(Os_desc *osp, Str_tbl *stp) +Dbg_sec_strtab(Lm_list *lml, Os_desc *osp, Str_tbl *stp) { - uint_t i; + uint_t i; - if (DBG_NOTCLASS(DBG_STRTAB)) + if (DBG_NOTCLASS(DBG_C_STRTAB)) return; if (!osp) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY)); if (stp->st_flags & FLG_STTAB_COMPRESS) - dbg_print(MSG_INTL(MSG_SEC_STRTAB_COMP), osp->os_name, - stp->st_fullstringsize, stp->st_stringsize); + dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_COMP), osp->os_name, + stp->st_fullstringsize, stp->st_stringsize); else - dbg_print(MSG_INTL(MSG_SEC_STRTAB_STND), osp->os_name, - stp->st_fullstringsize); + dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_STND), osp->os_name, + stp->st_fullstringsize); if ((DBG_NOTDETAIL()) || ((stp->st_flags & FLG_STTAB_COMPRESS) == 0)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_SEC_STRTAB_HD), osp->os_name, - stp->st_hbckcnt); + dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_HD), osp->os_name, + stp->st_hbckcnt); + for (i = 0; i < stp->st_hbckcnt; i++) { Str_hash *sthash; - dbg_print(MSG_INTL(MSG_SEC_STRTAB_BCKT), i); + + dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_BCKT), i); + for (sthash = stp->st_hashbcks[i]; sthash; sthash = sthash->hi_next) { - uint_t stroff; + uint_t stroff = sthash->hi_mstr->sm_stlen - + sthash->hi_stlen; - stroff = sthash->hi_mstr->sm_stlen - sthash->hi_stlen; if (stroff == 0) { - dbg_print(MSG_INTL(MSG_SEC_STRTAB_MSTR), - sthash->hi_refcnt, - sthash->hi_mstr->sm_str); + dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_MSTR), + sthash->hi_refcnt, sthash->hi_mstr->sm_str); } else { - const char *str; - str = &sthash->hi_mstr->sm_str[stroff]; - dbg_print(MSG_INTL(MSG_SEC_STRTAB_SUFSTR), - sthash->hi_refcnt, - str, sthash->hi_mstr->sm_str); + dbg_print(lml, MSG_INTL(MSG_SEC_STRTAB_SUFSTR), + sthash->hi_refcnt, + &sthash->hi_mstr->sm_str[stroff], + sthash->hi_mstr->sm_str); } } @@ -92,11 +93,11 @@ Dbg_sec_strtab(Os_desc *osp, Str_tbl *stp) } void -Dbg_sec_in(Is_desc *isp) +Dbg_sec_in(Lm_list *lml, Is_desc *isp) { const char *str; - if (DBG_NOTCLASS(DBG_SECTIONS)) + if (DBG_NOTCLASS(DBG_C_SECTIONS)) return; if (isp->is_file != NULL) @@ -104,15 +105,15 @@ Dbg_sec_in(Is_desc *isp) else str = MSG_INTL(MSG_STR_NULL); - dbg_print(MSG_INTL(MSG_SEC_INPUT), isp->is_name, str); + dbg_print(lml, MSG_INTL(MSG_SEC_INPUT), isp->is_name, str); } void -Dbg_sec_added(Os_desc *osp, Sg_desc *sgp) +Dbg_sec_added(Lm_list *lml, Os_desc *osp, Sg_desc *sgp) { const char *str; - if (DBG_NOTCLASS(DBG_SECTIONS)) + if (DBG_NOTCLASS(DBG_C_SECTIONS)) return; if (sgp->sg_name && *sgp->sg_name) @@ -120,15 +121,15 @@ Dbg_sec_added(Os_desc *osp, Sg_desc *sgp) else str = MSG_INTL(MSG_STR_NULL); - dbg_print(MSG_INTL(MSG_SEC_ADDED), osp->os_name, str); + dbg_print(lml, MSG_INTL(MSG_SEC_ADDED), osp->os_name, str); } void -Dbg_sec_created(Os_desc *osp, Sg_desc *sgp) +Dbg_sec_created(Lm_list *lml, Os_desc *osp, Sg_desc *sgp) { const char *str; - if (DBG_NOTCLASS(DBG_SECTIONS)) + if (DBG_NOTCLASS(DBG_C_SECTIONS)) return; if (sgp->sg_name && *sgp->sg_name) @@ -136,26 +137,26 @@ Dbg_sec_created(Os_desc *osp, Sg_desc *sgp) else str = MSG_INTL(MSG_STR_NULL); - dbg_print(MSG_INTL(MSG_SEC_CREATED), osp->os_name, str); + dbg_print(lml, MSG_INTL(MSG_SEC_CREATED), osp->os_name, str); } void -Dbg_sec_discarded(Is_desc *isp, Is_desc *disp) +Dbg_sec_discarded(Lm_list *lml, Is_desc *isp, Is_desc *disp) { - if (DBG_NOTCLASS(DBG_SECTIONS)) + if (DBG_NOTCLASS(DBG_C_SECTIONS)) return; - dbg_print(MSG_INTL(MSG_SEC_DISCARDED), isp->is_basename, + dbg_print(lml, MSG_INTL(MSG_SEC_DISCARDED), isp->is_basename, isp->is_file->ifl_name, disp->is_basename, disp->is_file->ifl_name); } void -Dbg_sec_group(Is_desc *isp, Group_desc *gdp) +Dbg_sec_group(Lm_list *lml, Is_desc *isp, Group_desc *gdp) { const char *fmt; - if (DBG_NOTCLASS(DBG_SECTIONS)) + if (DBG_NOTCLASS(DBG_C_SECTIONS)) return; if (gdp->gd_flags & GRP_FLG_DISCARD) @@ -163,7 +164,7 @@ Dbg_sec_group(Is_desc *isp, Group_desc *gdp) else fmt = MSG_INTL(MSG_SEC_GRP_INPUT); - dbg_print(fmt, isp->is_name, isp->is_file->ifl_name, + dbg_print(lml, fmt, isp->is_name, isp->is_file->ifl_name, gdp->gd_gsectname, gdp->gd_symname); } @@ -173,9 +174,10 @@ Dbg_sec_order_list(Ofl_desc *ofl, int flag) Os_desc *osp; Is_desc *isp1; Listnode *lnp1, *lnp2; + Lm_list *lml = ofl->ofl_lml; const char *str; - if (DBG_NOTCLASS(DBG_SECTIONS)) + if (DBG_NOTCLASS(DBG_C_SECTIONS)) return; if (DBG_NOTDETAIL()) return; @@ -191,8 +193,8 @@ Dbg_sec_order_list(Ofl_desc *ofl, int flag) for (LIST_TRAVERSE(&ofl->ofl_ordered, lnp1, osp)) { Sort_desc *sort = osp->os_sort; - dbg_print(str, osp->os_name); - dbg_print(MSG_INTL(MSG_ORD_HDR_1), + dbg_print(lml, str, osp->os_name); + dbg_print(lml, MSG_INTL(MSG_ORD_HDR_1), EC_WORD(sort->st_beforecnt), EC_WORD(sort->st_aftercnt), EC_WORD(sort->st_ordercnt)); @@ -203,7 +205,7 @@ Dbg_sec_order_list(Ofl_desc *ofl, int flag) static const char *msg; if ((isp1->is_flags & FLG_IS_ORDERED) == 0) { - dbg_print(MSG_INTL(MSG_ORD_TITLE_0), + dbg_print(lml, MSG_INTL(MSG_ORD_TITLE_0), isp1->is_name, isp1->is_file->ifl_name); continue; } @@ -218,28 +220,28 @@ Dbg_sec_order_list(Ofl_desc *ofl, int flag) } if (link == SHN_BEFORE) { - dbg_print(MSG_INTL(MSG_ORD_TITLE_1), + dbg_print(lml, MSG_INTL(MSG_ORD_TITLE_1), isp1->is_name, isp1->is_file->ifl_name); continue; } if (link == SHN_AFTER) { - dbg_print(MSG_INTL(MSG_ORD_TITLE_2), + dbg_print(lml, MSG_INTL(MSG_ORD_TITLE_2), isp1->is_name, isp1->is_file->ifl_name); continue; } isp2 = ifl->ifl_isdesc[link]; - dbg_print(msg, isp1->is_name, ifl->ifl_name, - isp2->is_name, isp2->is_key); + dbg_print(lml, msg, isp1->is_name, ifl->ifl_name, + isp2->is_name, isp2->is_key); } } } void -Dbg_sec_order_error(Ifl_desc *ifl, Word ndx, int error) +Dbg_sec_order_error(Lm_list *lml, Ifl_desc *ifl, Word ndx, int error) { - if (DBG_NOTCLASS(DBG_SECTIONS)) + if (DBG_NOTCLASS(DBG_C_SECTIONS)) return; if (DBG_NOTDETAIL()) return; @@ -247,9 +249,9 @@ Dbg_sec_order_error(Ifl_desc *ifl, Word ndx, int error) if (error == 0) return; - dbg_print(MSG_INTL(MSG_ORD_ERR_TITLE), - ifl->ifl_isdesc[ndx]->is_name, ifl->ifl_name); + dbg_print(lml, MSG_INTL(MSG_ORD_ERR_TITLE), + ifl->ifl_isdesc[ndx]->is_name, ifl->ifl_name); if (error) - dbg_print(MSG_INTL(order_errors[error - 1])); + dbg_print(lml, MSG_INTL(order_errors[error - 1])); } diff --git a/usr/src/cmd/sgs/liblddbg/common/segments.c b/usr/src/cmd/sgs/liblddbg/common/segments.c index e59d2fff0d..c501f94dad 100644 --- a/usr/src/cmd/sgs/liblddbg/common/segments.c +++ b/usr/src/cmd/sgs/liblddbg/common/segments.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 2000 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -34,7 +34,7 @@ * Print out a single `segment descriptor' entry. */ void -_Dbg_seg_desc_entry(Half mach, int ndx, Sg_desc *sgp) +Dbg_seg_desc_entry(Lm_list *lml, Half mach, int ndx, Sg_desc *sgp) { const char *str; @@ -43,64 +43,67 @@ _Dbg_seg_desc_entry(Half mach, int ndx, Sg_desc *sgp) else str = MSG_INTL(MSG_STR_NULL); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_ORIG(MSG_SEG_NAME), ndx, str); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_ORIG(MSG_SEG_NAME), ndx, str); + + Elf_phdr(lml, mach, &sgp->sg_phdr); - Elf_phdr_entry(mach, &sgp->sg_phdr); + dbg_print(lml, MSG_ORIG(MSG_SEG_LENGTH), EC_ADDR(sgp->sg_length)); + dbg_print(lml, MSG_ORIG(MSG_SEG_FLAGS), + conv_seg_flags(sgp->sg_flags)); - dbg_print(MSG_ORIG(MSG_SEG_LENGTH), EC_ADDR(sgp->sg_length)); - dbg_print(MSG_ORIG(MSG_SEG_FLAGS), conv_segaflg_str(sgp->sg_flags)); if (sgp->sg_sizesym && sgp->sg_sizesym->sd_name) - dbg_print(MSG_ORIG(MSG_SEG_SIZESYM), - _Dbg_sym_dem(sgp->sg_sizesym->sd_name)); + dbg_print(lml, MSG_ORIG(MSG_SEG_SIZESYM), + Dbg_demangle_name(sgp->sg_sizesym->sd_name)); + if (sgp->sg_secorder.head) { - Listnode * lnp; - Sec_order * scop; + Listnode *lnp; + Sec_order *scop; - dbg_print(MSG_ORIG(MSG_SEG_ORDER)); + dbg_print(lml, MSG_ORIG(MSG_SEG_ORDER)); for (LIST_TRAVERSE(&sgp->sg_secorder, lnp, scop)) { - dbg_print(MSG_ORIG(MSG_SEG_SECTION), scop->sco_secname, - EC_WORD(scop->sco_index)); + dbg_print(lml, MSG_ORIG(MSG_SEG_SECTION), + scop->sco_secname, EC_WORD(scop->sco_index)); } } } void -Dbg_seg_title() +Dbg_seg_title(Lm_list *lml) { - if (DBG_NOTCLASS(DBG_SEGMENTS)) + if (DBG_NOTCLASS(DBG_C_SEGMENTS)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_SEG_DESC_INUSE)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_SEG_DESC_INUSE)); } void -Dbg_seg_entry(Half mach, int ndx, Sg_desc *sgp) +Dbg_seg_entry(Ofl_desc *ofl, int ndx, Sg_desc *sgp) { - if (DBG_NOTCLASS(DBG_SEGMENTS)) + if (DBG_NOTCLASS(DBG_C_SEGMENTS)) return; - _Dbg_seg_desc_entry(mach, ndx, sgp); + Dbg_seg_desc_entry(ofl->ofl_lml, ofl->ofl_dehdr->e_machine, ndx, sgp); } /* * Print out the available segment descriptors. */ void -Dbg_seg_list(Half mach, List *lsg) +Dbg_seg_list(Lm_list *lml, Half mach, List *lsg) { Listnode *lnp; Sg_desc *sgp; int ndx = 0; - if (DBG_NOTCLASS(DBG_SEGMENTS)) + if (DBG_NOTCLASS(DBG_C_SEGMENTS)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_SEG_DESC_AVAIL)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_SEG_DESC_AVAIL)); for (LIST_TRAVERSE(lsg, lnp, sgp)) - _Dbg_seg_desc_entry(mach, ndx++, sgp); + Dbg_seg_desc_entry(lml, mach, ndx++, sgp); } /* @@ -112,20 +115,52 @@ Dbg_seg_list(Half mach, List *lsg) void Dbg_seg_os(Ofl_desc *ofl, Os_desc *osp, int ndx) { + Lm_list *lml = ofl->ofl_lml; Listnode *lnp; Is_desc *isp; + Elf_Data *data; + Shdr *shdr; - if (DBG_NOTCLASS(DBG_SEGMENTS)) + if (DBG_NOTCLASS(DBG_C_SEGMENTS)) return; - dbg_print(MSG_ORIG(MSG_SEC_NAME), ndx, osp->os_name); - Elf_shdr_entry(ofl->ofl_e_machine, osp->os_shdr); - Gelf_elf_data_title(); - _Dbg_elf_data_out(osp); + dbg_print(lml, MSG_ORIG(MSG_SEC_NAME), ndx, osp->os_name); + Elf_shdr(lml, ofl->ofl_dehdr->e_machine, osp->os_shdr); + dbg_print(lml, MSG_INTL(MSG_EDATA_TITLE)); + + shdr = osp->os_shdr; + data = osp->os_outdata; + dbg_print(lml, MSG_INTL(MSG_EDATA_ENTRY), MSG_INTL(MSG_STR_OUT), + EC_ADDR(shdr->sh_addr), conv_elfdata_type(data->d_type), + EC_XWORD(data->d_size), EC_OFF(data->d_off), + EC_XWORD(data->d_align), MSG_ORIG(MSG_STR_EMPTY), + MSG_ORIG(MSG_STR_EMPTY)); if (DBG_NOTDETAIL()) return; - for (LIST_TRAVERSE(&(osp->os_isdescs), lnp, isp)) - _Dbg_elf_data_in(osp, isp); + for (LIST_TRAVERSE(&(osp->os_isdescs), lnp, isp)) { + const char *file, *str; + Addr addr; + + data = isp->is_indata; + + if (isp->is_flags & FLG_IS_DISCARD) { + str = MSG_INTL(MSG_EDATA_IGNSCN); + addr = 0; + } else { + str = MSG_ORIG(MSG_STR_EMPTY); + addr = (Addr)(shdr->sh_addr + data->d_off); + } + + if (isp->is_file && isp->is_file->ifl_name) + file = isp->is_file->ifl_name; + else + file = MSG_ORIG(MSG_STR_EMPTY); + + dbg_print(lml, MSG_INTL(MSG_EDATA_ENTRY), MSG_INTL(MSG_STR_IN), + EC_ADDR(addr), conv_elfdata_type(data->d_type), + EC_XWORD(data->d_size), EC_OFF(data->d_off), + EC_XWORD(data->d_align), file, str); + } } diff --git a/usr/src/cmd/sgs/liblddbg/common/shdr.c b/usr/src/cmd/sgs/liblddbg/common/shdr.c index 159c934e6e..b06c8781cc 100644 --- a/usr/src/cmd/sgs/liblddbg/common/shdr.c +++ b/usr/src/cmd/sgs/liblddbg/common/shdr.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,48 +18,28 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 2000 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 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" - - -#if !(defined(_ELF64) && defined(lint)) - - -/* - * Print out a single `section header' entry. - */ -void -Elf_shdr_entry(Half mach, Elf32_Shdr * shdr) -{ - dbg_print(MSG_ORIG(MSG_SHD_ADDR), EC_ADDR(shdr->sh_addr), - conv_secflg_str(mach, shdr->sh_flags)); - dbg_print(MSG_ORIG(MSG_SHD_SIZE), EC_XWORD(shdr->sh_size), - conv_sectyp_str(mach, shdr->sh_type)); - dbg_print(MSG_ORIG(MSG_SHD_OFFSET), EC_OFF(shdr->sh_offset), - EC_XWORD(shdr->sh_entsize)); - dbg_print(MSG_ORIG(MSG_SHD_LINK), EC_WORD(shdr->sh_link), - conv_secinfo_str(shdr->sh_info, shdr->sh_flags)); - dbg_print(MSG_ORIG(MSG_SHD_ALIGN), EC_XWORD(shdr->sh_addralign)); -} +#include <sgs.h> +#include <_debug.h> +#include <conv.h> +#include <msg.h> void -Gelf_shdr_entry(Half mach, GElf_Shdr * shdr) +Elf_shdr(Lm_list *lml, Half mach, Shdr * shdr) { - dbg_print(MSG_ORIG(MSG_SHD_ADDR), EC_ADDR(shdr->sh_addr), - conv_secflg_str(mach, (Word)shdr->sh_flags)); - dbg_print(MSG_ORIG(MSG_SHD_SIZE), EC_XWORD(shdr->sh_size), - conv_sectyp_str(mach, shdr->sh_type)); - dbg_print(MSG_ORIG(MSG_SHD_OFFSET), EC_OFF(shdr->sh_offset), + dbg_print(lml, MSG_ORIG(MSG_SHD_ADDR), EC_ADDR(shdr->sh_addr), + conv_sec_flags(shdr->sh_flags)); + dbg_print(lml, MSG_ORIG(MSG_SHD_SIZE), EC_XWORD(shdr->sh_size), + conv_sec_type(mach, shdr->sh_type)); + dbg_print(lml, MSG_ORIG(MSG_SHD_OFFSET), EC_OFF(shdr->sh_offset), EC_XWORD(shdr->sh_entsize)); - dbg_print(MSG_ORIG(MSG_SHD_LINK), EC_WORD(shdr->sh_link), - conv_secinfo_str(shdr->sh_info, (Word)shdr->sh_flags)); - dbg_print(MSG_ORIG(MSG_SHD_ALIGN), EC_XWORD(shdr->sh_addralign)); + dbg_print(lml, MSG_ORIG(MSG_SHD_LINK), EC_WORD(shdr->sh_link), + conv_sec_info(shdr->sh_info, shdr->sh_flags)); + dbg_print(lml, MSG_ORIG(MSG_SHD_ALIGN), EC_XWORD(shdr->sh_addralign)); } - -#endif /* !(defined(_ELF64) && defined(lint)) */ diff --git a/usr/src/cmd/sgs/liblddbg/common/statistics.c b/usr/src/cmd/sgs/liblddbg/common/statistics.c index 507fd9b599..a363bc6d17 100644 --- a/usr/src/cmd/sgs/liblddbg/common/statistics.c +++ b/usr/src/cmd/sgs/liblddbg/common/statistics.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -33,34 +32,36 @@ void Dbg_statistics_ld(Ofl_desc *ofl) { - if (DBG_NOTCLASS(DBG_STATISTICS)) + Lm_list *lml = ofl->ofl_lml; + + if (DBG_NOTCLASS(DBG_C_STATS)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_STATS_GENERAL)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_STATS_GENERAL)); if (ofl->ofl_objscnt || ofl->ofl_soscnt || ofl->ofl_arscnt) { - dbg_print(MSG_INTL(MSG_STATS_FILES), + dbg_print(lml, MSG_INTL(MSG_STATS_FILES), EC_XWORD(ofl->ofl_objscnt), EC_XWORD(ofl->ofl_soscnt), EC_XWORD(ofl->ofl_arscnt)); } if (ofl->ofl_locscnt || ofl->ofl_globcnt) { - dbg_print(MSG_INTL(MSG_STATS_SYMBOLS_OUT), + dbg_print(lml, MSG_INTL(MSG_STATS_SYMBOLS_OUT), EC_XWORD(ofl->ofl_globcnt), EC_XWORD(ofl->ofl_locscnt)); } if (ofl->ofl_entercnt || ofl->ofl_scopecnt || ofl->ofl_elimcnt) { - dbg_print(MSG_INTL(MSG_STATS_SYMBOLS_IN), + dbg_print(lml, MSG_INTL(MSG_STATS_SYMBOLS_IN), EC_XWORD(ofl->ofl_entercnt), EC_XWORD(ofl->ofl_scopecnt), EC_XWORD(ofl->ofl_elimcnt)); } if (ofl->ofl_outrelscnt) { - dbg_print(MSG_INTL(MSG_STATS_RELOCS_OUT), + dbg_print(lml, MSG_INTL(MSG_STATS_RELOCS_OUT), EC_XWORD(ofl->ofl_outrelscnt)); } if (ofl->ofl_entrelscnt || ofl->ofl_actrelscnt) { - dbg_print(MSG_INTL(MSG_STATS_RELOCS_IN), + dbg_print(lml, MSG_INTL(MSG_STATS_RELOCS_IN), EC_XWORD(ofl->ofl_entrelscnt), EC_XWORD(ofl->ofl_actrelscnt)); } @@ -73,21 +74,22 @@ Dbg_statistics_ar(Ofl_desc *ofl) Ar_desc *adp; Elf_Arsym *arsym; Ar_aux *aux; + Lm_list *lml = ofl->ofl_lml; - if (DBG_NOTCLASS(DBG_STATISTICS | DBG_UNUSED)) + if (DBG_NOTCLASS(DBG_C_STATS | DBG_C_UNUSED)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); for (LIST_TRAVERSE(&ofl->ofl_ars, lnp, adp)) { size_t poffset = 0; uint_t count = 0, used = 0; if ((adp->ad_flags & FLG_ARD_EXTRACT) == 0) { - Dbg_unused_file(adp->ad_name, 0, 0); + Dbg_unused_file(lml, adp->ad_name, 0, 0); continue; } - if (DBG_NOTCLASS(DBG_STATISTICS)) + if (DBG_NOTCLASS(DBG_C_STATS)) continue; arsym = adp->ad_start; @@ -108,9 +110,9 @@ Dbg_statistics_ar(Ofl_desc *ofl) if ((count == 0) || (used == 0)) continue; #ifndef UDIV_NOT_SUPPORTED - dbg_print(MSG_INTL(MSG_STATS_AR), adp->ad_name, count, used, - ((used * 100) / count)); + dbg_print(lml, MSG_INTL(MSG_STATS_AR), adp->ad_name, count, + used, ((used * 100) / count)); #endif } - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); } diff --git a/usr/src/cmd/sgs/liblddbg/common/support.c b/usr/src/cmd/sgs/liblddbg/common/support.c index 55085979c9..e0ee46447b 100644 --- a/usr/src/cmd/sgs/liblddbg/common/support.c +++ b/usr/src/cmd/sgs/liblddbg/common/support.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 1998-2001 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -29,11 +29,11 @@ #include "_debug.h" void -Dbg_support_req(const char *define, int flag) +Dbg_support_req(Lm_list *lml, const char *define, int flag) { const char *str; - if (DBG_NOTCLASS(DBG_SUPPORT)) + if (DBG_NOTCLASS(DBG_C_SUPPORT)) return; if (flag == DBG_SUP_ENVIRON) @@ -43,26 +43,26 @@ Dbg_support_req(const char *define, int flag) else str = MSG_INTL(MSG_SUP_REQ_DEF); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_SUP_REQ), define, str); + dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY)); + dbg_print(lml, MSG_INTL(MSG_SUP_REQ), define, str); } void -Dbg_support_load(const char *obj, const char *func) +Dbg_support_load(Lm_list *lml, const char *obj, const char *func) { - if (DBG_NOTCLASS(DBG_SUPPORT)) + if (DBG_NOTCLASS(DBG_C_SUPPORT)) return; - dbg_print(MSG_INTL(MSG_SUP_ROUTINE), obj, func); + dbg_print(lml, MSG_INTL(MSG_SUP_ROUTINE), obj, func); } void -Dbg_support_action(const char *obj, const char *func, Support_ndx ndx, - const char *name) +Dbg_support_action(Lm_list *lml, const char *obj, const char *func, + Support_ndx ndx, const char *name) { const char *str; - if (DBG_NOTCLASS(DBG_SUPPORT)) + if (DBG_NOTCLASS(DBG_C_SUPPORT)) return; if (DBG_NOTDETAIL()) return; @@ -78,7 +78,8 @@ Dbg_support_action(const char *obj, const char *func, Support_ndx ndx, if ((ndx == LDS_ATEXIT) || (ndx == LDS_VERSION) || (ndx == LDS_INPUT_DONE)) - dbg_print(MSG_INTL(MSG_SUP_CALLING_1), func, obj); + dbg_print(lml, MSG_INTL(MSG_SUP_CALLING_1), func, obj); else - dbg_print(MSG_INTL(MSG_SUP_CALLING_2), func, obj, str, name); + dbg_print(lml, MSG_INTL(MSG_SUP_CALLING_2), func, obj, + str, name); } diff --git a/usr/src/cmd/sgs/liblddbg/common/syminfo.c b/usr/src/cmd/sgs/liblddbg/common/syminfo.c new file mode 100644 index 0000000000..b5a2fea417 --- /dev/null +++ b/usr/src/cmd/sgs/liblddbg/common/syminfo.c @@ -0,0 +1,116 @@ +/* + * CDDL HEADER START + * + * The contents of this file are subject to the terms of the + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. + * + * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE + * or http://www.opensolaris.org/os/licensing. + * See the License for the specific language governing permissions + * and limitations under the License. + * + * When distributing Covered Code, include this CDDL HEADER in each + * file and include the License file at usr/src/OPENSOLARIS.LICENSE. + * If applicable, add the following below this CDDL HEADER, with the + * fields enclosed by brackets "[]" replaced with your own identifying + * information: Portions Copyright [yyyy] [name of copyright owner] + * + * CDDL HEADER END + */ + +/* + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. + */ +#pragma ident "%Z%%M% %I% %E% SMI" + +#include <sgs.h> +#include <debug.h> +#include <msg.h> + +void +Elf_syminfo_title(Lm_list *lml) +{ + dbg_print(lml, MSG_INTL(MSG_SYMINFO_TITLE)); +} + +#define FLAGSZ 16 +#define NDXSZ 10 + +void +Elf_syminfo_entry(Lm_list *lml, Word ndx, Syminfo *sip, const char *name, + const char *needed) +{ + const char *bndstr, *str; + char flagstr[FLAGSZ], sndxstr[NDXSZ], dndxstr[NDXSZ]; + int flgndx = 0; + Half flags = sip->si_flags; + + if (flags & SYMINFO_FLG_DIRECT) { + if (sip->si_boundto == SYMINFO_BT_SELF) + bndstr = MSG_INTL(MSG_SYMINFO_SELF); + else if (sip->si_boundto == SYMINFO_BT_PARENT) + bndstr = MSG_INTL(MSG_SYMINFO_PARENT); + else + bndstr = needed; + + flagstr[flgndx++] = 'D'; + flags &= ~SYMINFO_FLG_DIRECT; + + } else if (flags & SYMINFO_FLG_FILTER) { + bndstr = needed; + flagstr[flgndx++] = 'F'; + flags &= ~SYMINFO_FLG_FILTER; + + } else if (flags & SYMINFO_FLG_AUXILIARY) { + bndstr = needed; + flagstr[flgndx++] = 'A'; + flags &= ~SYMINFO_FLG_AUXILIARY; + + } else if (sip->si_boundto == SYMINFO_BT_EXTERN) + bndstr = MSG_INTL(MSG_SYMINFO_EXTERN); + else + bndstr = MSG_ORIG(MSG_STR_EMPTY); + + if (flags & SYMINFO_FLG_DIRECTBIND) { + flagstr[flgndx++] = 'B'; + flags &= ~SYMINFO_FLG_DIRECTBIND; + } + if (flags & SYMINFO_FLG_COPY) { + flagstr[flgndx++] = 'C'; + flags &= ~SYMINFO_FLG_COPY; + } + if (flags & SYMINFO_FLG_LAZYLOAD) { + flagstr[flgndx++] = 'L'; + flags &= ~SYMINFO_FLG_LAZYLOAD; + } + if (flags & SYMINFO_FLG_NOEXTDIRECT) { + flagstr[flgndx++] = 'N'; + flags &= ~SYMINFO_FLG_NOEXTDIRECT; + } + + /* + * Did we account for all of the flags? + */ + if (flags) + (void) snprintf(&flagstr[flgndx], FLAGSZ - ndx, + MSG_ORIG(MSG_SYMINFO_UNKFLAG), flags); + else + flagstr[flgndx] = '\0'; + + /* + * If we've bound to a dependency, determine the dynamic entry index. + */ + if (bndstr == needed) { + (void) snprintf(dndxstr, NDXSZ, MSG_ORIG(MSG_FMT_INDEX), + sip->si_boundto); + str = dndxstr; + } else + str = MSG_ORIG(MSG_STR_EMPTY); + + (void) snprintf(sndxstr, NDXSZ, MSG_ORIG(MSG_FMT_INDEX), ndx); + + dbg_print(lml, MSG_INTL(MSG_SYMINFO_ENTRY), sndxstr, flagstr, str, + bndstr, Elf_demangle_name(name)); +} diff --git a/usr/src/cmd/sgs/liblddbg/common/syms.c b/usr/src/cmd/sgs/liblddbg/common/syms.c index 840dc12af2..b371776c0e 100644 --- a/usr/src/cmd/sgs/liblddbg/common/syms.c +++ b/usr/src/cmd/sgs/liblddbg/common/syms.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,230 +18,122 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> #include <dlfcn.h> -#include <strings.h> #include "msg.h" #include "_debug.h" #include "libld.h" -/* - * Print out a single `symbol table node' entry. - */ -#if !defined(_ELF64) -void -Gelf_sym_table_title(GElf_Ehdr *ehdr, const char *index, const char *name) -{ - if ((int)ehdr->e_ident[EI_CLASS] == ELFCLASS64) { - if (DBG_NOTLONG()) - dbg_print(MSG_ORIG(MSG_SYM_TITLE_64), index, name); - else - dbg_print(MSG_ORIG(MSG_SYM_L_TITLE_64), index, name); - } else { - if (DBG_NOTLONG()) - dbg_print(MSG_ORIG(MSG_SYM_TITLE), index, name); - else - dbg_print(MSG_ORIG(MSG_SYM_L_TITLE), index, name); - } -} +#if !(defined(_ELF64)) + void -Elf_sym_table_entry(const char *prestr, Elf32_Ehdr *ehdr, Elf32_Sym *sym, - Elf32_Word verndx, const char *sec, const char *poststr) +Dbg_syms_lookup_aout(Lm_list *lml, const char *name) { - const char *msg; + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) + return; - if (DBG_NOTLONG()) - msg = MSG_ORIG(MSG_SYM_ENTRY); - else - msg = MSG_ORIG(MSG_SYM_L_ENTRY); - - dbg_print(msg, prestr, - conv_sym_value_str(ehdr->e_machine, ELF32_ST_TYPE(sym->st_info), - EC_XWORD(sym->st_value)), EC_XWORD(sym->st_size), - conv_info_type_str(ehdr->e_machine, ELF32_ST_TYPE(sym->st_info)), - conv_info_bind_str(ELF32_ST_BIND(sym->st_info)), - conv_sym_stother(sym->st_other), EC_WORD(verndx), - sec ? sec : conv_shndx_str(sym->st_shndx), - _Dbg_sym_dem(poststr)); + dbg_print(lml, MSG_INTL(MSG_SYM_AOUT), Dbg_demangle_name(name)); } +#endif + void -Gelf_sym_table_entry(const char *prestr, GElf_Ehdr *ehdr, GElf_Sym *sym, - GElf_Word verndx, const char *sec, const char *poststr) +Dbg_syms_lookup(Rt_map *lmp, const char *name, const char *type) { - const char *msg; + Lm_list *lml = LIST(lmp); - if ((int)ehdr->e_ident[EI_CLASS] == ELFCLASS64) { - if (DBG_NOTLONG()) - msg = MSG_ORIG(MSG_SYM_ENTRY_64); - else - msg = MSG_ORIG(MSG_SYM_L_ENTRY_64); - } else { - if (DBG_NOTLONG()) - msg = MSG_ORIG(MSG_SYM_ENTRY); - else - msg = MSG_ORIG(MSG_SYM_L_ENTRY); - } + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) + return; - dbg_print(msg, prestr, conv_sym_value_str(ehdr->e_machine, - GELF_ST_TYPE(sym->st_info), EC_XWORD(sym->st_value)), - EC_XWORD(sym->st_size), - conv_info_type_str(ehdr->e_machine, GELF_ST_TYPE(sym->st_info)), - conv_info_bind_str(GELF_ST_BIND(sym->st_info)), - conv_sym_stother(sym->st_other), EC_WORD(verndx), - sec ? sec : conv_shndx_str(sym->st_shndx), - _Dbg_sym_dem(poststr)); + dbg_print(lml, MSG_INTL(MSG_SYM_LOOKUP), Dbg_demangle_name(name), + NAME(lmp), type); } void -Gelf_syminfo_title() +Dbg_syms_dlsym(Rt_map *clmp, const char *sym, const char *next, int flag) { - dbg_print(MSG_INTL(MSG_SYMI_TITLE2)); -} + const char *str, *from = NAME(clmp); + Lm_list *lml = LIST(clmp); -void -Gelf_syminfo_entry(int ndx, GElf_Syminfo *sip, const char *sname, - const char *needed) -{ - const char *bind_str; - char flags[16], index[32], bind_index[32] = " "; - int flgndx = 0; - Half symflags; - - symflags = sip->si_flags; - - if (symflags & SYMINFO_FLG_DIRECT) { - if (sip->si_boundto == SYMINFO_BT_SELF) - bind_str = MSG_INTL(MSG_SYMI_SELF); - else if (sip->si_boundto == SYMINFO_BT_PARENT) - bind_str = MSG_INTL(MSG_SYMI_PARENT); - else { - bind_str = needed; - (void) sprintf(bind_index, MSG_ORIG(MSG_FMT_INDEX), - sip->si_boundto); - } - flags[flgndx++] = 'D'; - symflags &= ~SYMINFO_FLG_DIRECT; - - } else if (symflags & (SYMINFO_FLG_FILTER | SYMINFO_FLG_AUXILIARY)) { - bind_str = needed; - (void) sprintf(bind_index, MSG_ORIG(MSG_FMT_INDEX), - sip->si_boundto); - - if (symflags & SYMINFO_FLG_FILTER) { - flags[flgndx++] = 'F'; - symflags &= ~SYMINFO_FLG_FILTER; - } - if (symflags & SYMINFO_FLG_AUXILIARY) { - flags[flgndx++] = 'A'; - symflags &= ~SYMINFO_FLG_AUXILIARY; - } - } else if (sip->si_boundto == SYMINFO_BT_EXTERN) { - bind_str = MSG_INTL(MSG_SYMI_EXTERN); - } else - bind_str = MSG_ORIG(MSG_STR_EMPTY); - - if (symflags & SYMINFO_FLG_DIRECTBIND) { - flags[flgndx++] = 'B'; - symflags &= ~SYMINFO_FLG_DIRECTBIND; - } - if (symflags & SYMINFO_FLG_COPY) { - flags[flgndx++] = 'C'; - symflags &= ~SYMINFO_FLG_COPY; - } - if (symflags & SYMINFO_FLG_LAZYLOAD) { - flags[flgndx++] = 'L'; - symflags &= ~SYMINFO_FLG_LAZYLOAD; - } - if (symflags & SYMINFO_FLG_NOEXTDIRECT) { - flags[flgndx++] = 'N'; - symflags &= ~SYMINFO_FLG_NOEXTDIRECT; - } + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) + return; - /* - * Did we account for all of the flags? - */ - if (symflags) - (void) sprintf(&flags[flgndx], " 0x%x", symflags); + if (flag == DBG_DLSYM_NEXT) + str = MSG_ORIG(MSG_SYM_NEXT); + else if (flag == DBG_DLSYM_DEFAULT) + str = MSG_ORIG(MSG_SYM_DEFAULT); + else if (flag == DBG_DLSYM_SELF) + str = MSG_ORIG(MSG_SYM_SELF); + else if (flag == DBG_DLSYM_PROBE) + str = MSG_ORIG(MSG_SYM_PROBE); else - flags[flgndx] = '\0'; - - (void) sprintf(index, MSG_ORIG(MSG_FMT_INDEX), ndx); - dbg_print(MSG_ORIG(MSG_SYMI_FMT), index, flags, bind_index, bind_str, - _Dbg_sym_dem(sname)); -} - - -const char * -Gelf_sym_dem(const char *name) -{ - return (conv_sym_dem(name)); -} - -const char * -_Dbg_sym_dem(const char *name) -{ - if (DBG_NOTCLASS(DBG_DEMANGLE)) - return (name); + str = MSG_ORIG(MSG_STR_EMPTY); - return (conv_sym_dem(name)); + Dbg_util_nl(lml, DBG_NL_STD); + if (next == 0) + dbg_print(lml, MSG_INTL(MSG_SYM_DLSYM_1), + Dbg_demangle_name(sym), from, str); + else + dbg_print(lml, MSG_INTL(MSG_SYM_DLSYM_2), + Dbg_demangle_name(sym), from, next, str); } void -Dbg_syms_ar_title(const char *file, int again) +Dbg_syms_lazy_rescan(Lm_list *lml, const char *name) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_FILES)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_SYM_AR_FILE), file, - again ? MSG_INTL(MSG_STR_AGAIN) : MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_SYM_LAZY_RESCAN), Dbg_demangle_name(name)); } void -Dbg_syms_lazy_rescan(const char *name) +Dbg_syms_ar_title(Lm_list *lml, const char *file, int again) { - if (DBG_NOTCLASS(DBG_SYMBOLS | DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_SYM_LAZY_RESCAN), _Dbg_sym_dem(name)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_SYM_AR_FILE), file, + again ? MSG_INTL(MSG_STR_AGAIN) : MSG_ORIG(MSG_STR_EMPTY)); } -#endif /* !defined(_ELF64) */ - void -Dbg_syms_ar_entry(Xword ndx, Elf_Arsym *arsym) +Dbg_syms_ar_entry(Lm_list *lml, Xword ndx, Elf_Arsym *arsym) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; - dbg_print(MSG_INTL(MSG_SYM_AR_ENTRY), EC_XWORD(ndx), - _Dbg_sym_dem(arsym->as_name)); + dbg_print(lml, MSG_INTL(MSG_SYM_AR_ENTRY), EC_XWORD(ndx), + Dbg_demangle_name(arsym->as_name)); } void -Dbg_syms_ar_checking(Xword ndx, Elf_Arsym *arsym, const char *name) +Dbg_syms_ar_checking(Lm_list *lml, Xword ndx, Elf_Arsym *arsym, + const char *name) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; - dbg_print(MSG_INTL(MSG_SYM_AR_CHECK), EC_XWORD(ndx), - _Dbg_sym_dem(arsym->as_name), name); + dbg_print(lml, MSG_INTL(MSG_SYM_AR_CHECK), EC_XWORD(ndx), + Dbg_demangle_name(arsym->as_name), name); } void -Dbg_syms_ar_resolve(Xword ndx, Elf_Arsym *arsym, const char *fname, int flag) +Dbg_syms_ar_resolve(Lm_list *lml, Xword ndx, Elf_Arsym *arsym, + const char *fname, int flag) { const char *fmt; - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; if (flag) @@ -250,24 +141,26 @@ Dbg_syms_ar_resolve(Xword ndx, Elf_Arsym *arsym, const char *fname, int flag) else fmt = MSG_INTL(MSG_SYM_AR_RESOLVE); - dbg_print(fmt, EC_XWORD(ndx), _Dbg_sym_dem(arsym->as_name), fname); + dbg_print(lml, fmt, EC_XWORD(ndx), Dbg_demangle_name(arsym->as_name), + fname); } void -Dbg_syms_spec_title() +Dbg_syms_spec_title(Lm_list *lml) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_SYM_SPECIAL)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_SYM_SPECIAL)); } void -Dbg_syms_discarded(Sym_desc *sdp, Is_desc *disp) +Dbg_syms_discarded(Lm_list *lml, Sym_desc *sdp, Is_desc *disp) { const char *sectname; - if (DBG_NOTCLASS(DBG_SYMBOLS)) + + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; if (DBG_NOTDETAIL()) return; @@ -275,336 +168,289 @@ Dbg_syms_discarded(Sym_desc *sdp, Is_desc *disp) if ((sectname = disp->is_basename) == 0) sectname = disp->is_name; - dbg_print(MSG_INTL(MSG_SYM_DISCARDED), _Dbg_sym_dem(sdp->sd_name), - sectname, disp->is_file->ifl_name); + dbg_print(lml, MSG_INTL(MSG_SYM_DISCARDED), + Dbg_demangle_name(sdp->sd_name), sectname, disp->is_file->ifl_name); } - void -Dbg_syms_entered(Ehdr *ehdr, Sym *sym, Sym_desc *sdp) +Dbg_syms_entered(Ofl_desc *ofl, Sym *sym, Sym_desc *sdp) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + Lm_list *lml = ofl->ofl_lml; + + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; if (DBG_NOTDETAIL()) return; - Elf_sym_table_entry(MSG_INTL(MSG_STR_ENTERED), ehdr, sym, sdp->sd_aux ? - sdp->sd_aux->sa_overndx : 0, NULL, conv_deftag_str(sdp->sd_ref)); + Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_INTL(MSG_STR_ENTERED), + ofl->ofl_dehdr->e_machine, sym, + sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL, + conv_def_tag(sdp->sd_ref)); } void -Dbg_syms_process(Ifl_desc *ifl) +Dbg_syms_process(Lm_list *lml, Ifl_desc *ifl) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_SYM_PROCESS), ifl->ifl_name, - conv_etype_str(ifl->ifl_ehdr->e_type)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_SYM_PROCESS), ifl->ifl_name, + conv_ehdr_type(ifl->ifl_ehdr->e_type)); } void -Dbg_syms_entry(Xword ndx, Sym_desc *sdp) +Dbg_syms_entry(Lm_list *lml, Word ndx, Sym_desc *sdp) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; - dbg_print(MSG_INTL(MSG_SYM_BASIC), EC_XWORD(ndx), - _Dbg_sym_dem(sdp->sd_name)); + dbg_print(lml, MSG_INTL(MSG_SYM_BASIC), EC_WORD(ndx), + Dbg_demangle_name(sdp->sd_name)); } void -Dbg_syms_global(Xword ndx, const char *name) +Dbg_syms_global(Lm_list *lml, Word ndx, const char *name) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; - dbg_print(MSG_INTL(MSG_SYM_ADDING), EC_XWORD(ndx), _Dbg_sym_dem(name)); + dbg_print(lml, MSG_INTL(MSG_SYM_ADDING), EC_WORD(ndx), + Dbg_demangle_name(name)); } void -Dbg_syms_sec_title() +Dbg_syms_sec_title(Lm_list *lml) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_SYM_INDEX)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_SYM_INDEX)); } void -Dbg_syms_sec_entry(int ndx, Sg_desc *sgp, Os_desc *osp) +Dbg_syms_sec_entry(Lm_list *lml, Word ndx, Sg_desc *sgp, Os_desc *osp) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_INTL(MSG_SYM_SECTION), ndx, osp->os_name, - (*sgp->sg_name ? sgp->sg_name : MSG_INTL(MSG_STR_NULL))); + dbg_print(lml, MSG_INTL(MSG_SYM_SECTION), EC_WORD(ndx), osp->os_name, + (*sgp->sg_name ? sgp->sg_name : MSG_INTL(MSG_STR_NULL))); } void -Dbg_syms_up_title(Ehdr *ehdr) +Dbg_syms_up_title(Lm_list *lml) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_SYM_FINAL)); - /* LINTED */ - Gelf_sym_table_title((GElf_Ehdr *)ehdr, - MSG_ORIG(MSG_STR_EMPTY), MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_SYM_FINAL)); + Elf_syms_table_title(lml, ELF_DBG_LD); } void -Dbg_syms_ignore(Ehdr *ehdr, Sym_desc *sdp) +Dbg_syms_ignore(Ofl_desc *ofl, Sym_desc *sdp) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; if (DBG_NOTDETAIL()) return; - Elf_sym_table_entry(MSG_INTL(MSG_STR_IGNORE), ehdr, sdp->sd_sym, - 0, NULL, MSG_INTL(MSG_STR_UNUSED)); + Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_IGNORE), + ofl->ofl_dehdr->e_machine, sdp->sd_sym, 0, NULL, + MSG_INTL(MSG_STR_UNUSED)); } void -Dbg_syms_old(Ehdr *ehdr, Sym_desc *sdp) +Dbg_syms_old(Ofl_desc *ofl, Sym_desc *sdp) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; if (DBG_NOTDETAIL()) return; - Elf_sym_table_entry(MSG_INTL(MSG_STR_OLD), ehdr, sdp->sd_sym, + Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_OLD), + ofl->ofl_dehdr->e_machine, sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL, sdp->sd_name); } void -Dbg_syms_new(Ehdr *ehdr, Sym *sym, Sym_desc *sdp) +Dbg_syms_new(Ofl_desc *ofl, Sym *sym, Sym_desc *sdp) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; if (DBG_NOTDETAIL()) return; - Elf_sym_table_entry(MSG_INTL(MSG_STR_NEW), ehdr, sym, + Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_NEW), + ofl->ofl_dehdr->e_machine, sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL, - conv_deftag_str(sdp->sd_ref)); + conv_def_tag(sdp->sd_ref)); } void -Dbg_syms_updated(Ehdr *ehdr, Sym_desc *sdp, const char *name) +Dbg_syms_updated(Ofl_desc *ofl, Sym_desc *sdp, const char *name) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + Lm_list *lml = ofl->ofl_lml; + + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; - dbg_print(MSG_INTL(MSG_SYM_UPDATE), name); + dbg_print(lml, MSG_INTL(MSG_SYM_UPDATE), name); if (DBG_NOTDETAIL()) return; - Elf_sym_table_entry(MSG_ORIG(MSG_STR_EMPTY), ehdr, sdp->sd_sym, + Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_ORIG(MSG_STR_EMPTY), + ofl->ofl_dehdr->e_machine, sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL, - conv_deftag_str(sdp->sd_ref)); + conv_def_tag(sdp->sd_ref)); } void -Dbg_syms_created(const char *name) +Dbg_syms_created(Lm_list *lml, const char *name) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; - dbg_print(MSG_INTL(MSG_SYM_CREATE), _Dbg_sym_dem(name)); + dbg_print(lml, MSG_INTL(MSG_SYM_CREATE), Dbg_demangle_name(name)); } void -Dbg_syms_resolving1(Xword ndx, const char *name, int row, int col) +Dbg_syms_resolving(Ofl_desc *ofl, Word ndx, const char *name, int row, + int col, Sym *osym, Sym *nsym, Sym_desc *sdp, Ifl_desc *ifl) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) - return; + Lm_list *lml = ofl->ofl_lml; + Half mach = ofl->ofl_dehdr->e_machine; - dbg_print(MSG_INTL(MSG_SYM_RESOLVING), EC_XWORD(ndx), - _Dbg_sym_dem(name), row, col); -} - -void -Dbg_syms_resolving2(Ehdr *ehdr, Sym *osym, Sym *nsym, Sym_desc *sdp, - Ifl_desc *ifl) -{ - if (DBG_NOTCLASS(DBG_SYMBOLS)) - return; - if (DBG_NOTDETAIL()) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; - Elf_sym_table_entry(MSG_INTL(MSG_STR_OLD), ehdr, osym, sdp->sd_aux ? - sdp->sd_aux->sa_overndx : 0, NULL, sdp->sd_file->ifl_name); - Elf_sym_table_entry(MSG_INTL(MSG_STR_NEW), ehdr, nsym, 0, NULL, - ifl->ifl_name); -} + dbg_print(lml, MSG_INTL(MSG_SYM_RESOLVING), EC_WORD(ndx), + Dbg_demangle_name(name), row, col); -void -Dbg_syms_resolved(Ehdr *ehdr, Sym_desc *sdp) -{ - if (DBG_NOTCLASS(DBG_SYMBOLS)) - return; if (DBG_NOTDETAIL()) return; - Elf_sym_table_entry(MSG_INTL(MSG_STR_RESOLVED), ehdr, sdp->sd_sym, - sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL, - conv_deftag_str(sdp->sd_ref)); -} - -void -Dbg_syms_nl() -{ - if (DBG_NOTCLASS(DBG_SYMBOLS)) - return; + Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_OLD), + mach, osym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL, + sdp->sd_file->ifl_name); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_INTL(MSG_STR_NEW), + mach, nsym, 0, NULL, ifl->ifl_name); } -static Boolean symbol_title = TRUE; - -static void -_Dbg_syms_reloc_title() -{ - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_SYM_BSS)); - - symbol_title = FALSE; -} void -Dbg_syms_reloc(Ehdr *ehdr, Sym_desc *sdp) +Dbg_syms_resolved(Ofl_desc *ofl, Sym_desc *sdp) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; - - if (symbol_title) - _Dbg_syms_reloc_title(); - dbg_print(MSG_INTL(MSG_SYM_UPDATE), _Dbg_sym_dem(sdp->sd_name)); - if (DBG_NOTDETAIL()) return; - Elf_sym_table_entry(MSG_ORIG(MSG_SYM_COPY), ehdr, sdp->sd_sym, + Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, + MSG_INTL(MSG_STR_RESOLVED), ofl->ofl_dehdr->e_machine, sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL, - conv_deftag_str(sdp->sd_ref)); + conv_def_tag(sdp->sd_ref)); } void -Dbg_syms_lookup_aout(const char *name) +Dbg_syms_reloc(Ofl_desc *ofl, Sym_desc *sdp) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) - return; + static Boolean symbol_title = TRUE; + Lm_list *lml = ofl->ofl_lml; - dbg_print(MSG_INTL(MSG_SYM_AOUT), _Dbg_sym_dem(name)); -} - -void -Dbg_syms_lookup(const char *name, const char *file, const char *type) -{ - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; - dbg_print(MSG_INTL(MSG_SYM_LOOKUP), _Dbg_sym_dem(name), file, type); -} + if (symbol_title) { + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_SYM_BSS)); -void -Dbg_syms_dlsym(const char *sym, const char *from, const char *next, int flag) -{ - const char *str; + symbol_title = FALSE; + } + dbg_print(lml, MSG_INTL(MSG_SYM_UPDATE), + Dbg_demangle_name(sdp->sd_name)); - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTDETAIL()) return; - if (flag == DBG_DLSYM_NEXT) - str = MSG_ORIG(MSG_SYM_NEXT); - else if (flag == DBG_DLSYM_DEFAULT) - str = MSG_ORIG(MSG_SYM_DEFAULT); - else if (flag == DBG_DLSYM_SELF) - str = MSG_ORIG(MSG_SYM_SELF); - else if (flag == DBG_DLSYM_PROBE) - str = MSG_ORIG(MSG_SYM_PROBE); - else - str = MSG_ORIG(MSG_STR_EMPTY); - - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - if (next == 0) - dbg_print(MSG_INTL(MSG_SYM_DLSYM_1), _Dbg_sym_dem(sym), - from, str); - else - dbg_print(MSG_INTL(MSG_SYM_DLSYM_2), _Dbg_sym_dem(sym), - from, next, str); + Elf_syms_table_entry(lml, ELF_DBG_LD, MSG_ORIG(MSG_SYM_COPY), + ofl->ofl_dehdr->e_machine, sdp->sd_sym, + sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL, + conv_def_tag(sdp->sd_ref)); } void -Dbg_syms_reduce(int which, Ehdr *ehdr, Sym_desc *sdp, - int idx, const char *sname) +Dbg_syms_reduce(Ofl_desc *ofl, int which, Sym_desc *sdp, int idx, + const char *sname) { static Boolean sym_reduce_title = TRUE; static Boolean sym_retain_title = TRUE; Boolean isfromglobal = (which == DBG_SYM_REDUCE_GLOBAL); Boolean isfromretain = (which == DBG_SYM_REDUCE_RETAIN); + Lm_list *lml = ofl->ofl_lml; - if (DBG_NOTCLASS(DBG_SYMBOLS | DBG_VERSIONS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS | DBG_C_VERSIONS)) return; if (sym_reduce_title && isfromglobal) { sym_reduce_title = FALSE; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_SYM_REDUCED)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_SYM_REDUCED)); } else if (sym_retain_title && isfromretain) { sym_retain_title = FALSE; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_SYM_RETAINING)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_SYM_RETAINING)); } if ((sdp->sd_flags1 & FLG_SY1_ELIM) && isfromglobal) - dbg_print(MSG_INTL(MSG_SYM_ELIMINATING), - _Dbg_sym_dem(sdp->sd_name)); + dbg_print(lml, MSG_INTL(MSG_SYM_ELIMINATING), + Dbg_demangle_name(sdp->sd_name)); else if (isfromglobal) - dbg_print(MSG_INTL(MSG_SYM_REDUCING), - _Dbg_sym_dem(sdp->sd_name)); + dbg_print(lml, MSG_INTL(MSG_SYM_REDUCING), + Dbg_demangle_name(sdp->sd_name)); else - dbg_print(MSG_INTL(MSG_SYM_NOTELIMINATE), - _Dbg_sym_dem(sdp->sd_name), sname, idx); + dbg_print(lml, MSG_INTL(MSG_SYM_NOTELIMINATE), + Dbg_demangle_name(sdp->sd_name), sname, idx); if (DBG_NOTDETAIL()) return; - Elf_sym_table_entry(MSG_ORIG(MSG_SYM_LOCAL), ehdr, sdp->sd_sym, + Elf_syms_table_entry(ofl->ofl_lml, ELF_DBG_LD, MSG_ORIG(MSG_SYM_LOCAL), + ofl->ofl_dehdr->e_machine, sdp->sd_sym, sdp->sd_aux ? sdp->sd_aux->sa_overndx : 0, NULL, sdp->sd_file->ifl_name); } - void -Dbg_syminfo_title() +Dbg_syminfo_title(Lm_list *lml) { - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_SYMI_TITLE1)); - Gelf_syminfo_title(); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_SYMINFO_INFO)); + Elf_syminfo_title(lml); } void -Dbg_syminfo_entry(int ndx, Syminfo *sip, Sym *sym, const char *strtab, - Dyn *dyn) +Dbg_syminfo_entry(Lm_list *lml, Word ndx, Syminfo *sip, Sym *sym, + const char *strtab, Dyn *dyn) { const char *needed; - if (DBG_NOTCLASS(DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_SYMBOLS)) return; if (DBG_NOTDETAIL()) return; @@ -614,6 +460,58 @@ Dbg_syminfo_entry(int ndx, Syminfo *sip, Sym *sym, const char *strtab, else needed = 0; - Gelf_syminfo_entry(ndx, (GElf_Syminfo *)sip, - _Dbg_sym_dem(strtab + sym->st_name), needed); + Elf_syminfo_entry(lml, ndx, sip, + Dbg_demangle_name(strtab + sym->st_name), needed); +} + +/* + * Symbol table output can differ slightly depending on the caller. However, + * the final diagnostic is maintained here so hat the various message strings + * remain consistent + * + * elfdump: index value size type bind oth ver shndx name + * ld: value size type bind oth ver shndx + */ +void +Elf_syms_table_title(Lm_list *lml, int caller) +{ + if (caller == ELF_DBG_ELFDUMP) { + if (DBG_NOTLONG()) + dbg_print(lml, MSG_INTL(MSG_SYM_EFS_TITLE)); + else + dbg_print(lml, MSG_INTL(MSG_SYM_EFL_TITLE)); + return; + } + + if (caller == ELF_DBG_LD) { + if (DBG_NOTLONG()) + dbg_print(lml, MSG_INTL(MSG_SYM_LDS_TITLE)); + else + dbg_print(lml, MSG_INTL(MSG_SYM_LDL_TITLE)); + return; + } +} + +void +Elf_syms_table_entry(Lm_list *lml, int caller, const char *prestr, Half mach, + Sym *sym, Word verndx, const char *sec, const char *poststr) +{ + uchar_t type = ELF_ST_TYPE(sym->st_info); + uchar_t bind = ELF_ST_BIND(sym->st_info); + const char *msg; + + if ((caller == ELF_DBG_ELFDUMP) || + (caller == ELF_DBG_LD)) { + if (DBG_NOTLONG()) + msg = MSG_INTL(MSG_SYM_EFS_ENTRY); + else + msg = MSG_INTL(MSG_SYM_EFL_ENTRY); + + dbg_print(lml, msg, prestr, + conv_sym_value(mach, type, sym->st_value), sym->st_size, + conv_sym_info_type(mach, type), conv_sym_info_bind(bind), + conv_sym_other(sym->st_other), verndx, + sec ? sec : conv_sym_shndx(sym->st_shndx), + Elf_demangle_name(poststr)); + } } diff --git a/usr/src/cmd/sgs/liblddbg/common/tls.c b/usr/src/cmd/sgs/liblddbg/common/tls.c index 435efa2146..5af330e3a3 100644 --- a/usr/src/cmd/sgs/liblddbg/common/tls.c +++ b/usr/src/cmd/sgs/liblddbg/common/tls.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,65 +18,68 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <link.h> -#include <stdio.h> #include <libc_int.h> #include <rtld.h> +#include <debug.h> #include "msg.h" #include "_debug.h" static void -tls_modent(TLS_modinfo * tmodent) +Dbg_tls_modent(Lm_list *lml, TLS_modinfo * tmodent) { - dbg_print(MSG_INTL(MSG_TLS_STMODENT1), - EC_XWORD((uintptr_t)tmodent->tm_tlsblock), - EC_XWORD(tmodent->tm_stattlsoffset), - EC_XWORD(tmodent->tm_flags)); - dbg_print(MSG_INTL(MSG_TLS_STMODENT2), - EC_XWORD(tmodent->tm_filesz), - EC_XWORD(tmodent->tm_memsz), - EC_XWORD(tmodent->tm_modid)); + dbg_print(lml, MSG_INTL(MSG_TLS_STMODENT1), + EC_XWORD((uintptr_t)tmodent->tm_tlsblock), + EC_XWORD(tmodent->tm_stattlsoffset), EC_XWORD(tmodent->tm_flags)); + dbg_print(lml, MSG_INTL(MSG_TLS_STMODENT2), + EC_XWORD(tmodent->tm_filesz), EC_XWORD(tmodent->tm_memsz), + EC_XWORD(tmodent->tm_modid)); } void -Dbg_tls_static_block(void * vtlsmodlist, unsigned long tlsstatsize) +Dbg_tls_static_block(Lm_list *lml, void *vtlsmodlist, ulong_t tlsstatsize) { - unsigned int i; + uint_t i; TLS_modinfo ** tlsmodlist; - if (DBG_NOTCLASS(DBG_TLS)) + if (DBG_NOTCLASS(DBG_C_TLS)) return; + tlsmodlist = (TLS_modinfo **)vtlsmodlist; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); + for (i = 0; tlsmodlist[i]; i++) { - dbg_print(MSG_INTL(MSG_TLS_STATBLOCK1), - i, tlsmodlist[i]->tm_modname); - tls_modent(tlsmodlist[i]); + dbg_print(lml, MSG_INTL(MSG_TLS_STATBLOCK1), i, + tlsmodlist[i]->tm_modname); + Dbg_tls_modent(lml, tlsmodlist[i]); } - dbg_print(MSG_INTL(MSG_TLS_STATBLOCK2), EC_XWORD(tlsstatsize)); + dbg_print(lml, MSG_INTL(MSG_TLS_STATBLOCK2), EC_XWORD(tlsstatsize)); } - void -Dbg_tls_modactivity(void * vtlsmodent, uint_t flag) +Dbg_tls_modactivity(Lm_list *lml, void *vtlsmodent, uint_t flag) { const char *str; TLS_modinfo *tlsmodent; - if (DBG_NOTCLASS(DBG_TLS)) + + if (DBG_NOTCLASS(DBG_C_TLS)) return; + if (flag == TM_FLG_MODADD) str = MSG_INTL(MSG_TLS_ADD); else str = MSG_INTL(MSG_TLS_REMOVE); + tlsmodent = (TLS_modinfo *)vtlsmodent; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_TLS_MODACT), str, tlsmodent->tm_modname); - tls_modent(tlsmodent); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_TLS_MODACT), str, tlsmodent->tm_modname); + Dbg_tls_modent(lml, tlsmodent); } diff --git a/usr/src/cmd/sgs/liblddbg/common/unused.c b/usr/src/cmd/sgs/liblddbg/common/unused.c index d478da087d..8f8ddaf15e 100644 --- a/usr/src/cmd/sgs/liblddbg/common/unused.c +++ b/usr/src/cmd/sgs/liblddbg/common/unused.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -31,11 +30,34 @@ #include "libld.h" void -Dbg_unused_sec(Is_desc *isp) +Dbg_unused_rtldinfo(Rt_map *lmp) +{ + Lm_list *lml = LIST(lmp); + + if (DBG_NOTCLASS(DBG_C_UNUSED)) + return; + + dbg_print(lml, MSG_INTL(MSG_USD_RTLDINFO), NAME(lmp), + NAME(lml->lm_info_lmp)); +} + +void +Dbg_unused_unref(Rt_map *lmp, const char *depend) +{ + if (DBG_NOTCLASS(DBG_C_UNUSED)) + return; + if (DBG_NOTDETAIL()) + return; + + dbg_print(LIST(lmp), MSG_INTL(MSG_USD_UNREF), NAME(lmp), depend); +} + +void +Dbg_unused_sec(Lm_list *lml, Is_desc *isp) { const char *str; - if (DBG_NOTCLASS(DBG_UNUSED)) + if (DBG_NOTCLASS(DBG_C_UNUSED)) return; if (DBG_NOTDETAIL()) return; @@ -54,47 +76,20 @@ Dbg_unused_sec(Is_desc *isp) else str = MSG_ORIG(MSG_STR_EMPTY); - dbg_print(MSG_INTL(MSG_USD_SEC), isp->is_basename, + dbg_print(lml, MSG_INTL(MSG_USD_SEC), isp->is_basename, EC_XWORD(isp->is_shdr->sh_size), isp->is_file->ifl_name, str); } -/* - * There are no ELF32/ELF64 data structures in these functions - only define - * one copy in liblddbg. - */ -#if !defined(_ELF64) - void -Dbg_unused_file(const char *name, int needstr, int cycle) +Dbg_unused_file(Lm_list *lml, const char *name, int needstr, uint_t cycle) { - if (DBG_NOTCLASS(DBG_UNUSED)) + if (DBG_NOTCLASS(DBG_C_UNUSED)) return; if (needstr) - dbg_print(MSG_INTL(MSG_USD_NEEDSTR), name); + dbg_print(lml, MSG_INTL(MSG_USD_NEEDSTR), name); else if (cycle) - dbg_print(MSG_INTL(MSG_USD_FILECYCLIC), name, cycle); + dbg_print(lml, MSG_INTL(MSG_USD_FILECYCLIC), name, cycle); else - dbg_print(MSG_INTL(MSG_USD_FILE), name); -} - -void -Dbg_unused_unref(const char *caller, const char *depend) -{ - if (DBG_NOTCLASS(DBG_UNUSED)) - return; - if (DBG_NOTDETAIL()) - return; - - dbg_print(MSG_INTL(MSG_USD_UNREF), caller, depend); -} - -void -Dbg_unused_rtldinfo(const char *fname1, const char *fname2) -{ - if (DBG_NOTCLASS(DBG_UNUSED)) - return; - - dbg_print(MSG_INTL(MSG_USD_RTLDINFO), fname1, fname2); + dbg_print(lml, MSG_INTL(MSG_USD_FILE), name); } -#endif diff --git a/usr/src/cmd/sgs/liblddbg/common/util.c b/usr/src/cmd/sgs/liblddbg/common/util.c index b531aecb19..d15eb01d63 100644 --- a/usr/src/cmd/sgs/liblddbg/common/util.c +++ b/usr/src/cmd/sgs/liblddbg/common/util.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -30,32 +30,26 @@ #include "libld.h" /* - * Generic new line generator. - */ -void -Dbg_util_nl() -{ - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); -} - -/* * If any run-time linker debugging is being carried out always indicate the * fact and specify the point at which we transfer control to the main program. */ void -Dbg_util_call_main(const char *name) +Dbg_util_call_main(Rt_map *lmp) { - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_UTL_TRANS), name); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Lm_list *lml = LIST(lmp); + + Dbg_util_nl(lml, DBG_NL_FRC); + dbg_print(lml, MSG_INTL(MSG_UTL_TRANS), NAME(lmp)); + Dbg_util_nl(lml, DBG_NL_FRC); } void -Dbg_util_call_init(const char *name, int flag) +Dbg_util_call_init(Rt_map *lmp, int flag) { - const char *str; + Lm_list *lml = LIST(lmp); + const char *str; - if (DBG_NOTCLASS(DBG_INIT)) + if (DBG_NOTCLASS(DBG_C_INIT)) return; if (flag == DBG_INIT_SORT) @@ -67,37 +61,41 @@ Dbg_util_call_init(const char *name, int flag) else str = MSG_INTL(MSG_UTL_DONE); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_UTL_INIT), str, name); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_UTL_INIT), str, NAME(lmp)); + Dbg_util_nl(lml, DBG_NL_STD); } void -Dbg_util_no_init(const char *name) +Dbg_util_no_init(Rt_map *lmp) { - if (DBG_NOTCLASS(DBG_INIT)) + Lm_list *lml = LIST(lmp); + + if (DBG_NOTCLASS(DBG_C_INIT)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_UTL_NOINIT), name); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_UTL_NOINIT), NAME(lmp)); + Dbg_util_nl(lml, DBG_NL_STD); } void -Dbg_util_intoolate(const char *name) +Dbg_util_intoolate(Rt_map *lmp) { - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_UTL_INTOOLATE), name); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Lm_list *lml = LIST(lmp); + + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_UTL_INTOOLATE), NAME(lmp)); + Dbg_util_nl(lml, DBG_NL_STD); } void -Dbg_util_dbnotify(rd_event_e event, r_state_e state) +Dbg_util_dbnotify(Lm_list *lml, rd_event_e event, r_state_e state) { const char *estr; const char *sstr; - if (DBG_NOTCLASS(DBG_FILES)) + if (DBG_NOTCLASS(DBG_C_FILES)) return; if (DBG_NOTDETAIL()) return; @@ -134,18 +132,18 @@ Dbg_util_dbnotify(rd_event_e event, r_state_e state) break; } - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_UTL_DBNOTIFY), estr, sstr); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_UTL_DBNOTIFY), estr, sstr); + Dbg_util_nl(lml, DBG_NL_STD); } void -Dbg_util_call_array(const char *libname, void *addr, uint_t ndx, - uint_t shtype) +Dbg_util_call_array(Rt_map *lmp, void *addr, int ndx, Word shtype) { + Lm_list *lml = LIST(lmp); const char *str; - if (DBG_NOTCLASS(DBG_INIT)) + if (DBG_NOTCLASS(DBG_C_INIT)) return; if (shtype == SHT_INIT_ARRAY) @@ -154,34 +152,40 @@ Dbg_util_call_array(const char *libname, void *addr, uint_t ndx, str = MSG_ORIG(MSG_SCN_FINIARRAY); else str = MSG_ORIG(MSG_SCN_PREINITARRAY); - dbg_print(MSG_INTL(MSG_UTL_ARRAY), str, ndx, EC_ADDR(addr), libname); + + dbg_print(lml, MSG_INTL(MSG_UTL_ARRAY), str, ndx, EC_NATPTR(addr), + NAME(lmp)); } void -Dbg_util_call_fini(const char *name) +Dbg_util_call_fini(Rt_map *lmp) { - if (DBG_NOTCLASS(DBG_INIT)) + Lm_list *lml = LIST(lmp); + + if (DBG_NOTCLASS(DBG_C_INIT)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_UTL_FINI), name); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_UTL_FINI), NAME(lmp)); + Dbg_util_nl(lml, DBG_NL_STD); } void -Dbg_util_str(const char *name) +Dbg_util_str(Lm_list *lml, const char *str) { - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_ORIG(MSG_FMT_STR), name); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); + Dbg_util_nl(lml, DBG_NL_FRC); + dbg_print(lml, MSG_ORIG(MSG_FMT_STR), str); + Dbg_util_nl(lml, DBG_NL_FRC); + Dbg_util_nl(lml, DBG_NL_STD); } void -Dbg_util_scc_title(int sec) +Dbg_util_scc_title(Lm_list *lml, int sec) { const char *_sec; - if (DBG_NOTCLASS(DBG_INIT)) + if (DBG_NOTCLASS(DBG_C_INIT)) return; if (DBG_NOTDETAIL()) return; @@ -191,40 +195,43 @@ Dbg_util_scc_title(int sec) else _sec = MSG_INTL(MSG_UTL_SCC_SUBF); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_UTL_SCC_TITLE), _sec); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_UTL_SCC_TITLE), _sec); } void -Dbg_util_scc_entry(uint_t idx, const char *name) +Dbg_util_scc_entry(Rt_map *lmp, uint_t idx) { - if (DBG_NOTCLASS(DBG_INIT)) + if (DBG_NOTCLASS(DBG_C_INIT)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_ORIG(MSG_UTL_SCC_ENTRY), idx, name); + dbg_print(LIST(lmp), MSG_ORIG(MSG_UTL_SCC_ENTRY), idx, NAME(lmp)); } void -Dbg_util_broadcast(const char *name) +Dbg_util_broadcast(Rt_map *lmp) { - if (DBG_NOTCLASS(DBG_INIT)) + Lm_list *lml = LIST(lmp); + + if (DBG_NOTCLASS(DBG_C_INIT)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_UTL_BROAD), name); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_UTL_BROAD), NAME(lmp)); + Dbg_util_nl(lml, DBG_NL_STD); } void -Dbg_util_wait(int what, const char *cname, const char *dname) +Dbg_util_wait(Rt_map *clmp, Rt_map *dlmp, int what) { + Lm_list *lml = LIST(clmp); const char *str; - if (DBG_NOTCLASS(DBG_INIT)) + if (DBG_NOTCLASS(DBG_C_INIT)) return; if (DBG_NOTDETAIL()) return; @@ -236,19 +243,20 @@ Dbg_util_wait(int what, const char *cname, const char *dname) else str = MSG_INTL(MSG_STR_SYMBOL); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_UTL_WAIT), str, cname, dname); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_UTL_WAIT), str, NAME(clmp), NAME(dlmp)); + Dbg_util_nl(lml, DBG_NL_STD); } static int ectoggle = 0; void -Dbg_util_edge_in(Rt_map *clmp, uint_t flags, Rt_map *dlmp, int ndx, int flag) +Dbg_util_edge_in(Lm_list *lml, Rt_map *clmp, uint_t flags, Rt_map *dlmp, + int ndx, int flag) { const char *str; - if (DBG_NOTCLASS(DBG_INIT)) + if (DBG_NOTCLASS(DBG_C_INIT)) return; if (DBG_NOTDETAIL()) return; @@ -259,34 +267,36 @@ Dbg_util_edge_in(Rt_map *clmp, uint_t flags, Rt_map *dlmp, int ndx, int flag) str = MSG_ORIG(MSG_SCN_FINI); if ((clmp == 0) || (ectoggle == 0)) - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); if (clmp == 0) { - dbg_print(MSG_INTL(MSG_UTL_EDGE_TITLE), str); - dbg_print(MSG_INTL(MSG_UTL_EDGE_START), ndx, NAME(dlmp)); + dbg_print(lml, MSG_INTL(MSG_UTL_EDGE_TITLE), str); + dbg_print(lml, MSG_INTL(MSG_UTL_EDGE_START), ndx, NAME(dlmp)); } else - dbg_print(MSG_INTL(MSG_UTL_EDGE_IN), ndx, NAME(dlmp), - NAME(clmp), conv_bindent_str(flags)); + dbg_print(lml, MSG_INTL(MSG_UTL_EDGE_IN), ndx, NAME(dlmp), + NAME(clmp), conv_bnd_type(flags)); ectoggle = 1; } void -Dbg_util_edge_out(const char *cname, int ndx, const char *dname) +Dbg_util_edge_out(Rt_map *clmp, Rt_map *dlmp) { - if (DBG_NOTCLASS(DBG_INIT)) + if (DBG_NOTCLASS(DBG_C_INIT)) return; if (DBG_NOTDETAIL()) return; - dbg_print(MSG_INTL(MSG_UTL_EDGE_OUT), ndx, cname, dname); + dbg_print(LIST(clmp), MSG_INTL(MSG_UTL_EDGE_OUT), SORTVAL(clmp), + NAME(clmp), NAME(dlmp)); } void -Dbg_util_collect(const char *name, int ndx, int flag) +Dbg_util_collect(Rt_map *lmp, int ndx, int flag) { + Lm_list *lml = LIST(lmp); const char *str; - if (DBG_NOTCLASS(DBG_INIT)) + if (DBG_NOTCLASS(DBG_C_INIT)) return; if (DBG_NOTDETAIL()) return; @@ -297,8 +307,47 @@ Dbg_util_collect(const char *name, int ndx, int flag) str = MSG_ORIG(MSG_SCN_FINI); if (ectoggle == 1) { - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); ectoggle = 0; } - dbg_print(MSG_INTL(MSG_UTL_COLLECT), ndx, name, str); + dbg_print(lml, MSG_INTL(MSG_UTL_COLLECT), ndx, NAME(lmp), str); +} + +/* + * Generic new line generator. To prevent multiple newlines from being + * generated, a flag is maintained in the global debug descriptor. This flag + * is cleared by the callers dbg_print() function to indicate that a newline + * (actually, any line) has been printed. Multiple newlines can be generated + * using the DBG_NL_FRC flag. + */ +void +Dbg_util_nl(Lm_list *lml, int flag) +{ + if ((flag == DBG_NL_STD) && (dbg_desc->d_extra & DBG_E_STDNL)) + return; + + dbg_print(lml, MSG_ORIG(MSG_STR_EMPTY)); + + if (flag == DBG_NL_STD) + dbg_desc->d_extra |= DBG_E_STDNL; +} + +/* + * Define name demanglers. + */ +const char * +Dbg_demangle_name(const char *name) +{ + if (DBG_NOTCLASS(DBG_C_DEMANGLE)) + return (name); + + return (conv_demangle_name(name)); +} + +const char * +Elf_demangle_name(const char *name) +{ + if (DBG_ISDEMANGLE()) + return (conv_demangle_name(name)); + return (name); } diff --git a/usr/src/cmd/sgs/liblddbg/common/version.c b/usr/src/cmd/sgs/liblddbg/common/version.c index eb171b6236..b0fdf719d7 100644 --- a/usr/src/cmd/sgs/liblddbg/common/version.c +++ b/usr/src/cmd/sgs/liblddbg/common/version.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,117 +18,80 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <link.h> -#include <stdio.h> +#include <debug.h> #include "msg.h" #include "_debug.h" -#if !defined(_ELF64) -void -Gelf_ver_def_title() -{ - dbg_print(MSG_ORIG(MSG_VER_DEF_2)); -} - -void -Gelf_ver_need_title() -{ - dbg_print(MSG_ORIG(MSG_VER_NEED_2)); -} - -void -Gelf_ver_line_1(const char * index, const char * name, const char * dep, - const char * flags) -{ - if (DBG_NOTLONG()) - dbg_print(MSG_ORIG(MSG_VER_LINE_1), index, name, dep, flags); - else - dbg_print(MSG_ORIG(MSG_VER_L_LINE_1), index, name, dep, flags); -} - void -Gelf_ver_line_2(const char * name, const char * dep) +Dbg_ver_avail_title(Lm_list *lml, const char *file) { - dbg_print(MSG_ORIG(MSG_VER_LINE_2), name, dep); -} - -void -Gelf_ver_line_3(const char * name, const char * dep, const char * flags) -{ - dbg_print(MSG_ORIG(MSG_VER_LINE_3), name, dep, flags); -} - -void -Dbg_ver_avail_title(const char * file) -{ - if (DBG_NOTCLASS(DBG_VERSIONS)) + if (DBG_NOTCLASS(DBG_C_VERSIONS)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_VER_AVAIL_1), file); - dbg_print(MSG_INTL(MSG_VER_AVAIL_2)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_VER_AVAIL_1), file); + dbg_print(lml, MSG_INTL(MSG_VER_AVAIL_2)); } void -Dbg_ver_def_title(const char * file) +Dbg_ver_def_title(Lm_list *lml, const char *file) { - if (DBG_NOTCLASS(DBG_VERSIONS)) + if (DBG_NOTCLASS(DBG_C_VERSIONS)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_VER_DEF_1), file); - Gelf_ver_def_title(); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_VER_DEF_TITLE), file); + Elf_ver_def_title(lml); } void -Dbg_ver_need_title(const char * file) +Dbg_ver_need_title(Lm_list *lml, const char *file) { - if (DBG_NOTCLASS(DBG_VERSIONS)) + if (DBG_NOTCLASS(DBG_C_VERSIONS)) return; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_VER_NEED_1), file); - Gelf_ver_need_title(); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_VER_NEED_TITLE), file); + Elf_ver_need_title(lml); } void -Dbg_ver_need_entry(Half cnt, const char * file, const char * version) +Dbg_ver_need_entry(Lm_list *lml, Half cnt, const char *file, + const char *version) { - if (DBG_NOTCLASS(DBG_VERSIONS)) + if (DBG_NOTCLASS(DBG_C_VERSIONS)) return; - if (cnt == 0) { - if (DBG_NOTLONG()) - dbg_print(MSG_ORIG(MSG_VER_LINE_5), file, version); - else - dbg_print(MSG_ORIG(MSG_VER_L_LINE_5), file, version); - } else - dbg_print(MSG_ORIG(MSG_VER_LINE_4), MSG_ORIG(MSG_STR_EMPTY), - version); + if (cnt) + Elf_ver_line_4(lml, version); + else + Elf_ver_line_5(lml, file, version); } void -Dbg_ver_symbol(const char * name) +Dbg_ver_symbol(Lm_list *lml, const char *name) { static Boolean ver_symbol_title = TRUE; - if (DBG_NOTCLASS(DBG_VERSIONS | DBG_SYMBOLS)) + if (DBG_NOTCLASS(DBG_C_VERSIONS | DBG_C_SYMBOLS)) return; - if (DBG_NOTCLASS(DBG_VERSIONS)) + if (DBG_NOTCLASS(DBG_C_VERSIONS)) if (ver_symbol_title) { ver_symbol_title = FALSE; - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_SYM_VERSION)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_SYM_VERSION)); } - Dbg_syms_created(name); + Dbg_syms_created(lml, name); } /* @@ -137,27 +99,22 @@ Dbg_ver_symbol(const char * name) * be generated for any debugging family. */ void -Dbg_ver_nointerface(const char * name) +Dbg_ver_nointerface(Lm_list *lml, const char *name) { - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); - dbg_print(MSG_INTL(MSG_VER_NOINTERFACE), name); - dbg_print(MSG_ORIG(MSG_STR_EMPTY)); + Dbg_util_nl(lml, DBG_NL_STD); + dbg_print(lml, MSG_INTL(MSG_VER_NOINTERFACE), name); + Dbg_util_nl(lml, DBG_NL_STD); } -#endif /* !defined(_ELF64) */ - -/* - * Print a version descriptor. - */ void -Dbg_ver_desc_entry(Ver_desc * vdp) +Dbg_ver_desc_entry(Lm_list *lml, Ver_desc *vdp) { - const char * dep; - Ver_desc * _vdp, * __vdp; + const char *dep; + Ver_desc *_vdp, *__vdp; Listnode * lnp; char index[10]; - if (DBG_NOTCLASS(DBG_VERSIONS)) + if (DBG_NOTCLASS(DBG_C_VERSIONS)) return; if (vdp->vd_deps.head) { @@ -168,8 +125,8 @@ Dbg_ver_desc_entry(Ver_desc * vdp) dep = MSG_ORIG(MSG_STR_EMPTY); } (void) sprintf(index, MSG_ORIG(MSG_FMT_INDEX), vdp->vd_ndx); - Gelf_ver_line_1(index, vdp->vd_name, dep, - conv_verflg_str(vdp->vd_flags)); + Elf_ver_line_1(lml, index, vdp->vd_name, dep, + conv_ver_flags(vdp->vd_flags)); /* * Loop through the dependency list in case there are more that one @@ -178,27 +135,79 @@ Dbg_ver_desc_entry(Ver_desc * vdp) for (LIST_TRAVERSE(&vdp->vd_deps, lnp, __vdp)) { if (_vdp == __vdp) continue; - dbg_print(MSG_ORIG(MSG_VER_LINE_4), MSG_ORIG(MSG_STR_EMPTY), - __vdp->vd_name); + Elf_ver_line_4(lml, __vdp->vd_name); } } void -Dbg_ver_avail_entry(Ver_index * vip, const char * select) +Dbg_ver_avail_entry(Lm_list *lml, Ver_index *vip, const char *select) { - if (DBG_NOTCLASS(DBG_VERSIONS)) + if (DBG_NOTCLASS(DBG_C_VERSIONS)) return; if (select) { if (DBG_NOTLONG()) - dbg_print(MSG_ORIG(MSG_VER_SELECTED), vip->vi_name, select); + dbg_print(lml, MSG_ORIG(MSG_VER_SELECTED), + vip->vi_name, select); else - dbg_print(MSG_ORIG(MSG_VER_L_SELECTED), - vip->vi_name, select); + dbg_print(lml, MSG_ORIG(MSG_VER_L_SELECTED), + vip->vi_name, select); } else { if (DBG_NOTLONG()) - dbg_print(MSG_ORIG(MSG_VER_ALL), vip->vi_name); + dbg_print(lml, MSG_ORIG(MSG_VER_ALL), vip->vi_name); else - dbg_print(MSG_ORIG(MSG_VER_L_ALL), vip->vi_name); + dbg_print(lml, MSG_ORIG(MSG_VER_L_ALL), vip->vi_name); } } + +void +Elf_ver_def_title(Lm_list *lml) +{ + dbg_print(lml, MSG_INTL(MSG_VER_DEF)); +} + +void +Elf_ver_need_title(Lm_list *lml) +{ + dbg_print(lml, MSG_INTL(MSG_VER_NEED)); +} + +void +Elf_ver_line_1(Lm_list *lml, const char *index, const char *name, + const char *dep, const char *flags) +{ + if (DBG_NOTLONG()) + dbg_print(lml, MSG_INTL(MSG_VER_LINE_1), index, name, + dep, flags); + else + dbg_print(lml, MSG_INTL(MSG_VER_LLINE_1), index, name, + dep, flags); +} + +void +Elf_ver_line_2(Lm_list *lml, const char *name, const char *dep) +{ + dbg_print(lml, MSG_INTL(MSG_VER_LINE_2), name, dep); +} + +void +Elf_ver_line_3(Lm_list *lml, const char *name, const char *dep, + const char *flags) +{ + dbg_print(lml, MSG_INTL(MSG_VER_LINE_3), name, dep, flags); +} + +void +Elf_ver_line_4(Lm_list *lml, const char *version) +{ + dbg_print(lml, MSG_INTL(MSG_VER_LINE_4), version); +} + +void +Elf_ver_line_5(Lm_list *lml, const char *file, const char *version) +{ + if (DBG_NOTLONG()) + dbg_print(lml, MSG_INTL(MSG_VER_LINE_5), file, version); + else + dbg_print(lml, MSG_INTL(MSG_VER_LLINE_5), file, version); +} diff --git a/usr/src/cmd/sgs/liblddbg/i386/Makefile b/usr/src/cmd/sgs/liblddbg/i386/Makefile index 0ac84d3a85..d27ae308e3 100644 --- a/usr/src/cmd/sgs/liblddbg/i386/Makefile +++ b/usr/src/cmd/sgs/liblddbg/i386/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,19 +18,21 @@ # # CDDL HEADER END # + # -# Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -include $(SRC)/cmd/sgs/liblddbg/Makefile.com +include ../Makefile.com .KEEP_STATE: all: $(DYNLIB) $(LIBLINKS) -install: all $(ROOTFS_DYNLIB) +install \ +package: all $(ROOTFS_DYNLIB) -include $(SRC)/cmd/sgs/liblddbg/Makefile.targ +include ../Makefile.targ diff --git a/usr/src/cmd/sgs/liblddbg/sparc/Makefile b/usr/src/cmd/sgs/liblddbg/sparc/Makefile index 0ac84d3a85..d27ae308e3 100644 --- a/usr/src/cmd/sgs/liblddbg/sparc/Makefile +++ b/usr/src/cmd/sgs/liblddbg/sparc/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,19 +18,21 @@ # # CDDL HEADER END # + # -# Copyright 1996-2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -include $(SRC)/cmd/sgs/liblddbg/Makefile.com +include ../Makefile.com .KEEP_STATE: all: $(DYNLIB) $(LIBLINKS) -install: all $(ROOTFS_DYNLIB) +install \ +package: all $(ROOTFS_DYNLIB) -include $(SRC)/cmd/sgs/liblddbg/Makefile.targ +include ../Makefile.targ diff --git a/usr/src/cmd/sgs/liblddbg/sparcv9/Makefile b/usr/src/cmd/sgs/liblddbg/sparcv9/Makefile index ddd10bffb3..16c74125d7 100644 --- a/usr/src/cmd/sgs/liblddbg/sparcv9/Makefile +++ b/usr/src/cmd/sgs/liblddbg/sparcv9/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,28 +18,33 @@ # # CDDL HEADER END # + # -# Copyright 1997-2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # +include ../Makefile.com -include $(SRC)/cmd/sgs/liblddbg/Makefile.com +ROOTFS_LIBDIR64 = \ + $(VAR_LIBLDDBG_V9_ROOTFS_LIBDIR) +ROOTFS_DYNLIB64 = \ + $(DYNLIB:%=$(ROOTFS_LIBDIR64)/%) -ROOTFS_LIBDIR= $(VAR_LIBLDDBG_V9_ROOTFS_LIBDIR) -ROOTFS_DYNLIB64= $(DYNLIB:%=$(ROOTFS_LIBDIR)/%) +CONVLIBDIR = $(CONVLIBDIR64) + +LINTFLAGS64 += $(VAR_LINTFLAGS64) .KEEP_STATE: +$(ROOTFS_DYNLIB64) := FILEMODE= 755 + all: $(DYNLIB) $(LIBLINKS) -install: all $(ROOTFS_DYNLIB64) +install \ +package: all $(ROOTFS_DYNLIB64) -include $(SRC)/cmd/sgs/liblddbg/Makefile.targ +include ../Makefile.targ include ../../Makefile.sub.64 - -CONVLIBDIR = $(CONVLIBDIR64) - -LINTFLAGS64 += $(VAR_LINTFLAGS64) diff --git a/usr/src/cmd/sgs/libldstab/Makefile.com b/usr/src/cmd/sgs/libldstab/Makefile.com index 2461fd0eb8..d862036421 100644 --- a/usr/src/cmd/sgs/libldstab/Makefile.com +++ b/usr/src/cmd/sgs/libldstab/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -43,7 +43,7 @@ SRCBASE= ../../../.. MAPFILES= ../common/mapfile-vers MAPOPTS= $(MAPFILES:%=-M%) -LDLIBS += $(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf -lc +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf -lc DYNFLAGS += $(VERSREF) $(MAPOPTS) LINTFLAGS += -erroff=E_NAME_DECL_NOT_USED_DEF2 \ diff --git a/usr/src/cmd/sgs/librtld/Makefile.com b/usr/src/cmd/sgs/librtld/Makefile.com index faea9a74b0..03aaf6a18c 100644 --- a/usr/src/cmd/sgs/librtld/Makefile.com +++ b/usr/src/cmd/sgs/librtld/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -40,12 +40,13 @@ OBJECTS= $(BLTOBJ) $(MACHOBJS) $(COMOBJS) include $(SRC)/lib/Makefile.lib include $(SRC)/cmd/sgs/Makefile.com -MAPFILE= ../common/mapfile-vers +MAPFILES = ../common/mapfile-vers +MAPOPTS = $(MAPFILES:%=-M%) CPPFLAGS += -I../../rtld/common -I$(SRCBASE)/lib/libc/inc \ -I$(SRCBASE)/uts/common/krtld -DYNFLAGS += $(VERSREF) $(ZLAZYLOAD) -LDLIBS += $(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf -lc +DYNFLAGS += $(VERSREF) $(ZLAZYLOAD) '-R$$ORIGIN' +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf -lc LINTFLAGS += -u -erroff=E_NAME_DECL_NOT_USED_DEF2 LINTFLAGS64 += -u -erroff=E_NAME_DECL_NOT_USED_DEF2 @@ -54,7 +55,7 @@ LINTFLAGS64 += -u -erroff=E_NAME_DECL_NOT_USED_DEF2 # '=' is used with extra variables. # XXXFLAGS= -$(DYNLIB) := XXXFLAGS= $(USE_PROTO) -M$(MAPFILE) +$(DYNLIB) := XXXFLAGS= $(USE_PROTO) $(MAPOPTS) DYNFLAGS += $(XXXFLAGS) diff --git a/usr/src/cmd/sgs/librtld/amd64/Makefile b/usr/src/cmd/sgs/librtld/amd64/Makefile index 9a2f0a6f8f..e0645150c2 100644 --- a/usr/src/cmd/sgs/librtld/amd64/Makefile +++ b/usr/src/cmd/sgs/librtld/amd64/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -28,7 +28,8 @@ include $(SRC)/cmd/sgs/librtld/Makefile.com -CPPFLAGS += -I../../../../uts/intel/amd64/krtld +CPPFLAGS += -I../../../../uts/intel/amd64/krtld +MAPFILES += ../common/mapfile-64-vers .KEEP_STATE: diff --git a/usr/src/cmd/sgs/librtld/amd64/_relocate.c b/usr/src/cmd/sgs/librtld/amd64/_relocate.c index 3449aef47d..26dbc9ba2d 100644 --- a/usr/src/cmd/sgs/librtld/amd64/_relocate.c +++ b/usr/src/cmd/sgs/librtld/amd64/_relocate.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -32,125 +32,112 @@ #include "_librtld.h" #include "_elf.h" - /* * Undo relocations that have been applied to a memory image. Basically this * involves copying the original files relocation offset into the new image * being created. */ +/* ARGSUSED3 */ void -undo_reloc(void *vrel, unsigned char *oaddr, unsigned char *iaddr, - Reloc *reloc) +undo_reloc(void *vrel, uchar_t *oaddr, uchar_t *iaddr, Reloc *reloc) { -#if 0 /* XX64 -- fix me */ - Rel *rel = vrel; - /* LINTED */ - unsigned long *_oaddr = (unsigned long *)oaddr; - /* LINTED */ - unsigned long *_iaddr = (unsigned long *)iaddr; - - switch (ELF_R_TYPE(rel->r_info)) { - case R_386_NONE: + Rela *rel = vrel; + const Rel_entry *rep; + Xword rtype = ELF_R_TYPE(rel->r_info); + ulong_t *_oaddr; + ulong_t *_iaddr; + + switch (rtype) { + case R_AMD64_NONE: break; - - case R_386_COPY: + case R_AMD64_COPY: (void) memset((void *)oaddr, 0, (size_t)reloc->r_size); break; + case R_AMD64_JUMP_SLOT: + /* LINTED */ + _oaddr = (unsigned long *)oaddr; + /* LINTED */ + _iaddr = (unsigned long *)iaddr; - case R_386_JMP_SLOT: - if (_iaddr) - *_oaddr = *_iaddr + reloc->r_value; - else - *_oaddr = reloc->r_value; - break; - - default: - if (_iaddr) + if (_iaddr) { + *_oaddr++ = *_iaddr++; + *_oaddr++ = *_iaddr++; *_oaddr = *_iaddr; - else + } else { + *_oaddr++ = 0; + *_oaddr++ = 0; *_oaddr = 0; + } break; + default: + rep = &reloc_table[rtype]; + if (iaddr) + (void) memcpy(oaddr, iaddr, rep->re_fsize); + else + (void) memset(oaddr, 0, rep->re_fsize); } -#endif /* XX64 -- fix me */ } - /* * Copy a relocation record and increment its value. The record must reflect - * the new address to which this image is fixed. Note that .got entries - * associated with .plt's must be fixed to the new base address. + * the new address to which this image is fixed. */ +/* ARGSUSED3 */ void -inc_reloc(void *vnrel, void *vorel, Reloc *reloc, unsigned char *oaddr, - unsigned char *iaddr) +inc_reloc(void *vnrel, void *vorel, Reloc *reloc, uchar_t *oaddr, + uchar_t *iaddr) { -#if 0 /* XX64 -- fix me */ - Rel *nrel = vnrel; - Rel *orel = vorel; - /* LINTED */ - unsigned long *_oaddr = (unsigned long *)oaddr; - /* LINTED */ - unsigned long *_iaddr = (unsigned long *)iaddr; - - if (ELF_R_TYPE(nrel->r_info) == R_386_JMP_SLOT) { - if (_iaddr) - *_oaddr = *_iaddr + reloc->r_value; - else - *_oaddr = reloc->r_value; - } + Rela *nrel = vnrel; + Rela *orel = vorel; *nrel = *orel; nrel->r_offset += reloc->r_value; -#endif /* XX64 -- fix me */ } - /* * Clear a relocation record. The relocation has been applied to the image and * thus the relocation must not occur again. */ void -clear_reloc(void * vrel) +clear_reloc(void *vrel) { -#if 0 /* XX64 -- fix me */ - Rel * rel = vrel; + Rela *rel = vrel; rel->r_offset = 0; - rel->r_info = ELF_R_INFO(0, R_386_NONE); -#endif /* XX64 -- fix me */ + rel->r_info = ELF_R_INFO(0, R_AMD64_NONE); + rel->r_addend = 0; } - /* * Apply a relocation to an image being built from an input file. Use the * runtime linkers routines to do the necessary magic. */ void -apply_reloc(void *vrel, Reloc *reloc, const char *name, - unsigned char *oaddr, Rt_map *lmp) +apply_reloc(void *vrel, Reloc *reloc, const char *name, uchar_t *oaddr, + Rt_map *lmp) { -#if 0 /* XX64 -- fix me */ - Rel *rel = vrel; - Byte type = ELF_R_TYPE(rel->r_info); - Word value = reloc->r_value; + Rela *rel = vrel; + Xword type = ELF_R_TYPE(rel->r_info); + Xword value = reloc->r_value + rel->r_addend; - if (type == R_386_JMP_SLOT) { + if (type == R_AMD64_JUMP_SLOT) { uintptr_t addr, vaddr; if (FLAGS(lmp) & FLG_RT_FIXED) vaddr = 0; else vaddr = ADDR(lmp); + addr = (uintptr_t)oaddr - rel->r_offset; /* LINTED */ elf_plt_write((uintptr_t)addr, vaddr, rel, (uintptr_t)value, reloc->r_pltndx); - } else if (type == R_386_COPY) { + + } else if (type == R_AMD64_COPY) { (void) memcpy((void *)oaddr, (void *)value, (size_t)reloc->r_size); - } else { - (void) do_reloc(type, oaddr, &value, reloc->r_name, name); + (void) do_reloc(type, oaddr, &value, reloc->r_name, name, + LIST(lmp)); } -#endif /* XX64 -- fix me */ } diff --git a/usr/src/cmd/sgs/librtld/common/_librtld.h b/usr/src/cmd/sgs/librtld/common/_librtld.h index 9d3fc8d175..d294086ca7 100644 --- a/usr/src/cmd/sgs/librtld/common/_librtld.h +++ b/usr/src/cmd/sgs/librtld/common/_librtld.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 2001 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #ifndef __LIBRTLD_H @@ -84,15 +84,12 @@ typedef struct reloc { /* * Define any local prototypes. */ -extern void apply_reloc(void *, Reloc *, const char *, unsigned char *, - Rt_map * lmp); +extern void apply_reloc(void *, Reloc *, const char *, uchar_t *, Rt_map *); extern void clear_reloc(void *); extern int count_reloc(Cache *, Cache *, Rt_map *, int, Addr, Xword *, Xword *, Xword *); -extern void inc_reloc(void *, void *, Reloc *, unsigned char *, - unsigned char *); -extern void undo_reloc(void *, unsigned char *, unsigned char *, - Reloc *); +extern void inc_reloc(void *, void *, Reloc *, uchar_t *, uchar_t *); +extern void undo_reloc(void *, uchar_t *, uchar_t *, Reloc *); extern int update_dynamic(Cache *, Cache *, Rt_map *, int, Addr, Off, const char *, Xword, Xword, Xword, Xword, Xword); extern void update_reloc(Cache *, Cache *, Cache *, const char *, diff --git a/usr/src/cmd/sgs/librtld/common/dldump.c b/usr/src/cmd/sgs/librtld/common/dldump.c index 7f1ed83de8..27dd6a264b 100644 --- a/usr/src/cmd/sgs/librtld/common/dldump.c +++ b/usr/src/cmd/sgs/librtld/common/dldump.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * dldump(3c) creates a new file image from the specified input file. @@ -162,6 +162,7 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) Addr edata; char *shstr, *_shstr, *ipath = NAME(lmp); prstatus_t *status = 0, _status; + Lm_list *lml = LIST(lmp); if (lmp == lml_main.lm_head) { char proc[16]; @@ -174,7 +175,7 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) (int)getpid()); if ((pfd = open(proc, O_RDONLY)) == -1) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), proc, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), proc, strerror(err)); return (1); } @@ -187,7 +188,7 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) */ if ((fd = ioctl(pfd, PIOCOPENM, (void *)0)) == -1) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_PROC), ipath, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_PROC), ipath, strerror(err)); (void) close(pfd); return (1); @@ -204,7 +205,7 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) if (!(flags & RTLD_NOHEAP)) { if (ioctl(pfd, PIOCSTATUS, (void *)&_status) == -1) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_PROC), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_PROC), ipath, strerror(err)); (void) close(fd); (void) close(pfd); @@ -220,7 +221,7 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) */ if ((fd = open(ipath, O_RDONLY, 0)) == -1) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), ipath, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), ipath, strerror(err)); return (1); } @@ -232,7 +233,7 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) */ (void) elf_version(EV_CURRENT); if ((ielf = elf_begin(fd, ELF_C_READ, NULL)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_BEGIN), ipath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_BEGIN), ipath); cleanup(ielf, oelf, melf, icache, mcache, fd, 0); return (1); } @@ -241,7 +242,7 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) if ((elf_kind(ielf) != ELF_K_ELF) || ((iehdr = elf_getehdr(ielf)) == NULL) || ((iehdr->e_type != ET_EXEC) && (iehdr->e_type != ET_DYN))) { - eprintf(ERR_FATAL, MSG_INTL(MSG_IMG_ELF), ipath); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_IMG_ELF), ipath); cleanup(ielf, oelf, melf, icache, mcache, 0, 0); return (1); } @@ -251,13 +252,13 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) */ if ((fd = open(opath, (O_RDWR | O_CREAT | O_TRUNC), 0777)) == -1) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), opath, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), opath, strerror(err)); cleanup(ielf, oelf, melf, icache, mcache, 0, 0); return (1); } if ((oelf = elf_begin(fd, ELF_C_WRITE, NULL)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_BEGIN), opath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_BEGIN), opath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } @@ -268,7 +269,7 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) * heap section size. */ if ((iphdr = elf_getphdr(ielf)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETPHDR), ipath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETPHDR), ipath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } @@ -300,7 +301,7 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) * segment, and would therefore have the wrong permissions). */ if (status && !data_phdr) { - eprintf(ERR_WARNING, MSG_INTL(MSG_IMG_DATASEG), ipath); + eprintf(lml, ERR_WARNING, MSG_INTL(MSG_IMG_DATASEG), ipath); status = 0; } @@ -308,12 +309,12 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) * Obtain the input files section header string table. */ if ((scn = elf_getscn(ielf, iehdr->e_shstrndx)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETSCN), ipath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETSCN), ipath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } if ((data = elf_getdata(scn, NULL)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETDATA), ipath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETDATA), ipath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } @@ -345,13 +346,13 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) for (scn = 0; scn = elf_nextscn(ielf, scn); _icache++) { if ((_icache->c_shdr = shdr = elf_getshdr(scn)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETSHDR), ipath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETSHDR), ipath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } if ((_icache->c_data = elf_getdata(scn, NULL)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETDATA), ipath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETDATA), ipath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } @@ -474,7 +475,7 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) * and disable the heap addition. */ if (!data_cache) { - eprintf(ERR_WARNING, MSG_INTL(MSG_IMG_DATASEC), ipath); + eprintf(lml, ERR_WARNING, MSG_INTL(MSG_IMG_DATASEC), ipath); status = 0; endx = 0; } @@ -503,7 +504,7 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) * that isn't calculated as part of elf_update(). */ if ((oehdr = elf_newehdr(oelf)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_NEWEHDR), opath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_NEWEHDR), opath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } @@ -520,7 +521,7 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) * and the data segments size to reflect any new heap section. */ if ((ophdr = elf_newphdr(oelf, iehdr->e_phnum)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_NEWPHDR), opath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_NEWPHDR), opath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } @@ -561,12 +562,12 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) * Create a matching section header in the output file. */ if ((scn = elf_newscn(oelf)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_NEWSCN), opath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_NEWSCN), opath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } if ((shdr = elf_getshdr(scn)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_NEWSHDR), opath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_NEWSHDR), opath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } @@ -586,7 +587,7 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) * Create a matching data buffer for this section. */ if ((data = elf_newdata(scn)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_NEWDATA), opath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_NEWDATA), opath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } @@ -696,17 +697,17 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) * allow us to write and update the new image. */ if (elf_update(oelf, ELF_C_WRIMAGE) == -1) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_UPDATE), opath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_UPDATE), opath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } if ((melf = elf_begin(0, ELF_C_IMAGE, oelf)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_BEGIN), opath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_BEGIN), opath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } if ((mehdr = elf_getehdr(melf)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETEHDR), opath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETEHDR), opath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } @@ -724,13 +725,13 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) for (scn = 0; scn = elf_nextscn(melf, scn); _mcache++) { if ((_mcache->c_shdr = elf_getshdr(scn)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETSHDR), opath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETSHDR), opath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } if ((_mcache->c_data = elf_getdata(scn, NULL)) == NULL) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_GETDATA), opath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_GETDATA), opath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } @@ -817,7 +818,7 @@ rt_dldump(Rt_map *lmp, const char *opath, int flags, Addr addr) * Having completed all section updates write the memory file out. */ if (elf_update(oelf, ELF_C_WRITE) == -1) { - eprintf(ERR_ELF, MSG_ORIG(MSG_ELF_UPDATE), opath); + eprintf(lml, ERR_ELF, MSG_ORIG(MSG_ELF_UPDATE), opath); cleanup(ielf, oelf, melf, icache, mcache, fd, opath); return (1); } diff --git a/usr/src/cmd/sgs/librtld/common/dynamic.c b/usr/src/cmd/sgs/librtld/common/dynamic.c index 06a98118b3..1fc6d5bc6f 100644 --- a/usr/src/cmd/sgs/librtld/common/dynamic.c +++ b/usr/src/cmd/sgs/librtld/common/dynamic.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Update any dynamic entry offsets. One issue with dynamic entries is that @@ -38,13 +38,13 @@ #include "_librtld.h" int -update_dynamic(Cache * cache, Cache * _cache, Rt_map * lmp, int flags, +update_dynamic(Cache *cache, Cache *_cache, Rt_map *lmp, int flags, Addr addr, Off off, const char *file, Xword null, Xword data, Xword func, Xword entsize, Xword checksum) { - Dyn * dyn = (Dyn *)_cache->c_data->d_buf, * posdyn = 0; + Dyn *dyn = (Dyn *)_cache->c_data->d_buf, *posdyn = 0; const char *strs; - Cache * __cache; + Cache *__cache; /* * If we're dealing with an object that might have bound to an external @@ -62,7 +62,7 @@ update_dynamic(Cache * cache, Cache * _cache, Rt_map * lmp, int flags, switch ((Xword)dyn->d_tag) { case DT_NEEDED: if (posdyn) { - Rt_map * dlmp; + Rt_map *dlmp; /* * Determine whether this dependency has been @@ -256,7 +256,8 @@ update_dynamic(Cache * cache, Cache * _cache, Rt_map * lmp, int flags, } break; } - eprintf(ERR_WARNING, MSG_INTL(MSG_DT_UNKNOWN), file, + eprintf(LIST(lmp), ERR_WARNING, + MSG_INTL(MSG_DT_UNKNOWN), file, EC_XWORD(dyn->d_tag)); return (1); } diff --git a/usr/src/cmd/sgs/libelf/spec/amd64/Makefile b/usr/src/cmd/sgs/librtld/common/mapfile-32-vers index 8620a77b67..8fc21079ce 100644 --- a/usr/src/cmd/sgs/libelf/spec/amd64/Makefile +++ b/usr/src/cmd/sgs/librtld/common/mapfile-32-vers @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,27 +18,16 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -.KEEP_STATE: - -include ../Makefile.targ - -# Add arch specific objects here -OBJECTS += - -include $(SRC)/lib/Makefile.lib -include $(SRC)/lib/Makefile.lib.64 - -# Uncomment the following if the linker complains -#amd64_C_PICFLAGS = -K PIC - -include $(SRC)/lib/Makefile.spec -ABILLIBC= - -install: $(ROOTABILIB64) +{ + global: + do32_reloc = FUNCTION parent; + reloc32_table = DATA parent; +}; diff --git a/usr/src/cmd/sgs/librtld/common/mapfile-64-vers b/usr/src/cmd/sgs/librtld/common/mapfile-64-vers new file mode 100644 index 0000000000..88a09d216c --- /dev/null +++ b/usr/src/cmd/sgs/librtld/common/mapfile-64-vers @@ -0,0 +1,33 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +{ + global: + do64_reloc = FUNCTION parent; + reloc64_table = DATA parent; +}; diff --git a/usr/src/cmd/sgs/librtld/common/mapfile-vers b/usr/src/cmd/sgs/librtld/common/mapfile-vers index c7808fc779..eb93fa1d36 100644 --- a/usr/src/cmd/sgs/librtld/common/mapfile-vers +++ b/usr/src/cmd/sgs/librtld/common/mapfile-vers @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ # # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -34,13 +33,11 @@ SUNWprivate_1.3 { { global: - do_reloc = FUNCTION parent; elf_plt_write = FUNCTION parent; eprintf = FUNCTION parent; is_so_loaded = FUNCTION parent; lookup_sym = FUNCTION parent; - reloc_table = DATA parent; lml_main = DATA parent; local: *; diff --git a/usr/src/cmd/sgs/librtld/i386/Makefile b/usr/src/cmd/sgs/librtld/i386/Makefile index 821b5539a5..d0972f0319 100644 --- a/usr/src/cmd/sgs/librtld/i386/Makefile +++ b/usr/src/cmd/sgs/librtld/i386/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 1998-2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -28,7 +28,8 @@ include $(SRC)/cmd/sgs/librtld/Makefile.com -CPPFLAGS += -I../../../../uts/intel/ia32/krtld +CPPFLAGS += -I../../../../uts/intel/ia32/krtld +MAPFILES += ../common/mapfile-32-vers .KEEP_STATE: diff --git a/usr/src/cmd/sgs/librtld/i386/_relocate.c b/usr/src/cmd/sgs/librtld/i386/_relocate.c index c98d7d7f5c..ebf603b088 100644 --- a/usr/src/cmd/sgs/librtld/i386/_relocate.c +++ b/usr/src/cmd/sgs/librtld/i386/_relocate.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 2000-2001 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -31,21 +31,19 @@ #include "_librtld.h" #include "_elf.h" - /* * Undo relocations that have been applied to a memory image. Basically this * involves copying the original files relocation offset into the new image * being created. */ void -undo_reloc(void *vrel, unsigned char *oaddr, unsigned char *iaddr, - Reloc *reloc) +undo_reloc(void *vrel, uchar_t *oaddr, uchar_t *iaddr, Reloc *reloc) { - Rel *rel = vrel; + Rel *rel = vrel; /* LINTED */ - unsigned long *_oaddr = (unsigned long *)oaddr; + ulong_t *_oaddr = (ulong_t *)oaddr; /* LINTED */ - unsigned long *_iaddr = (unsigned long *)iaddr; + ulong_t *_iaddr = (ulong_t *)iaddr; switch (ELF_R_TYPE(rel->r_info)) { case R_386_NONE: @@ -71,22 +69,21 @@ undo_reloc(void *vrel, unsigned char *oaddr, unsigned char *iaddr, } } - /* * Copy a relocation record and increment its value. The record must reflect * the new address to which this image is fixed. Note that .got entries * associated with .plt's must be fixed to the new base address. */ void -inc_reloc(void *vnrel, void *vorel, Reloc *reloc, unsigned char *oaddr, - unsigned char *iaddr) +inc_reloc(void *vnrel, void *vorel, Reloc *reloc, uchar_t *oaddr, + uchar_t *iaddr) { - Rel *nrel = vnrel; - Rel *orel = vorel; + Rel *nrel = vnrel; + Rel *orel = vorel; /* LINTED */ - unsigned long *_oaddr = (unsigned long *)oaddr; + ulong_t *_oaddr = (ulong_t *)oaddr; /* LINTED */ - unsigned long *_iaddr = (unsigned long *)iaddr; + ulong_t *_iaddr = (ulong_t *)iaddr; if (ELF_R_TYPE(nrel->r_info) == R_386_JMP_SLOT) { if (_iaddr) @@ -99,31 +96,29 @@ inc_reloc(void *vnrel, void *vorel, Reloc *reloc, unsigned char *oaddr, nrel->r_offset += reloc->r_value; } - /* * Clear a relocation record. The relocation has been applied to the image and * thus the relocation must not occur again. */ void -clear_reloc(void * vrel) +clear_reloc(void *vrel) { - Rel * rel = vrel; + Rel *rel = vrel; rel->r_offset = 0; rel->r_info = ELF_R_INFO(0, R_386_NONE); } - /* * Apply a relocation to an image being built from an input file. Use the * runtime linkers routines to do the necessary magic. */ void -apply_reloc(void *vrel, Reloc *reloc, const char *name, - unsigned char *oaddr, Rt_map *lmp) +apply_reloc(void *vrel, Reloc *reloc, const char *name, uchar_t *oaddr, + Rt_map *lmp) { Rel *rel = vrel; - Byte type = ELF_R_TYPE(rel->r_info); + Xword type = ELF_R_TYPE(rel->r_info); Word value = reloc->r_value; if (type == R_386_JMP_SLOT) { @@ -137,11 +132,12 @@ apply_reloc(void *vrel, Reloc *reloc, const char *name, /* LINTED */ elf_plt_write((uintptr_t)addr, vaddr, rel, (uintptr_t)value, reloc->r_pltndx); + } else if (type == R_386_COPY) { (void) memcpy((void *)oaddr, (void *)value, (size_t)reloc->r_size); - } else { - (void) do_reloc(type, oaddr, &value, reloc->r_name, name); + (void) do_reloc(type, oaddr, &value, reloc->r_name, name, + LIST(lmp)); } } diff --git a/usr/src/cmd/sgs/librtld/sparc/Makefile b/usr/src/cmd/sgs/librtld/sparc/Makefile index 6e3e857a83..5d07608807 100644 --- a/usr/src/cmd/sgs/librtld/sparc/Makefile +++ b/usr/src/cmd/sgs/librtld/sparc/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 1998-2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -28,7 +28,8 @@ include $(SRC)/cmd/sgs/librtld/Makefile.com -CPPFLAGS += -I../../../../uts/sparc/krtld +CPPFLAGS += -I../../../../uts/sparc/krtld +MAPFILES += ../common/mapfile-32-vers .KEEP_STATE: diff --git a/usr/src/cmd/sgs/librtld/sparc/_relocate.c b/usr/src/cmd/sgs/librtld/sparc/_relocate.c index cd6686d5dc..c93a6f17d1 100644 --- a/usr/src/cmd/sgs/librtld/sparc/_relocate.c +++ b/usr/src/cmd/sgs/librtld/sparc/_relocate.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 2000-2001 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -31,7 +31,6 @@ #include "_librtld.h" #include "_elf.h" - /* * Undo relocations that have been applied to a memory image. Basically this * involves copying the original files relocation offset into the new image @@ -39,14 +38,13 @@ */ /* ARGSUSED3 */ void -undo_reloc(void *vrel, unsigned char *oaddr, unsigned char *iaddr, - Reloc *reloc) +undo_reloc(void *vrel, uchar_t *oaddr, uchar_t *iaddr, Reloc *reloc) { Rela *rel = vrel; const Rel_entry *rep; - int rtype = ELF_R_TYPE(rel->r_info); - unsigned long *_oaddr; - unsigned long *_iaddr; + Xword rtype = ELF_R_TYPE(rel->r_info); + ulong_t *_oaddr; + ulong_t *_iaddr; switch (rtype) { case R_SPARC_NONE: @@ -72,23 +70,21 @@ undo_reloc(void *vrel, unsigned char *oaddr, unsigned char *iaddr, break; default: rep = &reloc_table[rtype]; - if (_iaddr) + if (iaddr) (void) memcpy(oaddr, iaddr, rep->re_fsize); else (void) memset(oaddr, 0, rep->re_fsize); - break; } } - /* * Copy a relocation record and increment its value. The record must reflect * the new address to which this image is fixed. */ /* ARGSUSED3 */ void -inc_reloc(void *vnrel, void *vorel, Reloc *reloc, unsigned char *oaddr, - unsigned char *iaddr) +inc_reloc(void *vnrel, void *vorel, Reloc *reloc, uchar_t *oaddr, + uchar_t *iaddr) { Rela *nrel = vnrel; Rela *orel = vorel; @@ -97,7 +93,6 @@ inc_reloc(void *vnrel, void *vorel, Reloc *reloc, unsigned char *oaddr, nrel->r_offset += reloc->r_value; } - /* * Clear a relocation record. The relocation has been applied to the image and * thus the relocation must not occur again. @@ -112,18 +107,17 @@ clear_reloc(void *vrel) rel->r_addend = 0; } - /* * Apply a relocation to an image being built from an input file. Use the * runtime linkers routines to do the necessary magic. */ void -apply_reloc(void *vrel, Reloc *reloc, const char *name, - unsigned char *oaddr, Rt_map *lmp) +apply_reloc(void *vrel, Reloc *reloc, const char *name, uchar_t *oaddr, + Rt_map *lmp) { - Rela *rel = vrel; - Byte type = (Byte)ELF_R_TYPE(rel->r_info); - Xword value = reloc->r_value + rel->r_addend; + Rela *rel = vrel; + Xword type = ELF_R_TYPE(rel->r_info); + Xword value = reloc->r_value + rel->r_addend; if (type == R_SPARC_JMP_SLOT) { uintptr_t addr, vaddr; @@ -137,11 +131,14 @@ apply_reloc(void *vrel, Reloc *reloc, const char *name, /* LINTED */ elf_plt_write((uintptr_t)addr, vaddr, rel, (uintptr_t)value, reloc->r_pltndx); + } else if (type == R_SPARC_COPY) { (void) memcpy((void *)oaddr, (void *)value, (size_t)reloc->r_size); - } else { - (void) do_reloc(type, oaddr, &value, reloc->r_name, name); + if (IS_EXTOFFSET(type)) + value += ELF_R_TYPE_DATA(rel->r_info); + (void) do_reloc(type, oaddr, &value, reloc->r_name, name, + LIST(lmp)); } } diff --git a/usr/src/cmd/sgs/librtld/sparcv9/Makefile b/usr/src/cmd/sgs/librtld/sparcv9/Makefile index b1b4997442..eba63918c2 100644 --- a/usr/src/cmd/sgs/librtld/sparcv9/Makefile +++ b/usr/src/cmd/sgs/librtld/sparcv9/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,16 +18,18 @@ # # CDDL HEADER END # + # -# Copyright 1998-2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # include $(SRC)/cmd/sgs/librtld/Makefile.com -CPPFLAGS += -I../../../../uts/sparc/krtld +CPPFLAGS += -I../../../../uts/sparc/krtld +MAPFILES += ../common/mapfile-64-vers .KEEP_STATE: @@ -51,6 +52,3 @@ include ../../Makefile.sub.64 CONVLIBDIR = $(CONVLIBDIR64) ELFLIBDIR = $(ELFLIBDIR64) - - - diff --git a/usr/src/cmd/sgs/librtld/sparcv9/_relocate.c b/usr/src/cmd/sgs/librtld/sparcv9/_relocate.c index 7a564f3e59..c93a6f17d1 100644 --- a/usr/src/cmd/sgs/librtld/sparcv9/_relocate.c +++ b/usr/src/cmd/sgs/librtld/sparcv9/_relocate.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,21 +18,19 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 2000-2001 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <string.h> -#include <stdio.h> #include "machdep.h" #include "reloc.h" #include "_librtld.h" #include "_elf.h" - - /* * Undo relocations that have been applied to a memory image. Basically this * involves copying the original files relocation offset into the new image @@ -41,15 +38,13 @@ */ /* ARGSUSED3 */ void -undo_reloc(void *vrel, unsigned char *oaddr, unsigned char *iaddr, - Reloc *reloc) +undo_reloc(void *vrel, uchar_t *oaddr, uchar_t *iaddr, Reloc *reloc) { Rela *rel = vrel; const Rel_entry *rep; - /* LINTED */ - int rtype = (int)ELF_R_TYPE(rel->r_info); - unsigned long *_oaddr; - unsigned long *_iaddr; + Xword rtype = ELF_R_TYPE(rel->r_info); + ulong_t *_oaddr; + ulong_t *_iaddr; switch (rtype) { case R_SPARC_NONE: @@ -62,6 +57,7 @@ undo_reloc(void *vrel, unsigned char *oaddr, unsigned char *iaddr, _oaddr = (unsigned long *)oaddr; /* LINTED */ _iaddr = (unsigned long *)iaddr; + if (_iaddr) { *_oaddr++ = *_iaddr++; *_oaddr++ = *_iaddr++; @@ -81,15 +77,14 @@ undo_reloc(void *vrel, unsigned char *oaddr, unsigned char *iaddr, } } - /* * Copy a relocation record and increment its value. The record must reflect * the new address to which this image is fixed. */ /* ARGSUSED3 */ void -inc_reloc(void *vnrel, void *vorel, Reloc *reloc, unsigned char *oaddr, - unsigned char *iaddr) +inc_reloc(void *vnrel, void *vorel, Reloc *reloc, uchar_t *oaddr, + uchar_t *iaddr) { Rela *nrel = vnrel; Rela *orel = vorel; @@ -98,7 +93,6 @@ inc_reloc(void *vnrel, void *vorel, Reloc *reloc, unsigned char *oaddr, nrel->r_offset += reloc->r_value; } - /* * Clear a relocation record. The relocation has been applied to the image and * thus the relocation must not occur again. @@ -113,18 +107,16 @@ clear_reloc(void *vrel) rel->r_addend = 0; } - /* * Apply a relocation to an image being built from an input file. Use the * runtime linkers routines to do the necessary magic. */ void -apply_reloc(void *vrel, Reloc *reloc, const char *name, - unsigned char *oaddr, Rt_map *lmp) +apply_reloc(void *vrel, Reloc *reloc, const char *name, uchar_t *oaddr, + Rt_map *lmp) { Rela *rel = vrel; - /* LINTED */ - Byte type = (Byte)ELF_R_TYPE(rel->r_info); + Xword type = ELF_R_TYPE(rel->r_info); Xword value = reloc->r_value + rel->r_addend; if (type == R_SPARC_JMP_SLOT) { @@ -143,10 +135,10 @@ apply_reloc(void *vrel, Reloc *reloc, const char *name, } else if (type == R_SPARC_COPY) { (void) memcpy((void *)oaddr, (void *)value, (size_t)reloc->r_size); - } else { if (IS_EXTOFFSET(type)) value += ELF_R_TYPE_DATA(rel->r_info); - (void) do_reloc(type, oaddr, &value, reloc->r_name, name); + (void) do_reloc(type, oaddr, &value, reloc->r_name, name, + LIST(lmp)); } } diff --git a/usr/src/cmd/sgs/librtld_db/Makefile.com b/usr/src/cmd/sgs/librtld_db/Makefile.com index 199dbc1959..973a04bb80 100644 --- a/usr/src/cmd/sgs/librtld_db/Makefile.com +++ b/usr/src/cmd/sgs/librtld_db/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -40,11 +40,10 @@ include $(SRC)/cmd/sgs/Makefile.com MAPFILE= ../common/mapfile-vers DYNFLAGS += -M$(MAPFILE) $(VERSREF) -LDLIBS += $(CONVLIBDIR) -lconv -lc - -LINTFLAGS += -u -LINTFLAGS64 += -u +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) -lc +LINTFLAGS += -u -erroff=E_NAME_DECL_NOT_USED_DEF2 +LINTFLAGS64 += -u -erroff=E_NAME_DECL_NOT_USED_DEF2 BLTDEFS= msg.h BLTDATA= msg.c @@ -53,14 +52,13 @@ BLTFILES= $(BLTDEFS) $(BLTDATA) SGSMSGCOM= ../common/librtld_db.msg SGSMSGINTEL= ../common/librtld_db.intel.msg -SGSMSGSPARC= ../common/librtld_db.sparc.msg +SGSMSGSPARCV9= ../common/librtld_db.sparcv9.msg SGSMSGTARG= $(SGSMSGCOM) SGSMSGALL= $(SGSMSGCOM) SGSMSGFLAGS += -h $(BLTDEFS) -d $(BLTDATA) SRCS= ../common/llib-lrtld_db -LINTSRCS= $(COMOBJS:%.o=../common/%.c) $(PLTSRCS) \ - $(BLTDATA) ../common/lintsup.c +LINTSRCS= $(COMOBJS:%.o=../common/%.c) $(PLTSRCS) $(BLTDATA) CLEANFILES += $(BLTFILES) $(LINTOUTS) CLOBBERFILES += $(DYNLIB) $(LINTLIB) diff --git a/usr/src/cmd/sgs/librtld_db/Makefile.targ b/usr/src/cmd/sgs/librtld_db/Makefile.targ index 4e61597d8c..6dbbe262a7 100644 --- a/usr/src/cmd/sgs/librtld_db/Makefile.targ +++ b/usr/src/cmd/sgs/librtld_db/Makefile.targ @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,15 +18,14 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -lint: $(LINTLIB) $(LINTOUT32) $(SGSLINTOUT) - pics/%.o: ../common/%.c $(COMPILE.c) -o $@ $< $(POST_PROCESS_O) diff --git a/usr/src/cmd/sgs/librtld_db/amd64/Makefile b/usr/src/cmd/sgs/librtld_db/amd64/Makefile index a0c4cfa589..598eee444b 100644 --- a/usr/src/cmd/sgs/librtld_db/amd64/Makefile +++ b/usr/src/cmd/sgs/librtld_db/amd64/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,16 +18,17 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # -COMOBJS64= rd_elf64.o -PLTOBJS= plt32_resolution.o plt64_resolution.o -PLTSRCS= ../i386/plt32_resolution.c plt64_resolution.c +COMOBJS64 = rd_elf64.o +PLTOBJS = plt32_resolution.o plt64_resolution.o +PLTSRCS = ../i386/plt32_resolution.c plt64_resolution.c include ../Makefile.com @@ -36,18 +36,21 @@ SGSMSGTARG += $(SGSMSGINTEL) LINTFLAGS64 += $(VAR_LINTFLAGS64) CPPFLAGS += -D_SYSCALL32 -CONVLIBDIR= $(CONVLIBDIR64) +CONVLIBDIR = $(CONVLIBDIR64) .KEEP_STATE: all: $(DYNLIB) $(LINTLIB) + install: all $(ROOTFS_DYNLIB64) $(ROOTFS_LINKS64) \ $(ROOTFS_LIBDIR64)/$(LINTLIB) -lint: $(LINTOUT64) pics/plt32_resolution.o: ../i386/plt32_resolution.c - $(COMPILE.c) -D_ELF32 $(PICFLAGS) -o $@ ../i386/plt32_resolution.c - $(POST_PROCESS_O) + $(COMPILE.c) -D_ELF32 $(PICFLAGS) -o $@ \ + ../i386/plt32_resolution.c + $(POST_PROCESS_O) + +lint: $(LINTLIB) $(LINTOUT32) $(LINTOUT64) $(SGSLINTOUT) include ../Makefile.targ include ../../Makefile.sub.64 diff --git a/usr/src/cmd/sgs/librtld_db/amd64/plt64_resolution.c b/usr/src/cmd/sgs/librtld_db/amd64/plt64_resolution.c index f6d8592a49..86a80c1f47 100644 --- a/usr/src/cmd/sgs/librtld_db/amd64/plt64_resolution.c +++ b/usr/src/cmd/sgs/librtld_db/amd64/plt64_resolution.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -54,7 +54,6 @@ plt64_resolution(rd_agent_t *rap, psaddr_t pc, lwpid_t lwpid, uint32_t pcrel; psaddr_t destaddr; psaddr_t pltoff, pltaddr; - prgregset_t gr; if (rtld_db_version >= RD_VERSION3) { diff --git a/usr/src/cmd/sgs/librtld_db/common/_rtld_db.h b/usr/src/cmd/sgs/librtld_db/common/_rtld_db.h index 198d6a3605..a3a3b8e31a 100644 --- a/usr/src/cmd/sgs/librtld_db/common/_rtld_db.h +++ b/usr/src/cmd/sgs/librtld_db/common/_rtld_db.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -80,7 +80,7 @@ extern rd_err_e _rd_event_getmsg32(rd_agent_t *, rd_event_msg_t *); extern rd_err_e _rd_objpad_enable32(struct rd_agent *, size_t); extern rd_err_e _rd_loadobj_iter32(rd_agent_t *, rl_iter_f *, void *); extern rd_err_e find_dynamic_ent32(struct rd_agent *, psaddr_t, - Xword, Elf32_Dyn *); + Xword, Dyn *); extern rd_err_e plt32_resolution(rd_agent_t *, psaddr_t, lwpid_t, psaddr_t, rd_plt_info_t *); diff --git a/usr/src/cmd/sgs/librtld_db/common/librtld_db.intel.msg b/usr/src/cmd/sgs/librtld_db/common/librtld_db.intel.msg index acdf0364bf..b520a8622a 100644 --- a/usr/src/cmd/sgs/librtld_db/common/librtld_db.intel.msg +++ b/usr/src/cmd/sgs/librtld_db/common/librtld_db.intel.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,12 +18,17 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# # ident "%Z%%M% %I% %E% SMI" # Message file for cmd/sgs/librtld_db - intel specific. @ _END_ -@ MSG_DB_READFAIL_X86_1 "rtld_db: rlif: read of 0x%llx failed\n" -@ MSG_DB_NODYN_X86 "rtld_db: rlif: no PT_DYNAMIC found\n" -@ MSG_DB_NOGOT_X86 "rtld_db: rpr: unable to resolve GOT addr\n" +@ MSG_DB_READFAIL_X86_1 "rtld_db: rlif: read of 0x%llx failed" +@ MSG_DB_NODYN_X86 "rtld_db: rlif: no PT_DYNAMIC found" +@ MSG_DB_NOGOT_X86 "rtld_db: rpr: unable to resolve GOT addr" diff --git a/usr/src/cmd/sgs/librtld_db/common/librtld_db.msg b/usr/src/cmd/sgs/librtld_db/common/librtld_db.msg index a44bd7b37b..6eb9c534e3 100644 --- a/usr/src/cmd/sgs/librtld_db/common/librtld_db.msg +++ b/usr/src/cmd/sgs/librtld_db/common/librtld_db.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,13 +18,17 @@ # # CDDL HEADER END # -#pragma ident "%Z%%M% %I% %E% SMI" + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" # Message file for cmd/sgs/librtld_db. @ MSG_ID_LIBRTLD_DB - # There presently seem little point in internationalizing these messages # as they provide debugging information for dbx developers and shouldn't # be see by anyone else. diff --git a/usr/src/cmd/sgs/librtld_db/common/librtld_db.sparc.msg b/usr/src/cmd/sgs/librtld_db/common/librtld_db.sparcv9.msg index dc35c1b15a..c2a8f1cf65 100644 --- a/usr/src/cmd/sgs/librtld_db/common/librtld_db.sparc.msg +++ b/usr/src/cmd/sgs/librtld_db/common/librtld_db.sparcv9.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,12 +18,16 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# # ident "%Z%%M% %I% %E% SMI" -# Message file for cmd/sgs/librtld_db - SPARC specific. +# Message file for cmd/sgs/librtld_db - SPARCV9 specific. @ _END_ - @ MSG_DB_BADFPLT "rtld_db: rpr: bad plt instruction found: \ addr: 0x%llx instr:0x%llx" diff --git a/usr/src/cmd/sgs/librtld_db/i386/Makefile b/usr/src/cmd/sgs/librtld_db/i386/Makefile index 6951866554..86efe4257f 100644 --- a/usr/src/cmd/sgs/librtld_db/i386/Makefile +++ b/usr/src/cmd/sgs/librtld_db/i386/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,14 +18,16 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" +# -PLTOBJS = plt32_resolution.o -PLTSRCS = plt32_resolution.c +PLTOBJS = plt32_resolution.o +PLTSRCS = plt32_resolution.c include ../Makefile.com @@ -39,4 +40,6 @@ all: $(DYNLIB) $(LINTLIB) install: all $(ROOTFS_DYNLIB) $(ROOTFS_LINKS) \ $(ROOTFS_LIBDIR)/$(LINTLIB) $(ROOTFS_LIBDIR)/$(LINTLIBSRC) +lint: $(LINTLIB) $(LINTOUT32) $(SGSLINTOUT) + include ../Makefile.targ diff --git a/usr/src/cmd/sgs/librtld_db/rdb_demo/common/callstack.c b/usr/src/cmd/sgs/librtld_db/rdb_demo/common/callstack.c index 134169d16f..12b5ed1927 100644 --- a/usr/src/cmd/sgs/librtld_db/rdb_demo/common/callstack.c +++ b/usr/src/cmd/sgs/librtld_db/rdb_demo/common/callstack.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <unistd.h> #include <string.h> @@ -51,7 +50,6 @@ #define STACK_BIAS 0 #endif - static int get_frame(struct ps_prochandle *ph, psaddr_t fp, struct frame *frm) { @@ -72,10 +70,9 @@ get_frame(struct ps_prochandle *ph, psaddr_t fp, struct frame *frm) frm->fr_savpc = (long)frm32.fr_savpc; #if defined(__sparcv9) - frm->fr_savfp = (struct frame *)frm32.fr_savfp; + frm->fr_savfp = (struct frame *)(uintptr_t)frm32.fr_savfp; #elif defined(__amd64) frm->fr_savfp = (long)frm32.fr_savfp; -#else #endif return (0); } @@ -89,10 +86,8 @@ get_frame(struct ps_prochandle *ph, psaddr_t fp, struct frame *frm) return (0); } - /* - * Relatively architecture neutral routine to display - * the callstack. + * Relatively architecture neutral routine to display the callstack. */ void CallStack(struct ps_prochandle *ph) diff --git a/usr/src/cmd/sgs/librtld_db/sparc/Makefile b/usr/src/cmd/sgs/librtld_db/sparc/Makefile index ab9afee552..a9d2dde2a3 100644 --- a/usr/src/cmd/sgs/librtld_db/sparc/Makefile +++ b/usr/src/cmd/sgs/librtld_db/sparc/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,11 +18,13 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" +# PLTOBJS = plt32_resolution.o PLTSRCS = plt32_resolution.c @@ -33,7 +34,10 @@ include ../Makefile.com .KEEP_STATE: all: $(DYNLIB) $(LINTLIB) + install: all $(ROOTFS_DYNLIB) $(ROOTFS_LINKS) \ $(ROOTFS_LIBDIR)/$(LINTLIB) $(ROOTFS_LIBDIR)/$(LINTLIBSRC) +lint: $(LINTLIB) $(LINTOUT32) $(SGSLINTOUT) + include ../Makefile.targ diff --git a/usr/src/cmd/sgs/librtld_db/sparcv9/Makefile b/usr/src/cmd/sgs/librtld_db/sparcv9/Makefile index 7662487de2..001502facb 100644 --- a/usr/src/cmd/sgs/librtld_db/sparcv9/Makefile +++ b/usr/src/cmd/sgs/librtld_db/sparcv9/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,34 +18,39 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" +# -COMOBJS64= rd_elf64.o -PLTOBJS= plt32_resolution.o plt64_resolution.o -PLTSRCS= ../sparc/plt32_resolution.c plt64_resolution.c +COMOBJS64 = rd_elf64.o +PLTOBJS = plt32_resolution.o plt64_resolution.o +PLTSRCS = ../sparc/plt32_resolution.c plt64_resolution.c include ../Makefile.com -SGSMSGTARG += $(SGSMSGSPARC) +SGSMSGTARG += $(SGSMSGSPARCV9) LINTFLAGS64 += $(VAR_LINTFLAGS64) CPPFLAGS += -D_SYSCALL32 -CONVLIBDIR= $(CONVLIBDIR64) +CONVLIBDIR = $(CONVLIBDIR64) .KEEP_STATE: all: $(DYNLIB) $(LINTLIB) + install: all $(ROOTFS_DYNLIB64) $(ROOTFS_LINKS64) \ $(ROOTFS_LIBDIR64)/$(LINTLIB) -lint: $(LINTOUT64) pics/plt32_resolution.o: ../sparc/plt32_resolution.c - $(COMPILE.c) -D_ELF32 $(PICFLAGS) -o $@ ../sparc/plt32_resolution.c - $(POST_PROCESS_O) + $(COMPILE.c) -D_ELF32 $(PICFLAGS) -o $@ \ + ../sparc/plt32_resolution.c + $(POST_PROCESS_O) + +lint: $(LINTLIB) $(LINTOUT32) $(LINTOUT64) $(SGSLINTOUT) include ../Makefile.targ include ../../Makefile.sub.64 diff --git a/usr/src/cmd/sgs/link_audit/Makefile.com b/usr/src/cmd/sgs/link_audit/Makefile.com index 8daa0163cc..b47b460b54 100644 --- a/usr/src/cmd/sgs/link_audit/Makefile.com +++ b/usr/src/cmd/sgs/link_audit/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -68,8 +68,8 @@ BINDPICS= $(BINDSRC:%.c=$(PICDIR)/%.o) $(PICDIR)/env.o $(WHOPICS):= SEMANTICCHK= +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) -LDLIBS += $(CONVLIBDIR) -lconv # Building SUNWonld results in a call to the `package' target. Requirements # needed to run this application on older releases are established: # dlopen/dlclose requires libdl.so.1 prior to 5.10 diff --git a/usr/src/cmd/sgs/link_audit/amd64/Makefile b/usr/src/cmd/sgs/link_audit/amd64/Makefile index 4e9bbca7d8..2a7a9950c4 100644 --- a/usr/src/cmd/sgs/link_audit/amd64/Makefile +++ b/usr/src/cmd/sgs/link_audit/amd64/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -28,11 +28,13 @@ include ../Makefile.com -CONVLIBDIR= $(CONVLIBDIR64) -ELFLIBDIR= $(ELFLIBDIR64) +CONVLIBDIR = $(CONVLIBDIR64) +ELFLIBDIR = $(ELFLIBDIR64) + +lint := CONV_LIB = $(CONV_LIB64) $(ONLIBS) \ -$(CCSLIBS):= CFLAGS64 += $(C_PICFLAGS64) $(NO_ASM_WARN) +$(CCSLIBS) := CFLAGS64 += $(C_PICFLAGS64) $(NO_ASM_WARN) LINTFLAGS64 += $(VAR_LINTFLAGS64) diff --git a/usr/src/cmd/sgs/link_audit/i386/Makefile b/usr/src/cmd/sgs/link_audit/i386/Makefile index 48bddda040..107de46013 100644 --- a/usr/src/cmd/sgs/link_audit/i386/Makefile +++ b/usr/src/cmd/sgs/link_audit/i386/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,17 +18,20 @@ # # CDDL HEADER END # + # -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# ident "%Z%%M% %I% %E% SMI" +# include ../Makefile.com +lint := CONV_LIB = $(CONV_LIB32) + $(ONLIBS) \ -$(CCSLIBS):= CFLAGS += $(C_PICFLAGS) $(NO_ASM_WARN) +$(CCSLIBS) := CFLAGS += $(C_PICFLAGS) $(NO_ASM_WARN) .KEEP_STATE: diff --git a/usr/src/cmd/sgs/link_audit/sparc/Makefile b/usr/src/cmd/sgs/link_audit/sparc/Makefile index 48bddda040..107de46013 100644 --- a/usr/src/cmd/sgs/link_audit/sparc/Makefile +++ b/usr/src/cmd/sgs/link_audit/sparc/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,17 +18,20 @@ # # CDDL HEADER END # + # -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# ident "%Z%%M% %I% %E% SMI" +# include ../Makefile.com +lint := CONV_LIB = $(CONV_LIB32) + $(ONLIBS) \ -$(CCSLIBS):= CFLAGS += $(C_PICFLAGS) $(NO_ASM_WARN) +$(CCSLIBS) := CFLAGS += $(C_PICFLAGS) $(NO_ASM_WARN) .KEEP_STATE: diff --git a/usr/src/cmd/sgs/link_audit/sparcv9/Makefile b/usr/src/cmd/sgs/link_audit/sparcv9/Makefile index 4e9bbca7d8..2a7a9950c4 100644 --- a/usr/src/cmd/sgs/link_audit/sparcv9/Makefile +++ b/usr/src/cmd/sgs/link_audit/sparcv9/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -28,11 +28,13 @@ include ../Makefile.com -CONVLIBDIR= $(CONVLIBDIR64) -ELFLIBDIR= $(ELFLIBDIR64) +CONVLIBDIR = $(CONVLIBDIR64) +ELFLIBDIR = $(ELFLIBDIR64) + +lint := CONV_LIB = $(CONV_LIB64) $(ONLIBS) \ -$(CCSLIBS):= CFLAGS64 += $(C_PICFLAGS64) $(NO_ASM_WARN) +$(CCSLIBS) := CFLAGS64 += $(C_PICFLAGS64) $(NO_ASM_WARN) LINTFLAGS64 += $(VAR_LINTFLAGS64) diff --git a/usr/src/cmd/sgs/mcs/Makefile.com b/usr/src/cmd/sgs/mcs/Makefile.com index ad4bad7f36..8ba93d5404 100644 --- a/usr/src/cmd/sgs/mcs/Makefile.com +++ b/usr/src/cmd/sgs/mcs/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -43,11 +43,12 @@ OBJS= main.o file.o utils.o global.o \ LLDFLAGS = '-R$$ORIGIN/../../lib' LLDFLAGS64 = '-R$$ORIGIN/../../../lib/$(MACH64)' LDFLAGS += $(VERSREF) $(LLDFLAGS) -LDLIBS += $(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) $(ELFLIBDIR) -lelf -LINTFLAGS += -x $(LDLIBS) -LINTFLAGS64 += -x $(LDLIBS) +LINTFLAGS += -x +LINTFLAGS64 += -x -SRCS= $(OBJS:%.o=../common/%.c) +SRCS = $(OBJS:%.o=../common/%.c) +LINTSRCS = $(SRCS) -CLEANFILES += $(OBJS) $(LINTOUT) +CLEANFILES += $(OBJS) $(LINTOUTS) diff --git a/usr/src/cmd/sgs/mcs/Makefile.targ b/usr/src/cmd/sgs/mcs/Makefile.targ index d277651bcb..d81393ab30 100644 --- a/usr/src/cmd/sgs/mcs/Makefile.targ +++ b/usr/src/cmd/sgs/mcs/Makefile.targ @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,11 +18,13 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" # -# Copyright (c) 1998 by Sun Microsystems, Inc. -# All rights reserved. %.o: ../common/%.c $(COMPILE.c) $< @@ -40,7 +41,7 @@ delete: install \ package: all $(ROOTCCSBINPROG) $(ROOTLINKS) -lint: $(LINTOUT) +lint: $(LINTOUT32) $(SGSLINTOUT) $(PROG): $(OBJS) $(LINK.c) -o $@ $(OBJS) $(LDLIBS) @@ -50,10 +51,8 @@ $(ROOTLINKS): $(ROOTCCSBINPROG) $(RM) $@ $(LN) $(ROOTCCSBINPROG) $@ -$(LINTOUT): $(SRCS) - $(LINT.c) $(SRCS) > $(LINTOUT) 2>&1 - $(ROOTCCSBIN64)/%: % - $(INS.file) + $(INS.file) include $(SRC)/cmd/Makefile.targ +include $(SRC)/cmd/sgs/Makefile.targ diff --git a/usr/src/cmd/sgs/mcs/common/file.c b/usr/src/cmd/sgs/mcs/common/file.c index d7267aef26..77a1d0468a 100644 --- a/usr/src/cmd/sgs/mcs/common/file.c +++ b/usr/src/cmd/sgs/mcs/common/file.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -144,6 +143,8 @@ each_file(char *cur_file, Cmd_Info *cmd_info) while ((elf = elf_begin(fd, cmd, arf)) != 0) { if (ar_file) /* get header info */ { + size_t len; + if ((mem_header = elf_getarhdr(elf)) == NULL) { error_message(GETARHDR_ERROR, LIBelf_ERROR, elf_errmsg(-1), @@ -157,15 +158,18 @@ each_file(char *cur_file, Cmd_Info *cmd_info) if (cur_filenm != NULL) free(cur_filenm); - if ((cur_filenm = malloc((strlen(cur_file) + 3 + - strlen(mem_header->ar_name)))) == NULL) { + + len = (strlen(cur_file) + 3 + + strlen(mem_header->ar_name)); + + if ((cur_filenm = malloc(len)) == NULL) { error_message(MALLOC_ERROR, PLAIN_ERROR, (char *)0, prog); mcs_exit(FAILURE); } - (void) sprintf(cur_filenm, "%s[%s]", + (void) snprintf(cur_filenm, len, "%s[%s]", cur_file, mem_header->ar_name); } @@ -1550,7 +1554,8 @@ post_process(Cmd_Info *cmd_info) grpcnt = 0; grpdata = (Word *)(sinfo->data->d_buf); for (i = 1; i < num; i++) { - if (sec_table[grpdata[i]].secno != DELETED) + if (sec_table[grpdata[i]].secno != + (GElf_Word)DELETED) grpcnt++; } @@ -1618,7 +1623,7 @@ post_process(Cmd_Info *cmd_info) ngrpdata[0] = grpdata[0]; j = 1; for (i = 1; i < num; i++) { - if (sec_table[grpdata[i]].secno != -1) { + if (sec_table[grpdata[i]].secno != (GElf_Word)DELETED) { ngrpdata[j++] = sec_table[grpdata[i]].secno; } } diff --git a/usr/src/cmd/sgs/mcs/common/message.c b/usr/src/cmd/sgs/mcs/common/message.c index c85bd2bb4d..93b1852a27 100644 --- a/usr/src/cmd/sgs/mcs/common/message.c +++ b/usr/src/cmd/sgs/mcs/common/message.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,9 +22,8 @@ * Copyright(c) 1988 AT&T * All Rights Reserved * - * - * Copyright(c) 1995 by Sun Microsystems, Inc. - * All Rights Reserved + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include "mcs.h" @@ -111,6 +109,7 @@ error_message(int args, ...) case ELFVER_ERROR: case EXEC_AR_ERROR: case LIBELF_ERROR: + /* LINTED */ (void) fprintf(stderr, message, va_arg(ap, char *)); break; case OPEN_ERROR: @@ -138,24 +137,27 @@ error_message(int args, ...) case ACT_APPEND2_ERROR: case ACT_COMPRESS1_ERROR: case ACT_COMPRESS2_ERROR: { - char * a = va_arg(ap, char *); - char * b = va_arg(ap, char *); - char * c = va_arg(ap, char *); + char *a = va_arg(ap, char *); + char *b = va_arg(ap, char *); + char *c = va_arg(ap, char *); + /* LINTED */ (void) fprintf(stderr, message, a, b, c); break; } case ACT_DELETE2_ERROR: { - char * a = va_arg(ap, char *); - char * b = va_arg(ap, char *); - char * c = va_arg(ap, char *); - char * d = va_arg(ap, char *); + char *a = va_arg(ap, char *); + char *b = va_arg(ap, char *); + char *c = va_arg(ap, char *); + char *d = va_arg(ap, char *); + /* LINTED */ (void) fprintf(stderr, message, a, b, c, d); break; } case GETARHDR_ERROR: { - char * a = va_arg(ap, char *); - char * b = va_arg(ap, char *); + char *a = va_arg(ap, char *); + char *b = va_arg(ap, char *); long c = va_arg(ap, long); + /* LINTED */ (void) fprintf(stderr, message, a, b, c); break; } diff --git a/usr/src/cmd/sgs/moe/Makefile.com b/usr/src/cmd/sgs/moe/Makefile.com index 7c74ff5640..d4810e7fcf 100644 --- a/usr/src/cmd/sgs/moe/Makefile.com +++ b/usr/src/cmd/sgs/moe/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -38,8 +38,8 @@ OBJS= $(BLTOBJ) $(COMOBJ) MAPFILE= ../common/mapfile-vers -LDFLAGS += -Wl,$(VERSREF) -Yl,$(SGSPROTO) -M $(MAPFILE) -LDLIBS += $(CONVLIBDIR) -lconv +LDFLAGS += -Wl,$(VERSREF) $(USE_PROTO) -M $(MAPFILE) +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) LINTFLAGS += -x LINTFLAGS64 += -x diff --git a/usr/src/cmd/sgs/nm/common/nm.c b/usr/src/cmd/sgs/nm/common/nm.c index ce33c33aa0..76a27f6662 100644 --- a/usr/src/cmd/sgs/nm/common/nm.c +++ b/usr/src/cmd/sgs/nm/common/nm.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * Copyright (c) 1989 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -877,7 +876,7 @@ print_header(int class) int adj = 0; if (class == ELFCLASS64) - adj = 4; + adj = 11; /* * Print header line if needed. @@ -1067,7 +1066,7 @@ print_with_pflag( int adj = 0; if ((int)ehdr->e_ident[EI_CLASS] == ELFCLASS64) - adj = 4; + adj = 11; if (is_sym_print(sym_data) != 1) return; @@ -1179,7 +1178,7 @@ print_with_Pflag( int adj = 0; if ((int)ehdr->e_ident[EI_CLASS] == ELFCLASS64) - adj = 4; + adj = 11; if (is_sym_print(sym_data) != 1) return; @@ -1282,7 +1281,7 @@ print_with_otherflags( int adj = 0; if ((int)ehdr->e_ident[EI_CLASS] == ELFCLASS64) - adj = 4; + adj = 11; if (is_sym_print(sym_data) != 1) return; diff --git a/usr/src/cmd/sgs/packages/Makefile b/usr/src/cmd/sgs/packages/Makefile index 80940ddd0b..31ce31881e 100644 --- a/usr/src/cmd/sgs/packages/Makefile +++ b/usr/src/cmd/sgs/packages/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ # # CDDL HEADER END # + # -# ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# cmd/sgs/packages/Makefile +# ident "%Z%%M% %I% %E% SMI" +# include $(SRC)/Makefile.master include $(SRC)/cmd/sgs/Makefile.var @@ -135,9 +134,6 @@ package_dep_: FRC $(ROOT)/usr/include/rtld_db.h \ $(ROOT)/usr/include/link.h @ cd $(SRC)/lib/libproc; pwd; $(MAKE) install_h -$(VAR_SPEC_ON) @ cd $(SRC)/head; pwd; $(MAKE) \ -$(VAR_SPEC_ON) $(ROOT)/usr/include/apptrace.h \ -$(VAR_SPEC_ON) $(ROOT)/usr/include/apptrace_impl.h @ cd $(SRC)/uts/common/sys; pwd; $(MAKE) \ $(ROOT)/usr/include/sys/elf.h \ $(ROOT)/usr/include/sys/elf_386.h \ @@ -152,9 +148,8 @@ $(VAR_SPEC_ON) $(ROOT)/usr/include/apptrace_impl.h $(ROOT)/usr/include/sys/link.h \ $(ROOT)/usr/include/sys/note.h \ $(ROOT)/usr/include/sys/systeminfo.h -$(VAR_SPEC_ON) @ cd $(SRC)/uts/$(M32)/sys; pwd; $(MAKE) \ + @ cd $(SRC)/uts/$(M32)/sys; pwd; $(MAKE) \ $(ROOT)/usr/include/sys/machelf.h -$(VAR_SPEC_ON) @ cd $(SRC)/lib/abi; pwd; $(MAKE) spec @ cd ../tools/$(MACH); pwd; $(MAKE) sgsmsg piglatin @ cd ..; pwd; $(MAKE) _msg_sgsmsg @ cd ..; pwd; $(MAKE) native-add diff --git a/usr/src/cmd/sgs/packages/Makefile.lint b/usr/src/cmd/sgs/packages/Makefile.lint index 567a40374c..720f3e4201 100644 --- a/usr/src/cmd/sgs/packages/Makefile.lint +++ b/usr/src/cmd/sgs/packages/Makefile.lint @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -53,7 +53,6 @@ LSUBDIRS2 = ../rtld \ ../ldprof \ ../link_audit \ ../libldmake \ - ../librtld_db \ ../rtld/mdbmod LINTLDIRS= ../libld \ diff --git a/usr/src/cmd/sgs/packages/common/SUNWonld-README b/usr/src/cmd/sgs/packages/common/SUNWonld-README index 0ee65c81d4..3766b7e716 100644 --- a/usr/src/cmd/sgs/packages/common/SUNWonld-README +++ b/usr/src/cmd/sgs/packages/common/SUNWonld-README @@ -1089,3 +1089,7 @@ Bugid Risk Synopsis 6380470 32-bit ld(1) incorrectly builds 64-bit relocatable objects 6391407 Insufficient alignment of 32-bit object in archive makes ld segfault (libelf component only) +6316708 LD_DEBUG should provide a means of identifying/isolating individual + link-map lists +6280209 elfdump cores on memory model 0x3 +6197234 elfdump and dump don't handle 64-bit symbols correctly diff --git a/usr/src/cmd/sgs/packages/common/prototype_com b/usr/src/cmd/sgs/packages/common/prototype_com index 576f1209e4..57c4cfc616 100644 --- a/usr/src/cmd/sgs/packages/common/prototype_com +++ b/usr/src/cmd/sgs/packages/common/prototype_com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -55,8 +55,7 @@ f none $SGSDIR/lib/libdl.so.1=lib/libdl.so.1 755 root bin s none $SGSDIR/lib/libdl.so=./libdl.so.1 f none $SGSDIR/lib/libelf.so.1=lib/libelf.so.1 755 root bin s none $SGSDIR/lib/libelf.so=./libelf.so.1 -f none $SGSDIR/lib/libld.so.2=lib/libld.so.2 755 root bin -f none $SGSDIR/lib/libld.so.3=lib/libld.so.3 755 root bin +f none $SGSDIR/lib/libld.so.4=lib/libld.so.4 755 root bin f none $SGSDIR/lib/liblddbg.so.4=lib/liblddbg.so.4 755 root bin f none $SGSDIR/lib/librtld.so.1=lib/librtld.so.1 755 root bin s none $SGSDIR/lib/librtld_db.so=librtld_db.so.1 diff --git a/usr/src/cmd/sgs/packages/common/prototype_i386 b/usr/src/cmd/sgs/packages/common/prototype_i386 index ed01876196..7a553ac215 100644 --- a/usr/src/cmd/sgs/packages/common/prototype_i386 +++ b/usr/src/cmd/sgs/packages/common/prototype_i386 @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,11 +18,12 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" # # This required package information file contains a list of package contents. # The 'pkgmk' command uses this file to identify the contents of a package @@ -37,23 +37,19 @@ !include prototype_com -# -# XX64 - still have files to fill in -# - d none $SGSDIR/lib/amd64=lib/amd64 755 root bin f none $SGSDIR/lib/amd64/ld.so.1=lib/amd64/ld.so.1 755 root bin f none $SGSDIR/lib/amd64/libdl.so.1=lib/amd64/libdl.so.1 755 root bin s none $SGSDIR/lib/amd64/libdl.so=libdl.so.1 f none $SGSDIR/lib/amd64/libelf.so.1=lib/amd64/libelf.so.1 755 root bin s none $SGSDIR/lib/amd64/libelf.so=libelf.so.1 -f none $SGSDIR/lib/amd64/libld.so.2=lib/amd64/libld.so.2 755 root bin -f none $SGSDIR/lib/amd64/libld.so.3=lib/amd64/libld.so.3 755 root bin +f none $SGSDIR/lib/amd64/libld.so.4=lib/amd64/libld.so.4 755 root bin f none $SGSDIR/lib/amd64/liblddbg.so.4=lib/amd64/liblddbg.so.4 755 root bin f none $SGSDIR/lib/amd64/librtld.so.1=lib/amd64/librtld.so.1 755 root bin f none $SGSDIR/lib/amd64/librtld_db.so.1=lib/amd64/librtld_db.so.1 755 root bin s none $SGSDIR/lib/amd64/librtld_db.so=librtld_db.so.1 d none $SGSDIR/usr/bin/amd64 755 root bin +f none $SGSDIR/usr/bin/amd64/moe=usr/bin/amd64/moe 555 root bin f none $SGSDIR/usr/bin/amd64/pvs=usr/bin/amd64/pvs 555 root bin d none $SGSDIR/usr/ccs/bin/amd64 755 root bin f none $SGSDIR/usr/ccs/bin/amd64/elfdump=usr/ccs/bin/amd64/elfdump 0555 root bin @@ -62,9 +58,9 @@ f none $SGSDIR/usr/ccs/bin/amd64/mcs=usr/ccs/bin/amd64/mcs 0555 root bin l none $SGSDIR/usr/ccs/bin/amd64/strip=../../../../usr/ccs/bin/amd64/mcs d none $SGSDIR/usr/lib/link_audit/amd64 755 root bin s none $SGSDIR/usr/lib/link_audit/64=amd64 -#f none $SGSDIR/usr/lib/link_audit/amd64/ldprof.so.1=usr/lib/link_audit/amd64/ldprof.so.1 755 root bin -#f none $SGSDIR/usr/lib/link_audit/amd64/truss.so.1=usr/lib/link_audit/amd64/truss.so.1 755 root bin -#f none $SGSDIR/usr/lib/link_audit/amd64/who.so.1=usr/lib/link_audit/amd64/who.so.1 755 root bin +f none $SGSDIR/usr/lib/link_audit/amd64/ldprof.so.1=usr/lib/link_audit/amd64/ldprof.so.1 755 root bin +f none $SGSDIR/usr/lib/link_audit/amd64/truss.so.1=usr/lib/link_audit/amd64/truss.so.1 755 root bin +f none $SGSDIR/usr/lib/link_audit/amd64/who.so.1=usr/lib/link_audit/amd64/who.so.1 755 root bin d none $SGSDIR/usr/lib/mdb/proc/amd64 755 root sys f none $SGSDIR/usr/lib/mdb/proc/amd64/ld.so=usr/lib/mdb/proc/amd64/ld.so 555 root sys d none $SGSDIR/usr/lib/secure/amd64 755 root bin @@ -79,6 +75,6 @@ f none opt/SUNWonld/bin/amd64/rdb 755 root bin d none opt/SUNWonld/lib/amd64 755 root bin s none opt/SUNWonld/lib/64=amd64 f none opt/SUNWonld/lib/amd64/libldmake.so.1 755 root bin -#f none opt/SUNWonld/lib/amd64/bindings.so.1 755 root bin -#f none opt/SUNWonld/lib/amd64/perfcnt.so.1 755 root bin -#f none opt/SUNWonld/lib/amd64/symbindrep.so.1 755 root bin +f none opt/SUNWonld/lib/amd64/bindings.so.1 755 root bin +f none opt/SUNWonld/lib/amd64/perfcnt.so.1 755 root bin +f none opt/SUNWonld/lib/amd64/symbindrep.so.1 755 root bin diff --git a/usr/src/cmd/sgs/packages/common/prototype_sparc b/usr/src/cmd/sgs/packages/common/prototype_sparc index c03636eabe..c84fe4636b 100644 --- a/usr/src/cmd/sgs/packages/common/prototype_sparc +++ b/usr/src/cmd/sgs/packages/common/prototype_sparc @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -43,8 +43,7 @@ f none $SGSDIR/lib/sparcv9/libdl.so.1=lib/sparcv9/libdl.so.1 755 root bin s none $SGSDIR/lib/sparcv9/libdl.so=libdl.so.1 f none $SGSDIR/lib/sparcv9/libelf.so.1=lib/sparcv9/libelf.so.1 755 root bin s none $SGSDIR/lib/sparcv9/libelf.so=libelf.so.1 -f none $SGSDIR/lib/sparcv9/libld.so.2=lib/sparcv9/libld.so.2 755 root bin -f none $SGSDIR/lib/sparcv9/libld.so.3=lib/sparcv9/libld.so.3 755 root bin +f none $SGSDIR/lib/sparcv9/libld.so.4=lib/sparcv9/libld.so.4 755 root bin f none $SGSDIR/lib/sparcv9/liblddbg.so.4=lib/sparcv9/liblddbg.so.4 755 root bin f none $SGSDIR/lib/sparcv9/librtld.so.1=lib/sparcv9/librtld.so.1 755 root bin f none $SGSDIR/lib/sparcv9/librtld_db.so.1=lib/sparcv9/librtld_db.so.1 755 root bin diff --git a/usr/src/cmd/sgs/packages/inc.flg b/usr/src/cmd/sgs/packages/inc.flg index c72d3c1243..4e3da5e042 100644 --- a/usr/src/cmd/sgs/packages/inc.flg +++ b/usr/src/cmd/sgs/packages/inc.flg @@ -3,9 +3,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. @@ -22,7 +21,7 @@ # # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -59,7 +58,6 @@ find_files "s.*" \ usr/src/cmd/sgs/sgsdemangler \ usr/src/common/avl \ usr/src/common/elfcap \ - usr/src/lib/abi/apptrace \ usr/src/lib/libc/inc \ usr/src/lib/libproc \ usr/src/lib/common @@ -109,7 +107,3 @@ 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 -echo_file usr/src/lib/Makefile.spec -echo_file usr/src/lib/Makefile.spec.arch -echo_file usr/src/lib/abi/Makefile -exec_file usr/src/lib/abi/req.flg diff --git a/usr/src/cmd/sgs/pvs/Makefile.com b/usr/src/cmd/sgs/pvs/Makefile.com index 592f95c189..9f73c07732 100644 --- a/usr/src/cmd/sgs/pvs/Makefile.com +++ b/usr/src/cmd/sgs/pvs/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -41,8 +41,8 @@ MAPFILE= ../common/mapfile-vers LLDFLAGS = '-R$$ORIGIN/../lib' LLDFLAGS64 = '-R$$ORIGIN/../../lib/$(MACH64)' LDFLAGS += $(VERSREF) $(USE_PROTO) -M$(MAPFILE) $(LLDFLAGS) -LDLIBS += $(CONVLIBDIR) -lconv $(ELFLIBDIR) -lelf $(LDDBGLIBDIR) \ - $(LDDBG_LIB) +LDLIBS += $(LDDBGLIBDIR) $(LDDBG_LIB) $(ELFLIBDIR) -lelf \ + $(CONVLIBDIR) $(CONV_LIB) LINTFLAGS += -x LINTFLAGS64 += -x diff --git a/usr/src/cmd/sgs/pvs/amd64/Makefile b/usr/src/cmd/sgs/pvs/amd64/Makefile index 2a7e9f279a..a0f7624ef0 100644 --- a/usr/src/cmd/sgs/pvs/amd64/Makefile +++ b/usr/src/cmd/sgs/pvs/amd64/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -30,13 +30,13 @@ include ../Makefile.com .KEEP_STATE: -LLDFLAGS= $(LLDFLAGS64) -CONVLIBDIR= $(CONVLIBDIR64) -ELFLIBDIR= $(ELFLIBDIR64) -LDDBGLIBDIR= $(LDDBGLIBDIR64) +LLDFLAGS = $(LLDFLAGS64) +CONVLIBDIR = $(CONVLIBDIR64) +ELFLIBDIR = $(ELFLIBDIR64) +LDDBGLIBDIR = $(LDDBGLIBDIR64) LINTFLAGS64 += $(VAR_LINTFLAGS64) -ROOTPROG=$(ROOTPROG64) +ROOTPROG = $(ROOTPROG64) include ../Makefile.targ include ../../Makefile.sub.64 diff --git a/usr/src/cmd/sgs/pvs/common/lintsup.c b/usr/src/cmd/sgs/pvs/common/lintsup.c index 337c1ccb7d..12a83f0706 100644 --- a/usr/src/cmd/sgs/pvs/common/lintsup.c +++ b/usr/src/cmd/sgs/pvs/common/lintsup.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,8 +22,8 @@ /* PROTOLIB1 */ /* - * Copyright (c) 2000 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -33,11 +32,11 @@ * these symbols used. */ -#include "debug.h" +#include <debug.h> #include "msg.h" void foo() { - dbg_print(_pvs_msg((Msg)&__pvs_msg[0])); + dbg_print(0, _pvs_msg((Msg)&__pvs_msg[0])); } diff --git a/usr/src/cmd/sgs/pvs/common/mapfile-vers b/usr/src/cmd/sgs/pvs/common/mapfile-vers index 1b935a2dc3..8926c12f55 100644 --- a/usr/src/cmd/sgs/pvs/common/mapfile-vers +++ b/usr/src/cmd/sgs/pvs/common/mapfile-vers @@ -1,15 +1,9 @@ # -#ident "%Z%%M% %I% %E% SMI" -# -# 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. +# 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. @@ -25,12 +19,17 @@ # CDDL HEADER END # +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# # Specify what global symbols we export (none). Note that we're not # interested in declaring a version, simply scoping the file is sufficient. { global: - dbg_print; main; # debuggers seem to like this. local: *; diff --git a/usr/src/cmd/sgs/pvs/common/pvs.c b/usr/src/cmd/sgs/pvs/common/pvs.c index 678a534cbd..7e0c960fb0 100644 --- a/usr/src/cmd/sgs/pvs/common/pvs.c +++ b/usr/src/cmd/sgs/pvs/common/pvs.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -60,11 +60,10 @@ #include <unistd.h> #include <locale.h> #include <errno.h> -#include <sys/varargs.h> -#include "sgs.h" -#include "conv.h" -#include "debug.h" -#include "gelf.h" +#include <sgs.h> +#include <conv.h> +#include <gelf.h> +#include <debug.h> #include "msg.h" #define FLG_VER_AVAIL 0x10 @@ -105,29 +104,11 @@ static const char * demangle(const char *name) { if (Cflag) - return (Gelf_sym_dem(name)); + return (Elf_demangle_name(name)); else return (name); } - -/* - * Define our own printing routine. We don't actually use this, but because - * we use liblddbg to demangle symbols we need to provide this to satisfy - * liblddbg's binding requirements. - */ -/*PRINTFLIKE1*/ -void -dbg_print(const char *format, ...) -{ - va_list ap; - - va_start(ap, format); - (void) vprintf(format, ap); - (void) printf(MSG_ORIG(MSG_STR_NL)); -} - - /* * Print any reduced symbols. The convention is that reduced symbols exist as * LOCL entries in the .symtab, between the FILE symbol for the output file and diff --git a/usr/src/cmd/sgs/pvs/common/pvs.msg b/usr/src/cmd/sgs/pvs/common/pvs.msg index 5d21a9c309..ef3c2256f1 100644 --- a/usr/src/cmd/sgs/pvs/common/pvs.msg +++ b/usr/src/cmd/sgs/pvs/common/pvs.msg @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,8 +18,12 @@ # # CDDL HEADER END # -# ident "%Z%%M% %I% %E% SMI" +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" @ _START_ @@ -78,6 +78,5 @@ @ MSG_ELF_GETDATA "%s: %s: elf_getdata: %s\n" @ MSG_STR_EMPTY "" -@ MSG_STR_NL "\n" @ MSG_SUNW_OST_SGS "SUNW_OST_SGS" diff --git a/usr/src/cmd/sgs/pvs/sparcv9/Makefile b/usr/src/cmd/sgs/pvs/sparcv9/Makefile index 4e3541d10a..e00e753054 100644 --- a/usr/src/cmd/sgs/pvs/sparcv9/Makefile +++ b/usr/src/cmd/sgs/pvs/sparcv9/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2000-2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -30,13 +29,13 @@ include ../Makefile.com .KEEP_STATE: -LLDFLAGS= $(LLDFLAGS64) -CONVLIBDIR= $(CONVLIBDIR64) -ELFLIBDIR= $(ELFLIBDIR64) -LDDBGLIBDIR= $(LDDBGLIBDIR64) +LLDFLAGS = $(LLDFLAGS64) +CONVLIBDIR = $(CONVLIBDIR64) +ELFLIBDIR = $(ELFLIBDIR64) +LDDBGLIBDIR = $(LDDBGLIBDIR64) LINTFLAGS64 += $(VAR_LINTFLAGS64) -ROOTPROG=$(ROOTPROG64) +ROOTPROG = $(ROOTPROG64) include ../Makefile.targ include ../../Makefile.sub.64 diff --git a/usr/src/cmd/sgs/rtld/Makefile.com b/usr/src/cmd/sgs/rtld/Makefile.com index 5cd0256157..deabc1e224 100644 --- a/usr/src/cmd/sgs/rtld/Makefile.com +++ b/usr/src/cmd/sgs/rtld/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -44,7 +44,8 @@ NOCTFOBJS= $(ASOBJS) include $(SRC)/lib/Makefile.lib include $(SRC)/cmd/sgs/Makefile.com -PLAT= $(VAR_PLAT_$(BASEPLAT)) + +PLAT = $(VAR_PLAT_$(BASEPLAT)) # Dtrace needs an executable data segment. NX_MAP= @@ -73,7 +74,7 @@ FILEMODE = 755 CPPFEATUREMACROS= $(VAR_RTLD_CPPFEATUREMACROS) CPPFLAGS += -I$(SRCBASE)/lib/libc/inc -I$(SRCBASE)/uts/common/krtld \ - $(CPPFEATUREMACROS) + -I$(SRCBASE)/uts/$(PLAT)/krtld $(CPPFEATUREMACROS) ASFLAGS= -P -D_ASM $(CPPFLAGS) LDLIB = -L ../../libld/$(MACH) RTLDLIB = -L ../../librtld/$(MACH) @@ -85,12 +86,11 @@ CPICLIB = $(VAR_RTLD_CPICLIB) CPICLIB64 = $(VAR_RTLD_CPICLIB64) CLIB = -lc_pic -LDLIBS= $(LDLIBS.lib) \ - $(CONVLIBDIR) -lconv \ +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) \ $(CPICLIB) $(CLIB) \ - $(LDLIB) $(LD_LIB) \ $(LDDBGLIBDIR) $(LDDBG_LIB) \ - $(RTLDLIB) -lrtld + $(RTLDLIB) -lrtld \ + $(LDLIB) $(LD_LIB) DYNFLAGS += -i -e _rt_boot $(VERSREF) -Bsymbolic -zlazyload -znodlopen \ -zdtrace=dtrace_data $(MAPOPTS) '-R$$ORIGIN' diff --git a/usr/src/cmd/sgs/rtld/Makefile.targ b/usr/src/cmd/sgs/rtld/Makefile.targ index 55b6e20850..c35e499d5b 100644 --- a/usr/src/cmd/sgs/rtld/Makefile.targ +++ b/usr/src/cmd/sgs/rtld/Makefile.targ @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -65,7 +65,7 @@ pics/%.o: $(SRCBASE)/uts/$(PLAT)/krtld/%.c $(RTLD): pics $(PICS) $(CRTS) $(MAPFILES) $(SGSPROTO)/ld -o $@ -dy -G $(DYNFLAGS) $(CRTI) $(PICS) \ - $(LDLIBS) $(CRTN) + $(LDLIBS) $(CRTN) $(POST_PROCESS_SO) delete: diff --git a/usr/src/cmd/sgs/rtld/amd64/Makefile b/usr/src/cmd/sgs/rtld/amd64/Makefile index c56229ca54..22e6a2d387 100644 --- a/usr/src/cmd/sgs/rtld/amd64/Makefile +++ b/usr/src/cmd/sgs/rtld/amd64/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,16 @@ # # CDDL HEADER END # + # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # +BASEPLAT = amd64 + # Object lists are organized into primary (most frequently used code) and # secondary lists (less frequently used code, ie. a.out support). @@ -33,7 +35,7 @@ P_COMOBJS= debugdata.o \ analyze.o elf.o globals.o malloc.o \ mutex.o paths.o setup.o util.o \ dlfcns.o config_elf.o locale.o tsort.o \ - getcwd.o remove.o sunwmove.o tls.o \ + getcwd.o remove.o move.o tls.o \ cap.o S_COMOBJS= debug.o audit.o object.o @@ -56,23 +58,17 @@ CRTI= pics/crti.o CRTN= pics/crtn.o CRTS= $(CRTI) $(CRTN) -BASEPLAT= amd64 - -include $(SRC)/Makefile.master +include $(SRC)/cmd/sgs/rtld/Makefile.com +include $(SRC)/lib/Makefile.lib.64 # We build 64-bit objects with gcc by default MAPFILE-ORDER = ../common/mapfile-order-devpro $(__GNUC64)MAPFILE-ORDER = ../common/mapfile-order-gcc -MAPFILE-PLAT = mapfile-amd64-vers - -include $(SRC)/cmd/sgs/rtld/Makefile.com -include $(SRC)/lib/Makefile.lib.64 - +MAPFILE-PLAT = mapfile-amd64-vers # Add any machine specific flags. -CPPFLAGS += -I../../../../uts/intel/amd64/krtld -DELF_TARGET_AMD64 CFLAGS += -xregs=no%appl ASFLAGS += -D__amd64 -D_ELF64 $(amd64_ASFLAGS) ADBGENFLAGS += -mlp64 @@ -84,8 +80,6 @@ SONAME= /lib/amd64/ld.so.1 SGSMSGTARG += $(SGSMSGINTEL) $(SGSMSGINTEL64) $(SGSMSG64) -DYNFLAGS += -zdtrace=dtrace_data - LDLIB = -L ../../libld/$(MACH64) RTLDLIB = -L ../../librtld/$(MACH64) @@ -93,6 +87,7 @@ CPICLIB = $(CPICLIB64) LDDBGLIBDIR = $(LDDBGLIBDIR64) CONVLIBDIR = $(CONVLIBDIR64) +MAPFILES += ../common/mapfile-64-vers .KEEP_STATE: @@ -106,11 +101,5 @@ adbmacros: adb .WAIT $(ADBSCRIPTS) adbinstall: adbmacros .WAIT $(ROOTADB64) - -pics/%.o: $(SRCBASE)/uts/intel/amd64/krtld/%.c - $(COMPILE.c) -o $@ $< $(WARNFLAGS) - $(POST_PROCESS_O) - - include $(SRC)/cmd/sgs/rtld/Makefile.targ include ../../Makefile.sub.64 diff --git a/usr/src/cmd/sgs/rtld/amd64/_setup.c b/usr/src/cmd/sgs/rtld/amd64/_setup.c index da3b3c54d1..8e5a0961ff 100644 --- a/usr/src/cmd/sgs/rtld/amd64/_setup.c +++ b/usr/src/cmd/sgs/rtld/amd64/_setup.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -44,10 +44,10 @@ #include <sys/stat.h> #include <link.h> #include <dlfcn.h> +#include <debug.h> #include "_rtld.h" #include "_audit.h" #include "msg.h" -#include "debug.h" extern int _end; extern int _etext; diff --git a/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c b/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c index acac50b10f..d4cd94c8b2 100644 --- a/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c +++ b/usr/src/cmd/sgs/rtld/amd64/amd64_elf.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -38,13 +38,13 @@ #include <dlfcn.h> #include <synch.h> #include <string.h> +#include <debug.h> +#include <reloc.h> +#include <conv.h> #include "_rtld.h" #include "_audit.h" #include "_elf.h" #include "msg.h" -#include "debug.h" -#include "reloc.h" -#include "conv.h" extern void elf_rtbndr(Rt_map *, ulong_t, caddr_t); @@ -148,6 +148,7 @@ elf_plt_trace_write(ulong_t roffset, Rt_map *rlmp, Rt_map *dlmp, Sym *sym, if (*dyn_plt == 0) { Sym * symp; Xword symvalue; + Lm_list *lml = LIST(rlmp); (void) memcpy((void *)dyn_plt, dyn_plt_template, sizeof (dyn_plt_template)); @@ -161,9 +162,9 @@ elf_plt_trace_write(ulong_t roffset, Rt_map *rlmp, Rt_map *dlmp, Sym *sym, */ symvalue = (Xword)((uintptr_t)dyndata - (uintptr_t)(&dyn_plt[TRCREL1OFF]) - 4); - if (do_reloc(R_AMD64_PC32, &dyn_plt[TRCREL1OFF], &symvalue, - MSG_ORIG(MSG_SYM_LADYNDATA), - MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) { + if (do_reloc(R_AMD64_PC32, &dyn_plt[TRCREL1OFF], + &symvalue, MSG_ORIG(MSG_SYM_LADYNDATA), + MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) { *fail = 1; return (0); } @@ -174,9 +175,9 @@ elf_plt_trace_write(ulong_t roffset, Rt_map *rlmp, Rt_map *dlmp, Sym *sym, * R_AMD64_64 0x15 0 elf_plt_trace */ symvalue = (Xword)elf_plt_trace; - if (do_reloc(R_AMD64_64, &dyn_plt[TRCREL2OFF], &symvalue, - MSG_ORIG(MSG_SYM_ELFPLTTRACE), - MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) { + if (do_reloc(R_AMD64_64, &dyn_plt[TRCREL2OFF], + &symvalue, MSG_ORIG(MSG_SYM_ELFPLTTRACE), + MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) { *fail = 1; return (0); } @@ -218,9 +219,10 @@ elf_bndr(Rt_map *lmp, ulong_t pltndx, caddr_t from) char *name; Rela *rptr; Sym *sym, *nsym; - uint_t binfo, sb_flags = 0; + uint_t binfo, sb_flags = 0, dbg_class; Slookup sl; - int entry, dbg_save, lmflags; + int entry, lmflags; + Lm_list *lml; /* * For compatibility with libthread (TI_VERSION 1) we track the entry @@ -230,9 +232,10 @@ elf_bndr(Rt_map *lmp, ulong_t pltndx, caddr_t from) */ entry = enter(); - if ((lmflags = LIST(lmp)->lm_flags) & LML_FLG_RTLDLM) { - dbg_save = dbg_mask; - dbg_mask = 0; + lml = LIST(lmp); + if ((lmflags = lml->lm_flags) & LML_FLG_RTLDLM) { + dbg_class = dbg_desc->d_class; + dbg_desc->d_class = 0; } /* @@ -242,10 +245,10 @@ elf_bndr(Rt_map *lmp, ulong_t pltndx, caddr_t from) */ if ((!lmp) && (pltndx <= (ulong_t)PLTRELSZ(lmp) / (ulong_t)RELENT(lmp))) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_PLTREF), - conv_reloc_amd64_type_str(R_AMD64_JUMP_SLOT), - EC_ADDR(lmp), EC_XWORD(pltndx), EC_ADDR(from)); - rtldexit(LIST(lmp), 1); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_PLTREF), + conv_reloc_amd64_type(R_AMD64_JUMP_SLOT), + EC_NATPTR(lmp), EC_XWORD(pltndx), EC_NATPTR(from)); + rtldexit(lml, 1); } reloff = pltndx * (ulong_t)RELENT(lmp); @@ -262,22 +265,22 @@ elf_bndr(Rt_map *lmp, ulong_t pltndx, caddr_t from) * Determine the last link-map of this list, this'll be the starting * point for any tsort() processing. */ - llmp = LIST(lmp)->lm_tail; + llmp = lml->lm_tail; /* * Find definition for symbol. */ sl.sl_name = name; sl.sl_cmap = lmp; - sl.sl_imap = LIST(lmp)->lm_head; + sl.sl_imap = lml->lm_head; sl.sl_hash = 0; sl.sl_rsymndx = rsymndx; sl.sl_flags = LKUP_DEFT; if ((nsym = lookup_sym(&sl, &nlmp, &binfo)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp), demangle(name)); - rtldexit(LIST(lmp), 1); + rtldexit(lml, 1); } symval = nsym->st_value; @@ -289,10 +292,10 @@ elf_bndr(Rt_map *lmp, ulong_t pltndx, caddr_t from) * Record that this new link map is now bound to the caller. */ if (bind_one(lmp, nlmp, BND_REFER) == 0) - rtldexit(LIST(lmp), 1); + rtldexit(lml, 1); } - if ((LIST(lmp)->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) { + if ((lml->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) { uint_t symndx = (((uintptr_t)nsym - (uintptr_t)SYMTAB(nlmp)) / SYMENT(nlmp)); symval = audit_symbind(lmp, nlmp, nsym, symndx, symval, @@ -303,7 +306,7 @@ elf_bndr(Rt_map *lmp, ulong_t pltndx, caddr_t from) addr = rptr->r_offset; if (!(FLAGS(lmp) & FLG_RT_FIXED)) addr += ADDR(lmp); - if (((LIST(lmp)->lm_tflags | FLAGS1(lmp)) & + if (((lml->lm_tflags | FLAGS1(lmp)) & (LML_TFLG_AUD_PLTENTER | LML_TFLG_AUD_PLTEXIT)) && AUDINFO(lmp)->ai_dynplts) { int fail = 0; @@ -316,7 +319,7 @@ elf_bndr(Rt_map *lmp, ulong_t pltndx, caddr_t from) nsym, symndx, pltndx, (caddr_t)symval, sb_flags, &fail); if (fail) - rtldexit(LIST(lmp), 1); + rtldexit(lml, 1); } else { /* * Write standard PLT entry to jump directly @@ -329,9 +332,9 @@ elf_bndr(Rt_map *lmp, ulong_t pltndx, caddr_t from) /* * Print binding information and rebuild PLT entry. */ - DBG_CALL(Dbg_bind_global(NAME(lmp), from, from - ADDR(lmp), - (Xword)(reloff / sizeof (Rela)), PLT_T_FULL, NAME(nlmp), - (caddr_t)symval, (caddr_t)nsym->st_value, name, binfo)); + DBG_CALL(Dbg_bind_global(lmp, (Addr)from, (Off)(from - ADDR(lmp)), + (Xword)(reloff / sizeof (Rela)), PLT_T_FULL, nlmp, + (Addr)symval, nsym->st_value, name, binfo)); /* * Complete any processing for newly loaded objects. Note we don't @@ -348,7 +351,7 @@ elf_bndr(Rt_map *lmp, ulong_t pltndx, caddr_t from) * result in objects being loaded on rtld's link-map, make sure these * objects are initialized also. */ - if ((LIST(nlmp)->lm_flags & LML_FLG_RTLDLM) && LIST(nlmp)->lm_init) + if ((lml->lm_flags & LML_FLG_RTLDLM) && LIST(nlmp)->lm_init) load_completion(nlmp, 0); /* @@ -363,11 +366,11 @@ elf_bndr(Rt_map *lmp, ulong_t pltndx, caddr_t from) */ if (entry) { is_dep_init(nlmp, lmp); - leave(LIST(lmp)); + leave(lml); } if (lmflags & LML_FLG_RTLDLM) - dbg_mask = dbg_save; + dbg_desc->d_class = dbg_class; return (symval); } @@ -558,10 +561,10 @@ elf_reloc(Rt_map *lmp, uint_t plt) } } if (!relbgn || (relbgn == relend)) { - DBG_CALL(Dbg_reloc_run(NAME(lmp), 0, plt, DBG_REL_NONE)); + DBG_CALL(Dbg_reloc_run(lmp, 0, plt, DBG_REL_NONE)); return (1); } - DBG_CALL(Dbg_reloc_run(NAME(lmp), M_REL_SHT_TYPE, plt, DBG_REL_START)); + DBG_CALL(Dbg_reloc_run(lmp, M_REL_SHT_TYPE, plt, DBG_REL_START)); /* * If we're processing a dynamic executable in lazy mode there is no @@ -588,7 +591,7 @@ elf_reloc(Rt_map *lmp, uint_t plt) * jump if we've been given a hint on the number of relocations. */ if ((rtype == R_AMD64_RELATIVE) && - !(FLAGS(lmp) & FLG_RT_FIXED) && !dbg_mask) { + ((FLAGS(lmp) & FLG_RT_FIXED) == 0) && (DBG_ENABLED == 0)) { /* * It's possible that the relative relocation block * has relocations against the text segment as well @@ -738,9 +741,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) (rtype != R_AMD64_COPY)) { /* LINTED */ if (psymdef == 0) { - DBG_CALL(Dbg_bind_weak( - NAME(lmp), (caddr_t)roffset, - (caddr_t) + DBG_CALL(Dbg_bind_weak(lmp, + (Addr)roffset, (Addr) (roffset - basebgn), name)); continue; } @@ -805,11 +807,13 @@ elf_reloc(Rt_map *lmp, uint_t plt) * chkmsg: MSG_INTL(MSG_LDD_SYM_NFOUND) */ if (symdef == 0) { + Lm_list *lml = LIST(lmp); + if (bind != STB_WEAK) { - if (LIST(lmp)->lm_flags & + if (lml->lm_flags & LML_FLG_IGNRELERR) { continue; - } else if (LIST(lmp)->lm_flags & + } else if (lml->lm_flags & LML_FLG_TRC_WARN) { (void) printf(MSG_INTL( MSG_LDD_SYM_NFOUND), @@ -817,7 +821,7 @@ elf_reloc(Rt_map *lmp, uint_t plt) NAME(lmp)); continue; } else { - eprintf(ERR_FATAL, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp), demangle(name)); @@ -828,9 +832,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) psymndx = rsymndx; psymdef = 0; - DBG_CALL(Dbg_bind_weak( - NAME(lmp), (caddr_t)roffset, - (caddr_t) + DBG_CALL(Dbg_bind_weak(lmp, + (Addr)roffset, (Addr) (roffset - basebgn), name)); continue; } @@ -935,7 +938,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) /* * Call relocation routine to perform required relocation. */ - DBG_CALL(Dbg_reloc_in(M_MACH, M_REL_SHT_TYPE, rel, name, NULL)); + DBG_CALL(Dbg_reloc_in(LIST(lmp), ELF_DBG_RTLD, M_MACH, + M_REL_SHT_TYPE, rel, NULL, name)); switch (rtype) { case R_AMD64_COPY: @@ -964,7 +968,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) * Write standard PLT entry to jump directly * to newly bound function. */ - DBG_CALL(Dbg_reloc_apply((Xword)roffset, + DBG_CALL(Dbg_reloc_apply_val(LIST(lmp), + ELF_DBG_RTLD, (Xword)roffset, (Xword)value)); *(ulong_t *)roffset = value; } @@ -975,11 +980,11 @@ elf_reloc(Rt_map *lmp, uint_t plt) * Write the relocation out. */ if (do_reloc(rtype, (uchar_t *)roffset, - (Xword *)&value, name, NAME(lmp)) == 0) + (Xword *)&value, name, NAME(lmp), LIST(lmp)) == 0) ret = 0; - DBG_CALL(Dbg_reloc_apply((Xword)roffset, - (Xword)value)); + DBG_CALL(Dbg_reloc_apply_val(LIST(lmp), ELF_DBG_RTLD, + (Xword)roffset, (Xword)value)); } if ((ret == 0) && @@ -987,10 +992,9 @@ elf_reloc(Rt_map *lmp, uint_t plt) break; if (binfo) { - DBG_CALL(Dbg_bind_global(NAME(lmp), (caddr_t)roffset, - (caddr_t)(roffset - basebgn), (Xword)(-1), - PLT_T_FULL, NAME(_lmp), (caddr_t)value, - (caddr_t)symdef->st_value, name, binfo)); + DBG_CALL(Dbg_bind_global(lmp, (Addr)roffset, + (Off)(roffset - basebgn), (Xword)(-1), PLT_T_FULL, + _lmp, (Addr)value, symdef->st_value, name, binfo)); } } @@ -1041,7 +1045,7 @@ elf_plt_write(uintptr_t addr, uintptr_t vaddr, void *rptr, uintptr_t symval, * ld.so.1. */ const char * -_conv_reloc_type_str(uint_t rel) +_conv_reloc_type(uint_t rel) { - return (conv_reloc_amd64_type_str(rel)); + return (conv_reloc_amd64_type(rel)); } diff --git a/usr/src/cmd/sgs/rtld/amd64/dlamd64getunwind.c b/usr/src/cmd/sgs/rtld/amd64/dlamd64getunwind.c index 43a6d99f05..2d59806a3f 100644 --- a/usr/src/cmd/sgs/rtld/amd64/dlamd64getunwind.c +++ b/usr/src/cmd/sgs/rtld/amd64/dlamd64getunwind.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -41,25 +41,24 @@ #include <stdio.h> static Dl_amd64_unwindinfo * -getunwind_core(void * pc, Dl_amd64_unwindinfo *unwindinfo) +getunwind_core(Rt_map *clmp, void *pc, Dl_amd64_unwindinfo *unwindinfo) { - Rt_map *lmp; - /* - * Validate the version information + * Validate the version information. */ if (unwindinfo == NULL) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLVAL)); + eprintf(LIST(clmp), ERR_FATAL, MSG_INTL(MSG_ARG_ILLVAL)); return (0); } if ((unwindinfo->dlui_version < DLUI_VERS_1) || (unwindinfo->dlui_version > DLUI_VERS_CURRENT)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_UNW_BADVERS), + eprintf(LIST(clmp), ERR_FATAL, MSG_INTL(MSG_UNW_BADVERS), DLUI_VERS_CURRENT, unwindinfo->dlui_version); return (0); } + /* - * clean out the structure + * Clean out the structure. */ unwindinfo->dlui_flags = 0; unwindinfo->dlui_objname = 0; @@ -68,15 +67,16 @@ getunwind_core(void * pc, Dl_amd64_unwindinfo *unwindinfo) unwindinfo->dlui_segstart = 0; unwindinfo->dlui_segend = 0; - lmp = _caller(pc, 0); - if (lmp) { + if (clmp) { Mmap *immap; - unwindinfo->dlui_objname = PATHNAME(lmp); + + unwindinfo->dlui_objname = PATHNAME(clmp); + /* - * Scan through the mmaps of this object to get - * the specific segment found. + * Scan through the mmaps of this object to get the specific + * segment found. */ - for (immap = MMAPS(lmp); immap->m_vaddr; immap++) { + for (immap = MMAPS(clmp); immap->m_vaddr; immap++) { if (((caddr_t)pc >= immap->m_vaddr) && ((caddr_t)pc < (immap->m_vaddr + immap->m_msize))) { break; @@ -84,26 +84,29 @@ getunwind_core(void * pc, Dl_amd64_unwindinfo *unwindinfo) } unwindinfo->dlui_segstart = immap->m_vaddr; unwindinfo->dlui_segend = immap->m_vaddr + immap->m_msize; - if (PTUNWIND(lmp) && (immap->m_vaddr)) { + + if (PTUNWIND(clmp) && (immap->m_vaddr)) { uintptr_t base; - if (FLAGS(lmp) & FLG_RT_FIXED) + + if (FLAGS(clmp) & FLG_RT_FIXED) base = 0; else - base = ADDR(lmp); + base = ADDR(clmp); + unwindinfo->dlui_unwindstart = - (void *)(PTUNWIND(lmp)->p_vaddr + base); + (void *)(PTUNWIND(clmp)->p_vaddr + base); unwindinfo->dlui_unwindend = - (void *)(PTUNWIND(lmp)->p_vaddr + - PTUNWIND(lmp)->p_memsz + base); - } else if (immap->m_vaddr) { + (void *)(PTUNWIND(clmp)->p_vaddr + + PTUNWIND(clmp)->p_memsz + base); + + } else if (immap->m_vaddr) unwindinfo->dlui_flags |= DLUI_FLG_NOUNWIND; - } else { + else unwindinfo->dlui_flags |= DLUI_FLG_NOUNWIND | DLUI_FLG_NOOBJ; - } } else { /* - * No object found + * No object found. */ unwindinfo->dlui_flags = DLUI_FLG_NOOBJ | DLUI_FLG_NOUNWIND; } @@ -111,18 +114,18 @@ getunwind_core(void * pc, Dl_amd64_unwindinfo *unwindinfo) } #pragma weak dlamd64getunwind = _dlamd64getunwind + Dl_amd64_unwindinfo * -_dlamd64getunwind(void * pc, Dl_amd64_unwindinfo *unwindinfo) +_dlamd64getunwind(void *pc, Dl_amd64_unwindinfo *unwindinfo) { - int entry; - + Rt_map *clmp; + int entry = enter(); - entry = enter(); + clmp = _caller(caller(), CL_NONE); - unwindinfo = getunwind_core(pc, unwindinfo); + unwindinfo = getunwind_core(clmp, pc, unwindinfo); if (entry) - leave(0); - + leave(LIST(clmp)); return (unwindinfo); } diff --git a/usr/src/cmd/sgs/rtld/common/_rtld.h b/usr/src/cmd/sgs/rtld/common/_rtld.h index 233358416d..75f9791d32 100644 --- a/usr/src/cmd/sgs/rtld/common/_rtld.h +++ b/usr/src/cmd/sgs/rtld/common/_rtld.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. @@ -24,7 +23,7 @@ * All Rights Reserved * * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -49,6 +48,7 @@ #include <sgs.h> #include <machdep.h> #include <rtc.h> +#include <debug.h> #include <msg.h> #include <libc_int.h> @@ -299,10 +299,9 @@ typedef struct { /* * Status flags for rtld_flags2 */ -#define RT_FL2_HASAUDIT 0x00000001 /* We have auditing lm_list */ +#define RT_FL2_HASAUDIT 0x00000001 /* auditing lm_list is present */ #define RT_FL2_RTLDSEEN 0x00000002 /* rtldinfo has been set */ -#define RT_FL2_UNIFPROC 0x00000004 /* we're running in libc/libthread */ - /* Unified environment */ +#define RT_FL2_UNIFPROC 0x00000004 /* libc/libthread unified environment */ #define RT_FL2_NOMALIGN 0x00000008 /* mmap MAP_ALIGN isn't available */ #define RT_FL2_NOFLTCFG 0x00000010 /* disable config filter use */ #define RT_FL2_FLTCFG 0x00000020 /* filter config info available */ @@ -494,13 +493,13 @@ extern int alist_delete(Alist *, const void *, Aliste *); extern int alist_test(Alist **, void *, size_t, int); extern int append_alias(Rt_map *, const char *, int *); extern int analyze_lmc(Lm_list *, Aliste, Rt_map *); -extern Am_ret anon_map(caddr_t *, size_t, int, int); +extern Am_ret anon_map(Lm_list *, caddr_t *, size_t, int, int); extern Fct *are_u_this(Rej_desc *, int, struct stat *, const char *); extern void atexit_fini(void); extern int bind_one(Rt_map *, Rt_map *, uint_t); extern int bufprint(Prfbuf *, const char *, ...); -extern void call_array(Addr *, uint_t, Rt_map *, uint_t); +extern void call_array(Addr *, uint_t, Rt_map *, Word); extern void call_fini(Lm_list *, Rt_map **); extern void call_init(Rt_map **, int); extern int callable(Rt_map *, Rt_map *, Grp_hdl *); @@ -508,8 +507,8 @@ extern Rt_map *_caller(caddr_t, int); extern caddr_t caller(void); extern void *calloc(size_t, size_t); extern void cap_assign(Cap *, Rt_map *); -extern const char *_conv_reloc_type_str(uint_t rel); -extern uint_t dbg_setup(const char *); +extern const char *_conv_reloc_type(uint_t rel); +extern uintptr_t dbg_setup(const char *, Dbg_desc *); extern const char *demangle(const char *); extern int dlclose_intn(Grp_hdl *, Rt_map *); extern int dlclose_core(Grp_hdl *, Rt_map *); @@ -521,11 +520,11 @@ extern Grp_hdl *dlmopen_intn(Lm_list *, const char *, int, Rt_map *, extern size_t doprf(const char *, va_list, Prfbuf *); extern int dowrite(Prfbuf *); extern void dz_init(int); -extern caddr_t dz_map(caddr_t, size_t, int, int); +extern caddr_t dz_map(Lm_list *, caddr_t, size_t, int, int); extern int elf_config(Rt_map *, int); extern int elf_mach_flags_check(Rej_desc *, Ehdr *); extern Rtc_obj *elf_config_ent(const char *, Word, int, const char **); -extern Pnode *elf_config_flt(const char *, const char *); +extern Pnode *elf_config_flt(Lm_list *, const char *, const char *); extern ulong_t elf_hash(const char *); extern void elf_reloc_bad(Rt_map *, void *, uchar_t, ulong_t, ulong_t); @@ -534,7 +533,6 @@ extern ulong_t elf_reloc_relative(ulong_t, ulong_t, ulong_t, extern ulong_t elf_reloc_relacount(ulong_t, ulong_t, ulong_t, ulong_t); extern int enter(void); -extern void eprintf(Error, const char *, ...); extern uint_t expand(char **, size_t *, char **, uint_t, uint_t, Rt_map *); extern Pnode *expand_paths(Rt_map *, const char *, uint_t, uint_t); @@ -579,10 +577,10 @@ extern Rt_map *load_path(Lm_list *, Aliste, const char *, Rt_map *, extern Rt_map *load_one(Lm_list *, Aliste, Pnode *, Rt_map *, int, uint_t, Grp_hdl **); extern const char *load_trace(Lm_list *, const char *, Rt_map *); -extern caddr_t nu_map(caddr_t, size_t, int, int); +extern caddr_t nu_map(Lm_list *, caddr_t, size_t, int, int); extern void *malloc(size_t); extern void move_data(Rt_map *); -extern int pr_open(void); +extern int pr_open(Lm_list *); extern void rd_event(Lm_list *, rd_event_e, r_state_e); extern int readenv_user(const char **, Word *, Word *, int); extern int readenv_config(Rtc_env *, Addr, int); @@ -606,9 +604,9 @@ extern int rt_bind_clear(int); extern int rt_mutex_lock(Rt_lock *); extern int rt_mutex_unlock(Rt_lock *); extern thread_t rt_thr_self(void); -extern void rtld_db_dlactivity(void); -extern void rtld_db_preinit(void); -extern void rtld_db_postinit(void); +extern void rtld_db_dlactivity(Lm_list *); +extern void rtld_db_preinit(Lm_list *); +extern void rtld_db_postinit(Lm_list *); extern void rtldexit(Lm_list *, int); extern int rtld_getopt(char **, char ***, auxv_t **, Word *, Word *, int); diff --git a/usr/src/cmd/sgs/rtld/common/a.out.c b/usr/src/cmd/sgs/rtld/common/a.out.c index 044b879d99..b871cda747 100644 --- a/usr/src/cmd/sgs/rtld/common/a.out.c +++ b/usr/src/cmd/sgs/rtld/common/a.out.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -30,6 +30,9 @@ */ #include "_synonyms.h" +#include <a.out.h> /* Explicitly override M_SEGSIZE */ +#include <machdep.h> /* used in M_SROUND */ + #include <sys/mman.h> #include <unistd.h> #include <string.h> @@ -37,11 +40,11 @@ #include <stdio.h> #include <dlfcn.h> #include <errno.h> +#include <debug.h> #include "_a.out.h" #include "cache_a.out.h" #include "msg.h" #include "_rtld.h" -#include "debug.h" /* * Default and secure dependency search paths. @@ -111,7 +114,7 @@ Fct aout_fct = { * filename. */ static Pnode * -aout_fix_name(const char *name) +aout_fix_name(const char *name, Rt_map *clmp) { size_t len; Pnode *pnp; @@ -137,7 +140,7 @@ aout_fix_name(const char *name) if (pnp->p_name) { pnp->p_len = len; pnp->p_orig = PN_SER_NEEDED; - DBG_CALL(Dbg_file_fixname(pnp->p_name, name)); + DBG_CALL(Dbg_file_fixname(LIST(clmp), pnp->p_name, name)); return (pnp); } free(pnp); @@ -232,7 +235,7 @@ aout_needed(Lm_list *lml, Aliste lmco, Rt_map *clmp) name, ((Lnk_obj *)(need))->lo_major, ((Lnk_obj *)(need))->lo_minor); - DBG_CALL(Dbg_libs_find(file)); + DBG_CALL(Dbg_libs_find(lml, file)); /* * We need to determine what filename will match the @@ -258,9 +261,9 @@ aout_needed(Lm_list *lml, Aliste lmco, Rt_map *clmp) break; } if (!path) { - eprintf(ERR_FATAL, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), file, - strerror(ENOENT)); + strerror(ENOENT)); return (0); } name = path; @@ -274,10 +277,11 @@ aout_needed(Lm_list *lml, Aliste lmco, Rt_map *clmp) * it must be fixed to specify the current working * directory (ie. libc.so.1.2 -> ./libc.so.1.2). */ - if ((pnp = aout_fix_name(name)) == 0) + if ((pnp = aout_fix_name(name, clmp)) == 0) return (0); } - DBG_CALL(Dbg_file_needed(name, NAME(clmp))); + + DBG_CALL(Dbg_file_needed(clmp, name)); nlmp = load_one(lml, lmco, pnp, clmp, MODE(clmp), 0, 0); remove_pnode(pnp); @@ -442,7 +446,7 @@ aout_lookup_sym(Slookup *slp, Rt_map **dlmp, uint_t *binfo) char name[PATH_MAX]; Slookup sl = *slp; - DBG_CALL(Dbg_syms_lookup_aout(slp->sl_name)); + DBG_CALL(Dbg_syms_lookup_aout(LIST(slp->sl_imap), slp->sl_name)); if (*sl.sl_name == '_') ++sl.sl_name; @@ -471,7 +475,7 @@ aout_find_sym(Slookup *slp, Rt_map **dlmp, uint_t *binfo) Rt_map *ilmp = slp->sl_imap; struct nlist *sp; - DBG_CALL(Dbg_syms_lookup(name, NAME(ilmp), MSG_ORIG(MSG_STR_AOUT))); + DBG_CALL(Dbg_syms_lookup(ilmp, name, MSG_ORIG(MSG_STR_AOUT))); if (sp = aout_findsb(name, ilmp, slp->sl_flags)) { if (sp->n_value != 0) { @@ -520,7 +524,7 @@ aout_map_so(Lm_list *lml, Aliste lmco, const char *pname, const char *oname, if ((addr = mmap(0, size, (PROT_READ | PROT_EXEC), MAP_PRIVATE, fd, 0)) == MAP_FAILED) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), pname, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), pname, strerror(err)); return (0); } @@ -549,7 +553,7 @@ aout_map_so(Lm_list *lml, Aliste lmco, const char *pname, const char *oname, (int)exec->a_data, (PROT_READ | PROT_WRITE | PROT_EXEC), (MAP_FIXED | MAP_PRIVATE), fd, (off_t)exec->a_text) == MAP_FAILED) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), pname, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), pname, strerror(err)); return (0); } @@ -558,7 +562,7 @@ aout_map_so(Lm_list *lml, Aliste lmco, const char *pname, const char *oname, * Allocate pages for the object's bss, if necessary. */ if (exec->a_bss != 0) { - if (dz_map(addr + M_SROUND(exec->a_text) + exec->a_data, + if (dz_map(lml, addr + M_SROUND(exec->a_text) + exec->a_data, (int)exec->a_bss, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_FIXED | MAP_PRIVATE) == MAP_FAILED) goto error; @@ -592,8 +596,8 @@ aout_new_lm(Lm_list *lml, const char *pname, const char *oname, Rt_map *lmp; caddr_t offset; - DBG_CALL(Dbg_file_aout(pname, (ulong_t)ld, (ulong_t)addr, - (ulong_t)size)); + DBG_CALL(Dbg_file_aout(lml, pname, (ulong_t)ld, (ulong_t)addr, + (ulong_t)size, lml->lm_lmidstr, lmco)); /* * Allocate space for the link-map and private a.out information. Once @@ -700,22 +704,22 @@ aout_new_lm(Lm_list *lml, const char *pname, const char *oname, * on the value of the argument. */ int -aout_set_prot(Rt_map *lm, int permission) +aout_set_prot(Rt_map *lmp, int permission) { int prot; /* protection setting */ caddr_t et; /* cached _etext of object */ size_t size; /* size of text segment */ - DBG_CALL(Dbg_file_prot(NAME(lm), permission)); + DBG_CALL(Dbg_file_prot(lmp, permission)); - et = (caddr_t)ETEXT(lm); - size = M_PROUND((ulong_t)(et - TEXTBASE(lm))); + et = (caddr_t)ETEXT(lmp); + size = M_PROUND((ulong_t)(et - TEXTBASE(lmp))); prot = PROT_READ | PROT_EXEC | permission; - if (mprotect((caddr_t)TEXTBASE(lm), size, prot) == -1) { + if (mprotect((caddr_t)TEXTBASE(lmp), size, prot) == -1) { int err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MPROT), NAME(lm), - strerror(err)); + eprintf(LIST(lmp), ERR_FATAL, MSG_INTL(MSG_SYS_MPROT), + NAME(lmp), strerror(err)); return (0); } return (1); diff --git a/usr/src/cmd/sgs/rtld/common/analyze.c b/usr/src/cmd/sgs/rtld/common/analyze.c index 1b443091cc..4e3d6f4c98 100644 --- a/usr/src/cmd/sgs/rtld/common/analyze.c +++ b/usr/src/cmd/sgs/rtld/common/analyze.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. @@ -24,7 +23,7 @@ * Copyright (c) 1988 AT&T * All Rights Reserved * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -41,12 +40,12 @@ #include <dlfcn.h> #include <errno.h> #include <link.h> +#include <debug.h> +#include <conv.h> #include "_rtld.h" #include "_audit.h" #include "_elf.h" #include "msg.h" -#include "debug.h" -#include "conv.h" static Fct * vector[] = { &elf_fct, @@ -360,7 +359,7 @@ _relocate_lmc(Lm_list *lml, Rt_map *nlmp, int *relocated) else tracing = 0; - DBG_CALL(Dbg_util_nl()); + DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD)); for (ALIST_TRAVERSE(COPY(nlmp), off1, lmpp)) { Rt_map * lmp = *lmpp; @@ -375,8 +374,8 @@ _relocate_lmc(Lm_list *lml, Rt_map *nlmp, int *relocated) * filled memory. */ zero = copy_zerobits(rcp->r_dlmp, rcp->r_dsym); - DBG_CALL(Dbg_reloc_copy(NAME(rcp->r_dlmp), - NAME(nlmp), rcp->r_name, zero)); + DBG_CALL(Dbg_reloc_copy(rcp->r_dlmp, nlmp, + rcp->r_name, zero)); if (zero) continue; @@ -392,7 +391,7 @@ _relocate_lmc(Lm_list *lml, Rt_map *nlmp, int *relocated) } } - DBG_CALL(Dbg_util_nl()); + DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD)); free(COPY(nlmp)); COPY(nlmp) = 0; @@ -860,7 +859,7 @@ trace_so(Rt_map *clmp, Rej_desc *rej, const char *name, const char *path, if (rej) { /* LINTED */ (void) snprintf(_reject, PATH_MAX, - MSG_INTL(ldd_reject[rej->rej_type]), conv_reject_str(rej)); + MSG_INTL(ldd_reject[rej->rej_type]), conv_reject_desc(rej)); if (rej->rej_name) path = rej->rej_name; reject = (char *)_reject; @@ -924,7 +923,7 @@ update_mode(Rt_map *lmp, int omode, int nmode) pmode |= ((~omode & nmode) & (RTLD_GLOBAL | RTLD_WORLD | RTLD_NODELETE)); if (pmode) { - DBG_CALL(Dbg_file_mode_promote(NAME(lmp), pmode)); + DBG_CALL(Dbg_file_mode_promote(lmp, pmode)); MODE(lmp) |= pmode; } @@ -1119,16 +1118,16 @@ file_notfound(Lm_list *lml, const char *name, Rt_map *clmp, uint_t flags, } if (rej->rej_type) { - eprintf(ERR_FATAL, MSG_INTL(err_reject[rej->rej_type]), + eprintf(lml, ERR_FATAL, MSG_INTL(err_reject[rej->rej_type]), rej->rej_name ? rej->rej_name : MSG_INTL(MSG_STR_UNKNOWN), - conv_reject_str(rej)); + conv_reject_desc(rej)); return; } if (secure) - eprintf(ERR_FATAL, MSG_INTL(MSG_SEC_OPEN), name); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SEC_OPEN), name); else - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), name, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), name, strerror(ENOENT)); } @@ -1142,7 +1141,7 @@ file_open(int err, Lm_list *lml, const char *oname, const char *nname, fdesc->fd_oname = oname; if ((err == 0) && (fdesc->fd_flags & FLG_FD_ALTER)) - DBG_CALL(Dbg_file_config_obj(oname, 0, nname)); + DBG_CALL(Dbg_file_config_obj(lml, oname, 0, nname)); /* * If we're dealing with a full pathname, determine whether this @@ -1197,8 +1196,8 @@ file_open(int err, Lm_list *lml, const char *oname, const char *nname, &added) == 0) return (0); if (added) - DBG_CALL(Dbg_file_skip(nname, - NAME(nlmp))); + DBG_CALL(Dbg_file_skip(LIST(nlmp), + NAME(nlmp), nname)); fdesc->fd_nname = nname; fdesc->fd_lmp = nlmp; return (1); @@ -1232,7 +1231,8 @@ file_open(int err, Lm_list *lml, const char *oname, const char *nname, if ((nname[0] == '/') && (fpavl_insert(lml, nlmp, nname, 0) == 0)) return (0); - DBG_CALL(Dbg_file_skip(nname, NAME(nlmp))); + DBG_CALL(Dbg_file_skip(LIST(nlmp), NAME(nlmp), + nname)); } fdesc->fd_nname = nname; fdesc->fd_lmp = nlmp; @@ -1283,7 +1283,7 @@ file_open(int err, Lm_list *lml, const char *oname, const char *nname, if (rej->rej_type) { rej->rej_name = nname; rej->rej_flag = (fdesc->fd_flags & FLG_FD_ALTER); - DBG_CALL(Dbg_file_rejected(rej)); + DBG_CALL(Dbg_file_rejected(lml, rej)); } return (0); } @@ -1329,7 +1329,8 @@ find_path(Lm_list *lml, const char *oname, Rt_map *clmp, uint_t flags, * as optional, fall through to open the * original path. */ - DBG_CALL(Dbg_libs_found(aname, FLG_FD_ALTER)); + DBG_CALL(Dbg_libs_found(lml, aname, + FLG_FD_ALTER)); if (((ret = file_open(0, lml, oname, aname, clmp, flags, fdesc, rej)) != 0) || ((obj->co_flags & RTC_OBJ_OPTINAL) == 0)) @@ -1339,7 +1340,7 @@ find_path(Lm_list *lml, const char *oname, Rt_map *clmp, uint_t flags, } } } - DBG_CALL(Dbg_libs_found(oname, 0)); + DBG_CALL(Dbg_libs_found(lml, oname, 0)); return (file_open(err, lml, oname, oname, clmp, flags, fdesc, rej)); } @@ -1350,7 +1351,7 @@ static int _find_file(Lm_list *lml, const char *oname, const char *nname, Rt_map *clmp, uint_t flags, Fdesc * fdesc, Rej_desc *rej, Pnode * dir, int aflag) { - DBG_CALL(Dbg_libs_found(nname, aflag)); + DBG_CALL(Dbg_libs_found(lml, nname, aflag)); if ((lml->lm_flags & LML_FLG_TRC_SEARCH) && ((FLAGS1(clmp) & FL1_RT_LDDSTUB) == 0)) { (void) printf(MSG_INTL(MSG_LDD_PTH_TRYING), nname, aflag ? @@ -1466,7 +1467,7 @@ find_file(Lm_list *lml, const char *oname, Rt_map *clmp, uint_t flags, * Protect ourselves from building an invalid pathname. */ if ((olen + dir->p_len + 1) >= PATH_MAX) { - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), nname, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), nname, strerror(ENAMETOOLONG)); return (0); } @@ -1720,7 +1721,7 @@ load_so(Lm_list *lml, Aliste lmco, const char *oname, Rt_map *clmp, #if !defined(ISSOLOAD_BASENAME_DISABLED) Rt_map *nlmp; #endif - DBG_CALL(Dbg_libs_find(oname)); + DBG_CALL(Dbg_libs_find(lml, oname)); #if !defined(ISSOLOAD_BASENAME_DISABLED) if ((nlmp = is_so_loaded(lml, oname, 0))) @@ -1824,7 +1825,8 @@ load_trace(Lm_list *lml, const char *name, Rt_map *clmp) * The auditor can indicate that this object should be ignored. */ if ((_name = audit_objsearch(clmp, name, LA_SER_ORIG)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_AUDITERM), name); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_GEN_AUDITERM), + name); return (0); } @@ -2092,7 +2094,7 @@ _load_path(Lm_list *lml, Aliste lmco, const char *name, Rt_map *clmp, _rej.rej_name = name; _rej.rej_type = SGS_REJ_STR; _rej.rej_str = MSG_INTL(MSG_GEN_NOOPEN); - DBG_CALL(Dbg_file_rejected(&_rej)); + DBG_CALL(Dbg_file_rejected(lml, &_rej)); rejection_inherit(rej, &_rej, nfdp); remove_so(lml, nlmp); return (0); @@ -2125,7 +2127,7 @@ _load_path(Lm_list *lml, Aliste lmco, const char *name, Rt_map *clmp, _rej.rej_name = name; _rej.rej_type = SGS_REJ_STR; _rej.rej_str = strerror(ENOENT); - DBG_CALL(Dbg_file_rejected(&_rej)); + DBG_CALL(Dbg_file_rejected(lml, &_rej)); rejection_inherit(rej, &_rej, nfdp); return (0); } @@ -2609,7 +2611,7 @@ lookup_sym(Slookup *slp, Rt_map **dlmp, uint_t *binfo) if ((flags & LKUP_WEAK) || (LIST(lmp)->lm_lazy == 0)) return ((Sym *)0); - DBG_CALL(Dbg_syms_lazy_rescan(name)); + DBG_CALL(Dbg_syms_lazy_rescan(LIST(clmp), name)); /* * If this request originated from a dlsym(RTLD_NEXT) then start @@ -2651,9 +2653,9 @@ lookup_sym(Slookup *slp, Rt_map **dlmp, uint_t *binfo) * an existing descriptor. */ int -bind_one(Rt_map * clmp, Rt_map * dlmp, uint_t flags) +bind_one(Rt_map *clmp, Rt_map *dlmp, uint_t flags) { - Bnd_desc ** bdpp, * bdp; + Bnd_desc **bdpp, *bdp; Aliste off; int found = ALE_CREATE; @@ -2700,7 +2702,7 @@ bind_one(Rt_map * clmp, Rt_map * dlmp, uint_t flags) if (flags & BND_REFER) FLAGS1(dlmp) |= FL1_RT_USED; - DBG_CALL(Dbg_file_bind_entry(bdp)); + DBG_CALL(Dbg_file_bind_entry(LIST(clmp), bdp)); } return (found); } @@ -2711,7 +2713,7 @@ bind_one(Rt_map * clmp, Rt_map * dlmp, uint_t flags) int relocate_finish(Rt_map *lmp, Alist *bound, int textrel, int ret) { - DBG_CALL(Dbg_reloc_run(NAME(lmp), 0, ret, DBG_REL_FINISH)); + DBG_CALL(Dbg_reloc_run(lmp, 0, ret, DBG_REL_FINISH)); /* * Establish bindings to all objects that have been bound to. diff --git a/usr/src/cmd/sgs/rtld/common/audit.c b/usr/src/cmd/sgs/rtld/common/audit.c index 8ab54a11af..d771931e9a 100644 --- a/usr/src/cmd/sgs/rtld/common/audit.c +++ b/usr/src/cmd/sgs/rtld/common/audit.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Audit interfaces. Auditing can be enabled in two ways: @@ -55,7 +55,7 @@ #include <stdarg.h> #include <dlfcn.h> #include <string.h> -#include "debug.h" +#include <debug.h> #include "_rtld.h" #include "_audit.h" #include "_elf.h" @@ -184,7 +184,7 @@ audit_objsearch(Rt_map *clmp, const char *name, uint_t flags) if (appl) rtld_flags &= ~RT_FL_APPLIC; - DBG_CALL(Dbg_libs_audit(name, nname)); + DBG_CALL(Dbg_libs_audit(LIST(clmp), name, nname)); return (nname); } @@ -273,7 +273,8 @@ _audit_objopen(List *list, Rt_map *nlmp, Lmid_t lmid, Audit_info *aip, if (alp->al_objopen == 0) continue; - DBG_CALL(Dbg_audit_object(alp->al_libname, NAME(nlmp))); + DBG_CALL(Dbg_audit_object(LIST(alp->al_lmp), alp->al_libname, + NAME(nlmp))); leave(LIST(alp->al_lmp)); flags = (*alp->al_objopen)((Link_map *)nlmp, lmid, @@ -310,7 +311,7 @@ _audit_objopen(List *list, Rt_map *nlmp, Lmid_t lmid, Audit_info *aip, } int -audit_objopen(Rt_map * clmp, Rt_map * nlmp) +audit_objopen(Rt_map *clmp, Rt_map *nlmp) { Lmid_t lmid = get_linkmap_id(LIST(nlmp)); int appl = 0, respond = 1, ndx = 0; @@ -457,7 +458,7 @@ _audit_pltenter(List *list, Rt_map *rlmp, Rt_map *dlmp, Sym *sym, #endif (void) enter(); - DBG_CALL(Dbg_audit_symval(alp->al_libname, + DBG_CALL(Dbg_audit_symval(LIST(alp->al_lmp), alp->al_libname, MSG_ORIG(MSG_AUD_PLTENTER), name, prev, sym->st_name)); } } @@ -622,7 +623,7 @@ _audit_symbind(List *list, Rt_map *rlmp, Rt_map *dlmp, Sym *sym, uint_t ndx, if ((prev != sym->st_value) && (alp->al_vernum >= LAV_VERSION2)) *flags |= LA_SYMB_ALTVALUE; - DBG_CALL(Dbg_audit_symval(alp->al_libname, + DBG_CALL(Dbg_audit_symval(LIST(alp->al_lmp), alp->al_libname, MSG_ORIG(MSG_AUD_SYMBIND), name, prev, sym->st_value)); } return (sym->st_value); @@ -863,7 +864,8 @@ audit_symget(Audit_list * alp, int info) if (auflag) audit_flags |= auflag; - DBG_CALL(Dbg_audit_interface(alp->al_libname, sname)); + DBG_CALL(Dbg_audit_interface(LIST(alp->al_lmp), + alp->al_libname, sname)); return (addr); } else return (0); @@ -875,7 +877,7 @@ audit_symget(Audit_list * alp, int info) static int audit_disable(char *name, Rt_map *clmp, Grp_hdl *ghp, Audit_list *alp) { - eprintf(ERR_FATAL, MSG_INTL(MSG_AUD_DISABLED), name); + eprintf(LIST(clmp), ERR_FATAL, MSG_INTL(MSG_AUD_DISABLED), name); if (ghp) (void) dlclose_intn(ghp, clmp); if (alp) @@ -892,9 +894,10 @@ int audit_setup(Rt_map *clmp, Audit_desc *adp, uint_t orig) { char *ptr, *next; + Lm_list *clml = LIST(clmp); int error = 1; - DBG_CALL(Dbg_audit_lib(adp->ad_name)); + DBG_CALL(Dbg_audit_lib(clml, adp->ad_name)); /* * Mark that we have at least one auditing link map @@ -921,7 +924,7 @@ audit_setup(Rt_map *clmp, Audit_desc *adp, uint_t orig) error = audit_disable(ptr, clmp, 0, 0); continue; } - lmp = ghp->gh_owner; + lmp = ghp->gh_ownlmp; /* * If this auditor has already been loaded, reuse it. @@ -931,7 +934,7 @@ audit_setup(Rt_map *clmp, Audit_desc *adp, uint_t orig) return (audit_disable(ptr, clmp, ghp, alp)); adp->ad_cnt++; - DBG_CALL(Dbg_audit_version(alp->al_libname, + DBG_CALL(Dbg_audit_version(clml, alp->al_libname, alp->al_vernum)); adp->ad_flags |= alp->al_flags; continue; @@ -968,7 +971,7 @@ audit_setup(Rt_map *clmp, Audit_desc *adp, uint_t orig) */ if ((alp->al_version = (uint_t(*)())audit_symget(alp, AI_LAVERSION)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_NOSYM), + eprintf(LIST(lmp), ERR_FATAL, MSG_INTL(MSG_GEN_NOSYM), MSG_ORIG(MSG_SYM_LAVERSION)); error = audit_disable(ptr, clmp, ghp, alp); continue; @@ -987,7 +990,7 @@ audit_setup(Rt_map *clmp, Audit_desc *adp, uint_t orig) if ((alp->al_vernum < LAV_VERSION1) || (alp->al_vernum > LAV_CURRENT)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_AUD_BADVERS), + eprintf(LIST(lmp), ERR_FATAL, MSG_INTL(MSG_AUD_BADVERS), LAV_CURRENT, alp->al_vernum); error = audit_disable(ptr, clmp, ghp, alp); continue; @@ -997,7 +1000,8 @@ audit_setup(Rt_map *clmp, Audit_desc *adp, uint_t orig) return (audit_disable(ptr, clmp, ghp, alp)); adp->ad_cnt++; - DBG_CALL(Dbg_audit_version(alp->al_libname, alp->al_vernum)); + DBG_CALL(Dbg_audit_version(clml, alp->al_libname, + alp->al_vernum)); /* * Collect any remaining entry points. diff --git a/usr/src/cmd/sgs/rtld/common/cache_a.out.c b/usr/src/cmd/sgs/rtld/common/cache_a.out.c index df6e3c5d95..4b7c1f37b1 100644 --- a/usr/src/cmd/sgs/rtld/common/cache_a.out.c +++ b/usr/src/cmd/sgs/rtld/common/cache_a.out.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright (c) 1999 by Sun Microsystems, Inc. - * All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -120,7 +120,7 @@ ask_db(dbp, file) return (NULL); if (verscmp(file + to_min, &AP(dbp)[ep->dbe_name] + tlop->lo_minor) > 0) - eprintf(ERR_WARNING, MSG_INTL(MSG_GEN_OLDREV), + eprintf(&lml_main, ERR_WARNING, MSG_INTL(MSG_GEN_OLDREV), &AP(dbp)[ep->dbe_name], file + to_min); return (&AP(dbp)[ep->dbe_name]); } @@ -130,7 +130,7 @@ ask_db(dbp, file) * orginated from the mmapped file or temporarily created */ struct db * -lo_cache(const char * ds) +lo_cache(const char *ds) { struct db *dbp; /* database pointer */ struct dbd *dbdp; /* working database descriptor */ @@ -152,7 +152,7 @@ lo_cache(const char * ds) * Build a database for the directory "ds". */ static struct db * -find_so(const char * ds) +find_so(const char *ds) { int fd; /* descriptor on directory */ int n; /* bytes from getdents */ @@ -259,7 +259,7 @@ find_so(const char * ds) } for (ep = &(dbp->db_hash[index]); ep; /* LINTED */ - ep = (struct dbe *) &AP(dbp)[ep->dbe_next]) { + ep = (struct dbe *)&AP(dbp)[ep->dbe_next]) { /* LINTED */ tlop = (struct link_object *) &AP(dbp)[ep->dbe_lop]; @@ -475,10 +475,10 @@ rest_ok(str) * greater than c2p */ static int -verscmp(const char * c1p, const char * c2p) +verscmp(const char *c1p, const char *c2p) { - char * l_c1p = (char *)c1p; /* working copy of c1p */ - char * l_c2p = (char *)c2p; /* working copy of c2p */ + char *l_c1p = (char *)c1p; /* working copy of c1p */ + char *l_c2p = (char *)c2p; /* working copy of c2p */ int l_c1p_ok = 0; /* is c1p a legal string */ int c2p_dig = 0; /* int that c1p currently */ /* represents */ diff --git a/usr/src/cmd/sgs/rtld/common/cap.c b/usr/src/cmd/sgs/rtld/common/cap.c index 9cd0aa1f37..48e2be2fae 100644 --- a/usr/src/cmd/sgs/rtld/common/cap.c +++ b/usr/src/cmd/sgs/rtld/common/cap.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -34,12 +33,11 @@ #include <stdio.h> #include <string.h> #include <limits.h> -#include "conv.h" +#include <debug.h> +#include <conv.h> #include "_rtld.h" #include "_audit.h" -#include "_elf.h" #include "msg.h" -#include "debug.h" /* * qsort(3c) comparison function. @@ -95,7 +93,7 @@ hwcap_check(Rej_desc *rej, Ehdr *ehdr) if ((val = (cptr->c_un.c_val & ~hwcap)) != 0) { rej->rej_type = SGS_REJ_HWCAP_1; - rej->rej_str = conv_hwcap_1_str(val, M_MACH); + rej->rej_str = conv_cap_val_hw1(val, M_MACH); return (0); } @@ -162,7 +160,7 @@ hwcap_dir(Alist **fdalpp, Lm_list *lml, const char *name, Rt_map *clmp, _rej.rej_type = SGS_REJ_STR; _rej.rej_name = name; _rej.rej_str = strerror(errno); - DBG_CALL(Dbg_file_rejected(&_rej)); + DBG_CALL(Dbg_file_rejected(lml, &_rej)); rejection_inherit(rej, &_rej, 0); return (0); } @@ -205,7 +203,7 @@ hwcap_dir(Alist **fdalpp, Lm_list *lml, const char *name, Rt_map *clmp, if (find_path(lml, name, clmp, flags, &fdesc, &_rej) == 0) rejection_inherit(rej, &_rej, &fdesc); else { - DBG_CALL(Dbg_cap_hw_candidate(name)); + DBG_CALL(Dbg_cap_hw_candidate(lml, name)); /* * If this object has already been loaded, obtain the @@ -303,7 +301,7 @@ _hwcap_filtees(Pnode **pnpp, Aliste nlmco, Rt_map *flmp, const char *ref, * relocating. Remove the file descriptor at this point, as it * is no longer required. */ - DBG_CALL(Dbg_file_filtee(NAME(flmp), fdp->fd_nname, 0)); + DBG_CALL(Dbg_file_filtee(lml, NAME(flmp), fdp->fd_nname, 0)); nlmp = load_path(lml, nlmco, fdp->fd_nname, flmp, mode, (flags | FLG_RT_HANDLE), &ghp, fdp, &rej); @@ -398,7 +396,7 @@ _hwcap_filtees(Pnode **pnpp, Aliste nlmco, Rt_map *flmp, const char *ref, */ if (nlmp == 0) { pnp->p_info = 0; - DBG_CALL(Dbg_file_filtee(0, pnp->p_name, audit)); + DBG_CALL(Dbg_file_filtee(lml, 0, pnp->p_name, audit)); if (ghp) (void) dlclose_core(ghp, flmp); @@ -416,8 +414,9 @@ hwcap_filtees(Pnode **pnpp, Aliste nlmco, Dyninfo *dip, Rt_map *flmp, { Pnode *pnp = *pnpp; const char *dir = pnp->p_name; + Lm_list *flml = LIST(flmp); - DBG_CALL(Dbg_cap_hw_filter(dir, NAME(flmp))); + DBG_CALL(Dbg_cap_hw_filter(flml, dir, flmp)); if ((pnp = _hwcap_filtees(pnpp, nlmco, flmp, ref, dir, mode, flags)) != 0) @@ -427,11 +426,11 @@ hwcap_filtees(Pnode **pnpp, Aliste nlmco, Dyninfo *dip, Rt_map *flmp, * If no hardware capability filtees have been found, provide suitable * diagnostics and mark the incoming Pnode as unused. */ - if ((LIST(flmp)->lm_flags & LML_FLG_TRC_ENABLE) && + if ((flml->lm_flags & LML_FLG_TRC_ENABLE) && (dip->di_flags & FLG_DI_AUXFLTR) && (rtld_flags & RT_FL_WARNFLTR)) (void) printf(MSG_INTL(MSG_LDD_HWCAP_NFOUND), dir); - DBG_CALL(Dbg_cap_hw_filter(dir, 0)); + DBG_CALL(Dbg_cap_hw_filter(flml, dir, 0)); pnp = *pnpp; pnp->p_len = 0; diff --git a/usr/src/cmd/sgs/rtld/common/config_elf.c b/usr/src/cmd/sgs/rtld/common/config_elf.c index a4790de8db..5779554023 100644 --- a/usr/src/cmd/sgs/rtld/common/config_elf.c +++ b/usr/src/cmd/sgs/rtld/common/config_elf.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -34,9 +34,9 @@ #include <limits.h> #include <stdio.h> #include <string.h> -#include "rtc.h" -#include "debug.h" -#include "conv.h" +#include <rtc.h> +#include <debug.h> +#include <conv.h> #include "_rtld.h" #include "msg.h" @@ -48,8 +48,9 @@ Config * config = &_config; * Validate a configuration file. */ static void -elf_config_validate(Addr addr, Rtc_head * head, Rt_map * lmp) +elf_config_validate(Addr addr, Rtc_head *head, Rt_map *lmp) { + Lm_list *lml = LIST(lmp); const char *str, *strtbl = config->c_strtbl; Rtc_obj *obj; Rtc_dir *dirtbl; @@ -83,10 +84,11 @@ elf_config_validate(Addr addr, Rtc_head * head, Rt_map * lmp) * the shared object is part of. In this case ignore * any mismatch name warnings. */ - if ((LIST(lmp)->lm_flags & LML_FLG_TRC_ENABLE) && + if ((lml->lm_flags & LML_FLG_TRC_ENABLE) && ((FLAGS1(lmp) & FL1_RT_LDDSTUB) == 0)) { - eprintf(ERR_WARNING, MSG_INTL(MSG_CONF_APP), - config->c_name, _cname); + eprintf(lml, ERR_WARNING, + MSG_INTL(MSG_CONF_APP), config->c_name, + _cname); return; } } @@ -132,7 +134,7 @@ elf_config_validate(Addr addr, Rtc_head * head, Rt_map * lmp) if (stat(str, &status) != 0) { err = errno; - eprintf(ERR_WARNING, MSG_INTL(MSG_CONF_DSTAT), + eprintf(lml, ERR_WARNING, MSG_INTL(MSG_CONF_DSTAT), config->c_name, str, strerror(err)); continue; } @@ -158,8 +160,9 @@ elf_config_validate(Addr addr, Rtc_head * head, Rt_map * lmp) if (stat(str, &status) != 0) { err = errno; - eprintf(ERR_WARNING, MSG_INTL(MSG_CONF_FSTAT), - config->c_name, str, strerror(err)); + eprintf(lml, ERR_WARNING, + MSG_INTL(MSG_CONF_FSTAT), config->c_name, + str, strerror(err)); continue; } @@ -168,15 +171,16 @@ elf_config_validate(Addr addr, Rtc_head * head, Rt_map * lmp) * changed. */ if (status.st_size != obj->co_info) { - eprintf(ERR_WARNING, MSG_INTL(MSG_CONF_FCMP), - config->c_name, str); + eprintf(lml, ERR_WARNING, + MSG_INTL(MSG_CONF_FCMP), config->c_name, + str); } } } } int -elf_config(Rt_map * lmp, int aout) +elf_config(Rt_map *lmp, int aout) { Rtc_head *head; int fd, features = 0; @@ -202,7 +206,7 @@ elf_config(Rt_map * lmp, int aout) char *name; /* - * If we're dealing with an alternative application fabricate + * If we're dealing with an alternative application, fabricate * the need for a $ORIGIN/ld.config.app-name configuration file. */ if (rtld_flags & RT_FL_CONFAPP) { @@ -276,10 +280,10 @@ elf_config(Rt_map * lmp, int aout) #ifndef SGS_PRE_UNIFIED_PROCESS if ((head->ch_cnflags & RTC_HDR_UPM) == 0) { #if defined(_ELF64) - str = conv_upm_string(str, MSG_ORIG(MSG_PTH_USRLIB_64), + str = conv_config_upm(str, MSG_ORIG(MSG_PTH_USRLIB_64), MSG_ORIG(MSG_PTH_LIB_64), MSG_PTH_LIB_64_SIZE); #else - str = conv_upm_string(str, MSG_ORIG(MSG_PTH_USRLIB), + str = conv_config_upm(str, MSG_ORIG(MSG_PTH_USRLIB), MSG_ORIG(MSG_PTH_LIB), MSG_PTH_LIB_SIZE); #endif } @@ -294,11 +298,11 @@ elf_config(Rt_map * lmp, int aout) #ifndef SGS_PRE_UNIFIED_PROCESS if ((head->ch_cnflags & RTC_HDR_UPM) == 0) { #if defined(_ELF64) - str = conv_upm_string(str, + str = conv_config_upm(str, MSG_ORIG(MSG_PTH_USRLIBSE_64), MSG_ORIG(MSG_PTH_LIBSE_64), MSG_PTH_LIBSE_64_SIZE); #else - str = conv_upm_string(str, MSG_ORIG(MSG_PTH_USRLIBSE), + str = conv_config_upm(str, MSG_ORIG(MSG_PTH_USRLIBSE), MSG_ORIG(MSG_PTH_LIBSE), MSG_PTH_LIBSE_SIZE); #endif } @@ -379,7 +383,8 @@ elf_config(Rt_map * lmp, int aout) if (((config->c_bgn <= head->ch_resbgn) && (config->c_bgn >= head->ch_resend)) || - (nu_map((caddr_t)(uintptr_t)head->ch_resbgn, + (nu_map(LIST(lmp), + (caddr_t)(uintptr_t)head->ch_resbgn, (head->ch_resend - head->ch_resbgn), PROT_NONE, MAP_FIXED | MAP_PRIVATE) == MAP_FAILED)) return (-1); @@ -429,7 +434,7 @@ elf_config_ent(const char *name, Word hash, int id, const char **alternate) * a Pnode list. */ Pnode * -elf_config_flt(const char *filter, const char *string) +elf_config_flt(Lm_list *lml, const char *filter, const char *string) { Rtc_fltr * fltrtbl; Pnode * pnp = 0, *npnp, *opnp = 0; @@ -462,7 +467,7 @@ elf_config_flt(const char *filter, const char *string) ((npnp->p_name = strdup(flte)) == 0)) return (0); - DBG_CALL(Dbg_file_filter(fltr, flte, 1)); + DBG_CALL(Dbg_file_filter(lml, fltr, flte, 1)); if (opnp == 0) pnp = npnp; diff --git a/usr/src/cmd/sgs/rtld/common/debug.c b/usr/src/cmd/sgs/rtld/common/debug.c index 2ba8a67cd9..c069456261 100644 --- a/usr/src/cmd/sgs/rtld/common/debug.c +++ b/usr/src/cmd/sgs/rtld/common/debug.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -38,7 +38,7 @@ #include <unistd.h> #include <string.h> #include <thread.h> -#include "debug.h" +#include <debug.h> #include "_rtld.h" #include "_elf.h" #include "msg.h" @@ -53,10 +53,10 @@ static pid_t pid; * Enable diagnostic output. All debugging functions reside in the linker * debugging library liblddbg.so which is lazy loaded when required. */ -uint_t -dbg_setup(const char *options) +uintptr_t +dbg_setup(const char *options, Dbg_desc *dbp) { - uint_t _dbg_mask; + uintptr_t ret; struct stat status; /* @@ -87,8 +87,8 @@ dbg_setup(const char *options) * categories selected. The mask effectively enables calls to the * debugging library. */ - if ((_dbg_mask = Dbg_setup(options)) == (uint_t)S_ERROR) - return (0); + if ((ret = Dbg_setup(options, dbp)) != (uintptr_t)1) + return (ret); /* * If an LD_DEBUG_OUTPUT file was specified then we need to direct all @@ -99,14 +99,14 @@ dbg_setup(const char *options) if (dbg_file) { char file[MAXPATHLEN]; - (void) snprintf(file, MAXPATHLEN, MSG_ORIG(MSG_DBG_FMT_FILE), - dbg_file, (int)getpid()); + (void) snprintf(file, MAXPATHLEN, MSG_ORIG(MSG_DBG_FILE), + dbg_file, getpid()); if ((dbg_fd = open(file, (O_RDWR | O_CREAT), 0666)) == -1) { int err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), file, - strerror(err)); - dbg_mask = 0; + eprintf(&lml_rtld, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), + file, strerror(err)); + dbp->d_class = 0; return (0); } } else { @@ -126,21 +126,53 @@ dbg_setup(const char *options) dbg_ino = status.st_ino; pid = getpid(); - return (_dbg_mask); + return (ret); +} + +static int +dbg_lmid(Lm_list *lml) +{ + const char **str; + Aliste off; + + for (ALIST_TRAVERSE(dbg_desc->d_list, off, str)) { + if (strcmp(lml->lm_lmidstr, *str) == 0) + return (1); + } + return (0); } /* * All diagnostic requests are funneled to this routine. */ -/*PRINTFLIKE1*/ +/* PRINTFLIKE2 */ void -dbg_print(const char *format, ...) +dbg_print(Lm_list *lml, const char *format, ...) { - va_list args; - char buffer[ERRSIZE + 1]; - pid_t _pid; - struct stat status; - Prfbuf prf; + va_list args; + char buffer[ERRSIZE + 1]; + pid_t _pid; + struct stat status; + Prfbuf prf; + + /* + * Knock off any newline indicator to signify that a diagnostic has + * been processed. + */ + dbg_desc->d_extra &= ~DBG_E_STDNL; + + /* + * If debugging has been isolated to individual link-map lists, + * determine whether this request originates from a link-map list that + * is being monitored. Otherwise, process all link-map list diagnostics + * except those that originate from ld.so.1 processing its own + * dependencies. + */ + if (dbg_desc->d_list && lml && lml->lm_lmidstr) { + if (dbg_lmid(lml) == 0) + return; + } else if (lml && (lml->lm_flags & LML_FLG_RTLDLM)) + return; /* * If we're in the application make sure the debugging file descriptor @@ -159,11 +191,10 @@ dbg_print(const char *format, ...) char file[MAXPATHLEN]; (void) snprintf(file, MAXPATHLEN, - MSG_ORIG(MSG_DBG_FMT_FILE), dbg_file, - (int)pid); + MSG_ORIG(MSG_DBG_FILE), dbg_file, pid); if ((dbg_fd = open(file, (O_RDWR | O_APPEND), 0)) == -1) { - dbg_mask = 0; + dbg_desc->d_class = 0; return; } (void) fstat(dbg_fd, &status); @@ -174,40 +205,47 @@ dbg_print(const char *format, ...) * If stderr has been stolen from us simply * turn debugging off. */ - dbg_mask = 0; + dbg_desc->d_class = 0; return; } } } + prf.pr_buf = prf.pr_cur = buffer; + prf.pr_len = ERRSIZE; + prf.pr_fd = dbg_fd; + /* - * The getpid() call is a 'special' interface between ld.so.1 - * and dbx, because of this getpid() can't be called freely - * until after control has been given to the user program. - * Once the control has been given to the user program - * we know that the r_debug structure has been properly - * initialized for the debugger. + * The getpid() call is a 'special' interface between ld.so.1 and dbx, + * because of this getpid() can't be called freely until after control + * has been given to the user program. Once the control has been given + * to the user program we know that the r_debug structure has been + * properly initialized for the debugger. */ if (rtld_flags & RT_FL_APPLIC) _pid = getpid(); else _pid = pid; - prf.pr_buf = prf.pr_cur = buffer; - prf.pr_len = ERRSIZE; - prf.pr_fd = dbg_fd; - - if (rtld_flags & RT_FL_THREADS) - (void) bufprint(&prf, MSG_ORIG(MSG_DBG_FMT_THREAD), _pid, - rt_thr_self()); + if (lml) + (void) bufprint(&prf, MSG_ORIG(MSG_DBG_PID), _pid); else - (void) bufprint(&prf, MSG_ORIG(MSG_DBG_FMT_DIAG), _pid); + (void) bufprint(&prf, MSG_ORIG(MSG_DBG_UNDEF)); + prf.pr_cur--; + + if (DBG_ISLMID() && lml && lml->lm_lmidstr) { + (void) bufprint(&prf, MSG_ORIG(MSG_DBG_LMID), lml->lm_lmidstr); + prf.pr_cur--; + } + if (rtld_flags & RT_FL_THREADS) { + (void) bufprint(&prf, MSG_ORIG(MSG_DBG_THREAD), rt_thr_self()); + prf.pr_cur--; + } /* * Format the message and print it. */ va_start(args, format); - prf.pr_cur--; (void) doprf(format, args, &prf); *(prf.pr_cur - 1) = '\n'; (void) dowrite(&prf); diff --git a/usr/src/cmd/sgs/rtld/common/dlfcns.c b/usr/src/cmd/sgs/rtld/common/dlfcns.c index 5ce9a4a8a3..0409854ac4 100644 --- a/usr/src/cmd/sgs/rtld/common/dlfcns.c +++ b/usr/src/cmd/sgs/rtld/common/dlfcns.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,14 +18,12 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - */ - -/* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -38,17 +35,17 @@ */ #include "_synonyms.h" +#include <sys/debug.h> #include <string.h> #include <dlfcn.h> #include <synch.h> -#include "debug.h" +#include <limits.h> +#include <debug.h> #include "_rtld.h" #include "_audit.h" #include "_elf.h" #include "msg.h" -#include <stdio.h> - /* * Determine who called us - given a pc determine in which object it resides. * @@ -112,9 +109,9 @@ _caller(caddr_t cpc, int flags) char * _dlerror() { - char *error; - Rt_map *clmp; - int entry; + char *error; + Rt_map *clmp; + int entry; entry = enter(); @@ -134,9 +131,9 @@ _dlerror() * is newly created. */ int -hdl_add(Grp_hdl * ghp, Rt_map * lmp, uint_t flags) +hdl_add(Grp_hdl *ghp, Rt_map *lmp, uint_t flags) { - Grp_desc * gdp; + Grp_desc *gdp; Aliste off; int found = ALE_CREATE; @@ -189,8 +186,8 @@ hdl_add(Grp_hdl * ghp, Rt_map * lmp, uint_t flags) Grp_hdl * hdl_alloc() { - Grp_hdl * ghp; - uint_t ndx; + Grp_hdl *ghp; + uint_t ndx; if ((ghp = calloc(sizeof (Grp_hdl), 1)) == 0) return (0); @@ -209,11 +206,11 @@ hdl_alloc() * Create a handle. */ Grp_hdl * -hdl_create(Lm_list * lml, Rt_map * nlmp, Rt_map * clmp, uint_t flags) +hdl_create(Lm_list *lml, Rt_map *nlmp, Rt_map *clmp, uint_t flags) { - Grp_hdl * ghp = 0, ** ghpp; + Grp_hdl *ghp = 0, ** ghpp; uint_t hflags; - Alist ** alpp; + Alist **alpp; Aliste off; /* @@ -277,11 +274,13 @@ hdl_create(Lm_list * lml, Rt_map * nlmp, Rt_map * clmp, uint_t flags) * GLOBAL visibility. */ if (flags & GPH_ZERO) { - ghp->gh_owner = lml->lm_head; + ghp->gh_ownlmp = lml->lm_head; + ghp->gh_ownlml = lml; } else { uint_t hflags = GPD_AVAIL; - ghp->gh_owner = nlmp; + ghp->gh_ownlmp = nlmp; + ghp->gh_ownlml = LIST(nlmp); /* * As an optimization, a handle for ld.so.1 itself @@ -314,7 +313,7 @@ hdl_create(Lm_list * lml, Rt_map * nlmp, Rt_map * clmp, uint_t flags) list_delete(&hdl_list[HDLIST_ORP], ghp); (void) list_append(&hdl_list[ndx], ghp); - if (dbg_mask) { + if (DBG_ENABLED) { Aliste off; Grp_desc * gdp; @@ -413,19 +412,19 @@ hdl_initialize(Grp_hdl *ghp, Rt_map *nlmp, Rt_map *clmp, int mode, int promote) * Sanity check a program-provided handle. */ static int -hdl_validate(Grp_hdl * ghp) +hdl_validate(Grp_hdl *ghp) { - Listnode * lnp; - Grp_hdl * _ghp; + Listnode *lnp; + Grp_hdl *lghp; uint_t ndx; /* LINTED */ ndx = (uintptr_t)ghp % HDLIST_SZ; - for (LIST_TRAVERSE(&hdl_list[ndx], lnp, _ghp)) - if ((_ghp == ghp) && (ghp->gh_refcnt != 0)) + for (LIST_TRAVERSE(&hdl_list[ndx], lnp, lghp)) { + if ((lghp == ghp) && (ghp->gh_refcnt != 0)) return (1); - + } return (0); } @@ -446,7 +445,7 @@ dlclose_core(Grp_hdl *ghp, Rt_map *clmp) * Diagnose what we're up to. */ if (ghp->gh_flags & GPH_ZERO) { - DBG_CALL(Dbg_file_dlclose(MSG_ORIG(MSG_STR_ZERO), + DBG_CALL(Dbg_file_dlclose(LIST(clmp), MSG_ORIG(MSG_STR_ZERO), DBG_DLCLOSE_IGNORE)); } else { Rt_map *olmp; @@ -455,12 +454,12 @@ dlclose_core(Grp_hdl *ghp, Rt_map *clmp) /* * Determine if we've an owner for this handle. */ - if ((olmp = ghp->gh_owner) != 0) + if ((olmp = ghp->gh_ownlmp) != 0) owner = NAME(olmp); else owner = MSG_INTL(MSG_STR_UNKNOWN); - DBG_CALL(Dbg_file_dlclose(owner, DBG_DLCLOSE_NULL)); + DBG_CALL(Dbg_file_dlclose(LIST(clmp), owner, DBG_DLCLOSE_NULL)); } /* @@ -489,11 +488,9 @@ dlclose_core(Grp_hdl *ghp, Rt_map *clmp) int dlclose_intn(Grp_hdl *ghp, Rt_map *clmp) { - Rt_map *nlmp = 0; - Lm_list *olml = 0; - Aliste off; - Grp_desc *gdp; - int error; + Rt_map *nlmp = 0; + Lm_list *olml = 0; + int error; /* * Although we're deleting object(s) it's quite possible that additional @@ -502,14 +499,7 @@ dlclose_intn(Grp_hdl *ghp, Rt_map *clmp) * link-map list as those objects being deleted. Remember this list * for later investigation. */ - if (ghp->gh_owner) - olml = LIST(ghp->gh_owner); - else { - for (ALIST_TRAVERSE(ghp->gh_depends, off, gdp)) { - if ((olml = LIST(gdp->gd_depend)) != 0) - break; - } - } + olml = ghp->gh_ownlml; error = dlclose_core(ghp, clmp); @@ -539,10 +529,10 @@ dlclose_intn(Grp_hdl *ghp, Rt_map *clmp) static int dlclose_check(void *handle, Rt_map *clmp) { - Grp_hdl * ghp = (Grp_hdl *)handle; + Grp_hdl *ghp = (Grp_hdl *)handle; - if (!hdl_validate(ghp)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INVHNDL)); + if (hdl_validate(ghp) == 0) { + eprintf(LIST(clmp), ERR_FATAL, MSG_INTL(MSG_ARG_INVHNDL)); return (1); } return (dlclose_intn(ghp, clmp)); @@ -557,34 +547,52 @@ int _dlclose(void *handle) { int error, entry; - uint_t dbg_save; - Word lmflags; Rt_map *clmp; entry = enter(); clmp = _caller(caller(), CL_EXECDEF); - if ((lmflags = LIST(clmp)->lm_flags) & LML_FLG_RTLDLM) { - dbg_save = dbg_mask; - dbg_mask = 0; - } - error = dlclose_check(handle, clmp); - if (lmflags & LML_FLG_RTLDLM) - dbg_mask = dbg_save; - if (entry) leave(LIST(clmp)); return (error); } +static uint_t lmid = 0; + +/* + * The addition of new link-map lists is assumed to be in small quantities. + * Here, we assign a unique link-map id for diagnostic use. Simply update the + * running link-map count until we max out. + */ +int +newlmid(Lm_list *lml) +{ + char buffer[MSG_LMID_ALT_SIZE + 12]; + + if (lmid == UINT_MAX) { + lml->lm_lmid = UINT_MAX; + (void) strncpy(buffer, MSG_ORIG(MSG_LMID_MAXED), + MSG_LMID_ALT_SIZE + 12); + } else { + lml->lm_lmid = lmid++; + (void) snprintf(buffer, MSG_LMID_ALT_SIZE + 12, + MSG_ORIG(MSG_LMID_FMT), MSG_ORIG(MSG_LMID_ALT), + lml->lm_lmid); + } + if ((lml->lm_lmidstr = strdup(buffer)) == 0) + return (0); + + return (1); +} + /* * Core dlopen activity. */ static Grp_hdl * -dlmopen_core(Lm_list * lml, const char *path, int mode, Rt_map * clmp, +dlmopen_core(Lm_list *lml, const char *path, int mode, Rt_map *clmp, uint_t flags, uint_t orig) { Rt_map *nlmp; @@ -593,8 +601,8 @@ dlmopen_core(Lm_list * lml, const char *path, int mode, Rt_map * clmp, Aliste olmco, nlmco; Lm_cntl *lmc; - DBG_CALL(Dbg_file_dlopen((path ? path : MSG_ORIG(MSG_STR_ZERO)), - NAME(clmp), mode)); + DBG_CALL(Dbg_file_dlopen(clmp, + (path ? path : MSG_ORIG(MSG_STR_ZERO)), mode)); /* * Check for magic link-map list values: @@ -623,7 +631,8 @@ dlmopen_core(Lm_list * lml, const char *path, int mode, Rt_map * clmp, lml->lm_flags |= LML_FLG_NOAUDIT; } - if (list_append(&dynlm_list, lml) == 0) { + if ((list_append(&dynlm_list, lml) == 0) || + (newlmid(lml) == 0)) { free(lml); return (0); } @@ -693,7 +702,7 @@ dlmopen_core(Lm_list * lml, const char *path, int mode, Rt_map * clmp, ((mode & RTLD_FIRST) == 0)) { remove_pnode(pnp); remove_lml(lml); - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_5)); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_5)); return (0); } @@ -771,8 +780,8 @@ Grp_hdl * dlmopen_intn(Lm_list * lml, const char *path, int mode, Rt_map * clmp, uint_t flags, uint_t orig, int *loaded) { - Rt_map * dlmp = 0; - Grp_hdl * ghp; + Rt_map *dlmp = 0; + Grp_hdl *ghp; /* * Determine the link-map that has just been loaded. @@ -785,7 +794,7 @@ dlmopen_intn(Lm_list * lml, const char *path, int mode, Rt_map * clmp, * file (crle(1)). */ if ((mode & RTLD_CONFGEN) == 0) - dlmp = ghp->gh_owner; + dlmp = ghp->gh_ownlmp; } /* @@ -803,14 +812,14 @@ dlmopen_intn(Lm_list * lml, const char *path, int mode, Rt_map * clmp, * Argument checking for dlopen. Only called via external entry. */ static Grp_hdl * -dlmopen_check(Lm_list * lml, const char *path, int mode, Rt_map * clmp, +dlmopen_check(Lm_list *lml, const char *path, int mode, Rt_map *clmp, int *loaded) { /* * Verify that a valid pathname has been supplied. */ if (path && (*path == '\0')) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLPATH)); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLPATH)); return (0); } @@ -820,19 +829,19 @@ dlmopen_check(Lm_list * lml, const char *path, int mode, Rt_map * clmp, * requires a specific pathname, and use of RTLD_PARENT is meaningless. */ if ((mode & (RTLD_NOW | RTLD_LAZY | RTLD_NOLOAD)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_1)); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_1)); return (0); } if ((mode & (RTLD_NOW | RTLD_LAZY)) == (RTLD_NOW | RTLD_LAZY)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_2)); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_2)); return (0); } if ((lml == (Lm_list *)LM_ID_NEWLM) && (path == 0)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_3)); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_3)); return (0); } if ((lml == (Lm_list *)LM_ID_NEWLM) && (mode & RTLD_PARENT)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_4)); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLMODE_4)); return (0); } if (((mode & (RTLD_GROUP | RTLD_WORLD)) == 0) && @@ -856,31 +865,21 @@ dlmopen_check(Lm_list * lml, const char *path, int mode, Rt_map * clmp, void * _dlopen(const char *path, int mode) { - int entry, loaded = 0; - uint_t dbg_save; - Word lmflags; - Rt_map * clmp; - Grp_hdl * ghp; - Lm_list * lml; + int entry, loaded = 0; + Rt_map *clmp; + Grp_hdl *ghp; + Lm_list *lml; entry = enter(); clmp = _caller(caller(), CL_EXECDEF); lml = LIST(clmp); - if ((lmflags = lml->lm_flags) & LML_FLG_RTLDLM) { - dbg_save = dbg_mask; - dbg_mask = 0; - } - ghp = dlmopen_check(lml, path, mode, clmp, &loaded); if (entry && ghp && loaded) unused(lml); - if (lmflags & LML_FLG_RTLDLM) - dbg_mask = dbg_save; - if (entry) leave(lml); return ((void *)ghp); @@ -894,28 +893,18 @@ _dlopen(const char *path, int mode) void * _dlmopen(Lmid_t lmid, const char *path, int mode) { - int entry, loaded = 0; - uint_t dbg_save; - Word lmflags; - Rt_map * clmp; - Grp_hdl * ghp; + int entry, loaded = 0; + Rt_map *clmp; + Grp_hdl *ghp; entry = enter(); clmp = _caller(caller(), CL_EXECDEF); - if ((lmflags = LIST(clmp)->lm_flags) & LML_FLG_RTLDLM) { - dbg_save = dbg_mask; - dbg_mask = 0; - } - ghp = dlmopen_check((Lm_list *)lmid, path, mode, clmp, &loaded); - if (entry && ghp && ghp->gh_owner && loaded) - unused(LIST(ghp->gh_owner)); - - if (lmflags & LML_FLG_RTLDLM) - dbg_mask = dbg_save; + if (entry && ghp && ghp->gh_ownlmp && loaded) + unused(LIST(ghp->gh_ownlmp)); if (entry) leave(LIST(clmp)); @@ -928,7 +917,7 @@ _dlmopen(Lmid_t lmid, const char *path, int mode) Sym * dlsym_handle(Grp_hdl * ghp, Slookup * slp, Rt_map ** _lmp, uint_t *binfo) { - Rt_map *nlmp, * lmp = ghp->gh_owner; + Rt_map *nlmp, * lmp = ghp->gh_ownlmp; Rt_map *clmp = slp->sl_cmap; const char *name = slp->sl_name; Sym *sym = 0; @@ -985,7 +974,7 @@ dlsym_handle(Grp_hdl * ghp, Slookup * slp, Rt_map ** _lmp, uint_t *binfo) * need for elf_lazy_find_sym() to descend the link-maps itself. */ if (LIST(lmp)->lm_lazy) { - DBG_CALL(Dbg_syms_lazy_rescan(name)); + DBG_CALL(Dbg_syms_lazy_rescan(LIST(lmp), name)); sl.sl_flags |= LKUP_NODESCENT; @@ -1028,7 +1017,7 @@ dlsym_handle(Grp_hdl * ghp, Slookup * slp, Rt_map ** _lmp, uint_t *binfo) * attempt to exhaust the search. */ if (LIST(lmp)->lm_lazy) { - DBG_CALL(Dbg_syms_lazy_rescan(name)); + DBG_CALL(Dbg_syms_lazy_rescan(LIST(lmp), name)); for (ALIST_TRAVERSE(ghp->gh_depends, off, gdp)) { nlmp = gdp->gd_depend; @@ -1116,7 +1105,7 @@ dlsym_core(void *handle, const char *name, Rt_map *clmp, Rt_map **dlmp) */ sl.sl_imap = nlmp = (Rt_map *)NEXT(clmp); - DBG_CALL(Dbg_syms_dlsym(name, NAME(clmp), (nlmp ? NAME(nlmp) : + DBG_CALL(Dbg_syms_dlsym(clmp, name, (nlmp ? NAME(nlmp) : MSG_INTL(MSG_STR_NULL)), DBG_DLSYM_NEXT)); if (nlmp == 0) @@ -1129,7 +1118,7 @@ dlsym_core(void *handle, const char *name, Rt_map *clmp, Rt_map **dlmp) /* * If the handle is RTLD_SELF start searching from the caller. */ - DBG_CALL(Dbg_syms_dlsym(name, NAME(clmp), NAME(clmp), + DBG_CALL(Dbg_syms_dlsym(clmp, name, NAME(clmp), DBG_DLSYM_SELF)); sl.sl_imap = clmp; @@ -1143,8 +1132,7 @@ dlsym_core(void *handle, const char *name, Rt_map *clmp, Rt_map **dlmp) * If the handle is RTLD_DEFAULT mimic the standard symbol * lookup as would be triggered by a relocation. */ - DBG_CALL(Dbg_syms_dlsym(name, NAME(clmp), 0, - DBG_DLSYM_DEFAULT)); + DBG_CALL(Dbg_syms_dlsym(clmp, name, 0, DBG_DLSYM_DEFAULT)); sl.sl_imap = hlmp; sl.sl_flags = LKUP_SPEC; @@ -1162,7 +1150,7 @@ dlsym_core(void *handle, const char *name, Rt_map *clmp, Rt_map **dlmp) * loaded to satisfy this request, but no exhaustive lazy load * rescan is carried out. */ - DBG_CALL(Dbg_syms_dlsym(name, NAME(clmp), 0, DBG_DLSYM_PROBE)); + DBG_CALL(Dbg_syms_dlsym(clmp, name, 0, DBG_DLSYM_PROBE)); sl.sl_imap = hlmp; sl.sl_flags = (LKUP_SPEC | LKUP_NOFALBACK); @@ -1175,23 +1163,22 @@ dlsym_core(void *handle, const char *name, Rt_map *clmp, Rt_map **dlmp) * Look in the shared object specified by the handle and in all * of its dependencies. */ - DBG_CALL(Dbg_syms_dlsym(name, NAME(clmp), NAME(ghp->gh_owner), + DBG_CALL(Dbg_syms_dlsym(clmp, name, NAME(ghp->gh_ownlmp), DBG_DLSYM_DEF)); sym = LM_DLSYM(clmp)(ghp, &sl, dlmp, &binfo); } if (sym) { + Lm_list *lml = LIST(clmp); Addr addr = sym->st_value; if (!(FLAGS(*dlmp) & FLG_RT_FIXED)) addr += ADDR(*dlmp); - DBG_CALL(Dbg_bind_global(NAME(clmp), 0, 0, (Xword)-1, - PLT_T_NONE, NAME(*dlmp), (caddr_t)addr, - (caddr_t)sym->st_value, name, binfo)); + DBG_CALL(Dbg_bind_global(clmp, 0, 0, (Xword)-1, PLT_T_NONE, + *dlmp, addr, sym->st_value, name, binfo)); - if ((LIST(clmp)->lm_tflags | FLAGS1(clmp)) & - LML_TFLG_AUD_SYMBIND) { + if ((lml->lm_tflags | FLAGS1(clmp)) & LML_TFLG_AUD_SYMBIND) { uint_t sb_flags = LA_SYMB_DLSYM; /* LINTED */ uint_t symndx = (uint_t)(((Xword)sym - @@ -1211,10 +1198,10 @@ dlsym_core(void *handle, const char *name, Rt_map *clmp, Rt_map **dlmp) void * dlsym_intn(void *handle, const char *name, Rt_map *clmp, Rt_map **dlmp) { - Rt_map * llmp = 0; - void * error; + Rt_map *llmp = 0; + void *error; Aliste off; - Grp_desc * gdp; + Grp_desc *gdp; /* * While looking for symbols it's quite possible that additional objects @@ -1228,8 +1215,8 @@ dlsym_intn(void *handle, const char *name, Rt_map *clmp, Rt_map **dlmp) else { Grp_hdl * ghp = (Grp_hdl *)handle; - if (ghp->gh_owner) - llmp = LIST(ghp->gh_owner)->lm_tail; + if (ghp->gh_ownlmp) + llmp = LIST(ghp->gh_ownlmp)->lm_tail; else { for (ALIST_TRAVERSE(ghp->gh_depends, off, gdp)) { if ((llmp = LIST(gdp->gd_depend)->lm_tail) != 0) @@ -1245,7 +1232,7 @@ dlsym_intn(void *handle, const char *name, Rt_map *clmp, Rt_map **dlmp) */ if (nosym_str == 0) nosym_str = MSG_INTL(MSG_GEN_NOSYM); - eprintf(ERR_FATAL, nosym_str, name); + eprintf(LIST(clmp), ERR_FATAL, nosym_str, name); } load_completion(llmp, clmp); @@ -1263,13 +1250,13 @@ dlsym_check(void *handle, const char *name, Rt_map *clmp, Rt_map **dlmp) * Verify the arguments. */ if (name == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLSYM)); + eprintf(LIST(clmp), ERR_FATAL, MSG_INTL(MSG_ARG_ILLSYM)); return (0); } if ((handle != RTLD_NEXT) && (handle != RTLD_DEFAULT) && (handle != RTLD_SELF) && (handle != RTLD_PROBE) && (hdl_validate((Grp_hdl *)handle) == 0)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INVHNDL)); + eprintf(LIST(clmp), ERR_FATAL, MSG_INTL(MSG_ARG_INVHNDL)); return (0); } return (dlsym_intn(handle, name, clmp, dlmp)); @@ -1285,21 +1272,14 @@ dlsym_check(void *handle, const char *name, Rt_map *clmp, Rt_map **dlmp) void * _dlsym(void *handle, const char *name) { - int entry; - uint_t dbg_save; - Word lmflags; - Rt_map *clmp, *dlmp = 0; - void *addr; + int entry; + Rt_map *clmp, *dlmp = 0; + void *addr; entry = enter(); clmp = _caller(caller(), CL_EXECDEF); - if ((lmflags = LIST(clmp)->lm_flags) & LML_FLG_RTLDLM) { - dbg_save = dbg_mask; - dbg_mask = 0; - } - addr = dlsym_check(handle, name, clmp, &dlmp); if (dlmp) @@ -1308,9 +1288,6 @@ _dlsym(void *handle, const char *name) if (entry && dlmp) is_dep_init(dlmp, clmp); - if (lmflags & LML_FLG_RTLDLM) - dbg_mask = dbg_save; - if (entry) leave(LIST(clmp)); return (addr); @@ -1346,10 +1323,8 @@ dladdr_core(Rt_map *clmp, void *addr, Dl_info *dlip, void **info, int flags) int _dladdr(void *addr, Dl_info *dlip) { - int entry, error; - uint_t dbg_save; - Word lmflags; - Rt_map *clmp; + int entry, error; + Rt_map *clmp; entry = enter(); @@ -1359,18 +1334,11 @@ _dladdr(void *addr, Dl_info *dlip) * indicate the failure. */ if ((clmp = _caller((caddr_t)addr, CL_NONE)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INVADDR), EC_ADDR(addr)); + eprintf(0, ERR_FATAL, MSG_INTL(MSG_ARG_INVADDR), + EC_NATPTR(addr)); error = 0; } else { - if ((lmflags = LIST(clmp)->lm_flags) & LML_FLG_RTLDLM) { - dbg_save = dbg_mask; - dbg_mask = 0; - } - dladdr_core(clmp, addr, dlip, 0, 0); - - if (lmflags & LML_FLG_RTLDLM) - dbg_mask = dbg_save; error = 1; } @@ -1384,10 +1352,8 @@ _dladdr(void *addr, Dl_info *dlip) int _dladdr1(void *addr, Dl_info *dlip, void **info, int flags) { - int entry, error = 0; - uint_t dbg_save; - Word lmflags; - Rt_map *clmp; + int entry, error = 0; + Rt_map *clmp; /* * Validate any flags. @@ -1397,11 +1363,12 @@ _dladdr1(void *addr, Dl_info *dlip, void **info, int flags) if (((request = (flags & RTLD_DL_MASK)) != RTLD_DL_SYMENT) && (request != RTLD_DL_LINKMAP)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLFLAGS), flags); + eprintf(0, ERR_FATAL, MSG_INTL(MSG_ARG_ILLFLAGS), + flags); return (0); } if (info == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLINFO), flags); + eprintf(0, ERR_FATAL, MSG_INTL(MSG_ARG_ILLINFO), flags); return (0); } } @@ -1414,20 +1381,14 @@ _dladdr1(void *addr, Dl_info *dlip, void **info, int flags) * indicate the failure. */ if ((clmp = _caller((caddr_t)addr, CL_NONE)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INVADDR), EC_ADDR(addr)); + eprintf(0, ERR_FATAL, MSG_INTL(MSG_ARG_INVADDR), + EC_NATPTR(addr)); error = 0; } else { - if ((lmflags = LIST(clmp)->lm_flags) & LML_FLG_RTLDLM) { - dbg_save = dbg_mask; - dbg_mask = 0; - } - dladdr_core(clmp, addr, dlip, info, flags); - - if (lmflags & LML_FLG_RTLDLM) - dbg_mask = dbg_save; error = 1; } + if (entry) leave(0); return (error); @@ -1437,43 +1398,50 @@ _dladdr1(void *addr, Dl_info *dlip, void **info, int flags) * Core dldump activity. */ static int -dldump_core(const char *ipath, const char *opath, int flags) +dldump_core(Lm_list *lml, const char *ipath, const char *opath, int flags) { - Addr addr = 0; - Rt_map *lmp; + Addr addr = 0; + Rt_map *lmp; /* * Verify any arguments first. */ if ((!opath || (*opath == '\0')) || (ipath && (*ipath == '\0'))) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLPATH)); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLPATH)); return (1); } /* - * If an input file is specified make sure its one of our dependencies. + * If an input file is specified make sure its one of our dependencies + * on the main link-map list. Note, this has really all evolved for + * crle(), which uses libcrle.so on an alternative link-map to trigger + * dumping objects from the main link-map list. If we ever want to + * dump objects from alternative link-maps, this model is going to + * have to be revisited. */ if (ipath) { if ((lmp = is_so_loaded(&lml_main, ipath, 0)) == 0) lmp = is_so_loaded(&lml_main, ipath, 1); if (lmp == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_NOFILE), ipath); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_GEN_NOFILE), + ipath); return (1); } if (FLAGS(lmp) & FLG_RT_ALTER) { - eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_ALTER), ipath); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_GEN_ALTER), ipath); return (1); } if (FLAGS(lmp) & FLG_RT_NODUMP) { - eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_NODUMP), ipath); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_GEN_NODUMP), + ipath); return (1); } } else lmp = lml_main.lm_head; - DBG_CALL(Dbg_file_dldump(NAME(lmp), opath, flags)); + DBG_CALL(Dbg_file_dldump(lmp, opath, flags)); /* * If the object being dump'ed isn't fixed identify its mapping. @@ -1497,29 +1465,19 @@ dldump_core(const char *ipath, const char *opath, int flags) #pragma weak dldump = _dldump /* - * External entry for dldump(3dl). Returns 0 on success, non-zero otherwise. + * External entry for dldump(3c). Returns 0 on success, non-zero otherwise. */ int _dldump(const char *ipath, const char *opath, int flags) { - int error, entry; - uint_t dbg_save; - Word lmflags; - Rt_map *clmp; + int error, entry; + Rt_map *clmp; entry = enter(); clmp = _caller(caller(), CL_EXECDEF); - if ((lmflags = LIST(clmp)->lm_flags) & LML_FLG_RTLDLM) { - dbg_save = dbg_mask; - dbg_mask = 0; - } - - error = dldump_core(ipath, opath, flags); - - if (lmflags & LML_FLG_RTLDLM) - dbg_mask = dbg_save; + error = dldump_core(LIST(clmp), ipath, opath, flags); if (entry) leave(LIST(clmp)); @@ -1553,10 +1511,11 @@ get_linkmap_id(Lm_list *lml) static int dlinfo_core(void *handle, int request, void *p, Rt_map *clmp) { + Lm_list *lml = LIST(clmp); Rt_map *lmp; if ((request > RTLD_DI_MAX) || (p == 0)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ILLVAL)); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ILLVAL)); return (-1); } @@ -1568,7 +1527,7 @@ dlinfo_core(void *handle, int request, void *p, Rt_map *clmp) if ((config->c_name == 0) || (config->c_bgn == 0) || (config->c_end == 0)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_NOCONFIG)); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_NOCONFIG)); return (-1); } dlip->dli_fname = config->c_name; @@ -1581,7 +1540,7 @@ dlinfo_core(void *handle, int request, void *p, Rt_map *clmp) */ if (request == RTLD_DI_PROFILENAME) { if (profile_name == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_NOPROFNAME)); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_NOPROFNAME)); return (-1); } @@ -1617,7 +1576,7 @@ dlinfo_core(void *handle, int request, void *p, Rt_map *clmp) */ (void) sigfillset(&set); if (sigismember(&set, sig) != 1) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INVSIG), sig); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_INVSIG), sig); return (-1); } @@ -1634,10 +1593,10 @@ dlinfo_core(void *handle, int request, void *p, Rt_map *clmp) Grp_hdl * ghp = (Grp_hdl *)handle; if (!hdl_validate(ghp)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_INVHNDL)); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_INVHNDL)); return (-1); } - lmp = ghp->gh_owner; + lmp = ghp->gh_ownlmp; } /* @@ -1726,13 +1685,14 @@ dlinfo_core(void *handle, int request, void *p, Rt_map *clmp) * there's sufficient space. */ if (size > info->dls_size) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_SERSIZE), + eprintf(lml, ERR_FATAL, + MSG_INTL(MSG_ARG_SERSIZE), EC_OFF(info->dls_size)); return (-1); } if (cnt > info->dls_cnt) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_SERCNT), - info->dls_cnt); + eprintf(lml, ERR_FATAL, + MSG_INTL(MSG_ARG_SERCNT), info->dls_cnt); return (-1); } @@ -1785,24 +1745,14 @@ int _dlinfo(void *handle, int request, void *p) { int error, entry; - uint_t dbg_save; - Word lmflags; Rt_map *clmp; entry = enter(); clmp = _caller(caller(), CL_EXECDEF); - if ((lmflags = LIST(clmp)->lm_flags) & LML_FLG_RTLDLM) { - dbg_save = dbg_mask; - dbg_mask = 0; - } - error = dlinfo_core(handle, request, p, clmp); - if (lmflags & LML_FLG_RTLDLM) - dbg_mask = dbg_save; - if (entry) leave(LIST(clmp)); return (error); diff --git a/usr/src/cmd/sgs/rtld/common/elf.c b/usr/src/cmd/sgs/rtld/common/elf.c index de9f76b7a5..85b840df87 100644 --- a/usr/src/cmd/sgs/rtld/common/elf.c +++ b/usr/src/cmd/sgs/rtld/common/elf.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. @@ -41,12 +40,12 @@ #include <string.h> #include <limits.h> #include <dlfcn.h> -#include "conv.h" +#include <debug.h> +#include <conv.h> #include "_rtld.h" #include "_audit.h" #include "_elf.h" #include "msg.h" -#include "debug.h" /* * Default and secure dependency search paths. @@ -142,7 +141,8 @@ elf_fix_name(const char *name, Rt_map *clmp, uint_t orig) (strcmp(name, MSG_ORIG(MSG_FIL_RTLD)) == 0)) { Pnode *pnp; - DBG_CALL(Dbg_file_fixname(name, MSG_ORIG(MSG_PTH_LIBSYS))); + DBG_CALL(Dbg_file_fixname(LIST(clmp), name, + MSG_ORIG(MSG_PTH_LIBSYS))); if (((pnp = calloc(sizeof (Pnode), 1)) == 0) || ((pnp->p_name = strdup(MSG_ORIG(MSG_PTH_LIBSYS))) == 0)) { if (pnp) @@ -299,7 +299,7 @@ elf_lazy_load(Rt_map *clmp, uint_t ndx, const char *sym) * dependencies processing has initiated. */ name = STRTAB(clmp) + DYN(clmp)[ndx].d_un.d_val; - DBG_CALL(Dbg_file_lazyload(name, NAME(clmp), sym)); + DBG_CALL(Dbg_file_lazyload(clmp, name, sym)); if (lml->lm_flags & LML_FLG_TRC_ENABLE) dip->di_flags |= FLG_DI_PROCESSD; @@ -467,6 +467,7 @@ elf_verify_vers(const char *name, Rt_map *clmp, Rt_map *nlmp) * Traverse the callers version needed information and determine if any * specific versions are required from the dependency. */ + DBG_CALL(Dbg_ver_need_title(LIST(clmp), NAME(clmp))); for (_num = 1; _num <= num; _num++, vnd = (Verneed *)((Xword)vnd + vnd->vn_next)) { Half cnt = vnd->vn_cnt; @@ -480,7 +481,6 @@ elf_verify_vers(const char *name, Rt_map *clmp, Rt_map *nlmp) if (strcmp(name, need) != 0) continue; - DBG_CALL(Dbg_ver_need_title(NAME(clmp))); if ((lml->lm_flags & LML_FLG_TRC_VERBOSE) && ((FLAGS1(clmp) & FL1_RT_LDDSTUB) == 0)) (void) printf(MSG_INTL(MSG_LDD_VER_FIND), name); @@ -499,7 +499,7 @@ elf_verify_vers(const char *name, Rt_map *clmp, Rt_map *nlmp) int found = 0; version = (char *)(cstrs + vnap->vna_name); - DBG_CALL(Dbg_ver_need_entry(0, need, version)); + DBG_CALL(Dbg_ver_need_entry(lml, 0, need, version)); for (_num = 1; _num <= num; _num++, vdf = (Verdef *)((Xword)vdf + vdf->vd_next)) { @@ -552,13 +552,14 @@ elf_verify_vers(const char *name, Rt_map *clmp, Rt_map *nlmp) */ if ((found == 0) && (num != 0) && (!(vnap->vna_flags & VER_FLG_WEAK))) { - eprintf(ERR_FATAL, MSG_INTL(MSG_VER_NFOUND), - need, version, NAME(clmp)); + eprintf(lml, ERR_FATAL, + MSG_INTL(MSG_VER_NFOUND), need, version, + NAME(clmp)); return (0); } } - return (1); } + DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD)); return (1); } @@ -668,7 +669,7 @@ elf_needed(Lm_list *lml, Aliste lmco, Rt_map *clmp) continue; } - DBG_CALL(Dbg_file_needed(name, NAME(clmp))); + DBG_CALL(Dbg_file_needed(clmp, name)); if (lml->lm_flags & LML_FLG_TRC_ENABLE) dip->di_flags |= FLG_DI_PROCESSD; @@ -711,7 +712,7 @@ elf_needed(Lm_list *lml, Aliste lmco, Rt_map *clmp) } static int -elf_map_check(const char *name, caddr_t vaddr, Off size) +elf_map_check(Lm_list *lml, const char *name, caddr_t vaddr, Off size) { prmap_t *maps, *_maps; int pfd, num, _num; @@ -734,12 +735,13 @@ elf_map_check(const char *name, caddr_t vaddr, Off size) /* * Determine the mappings presently in use by this process. */ - if ((pfd = pr_open()) == FD_UNAVAIL) + if ((pfd = pr_open(lml)) == FD_UNAVAIL) return (1); if (ioctl(pfd, PIOCNMAP, (void *)&num) == -1) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_PROC), name, strerror(err)); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_PROC), name, + strerror(err)); return (1); } @@ -748,7 +750,8 @@ elf_map_check(const char *name, caddr_t vaddr, Off size) if (ioctl(pfd, PIOCMAP, (void *)maps) == -1) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_PROC), name, strerror(err)); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_PROC), name, + strerror(err)); free(maps); return (1); } @@ -775,8 +778,8 @@ elf_map_check(const char *name, caddr_t vaddr, Off size) else str = MSG_INTL(MSG_STR_UNKNOWN); - eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_MAPINUSE), name, - EC_ADDR(vaddr), EC_OFF(size), str); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_GEN_MAPINUSE), name, + EC_NATPTR(vaddr), EC_OFF(size), str); return (1); } free(maps); @@ -790,8 +793,8 @@ elf_map_check(const char *name, caddr_t vaddr, Off size) * reservation using the file as backing. */ static Am_ret -elf_map_reserve(const char *name, caddr_t *maddr, Off msize, int mperm, - int fd, Xword align) +elf_map_reserve(Lm_list *lml, const char *name, caddr_t *maddr, Off msize, + int mperm, int fd, Xword align) { Am_ret amret; int mflag = MAP_PRIVATE | MAP_NORESERVE; @@ -802,7 +805,7 @@ elf_map_reserve(const char *name, caddr_t *maddr, Off msize, int mperm, *maddr = (caddr_t)align; } #endif - if ((amret = anon_map(maddr, msize, PROT_NONE, mflag)) == AM_ERROR) + if ((amret = anon_map(lml, maddr, msize, PROT_NONE, mflag)) == AM_ERROR) return (amret); if (amret == AM_OK) @@ -817,7 +820,8 @@ elf_map_reserve(const char *name, caddr_t *maddr, Off msize, int mperm, if ((*maddr = mmap(*maddr, msize, mperm, MAP_PRIVATE, fd, 0)) == MAP_FAILED) { int err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), name, strerror(err)); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), name, + strerror(err)); return (AM_ERROR); } return (AM_NOSUP); @@ -864,6 +868,7 @@ elf_map_textdata(caddr_t addr, Off flen, int mperm, int phdr_mperm, int mflag, */ static caddr_t elf_map_it( + Lm_list *lml, /* link-map list */ const char *name, /* actual name stored for pathname */ Off fsize, /* total mapping claim of the file */ Ehdr *ehdr, /* ELF header of file */ @@ -934,7 +939,7 @@ elf_map_it( rsize = fsize + padpsize + padsize; if (lml_main.lm_head) { - if (elf_map_check(name, raddr, rsize) != 0) + if (elf_map_check(lml, name, raddr, rsize) != 0) return (0); } @@ -963,7 +968,7 @@ elf_map_it( * be remapped. */ rsize = fsize + padmsize + padsize; - if ((amret = elf_map_reserve(name, &raddr, rsize, mperm, + if ((amret = elf_map_reserve(lml, name, &raddr, rsize, mperm, fd, align)) == AM_ERROR) return (0); maddr = raddr + padmsize; @@ -989,8 +994,8 @@ elf_map_it( (void) munmap(raddr, rsize); rsize += align; - if ((amret = elf_map_reserve(name, &raddr, rsize, mperm, - fd, align)) == AM_ERROR) + if ((amret = elf_map_reserve(lml, name, &raddr, rsize, + mperm, fd, align)) == AM_ERROR) return (0); maddr = faddr = (caddr_t)S_ROUND((Off)(raddr + @@ -1047,8 +1052,9 @@ elf_map_it( */ if (padsize) { if (amret == AM_NOSUP) { - if (dz_map(raddr, padpsize, PROT_NONE, (MAP_PRIVATE | - MAP_FIXED | MAP_NORESERVE)) == MAP_FAILED) + if (dz_map(lml, raddr, padpsize, PROT_NONE, + (MAP_PRIVATE | MAP_FIXED | MAP_NORESERVE)) == + MAP_FAILED) return (0); skipfseg = 0; @@ -1123,7 +1129,7 @@ elf_map_it( * processed. The segment reservation is mapped * directly from /dev/null. */ - if (nu_map((caddr_t)addr, phdr->p_memsz, PROT_NONE, + if (nu_map(lml, (caddr_t)addr, phdr->p_memsz, PROT_NONE, MAP_FIXED | MAP_PRIVATE) == MAP_FAILED) return (0); @@ -1135,7 +1141,7 @@ elf_map_it( * If this segment has no backing file then it defines a * nobits segment and is mapped directly from /dev/zero. */ - if (dz_map((caddr_t)addr, phdr->p_memsz, mperm, + if (dz_map(lml, (caddr_t)addr, phdr->p_memsz, mperm, MAP_FIXED | MAP_PRIVATE) == MAP_FAILED) return (0); @@ -1176,7 +1182,7 @@ elf_map_it( (MAP_FIXED | MAP_PRIVATE), fd, foff) == MAP_FAILED) { int err = errno; - eprintf(ERR_FATAL, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), name, strerror(err)); return (0); @@ -1219,7 +1225,8 @@ elf_map_it( zero((caddr_t)foff, (long)zplen); if ((zlen = (fend - (Off)zaddr)) > 0) { - if (dz_map(zaddr, zlen, mperm, + if (dz_map(lml, zaddr, zlen, + mperm, MAP_FIXED | MAP_PRIVATE) == MAP_FAILED) return (0); @@ -1261,8 +1268,9 @@ elf_map_it( * maddr is currently page aligned from the last segment * mapping. */ - if (dz_map(maddr, padsize, PROT_NONE, (MAP_PRIVATE | - MAP_FIXED | MAP_NORESERVE)) == MAP_FAILED) + if (dz_map(lml, maddr, padsize, PROT_NONE, + (MAP_PRIVATE | MAP_FIXED | MAP_NORESERVE)) == + MAP_FAILED) return (0); } maddr += padsize; @@ -1357,13 +1365,13 @@ _elf_lookup_filtee(Slookup *slp, Rt_map **dlmp, uint_t *binfo, uint_t ndx) Word tracing = (LIST(clmp)->lm_flags & (LML_FLG_TRC_UNREF | LML_FLG_TRC_UNUSED)); - if (tracing || dbg_mask) { + if (tracing || DBG_ENABLED) { Bnd_desc ** bdpp; Aliste off; FLAGS1(ilmp) |= FL1_RT_USED; - if ((tracing & LML_FLG_TRC_UNREF) || dbg_mask) { + if ((tracing & LML_FLG_TRC_UNREF) || DBG_ENABLED) { for (ALIST_TRAVERSE(CALLERS(ilmp), off, bdpp)) { Bnd_desc * bdp = *bdpp; @@ -1386,10 +1394,11 @@ _elf_lookup_filtee(Slookup *slp, Rt_map **dlmp, uint_t *binfo, uint_t ndx) filtees = (char *)STRTAB(ilmp) + DYN(ilmp)[ndx].d_un.d_val; if (dip->di_info == 0) { if (rtld_flags2 & RT_FL2_FLTCFG) - dip->di_info = elf_config_flt(PATHNAME(ilmp), filtees); + dip->di_info = elf_config_flt(lml, PATHNAME(ilmp), + filtees); if (dip->di_info == 0) { - DBG_CALL(Dbg_file_filter(NAME(ilmp), filtees, 0)); + DBG_CALL(Dbg_file_filter(lml, NAME(ilmp), filtees, 0)); if ((lml->lm_flags & (LML_FLG_TRC_VERBOSE | LML_FLG_TRC_SEARCH)) && ((FLAGS1(ilmp) & FL1_RT_LDDSTUB) == 0)) @@ -1478,7 +1487,7 @@ _elf_lookup_filtee(Slookup *slp, Rt_map **dlmp, uint_t *binfo, uint_t ndx) const char *filtee = pnp->p_name; int audit = 0; - DBG_CALL(Dbg_file_filtee(NAME(ilmp), filtee, 0)); + DBG_CALL(Dbg_file_filtee(lml, NAME(ilmp), filtee, 0)); ghp = 0; @@ -1620,7 +1629,8 @@ _elf_lookup_filtee(Slookup *slp, Rt_map **dlmp, uint_t *binfo, uint_t ndx) */ if (nlmp == 0) { pnp->p_info = 0; - DBG_CALL(Dbg_file_filtee(0, filtee, audit)); + DBG_CALL(Dbg_file_filtee(lml, 0, filtee, + audit)); if (ghp) (void) dlclose_core(ghp, ilmp); @@ -1700,7 +1710,7 @@ _elf_lookup_filtee(Slookup *slp, Rt_map **dlmp, uint_t *binfo, uint_t ndx) * If this object is tagged to terminate filtee processing we're * done. */ - if (FLAGS1(ghp->gh_owner) & FL1_RT_ENDFILTE) + if (FLAGS1(ghp->gh_ownlmp) & FL1_RT_ENDFILTE) break; } @@ -1835,10 +1845,8 @@ elf_find_sym(Slookup *slp, Rt_map **dlmp, uint_t *binfo) * If we're only here to establish a symbols index, skip the diagnostic * used to trace a symbol search. */ - if ((slp->sl_flags & LKUP_SYMNDX) == 0) { - DBG_CALL(Dbg_syms_lookup(name, NAME(ilmp), - MSG_ORIG(MSG_STR_ELF))); - } + if ((slp->sl_flags & LKUP_SYMNDX) == 0) + DBG_CALL(Dbg_syms_lookup(ilmp, name, MSG_ORIG(MSG_STR_ELF))); if (HASH(ilmp) == 0) return ((Sym *)0); @@ -2015,8 +2023,8 @@ elf_new_lm(Lm_list *lml, const char *pname, const char *oname, Dyn *ld, Xword rpath = 0; Ehdr *ehdr = (Ehdr *)addr; - DBG_CALL(Dbg_file_elf(pname, (ulong_t)ld, addr, msize, entry, - get_linkmap_id(lml), lmco)); + DBG_CALL(Dbg_file_elf(lml, pname, (ulong_t)ld, addr, msize, entry, + lml->lm_lmidstr, lmco)); /* * Allocate space for the link-map and private elf information. Once @@ -2292,7 +2300,7 @@ elf_new_lm(Lm_list *lml, const char *pname, const char *oname, Dyn *ld, if ((lml->lm_flags & LML_FLG_STARTREL) == 0) FLAGS(lmp) |= FLG_RT_INTRPOSE; else { - DBG_CALL(Dbg_util_intoolate(NAME(lmp))); + DBG_CALL(Dbg_util_intoolate(lmp)); if (lml->lm_flags & LML_FLG_TRC_ENABLE) (void) printf( MSG_INTL(MSG_LDD_REL_ERR2), @@ -2316,9 +2324,7 @@ elf_new_lm(Lm_list *lml, const char *pname, const char *oname, Dyn *ld, case DT_SUNW_RTLDINF: if ((lml->lm_info_lmp != 0) && (lml->lm_info_lmp != lmp)) { - DBG_CALL(Dbg_unused_rtldinfo( - NAME(lmp), - NAME(lml->lm_info_lmp))); + DBG_CALL(Dbg_unused_rtldinfo(lmp)); break; } lml->lm_info_lmp = lmp; @@ -2534,8 +2540,8 @@ elf_map_so(Lm_list *lml, Aliste lmco, const char *pname, const char *oname, else if (etype == ET_DYN) fixed = 0; else { - eprintf(ERR_ELF, MSG_INTL(MSG_GEN_BADTYPE), pname, - conv_etype_str(etype)); + eprintf(lml, ERR_ELF, MSG_INTL(MSG_GEN_BADTYPE), pname, + conv_ehdr_type(etype)); return (0); } @@ -2546,7 +2552,7 @@ elf_map_so(Lm_list *lml, Aliste lmco, const char *pname, const char *oname, size = (size_t)((char *)ehdr->e_phoff + (ehdr->e_phnum * ehdr->e_phentsize)); if (size > fmap->fm_fsize) { - eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_CORTRUNC), pname); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_GEN_CORTRUNC), pname); return (0); } if (size > fmap->fm_msize) { @@ -2554,7 +2560,7 @@ elf_map_so(Lm_list *lml, Aliste lmco, const char *pname, const char *oname, if ((fmap->fm_maddr = mmap(fmap->fm_maddr, size, PROT_READ, fmap->fm_mflags, fd, 0)) == MAP_FAILED) { int err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), pname, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), pname, strerror(err)); return (0); } @@ -2582,8 +2588,8 @@ elf_map_so(Lm_list *lml, Aliste lmco, const char *pname, const char *oname, fph = pptr; /* LINTED argument lph is initialized in first pass */ } else if (pptr->p_vaddr <= lph->p_vaddr) { - eprintf(ERR_ELF, MSG_INTL(MSG_GEN_INVPRGHDR), - pname); + eprintf(lml, ERR_ELF, + MSG_INTL(MSG_GEN_INVPRGHDR), pname); return (0); } @@ -2621,7 +2627,7 @@ elf_map_so(Lm_list *lml, Aliste lmco, const char *pname, const char *oname, * specified file and memory size. */ if ((fph == 0) || (lmph == 0) || (lfph == 0)) { - eprintf(ERR_ELF, MSG_INTL(MSG_GEN_NOLOADSEG), pname); + eprintf(lml, ERR_ELF, MSG_INTL(MSG_GEN_NOLOADSEG), pname); return (0); } @@ -2631,7 +2637,7 @@ elf_map_so(Lm_list *lml, Aliste lmco, const char *pname, const char *oname, * bus errors if we're given a truncated file). */ if (fmap->fm_fsize < ((size_t)lfph->p_offset + lfph->p_filesz)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_CORTRUNC), pname); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_GEN_CORTRUNC), pname); return (0); } @@ -2717,7 +2723,7 @@ elf_map_so(Lm_list *lml, Aliste lmco, const char *pname, const char *oname, /* * Map the file. */ - if (!(faddr = elf_map_it(pname, memsize, ehdr, fph, lph, + if (!(faddr = elf_map_it(lml, pname, memsize, ehdr, fph, lph, &phdr, &paddr, &plen, fixed, fd, align, mmaps, &mmapcnt))) return (0); } @@ -2785,7 +2791,7 @@ elf_map_so(Lm_list *lml, Aliste lmco, const char *pname, const char *oname, * on the value of the argument. */ int -elf_set_prot(Rt_map * lmp, int permission) +elf_set_prot(Rt_map *lmp, int permission) { Mmap *mmaps; @@ -2796,7 +2802,7 @@ elf_set_prot(Rt_map * lmp, int permission) if (FLAGS(lmp) & FLG_RT_IMGALLOC) return (1); - DBG_CALL(Dbg_file_prot(NAME(lmp), permission)); + DBG_CALL(Dbg_file_prot(lmp, permission)); for (mmaps = MMAPS(lmp); mmaps->m_vaddr; mmaps++) { if (mmaps->m_perm & PROT_WRITE) @@ -2805,7 +2811,7 @@ elf_set_prot(Rt_map * lmp, int permission) if (mprotect(mmaps->m_vaddr, mmaps->m_msize, (mmaps->m_perm | permission)) == -1) { int err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MPROT), + eprintf(LIST(lmp), ERR_FATAL, MSG_INTL(MSG_SYS_MPROT), NAME(lmp), strerror(err)); return (0); } @@ -2885,7 +2891,7 @@ elf_copy_reloc(char *name, Sym *rsym, Rt_map *rlmp, void *radd, Sym *dsym, if (lml->lm_flags & LML_FLG_TRC_WARN) { if (rsym->st_size != dsym->st_size) { (void) printf(MSG_INTL(MSG_LDD_CPY_SIZDIF), - _conv_reloc_type_str(M_R_COPY), demangle(name), + _conv_reloc_type(M_R_COPY), demangle(name), NAME(rlmp), EC_XWORD(rsym->st_size), NAME(dlmp), EC_XWORD(dsym->st_size)); if (rsym->st_size > dsym->st_size) @@ -2898,12 +2904,13 @@ elf_copy_reloc(char *name, Sym *rsym, Rt_map *rlmp, void *radd, Sym *dsym, if (ELF_ST_VISIBILITY(dsym->st_other) == STV_PROTECTED) { (void) printf(MSG_INTL(MSG_LDD_CPY_PROT), - _conv_reloc_type_str(M_R_COPY), demangle(name), + _conv_reloc_type(M_R_COPY), demangle(name), NAME(dlmp)); } } - DBG_CALL(Dbg_reloc_apply((Xword)radd, (Xword)rc.r_size)); + DBG_CALL(Dbg_reloc_apply_val(lml, ELF_DBG_RTLD, (Xword)radd, + (Xword)rc.r_size)); return (1); } @@ -3132,16 +3139,17 @@ elf_reloc_bad(Rt_map *lmp, void *rel, uchar_t rtype, ulong_t roffset, ulong_t rsymndx) { const char *name = (char *)0; + Lm_list *lml = LIST(lmp); int trace; - if ((LIST(lmp)->lm_flags & LML_FLG_TRC_ENABLE) && + if ((lml->lm_flags & LML_FLG_TRC_ENABLE) && (((rtld_flags & RT_FL_SILENCERR) == 0) || - (LIST(lmp)->lm_flags & LML_FLG_TRC_VERBOSE))) + (lml->lm_flags & LML_FLG_TRC_VERBOSE))) trace = 1; else trace = 0; - if ((trace == 0) && (dbg_mask == 0)) + if ((trace == 0) && (DBG_ENABLED == 0)) return; if (rsymndx) { @@ -3158,12 +3166,11 @@ elf_reloc_bad(Rt_map *lmp, void *rel, uchar_t rtype, ulong_t roffset, if (trace) { const char *rstr; - rstr = _conv_reloc_type_str((uint_t)rtype); + rstr = _conv_reloc_type((uint_t)rtype); (void) printf(MSG_INTL(MSG_LDD_REL_ERR1), rstr, name, EC_ADDR(roffset)); return; } - Dbg_reloc_error(M_MACH, M_REL_SHT_TYPE, rel, name, - MSG_ORIG(MSG_REL_BADROFFSET)); + Dbg_reloc_error(lml, ELF_DBG_RTLD, M_MACH, M_REL_SHT_TYPE, rel, name); } diff --git a/usr/src/cmd/sgs/rtld/common/globals.c b/usr/src/cmd/sgs/rtld/common/globals.c index 05fe816cd8..cf917ae5e7 100644 --- a/usr/src/cmd/sgs/rtld/common/globals.c +++ b/usr/src/cmd/sgs/rtld/common/globals.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. @@ -24,7 +23,7 @@ * All Rights Reserved * * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -34,6 +33,7 @@ #include <signal.h> #include <dlfcn.h> #include <synch.h> +#include <debug.h> #include "_rtld.h" /* @@ -136,7 +136,14 @@ const char *prm_preload = 0; /* permanent LD_PRELOAD string */ uint_t env_info = 0; /* information regarding environment */ /* variables */ int killsig = SIGKILL; /* signal sent on fatal exit */ -uint_t dbg_mask; /* debugging classes */ + +/* + * Note, the debugging descriptor interposes on the default definition provided + * by liblddbg. This is required as ld.so.1 must only have outstanding relative + * relocations. + */ +static Dbg_desc _dbg_desc = {0, 0, 0}; +Dbg_desc *dbg_desc = &_dbg_desc; /* debugging descriptor */ const char *dbg_file = 0; /* debugging directed to file */ #pragma weak environ = _environ /* environ for PLT tracing - we */ diff --git a/usr/src/cmd/sgs/rtld/common/malloc.c b/usr/src/cmd/sgs/rtld/common/malloc.c index 5189291e29..5638ff9112 100644 --- a/usr/src/cmd/sgs/rtld/common/malloc.c +++ b/usr/src/cmd/sgs/rtld/common/malloc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -200,7 +199,7 @@ found: size_t totpage = align(totsize, syspagsz); /* LINTED */ - if ((page = (struct page *)dz_map(0, totpage, + if ((page = (struct page *)dz_map(0, 0, totpage, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE)) == (struct page *)-1) return (0); diff --git a/usr/src/cmd/sgs/rtld/common/mapfile-32-vers b/usr/src/cmd/sgs/rtld/common/mapfile-32-vers new file mode 100644 index 0000000000..a3fa8e059c --- /dev/null +++ b/usr/src/cmd/sgs/rtld/common/mapfile-32-vers @@ -0,0 +1,33 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +SUNWprivate_1.2 { + global: + do32_reloc; # Required to support librtld.so + reloc32_table; +}; diff --git a/usr/src/cmd/sgs/rtld/common/mapfile-64-vers b/usr/src/cmd/sgs/rtld/common/mapfile-64-vers new file mode 100644 index 0000000000..7faa4a5cee --- /dev/null +++ b/usr/src/cmd/sgs/rtld/common/mapfile-64-vers @@ -0,0 +1,33 @@ +# +# CDDL HEADER START +# +# The contents of this file are subject to the terms of the +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. +# +# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE +# or http://www.opensolaris.org/os/licensing. +# See the License for the specific language governing permissions +# and limitations under the License. +# +# When distributing Covered Code, include this CDDL HEADER in each +# file and include the License file at usr/src/OPENSOLARIS.LICENSE. +# If applicable, add the following below this CDDL HEADER, with the +# fields enclosed by brackets "[]" replaced with your own identifying +# information: Portions Copyright [yyyy] [name of copyright owner] +# +# CDDL HEADER END +# + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# + +SUNWprivate_1.2 { + global: + do64_reloc; # Required to support librtld.so + reloc64_table; +}; diff --git a/usr/src/cmd/sgs/rtld/common/mapfile-order-devpro b/usr/src/cmd/sgs/rtld/common/mapfile-order-devpro index 9d2e992b8c..95f8df5e4d 100644 --- a/usr/src/cmd/sgs/rtld/common/mapfile-order-devpro +++ b/usr/src/cmd/sgs/rtld/common/mapfile-order-devpro @@ -1,15 +1,9 @@ # -#pragma ident "%Z%%M% %I% %E% SMI" -# -# 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. +# 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. @@ -24,6 +18,13 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# # Note: This mapfile is used to place r_debug as the # very first data item inside of the run-time linker. # This is required for the ld.so.1 <--> rtld_db bootstraping diff --git a/usr/src/cmd/sgs/rtld/common/mapfile-order-gcc b/usr/src/cmd/sgs/rtld/common/mapfile-order-gcc index 10f279187f..c719599999 100644 --- a/usr/src/cmd/sgs/rtld/common/mapfile-order-gcc +++ b/usr/src/cmd/sgs/rtld/common/mapfile-order-gcc @@ -1,15 +1,9 @@ # -#pragma ident "%Z%%M% %I% %E% SMI" -# -# 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. +# 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. @@ -24,6 +18,13 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# +# ident "%Z%%M% %I% %E% SMI" +# # Note: This mapfile is used to place r_debug as the # very first data item inside of the run-time linker. # This is required for the ld.so.1 <--> rtld_db bootstraping diff --git a/usr/src/cmd/sgs/rtld/common/mapfile-vers b/usr/src/cmd/sgs/rtld/common/mapfile-vers index deec1bbeb3..4619d71ab7 100644 --- a/usr/src/cmd/sgs/rtld/common/mapfile-vers +++ b/usr/src/cmd/sgs/rtld/common/mapfile-vers @@ -1,13 +1,9 @@ # -# 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. +# 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. @@ -22,6 +18,11 @@ # # CDDL HEADER END # + +# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. +# # ident "%Z%%M% %I% %E% SMI" # # Generic interface definition for usr/src/cmd/sgs/rtld. @@ -71,14 +72,12 @@ SUNWprivate_1.2 { rtld_db_postinit; r_debug; - do_reloc; # Required to support librtld.so elf_plt_write; is_so_loaded; lml_main; lookup_sym; - reloc_table; - dbg_mask; # Required to support liblddbg.so + dbg_desc; # Diagnostic support dbg_print; eprintf; # Error message printing diff --git a/usr/src/cmd/sgs/rtld/common/sunwmove.c b/usr/src/cmd/sgs/rtld/common/move.c index dad6990d04..dd3749aca0 100644 --- a/usr/src/cmd/sgs/rtld/common/sunwmove.c +++ b/usr/src/cmd/sgs/rtld/common/move.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -34,28 +34,29 @@ #include <sys/procfs.h> #include <sys/mman.h> #include <dlfcn.h> -#include "conv.h" +#include <debug.h> +#include <conv.h> #include "_rtld.h" #include "_audit.h" #include "_elf.h" #include "msg.h" -#include "debug.h" /* * Move data */ void -move_data(Rt_map * lmp) +move_data(Rt_map *lmp) { - Move * mv = MOVETAB(lmp); - Phdr * pptr = SUNWBSS(lmp); - unsigned long cnt1; - Half cnt2, stride; - Addr taddr; + Lm_list *lml = LIST(lmp); + Move *mv = MOVETAB(lmp); + Phdr *pptr = SUNWBSS(lmp); + ulong_t num, mvnum = MOVESZ(lmp) / MOVEENT(lmp); - DBG_CALL(Dbg_move_data(NAME(lmp))); - for (cnt1 = 0; cnt1 < MOVESZ(lmp) / MOVEENT(lmp); cnt1++, mv++) { - Sym * sym; + DBG_CALL(Dbg_move_data(lmp)); + for (num = 0; num < mvnum; num++, mv++) { + Addr taddr; + Half rep, stride; + Sym *sym; /* * If the target address needs to be mapped in, @@ -74,8 +75,9 @@ move_data(Rt_map * lmp) zero((caddr_t)foff, (long)(zaddr - foff)); zlen = eaddr - zaddr; if (zlen > 0) { - if (dz_map(zaddr, zlen, PROT_READ | PROT_WRITE, - MAP_FIXED | MAP_PRIVATE) == MAP_FAILED) + if (dz_map(lml, zaddr, zlen, + (PROT_READ | PROT_WRITE), + (MAP_FIXED | MAP_PRIVATE)) == MAP_FAILED) return; } @@ -92,11 +94,12 @@ move_data(Rt_map * lmp) else taddr = taddr + mv->m_poffset + ADDR(lmp); - DBG_CALL(Dbg_move_mventry2(mv, sym->st_name, - (char *)(sym->st_name + STRTAB(lmp)))); + DBG_CALL(Dbg_move_entry2(lml, mv, sym->st_name, + (const char *)(sym->st_name + STRTAB(lmp)))); + + for (rep = 0; rep < mv->m_repeat; rep++) { + DBG_CALL(Dbg_move_expand(lml, mv, taddr)); - for (cnt2 = 0; cnt2 < mv->m_repeat; cnt2++) { - DBG_CALL(Dbg_move_expanding(mv, taddr)); switch (ELF_M_SIZE(mv->m_info)) { case 1: *((char *)taddr) = (char)mv->m_value; @@ -118,7 +121,7 @@ move_data(Rt_map * lmp) taddr += 8 * stride; break; default: - eprintf(ERR_NONE, MSG_INTL(MSG_MOVE_ERR1)); + eprintf(lml, ERR_NONE, MSG_INTL(MSG_MOVE_ERR1)); break; } } diff --git a/usr/src/cmd/sgs/rtld/common/object.c b/usr/src/cmd/sgs/rtld/common/object.c index bf7a9f4644..947e10f0a7 100644 --- a/usr/src/cmd/sgs/rtld/common/object.c +++ b/usr/src/cmd/sgs/rtld/common/object.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -36,13 +36,16 @@ #include <libelf.h> #include <string.h> #include <dlfcn.h> -#include "libld.h" +#include <debug.h> +#include <libld.h> #include "_rtld.h" #include "_audit.h" #include "_elf.h" -#include "debug.h" -static Rt_map * olmp = 0; +static Rt_map *olmp = 0; + +static Ehdr dehdr = { { ELFMAG0, ELFMAG1, ELFMAG2, ELFMAG3, + M_CLASS, M_DATA }, 0, M_MACH, EV_CURRENT }; /* * Process a relocatable object. The static object link map pointer is used as @@ -61,12 +64,13 @@ elf_obj_init(Lm_list *lml, Aliste lmco, const char *name) */ if ((ofl = (Ofl_desc *)calloc(sizeof (Ofl_desc), 1)) == 0) return (0); - ofl->ofl_e_machine = M_MACH; - ofl->ofl_e_flags = 0; - ofl->ofl_libver = EV_CURRENT; - ofl->ofl_flags = (FLG_OF_DYNAMIC | FLG_OF_SHAROBJ | FLG_OF_STRIP | - FLG_OF_MEMORY); + + ofl->ofl_dehdr = &dehdr; + + ofl->ofl_flags = + (FLG_OF_DYNAMIC | FLG_OF_SHAROBJ | FLG_OF_STRIP | FLG_OF_MEMORY); ofl->ofl_flags1 = FLG_OF1_RELDYN | FLG_OF1_TEXTOFF; + ofl->ofl_lml = lml; /* * As ent_setup() will effectively lazy load the necessary support @@ -79,7 +83,7 @@ elf_obj_init(Lm_list *lml, Aliste lmco, const char *name) * Obtain a generic set of entrance criteria (this is the first call to * libld.so, which will effectively lazyload it). */ - if (ent_setup(ofl, syspagsz) == S_ERROR) + if (ld_ent_setup(ofl, syspagsz) == S_ERROR) return (0); /* @@ -89,7 +93,7 @@ elf_obj_init(Lm_list *lml, Aliste lmco, const char *name) if ((olmp = (Rt_map *)calloc(sizeof (Rt_map), 1)) == 0) return (0); - DBG_CALL(Dbg_file_elf(name, 0, 0, 0, 0, get_linkmap_id(lml), lmco)); + DBG_CALL(Dbg_file_elf(lml, name, 0, 0, 0, 0, lml->lm_lmidstr, lmco)); FLAGS(olmp) |= FLG_RT_OBJECT; olmp->rt_priv = (void *)ofl; @@ -142,11 +146,10 @@ elf_obj_file(Lm_list *lml, Aliste lmco, const char *name, int fd) /* * Proceed to process the input file. */ - DBG_CALL(Dbg_util_nl()); - if (process_open(name, 0, fd, (Ofl_desc *)olmp->rt_priv, + DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD)); + if (ld_process_open(name, 0, fd, (Ofl_desc *)olmp->rt_priv, NULL, &rej) == (Ifl_desc *)S_ERROR) return (0); - return (olmp); } @@ -167,19 +170,19 @@ elf_obj_fini(Lm_list *lml, Rt_map *lmp) uint_t phnum, mmapcnt; Lm_cntl *lmc; - DBG_CALL(Dbg_util_nl()); + DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD)); - if (reloc_init(ofl) == S_ERROR) + if (ld_reloc_init(ofl) == S_ERROR) return (0); - if (sym_validate(ofl) == S_ERROR) + if (ld_sym_validate(ofl) == S_ERROR) return (0); - if (make_sections(ofl) == S_ERROR) + if (ld_make_sections(ofl) == S_ERROR) return (0); - if (create_outfile(ofl) == S_ERROR) + if (ld_create_outfile(ofl) == S_ERROR) return (0); - if ((etext = update_outfile(ofl)) == (Addr)S_ERROR) + if ((etext = ld_update_outfile(ofl)) == (Addr)S_ERROR) return (0); - if (reloc_process(ofl) == S_ERROR) + if (ld_reloc_process(ofl) == S_ERROR) return (0); /* @@ -192,7 +195,7 @@ elf_obj_fini(Lm_list *lml, Rt_map *lmp) /* * Allocate a mapping array to retain mapped segment information. */ - ehdr = ofl->ofl_ehdr; + ehdr = ofl->ofl_nehdr; phdr = ofl->ofl_phdr; if ((mmaps = calloc(ehdr->e_phnum, sizeof (Mmap))) == 0) return (0); @@ -247,7 +250,7 @@ elf_obj_fini(Lm_list *lml, Rt_map *lmp) ORIGNAME(nlmp) = ORIGNAME(olmp); DIRSZ(nlmp) = DIRSZ(olmp); - ofl_cleanup(ofl); + ld_ofl_cleanup(ofl); free(olmp->rt_priv); (void) memcpy(olmp, nlmp, sizeof (Rt_map)); free(nlmp); diff --git a/usr/src/cmd/sgs/rtld/common/paths.c b/usr/src/cmd/sgs/rtld/common/paths.c index b384998eca..97b828cef5 100644 --- a/usr/src/cmd/sgs/rtld/common/paths.c +++ b/usr/src/cmd/sgs/rtld/common/paths.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. @@ -39,10 +38,10 @@ #include <fcntl.h> #include <string.h> #include <sys/systeminfo.h> +#include <debug.h> +#include <conv.h> #include "_rtld.h" #include "msg.h" -#include "conv.h" -#include "debug.h" /* * Given a search rule type, return a list of directories to search according @@ -84,7 +83,7 @@ get_dir_list(unsigned char rules, Rt_map * lmp, uint_t flags) if (env_info & ENV_INF_PATHCFG) mode |= LA_SER_CONFIG; - DBG_CALL(Dbg_libs_path(rpl_libpath, mode, + DBG_CALL(Dbg_libs_path(lml, rpl_libpath, mode, config->c_name)); /* @@ -106,7 +105,7 @@ get_dir_list(unsigned char rules, Rt_map * lmp, uint_t flags) (void) printf(fmt, rpl_libpath, config->c_name); } if (rpl_libdirs && (rtld_flags & RT_FL_SECURE) && - (search || dbg_mask)) { + (search || DBG_ENABLED)) { free(rpl_libdirs); rpl_libdirs = 0; } @@ -129,7 +128,7 @@ get_dir_list(unsigned char rules, Rt_map * lmp, uint_t flags) * always call Dbg_libs_path(). */ if (prm_libpath) { - DBG_CALL(Dbg_libs_path(prm_libpath, + DBG_CALL(Dbg_libs_path(lml, prm_libpath, (LA_SER_LIBPATH | LA_SER_CONFIG), config->c_name)); /* @@ -144,7 +143,7 @@ get_dir_list(unsigned char rules, Rt_map * lmp, uint_t flags) (void) printf(MSG_INTL(MSG_LDD_PTH_LIBPATHC), prm_libpath, config->c_name); if (prm_libdirs && (rtld_flags & RT_FL_SECURE) && - (search || dbg_mask)) { + (search || DBG_ENABLED)) { free(prm_libdirs); prm_libdirs = 0; } @@ -167,7 +166,7 @@ get_dir_list(unsigned char rules, Rt_map * lmp, uint_t flags) * Dbg_libs_path(). */ if (RPATH(lmp)) { - DBG_CALL(Dbg_libs_path(RPATH(lmp), LA_SER_RUNPATH, + DBG_CALL(Dbg_libs_path(lml, RPATH(lmp), LA_SER_RUNPATH, NAME(lmp))); /* @@ -182,7 +181,7 @@ get_dir_list(unsigned char rules, Rt_map * lmp, uint_t flags) (void) printf(MSG_INTL(MSG_LDD_PTH_RPATH), RPATH(lmp), NAME(lmp)); if (RLIST(lmp) && (rtld_flags & RT_FL_SECURE) && - (search || dbg_mask)) { + (search || DBG_ENABLED)) { free(RLIST(lmp)); RLIST(lmp) = 0; } @@ -208,7 +207,7 @@ get_dir_list(unsigned char rules, Rt_map * lmp, uint_t flags) /* * For ldd(1) -s, indicate the default paths that'll be used. */ - if (dirlist && (search || dbg_mask)) { + if (dirlist && (search || DBG_ENABLED)) { Pnode * pnp = dirlist; int num = 0; @@ -224,7 +223,7 @@ get_dir_list(unsigned char rules, Rt_map * lmp, uint_t flags) fmt = MSG_ORIG(MSG_LDD_FMT_PATH1); (void) printf(fmt, pnp->p_name); } else - DBG_CALL(Dbg_libs_path(pnp->p_name, + DBG_CALL(Dbg_libs_path(lml, pnp->p_name, pnp->p_orig, config->c_name)); } if (search) { @@ -284,13 +283,14 @@ get_next_dir(Pnode ** dirlist, Rt_map * lmp, uint_t flags) */ uint_t expand(char **name, size_t *len, char **list, uint_t orig, uint_t omit, - Rt_map * lmp) + Rt_map *lmp) { char _name[PATH_MAX]; char *token = 0, *oname, *optr, *_optr, *nptr, * _list; size_t olen = 0, nlen = 0, _len; int isaflag = 0; uint_t flags = 0; + Lm_list *lml = LIST(lmp); optr = _optr = oname = *name; nptr = _name; @@ -323,8 +323,9 @@ expand(char **name, size_t *len, char **list, uint_t orig, uint_t omit, (void) strncpy(nptr, _optr, _len); nptr = nptr + _len; } else { - eprintf(ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND1), - NAME(lmp), oname); + eprintf(lml, ERR_FATAL, + MSG_INTL(MSG_ERR_EXPAND1), NAME(lmp), + oname); return (0); } } @@ -359,7 +360,7 @@ expand(char **name, size_t *len, char **list, uint_t orig, uint_t omit, optr += MSG_TKN_ORIGIN_SIZE; _flags |= PN_TKN_ORIGIN; } else { - eprintf(ERR_FATAL, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND1), NAME(lmp), oname); return (0); @@ -397,7 +398,7 @@ expand(char **name, size_t *len, char **list, uint_t orig, uint_t omit, optr += MSG_TKN_PLATFORM_SIZE; _flags |= PN_TKN_PLATFORM; } else { - eprintf(ERR_FATAL, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND1), NAME(lmp), oname); return (0); @@ -425,7 +426,7 @@ expand(char **name, size_t *len, char **list, uint_t orig, uint_t omit, optr += MSG_TKN_OSNAME_SIZE; _flags |= PN_TKN_OSNAME; } else { - eprintf(ERR_FATAL, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND1), NAME(lmp), oname); return (0); @@ -453,7 +454,7 @@ expand(char **name, size_t *len, char **list, uint_t orig, uint_t omit, optr += MSG_TKN_OSREL_SIZE; _flags |= PN_TKN_OSREL; } else { - eprintf(ERR_FATAL, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND1), NAME(lmp), oname); return (0); @@ -494,7 +495,7 @@ expand(char **name, size_t *len, char **list, uint_t orig, uint_t omit, optr += MSG_TKN_ISALIST_SIZE; _flags |= PN_TKN_ISALIST; } else { - eprintf(ERR_FATAL, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND1), NAME(lmp), oname); return (0); @@ -576,8 +577,9 @@ expand(char **name, size_t *len, char **list, uint_t orig, uint_t omit, if (_flags) flags |= _flags; else { - eprintf(ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND2), - NAME(lmp), oname, token); + eprintf(lml, ERR_FATAL, + MSG_INTL(MSG_ERR_EXPAND2), NAME(lmp), + oname, token); return (0); } } @@ -590,7 +592,8 @@ expand(char **name, size_t *len, char **list, uint_t orig, uint_t omit, * the lead of a reserved token. */ if (nlen >= PATH_MAX) { - eprintf(ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND1), NAME(lmp), oname); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND1), NAME(lmp), + oname); return (0); } @@ -631,7 +634,7 @@ expand(char **name, size_t *len, char **list, uint_t orig, uint_t omit, (void) strncpy(nptr, _optr, _len); nptr = nptr + _len; } else { - eprintf(ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND1), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ERR_EXPAND1), NAME(lmp), oname); return (0); } @@ -767,7 +770,8 @@ is_path_secure(const char *opath, Rt_map * clmp, uint_t info, uint_t flags) (void) printf(MSG_INTL(MSG_LDD_FIL_ILLEGAL), opath); } else - eprintf(ERR_WARNING, MSG_INTL(MSG_SEC_ILLEGAL), opath); + eprintf(lml, ERR_WARNING, MSG_INTL(MSG_SEC_ILLEGAL), + opath); return (0); } @@ -789,13 +793,13 @@ is_path_secure(const char *opath, Rt_map * clmp, uint_t info, uint_t flags) opath); } } else - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), opath, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), opath, strerror(EACCES)); } else { /* * Search paths. */ - DBG_CALL(Dbg_libs_ignore(opath)); + DBG_CALL(Dbg_libs_ignore(lml, opath)); if ((lml->lm_flags & LML_FLG_TRC_SEARCH) && ((FLAGS1(clmp) & FL1_RT_LDDSTUB) == 0)) (void) printf(MSG_INTL(MSG_LDD_PTH_IGNORE), opath); diff --git a/usr/src/cmd/sgs/rtld/common/remove.c b/usr/src/cmd/sgs/rtld/common/remove.c index 7eed7cf079..53f1addcde 100644 --- a/usr/src/cmd/sgs/rtld/common/remove.c +++ b/usr/src/cmd/sgs/rtld/common/remove.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. @@ -20,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. * * Remove objects. Objects need removal from a process as part of: @@ -57,11 +56,11 @@ #include <dlfcn.h> #include <sys/debug.h> #include <sys/avl.h> -#include "libc_int.h" +#include <libc_int.h> +#include <debug.h> #include "_rtld.h" #include "_audit.h" #include "_elf.h" -#include "debug.h" #include "msg.h" /* @@ -131,7 +130,7 @@ purge_exit_handlers(Lm_list *lml, Rt_map **tobj) * satisfy any dlerror() usage. */ if (error) - eprintf(ERR_FATAL, MSG_INTL(MSG_ARG_ATEXIT), error); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_ARG_ATEXIT), error); free(addr); return (error); @@ -184,6 +183,8 @@ void remove_lml(Lm_list *lml) { if (lml && (lml->lm_head == 0)) { + if (lml->lm_lmidstr) + free(lml->lm_lmidstr); if (lml->lm_alp) free(lml->lm_alp); if (lml->lm_lists) @@ -243,7 +244,7 @@ remove_so(Lm_list *lml, Rt_map *lmp) lml->lm_peh_lmp = 0; } - DBG_CALL(Dbg_file_delete(NAME(lmp))); + DBG_CALL(Dbg_file_delete(lmp)); /* * Unmap the object. @@ -568,10 +569,10 @@ is_deletable(Alist ** lmalp, Alist ** ghalp, Rt_map * lmp) * enced from the objects within the groups that are candidates for deletion. */ static int -gdp_collect(Alist ** ghalpp, Alist ** lmalpp, Grp_hdl * ghp1) +gdp_collect(Alist **ghalpp, Alist **lmalpp, Grp_hdl *ghp1) { Aliste off; - Grp_desc * gdp; + Grp_desc *gdp; int action; /* @@ -764,7 +765,7 @@ free_hdl(Grp_hdl *ghp) for (ALIST_TRAVERSE(ghp->gh_depends, off, gdp)) { Rt_map *lmp = gdp->gd_depend; - if (ghp->gh_owner == lmp) + if (ghp->gh_ownlmp == lmp) (void) alist_delete(HANDLES(lmp), &ghp, 0); (void) alist_delete(GROUPS(lmp), &ghp, 0); } @@ -837,7 +838,7 @@ remove_caller(Grp_hdl *ghp, Rt_map *clmp) * final deletion of the orphaned handles. */ int -remove_hdl(Grp_hdl * ghp, Rt_map * clmp, int *removed) +remove_hdl(Grp_hdl *ghp, Rt_map *clmp, int *removed) { Rt_map * lmp, ** lmpp; int rescan = 0; @@ -1051,8 +1052,8 @@ remove_hdl(Grp_hdl * ghp, Rt_map * clmp, int *removed) * If this handle is already an orphan, or if it's owner is * deletable there's no need to inspect its dependencies. */ - if ((ghp->gh_owner == 0) || - (FLAGS(ghp->gh_owner) & FLG_RT_DELETE)) + if ((ghp->gh_ownlmp == 0) || + (FLAGS(ghp->gh_ownlmp) & FLG_RT_DELETE)) continue; /* @@ -1068,7 +1069,7 @@ remove_hdl(Grp_hdl * ghp, Rt_map * clmp, int *removed) * required there's no need to look at any other of the * handles dependencies. */ - if ((lmp == ghp->gh_owner) && + if ((lmp == ghp->gh_ownlmp) && (gdp->gd_flags & GPD_REMOVE)) break; @@ -1158,7 +1159,7 @@ remove_hdl(Grp_hdl * ghp, Rt_map * clmp, int *removed) */ for (ALIST_TRAVERSE(ghalp, off1, ghpp)) { Grp_hdl * ghp = *ghpp; - Rt_map * dlmp = ghp->gh_owner; + Rt_map * dlmp = ghp->gh_ownlmp; if (clmp && dlmp && ((LIST(dlmp)->lm_flags & LML_FLG_NOAUDIT) == 0) && @@ -1278,9 +1279,9 @@ remove_hdl(Grp_hdl * ghp, Rt_map * clmp, int *removed) * If this object is the owner of the handle break that * association in case the handle is retained. */ - if (ghp->gh_owner == lmp) { + if (ghp->gh_ownlmp == lmp) { (void) alist_delete(HANDLES(lmp), &ghp, 0); - ghp->gh_owner = 0; + ghp->gh_ownlmp = 0; } (void) alist_delete(GROUPS(lmp), &ghp, 0); @@ -1319,7 +1320,7 @@ remove_hdl(Grp_hdl * ghp, Rt_map * clmp, int *removed) */ (void) list_append(&hdl_list[HDLIST_ORP], ghp); - if (dbg_mask) { + if (DBG_ENABLED) { DBG_CALL(Dbg_file_hdl_title(DBG_DEP_ORPHAN)); for (ALIST_TRAVERSE(ghp->gh_depends, off1, gdp)) DBG_CALL(Dbg_file_hdl_action(ghp, @@ -1358,10 +1359,9 @@ remove_hdl(Grp_hdl * ghp, Rt_map * clmp, int *removed) */ do { List list; - Listnode * lnp; - Grp_hdl * ghp, * oghp = 0; - - DBG_CALL(Dbg_file_del_rescan()); + Listnode *lnp; + Grp_hdl *ghp, *oghp = 0; + int title = 0; /* * Effectively clean the HDLIST_ORP list. Any object that can't @@ -1374,6 +1374,9 @@ remove_hdl(Grp_hdl * ghp, Rt_map * clmp, int *removed) for (LIST_TRAVERSE(&list, lnp, ghp)) { int _error, _remove; + if (title++ == 0) + DBG_CALL(Dbg_file_del_rescan(ghp->gh_ownlml)); + if (oghp) { list_delete(&list, oghp); oghp = 0; diff --git a/usr/src/cmd/sgs/rtld/common/rtld.msg b/usr/src/cmd/sgs/rtld/common/rtld.msg index 7a95a21a49..14b3bd207a 100644 --- a/usr/src/cmd/sgs/rtld/common/rtld.msg +++ b/usr/src/cmd/sgs/rtld/common/rtld.msg @@ -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. @@ -365,11 +364,18 @@ @ MSG_EMG_ENOMEM "internal: Not enough space" -@ MSG_DBG_FMT_DIAG "%5.5d: " -@ MSG_DBG_FMT_FILE "%s.%5.5d" -@ MSG_DBG_FMT_THREAD "%5.5d: %d: " +@ MSG_DBG_PID "%5.5d: " +@ MSG_DBG_UNDEF "debug: " +@ MSG_DBG_LMID "%s: " +@ MSG_DBG_THREAD "%d: " +@ MSG_DBG_FILE "%s.%5.5d" + +@ MSG_LMID_BASE "BASE" +@ MSG_LMID_LDSO "LDSO" +@ MSG_LMID_ALT "ALT" + +@ MSG_LMID_FMT "%s%d" +@ MSG_LMID_MAXED "ALTMAXEDOUT" @ MSG_AUD_PLTENTER "la_pltenter" @ MSG_AUD_SYMBIND "la_symbind" - -@ MSG_REL_BADROFFSET "<offset lies outside memory image; relocation discarded>" diff --git a/usr/src/cmd/sgs/rtld/common/setup.c b/usr/src/cmd/sgs/rtld/common/setup.c index ed4531b12b..c50873c4bb 100644 --- a/usr/src/cmd/sgs/rtld/common/setup.c +++ b/usr/src/cmd/sgs/rtld/common/setup.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,12 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -49,13 +48,13 @@ #include <dlfcn.h> #include <sys/sysconfig.h> #include <sys/auxv.h> +#include <debug.h> +#include <conv.h> #include "_rtld.h" #include "_audit.h" #include "_elf.h" #include "_a.out.h" #include "msg.h" -#include "debug.h" -#include "conv.h" extern int _end, _edata, _etext; @@ -84,7 +83,7 @@ preload(const char *str, Rt_map *lmp) Word lmflags = lml_main.lm_flags; uint_t flags; - DBG_CALL(Dbg_util_nl()); + DBG_CALL(Dbg_util_nl(&lml_main, DBG_NL_STD)); if ((objs = strdup(str)) == 0) return (0); @@ -105,7 +104,7 @@ preload(const char *str, Rt_map *lmp) Pnode *pnp; Rt_map *nlmp = 0; - DBG_CALL(Dbg_file_preload(ptr)); + DBG_CALL(Dbg_file_preload(&lml_main, ptr)); /* * If this a secure application, then preload errors are @@ -301,12 +300,16 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz, AL_CNT_LMLISTS) == 0) return (0); lml_main.lm_flags |= LML_FLG_BASELM; + lml_main.lm_lmid = LM_ID_BASE; + lml_main.lm_lmidstr = (char *)MSG_ORIG(MSG_LMID_BASE); if (alist_append(&lml_rtld.lm_lists, 0, sizeof (Lm_cntl), AL_CNT_LMLISTS) == 0) return (0); lml_rtld.lm_flags |= (LML_FLG_RTLDLM | LML_FLG_NOAUDIT | LML_FLG_HOLDLOCK); + lml_rtld.lm_lmid = LM_ID_LDSO; + lml_rtld.lm_lmidstr = (char *)MSG_ORIG(MSG_LMID_LDSO); /* * Determine whether we have a secure executable. @@ -379,7 +382,7 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz, */ if (rtld_getopt(argv, &envp, &auxv, &(lml_main.lm_flags), &(lml_main.lm_tflags), (aoutdyn != 0)) == 1) { - eprintf(ERR_NONE, MSG_INTL(MSG_USG_BADOPT)); + eprintf(&lml_main, ERR_NONE, MSG_INTL(MSG_USG_BADOPT)); return (0); } _environ = envp; @@ -391,8 +394,8 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz, if ((fd = open(argvname, O_RDONLY)) == -1) { int err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), argvname, - strerror(err)); + eprintf(&lml_main, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), + argvname, strerror(err)); return (0); } } @@ -410,8 +413,9 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz, */ (void) fstat(fd, &status); if ((ftp = are_u_this(&rej, fd, &status, argvname)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(err_reject[rej.rej_type]), - argvname, conv_reject_str(&rej)); + eprintf(&lml_main, ERR_FATAL, + MSG_INTL(err_reject[rej.rej_type]), argvname, + conv_reject_desc(&rej)); return (0); } @@ -465,8 +469,9 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz, if (_brk_unlocked((void *)brkbase) == -1) { int err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_BRK), - argvname, strerror(err)); + eprintf(&lml_main, ERR_FATAL, + MSG_INTL(MSG_SYS_BRK), argvname, + strerror(err)); } } @@ -514,8 +519,8 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz, */ lml_main.lm_tflags |= LML_TFLG_NODIRECT; #else - eprintf(ERR_FATAL, MSG_INTL(MSG_ERR_REJ_UNKFILE), - argvname); + eprintf(&lml_main, ERR_FATAL, + MSG_INTL(MSG_ERR_REJ_UNKFILE), argvname); return (0); #endif } else if (phdr) { @@ -694,13 +699,14 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz, ulong_t mhwcap; if ((mhwcap = (HWCAP(mlmp) & ~hwcap)) != 0) { + const char *str = conv_cap_val_hw1(mhwcap, M_MACH); + if (lml_main.lm_flags & LML_FLG_TRC_ENABLE) { (void) printf(MSG_INTL(MSG_LDD_GEN_HWCAP_1), - NAME(mlmp), - conv_hwcap_1_str(mhwcap, M_MACH)); + NAME(mlmp), str); } else { - eprintf(ERR_FATAL, MSG_INTL(MSG_GEN_BADHWCAP_1), - conv_hwcap_1_str(mhwcap, M_MACH)); + eprintf(&lml_main, ERR_FATAL, + MSG_INTL(MSG_GEN_BADHWCAP_1), str); return (0); } } @@ -803,34 +809,56 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz, /* * If debugging was requested initialize things now that any cache has - * been established. + * been established. A user can specify LD_DEBUG=help to discover the + * list of debugging tokens available without running the application. + * However, don't allow this setting from a configuration file. + * + * Note, to prevent recursion issues caused by loading and binding the + * debugging libraries themselves, a local debugging descriptor is + * initialized. Once the debugging setup has completed, this local + * descriptor is copied to the global descriptor which effectively + * enables diagnostic output. */ - if (rpl_debug) - dbg_mask |= dbg_setup(rpl_debug); - if (prm_debug) - dbg_mask |= dbg_setup(prm_debug); + if (rpl_debug || prm_debug) { + Dbg_desc _dbg_desc = {0, 0, 0}; + + if (rpl_debug) { + uintptr_t ret; + + if ((ret = dbg_setup(rpl_debug, &_dbg_desc)) == S_ERROR) + return (0); + if (ret == 0) + rtldexit(&lml_main, 0); + } + if (prm_debug) + (void) dbg_setup(prm_debug, &_dbg_desc); + + *dbg_desc = _dbg_desc; + } /* * Now that debugging is enabled generate any diagnostics from any * previous events. */ if (hwcap) - DBG_CALL(Dbg_cap_hw_1(hwcap, M_MACH)); + DBG_CALL(Dbg_cap_val_hw1(&lml_main, hwcap, M_MACH)); if (features) - DBG_CALL(Dbg_file_config_dis(config->c_name, features)); + DBG_CALL(Dbg_file_config_dis(&lml_main, config->c_name, + features)); - if (dbg_mask) { - DBG_CALL(Dbg_file_ldso(PATHNAME(rlmp), (ulong_t)DYN(rlmp), - ADDR(rlmp), envp, auxv)); + if (DBG_ENABLED) { + DBG_CALL(Dbg_file_ldso(rlmp, envp, auxv, + LIST(rlmp)->lm_lmidstr, ALO_DATA)); if (FCT(mlmp) == &elf_fct) { - DBG_CALL(Dbg_file_elf(PATHNAME(mlmp), + DBG_CALL(Dbg_file_elf(&lml_main, PATHNAME(mlmp), (ulong_t)DYN(mlmp), ADDR(mlmp), MSIZE(mlmp), - ENTRY(mlmp), get_linkmap_id(LIST(mlmp)), ALO_DATA)); + ENTRY(mlmp), LIST(mlmp)->lm_lmidstr, ALO_DATA)); } else { - DBG_CALL(Dbg_file_aout(PATHNAME(mlmp), + DBG_CALL(Dbg_file_aout(&lml_main, PATHNAME(mlmp), (ulong_t)AOUTDYN(mlmp), (ulong_t)ADDR(mlmp), - (ulong_t)MSIZE(mlmp))); + (ulong_t)MSIZE(mlmp), LIST(mlmp)->lm_lmidstr, + ALO_DATA)); } } @@ -922,7 +950,7 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz, if ((rtld_flags & RT_FL_CONFGEN) == 0) { Word lmflags; - DBG_CALL(Dbg_file_nl()); + DBG_CALL(Dbg_util_nl(&lml_main, DBG_NL_STD)); if (relocate_lmc(&lml_main, ALO_DATA, mlmp) == 0) return (0); @@ -996,7 +1024,7 @@ setup(char **envp, auxv_t *auxv, Word _flags, char *_platform, int _syspagsz, unused(&lml_main); - DBG_CALL(Dbg_util_call_main(NAME(mlmp))); + DBG_CALL(Dbg_util_call_main(mlmp)); leave(LIST(mlmp)); diff --git a/usr/src/cmd/sgs/rtld/common/tls.c b/usr/src/cmd/sgs/rtld/common/tls.c index 3f0e20451e..72d9ed60da 100644 --- a/usr/src/cmd/sgs/rtld/common/tls.c +++ b/usr/src/cmd/sgs/rtld/common/tls.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -33,7 +33,6 @@ #include <libc_int.h> #include <_rtld.h> #include <_elf.h> -#include <conv.h> #include <msg.h> #include <debug.h> @@ -187,7 +186,7 @@ tls_modactivity(Rt_map * lmp, uint_t flag) tmi.tm_flags = 0; tmi.tm_stattlsoffset = 0; - DBG_CALL(Dbg_tls_modactivity(&tmi, flag)); + DBG_CALL(Dbg_tls_modactivity(LIST(lmp), &tmi, flag)); fptr(&tmi); /* @@ -222,17 +221,15 @@ tls_assign_soffset(Rt_map * lmp) int tls_report_modules() { - Rt_map * lmp; - uint_t tlsmodcnt; - uint_t tlsmodndx; - TLS_modinfo ** tlsmodlist; - TLS_modinfo * tlsbuflist; - Phdr * tlsphdr; + Rt_map *lmp; + uint_t tlsmodcnt, tlsmodndx; + TLS_modinfo **tlsmodlist; + TLS_modinfo *tlsbuflist; + Phdr *tlsphdr; tlsinitialized++; /* - * Scan through all objects to determine how many have TLS - * storage. + * Scan through all objects to determine how many have TLS storage. */ tlsmodcnt = 0; for (lmp = lml_main.lm_head; lmp; lmp = (Rt_map *)NEXT(lmp)) { @@ -245,11 +242,10 @@ tls_report_modules() continue; /* - * If a module has TLS - but the TLS interfaces - * are not present (no libthread?). Then this is - * a fatal condition. + * If a module has TLS - but the TLS interfaces are not present + * (no libthread?). Then this is a fatal condition. */ - eprintf(ERR_FATAL, MSG_INTL(MSG_ERR_TLS_NOTLS), + eprintf(&lml_main, ERR_FATAL, MSG_INTL(MSG_ERR_TLS_NOTLS), NAME(lmp)); return (0); } @@ -308,7 +304,8 @@ tls_report_modules() tlsmodndx++; } - DBG_CALL(Dbg_tls_static_block((void *)tlsmodlist, tls_static_size)); + DBG_CALL(Dbg_tls_static_block(&lml_main, (void *)tlsmodlist, + tls_static_size)); fptr_tls_statmods(tlsmodlist, tls_static_size); /* diff --git a/usr/src/cmd/sgs/rtld/common/tsort.c b/usr/src/cmd/sgs/rtld/common/tsort.c index 7bfffd378f..31187795b9 100644 --- a/usr/src/cmd/sgs/rtld/common/tsort.c +++ b/usr/src/cmd/sgs/rtld/common/tsort.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -47,9 +47,9 @@ #include <locale.h> #include <string.h> #include <libintl.h> +#include <debug.h> #include "_rtld.h" #include "msg.h" -#include "debug.h" /* * Structure for maintaining sorting state. @@ -96,7 +96,8 @@ sort_scc(Sort * sort, int fndx, int flag) static int cnt = 1; int ndx; Rt_map *lmp; - Word lmflags = LIST(sort->s_lmp)->lm_flags; + Lm_list *lml = LIST(sort->s_lmp); + Word lmflags = lml->lm_flags; Word init, unref; /* @@ -158,7 +159,8 @@ sort_scc(Sort * sort, int fndx, int flag) * be better traced (see trace_sort()), or analyzed for non-use. */ if (((init = (lmflags & LML_FLG_TRC_INIT)) == 0) && - ((unref = (lmflags & LML_FLG_TRC_UNREF)) == 0) && (dbg_mask == 0)) + ((unref = (lmflags & LML_FLG_TRC_UNREF)) == 0) && + (DBG_ENABLED == 0)) return (1); if (init) { @@ -168,7 +170,7 @@ sort_scc(Sort * sort, int fndx, int flag) } (void) printf(tfmt, cnt); } - DBG_CALL(Dbg_util_scc_title(flag & RT_SORT_REV)); + DBG_CALL(Dbg_util_scc_title(lml, (flag & RT_SORT_REV))); /* * Identify this cyclic group, and under ldd -i print the cycle in the @@ -181,14 +183,14 @@ sort_scc(Sort * sort, int fndx, int flag) if (init) (void) printf(ffmt, NAME(lmp)); - DBG_CALL(Dbg_util_scc_entry(ndx, NAME(lmp))); + DBG_CALL(Dbg_util_scc_entry(lmp, ndx)); } cnt++; - } else if (dbg_mask) { + } else if (DBG_ENABLED) { for (ndx = sort->s_lndx - 1; ndx >= fndx; ndx--) { lmp = sort->s_lmpa[ndx]; - DBG_CALL(Dbg_util_scc_entry(ndx, NAME(lmp))); + DBG_CALL(Dbg_util_scc_entry(lmp, ndx)); } } @@ -196,7 +198,7 @@ sort_scc(Sort * sort, int fndx, int flag) * If we're looking for unused dependencies determine if any of these * cyclic components are referenced from outside of the cycle. */ - if (unref || dbg_mask) { + if (unref || DBG_ENABLED) { Bnd_desc ** bdpp; for (ndx = fndx; ndx < sort->s_lndx; ndx++) { @@ -247,7 +249,7 @@ sort_scc(Sort * sort, int fndx, int flag) * to sort_scc() to sort these elements. */ static int -visit(Lm_list *lml, Rt_map * lmp, Sort * sort, int flag) +visit(Lm_list *lml, Rt_map * lmp, Sort *sort, int flag) { Alist *alpp = 0; int num = sort->s_lndx; @@ -257,7 +259,7 @@ visit(Lm_list *lml, Rt_map * lmp, Sort * sort, int flag) do { tlmp = sort->s_stack[--(sort->s_sndx)]; SORTVAL(tlmp) = sort->s_num; - DBG_CALL(Dbg_util_collect(NAME(tlmp), sort->s_lndx, flag)); + DBG_CALL(Dbg_util_collect(tlmp, sort->s_lndx, flag)); sort->s_lmpa[(sort->s_lndx)++] = tlmp; if (flag & RT_SORT_REV) { @@ -306,10 +308,10 @@ visit(Lm_list *lml, Rt_map * lmp, Sort * sort, int flag) } static int -dep_visit(Rt_map *, uint_t, Rt_map *, Lm_list *, Sort *, int); +dep_visit(Lm_list *, Rt_map *, uint_t, Rt_map *, Sort *, int); static int -_dep_visit(int min, Rt_map *clmp, Rt_map *dlmp, uint_t bflags, Lm_list *lml, +_dep_visit(Lm_list *lml, int min, Rt_map *clmp, Rt_map *dlmp, uint_t bflags, Sort *sort, int flag) { int _min; @@ -369,7 +371,7 @@ _dep_visit(int min, Rt_map *clmp, Rt_map *dlmp, uint_t bflags, Lm_list *lml, /* * Inspect this new dependency. */ - if ((_min = dep_visit(clmp, bflags, dlmp, lml, + if ((_min = dep_visit(lml, clmp, bflags, dlmp, sort, flag)) == -1) return (-1); } @@ -381,8 +383,7 @@ _dep_visit(int min, Rt_map *clmp, Rt_map *dlmp, uint_t bflags, Lm_list *lml, * along this dependency edge. */ if (_min < min) { - DBG_CALL(Dbg_util_edge_out(NAME(clmp), SORTVAL(clmp), - NAME(sort->s_stack[_min]))); + DBG_CALL(Dbg_util_edge_out(clmp, sort->s_stack[_min])); return (_min); } else return (min); @@ -392,7 +393,7 @@ _dep_visit(int min, Rt_map *clmp, Rt_map *dlmp, uint_t bflags, Lm_list *lml, * Visit the dependencies of each object. */ static int -dep_visit(Rt_map *clmp, uint_t cbflags, Rt_map *lmp, Lm_list *lml, Sort *sort, +dep_visit(Lm_list *lml, Rt_map *clmp, uint_t cbflags, Rt_map *lmp, Sort *sort, int flag) { int min; @@ -406,14 +407,14 @@ dep_visit(Rt_map *clmp, uint_t cbflags, Rt_map *lmp, Lm_list *lml, Sort *sort, if (FLAGS(lmp) & FLG_RT_INITFRST) sort->s_initfirst++; - DBG_CALL(Dbg_util_edge_in(clmp, cbflags, lmp, min, flag)); + DBG_CALL(Dbg_util_edge_in(lml, clmp, cbflags, lmp, min, flag)); /* * Traverse both explicit and implicit dependencies. */ for (ALIST_TRAVERSE(DEPENDS(lmp), off, bdpp)) { - if ((min = _dep_visit(min, lmp, (*bdpp)->b_depend, - (*bdpp)->b_flags, lml, sort, flag)) == -1) + if ((min = _dep_visit(lml, min, lmp, (*bdpp)->b_depend, + (*bdpp)->b_flags, sort, flag)) == -1) return (-1); } @@ -443,8 +444,8 @@ dep_visit(Rt_map *clmp, uint_t cbflags, Rt_map *lmp, Lm_list *lml, Sort *sort, if (gdp->gd_depend == lmp) continue; - if ((min = _dep_visit(min, lmp, - gdp->gd_depend, BND_FILTER, lml, + if ((min = _dep_visit(lml, min, lmp, + gdp->gd_depend, BND_FILTER, sort, flag)) == -1) return (-1); } @@ -757,11 +758,11 @@ tsort(Rt_map *lmp, int num, int flag) * tsort() list if their .init has already been called. */ if (lml->lm_flags & LML_FLG_OBJREEVAL) - _lmp = LIST(lmp)->lm_head; + _lmp = lml->lm_head; else _lmp = lmp; - DBG_CALL(Dbg_file_bindings(_lmp, flag, lml->lm_flags)); + DBG_CALL(Dbg_file_bindings(_lmp, flag)); lml->lm_flags &= ~(LML_FLG_OBJREEVAL | LML_FLG_OBJADDED | LML_FLG_OBJDELETED); @@ -775,7 +776,7 @@ tsort(Rt_map *lmp, int num, int flag) FLG_RT_INITCLCT)) != FLG_RT_RELOCED) continue; - if (dep_visit(0, 0, _lmp, lml, &sort, flag) == -1) + if (dep_visit(lml, 0, 0, _lmp, &sort, flag) == -1) return ((Rt_map **)S_ERROR); } else if (!(flag & RT_SORT_DELETE) || @@ -789,7 +790,7 @@ tsort(Rt_map *lmp, int num, int flag) (FLG_RT_INITCLCT))) continue; - if (dep_visit(0, 0, _lmp, lml, &sort, flag) == -1) + if (dep_visit(lml, 0, 0, _lmp, &sort, flag) == -1) return ((Rt_map **)S_ERROR); } } @@ -864,6 +865,6 @@ tsort(Rt_map *lmp, int num, int flag) * The caller is responsible for freeing the sorted link-map list once * the associated .init/.fini's have been fired. */ - DBG_CALL(Dbg_util_nl()); + DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD)); return (sort.s_lmpa); } diff --git a/usr/src/cmd/sgs/rtld/common/util.c b/usr/src/cmd/sgs/rtld/common/util.c index dfb331dfab..d686ccff38 100644 --- a/usr/src/cmd/sgs/rtld/common/util.c +++ b/usr/src/cmd/sgs/rtld/common/util.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -24,7 +23,7 @@ * Copyright (c) 1988 AT&T * All Rights Reserved * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -46,13 +45,12 @@ #include <dlfcn.h> #include <unistd.h> #include <stdlib.h> -#include <signal.h> #include <sys/auxv.h> +#include <debug.h> +#include <conv.h> #include "_rtld.h" #include "_audit.h" -#include "conv.h" #include "msg.h" -#include "debug.h" static int ld_flags_env(const char *, Word *, Word *, uint_t, int); @@ -71,10 +69,10 @@ static int ld_flags_env(const char *, Word *, Word *, uint_t, int); * Null function used as place where a debugger can set a breakpoint. */ void -rtld_db_dlactivity(void) +rtld_db_dlactivity(Lm_list *lml) { - DBG_CALL(Dbg_util_dbnotify(r_debug.rtd_rdebug.r_rdevent, - r_debug.rtd_rdebug.r_state)); + DBG_CALL(Dbg_util_dbnotify(lml, r_debug.rtd_rdebug.r_rdevent, + r_debug.rtd_rdebug.r_state)); } /* @@ -82,25 +80,23 @@ rtld_db_dlactivity(void) * processing breakpoint. */ void -rtld_db_preinit(void) +rtld_db_preinit(Lm_list *lml) { - DBG_CALL(Dbg_util_dbnotify(r_debug.rtd_rdebug.r_rdevent, - r_debug.rtd_rdebug.r_state)); + DBG_CALL(Dbg_util_dbnotify(lml, r_debug.rtd_rdebug.r_rdevent, + r_debug.rtd_rdebug.r_state)); } - /* * Null function used as place where debugger can set a post .init * processing breakpoint. */ void -rtld_db_postinit(void) +rtld_db_postinit(Lm_list *lml) { - DBG_CALL(Dbg_util_dbnotify(r_debug.rtd_rdebug.r_rdevent, - r_debug.rtd_rdebug.r_state)); + DBG_CALL(Dbg_util_dbnotify(lml, r_debug.rtd_rdebug.r_rdevent, + r_debug.rtd_rdebug.r_state)); } - /* * Debugger Event Notification * @@ -193,7 +189,7 @@ rd_event(Lm_list *lml, rd_event_e event, r_state_e state) */ r_debug.rtd_rdebug.r_state = state; r_debug.rtd_rdebug.r_rdevent = event; - fptr(); + fptr(lml); r_debug.rtd_rdebug.r_rdevent = RD_NONE; } @@ -513,7 +509,7 @@ is_dep_init(Rt_map * dlmp, Rt_map * clmp) if ((FLAGS(dlmp) & (FLG_RT_RELOCED | FLG_RT_INITCALL)) == (FLG_RT_RELOCED | FLG_RT_INITCALL)) { - DBG_CALL(Dbg_util_no_init(NAME(dlmp))); + DBG_CALL(Dbg_util_no_init(dlmp)); return; } @@ -563,7 +559,7 @@ is_dep_ready(Rt_map * dlmp, Rt_map * clmp, int what) ((tid = rt_thr_self()) != 0) && (THREADID(dlmp) != tid)) { while ((FLAGS(dlmp) & FLG_RT_INITDONE) == 0) { FLAGS1(dlmp) |= FL1_RT_INITWAIT; - DBG_CALL(Dbg_util_wait(what, NAME(clmp), NAME(dlmp))); + DBG_CALL(Dbg_util_wait(clmp, dlmp, what)); (void) rt_cond_wait(CONDVAR(dlmp), &rtldlock); } } @@ -573,9 +569,9 @@ is_dep_ready(Rt_map * dlmp, Rt_map * clmp, int what) * Execute .{preinit|init|fini}array sections */ void -call_array(Addr * array, uint_t arraysz, Rt_map * lmp, uint_t shtype) +call_array(Addr *array, uint_t arraysz, Rt_map *lmp, Word shtype) { - int start, stop, incr, i; + int start, stop, incr, ndx; uint_t arraycnt = (uint_t)(arraysz / sizeof (Addr)); if (array == NULL) @@ -597,13 +593,11 @@ call_array(Addr * array, uint_t arraysz, Rt_map * lmp, uint_t shtype) /* * Call the .*array[] entries */ - for (i = start; i != stop; i += incr) { - void (* fptr)(); + for (ndx = start; ndx != stop; ndx += incr) { + void (* fptr)() = (void(*)())array[ndx]; - DBG_CALL(Dbg_util_call_array(NAME(lmp), (void *)array[i], i, - shtype)); + DBG_CALL(Dbg_util_call_array(lmp, (void *)fptr, ndx, shtype)); - fptr = (void(*)())array[i]; leave(LIST(lmp)); (*fptr)(); (void) enter(); @@ -685,7 +679,7 @@ call_init(Rt_map ** tobj, int flag) continue; is_dep_ready(bdp->b_depend, lmp, DBG_WAIT_INIT); } - DBG_CALL(Dbg_util_call_init(NAME(lmp), flag)); + DBG_CALL(Dbg_util_call_init(lmp, flag)); } if (iptr) { @@ -698,7 +692,7 @@ call_init(Rt_map ** tobj, int flag) SHT_INIT_ARRAY); if (INITARRAY(lmp) || iptr) - DBG_CALL(Dbg_util_call_init(NAME(lmp), DBG_INIT_DONE)); + DBG_CALL(Dbg_util_call_init(lmp, DBG_INIT_DONE)); /* * Set the initdone flag regardless of whether this object @@ -714,7 +708,7 @@ call_init(Rt_map ** tobj, int flag) * Wake anyone up who might be waiting on this .init. */ if (FLAGS1(lmp) & FL1_RT_INITWAIT) { - DBG_CALL(Dbg_util_broadcast(NAME(lmp))); + DBG_CALL(Dbg_util_broadcast(lmp)); (void) rt_cond_broadcast(CONDVAR(lmp)); FLAGS1(lmp) &= ~FL1_RT_INITWAIT; } @@ -778,11 +772,11 @@ call_fini(Lm_list * lml, Rt_map ** tobj) * calling any .fini. */ is_dep_ready(lmp, lmp, DBG_WAIT_FINI); - DBG_CALL(Dbg_util_call_fini(NAME(lmp))); + DBG_CALL(Dbg_util_call_fini(lmp)); } - call_array(FINIARRAY(lmp), FINIARRAYSZ(lmp), - lmp, SHT_FINI_ARRAY); + call_array(FINIARRAY(lmp), FINIARRAYSZ(lmp), lmp, + SHT_FINI_ARRAY); if (fptr) { leave(LIST(lmp)); @@ -828,8 +822,8 @@ call_fini(Lm_list * lml, Rt_map ** tobj) } } } - DBG_CALL(Dbg_bind_plt_summary(M_MACH, pltcnt21d, pltcnt24d, - pltcntu32, pltcntu44, pltcntfull, pltcntfar)); + DBG_CALL(Dbg_bind_plt_summary(lml, M_MACH, pltcnt21d, pltcnt24d, + pltcntu32, pltcntu44, pltcntfull, pltcntfar)); free(tobj); } @@ -912,8 +906,6 @@ atexit_fini() lml->lm_flags |= LML_FLG_ATEXIT; lmp = (Rt_map *)lml->lm_head; - dbg_mask = 0; - if (((tobj = tsort(lmp, lml->lm_obj, RT_SORT_FWD)) != 0) && (tobj != (Rt_map **)S_ERROR)) call_fini(lml, tobj); @@ -2694,9 +2686,9 @@ printf(const char *format, ...) static char errbuf[ERRSIZE], *nextptr = errbuf, *prevptr = 0; -/*PRINTFLIKE2*/ +/*PRINTFLIKE3*/ void -eprintf(Error error, const char *format, ...) +eprintf(Lm_list *lml, Error error, const char *format, ...) { va_list args; int overflow = 0; @@ -2805,7 +2797,7 @@ eprintf(Error error, const char *format, ...) (void) dowrite(&prf); } - DBG_CALL(Dbg_util_str(nextptr)); + DBG_CALL(Dbg_util_str(lml, nextptr)); va_end(args); /* @@ -2828,7 +2820,7 @@ eprintf(Error error, const char *format, ...) MSG_STR_NL_SIZE); } } - DBG_CALL(Dbg_util_str(str)); + DBG_CALL(Dbg_util_str(lml, str)); lock = 0; nextptr = errbuf + ERRSIZE; @@ -2944,7 +2936,7 @@ dz_init(int fd) * on the current OS. */ Am_ret -anon_map(caddr_t *addr, size_t len, int prot, int flags) +anon_map(Lm_list *lml, caddr_t *addr, size_t len, int prot, int flags) { #if defined(MAP_ANON) static int noanon = 0; @@ -2959,7 +2951,7 @@ anon_map(caddr_t *addr, size_t len, int prot, int flags) if ((errno != EBADF) && (errno != EINVAL)) { int err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAPANON), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_MMAPANON), MSG_ORIG(MSG_PTH_DEVZERO), strerror(err)); return (AM_ERROR); } else @@ -2976,13 +2968,13 @@ anon_map(caddr_t *addr, size_t len, int prot, int flags) * behavior for older systems.) */ caddr_t -dz_map(caddr_t addr, size_t len, int prot, int flags) +dz_map(Lm_list *lml, caddr_t addr, size_t len, int prot, int flags) { caddr_t va; int err; Am_ret amret; - amret = anon_map(&addr, len, prot, flags); + amret = anon_map(lml, &addr, len, prot, flags); if (amret == AM_OK) return (addr); @@ -2995,7 +2987,7 @@ dz_map(caddr_t addr, size_t len, int prot, int flags) if ((dz_fd = open(MSG_ORIG(MSG_PTH_DEVZERO), O_RDONLY)) == FD_UNAVAIL) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), MSG_ORIG(MSG_PTH_DEVZERO), strerror(err)); return (MAP_FAILED); } @@ -3003,7 +2995,7 @@ dz_map(caddr_t addr, size_t len, int prot, int flags) if ((va = mmap(addr, len, prot, flags, dz_fd, 0)) == MAP_FAILED) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), MSG_ORIG(MSG_PTH_DEVZERO), strerror(err)); } return (va); @@ -3012,7 +3004,7 @@ dz_map(caddr_t addr, size_t len, int prot, int flags) static int pr_fd = FD_UNAVAIL; int -pr_open() +pr_open(Lm_list *lml) { char proc[16]; @@ -3022,7 +3014,7 @@ pr_open() if ((pr_fd = open(proc, O_RDONLY)) == FD_UNAVAIL) { int err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), proc, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), proc, strerror(err)); } } @@ -3032,7 +3024,7 @@ pr_open() static int nu_fd = FD_UNAVAIL; caddr_t -nu_map(caddr_t addr, size_t len, int prot, int flags) +nu_map(Lm_list *lml, caddr_t addr, size_t len, int prot, int flags) { caddr_t va; int err; @@ -3041,7 +3033,7 @@ nu_map(caddr_t addr, size_t len, int prot, int flags) if ((nu_fd = open(MSG_ORIG(MSG_PTH_DEVNULL), O_RDONLY)) == FD_UNAVAIL) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_OPEN), MSG_ORIG(MSG_PTH_DEVNULL), strerror(err)); return (MAP_FAILED); } @@ -3050,7 +3042,7 @@ nu_map(caddr_t addr, size_t len, int prot, int flags) if ((va = (caddr_t)mmap(addr, len, prot, flags, nu_fd, 0)) == MAP_FAILED) { err = errno; - eprintf(ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_SYS_MMAP), MSG_ORIG(MSG_PTH_DEVNULL), strerror(err)); } return (va); @@ -3092,7 +3084,7 @@ unused(Lm_list *lml) */ tracing = lml->lm_flags & (LML_FLG_TRC_UNREF | LML_FLG_TRC_UNUSED); - if ((tracing == 0) && (dbg_mask == 0)) + if ((tracing == 0) && (DBG_ENABLED == 0)) return; /* @@ -3107,7 +3099,7 @@ unused(Lm_list *lml) * determine whether any of this objects callers haven't * referenced it. */ - if ((tracing & LML_FLG_TRC_UNREF) || dbg_mask) { + if ((tracing & LML_FLG_TRC_UNREF) || DBG_ENABLED) { Bnd_desc ** bdpp; Aliste off; @@ -3126,15 +3118,15 @@ unused(Lm_list *lml) if (tracing & LML_FLG_TRC_UNREF) (void) printf(MSG_ORIG(MSG_STR_NL)); else - DBG_CALL(Dbg_util_nl()); + DBG_CALL(Dbg_util_nl(lml, + DBG_NL_STD)); } if (tracing & LML_FLG_TRC_UNREF) (void) printf(MSG_INTL(MSG_LDD_UNREF_FMT), NAME(lmp), NAME(clmp)); else - DBG_CALL(Dbg_unused_unref(NAME(lmp), - NAME(clmp))); + DBG_CALL(Dbg_unused_unref(lmp, NAME(clmp))); } } @@ -3149,26 +3141,25 @@ unused(Lm_list *lml) if (tracing) (void) printf(MSG_ORIG(MSG_STR_NL)); else - DBG_CALL(Dbg_util_nl()); + DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD)); } if (CYCGROUP(lmp)) { if (tracing) (void) printf(MSG_INTL(MSG_LDD_UNCYC_FMT), NAME(lmp), CYCGROUP(lmp)); else - DBG_CALL(Dbg_unused_file(NAME(lmp), 0, + DBG_CALL(Dbg_unused_file(lml, NAME(lmp), 0, CYCGROUP(lmp))); } else { if (tracing) (void) printf(MSG_INTL(MSG_LDD_UNUSED_FMT), NAME(lmp)); else - DBG_CALL(Dbg_unused_file(NAME(lmp), 0, 0)); + DBG_CALL(Dbg_unused_file(lml, NAME(lmp), 0, 0)); } } - if (dbg_mask) - DBG_CALL(Dbg_util_nl()); + DBG_CALL(Dbg_util_nl(lml, DBG_NL_STD)); } /* @@ -3452,7 +3443,7 @@ const char * demangle(const char *name) { if (rtld_flags & RT_FL_DEMANGLE) - return (conv_sym_dem(name)); + return (conv_demangle_name(name)); else return (name); } diff --git a/usr/src/cmd/sgs/rtld/i386/Makefile b/usr/src/cmd/sgs/rtld/i386/Makefile index d00fb35c45..7862afeec0 100644 --- a/usr/src/cmd/sgs/rtld/i386/Makefile +++ b/usr/src/cmd/sgs/rtld/i386/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,16 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" # +BASEPLAT = i386 + # Object lists are organized into primary (most frequently used code) and # secondary lists (less frequently used code, ie. profiling support). @@ -33,7 +35,7 @@ P_COMOBJS= debugdata.o \ analyze.o elf.o globals.o malloc.o \ mutex.o paths.o setup.o util.o \ dlfcns.o config_elf.o locale.o tsort.o \ - getcwd.o remove.o sunwmove.o tls.o \ + getcwd.o remove.o move.o tls.o \ cap.o S_COMOBJS= debug.o audit.o object.o @@ -55,8 +57,6 @@ CRTI= pics/crti.o CRTN= pics/crtn.o CRTS= $(CRTI) $(CRTN) -BASEPLAT= i386 - # __GNUC is overridden in the environment when building with gcc __GNUC:sh= echo \\043 @@ -68,7 +68,6 @@ include $(SRC)/cmd/sgs/rtld/Makefile.com # Add any machine specific flags. -CPPFLAGS += -I../../../../uts/$(PLAT)/krtld ADBGENCFLAGS += -erroff=%all ADBGENFLAGS += -milp32 ADBSUB= $(ADBSUB32) @@ -76,6 +75,8 @@ SONAME= $(VAR_RTLD_SONAME) SGSMSGTARG += $(SGSMSGINTEL) $(SGSMSGINTEL32) $(SGSMSG32) +MAPFILES += ../common/mapfile-32-vers + .KEEP_STATE: all: $(RTLD) @@ -88,8 +89,4 @@ adbmacros: adb .WAIT $(ADBSCRIPTS) adbinstall: adbmacros .WAIT $(ROOTADB) -pics/%.o: $(SRCBASE)/uts/$(PLAT)/krtld/%.c - $(COMPILE.c) -o $@ $< $(WARNFLAGS) - $(POST_PROCESS_O) - include $(SRC)/cmd/sgs/rtld/Makefile.targ diff --git a/usr/src/cmd/sgs/rtld/i386/_setup.c b/usr/src/cmd/sgs/rtld/i386/_setup.c index 6112fbda1d..4a3b801265 100644 --- a/usr/src/cmd/sgs/rtld/i386/_setup.c +++ b/usr/src/cmd/sgs/rtld/i386/_setup.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,14 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 1988 AT&T + * All Rights Reserved + * + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - #pragma ident "%Z%%M% %I% %E% SMI" /* @@ -48,10 +48,10 @@ #include <sys/stat.h> #include <link.h> #include <dlfcn.h> +#include <debug.h> #include "_rtld.h" #include "_audit.h" #include "msg.h" -#include "debug.h" extern int _end; extern int _etext; diff --git a/usr/src/cmd/sgs/rtld/i386/i386_elf.c b/usr/src/cmd/sgs/rtld/i386/i386_elf.c index e1e70e4e80..1fa149bdd3 100644 --- a/usr/src/cmd/sgs/rtld/i386/i386_elf.c +++ b/usr/src/cmd/sgs/rtld/i386/i386_elf.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -42,13 +41,13 @@ #include <dlfcn.h> #include <synch.h> #include <string.h> +#include <debug.h> +#include <reloc.h> +#include <conv.h> #include "_rtld.h" #include "_audit.h" #include "_elf.h" #include "msg.h" -#include "debug.h" -#include "reloc.h" -#include "conv.h" extern void elf_rtbndr(Rt_map *, ulong_t, caddr_t); @@ -117,7 +116,7 @@ elf_plt_trace_write(uint_t roffset, Rt_map *rlmp, Rt_map *dlmp, Sym *sym, * library that is interested in this binding. */ dyn_plt = (uchar_t *)((uintptr_t)AUDINFO(rlmp)->ai_dynplts + - (pltndx * dyn_plt_ent_size)); + (pltndx * dyn_plt_ent_size)); /* * Have we initialized this dynamic plt entry yet? If we haven't do it @@ -126,8 +125,9 @@ elf_plt_trace_write(uint_t roffset, Rt_map *rlmp, Rt_map *dlmp, Sym *sym, * we just set the plt to point to the new dyn_plt. */ if (*dyn_plt == 0) { - Sym * symp; + Sym *symp; Word symvalue; + Lm_list *lml = LIST(rlmp); (void) memcpy((void *)dyn_plt, dyn_plt_template, sizeof (dyn_plt_template)); @@ -141,7 +141,7 @@ elf_plt_trace_write(uint_t roffset, Rt_map *rlmp, Rt_map *dlmp, Sym *sym, symvalue = (Word)dyndata; if (do_reloc(R_386_32, &dyn_plt[4], &symvalue, MSG_ORIG(MSG_SYM_LADYNDATA), - MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) { + MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) { *fail = 1; return (0); } @@ -156,7 +156,7 @@ elf_plt_trace_write(uint_t roffset, Rt_map *rlmp, Rt_map *dlmp, Sym *sym, symvalue = (ulong_t)(elf_plt_trace) - (ulong_t)(dyn_plt + 9); if (do_reloc(R_386_PC32, &dyn_plt[9], &symvalue, MSG_ORIG(MSG_SYM_ELFPLTTRACE), - MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) { + MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) { *fail = 1; return (0); } @@ -194,14 +194,15 @@ elf_plt_trace_write(uint_t roffset, Rt_map *rlmp, Rt_map *dlmp, Sym *sym, ulong_t elf_bndr(Rt_map *lmp, ulong_t reloff, caddr_t from) { - Rt_map *nlmp, * llmp; + Rt_map *nlmp, *llmp; ulong_t addr, symval, rsymndx; char *name; Rel *rptr; Sym *sym, *nsym; - uint_t binfo, sb_flags = 0; + uint_t binfo, sb_flags = 0, dbg_class; Slookup sl; - int entry, dbg_save, lmflags; + int entry, lmflags; + Lm_list *lml; /* * For compatibility with libthread (TI_VERSION 1) we track the entry @@ -211,9 +212,10 @@ elf_bndr(Rt_map *lmp, ulong_t reloff, caddr_t from) */ entry = enter(); - if ((lmflags = LIST(lmp)->lm_flags) & LML_FLG_RTLDLM) { - dbg_save = dbg_mask; - dbg_mask = 0; + lml = LIST(lmp); + if ((lmflags = lml->lm_flags) & LML_FLG_RTLDLM) { + dbg_class = dbg_desc->d_class; + dbg_desc->d_class = 0; } /* @@ -222,10 +224,10 @@ elf_bndr(Rt_map *lmp, ulong_t reloff, caddr_t from) * over the .got entries or jumped to plt0 out of the blue. */ if (!lmp || ((reloff % sizeof (Rel)) != 0)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_PLTREF), - conv_reloc_386_type_str(R_386_JMP_SLOT), - EC_ADDR(lmp), EC_XWORD(reloff), EC_ADDR(from)); - rtldexit(LIST(lmp), 1); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_PLTREF), + conv_reloc_386_type(R_386_JMP_SLOT), + EC_NATPTR(lmp), EC_XWORD(reloff), EC_NATPTR(from)); + rtldexit(lml, 1); } /* @@ -241,22 +243,22 @@ elf_bndr(Rt_map *lmp, ulong_t reloff, caddr_t from) * Determine the last link-map of this list, this'll be the starting * point for any tsort() processing. */ - llmp = LIST(lmp)->lm_tail; + llmp = lml->lm_tail; /* * Find definition for symbol. */ sl.sl_name = name; sl.sl_cmap = lmp; - sl.sl_imap = LIST(lmp)->lm_head; + sl.sl_imap = lml->lm_head; sl.sl_hash = 0; sl.sl_rsymndx = rsymndx; sl.sl_flags = LKUP_DEFT; if ((nsym = lookup_sym(&sl, &nlmp, &binfo)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp), demangle(name)); - rtldexit(LIST(lmp), 1); + rtldexit(lml, 1); } symval = nsym->st_value; @@ -268,10 +270,10 @@ elf_bndr(Rt_map *lmp, ulong_t reloff, caddr_t from) * Record that this new link map is now bound to the caller. */ if (bind_one(lmp, nlmp, BND_REFER) == 0) - rtldexit(LIST(lmp), 1); + rtldexit(lml, 1); } - if ((LIST(lmp)->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) { + if ((lml->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) { uint_t symndx = (((uintptr_t)nsym - (uintptr_t)SYMTAB(nlmp)) / SYMENT(nlmp)); symval = audit_symbind(lmp, nlmp, nsym, symndx, symval, @@ -282,7 +284,7 @@ elf_bndr(Rt_map *lmp, ulong_t reloff, caddr_t from) addr = rptr->r_offset; if (!(FLAGS(lmp) & FLG_RT_FIXED)) addr += ADDR(lmp); - if (((LIST(lmp)->lm_tflags | FLAGS1(lmp)) & + if (((lml->lm_tflags | FLAGS1(lmp)) & (LML_TFLG_AUD_PLTENTER | LML_TFLG_AUD_PLTEXIT)) && AUDINFO(lmp)->ai_dynplts) { int fail = 0; @@ -295,7 +297,7 @@ elf_bndr(Rt_map *lmp, ulong_t reloff, caddr_t from) nsym, symndx, pltndx, (caddr_t)symval, sb_flags, &fail); if (fail) - rtldexit(LIST(lmp), 1); + rtldexit(lml, 1); } else { /* * Write standard PLT entry to jump directly @@ -308,9 +310,9 @@ elf_bndr(Rt_map *lmp, ulong_t reloff, caddr_t from) /* * Print binding information and rebuild PLT entry. */ - DBG_CALL(Dbg_bind_global(NAME(lmp), from, from - ADDR(lmp), - (Xword)(reloff / sizeof (Rel)), PLT_T_FULL, NAME(nlmp), - (caddr_t)symval, (caddr_t)nsym->st_value, name, binfo)); + DBG_CALL(Dbg_bind_global(lmp, (Addr)from, (Off)(from - ADDR(lmp)), + (Xword)(reloff / sizeof (Rel)), PLT_T_FULL, nlmp, (Addr)symval, + nsym->st_value, name, binfo)); /* * Complete any processing for newly loaded objects. Note we don't @@ -342,11 +344,11 @@ elf_bndr(Rt_map *lmp, ulong_t reloff, caddr_t from) */ if (entry) { is_dep_init(nlmp, lmp); - leave(LIST(lmp)); + leave(lml); } if (lmflags & LML_FLG_RTLDLM) - dbg_mask = dbg_save; + dbg_desc->d_class = dbg_class; return (symval); } @@ -535,10 +537,10 @@ elf_reloc(Rt_map *lmp, uint_t plt) } } if (!relbgn || (relbgn == relend)) { - DBG_CALL(Dbg_reloc_run(NAME(lmp), 0, plt, DBG_REL_NONE)); + DBG_CALL(Dbg_reloc_run(lmp, 0, plt, DBG_REL_NONE)); return (1); } - DBG_CALL(Dbg_reloc_run(NAME(lmp), M_REL_SHT_TYPE, plt, DBG_REL_START)); + DBG_CALL(Dbg_reloc_run(lmp, M_REL_SHT_TYPE, plt, DBG_REL_START)); /* * If we're processing a dynamic executable in lazy mode there is no @@ -565,7 +567,7 @@ elf_reloc(Rt_map *lmp, uint_t plt) * jump if we've been given a hint on the number of relocations. */ if ((rtype == R_386_RELATIVE) && - !(FLAGS(lmp) & FLG_RT_FIXED) && !dbg_mask) { + ((FLAGS(lmp) & FLG_RT_FIXED) == 0) && (DBG_ENABLED == 0)) { /* * It's possible that the relative relocation block * has relocations against the text segment as well @@ -696,9 +698,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) (rtype != R_386_COPY)) { /* LINTED */ if (psymdef == 0) { - DBG_CALL(Dbg_bind_weak( - NAME(lmp), (caddr_t)roffset, - (caddr_t) + DBG_CALL(Dbg_bind_weak(lmp, + (Addr)roffset, (Addr) (roffset - basebgn), name)); continue; } @@ -763,11 +764,13 @@ elf_reloc(Rt_map *lmp, uint_t plt) * chkmsg: MSG_INTL(MSG_LDD_SYM_NFOUND) */ if (symdef == 0) { + Lm_list *lml = LIST(lmp); + if (bind != STB_WEAK) { - if (LIST(lmp)->lm_flags & + if (lml->lm_flags & LML_FLG_IGNRELERR) { continue; - } else if (LIST(lmp)->lm_flags & + } else if (lml->lm_flags & LML_FLG_TRC_WARN) { (void) printf(MSG_INTL( MSG_LDD_SYM_NFOUND), @@ -775,7 +778,7 @@ elf_reloc(Rt_map *lmp, uint_t plt) NAME(lmp)); continue; } else { - eprintf(ERR_FATAL, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp), demangle(name)); @@ -786,9 +789,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) psymndx = rsymndx; psymdef = 0; - DBG_CALL(Dbg_bind_weak( - NAME(lmp), (caddr_t)roffset, - (caddr_t) + DBG_CALL(Dbg_bind_weak(lmp, + (Addr)roffset, (Addr) (roffset - basebgn), name)); continue; } @@ -892,7 +894,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) /* * Call relocation routine to perform required relocation. */ - DBG_CALL(Dbg_reloc_in(M_MACH, M_REL_SHT_TYPE, rel, name, NULL)); + DBG_CALL(Dbg_reloc_in(LIST(lmp), ELF_DBG_RTLD, M_MACH, + M_REL_SHT_TYPE, rel, NULL, name)); switch (rtype) { case R_386_COPY: @@ -921,7 +924,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) * Write standard PLT entry to jump directly * to newly bound function. */ - DBG_CALL(Dbg_reloc_apply((Xword)roffset, + DBG_CALL(Dbg_reloc_apply_val(LIST(lmp), + ELF_DBG_RTLD, (Xword)roffset, (Xword)value)); *(ulong_t *)roffset = value; } @@ -930,12 +934,12 @@ elf_reloc(Rt_map *lmp, uint_t plt) /* * Write the relocation out. */ - if (do_reloc(rtype, (uchar_t *)roffset, - (Word *)&value, name, NAME(lmp)) == 0) + if (do_reloc(rtype, (uchar_t *)roffset, (Word *)&value, + name, NAME(lmp), LIST(lmp)) == 0) ret = 0; - DBG_CALL(Dbg_reloc_apply((Xword)roffset, - (Xword)value)); + DBG_CALL(Dbg_reloc_apply_val(LIST(lmp), ELF_DBG_RTLD, + (Xword)roffset, (Xword)value)); } if ((ret == 0) && @@ -943,10 +947,9 @@ elf_reloc(Rt_map *lmp, uint_t plt) break; if (binfo) { - DBG_CALL(Dbg_bind_global(NAME(lmp), (caddr_t)roffset, - (caddr_t)(roffset - basebgn), (Xword)(-1), - PLT_T_FULL, NAME(_lmp), (caddr_t)value, - (caddr_t)symdef->st_value, name, binfo)); + DBG_CALL(Dbg_bind_global(lmp, (Addr)roffset, + (Off)(roffset - basebgn), (Xword)(-1), PLT_T_FULL, + _lmp, (Addr)value, symdef->st_value, name, binfo)); } } @@ -1030,7 +1033,8 @@ _elf_copy_reloc(const char *name, Rt_map *rlmp, Rt_map *dlmp) */ rel.r_offset = (Addr)ref; rel.r_info = (Word)R_386_COPY; - DBG_CALL(Dbg_reloc_in(M_MACH, M_REL_SHT_TYPE, &rel, name, 0)); + DBG_CALL(Dbg_reloc_in(LIST(rlmp), ELF_DBG_RTLD, M_MACH, M_REL_SHT_TYPE, + &rel, NULL, name)); return (elf_copy_reloc((char *)name, symref, rlmp, (void *)ref, symdef, _lmp, (void *)def)); @@ -1043,7 +1047,7 @@ elf_copy_gen(Rt_map *lmp) r_debug.rtd_rdebug.r_ldbase) && !(strcmp(interp->i_name, MSG_ORIG(MSG_PTH_LIBC)))) { - DBG_CALL(Dbg_reloc_run(NAME(lmp), M_REL_SHT_TYPE, 0, + DBG_CALL(Dbg_reloc_run(lmp, M_REL_SHT_TYPE, 0, DBG_REL_START)); if (_elf_copy_reloc(MSG_ORIG(MSG_SYM_CTYPE), lmp, @@ -1080,7 +1084,7 @@ elf_plt_write(uintptr_t addr, uintptr_t vaddr, void *rptr, uintptr_t symval, * ld.so.1. */ const char * -_conv_reloc_type_str(uint_t rel) +_conv_reloc_type(uint_t rel) { - return (conv_reloc_386_type_str(rel)); + return (conv_reloc_386_type(rel)); } diff --git a/usr/src/cmd/sgs/rtld/mdbmod/Makefile.com b/usr/src/cmd/sgs/rtld/mdbmod/Makefile.com index 8d5e31fa31..e4786df697 100644 --- a/usr/src/cmd/sgs/rtld/mdbmod/Makefile.com +++ b/usr/src/cmd/sgs/rtld/mdbmod/Makefile.com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2001-2003 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -29,18 +29,14 @@ LIBRARY= rtld.a VERS= .1 - COMOBJS= rtld.o BLTOBJ= msg.o OBJECTS= $(BLTOBJ) $(COMOBJS) - # include library definitions include $(SRC)/lib/Makefile.lib -include ../../../Makefile.com - -SRCBASE= ../../../../.. +include $(SRC)/cmd/sgs/Makefile.com SGSMSGALL= rtld.msg @@ -70,17 +66,14 @@ $(VAR_POUND_2)LIBS += $(LIBRARY) # definitions for lint -CFLAGS += -CFLAGS64 += CPPFLAGS += -I. -I../common -I../../common -I../../../include \ -I../../../include/$(MACH) \ - -I$(SRCBASE)/lib/libc/inc \ - -I$(SRCBASE)/uts/common/krtld \ - -I$(SRCBASE)/uts/$(ARCH)/sys + -I$(SRC)/lib/libc/inc \ + -I$(SRC)/uts/common/krtld \ + -I$(SRC)/uts/$(ARCH)/sys -CPPFLAGS64 += DYNFLAGS += $(VERSREF) -M $(MAPFILE) -LDLIBS += $(CONVLIBDIR) -lconv -lc +LDLIBS += $(CONVLIBDIR) $(CONV_LIB) -lc ROOTMDBLIB= $(ROOT)/usr/lib/mdb/proc ROOTMDBLIB64= $(ROOTMDBLIB)/$(MACH64) diff --git a/usr/src/cmd/sgs/rtld/mdbmod/Makefile.targ b/usr/src/cmd/sgs/rtld/mdbmod/Makefile.targ index ea4be19c3f..42f6344249 100644 --- a/usr/src/cmd/sgs/rtld/mdbmod/Makefile.targ +++ b/usr/src/cmd/sgs/rtld/mdbmod/Makefile.targ @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,13 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2001,2002 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # +# ident "%Z%%M% %I% %E% SMI" +# $(DYNLIB): $(MAPFILE) @@ -40,8 +40,6 @@ include $(SRC)/cmd/sgs/Makefile.targ chkmsg: $(LINTSRCS) sh $(CHKMSG) $(CHKMSGFLAGS) $(LINTSRCS) -lint: $(LINTOUT32) $(SGSLINTOUT) - $(BLTDEFS) + \ $(BLTDATA) + \ $(BLTMESG): $(SGSMSGALL) diff --git a/usr/src/cmd/sgs/rtld/mdbmod/amd64/Makefile b/usr/src/cmd/sgs/rtld/mdbmod/amd64/Makefile index 953cc45914..7600730d46 100644 --- a/usr/src/cmd/sgs/rtld/mdbmod/amd64/Makefile +++ b/usr/src/cmd/sgs/rtld/mdbmod/amd64/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,27 +18,27 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# +# ident "%Z%%M% %I% %E% SMI" # -include ../Makefile.com +include ../Makefile.com -CONVLIBDIR= $(CONVLIBDIR64) -MTARG= amd64/ -CPPFLAGS += -D_ELF64 +CONVLIBDIR = $(CONVLIBDIR64) +MTARG = amd64/ +CPPFLAGS += -D_ELF64 .KEEP_STATE: -all: $(BLTDEFS) .WAIT $(DYNLIB) -install: all .WAIT $(ROOTMDBLIBS) +all: $(BLTDEFS) .WAIT $(DYNLIB) +install: all .WAIT $(ROOTMDBLIBS) -include ../Makefile.targ -include ../../../../../Makefile.master.64 +lint: $(LINTOUT64) $(SGSLINTOUT) +include ../Makefile.targ +include ../../../Makefile.sub.64 diff --git a/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c b/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c index b37e9ce0b2..a4765cc139 100644 --- a/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c +++ b/usr/src/cmd/sgs/rtld/mdbmod/common/rtld.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -1122,8 +1122,8 @@ dcmd_GrpHdl(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) * Determine the handles owner. Note that an orphaned handle may no * longer contain its originating owner. */ - if (gh.gh_owner) { - if ((str = Rtmap_Name((uintptr_t)gh.gh_owner)) == 0) + if (gh.gh_ownlmp) { + if ((str = Rtmap_Name((uintptr_t)gh.gh_ownlmp)) == 0) return (DCMD_ERR); } else str = (char *)MSG_ORIG(MSG_STR_ORPHANED); @@ -1399,7 +1399,7 @@ dcmd_ElfDyn(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) } mdb_printf(MSG_ORIG(MSG_ELFDYN_TITLE), addr); - dynstr = conv_dyntag_str(dyn.d_tag, M_MACH); + dynstr = conv_dyn_tag(dyn.d_tag, M_MACH); mdb_printf(MSG_ORIG(MSG_ELFDYN_LINE1), addr, dynstr, dyn.d_un.d_ptr); mdb_set_dot(addr + sizeof (Dyn)); @@ -1437,19 +1437,19 @@ dcmd_ElfEhdr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) (byte[EI_MAG2] ? byte[EI_MAG2] : '0'), (byte[EI_MAG3] ? byte[EI_MAG3] : '0')); mdb_printf(MSG_ORIG(MSG_EHDR_LINE2), - conv_eclass_str(ehdr.e_ident[EI_CLASS]), - conv_edata_str(ehdr.e_ident[EI_DATA])); + conv_ehdr_class(ehdr.e_ident[EI_CLASS]), + conv_ehdr_data(ehdr.e_ident[EI_DATA])); mdb_printf(MSG_ORIG(MSG_EHDR_LINE3), - conv_emach_str(ehdr.e_machine), conv_ever_str(ehdr.e_version)); - mdb_printf(MSG_ORIG(MSG_EHDR_LINE4), conv_etype_str(ehdr.e_type)); + conv_ehdr_mach(ehdr.e_machine), conv_ehdr_vers(ehdr.e_version)); + mdb_printf(MSG_ORIG(MSG_EHDR_LINE4), conv_ehdr_type(ehdr.e_type)); /* * Line up the flags differently depending on wether we * received a numeric (e.g. "0x200") or text represent- * ation (e.g. "[ EF_SPARC_SUN_US1 ]"). */ - flgs = conv_eflags_str(ehdr.e_machine, ehdr.e_flags); + flgs = conv_ehdr_flags(ehdr.e_machine, ehdr.e_flags); if (flgs[0] == '[') mdb_printf(MSG_ORIG(MSG_EHDR_LINE5), flgs); else @@ -1490,13 +1490,11 @@ dcmd_ElfPhdr(uintptr_t addr, uint_t flags, int argc, const mdb_arg_t *argv) mdb_printf(MSG_ORIG(MSG_EPHDR_TITLE), addr); mdb_printf(MSG_ORIG(MSG_EPHDR_LINE1), phdr.p_vaddr, - conv_phdrflg_str(phdr.p_flags)); + conv_phdr_flags(phdr.p_flags)); mdb_printf(MSG_ORIG(MSG_EPHDR_LINE2), phdr.p_paddr, - conv_phdrtyp_str(M_MACH, phdr.p_type)); - mdb_printf(MSG_ORIG(MSG_EPHDR_LINE3), phdr.p_filesz, - phdr.p_memsz); - mdb_printf(MSG_ORIG(MSG_EPHDR_LINE4), phdr.p_offset, - phdr.p_align); + conv_phdr_type(M_MACH, phdr.p_type)); + mdb_printf(MSG_ORIG(MSG_EPHDR_LINE3), phdr.p_filesz, phdr.p_memsz); + mdb_printf(MSG_ORIG(MSG_EPHDR_LINE4), phdr.p_offset, phdr.p_align); mdb_set_dot(addr + sizeof (Phdr)); diff --git a/usr/src/cmd/sgs/rtld/mdbmod/i386/Makefile b/usr/src/cmd/sgs/rtld/mdbmod/i386/Makefile index d69d2a1e13..be30206afe 100644 --- a/usr/src/cmd/sgs/rtld/mdbmod/i386/Makefile +++ b/usr/src/cmd/sgs/rtld/mdbmod/i386/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,24 +18,24 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 2001 by Sun Microsystems, Inc. -# All rights reserved. -# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # +# ident "%Z%%M% %I% %E% SMI" # -include ../Makefile.com +include ../Makefile.com -CONVLIB= -L../../../libconv/i386 -MTARG= +MTARG = .KEEP_STATE: -all: $(BLTDEFS) .WAIT $(DYNLIB) -install: all .WAIT $(ROOTMDBLIBS) +all: $(BLTDEFS) .WAIT $(DYNLIB) + +install: all .WAIT $(ROOTMDBLIBS) -include ../Makefile.targ +lint: $(LINTOUT32) $(SGSLINTOUT) +include ../Makefile.targ diff --git a/usr/src/cmd/sgs/rtld/mdbmod/sparc/Makefile b/usr/src/cmd/sgs/rtld/mdbmod/sparc/Makefile index 9ec50b59c0..be30206afe 100644 --- a/usr/src/cmd/sgs/rtld/mdbmod/sparc/Makefile +++ b/usr/src/cmd/sgs/rtld/mdbmod/sparc/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,23 +18,24 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright (c) 2001 by Sun Microsystems, Inc. -# All rights reserved. -# +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # +# ident "%Z%%M% %I% %E% SMI" # -include ../Makefile.com +include ../Makefile.com -MTARG= +MTARG = .KEEP_STATE: -all: $(BLTDEFS) .WAIT $(DYNLIB) -install: all .WAIT $(ROOTMDBLIBS) +all: $(BLTDEFS) .WAIT $(DYNLIB) + +install: all .WAIT $(ROOTMDBLIBS) -include ../Makefile.targ +lint: $(LINTOUT32) $(SGSLINTOUT) +include ../Makefile.targ diff --git a/usr/src/cmd/sgs/rtld/mdbmod/sparcv9/Makefile b/usr/src/cmd/sgs/rtld/mdbmod/sparcv9/Makefile index 794ed0c2e8..43f9c51aa0 100644 --- a/usr/src/cmd/sgs/rtld/mdbmod/sparcv9/Makefile +++ b/usr/src/cmd/sgs/rtld/mdbmod/sparcv9/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,27 +18,27 @@ # # CDDL HEADER END # + # -#ident "%Z%%M% %I% %E% SMI" -# -# Copyright 2001-2002 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # -# +# ident "%Z%%M% %I% %E% SMI" # -include ../Makefile.com +include ../Makefile.com -CONVLIBDIR= $(CONVLIBDIR64) -MTARG= sparcv9/ -CPPFLAGS += -D_ELF64 +CONVLIBDIR = $(CONVLIBDIR64) +MTARG = sparcv9/ +CPPFLAGS += -D_ELF64 .KEEP_STATE: -all: $(BLTDEFS) .WAIT $(DYNLIB) -install: all .WAIT $(ROOTMDBLIBS) +all: $(BLTDEFS) .WAIT $(DYNLIB) +install: all .WAIT $(ROOTMDBLIBS) -include ../Makefile.targ -include ../../../../../Makefile.master.64 +lint: $(LINTOUT64) $(SGSLINTOUT) +include ../Makefile.targ +include ../../../Makefile.sub.64 diff --git a/usr/src/cmd/sgs/rtld/sparc/Makefile b/usr/src/cmd/sgs/rtld/sparc/Makefile index ee6902b324..96c5342885 100644 --- a/usr/src/cmd/sgs/rtld/sparc/Makefile +++ b/usr/src/cmd/sgs/rtld/sparc/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -33,7 +33,7 @@ P_COMOBJS= debugdata.o \ analyze.o elf.o globals.o malloc.o \ mutex.o paths.o setup.o util.o \ dlfcns.o config_elf.o locale.o tsort.o \ - getcwd.o remove.o sunwmove.o tls.o \ + getcwd.o remove.o move.o tls.o \ cap.o S_COMOBJS= debug.o audit.o object.o cache_a.out.o \ @@ -58,7 +58,7 @@ CRTS= $(CRTI) $(CRTN) CHKSRCS= $(SRCBASE)/uts/common/krtld/reloc.h -BASEPLAT= sparc +BASEPLAT = sparc # __GNUC is overridden in the environment when building with gcc __GNUC:sh= echo \\043 @@ -80,6 +80,8 @@ ADBGENFLAGS += -milp32 ADBSUB= $(ADBSUB32) SONAME= $(VAR_RTLD_SONAME) +MAPFILES += ../common/mapfile-32-vers + SGSMSGTARG += $(SGSMSGSPARC) $(SGSMSGSPARC32) $(SGSMSG32) .KEEP_STATE: diff --git a/usr/src/cmd/sgs/rtld/sparc/_setup.c b/usr/src/cmd/sgs/rtld/sparc/_setup.c index da72f8ba55..5bc903af65 100644 --- a/usr/src/cmd/sgs/rtld/sparc/_setup.c +++ b/usr/src/cmd/sgs/rtld/sparc/_setup.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,12 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -56,7 +55,6 @@ #ifdef A_OUT #include "_a.out.h" #endif /* A_OUT */ -#include "debug.h" extern int _end; extern int _etext; diff --git a/usr/src/cmd/sgs/rtld/sparc/common_sparc.c b/usr/src/cmd/sgs/rtld/sparc/common_sparc.c index f5fb36d50e..0ed248e903 100644 --- a/usr/src/cmd/sgs/rtld/sparc/common_sparc.c +++ b/usr/src/cmd/sgs/rtld/sparc/common_sparc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2000-2002 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -63,7 +63,7 @@ * Test the compatiblity of two register symbols, 0 pass, >0 fail */ static uintptr_t -check_regsyms(Sym * sym1, const char * name1, Sym * sym2, const char * name2) +check_regsyms(Sym *sym1, const char *name1, Sym *sym2, const char *name2) { if ((sym1->st_name == 0) && (sym2->st_name == 0)) return (0); /* scratches are always compatible */ @@ -119,7 +119,7 @@ elf_regsyms(Rt_map * lmp) (rsymndx * SYMENT(lmp))); for (rp = reglist; rp; rp = rp->rl_next) { - const char * str, * sym1, * sym2; + const char *str, *sym1, *sym2; if (rp->rl_sym == symdef) { /* @@ -135,7 +135,7 @@ elf_regsyms(Rt_map * lmp) continue; if ((str = demangle(sym1)) != sym1) { - char * _str = alloca(strlen(str) + 1); + char *_str = alloca(strlen(str) + 1); (void) strcpy(_str, str); sym1 = (const char *)_str; } @@ -143,11 +143,12 @@ elf_regsyms(Rt_map * lmp) if (LIST(lmp)->lm_flags & LML_FLG_TRC_WARN) { (void) printf(MSG_INTL(MSG_LDD_REG_SYMCONF), - conv_sym_SPARC_value_str(symdef->st_value), + conv_sym_SPARC_value(symdef->st_value), NAME(rp->rl_lmp), sym1, NAME(lmp), sym2); } else { - eprintf(ERR_FATAL, MSG_INTL(MSG_REG_SYMCONF), - conv_sym_SPARC_value_str(symdef->st_value), + eprintf(LIST(lmp), ERR_FATAL, + MSG_INTL(MSG_REG_SYMCONF), + conv_sym_SPARC_value(symdef->st_value), NAME(rp->rl_lmp), sym1, NAME(lmp), sym2); return (0); } diff --git a/usr/src/cmd/sgs/rtld/sparc/sparc_a.out.c b/usr/src/cmd/sgs/rtld/sparc/sparc_a.out.c index 7bf1df8190..25286cae24 100644 --- a/usr/src/cmd/sgs/rtld/sparc/sparc_a.out.c +++ b/usr/src/cmd/sgs/rtld/sparc/sparc_a.out.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,14 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright (c) 1988 AT&T + * All Rights Reserved + * + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ -/* Copyright (c) 1988 AT&T */ -/* All Rights Reserved */ - #pragma ident "%Z%%M% %I% %E% SMI" /* @@ -40,11 +40,11 @@ #include <sys/mman.h> #include <synch.h> #include <dlfcn.h> +#include <debug.h> #include "_a.out.h" #include "_rtld.h" #include "_audit.h" #include "msg.h" -#include "debug.h" extern void iflush_range(caddr_t, size_t); @@ -66,15 +66,16 @@ extern void iflush_range(caddr_t, size_t); ulong_t aout_bndr(caddr_t pc) { - Rt_map * lmp, * nlmp, * llmp; + Rt_map *lmp, *nlmp, *llmp; struct relocation_info *rp; struct nlist *sp; - Sym * sym; + Sym *sym; char *name; int rndx, entry; ulong_t symval; Slookup sl; uint_t binfo; + Lm_list *lml; /* * For compatibility with libthread (TI_VERSION 1) we track the entry @@ -106,22 +107,23 @@ aout_bndr(caddr_t pc) * Determine the last link-map of this list, this'll be the starting * point for any tsort() processing. */ - llmp = LIST(lmp)->lm_tail; + lml = LIST(lmp); + llmp = lml->lm_tail; /* * Find definition for symbol. */ sl.sl_name = name; sl.sl_cmap = lmp; - sl.sl_imap = LIST(lmp)->lm_head; + sl.sl_imap = lml->lm_head; sl.sl_hash = 0; sl.sl_rsymndx = 0; sl.sl_flags = LKUP_DEFT; if ((sym = aout_lookup_sym(&sl, &nlmp, &binfo)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp), demangle(name)); - rtldexit(LIST(lmp), 1); + rtldexit(lml, 1); } symval = sym->st_value; @@ -133,16 +135,15 @@ aout_bndr(caddr_t pc) * Record that this new link map is now bound to the caller. */ if (bind_one(lmp, nlmp, BND_REFER) == 0) - rtldexit(LIST(lmp), 1); + rtldexit(lml, 1); } /* * Print binding information and rebuild PLT entry. */ - DBG_CALL(Dbg_bind_global(NAME(lmp), - (caddr_t)(ADDR(lmp) + rp->r_address), (caddr_t)rp->r_address, - (Xword)(-1), PLT_T_NONE, NAME(nlmp), (caddr_t)symval, - (caddr_t)sym->st_value, name, binfo)); + DBG_CALL(Dbg_bind_global(lmp, (Addr)(ADDR(lmp) + rp->r_address), + (Off)rp->r_address, (Xword)(-1), PLT_T_NONE, nlmp, + (Addr)symval, sym->st_value, name, binfo)); if (!(rtld_flags & RT_FL_NOBIND)) aout_plt_write((caddr_t)(ADDR(lmp) + rp->r_address), symval); @@ -169,7 +170,7 @@ aout_bndr(caddr_t pc) */ if (entry) { is_dep_init(nlmp, lmp); - leave(LIST(lmp)); + leave(lml); } return (symval); @@ -220,8 +221,9 @@ aout_reloc(Rt_map * lmp, uint_t plt) Sym * sym; /* symbol definition */ int textrel = 0, ret = 1; Alist *bound = 0; + Lm_list *lml = LIST(lmp); - DBG_CALL(Dbg_reloc_run(NAME(lmp), SHT_RELA, plt, DBG_REL_START)); + DBG_CALL(Dbg_reloc_run(lmp, SHT_RELA, plt, DBG_REL_START)); /* * If we've been called upon to promote an RTLD_LAZY object to an @@ -287,13 +289,13 @@ aout_reloc(Rt_map * lmp, uint_t plt) sl.sl_flags = (LKUP_DEFT | LKUP_ALLCNTLIST); if ((sym = aout_lookup_sym(&sl, &_lmp, &binfo)) == 0) { - if (LIST(lmp)->lm_flags & LML_FLG_TRC_WARN) { + if (lml->lm_flags & LML_FLG_TRC_WARN) { (void) printf(MSG_INTL(MSG_LDD_SYM_NFOUND), demangle(name), NAME(lmp)); continue; } else { - eprintf(ERR_FATAL, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp), demangle(name)); ret = 0; @@ -323,10 +325,9 @@ aout_reloc(Rt_map * lmp, uint_t plt) if (IS_PC_RELATIVE(rp->r_type)) value -= (long)ADDR(lmp); - DBG_CALL(Dbg_bind_global(NAME(lmp), (caddr_t)ra, - (caddr_t)(ra - ADDR(lmp)), (Xword)(-1), PLT_T_NONE, - NAME(_lmp), (caddr_t)value, (caddr_t)sym->st_value, - name, binfo)); + DBG_CALL(Dbg_bind_global(lmp, (Addr)ra, + (Off)(ra - ADDR(lmp)), (Xword)(-1), PLT_T_NONE, + _lmp, (Addr)value, sym->st_value, name, binfo)); } /* @@ -346,7 +347,7 @@ aout_reloc(Rt_map * lmp, uint_t plt) case RELOC_DISP8: value += *ra & S_MASK(8); if (!S_INRANGE(value, 8)) - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW), NAME(lmp), (name ? demangle(name) : MSG_INTL(MSG_STR_UNKNOWN)), (int)value, 8, (uint_t)ra); @@ -368,7 +369,7 @@ aout_reloc(Rt_map * lmp, uint_t plt) case RELOC_DISP16: value += *ra & S_MASK(16); if (!S_INRANGE(value, 16)) - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW), NAME(lmp), (name ? demangle(name) : MSG_INTL(MSG_STR_UNKNOWN)), (int)value, 16, (uint_t)ra); @@ -378,7 +379,7 @@ aout_reloc(Rt_map * lmp, uint_t plt) case RELOC_BASE22: value += *ra & S_MASK(22); if (!S_INRANGE(value, 22)) - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW), NAME(lmp), (name ? demangle(name) : MSG_INTL(MSG_STR_UNKNOWN)), (int)value, 22, (uint_t)ra); @@ -394,7 +395,7 @@ aout_reloc(Rt_map * lmp, uint_t plt) value += *ra & S_MASK(22); value >>= 2; if (!S_INRANGE(value, 22)) - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_OVERFLOW), NAME(lmp), (name ? demangle(name) : MSG_INTL(MSG_STR_UNKNOWN)), (int)value, 22, (uint_t)ra); @@ -414,9 +415,9 @@ aout_reloc(Rt_map * lmp, uint_t plt) *(long *)ra = value; break; default: - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_UNIMPL), NAME(lmp), - (name ? demangle(name) : MSG_INTL(MSG_STR_UNKNOWN)), - rp->r_type); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_UNIMPL), + NAME(lmp), (name ? demangle(name) : + MSG_INTL(MSG_STR_UNKNOWN)), rp->r_type); ret = 0; break; } diff --git a/usr/src/cmd/sgs/rtld/sparc/sparc_elf.c b/usr/src/cmd/sgs/rtld/sparc/sparc_elf.c index d6d8d38bc4..d453beae09 100644 --- a/usr/src/cmd/sgs/rtld/sparc/sparc_elf.c +++ b/usr/src/cmd/sgs/rtld/sparc/sparc_elf.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,13 +18,13 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -42,13 +41,13 @@ #include <dlfcn.h> #include <synch.h> #include <string.h> +#include <debug.h> +#include <reloc.h> +#include <conv.h> #include "_rtld.h" #include "_audit.h" #include "_elf.h" #include "msg.h" -#include "debug.h" -#include "reloc.h" -#include "conv.h" extern void iflush_range(caddr_t, size_t); @@ -244,8 +243,7 @@ elf_plt_trace_write(caddr_t addr, Rela *rptr, Rt_map *rlmp, Rt_map *dlmp, int *fail) { extern ulong_t elf_plt_trace(); - uintptr_t dyn_plt; - uintptr_t *dyndata; + uintptr_t dyn_plt, *dyndata; /* * If both pltenter & pltexit have been disabled there @@ -272,8 +270,9 @@ elf_plt_trace_write(caddr_t addr, Rela *rptr, Rt_map *rlmp, Rt_map *dlmp, * we just set the plt to point to the new dyn_plt. */ if (*(uint_t *)dyn_plt == 0) { - Sym * symp; + Sym *symp; Xword symvalue; + Lm_list *lml = LIST(rlmp); (void) memcpy((void *)dyn_plt, dyn_plt_template, sizeof (dyn_plt_template)); @@ -286,7 +285,7 @@ elf_plt_trace_write(caddr_t addr, Rela *rptr, Rt_map *rlmp, Rt_map *dlmp, symvalue = (Xword)dyndata; if (do_reloc(R_SPARC_HI22, (uchar_t *)(dyn_plt + 0x20), &symvalue, MSG_ORIG(MSG_SYM_LADYNDATA), - MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) { + MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) { *fail = 1; return (0); } @@ -298,7 +297,7 @@ elf_plt_trace_write(caddr_t addr, Rela *rptr, Rt_map *rlmp, Rt_map *dlmp, symvalue = (Xword)dyndata; if (do_reloc(R_SPARC_LO10, (uchar_t *)(dyn_plt + 0x24), &symvalue, MSG_ORIG(MSG_SYM_LADYNDATA), - MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) { + MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) { *fail = 1; return (0); } @@ -308,10 +307,10 @@ elf_plt_trace_write(caddr_t addr, Rela *rptr, Rt_map *rlmp, Rt_map *dlmp, * call elf_plt_trace */ symvalue = (Xword)((uintptr_t)&elf_plt_trace - - (dyn_plt + 0x28)); + (dyn_plt + 0x28)); if (do_reloc(R_SPARC_WDISP30, (uchar_t *)(dyn_plt + 0x28), &symvalue, MSG_ORIG(MSG_SYM_ELFPLTTRACE), - MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) { + MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) { *fail = 1; return (0); } @@ -361,7 +360,9 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) uint_t binfo, sb_flags = 0; Slookup sl; Pltbindtype pbtype; - int entry, dbg_save, lmflags; + int entry, lmflags; + uint_t dbg_class; + Lm_list *lml = LIST(lmp); /* * For compatibility with libthread (TI_VERSION 1) we track the entry @@ -371,9 +372,9 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) */ entry = enter(); - if ((lmflags = LIST(lmp)->lm_flags) & LML_FLG_RTLDLM) { - dbg_save = dbg_mask; - dbg_mask = 0; + if ((lmflags = lml->lm_flags) & LML_FLG_RTLDLM) { + dbg_class = dbg_desc->d_class; + dbg_desc->d_class = 0; } /* @@ -394,10 +395,10 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) * over the plt entries or jumped to plt0 out of the blue. */ if (!lmp || ((addr % M_PLT_ENTSIZE) != 0)) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_PLTREF), - conv_reloc_SPARC_type_str(R_SPARC_JMP_SLOT), - EC_ADDR(lmp), EC_XWORD(pltoff), EC_ADDR(from)); - rtldexit(LIST(lmp), 1); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_PLTREF), + conv_reloc_SPARC_type(R_SPARC_JMP_SLOT), + EC_NATPTR(lmp), EC_XWORD(pltoff), EC_NATPTR(from)); + rtldexit(lml, 1); } reloff = pltndx * sizeof (Rela); @@ -414,22 +415,22 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) * Determine the last link-map of this list, this'll be the starting * point for any tsort() processing. */ - llmp = LIST(lmp)->lm_tail; + llmp = lml->lm_tail; /* * Find definition for symbol. */ sl.sl_name = name; sl.sl_cmap = lmp; - sl.sl_imap = LIST(lmp)->lm_head; + sl.sl_imap = lml->lm_head; sl.sl_hash = 0; sl.sl_rsymndx = rsymndx; sl.sl_flags = LKUP_DEFT; if ((nsym = lookup_sym(&sl, &nlmp, &binfo)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp), demangle(name)); - rtldexit(LIST(lmp), 1); + rtldexit(lml, 1); } symval = nsym->st_value; @@ -441,10 +442,10 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) * Record that this new link map is now bound to the caller. */ if (bind_one(lmp, nlmp, BND_REFER) == 0) - rtldexit(LIST(lmp), 1); + rtldexit(lml, 1); } - if ((LIST(lmp)->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) { + if ((lml->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) { ulong_t symndx = (((uintptr_t)nsym - (uintptr_t)SYMTAB(nlmp)) / SYMENT(nlmp)); @@ -459,7 +460,7 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) pbtype = PLT_T_NONE; if (!(rtld_flags & RT_FL_NOBIND)) { - if (((LIST(lmp)->lm_tflags | FLAGS1(lmp)) & + if (((lml->lm_tflags | FLAGS1(lmp)) & (LML_TFLG_AUD_PLTENTER | LML_TFLG_AUD_PLTEXIT)) && AUDINFO(lmp)->ai_dynplts) { int fail = 0; @@ -470,7 +471,7 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) rptr, lmp, nlmp, nsym, symndx, pltndx, (caddr_t)symval, sb_flags, &fail); if (fail) - rtldexit(LIST(lmp), 1); + rtldexit(lml, 1); } else { /* * Write standard PLT entry to jump directly @@ -484,9 +485,8 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) /* * Print binding information and rebuild PLT entry. */ - DBG_CALL(Dbg_bind_global(NAME(lmp), from, from - ADDR(lmp), pltndx, - pbtype, NAME(nlmp), (caddr_t)symval, (caddr_t)nsym->st_value, - name, binfo)); + DBG_CALL(Dbg_bind_global(lmp, (Addr)from, (Off)(from - ADDR(lmp)), + pltndx, pbtype, nlmp, (Addr)symval, nsym->st_value, name, binfo)); /* * Complete any processing for newly loaded objects. Note we don't @@ -518,11 +518,11 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) */ if (entry) { is_dep_init(nlmp, lmp); - leave(LIST(lmp)); + leave(lml); } if (lmflags & LML_FLG_RTLDLM) - dbg_mask = dbg_save; + dbg_desc->d_class = dbg_class; return (symval); } @@ -619,7 +619,7 @@ elf_reloc(Rt_map *lmp, uint_t plt) } } if (!relbgn || (relbgn == relend)) { - DBG_CALL(Dbg_reloc_run(NAME(lmp), 0, plt, DBG_REL_NONE)); + DBG_CALL(Dbg_reloc_run(lmp, 0, plt, DBG_REL_NONE)); return (1); } @@ -627,7 +627,7 @@ elf_reloc(Rt_map *lmp, uint_t plt) basebgn = ADDR(lmp); emap = ADDR(lmp) + MSIZE(lmp); - DBG_CALL(Dbg_reloc_run(NAME(lmp), M_REL_SHT_TYPE, plt, DBG_REL_START)); + DBG_CALL(Dbg_reloc_run(lmp, M_REL_SHT_TYPE, plt, DBG_REL_START)); /* * If we're processing in lazy mode there is no need to scan the @@ -652,7 +652,7 @@ elf_reloc(Rt_map *lmp, uint_t plt) * jump if we've been given a hint on the number of relocations. */ if ((rtype == R_SPARC_RELATIVE) && - !(FLAGS(lmp) & FLG_RT_FIXED) && !dbg_mask) { + ((FLAGS(lmp) & FLG_RT_FIXED) == 0) && (DBG_ENABLED == 0)) { /* * It's possible that the relative relocation block * has relocations against the text segment as well @@ -778,9 +778,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) (rtype != R_SPARC_COPY)) { /* LINTED */ if (psymdef == 0) { - DBG_CALL(Dbg_bind_weak( - NAME(lmp), (caddr_t)roffset, - (caddr_t) + DBG_CALL(Dbg_bind_weak(lmp, + (Addr)roffset, (Addr) (roffset - basebgn), name)); continue; } @@ -843,11 +842,13 @@ elf_reloc(Rt_map *lmp, uint_t plt) * may be unresolved. */ if (symdef == 0) { + Lm_list *lml = LIST(lmp); + if (bind != STB_WEAK) { - if (LIST(lmp)->lm_flags & + if (lml->lm_flags & LML_FLG_IGNRELERR) { continue; - } else if (LIST(lmp)->lm_flags & + } else if (lml->lm_flags & LML_FLG_TRC_WARN) { (void) printf(MSG_INTL( MSG_LDD_SYM_NFOUND), @@ -855,7 +856,7 @@ elf_reloc(Rt_map *lmp, uint_t plt) NAME(lmp)); continue; } else { - eprintf(ERR_FATAL, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp), demangle(name)); @@ -866,9 +867,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) psymndx = rsymndx; psymdef = 0; - DBG_CALL(Dbg_bind_weak( - NAME(lmp), (caddr_t)roffset, - (caddr_t) + DBG_CALL(Dbg_bind_weak(lmp, + (Addr)roffset, (Addr) (roffset - basebgn), name)); continue; } @@ -978,7 +978,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) /* * Call relocation routine to perform required relocation. */ - DBG_CALL(Dbg_reloc_in(M_MACH, M_REL_SHT_TYPE, rel, name, NULL)); + DBG_CALL(Dbg_reloc_in(LIST(lmp), ELF_DBG_RTLD, M_MACH, + M_REL_SHT_TYPE, rel, NULL, name)); switch (rtype) { case R_SPARC_REGISTER: @@ -1005,14 +1006,15 @@ elf_reloc(Rt_map *lmp, uint_t plt) } else if (roffset == STO_SPARC_REGISTER_G7) { set_sparc_g7(value); } else { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_BADREG), - NAME(lmp), EC_ADDR(roffset)); + eprintf(LIST(lmp), ERR_FATAL, + MSG_INTL(MSG_REL_BADREG), NAME(lmp), + EC_ADDR(roffset)); ret = 0; break; } - DBG_CALL(Dbg_reloc_reg_apply((Xword)roffset, - (Xword)value)); + DBG_CALL(Dbg_reloc_apply_reg(LIST(lmp), ELF_DBG_RTLD, + M_MACH, (Xword)roffset, (Xword)value)); break; case R_SPARC_COPY: if (elf_copy_reloc(name, symref, lmp, (void *)roffset, @@ -1046,7 +1048,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) * Write standard PLT entry to jump directly * to newly bound function. */ - DBG_CALL(Dbg_reloc_apply((Xword)roffset, + DBG_CALL(Dbg_reloc_apply_val(LIST(lmp), + ELF_DBG_RTLD, (Xword)roffset, (Xword)value)); pbtype = elf_plt_write((uintptr_t)vaddr, (uintptr_t)vaddr, (void *)rel, value, @@ -1063,9 +1066,9 @@ elf_reloc(Rt_map *lmp, uint_t plt) if ((rtype == R_SPARC_GLOB_DAT) || (rtype == R_SPARC_32)) { if (roffset & 0x3) { - eprintf(ERR_FATAL, + eprintf(LIST(lmp), ERR_FATAL, MSG_INTL(MSG_REL_NONALIGN), - conv_reloc_SPARC_type_str(rtype), + conv_reloc_SPARC_type(rtype), NAME(lmp), demangle(name), EC_OFF(roffset)); ret = 0; @@ -1073,7 +1076,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) *(uint_t *)roffset += value; } else { if (do_reloc(rtype, (uchar_t *)roffset, - (Xword *)&value, name, NAME(lmp)) == 0) + (Xword *)&value, name, + NAME(lmp), LIST(lmp)) == 0) ret = 0; } @@ -1081,8 +1085,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) * The value now contains the 'bit-shifted' value that * was or'ed into memory (this was set by do_reloc()). */ - DBG_CALL(Dbg_reloc_apply((Xword)roffset, - (Xword)value)); + DBG_CALL(Dbg_reloc_apply_val(LIST(lmp), ELF_DBG_RTLD, + (Xword)roffset, (Xword)value)); /* * If this relocation is against a text segment, make @@ -1097,10 +1101,9 @@ elf_reloc(Rt_map *lmp, uint_t plt) break; if (binfo) { - DBG_CALL(Dbg_bind_global(NAME(lmp), (caddr_t)roffset, - (caddr_t)(roffset - basebgn), pltndx, pbtype, - NAME(_lmp), (caddr_t)value, - (caddr_t)symdef->st_value, name, binfo)); + DBG_CALL(Dbg_bind_global(lmp, (Addr)roffset, + (Off)(roffset - basebgn), pltndx, pbtype, + _lmp, (Addr)value, symdef->st_value, name, binfo)); } } @@ -1114,7 +1117,7 @@ elf_reloc(Rt_map *lmp, uint_t plt) * ld.so.1. */ const char * -_conv_reloc_type_str(uint_t rel) +_conv_reloc_type(uint_t rel) { - return (conv_reloc_SPARC_type_str(rel)); + return (conv_reloc_SPARC_type(rel)); } diff --git a/usr/src/cmd/sgs/rtld/sparcv9/Makefile b/usr/src/cmd/sgs/rtld/sparcv9/Makefile index 8922db680e..238cf8805a 100644 --- a/usr/src/cmd/sgs/rtld/sparcv9/Makefile +++ b/usr/src/cmd/sgs/rtld/sparcv9/Makefile @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ # # CDDL HEADER END # + # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -33,7 +33,7 @@ P_COMOBJS= debugdata.o \ analyze.o elf.o globals.o malloc.o \ mutex.o paths.o setup.o util.o \ dlfcns.o config_elf.o locale.o tsort.o \ - getcwd.o remove.o sunwmove.o tls.o \ + getcwd.o remove.o move.o tls.o \ cap.o S_COMOBJS= debug.o audit.o object.o @@ -57,7 +57,7 @@ CRTS= $(CRTI) $(CRTN) CHKSRCS= $(SRCBASE)/uts/common/krtld/reloc.h -BASEPLAT= sparc +BASEPLAT = sparc # __GNUC is overridden in the environment when building with gcc __GNUC:sh= echo \\043 @@ -81,6 +81,8 @@ CPPFLAGS += -D_ELF64 LINTFLAGS64 += $(VAR_LINTFLAGS64) SONAME= $(VAR_RTLD_V9_SONAME) +MAPFILES += ../common/mapfile-64-vers + SGSMSGTARG += $(SGSMSGSPARC) $(SGSMSGSPARC64) $(SGSMSG64) LDLIB = -L ../../libld/$(MACH64) @@ -107,10 +109,5 @@ pics/%.o: ../sparc/%.c $(COMPILE.c) -o $@ $< $(WARNFLAGS) $(POST_PROCESS_O) -pics/%.o: $(SRCBASE)/uts/sparc/krtld/%.c - $(COMPILE.c) -o $@ $< $(WARNFLAGS) - $(POST_PROCESS_O) - - include $(SRC)/cmd/sgs/rtld/Makefile.targ include ../../Makefile.sub.64 diff --git a/usr/src/cmd/sgs/rtld/sparcv9/_setup.c b/usr/src/cmd/sgs/rtld/sparcv9/_setup.c index 0ca59ddec1..a5b333375e 100644 --- a/usr/src/cmd/sgs/rtld/sparcv9/_setup.c +++ b/usr/src/cmd/sgs/rtld/sparcv9/_setup.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,12 +18,12 @@ * * CDDL HEADER END */ + /* * Copyright (c) 1988 AT&T * All Rights Reserved * - * - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -51,7 +50,6 @@ #include "_rtld.h" #include "_audit.h" #include "msg.h" -#include "debug.h" extern int _end; extern int _etext; diff --git a/usr/src/cmd/sgs/rtld/sparcv9/sparc_elf.c b/usr/src/cmd/sgs/rtld/sparcv9/sparc_elf.c index a6a9608e30..8368398af9 100644 --- a/usr/src/cmd/sgs/rtld/sparcv9/sparc_elf.c +++ b/usr/src/cmd/sgs/rtld/sparcv9/sparc_elf.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,9 +18,10 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. - * Use is subject to license terms. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. + * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -38,13 +38,13 @@ #include <dlfcn.h> #include <synch.h> #include <string.h> +#include <debug.h> +#include <reloc.h> +#include <conv.h> #include "_rtld.h" #include "_audit.h" #include "_elf.h" #include "msg.h" -#include "debug.h" -#include "reloc.h" -#include "conv.h" extern void iflush_range(caddr_t, size_t); extern void plt_upper_32(uintptr_t, uintptr_t); @@ -300,8 +300,7 @@ elf_plt_trace_write(caddr_t addr, Rela * rptr, Rt_map * rlmp, Rt_map * dlmp, int *fail) { extern ulong_t elf_plt_trace(); - Addr dyn_plt; - Addr * dyndata; + Addr dyn_plt, *dyndata; /* * If both pltenter & pltexit have been disabled there @@ -319,7 +318,7 @@ elf_plt_trace_write(caddr_t addr, Rela * rptr, Rt_map * rlmp, Rt_map * dlmp, * library that is interested in this binding. */ dyn_plt = (Xword)AUDINFO(rlmp)->ai_dynplts + - (pltndx * dyn_plt_ent_size); + (pltndx * dyn_plt_ent_size); /* * Have we initialized this dynamic plt entry yet? If we haven't do it @@ -328,8 +327,9 @@ elf_plt_trace_write(caddr_t addr, Rela * rptr, Rt_map * rlmp, Rt_map * dlmp, * we just set the plt to point to the new dyn_plt. */ if (*(Word *)dyn_plt == 0) { - Sym * symp; + Sym *symp; Xword symvalue; + Lm_list *lml = LIST(rlmp); (void) memcpy((void *)dyn_plt, dyn_plt_template, sizeof (dyn_plt_template)); @@ -342,7 +342,7 @@ elf_plt_trace_write(caddr_t addr, Rela * rptr, Rt_map * rlmp, Rt_map * dlmp, symvalue = (Xword)dyndata; if (do_reloc(R_SPARC_HH22, (Byte *)(dyn_plt + 0x14), &symvalue, MSG_ORIG(MSG_SYM_LADYNDATA), - MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) { + MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) { *fail = 1; return (0); } @@ -354,7 +354,7 @@ elf_plt_trace_write(caddr_t addr, Rela * rptr, Rt_map * rlmp, Rt_map * dlmp, symvalue = (Xword)dyndata; if (do_reloc(R_SPARC_HM10, (Byte *)(dyn_plt + 0x18), &symvalue, MSG_ORIG(MSG_SYM_LADYNDATA), - MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) { + MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) { *fail = 1; return (0); } @@ -366,7 +366,7 @@ elf_plt_trace_write(caddr_t addr, Rela * rptr, Rt_map * rlmp, Rt_map * dlmp, symvalue = (Xword)dyndata; if (do_reloc(R_SPARC_LM22, (Byte *)(dyn_plt + 0x20), &symvalue, MSG_ORIG(MSG_SYM_LADYNDATA), - MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) { + MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) { *fail = 1; return (0); } @@ -378,7 +378,7 @@ elf_plt_trace_write(caddr_t addr, Rela * rptr, Rt_map * rlmp, Rt_map * dlmp, symvalue = (Xword)dyndata; if (do_reloc(R_SPARC_LO10, (Byte *)(dyn_plt + 0x24), &symvalue, MSG_ORIG(MSG_SYM_LADYNDATA), - MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) { + MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) { *fail = 1; return (0); } @@ -388,10 +388,10 @@ elf_plt_trace_write(caddr_t addr, Rela * rptr, Rt_map * rlmp, Rt_map * dlmp, * call elf_plt_trace */ symvalue = (Xword)((Addr)&elf_plt_trace - - (Addr)(dyn_plt + 0x2c)); + (Addr)(dyn_plt + 0x2c)); if (do_reloc(R_SPARC_WDISP30, (Byte *)(dyn_plt + 0x2c), &symvalue, MSG_ORIG(MSG_SYM_ELFPLTTRACE), - MSG_ORIG(MSG_SPECFIL_DYNPLT)) == 0) { + MSG_ORIG(MSG_SPECFIL_DYNPLT), lml) == 0) { *fail = 1; return (0); } @@ -412,12 +412,11 @@ elf_plt_trace_write(caddr_t addr, Rela * rptr, Rt_map * rlmp, Rt_map * dlmp, iflush_range((void *)dyn_plt, sizeof (dyn_plt_template)); } - (void) elf_plt_write((uintptr_t)addr, (uintptr_t)addr, - rptr, (uintptr_t)dyn_plt, pltndx); + (void) elf_plt_write((uintptr_t)addr, (uintptr_t)addr, rptr, + (uintptr_t)dyn_plt, pltndx); return ((caddr_t)dyn_plt); } - /* * Function binding routine - invoked on the first call to a function through * the procedure linkage table; @@ -437,7 +436,7 @@ elf_plt_trace_write(caddr_t addr, Rela * rptr, Rt_map * rlmp, Rt_map * dlmp, ulong_t elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) { - Rt_map *nlmp, * llmp; + Rt_map *nlmp, *llmp; Addr addr, vaddr, reloff, symval; char *name; Rela *rptr; @@ -447,7 +446,9 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) ulong_t rsymndx; Slookup sl; Pltbindtype pbtype; - int entry, dbg_save, lmflags, farplt = 0; + int entry, lmflags, farplt = 0; + uint_t dbg_class; + Lm_list *lml = LIST(lmp); /* * For compatibility with libthread (TI_VERSION 1) we track the entry @@ -457,9 +458,9 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) */ entry = enter(); - if ((lmflags = LIST(lmp)->lm_flags) & LML_FLG_RTLDLM) { - dbg_save = dbg_mask; - dbg_mask = 0; + if ((lmflags = lml->lm_flags) & LML_FLG_RTLDLM) { + dbg_class = dbg_desc->d_class; + dbg_desc->d_class = 0; } /* @@ -493,10 +494,10 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) */ if (!lmp || (!farplt && (addr % M_PLT_ENTSIZE) != 0) || (farplt && (addr % M_PLT_INSSIZE))) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_PLTREF), - conv_reloc_SPARC_type_str(R_SPARC_JMP_SLOT), - EC_ADDR(lmp), EC_XWORD(pltoff), EC_ADDR(from)); - rtldexit(LIST(lmp), 1); + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_PLTREF), + conv_reloc_SPARC_type(R_SPARC_JMP_SLOT), + EC_NATPTR(lmp), EC_XWORD(pltoff), EC_NATPTR(from)); + rtldexit(lml, 1); } reloff = pltndx * sizeof (Rela); @@ -513,21 +514,21 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) * Determine the last link-map of this list, this'll be the starting * point for any tsort() processing. */ - llmp = LIST(lmp)->lm_tail; + llmp = lml->lm_tail; /* * Find definition for symbol. */ sl.sl_name = name; sl.sl_cmap = lmp; - sl.sl_imap = LIST(lmp)->lm_head; + sl.sl_imap = lml->lm_head; sl.sl_hash = 0; sl.sl_rsymndx = rsymndx; sl.sl_flags = LKUP_DEFT; if ((nsym = lookup_sym(&sl, &nlmp, &binfo)) == 0) { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp), + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp), demangle(name)); - rtldexit(LIST(lmp), 1); + rtldexit(lml, 1); } symval = nsym->st_value; @@ -539,10 +540,10 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) * Record that this new link map is now bound to the caller. */ if (bind_one(lmp, nlmp, BND_REFER) == 0) - rtldexit(LIST(lmp), 1); + rtldexit(lml, 1); } - if ((LIST(lmp)->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) { + if ((lml->lm_tflags | FLAGS1(lmp)) & LML_TFLG_AUD_SYMBIND) { /* LINTED */ uint_t symndx = (uint_t)(((uintptr_t)nsym - (uintptr_t)SYMTAB(nlmp)) / SYMENT(nlmp)); @@ -558,7 +559,7 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) pbtype = PLT_T_NONE; if (!(rtld_flags & RT_FL_NOBIND)) { - if (((LIST(lmp)->lm_tflags | FLAGS1(lmp)) & + if (((lml->lm_tflags | FLAGS1(lmp)) & (LML_TFLG_AUD_PLTENTER | LML_TFLG_AUD_PLTEXIT)) && AUDINFO(lmp)->ai_dynplts) { int fail = 0; @@ -570,7 +571,7 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) rptr, lmp, nlmp, nsym, symndx, pltndx, (caddr_t)symval, sb_flags, &fail); if (fail) - rtldexit(LIST(lmp), 1); + rtldexit(lml, 1); } else { /* * Write standard PLT entry to jump directly @@ -584,10 +585,9 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) /* * Print binding information and rebuild PLT entry. */ - DBG_CALL(Dbg_bind_global(NAME(lmp), from, from - ADDR(lmp), - (Xword)pltndx, pbtype, NAME(nlmp), (caddr_t)symval, - (caddr_t)nsym->st_value, name, binfo)); - + DBG_CALL(Dbg_bind_global(lmp, (Addr)from, (Off)(from - ADDR(lmp)), + (Xword)pltndx, pbtype, nlmp, (Addr)symval, nsym->st_value, + name, binfo)); /* * Complete any processing for newly loaded objects. Note we don't @@ -623,7 +623,7 @@ elf_bndr(Rt_map *lmp, ulong_t pltoff, caddr_t from) } if (lmflags & LML_FLG_RTLDLM) - dbg_mask = dbg_save; + dbg_desc->d_class = dbg_class; return (symval); } @@ -644,8 +644,8 @@ bindpltpad(Rt_map *lmp, List *padlist, Addr value, void **pltaddr, for (LIST_TRAVERSE(padlist, lnp, pip)) { if (pip->pp_addr == value) { *pltaddr = pip->pp_plt; - DBG_CALL(Dbg_pltpad_bindto64(NAME(lmp), sname, - (Addr)*pltaddr)); + DBG_CALL(Dbg_bind_pltpad_from(lmp, (Addr)*pltaddr, + sname)); return (1); } if (pip->pp_addr > value) @@ -697,7 +697,7 @@ bindpltpad(Rt_map *lmp, List *padlist, Addr value, void **pltaddr, } *pltaddr = plt; - DBG_CALL(Dbg_pltpad_boundto64(NAME(lmp), (Addr)*pltaddr, fname, sname)); + DBG_CALL(Dbg_bind_pltpad_to(lmp, (Addr)*pltaddr, fname, sname)); return (1); } @@ -816,7 +816,7 @@ elf_reloc(Rt_map *lmp, uint_t plt) } } if (!relbgn || (relbgn == relend)) { - DBG_CALL(Dbg_reloc_run(NAME(lmp), 0, plt, DBG_REL_NONE)); + DBG_CALL(Dbg_reloc_run(lmp, 0, plt, DBG_REL_NONE)); return (1); } @@ -824,7 +824,7 @@ elf_reloc(Rt_map *lmp, uint_t plt) basebgn = ADDR(lmp); emap = ADDR(lmp) + MSIZE(lmp); - DBG_CALL(Dbg_reloc_run(NAME(lmp), M_REL_SHT_TYPE, plt, DBG_REL_START)); + DBG_CALL(Dbg_reloc_run(lmp, M_REL_SHT_TYPE, plt, DBG_REL_START)); /* * If we're processing in lazy mode there is no need to scan the @@ -850,7 +850,7 @@ elf_reloc(Rt_map *lmp, uint_t plt) * number of relocations. */ if ((rtype == R_SPARC_RELATIVE) && - !(FLAGS(lmp) & FLG_RT_FIXED) && !dbg_mask) { + ((FLAGS(lmp) & FLG_RT_FIXED) == 0) && (DBG_ENABLED == 0)) { /* * It's possible that the relative relocation block * has relocations against the text segment as well @@ -978,9 +978,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) (rtype != R_SPARC_COPY)) { /* LINTED */ if (psymdef == 0) { - DBG_CALL(Dbg_bind_weak( - NAME(lmp), (caddr_t)roffset, - (caddr_t) + DBG_CALL(Dbg_bind_weak(lmp, + (Addr)roffset, (Addr) (roffset - basebgn), name)); continue; } @@ -1044,11 +1043,13 @@ elf_reloc(Rt_map *lmp, uint_t plt) * chkmsg: MSG_INTL(MSG_LDD_SYM_NFOUND) */ if (symdef == 0) { + Lm_list *lml = LIST(lmp); + if (bind != STB_WEAK) { - if (LIST(lmp)->lm_flags & + if (lml->lm_flags & LML_FLG_IGNRELERR) { continue; - } else if (LIST(lmp)->lm_flags & + } else if (lml->lm_flags & LML_FLG_TRC_WARN) { (void) printf(MSG_INTL( MSG_LDD_SYM_NFOUND), @@ -1056,7 +1057,7 @@ elf_reloc(Rt_map *lmp, uint_t plt) NAME(lmp)); continue; } else { - eprintf(ERR_FATAL, + eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOSYM), NAME(lmp), demangle(name)); @@ -1067,9 +1068,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) psymndx = rsymndx; psymdef = 0; - DBG_CALL(Dbg_bind_weak( - NAME(lmp), (caddr_t)roffset, - (caddr_t) + DBG_CALL(Dbg_bind_weak(lmp, + (Addr)roffset, (Addr) (roffset - basebgn), name)); continue; } @@ -1180,7 +1180,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) /* * Call relocation routine to perform required relocation. */ - DBG_CALL(Dbg_reloc_in(M_MACH, M_REL_SHT_TYPE, rel, name, NULL)); + DBG_CALL(Dbg_reloc_in(LIST(lmp), ELF_DBG_RTLD, M_MACH, + M_REL_SHT_TYPE, rel, NULL, name)); switch (rtype) { case R_SPARC_REGISTER: @@ -1207,14 +1208,15 @@ elf_reloc(Rt_map *lmp, uint_t plt) } else if (roffset == STO_SPARC_REGISTER_G7) { set_sparc_g7(value); } else { - eprintf(ERR_FATAL, MSG_INTL(MSG_REL_BADREG), - NAME(lmp), EC_ADDR(roffset)); + eprintf(LIST(lmp), ERR_FATAL, + MSG_INTL(MSG_REL_BADREG), NAME(lmp), + EC_ADDR(roffset)); ret = 0; break; } - DBG_CALL(Dbg_reloc_reg_apply((Xword)roffset, - (Xword)value)); + DBG_CALL(Dbg_reloc_apply_reg(LIST(lmp), ELF_DBG_RTLD, + M_MACH, (Xword)roffset, (Xword)value)); break; case R_SPARC_COPY: if (elf_copy_reloc(name, symref, lmp, (void *)roffset, @@ -1249,8 +1251,9 @@ elf_reloc(Rt_map *lmp, uint_t plt) * Write standard PLT entry to jump directly * to newly bound function. */ - DBG_CALL(Dbg_reloc_apply(roffset, - (ulong_t)value)); + DBG_CALL(Dbg_reloc_apply_val(LIST(lmp), + ELF_DBG_RTLD, (Xword)roffset, + (Xword)value)); pbtype = elf_plt_write((uintptr_t)vaddr, (uintptr_t)vaddr, (void *)rel, value, pltndx); @@ -1282,9 +1285,9 @@ elf_reloc(Rt_map *lmp, uint_t plt) if ((rtype == R_SPARC_GLOB_DAT) || (rtype == R_SPARC_64)) { if (roffset & 0x7) { - eprintf(ERR_FATAL, + eprintf(LIST(lmp), ERR_FATAL, MSG_INTL(MSG_REL_NONALIGN), - conv_reloc_SPARC_type_str(rtype), + conv_reloc_SPARC_type(rtype), NAME(lmp), demangle(name), EC_OFF(roffset)); ret = 0; @@ -1292,7 +1295,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) *(ulong_t *)roffset += value; } else { if (do_reloc(rtype, (uchar_t *)roffset, - (Xword *)&value, name, NAME(lmp)) == 0) + (Xword *)&value, name, + NAME(lmp), LIST(lmp)) == 0) ret = 0; } @@ -1300,8 +1304,8 @@ elf_reloc(Rt_map *lmp, uint_t plt) * The value now contains the 'bit-shifted' value that * was or'ed into memory (this was set by do_reloc()). */ - DBG_CALL(Dbg_reloc_apply((ulong_t)roffset, - value)); + DBG_CALL(Dbg_reloc_apply_val(LIST(lmp), ELF_DBG_RTLD, + (Xword)roffset, (Xword)value)); /* * If this relocation is against a text segment, make @@ -1316,10 +1320,9 @@ elf_reloc(Rt_map *lmp, uint_t plt) break; if (binfo) { - DBG_CALL(Dbg_bind_global(NAME(lmp), (caddr_t)roffset, - (caddr_t)(roffset - basebgn), pltndx, pbtype, - NAME(_lmp), (caddr_t)value, - (caddr_t)symdef->st_value, name, binfo)); + DBG_CALL(Dbg_bind_global(lmp, (Addr)roffset, + (Off)(roffset - basebgn), pltndx, pbtype, + _lmp, (Addr)value, symdef->st_value, name, binfo)); } } @@ -1352,7 +1355,7 @@ elf_reloc(Rt_map *lmp, uint_t plt) * ld.so.1. */ const char * -_conv_reloc_type_str(uint_t rel) +_conv_reloc_type(uint_t rel) { - return (conv_reloc_SPARC_type_str(rel)); + return (conv_reloc_SPARC_type(rel)); } diff --git a/usr/src/cmd/sgs/tools/bld_lint.sh b/usr/src/cmd/sgs/tools/bld_lint.sh index 029cdcf390..826d164ac6 100644 --- a/usr/src/cmd/sgs/tools/bld_lint.sh +++ b/usr/src/cmd/sgs/tools/bld_lint.sh @@ -3,9 +3,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,8 +19,9 @@ # # CDDL HEADER END # + # -# Copyright 1998,2002 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -31,19 +31,20 @@ DASHES="============================================================" MACH= `uname -p` -if [ $MACH = "sparc" ]; \ +if [ $MACH = "sparc" ] then MACH64="sparcv9" +elif [ $MACH = "i386" ] +then + MACH64="amd64" else MACH64="unknown" fi LOG=lint.$MACH.log - # -# Keep the first run as a backup, so that -# subsequent runs can diff against it. +# Keep the first run as a backup, so that subsequent runs can diff against it. # if [ -f $LOG ] then @@ -81,10 +82,8 @@ do fi done - # -# If there is a backup log, diff the current -# one against it. +# If there is a backup log, diff the current one against it. # if [ -f $LOG.bak ] then diff --git a/usr/src/cmd/sgs/tools/chkmsg.sh b/usr/src/cmd/sgs/tools/chkmsg.sh index edd899b5d0..04d7be141f 100644 --- a/usr/src/cmd/sgs/tools/chkmsg.sh +++ b/usr/src/cmd/sgs/tools/chkmsg.sh @@ -3,9 +3,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,11 +19,12 @@ # # CDDL HEADER END # + # -# Copyright (c) 1999 by Sun Microsystems, Inc. -# All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. +# Use is subject to license terms. # -#ident "%Z%%M% %I% %E% SMI" +# ident "%Z%%M% %I% %E% SMI" TOOLDIR="${SRC}/cmd/sgs/tools/" @@ -49,14 +49,15 @@ if [ $# -eq 0 ]; then fi # -# Sort the MSG_INTL() and MSG_ORIG() entries. +# Sort the MSG_INTL() and MSG_ORIG() entries. Note, messages can come in _32 +# and _64 flavors - if so strip the suffix and uniquify the output. # if [ -s CATA_MSG_INTL_LIST ] ; then - sort CATA_MSG_INTL_LIST | uniq > _TMP + sed -e "s/_32$//" -e "s/_64$//" CATA_MSG_INTL_LIST | sort | uniq > _TMP mv _TMP CATA_MSG_INTL_LIST fi if [ -s CATA_MSG_ORIG_LIST ] ; then - sort CATA_MSG_ORIG_LIST | uniq > _TMP + sed -e "s/_32$//" -e "s/_64$//" CATA_MSG_ORIG_LIST | sort | uniq > _TMP mv _TMP CATA_MSG_ORIG_LIST fi @@ -66,11 +67,11 @@ fi nawk -f ${TOOLDIR}/getmessage.awk $* if [ -s MSG_INTL_LIST ] ; then - sort MSG_INTL_LIST | uniq > _TMP + sed -e "s/_32$//" -e "s/_64$//" MSG_INTL_LIST | sort | uniq > _TMP mv _TMP MSG_INTL_LIST fi if [ -s MSG_ORIG_LIST ] ; then - sort MSG_ORIG_LIST | uniq > _TMP + sed -e "s/_32$//" -e "s/_64$//" MSG_ORIG_LIST | sort | uniq > _TMP mv _TMP MSG_ORIG_LIST fi diff --git a/usr/src/cmd/sgs/tools/common/alist.c b/usr/src/cmd/sgs/tools/common/alist.c index 4bd03c3e7a..3cf3534725 100644 --- a/usr/src/cmd/sgs/tools/common/alist.c +++ b/usr/src/cmd/sgs/tools/common/alist.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -28,7 +28,6 @@ #include <sgs.h> #include <string.h> -#include <stdlib.h> /* * Alist manipulation. An Alist is a list of elements formed into an array. diff --git a/usr/src/cmd/sgs/tools/common/leb128.c b/usr/src/cmd/sgs/tools/common/leb128.c index 92b6090c33..a36ee7a249 100644 --- a/usr/src/cmd/sgs/tools/common/leb128.c +++ b/usr/src/cmd/sgs/tools/common/leb128.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,17 +18,18 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ + #pragma ident "%Z%%M% %I% %E% SMI" #include <stdio.h> #include <dwarf.h> #include <sys/types.h> #include <sys/elf.h> -#include <gelf.h> /* * Little Endian Base 128 (LEB128) numbers. diff --git a/usr/src/cmd/sgs/tools/common/string_table.c b/usr/src/cmd/sgs/tools/common/string_table.c index 2d57269fc8..c8d0aacc63 100644 --- a/usr/src/cmd/sgs/tools/common/string_table.c +++ b/usr/src/cmd/sgs/tools/common/string_table.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,15 +18,15 @@ * * CDDL HEADER END */ + /* - * Copyright 2003 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" #include <string_table.h> -#include <stdlib.h> #include <strings.h> #include <sgs.h> #include <stdio.h> diff --git a/usr/src/cmd/sgs/tools/proto.sh b/usr/src/cmd/sgs/tools/proto.sh index 06f67343f8..4d1963a9d5 100644 --- a/usr/src/cmd/sgs/tools/proto.sh +++ b/usr/src/cmd/sgs/tools/proto.sh @@ -3,9 +3,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,8 +19,9 @@ # # CDDL HEADER END # + # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -150,6 +150,7 @@ do fi done +SYSLIB=$CODEMGR_WS/proto/root_$MACH/lib USRLIB=$CODEMGR_WS/proto/root_$MACH/usr/lib if [ ! -h $USRLIB/ld.so.1 ]; then @@ -162,24 +163,26 @@ fi # In addition create some 64 symlinks so that dependencies referenced # from our test environment will map back to the appropriate libraries. # -if [ $MACH = "sparc" ] ; then - if [ ! -h $USRLIB/64 ] ; then - rm -f $USRLIB/64 - ln -s sparcv9 $USRLIB/64 - echo "$USRLIB/64 -> $USRLIB/sparcv9" - fi - if [ ! -h $USRLIB/link_audit/64 ] ; then - rm -f $USRLIB/link_audit/64 - ln -s sparcv9 $USRLIB/link_audit/64 - echo "$USRLIB/link_audit/64 -> $USRLIB/link_audit/sparcv9" - fi - if [ ! -h $USRLIB/64/ld.so.1 ]; then - rm -f $USRLIB/64/ld.so.1 - ln -s ../../lib/64/ld.so.1 $USRLIB/64/ld.so.1 - echo "$USRLIB/64/ld.so.1 -> ../../../lib/64/ld.so.1" - fi +if [ ! -h $SYSLIB/64 ] ; then + rm -f $SYSLIB/64 + ln -s $MACH64 $SYSLIB/64 + echo "$SYSLIB/64 -> $SYSLIB/$MACH64" +fi +if [ ! -h $USRLIB/64 ] ; then + rm -f $USRLIB/64 + ln -s $MACH64 $USRLIB/64 + echo "$USRLIB/64 -> $USRLIB/$MACH64" +fi +if [ ! -h $USRLIB/link_audit/64 ] ; then + rm -f $USRLIB/link_audit/64 + ln -s $MACH64 $USRLIB/link_audit/64 + echo "$USRLIB/link_audit/64 -> $USRLIB/link_audit/$MACH64" +fi +if [ ! -h $USRLIB/64/ld.so.1 ]; then + rm -f $USRLIB/64/ld.so.1 + ln -s ../../../lib/64/ld.so.1 $USRLIB/64/ld.so.1 + echo "$USRLIB/64/ld.so.1 -> ../../../lib/64/ld.so.1" fi - # # diff --git a/usr/src/pkgdefs/SUNWcsl/prototype_i386 b/usr/src/pkgdefs/SUNWcsl/prototype_i386 index c59bde1e95..4b0fc29ff3 100644 --- a/usr/src/pkgdefs/SUNWcsl/prototype_i386 +++ b/usr/src/pkgdefs/SUNWcsl/prototype_i386 @@ -61,8 +61,6 @@ s none usr/ccs/lib/amd64/libtermlib.so=../../../../lib/amd64/libcurses.so.1 s none usr/ccs/lib/amd64/libtermcap.so=../../../../lib/amd64/libcurses.so.1 s none usr/ccs/lib/amd64/libl.so=../../../lib/amd64/libl.so.1 s none usr/ccs/lib/amd64/liby.so=../../../lib/amd64/liby.so.1 -s none usr/ccs/lib/amd64/libld.so.2=../../../../lib/amd64/libld.so.2 -s none usr/ccs/lib/amd64/libld.so.3=../../../../lib/amd64/libld.so.3 d none usr/lib/cfgadm/amd64 755 root bin f none usr/lib/cfgadm/amd64/scsi.so.1 755 root bin s none usr/lib/cfgadm/amd64/scsi.so=./scsi.so.1 diff --git a/usr/src/pkgdefs/SUNWcsl/prototype_sparc b/usr/src/pkgdefs/SUNWcsl/prototype_sparc index c98dc72049..50e3ceae22 100644 --- a/usr/src/pkgdefs/SUNWcsl/prototype_sparc +++ b/usr/src/pkgdefs/SUNWcsl/prototype_sparc @@ -56,8 +56,6 @@ s none usr/ccs/lib/sparcv9/libtermlib.so=../../../../lib/sparcv9/libcurses.so.1 s none usr/ccs/lib/sparcv9/libtermcap.so=../../../../lib/sparcv9/libcurses.so.1 s none usr/ccs/lib/sparcv9/libl.so=../../../lib/sparcv9/libl.so.1 s none usr/ccs/lib/sparcv9/liby.so=../../../lib/sparcv9/liby.so.1 -s none usr/ccs/lib/sparcv9/libld.so.2=../../../../lib/sparcv9/libld.so.2 -s none usr/ccs/lib/sparcv9/libld.so.3=../../../../lib/sparcv9/libld.so.3 d none usr/lib/cfgadm/sparcv9 755 root bin f none usr/lib/cfgadm/sparcv9/scsi.so.1 755 root bin s none usr/lib/cfgadm/sparcv9/scsi.so=./scsi.so.1 diff --git a/usr/src/pkgdefs/SUNWcslr/prototype_com b/usr/src/pkgdefs/SUNWcslr/prototype_com index defe5d6c6f..15f1c5dd48 100644 --- a/usr/src/pkgdefs/SUNWcslr/prototype_com +++ b/usr/src/pkgdefs/SUNWcslr/prototype_com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -94,8 +93,7 @@ f none lib/libintl.so.1 755 root bin s none lib/libkstat.so=libkstat.so.1 f none lib/libkstat.so.1 755 root bin f none lib/liblaadm.so.1 755 root bin -f none lib/libld.so.2 755 root bin -f none lib/libld.so.3 755 root bin +f none lib/libld.so.4 755 root bin f none lib/liblddbg.so.4 755 root bin f none lib/libmacadm.so.1 755 root bin s none lib/libmd5.so=libmd5.so.1 diff --git a/usr/src/pkgdefs/SUNWcslr/prototype_i386 b/usr/src/pkgdefs/SUNWcslr/prototype_i386 index d9386b4cfc..980114658f 100644 --- a/usr/src/pkgdefs/SUNWcslr/prototype_i386 +++ b/usr/src/pkgdefs/SUNWcslr/prototype_i386 @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2005 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -92,8 +91,7 @@ s none lib/amd64/libintl.so=libintl.so.1 f none lib/amd64/libintl.so.1 755 root bin s none lib/amd64/libkstat.so=libkstat.so.1 f none lib/amd64/libkstat.so.1 755 root bin -f none lib/amd64/libld.so.2 755 root bin -f none lib/amd64/libld.so.3 755 root bin +f none lib/amd64/libld.so.4 755 root bin f none lib/amd64/liblddbg.so.4 755 root bin s none lib/amd64/libmd5.so=libmd5.so.1 f none lib/amd64/libmd5.so.1 755 root bin diff --git a/usr/src/pkgdefs/SUNWcslr/prototype_sparc b/usr/src/pkgdefs/SUNWcslr/prototype_sparc index fc93ca03b1..6e8369140b 100644 --- a/usr/src/pkgdefs/SUNWcslr/prototype_sparc +++ b/usr/src/pkgdefs/SUNWcslr/prototype_sparc @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -95,8 +94,7 @@ s none lib/sparcv9/libintl.so=libintl.so.1 f none lib/sparcv9/libintl.so.1 755 root bin s none lib/sparcv9/libkstat.so=libkstat.so.1 f none lib/sparcv9/libkstat.so.1 755 root bin -f none lib/sparcv9/libld.so.2 755 root bin -f none lib/sparcv9/libld.so.3 755 root bin +f none lib/sparcv9/libld.so.4 755 root bin f none lib/sparcv9/liblddbg.so.4 755 root bin s none lib/sparcv9/libmd5.so=libmd5.so.1 f none lib/sparcv9/libmd5.so.1 755 root bin diff --git a/usr/src/pkgdefs/SUNWtoo/prototype_com b/usr/src/pkgdefs/SUNWtoo/prototype_com index 409e050aad..1bec44ac82 100644 --- a/usr/src/pkgdefs/SUNWtoo/prototype_com +++ b/usr/src/pkgdefs/SUNWtoo/prototype_com @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #pragma ident "%Z%%M% %I% %E% SMI" @@ -64,7 +63,6 @@ d none usr/ccs/bin 755 root bin f none usr/ccs/bin/ld 755 root bin f none usr/ccs/bin/regcmp 555 root bin d none usr/ccs/lib 755 root bin -s none usr/ccs/lib/libld.so.2=../../../lib/libld.so.2 s none usr/ccs/lib/link_audit=../../lib/link_audit d none usr/lib 755 root bin d none usr/lib/ld 755 root bin @@ -75,7 +73,6 @@ f none usr/lib/ld/map.execdata 444 root bin f none usr/lib/ld/map.noexdata 444 root bin f none usr/lib/ld/map.pagealign 444 root bin f none usr/lib/lddstub 555 root bin -s none usr/lib/libld.so.2=../../lib/libld.so.2 f none usr/lib/libldstab.so.1 755 root bin d none usr/lib/link_audit 755 root bin s none usr/lib/link_audit/32=. diff --git a/usr/src/pkgdefs/SUNWtoo/prototype_i386 b/usr/src/pkgdefs/SUNWtoo/prototype_i386 index b06bc78585..72610f4b52 100644 --- a/usr/src/pkgdefs/SUNWtoo/prototype_i386 +++ b/usr/src/pkgdefs/SUNWtoo/prototype_i386 @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # # ident "%Z%%M% %I% %E% SMI" @@ -53,8 +52,6 @@ d none usr/bin/i86 755 root bin f none usr/bin/i86/gcore 555 root bin f none usr/bin/i86/plimit 555 root bin f none usr/bin/i86/truss 555 root bin -s none usr/lib/libld.so.3=../../lib/libld.so.3 -s none usr/ccs/lib/libld.so.3=../../../lib/libld.so.3 d none usr/bin/amd64 755 root bin f none usr/bin/amd64/gcore 555 root bin f none usr/bin/amd64/plimit 555 root bin @@ -72,7 +69,5 @@ f none usr/lib/link_audit/amd64/ldprof.so.1 755 root bin f none usr/lib/link_audit/amd64/truss.so.1 755 root bin f none usr/lib/link_audit/amd64/who.so.1 755 root bin d none usr/lib/amd64 755 root bin -s none usr/lib/amd64/libld.so.2=../../../lib/amd64/libld.so.2 -s none usr/lib/amd64/libld.so.3=../../../lib/amd64/libld.so.3 f none usr/lib/amd64/libldstab.so.1 755 root bin f none usr/lib/amd64/lddstub 555 root bin diff --git a/usr/src/pkgdefs/SUNWtoo/prototype_sparc b/usr/src/pkgdefs/SUNWtoo/prototype_sparc index c04d85c85f..22bfa0d0a0 100644 --- a/usr/src/pkgdefs/SUNWtoo/prototype_sparc +++ b/usr/src/pkgdefs/SUNWtoo/prototype_sparc @@ -2,9 +2,8 @@ # CDDL HEADER START # # The contents of this file are subject to the terms of the -# Common Development and Distribution License, Version 1.0 only -# (the "License"). You may not use this file except in compliance -# with the License. +# Common Development and Distribution License (the "License"). +# You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www.opensolaris.org/os/licensing. @@ -20,7 +19,7 @@ # CDDL HEADER END # # -# Copyright 2004 Sun Microsystems, Inc. All rights reserved. +# Copyright 2006 Sun Microsystems, Inc. All rights reserved. # Use is subject to license terms. # #pragma ident "%Z%%M% %I% %E% SMI" @@ -52,8 +51,6 @@ d none usr/bin/sparcv7 755 root bin f none usr/bin/sparcv7/gcore 555 root bin f none usr/bin/sparcv7/truss 555 root bin -s none usr/lib/libld.so.3=../../lib/libld.so.3 -s none usr/ccs/lib/libld.so.3=../../../lib/libld.so.3 d none usr/bin/sparcv9 755 root bin f none usr/bin/sparcv9/gcore 555 root bin f none usr/bin/sparcv9/plimit 555 root bin @@ -71,7 +68,5 @@ f none usr/lib/link_audit/sparcv9/ldprof.so.1 755 root bin f none usr/lib/link_audit/sparcv9/truss.so.1 755 root bin f none usr/lib/link_audit/sparcv9/who.so.1 755 root bin d none usr/lib/sparcv9 755 root bin -s none usr/lib/sparcv9/libld.so.2=../../../lib/sparcv9/libld.so.2 -s none usr/lib/sparcv9/libld.so.3=../../../lib/sparcv9/libld.so.3 f none usr/lib/sparcv9/libldstab.so.1 755 root bin f none usr/lib/sparcv9/lddstub 555 root bin diff --git a/usr/src/tools/abi/etc/ABI_i386.db b/usr/src/tools/abi/etc/ABI_i386.db index 185e9a7a2a..29f5c7a312 100644 --- a/usr/src/tools/abi/etc/ABI_i386.db +++ b/usr/src/tools/abi/etc/ABI_i386.db @@ -5,9 +5,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. @@ -15054,12 +15053,6 @@ add_key_name usr/lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivat add_key_name lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 add_name usr/lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0 add_name lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 -add_string usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -add_string usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -add_string lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -add_string lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -add_string lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -add_string lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 add_tnode lib/amd64/libcmdutils.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 add_tnode lib/libcmdutils.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 add_wch usr/xpg4/lib/libcurses.so.1 0 0 SUNW_1.2 SUNW_1.1 0 0 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0 @@ -17095,9 +17088,7 @@ calloc usr/lib/libmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1 calloc usr/lib/libmapmalloc.so.1 0 0 SUNW_1.1 SUNW_0.7 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 1111111 1011111 0 0100000 0 0 0 0 calloc usr/lib/libsys.so.1 0 0 SYSVABI_1.3 SYSVABI_1.2 0 0 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 1111111 1011111 0 0100000 0 0 0 0 calloc usr/lib/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0 -calloc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 calloc usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0 -calloc usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 calloc usr/lib/libmtmalloc.so.1 0 0 0 0 0 0 0 0 SUNW_1.1.1 SUNW_1.1.1 0 0 SUNW_1.1.1 SUNW_1.1.1 SUNW_1.1.1 SUNW_1.1.1 0001111 0001011 0 0000100 0 0 0 0 calloc usr/lib/libumem.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0 0 0000011 0000010 0 0000001 0 0 0 0 calloc lib/ld.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0 @@ -18279,12 +18270,6 @@ create_auth_reply usr/lib/libkrb.so.1 0 0 SUNW_1.1 SUNW_0.7 0 0 0 0 0 0 0 0 0 0 create_event_service usr/lib/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0 create_event_service usr/lib/amd64/librcm.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 create_history_entry usr/lib/krb5/libkadm5srv.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0 -create_outfile usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -create_outfile usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -create_outfile lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -create_outfile lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -create_outfile lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -create_outfile lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 create_policy_1 usr/lib/krb5/libkadm5clnt.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0 create_policy_1 usr/lib/krb5/amd64/libkadm5clnt.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 create_principal_1 usr/lib/krb5/libkadm5clnt.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0 @@ -19011,14 +18996,9 @@ dbg_mask lib/ld.so.1 1 4 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 dbg_mask lib/amd64/ld.so.1 1 4 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0 dbg_print etc/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0 dbg_print usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0 -dbg_print usr/lib/libld.so.2 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0001111 0 0001010 0000101 0 0 0 0 dbg_print usr/lib/libpicltree.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0000111 0 0000111 0 0 0 0 0 dbg_print lib/ld.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0 dbg_print lib/amd64/ld.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0 -dbg_print lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -dbg_print lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -dbg_print lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -dbg_print lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 dbgstr2num usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 dbm_clearerr usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_1.1 0 0 SUNW_1.20 SUNW_1.1 SUNW_1.21 SUNW_1.1 SUNW_1.21 SUNW_1.1 SUNW_1.21.2 SUNW_1.1 0 0 1111111 1011110 0 0100001 0 0 0 0 dbm_clearerr usr/lib/krb5/libdb2.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0 @@ -21167,12 +21147,6 @@ endwin lib/amd64/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 00 endwin lib/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 endzoneent usr/lib/amd64/libzonecfg.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 endzoneent usr/lib/libzonecfg.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 -ent_setup usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -ent_setup usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -ent_setup lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ent_setup lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ent_setup lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ent_setup lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 enumerate_dd usr/lib/libdhcpsvc.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 env usr/lib/libipsecutil.so.1 1 40 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 environ etc/lib/ld.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0 @@ -21601,12 +21575,6 @@ filter lib/amd64/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 00 filter lib/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 find_p11i_slot usr/lib/libike.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0000011 0 0000011 0 0 0 0 0 find_word usr/lib/krb5/libkadm5srv.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0000111 0 0000111 0 0 0 0 0 -finish_libs usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -finish_libs usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -finish_libs lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -finish_libs lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -finish_libs lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -finish_libs lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 finite usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 0 0 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1011110 0 0100001 0 0 0 0 finite lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0 finite usr/lib/libc/libc_hwcap1.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0 @@ -22307,9 +22275,7 @@ free usr/lib/libmapmalloc.so.1 0 0 SUNW_1.1 SUNW_0.7 0 0 SUNW_1.1 SUNW_0.7 SUNW_ free usr/lib/libmtmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0 free usr/lib/libsys.so.1 0 0 SYSVABI_1.3 SYSVABI_1.2 0 0 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 1111111 1011111 0 0100000 0 0 0 0 free usr/lib/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0 -free usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 free usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0 -free usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 free usr/lib/libumem.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0 0 0000011 0000010 0 0000001 0 0 0 0 free lib/ld.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0 free lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SYSVABI_1.3 0000001 0000001 0 0 0 0 0 0 @@ -28097,12 +28063,6 @@ ld_file usr/lib/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.2 SUNW_1.1 SUNWp ld_file usr/lib/amd64/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 ld_file64 usr/lib/amd64/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 ld_file64 usr/lib/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 -ld_main usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -ld_main usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -ld_main lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ld_main lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ld_main lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ld_main lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 ld_section usr/lib/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0001111 0100000 0 0 0 0 ld_section usr/lib/amd64/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 ld_section64 usr/lib/amd64/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 @@ -28111,12 +28071,6 @@ ld_start usr/lib/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.2 SUNW_1.1 SUNW ld_start usr/lib/amd64/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 ld_start64 usr/lib/amd64/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 ld_start64 usr/lib/libldstab.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 -ld_support_loadso usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -ld_support_loadso usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -ld_support_loadso lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ld_support_loadso lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ld_support_loadso lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ld_support_loadso lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 ldapConfig usr/lib/libnisdb.so.2 1 60 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0 ldapDBTableMapping usr/lib/libnisdb.so.2 1 140 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0 ldapMappingList usr/lib/libnisdb.so.2 1 340 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0 @@ -29013,8 +28967,6 @@ lgrp_version usr/lib/liblgrp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 SUNW lgrp_version usr/lib/amd64/liblgrp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 lgrp_view usr/lib/liblgrp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 0000011 0000011 0 0 0 0 0 0 lgrp_view usr/lib/amd64/liblgrp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 -libld_malloc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 -libld_malloc usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 libtecla_version usr/lib/amd64/libtecla.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 tecla_1.6 tecla_1.4 0000001 0000001 0 0 0 0 0 0 libtecla_version usr/lib/libtecla.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 tecla_1.6 tecla_1.4 0000001 0000001 0 0 0 0 0 0 line usr/lib/libplot.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0 @@ -29060,12 +29012,6 @@ lio_listio64 lib/librt.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.4 SUNW_1.1 000000 list_append usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1011111 0100000 0 0 0 0 list_append usr/lib/print/psm-lpsched.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0000011 0 0000011 0 0 0 0 0 list_append_unique usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1011111 0100000 0 0 0 0 -list_appendc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -list_appendc usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -list_appendc lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_appendc lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_appendc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_appendc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 list_concatenate usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1011111 0100000 0 0 0 0 list_dd usr/lib/libdhcp.so.2 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 1111111 0 1010000 0101111 0 0 0 0 list_dd usr/lib/libdhcpsvc.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 @@ -29079,27 +29025,9 @@ list_dt usr/lib/inet/dhcp/svc/ds_SUNWbinfiles.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1 list_dt usr/lib/inet/dhcp/svc/ds_SUNWfiles.so.0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 list_dt usr/lib/inet/dhcp/svc/ds_SUNWfiles.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 list_dt usr/lib/inet/dhcp/svc/ds_SUNWnisplus.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 -list_insertc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -list_insertc usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -list_insertc lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_insertc lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_insertc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_insertc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 list_ints usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 list_iterate usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1011111 0100000 0 0 0 0 list_locate usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1011111 0100000 0 0 0 0 -list_prependc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -list_prependc usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -list_prependc lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_prependc lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_prependc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_prependc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_where usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -list_where usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -list_where lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_where lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_where lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_where lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 listdev usr/lib/libadm.so.1 0 0 SUNW_1.1 SUNW_0.7 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 0 0 1111111 1011110 0 0100001 0 0 0 0 listdev lib/amd64/libadm.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 listdev lib/libadm.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 @@ -29374,12 +29302,6 @@ makdatum lib/libnsl.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.5 SUNWprivate make_dd usr/lib/libdhcp.so.2 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 1111111 0 1010000 0101111 0 0 0 0 make_key_sched usr/lib/gss/do/mech_krb5.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0011111 0 0011110 0000001 0 0 0 0 make_key_sched usr/lib/gss/gl/mech_krb5.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0011111 0 0011110 0000001 0 0 0 0 -make_sections usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -make_sections usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -make_sections lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -make_sections lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -make_sections lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -make_sections lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 makecontext usr/lib/libc.so.1 0 0 SUNW_1.18 SYSVABI_1.3 0 0 SUNW_1.20 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21.2 SYSVABI_1.3 0 0 1111111 1011110 0 0100001 0 0 0 0 makecontext usr/lib/libsys.so.1 0 0 SYSVABI_1.3 SYSVABI_1.3 0 0 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 SYSVABI_1.3 1111111 1011111 0 0100000 0 0 0 0 makecontext lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SYSVABI_1.3 0000001 0000001 0 0 0 0 0 0 @@ -29417,9 +29339,7 @@ malloc usr/lib/libmapmalloc.so.1 0 0 SUNW_1.1 SUNW_0.7 0 0 SUNW_1.1 SUNW_0.7 SUN malloc usr/lib/libmtmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0 malloc usr/lib/libsys.so.1 0 0 SYSVABI_1.3 SYSVABI_1.2 0 0 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 1111111 1011111 0 0100000 0 0 0 0 malloc usr/lib/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0 -malloc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 malloc usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0 -malloc usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 malloc usr/lib/libumem.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0 0 0000011 0000010 0 0000001 0 0 0 0 malloc lib/ld.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0 malloc lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SYSVABI_1.3 0000001 0000001 0 0 0 0 0 0 @@ -32681,12 +32601,6 @@ octet_to_hexascii lib/amd64/libinetutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWpri octet_to_hexascii lib/libinetutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 oextra usr/lib/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1011111 0100000 0 0 0 0 oextra usr/lib/amd64/lib4014.so.1 1 4 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 -ofl_cleanup usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -ofl_cleanup usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -ofl_cleanup lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ofl_cleanup lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ofl_cleanup lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ofl_cleanup lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 ohix usr/lib/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1011111 0100000 0 0 0 0 ohix usr/lib/amd64/lib4014.so.1 1 4 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 ohiy usr/lib/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1011111 0100000 0 0 0 0 @@ -32739,12 +32653,6 @@ open_dt usr/lib/inet/dhcp/svc/ds_SUNWnisplus.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1. open_ldap_connection usr/lib/libldap.so.3 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 0 0 1111111 1011110 0 0100001 0 0 0 0 open_mnttab usr/lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0 open_mnttab lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 -open_outfile usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -open_outfile usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -open_outfile lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -open_outfile lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -open_outfile lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -open_outfile lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 openat usr/lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 SUNW_1.21 SUNW_1.21 SUNW_1.21.2 SUNW_1.21 0 0 0000111 0000110 0 0000001 0 0 0 0 openat lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.21 0000001 0000001 0 0 0 0 0 0 openat usr/lib/libc/libc_hwcap1.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.21 0000001 0000001 0 0 0 0 0 0 @@ -34145,12 +34053,6 @@ proc_unctrl_psinfo lib/libproc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 proc_update_maps usr/lib/libproc.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 0 0 0 0 0 0 0 0 0 0 1111111 1000000 0 0111111 0 0 0 0 proc_walk lib/amd64/libproc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 proc_walk lib/libproc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 -process_open usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -process_open usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -process_open lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -process_open lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -process_open lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -process_open lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 processor_bind usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 0 0 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1011110 0 0100001 0 0 0 0 processor_bind lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0 processor_bind usr/lib/libc/libc_hwcap1.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0 @@ -36415,18 +36317,6 @@ reglength lib/libgen.so.1 1 4 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 rel_own_bydd usr/lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0 rel_own_bydd lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 relative_name usr/lib/libnisdb.so.2 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0 -reloc_init usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -reloc_init usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -reloc_init lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -reloc_init lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -reloc_init lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -reloc_init lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -reloc_process usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -reloc_process usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -reloc_process lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -reloc_process lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -reloc_process lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -reloc_process lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 reloc_table etc/lib/ld.so.1 1 48 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0 reloc_table usr/lib/ld.so.1 1 48 SUNWprivate_1.1 SUNWprivate_1.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1011110 0100001 0 0 0 0 reloc_table lib/ld.so.1 1 48 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0 @@ -37826,18 +37716,6 @@ sctp_send usr/lib/amd64/libsctp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1 sctp_send usr/lib/libsctp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 sctp_sendmsg usr/lib/amd64/libsctp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 sctp_sendmsg usr/lib/libsctp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 -sdf_add usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -sdf_add usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -sdf_add lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sdf_add lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sdf_add lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sdf_add lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sdf_find usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -sdf_find usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -sdf_find lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sdf_find lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sdf_find lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sdf_find lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 sdiv usr/lib/libmp.so.1 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 0 0 0001111 0001110 0 0000001 0 0 0 0 sdiv lib/libmp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 sdssc_add_hosts usr/lib/libmeta.so.1 1 4 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0 @@ -37927,12 +37805,6 @@ se_tuple_ints usr/lib/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 se_tuple_name usr/lib/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 0011111 0 0010000 0001111 0 0 0 0 se_tuple_strings usr/lib/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 0011111 0 0010000 0001111 0 0 0 0 se_tuple_type usr/lib/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 0011111 0 0010000 0001111 0 0 0 0 -sec_validate usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -sec_validate usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -sec_validate lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sec_validate lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sec_validate lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sec_validate lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 seconvert usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 0 0 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1011110 0 0100001 0 0 0 0 seconvert lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0 seconvert usr/lib/libc/libc_hwcap1.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0 @@ -39736,11 +39608,6 @@ ssignal lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 000 ssignal usr/lib/libc/libc_hwcap1.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0 ssignal usr/lib/libc/libc_hwcap2.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0 ssignal lib/amd64/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0 -st_new usr/lib/libld.so.2 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0001111 0 0001010 0000101 0 0 0 0 -st_new lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -st_new lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -st_new lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -st_new lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 stack_getbounds usr/lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.21.2 SUNW_1.21.2 0 0 0000011 0000010 0 0000001 0 0 0 0 stack_getbounds lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.21.2 0000001 0000001 0 0 0 0 0 0 stack_getbounds usr/lib/libc/libc_hwcap1.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.21.2 0000001 0000001 0 0 0 0 0 0 @@ -40394,24 +40261,6 @@ swscanf lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.18 0000001 00 swscanf usr/lib/libc/libc_hwcap1.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.18 0000001 0000001 0 0 0 0 0 0 swscanf usr/lib/libc/libc_hwcap2.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.18 0000001 0000001 0 0 0 0 0 0 swscanf lib/amd64/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.18 0000001 0000001 0 0 0 0 0 0 -sym_add_u usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -sym_add_u usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -sym_add_u lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_add_u lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_add_u lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_add_u lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_enter usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -sym_enter usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -sym_enter lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_enter lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_enter lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_enter lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_find usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -sym_find usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -sym_find lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_find lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_find lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_find lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 sym_ntop usr/lib/libresolv.so.2 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 0 0 0001111 0 0001110 0000001 0 0 0 0 sym_ntop lib/amd64/libresolv.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 0000001 0 0000001 0 0 0 0 0 sym_ntop lib/libresolv.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 0000001 0 0000001 0 0 0 0 0 @@ -40421,12 +40270,6 @@ sym_ntos lib/libresolv.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWpriv sym_ston usr/lib/libresolv.so.2 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 0 0 0001111 0 0001110 0000001 0 0 0 0 sym_ston lib/amd64/libresolv.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 0000001 0 0000001 0 0 0 0 0 sym_ston lib/libresolv.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 0000001 0 0000001 0 0 0 0 0 -sym_validate usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -sym_validate usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -sym_validate lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_validate lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_validate lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_validate lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 symlink usr/lib/libc.so.1 0 0 SUNW_1.18 SYSVABI_1.3 0 0 SUNW_1.20 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21.2 SYSVABI_1.3 0 0 1111111 1011110 0 0100001 0 0 0 0 symlink usr/lib/libsys.so.1 0 0 SYSVABI_1.3 SYSVABI_1.2 0 0 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 SYSVABI_1.3 SYSVABI_1.2 1111111 1011111 0 0100000 0 0 0 0 symlink lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SYSVABI_1.3 0000001 0000001 0 0 0 0 0 0 @@ -42403,12 +42246,6 @@ untouchwin usr/xpg4/lib/amd64/libcurses.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1. untouchwin usr/xpg4/lib/amd64/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.2 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 untouchwin lib/amd64/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 untouchwin lib/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 -update_outfile usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -update_outfile usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -update_outfile lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -update_outfile lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -update_outfile lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -update_outfile lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 update_panels usr/lib/libpanel.so.1 0 0 SUNW_1.1 SUNW_1.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1011111 0 0100000 0 0 0 0 update_panels usr/lib/amd64/libpanel.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 update_root_object usr/lib/libnisdb.so.2 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0 @@ -42688,30 +42525,6 @@ verbosity usr/lib/libmeta.so.1 1 4 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWpriva verbosity lib/libmeta.so.1 1 4 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 verr usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 verrx usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 -vers_base usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -vers_base usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -vers_base lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_base lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_base lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_base lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_check_defs usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -vers_check_defs usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -vers_check_defs lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_check_defs lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_check_defs lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_check_defs lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_desc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -vers_desc usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -vers_desc lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_desc lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_desc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_desc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_find usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1011110 0100001 0 0 0 0 -vers_find usr/lib/libld.so.3 0 0 0 0 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 0011111 0 0010100 0001011 0 0 0 0 -vers_find lib/amd64/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_find lib/amd64/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_find lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_find lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 version usr/lib/inet/dhcp/svc/ds_SUNWnisplus.so.0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 version usr/lib/inet/dhcp/svc/ds_SUNWbinfiles.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 version usr/lib/inet/dhcp/svc/ds_SUNWfiles.so.0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 diff --git a/usr/src/tools/abi/etc/ABI_sparc.db b/usr/src/tools/abi/etc/ABI_sparc.db index 3cbdd3c665..55c7bcc1ea 100644 --- a/usr/src/tools/abi/etc/ABI_sparc.db +++ b/usr/src/tools/abi/etc/ABI_sparc.db @@ -5,9 +5,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. @@ -17155,14 +17154,6 @@ add_key_name usr/lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivat add_key_name lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 add_name usr/lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0 add_name lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 -add_string usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -add_string usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -add_string usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -add_string usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -add_string lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -add_string lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -add_string lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -add_string lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 add_tnode lib/sparcv9/libcmdutils.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 add_tnode lib/libcmdutils.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 add_wch usr/xpg4/lib/sparcv9/libcurses.so.1 0 0 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 @@ -19841,16 +19832,12 @@ calloc usr/lib/sparcv9/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_ calloc usr/lib/sparcv9/libmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 calloc usr/lib/sparcv9/libmapmalloc.so.1 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 1111111 1111111 0 0 0 0 0 0 calloc usr/lib/sparcv9/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 -calloc usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 -calloc usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 calloc usr/lib/sparcv9/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0 calloc usr/lib/libc.so.1 0 0 SUNW_1.18 SYSVABI_1.3 SUNW_1.18 SYSVABI_1.3 SUNW_1.20 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21.2 SYSVABI_1.3 0 0 1111111 1111110 0 0000001 0 0 0 0 calloc usr/lib/libmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 calloc usr/lib/libmapmalloc.so.1 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 1111111 1111111 0 0 0 0 0 0 calloc usr/lib/libsys.so.1 0 0 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 1111111 1111111 0 0 0 0 0 0 calloc usr/lib/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 -calloc usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 -calloc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 calloc usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0 calloc usr/lib/sparcv9/libmtmalloc.so.1 0 0 0 0 0 0 0 0 SUNW_1.1.1 SUNW_1.1.1 0 0 SUNW_1.1.1 SUNW_1.1.1 SUNW_1.1.1 SUNW_1.1.1 0001111 0001011 0 0000100 0 0 0 0 calloc usr/lib/libmtmalloc.so.1 0 0 0 0 0 0 0 0 SUNW_1.1.1 SUNW_1.1.1 0 0 SUNW_1.1.1 SUNW_1.1.1 SUNW_1.1.1 SUNW_1.1.1 0001111 0001011 0 0000100 0 0 0 0 @@ -21227,14 +21214,6 @@ create_auth_reply usr/lib/libkrb.so.1 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 0 create_event_service usr/lib/sparcv9/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0 create_event_service usr/lib/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0 create_history_entry usr/lib/krb5/libkadm5srv.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0 -create_outfile usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -create_outfile usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -create_outfile usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -create_outfile usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -create_outfile lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -create_outfile lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -create_outfile lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -create_outfile lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 create_policy_1 usr/lib/krb5/libkadm5clnt.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0 create_policy_1 usr/lib/krb5/sparcv9/libkadm5clnt.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0 create_principal_1 usr/lib/krb5/libkadm5clnt.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0011111 0 0011111 0 0 0 0 0 @@ -22001,17 +21980,9 @@ dbg_mask lib/sparcv9/ld.so.1 1 4 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWpri dbg_print etc/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0 dbg_print usr/lib/sparcv9/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0 dbg_print usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0 -dbg_print usr/lib/sparcv9/libld.so.2 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0 -dbg_print usr/lib/sparcv9/libld.so.3 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0 -dbg_print usr/lib/libld.so.2 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0 -dbg_print usr/lib/libld.so.3 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0 dbg_print usr/lib/libpicltree.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0001111 0 0001111 0 0 0 0 0 dbg_print lib/ld.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0 dbg_print lib/sparcv9/ld.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.2 SUNWprivate_1.2 0000001 0 0000001 0 0 0 0 0 -dbg_print lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -dbg_print lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -dbg_print lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -dbg_print lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 dbgstr2num usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 dbm_clearerr usr/lib/sparcv9/libc.so.1 0 0 SUNW_1.18 SUNW_1.1 SUNW_1.18 SUNW_1.1 SUNW_1.20 SUNW_1.1 SUNW_1.21 SUNW_1.1 SUNW_1.21 SUNW_1.1 SUNW_1.21.2 SUNW_1.1 0 0 1111111 1111110 0 0000001 0 0 0 0 dbm_clearerr usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_1.1 SUNW_1.18 SUNW_1.1 SUNW_1.20 SUNW_1.1 SUNW_1.21 SUNW_1.1 SUNW_1.21 SUNW_1.1 SUNW_1.21.2 SUNW_1.1 0 0 1111111 1111110 0 0000001 0 0 0 0 @@ -24575,14 +24546,6 @@ endwin lib/sparcv9/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 endwin lib/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 endzoneent usr/lib/sparcv9/libzonecfg.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 endzoneent usr/lib/libzonecfg.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 -ent_setup usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ent_setup usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ent_setup usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ent_setup usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ent_setup lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ent_setup lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ent_setup lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ent_setup lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 enumerate_dd usr/lib/libdhcpsvc.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 env usr/lib/libipsecutil.so.1 1 48 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 environ etc/lib/ld.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0 @@ -24990,14 +24953,6 @@ filter lib/sparcv9/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 filter lib/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 find_p11i_slot usr/lib/libike.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0000011 0 0000011 0 0 0 0 0 find_word usr/lib/krb5/libkadm5srv.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0000111 0 0000111 0 0 0 0 0 -finish_libs usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -finish_libs usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -finish_libs usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -finish_libs usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -finish_libs lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -finish_libs lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -finish_libs lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -finish_libs lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 finite usr/lib/sparcv9/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0 finite usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0 finite lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0 @@ -26080,8 +26035,6 @@ free usr/lib/sparcv9/libmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW free usr/lib/sparcv9/libmapmalloc.so.1 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 1111111 1111111 0 0 0 0 0 0 free usr/lib/sparcv9/libmtmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 free usr/lib/sparcv9/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 -free usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 -free usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 free usr/lib/sparcv9/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0 free usr/lib/libc.so.1 0 0 SUNW_1.18 SYSVABI_1.3 SUNW_1.18 SYSVABI_1.3 SUNW_1.20 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21.2 SYSVABI_1.3 0 0 1111111 1111110 0 0000001 0 0 0 0 free usr/lib/libbsdmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 @@ -26090,8 +26043,6 @@ free usr/lib/libmapmalloc.so.1 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 free usr/lib/libmtmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 free usr/lib/libsys.so.1 0 0 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 1111111 1111111 0 0 0 0 0 0 free usr/lib/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 -free usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 -free usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 free usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0 free usr/lib/sparcv9/libumem.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0 0 0000011 0000010 0 0000001 0 0 0 0 free usr/lib/libumem.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0 0 0000011 0000010 0 0000001 0 0 0 0 @@ -33414,14 +33365,6 @@ ld_file usr/lib/sparcv9/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUN ld_file usr/lib/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0 ld_file64 usr/lib/sparcv9/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0 ld_file64 usr/lib/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0 -ld_main usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ld_main usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ld_main usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ld_main usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ld_main lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ld_main lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ld_main lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ld_main lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 ld_section usr/lib/sparcv9/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0 ld_section usr/lib/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0 ld_section64 usr/lib/sparcv9/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0 @@ -33430,14 +33373,6 @@ ld_start usr/lib/sparcv9/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SU ld_start usr/lib/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0 ld_start64 usr/lib/sparcv9/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0 ld_start64 usr/lib/libldstab.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNW_1.2 SUNW_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 1010000 0101111 0 0 0 0 0 -ld_support_loadso usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ld_support_loadso usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ld_support_loadso usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ld_support_loadso usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ld_support_loadso lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ld_support_loadso lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ld_support_loadso lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ld_support_loadso lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 ldapConfig usr/lib/libnisdb.so.2 1 60 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0 ldapDBTableMapping usr/lib/libnisdb.so.2 1 144 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0 ldapMappingList usr/lib/libnisdb.so.2 1 344 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0 @@ -34474,10 +34409,6 @@ lgrp_version usr/lib/sparcv9/liblgrp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_ lgrp_version usr/lib/liblgrp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 0000011 0000011 0 0 0 0 0 0 lgrp_view usr/lib/sparcv9/liblgrp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 0000011 0000011 0 0 0 0 0 0 lgrp_view usr/lib/liblgrp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 0000011 0000011 0 0 0 0 0 0 -libld_malloc usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 -libld_malloc usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 -libld_malloc usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 -libld_malloc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 libtecla_version usr/lib/sparcv9/libtecla.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 tecla_1.6 tecla_1.4 0000001 0000001 0 0 0 0 0 0 libtecla_version usr/lib/libtecla.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 tecla_1.6 tecla_1.4 0000001 0000001 0 0 0 0 0 0 line usr/lib/sparcv9/libplot.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 @@ -34523,14 +34454,6 @@ lio_listio64 lib/librt.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.4 SUNW_1.1 000000 list_append usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1111111 0 0 0 0 0 list_append usr/lib/print/psm-lpsched.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0000011 0 0000011 0 0 0 0 0 list_append_unique usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1111111 0 0 0 0 0 -list_appendc usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_appendc usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_appendc usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_appendc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_appendc lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_appendc lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_appendc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_appendc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 list_concatenate usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1111111 0 0 0 0 0 list_dd usr/lib/libdhcp.so.2 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 1111111 0 1110000 0001111 0 0 0 0 list_dd usr/lib/libdhcpsvc.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 @@ -34544,33 +34467,9 @@ list_dt usr/lib/inet/dhcp/svc/ds_SUNWfiles.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 list_dt usr/lib/inet/dhcp/svc/ds_SUNWbinfiles.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 list_dt usr/lib/inet/dhcp/svc/ds_SUNWnisplus.so.0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 list_dt usr/lib/inet/dhcp/svc/ds_SUNWnisplus.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 -list_insertc usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_insertc usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_insertc usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_insertc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_insertc lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_insertc lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_insertc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_insertc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 list_ints usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 list_iterate usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1111111 0 0 0 0 0 list_locate usr/lib/libprint.so.2 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 1111111 0 1111111 0 0 0 0 0 -list_prependc usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_prependc usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_prependc usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_prependc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_prependc lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_prependc lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_prependc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_prependc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_where usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_where usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_where usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_where usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -list_where lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_where lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_where lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -list_where lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 listdev usr/lib/sparcv9/libadm.so.1 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0 listdev usr/lib/libadm.so.1 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0 listdev lib/sparcv9/libadm.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 @@ -34861,14 +34760,6 @@ make_key_sched usr/lib/gss/do/mech_krb5.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWpri make_key_sched usr/lib/gss/do/sparcv9/mech_krb5.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0011111 0 0011110 0000001 0 0 0 0 make_key_sched usr/lib/gss/gl/mech_krb5.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0011111 0 0011110 0000001 0 0 0 0 make_key_sched usr/lib/gss/gl/sparcv9/mech_krb5.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0011111 0 0011110 0000001 0 0 0 0 -make_sections usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -make_sections usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -make_sections usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -make_sections usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -make_sections lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -make_sections lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -make_sections lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -make_sections lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 makecontext usr/lib/sparcv9/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0 makecontext usr/lib/libc.so.1 0 0 SUNW_1.18 SYSVABI_1.3 SUNW_1.18 SYSVABI_1.3 SUNW_1.20 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21.2 SYSVABI_1.3 0 0 1111111 1111110 0 0000001 0 0 0 0 makecontext usr/lib/libsys.so.1 0 0 SISCD_2.3 SYSVABI_1.3 SISCD_2.3 SYSVABI_1.3 SISCD_2.3 SYSVABI_1.3 SISCD_2.3 SYSVABI_1.3 SISCD_2.3 SYSVABI_1.3 SISCD_2.3 SYSVABI_1.3 SISCD_2.3 SYSVABI_1.3 1111111 1111111 0 0 0 0 0 0 @@ -34903,8 +34794,6 @@ malloc usr/lib/sparcv9/libmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SU malloc usr/lib/sparcv9/libmapmalloc.so.1 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 1111111 1111111 0 0 0 0 0 0 malloc usr/lib/sparcv9/libmtmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 malloc usr/lib/sparcv9/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 -malloc usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 -malloc usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 malloc usr/lib/sparcv9/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0 malloc usr/lib/libc.so.1 0 0 SUNW_1.18 SYSVABI_1.3 SUNW_1.18 SYSVABI_1.3 SUNW_1.20 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21.2 SYSVABI_1.3 0 0 1111111 1111110 0 0000001 0 0 0 0 malloc usr/lib/libbsdmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 @@ -34913,8 +34802,6 @@ malloc usr/lib/libmapmalloc.so.1 0 0 SUNW_1.1 SUNW_0.7 SUNW_1.1 SUNW_0.7 SUNW_1. malloc usr/lib/libmtmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 SUNW_1.1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 malloc usr/lib/libsys.so.1 0 0 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 1111111 1111111 0 0 0 0 0 0 malloc usr/lib/watchmalloc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 -malloc usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 -malloc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.9 SUNWprivate_2.9 0 0 SUNWprivate_2.11 SUNWprivate_2.11 0 0 0 0 1111111 0 1010100 0101011 0 0 0 0 malloc usr/lib/ld.so.1 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0 malloc usr/lib/sparcv9/libumem.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0 0 0000011 0000010 0 0000001 0 0 0 0 malloc usr/lib/libumem.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0 0 0000011 0000010 0 0000001 0 0 0 0 @@ -38545,14 +38432,6 @@ octet_to_hexascii lib/sparcv9/libinetutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWp octet_to_hexascii lib/libinetutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 oextra usr/lib/sparcv9/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1111111 0 0 0 0 0 oextra usr/lib/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1111111 0 0 0 0 0 -ofl_cleanup usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ofl_cleanup usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ofl_cleanup usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ofl_cleanup usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -ofl_cleanup lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ofl_cleanup lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ofl_cleanup lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -ofl_cleanup lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 ohix usr/lib/sparcv9/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1111111 0 0 0 0 0 ohix usr/lib/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1111111 0 0 0 0 0 ohiy usr/lib/sparcv9/lib4014.so.1 1 4 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 1111111 0 1111111 0 0 0 0 0 @@ -38610,14 +38489,6 @@ open_ldap_connection usr/lib/sparcv9/libldap.so.3 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.2 open_ldap_connection usr/lib/libldap.so.3 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 0 0 1111111 1111110 0 0000001 0 0 0 0 open_mnttab usr/lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0 open_mnttab lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 -open_outfile usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -open_outfile usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -open_outfile usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -open_outfile usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -open_outfile lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -open_outfile lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -open_outfile lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -open_outfile lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 openat usr/lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 SUNW_1.21 SUNW_1.21 SUNW_1.21.2 SUNW_1.21 0 0 0000111 0000110 0 0000001 0 0 0 0 openat usr/lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 SUNW_1.21 SUNW_1.21 SUNW_1.21.2 SUNW_1.21 0 0 0000111 0000110 0 0000001 0 0 0 0 openat lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.21 0000001 0000001 0 0 0 0 0 0 @@ -40070,14 +39941,6 @@ proc_update_maps usr/lib/sparcv9/libproc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUN proc_update_maps usr/lib/libproc.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 0 0 0 0 0 0 0 0 0 0 1111111 1100000 0 0011111 0 0 0 0 proc_walk lib/sparcv9/libproc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 proc_walk lib/libproc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 -process_open usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -process_open usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -process_open usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -process_open usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -process_open lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -process_open lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -process_open lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -process_open lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 processor_bind usr/lib/sparcv9/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0 processor_bind usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0 processor_bind lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0 @@ -42694,22 +42557,6 @@ reglength lib/libgen.so.1 1 4 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 rel_own_bydd usr/lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0 rel_own_bydd lib/libmeta.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 relative_name usr/lib/libnisdb.so.2 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0 -reloc_init usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -reloc_init usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -reloc_init usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -reloc_init usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -reloc_init lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -reloc_init lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -reloc_init lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -reloc_init lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -reloc_process usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -reloc_process usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -reloc_process usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -reloc_process usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -reloc_process lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -reloc_process lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -reloc_process lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -reloc_process lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 reloc_table etc/lib/ld.so.1 1 672 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0 reloc_table usr/lib/sparcv9/ld.so.1 1 672 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0 reloc_table usr/lib/ld.so.1 1 672 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 SUNWprivate_1.2 0 0 1111111 0 1111110 0000001 0 0 0 0 @@ -44238,22 +44085,6 @@ sctp_send usr/lib/sparcv9/libsctp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW sctp_send usr/lib/libsctp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 sctp_sendmsg usr/lib/sparcv9/libsctp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 sctp_sendmsg usr/lib/libsctp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 -sdf_add usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sdf_add usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sdf_add usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sdf_add usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sdf_add lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sdf_add lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sdf_add lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sdf_add lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sdf_find usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sdf_find usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sdf_find usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sdf_find usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sdf_find lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sdf_find lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sdf_find lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sdf_find lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 sdiv usr/lib/libmp.so.1 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 0 0 0001111 0001110 0 0000001 0 0 0 0 sdiv lib/libmp.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 sdssc_add_hosts usr/lib/libmeta.so.1 1 4 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0000111 0 0000110 0000001 0 0 0 0 @@ -44360,14 +44191,6 @@ se_tuple_strings usr/lib/sparcv9/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWpri se_tuple_strings usr/lib/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 0011111 0 0010000 0001111 0 0 0 0 se_tuple_type usr/lib/sparcv9/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 0011111 0 0010000 0001111 0 0 0 0 se_tuple_type usr/lib/librcm.so.1 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0 0 0 0 0 0 0 0 0011111 0 0010000 0001111 0 0 0 0 -sec_validate usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sec_validate usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sec_validate usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sec_validate usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sec_validate lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sec_validate lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sec_validate lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sec_validate lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 seconvert usr/lib/sparcv9/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0 seconvert usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0 seconvert lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0 @@ -46254,14 +46077,6 @@ ssignal usr/lib/sparcv9/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW ssignal usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0 ssignal lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0 ssignal lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_0.7 0000001 0000001 0 0 0 0 0 0 -st_new usr/lib/sparcv9/libld.so.2 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0 -st_new usr/lib/sparcv9/libld.so.3 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0 -st_new usr/lib/libld.so.2 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0 -st_new usr/lib/libld.so.3 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0 0 0111111 0 0101010 0010101 0 0 0 0 -st_new lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -st_new lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -st_new lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -st_new lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 stack_getbounds usr/lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.21.2 SUNW_1.21.2 0 0 0000011 0000010 0 0000001 0 0 0 0 stack_getbounds usr/lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.21.2 SUNW_1.21.2 0 0 0000011 0000010 0 0000001 0 0 0 0 stack_getbounds lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.21.2 0000001 0000001 0 0 0 0 0 0 @@ -46939,30 +46754,6 @@ swscanf usr/lib/sparcv9/libc.so.1 0 0 SUNW_1.18 SUNW_1.18 SUNW_1.18 SUNW_1.18 SU swscanf usr/lib/libc.so.1 0 0 SUNW_1.18 SUNW_1.18 SUNW_1.18 SUNW_1.18 SUNW_1.20 SUNW_1.18 SUNW_1.21 SUNW_1.18 SUNW_1.21 SUNW_1.18 SUNW_1.21.2 SUNW_1.18 0 0 1111111 1111110 0 0000001 0 0 0 0 swscanf lib/sparcv9/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.18 0000001 0000001 0 0 0 0 0 0 swscanf lib/libc.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.22 SUNW_1.18 0000001 0000001 0 0 0 0 0 0 -sym_add_u usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_add_u usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_add_u usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_add_u usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_add_u lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_add_u lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_add_u lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_add_u lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_enter usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_enter usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_enter usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_enter usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_enter lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_enter lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_enter lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_enter lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_find usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_find usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_find usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_find usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_find lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_find lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_find lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_find lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 sym_ntop usr/lib/sparcv9/libresolv.so.2 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 0 0 0001111 0 0001110 0000001 0 0 0 0 sym_ntop usr/lib/libresolv.so.2 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 0 0 0001111 0 0001110 0000001 0 0 0 0 sym_ntop lib/sparcv9/libresolv.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 0000001 0 0000001 0 0 0 0 0 @@ -46975,14 +46766,6 @@ sym_ston usr/lib/sparcv9/libresolv.so.2 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWpriv sym_ston usr/lib/libresolv.so.2 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 SUNWprivate_2.2 SUNWprivate_2.1 0 0 0001111 0 0001110 0000001 0 0 0 0 sym_ston lib/sparcv9/libresolv.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 0000001 0 0000001 0 0 0 0 0 sym_ston lib/libresolv.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.2 SUNWprivate_2.1 0000001 0 0000001 0 0 0 0 0 -sym_validate usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_validate usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_validate usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_validate usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -sym_validate lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_validate lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_validate lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -sym_validate lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 symlink usr/lib/sparcv9/libc.so.1 0 0 SUNW_1.18 SUNW_0.7 SUNW_1.18 SUNW_0.7 SUNW_1.20 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21 SUNW_0.7 SUNW_1.21.2 SUNW_0.7 0 0 1111111 1111110 0 0000001 0 0 0 0 symlink usr/lib/libc.so.1 0 0 SUNW_1.18 SYSVABI_1.3 SUNW_1.18 SYSVABI_1.3 SUNW_1.20 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21 SYSVABI_1.3 SUNW_1.21.2 SYSVABI_1.3 0 0 1111111 1111110 0 0000001 0 0 0 0 symlink usr/lib/libsys.so.1 0 0 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 SISCD_2.3 SYSVABI_1.2 1111111 1111111 0 0 0 0 0 0 @@ -49246,14 +49029,6 @@ untouchwin usr/xpg4/lib/sparcv9/libcurses.so.2 0 0 0 0 0 0 SUNW_1.2 SUNW_1.1 SUN untouchwin usr/xpg4/lib/libcurses.so.2 0 0 0 0 0 0 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 SUNW_1.2 SUNW_1.1 0011111 0011111 0 0 0 0 0 0 untouchwin lib/sparcv9/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 untouchwin lib/libcurses.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNW_1.1 SUNW_1.1 0000001 0000001 0 0 0 0 0 0 -update_outfile usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -update_outfile usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -update_outfile usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -update_outfile usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -update_outfile lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -update_outfile lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -update_outfile lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -update_outfile lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 update_panels usr/lib/sparcv9/libpanel.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 update_panels usr/lib/libpanel.so.1 0 0 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 SUNW_1.1 1111111 1111111 0 0 0 0 0 0 update_root_object usr/lib/libnisdb.so.2 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 SUNWprivate_2.1 0000111 0 0000111 0 0 0 0 0 @@ -49546,38 +49321,6 @@ verbosity usr/lib/libmeta.so.1 1 4 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWpriva verbosity lib/libmeta.so.1 1 4 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 verr usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 verrx usr/lib/libipsecutil.so.1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 0000001 0 0000001 0 0 0 0 0 -vers_base usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_base usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_base usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_base usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_base lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_base lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_base lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_base lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_check_defs usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_check_defs usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_check_defs usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_check_defs usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_check_defs lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_check_defs lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_check_defs lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_check_defs lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_desc usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_desc usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_desc usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_desc usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_desc lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_desc lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_desc lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_desc lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_find usr/lib/sparcv9/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_find usr/lib/sparcv9/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_find usr/lib/libld.so.3 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_find usr/lib/libld.so.2 0 0 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.9 SUNWprivate_2.9 SUNWprivate_2.14 SUNWprivate_2.14 SUNWprivate_2.11 SUNWprivate_2.11 SUNWprivate_2.14 SUNWprivate_2.14 0 0 1111111 0 1111110 0000001 0 0 0 0 -vers_find lib/sparcv9/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_find lib/sparcv9/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_find lib/libld.so.2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 -vers_find lib/libld.so.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0 SUNWprivate_2.14 SUNWprivate_2.14 0000001 0 0000001 0 0 0 0 0 version usr/lib/inet/dhcp/svc/ds_SUNWfiles.so.0 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 version usr/lib/inet/dhcp/svc/ds_SUNWfiles.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 version usr/lib/inet/dhcp/svc/ds_SUNWbinfiles.so.1 0 0 0 0 0 0 0 0 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 SUNWprivate_1.1 0001111 0 0001111 0 0 0 0 0 diff --git a/usr/src/tools/scripts/check_rtime.pl b/usr/src/tools/scripts/check_rtime.pl index d490f79345..b42931584e 100644 --- a/usr/src/tools/scripts/check_rtime.pl +++ b/usr/src/tools/scripts/check_rtime.pl @@ -127,8 +127,7 @@ $SkipUndefFiles = qr{ ^(?: librtld_db\.so\.1 | # " " " " libc_db\.so\.1 | # " " " " libldstab\.so\.1 | # link-edit support libraries have - libld\.so\.3 | # callback to the link-editors - libld\.so\.2 | # " " " " + libld\.so\.[2-4] | # callback to the link-editors liblddbg\.so\.4 | # " " " " librtld\.so\.1 | # " " " " libnisdb\.so\.2 | # C++ diff --git a/usr/src/uts/common/krtld/reloc.h b/usr/src/uts/common/krtld/reloc.h index 8b13de461d..9358f12ca8 100644 --- a/usr/src/uts/common/krtld/reloc.h +++ b/usr/src/uts/common/krtld/reloc.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. @@ -37,6 +36,7 @@ #include <sys/kobj_impl.h> #else #include <machdep.h> +#include <rtld.h> #include <conv.h> #endif /* _KERNEL */ @@ -81,7 +81,22 @@ extern "C" { /* locally */ /* - * Macros for testing relocation table flags + * In user land, redefine the relocation table and relocation engine to be + * class specific if necessary. This allows both engines to reside in the + * intel/amd version of libld. + */ +#if !defined(_KERNEL) +#if defined(_ELF64) +#define do_reloc do64_reloc +#define reloc_table reloc64_table +#else +#define do_reloc do32_reloc +#define reloc_table reloc32_table +#endif +#endif + +/* + * Relocation table and macros for testing relocation table flags. */ extern const Rel_entry reloc_table[]; @@ -107,53 +122,38 @@ extern const Rel_entry reloc_table[]; FLG_RE_ADDRELATIVE) != 0) #define IS_REGISTER(X) ((reloc_table[(X)].re_flags & \ FLG_RE_REGISTER) != 0) -#define IS_FORMOFF(X) ((reloc_table[(X)].re_flags &\ +#define IS_FORMOFF(X) ((reloc_table[(X)].re_flags & \ FLG_RE_FRMOFF) != 0) -#define IS_NOTSUP(X) ((reloc_table[(X)].re_flags &\ +#define IS_NOTSUP(X) ((reloc_table[(X)].re_flags & \ FLG_RE_NOTSUP) != 0) -#define IS_SEG_RELATIVE(X) ((reloc_table[(X)].re_flags &\ +#define IS_SEG_RELATIVE(X) ((reloc_table[(X)].re_flags & \ FLG_RE_SEGREL) != 0) -#define IS_EXTOFFSET(X) ((reloc_table[(X)].re_flags &\ +#define IS_EXTOFFSET(X) ((reloc_table[(X)].re_flags & \ FLG_RE_EXTOFFSET) != 0) -#define IS_SEC_RELATIVE(X) ((reloc_table[(X)].re_flags &\ +#define IS_SEC_RELATIVE(X) ((reloc_table[(X)].re_flags & \ FLG_RE_SECREL) != 0) -#define IS_TLS_INS(X) ((reloc_table[(X)].re_flags &\ +#define IS_TLS_INS(X) ((reloc_table[(X)].re_flags & \ FLG_RE_TLSINS) != 0) -#define IS_TLS_GD(X) ((reloc_table[(X)].re_flags &\ +#define IS_TLS_GD(X) ((reloc_table[(X)].re_flags & \ FLG_RE_TLSGD) != 0) -#define IS_TLS_LD(X) ((reloc_table[(X)].re_flags &\ +#define IS_TLS_LD(X) ((reloc_table[(X)].re_flags & \ FLG_RE_TLSLD) != 0) -#define IS_TLS_IE(X) ((reloc_table[(X)].re_flags &\ +#define IS_TLS_IE(X) ((reloc_table[(X)].re_flags & \ FLG_RE_TLSIE) != 0) -#define IS_TLS_LE(X) ((reloc_table[(X)].re_flags &\ +#define IS_TLS_LE(X) ((reloc_table[(X)].re_flags & \ FLG_RE_TLSLE) != 0) -#define IS_TLS(X) ((reloc_table[(X)].re_flags &\ +#define IS_TLS(X) ((reloc_table[(X)].re_flags & \ (FLG_RE_TLSINS|FLG_RE_TLSGD| \ FLG_RE_TLSLD|FLG_RE_TLSIE| \ FLG_RE_TLSLE)) != 0) -#define IS_LOCALBND(X) ((reloc_table[(X)].re_flags &\ +#define IS_LOCALBND(X) ((reloc_table[(X)].re_flags & \ FLG_RE_LOCLBND) != 0) /* - * Functions. + * Relocation engine. */ extern int do_reloc(uchar_t, uchar_t *, Xword *, const char *, - const char *); - -/* - * Provide a macro to select the appropriate convension routine for this - * architecture. - */ -#if defined(__amd64) -#define CONV_RELOC_TYPE conv_reloc_amd64_type_str -#elif defined(__i386) -#define CONV_RELOC_TYPE conv_reloc_386_type_str -#elif defined(__sparc) -#define CONV_RELOC_TYPE conv_reloc_SPARC_type_str -#else -#error platform not defined! -#endif - + const char *, void *); #if defined(_KERNEL) /* @@ -182,49 +182,68 @@ extern int do_reloc(uchar_t, uchar_t *, Xword *, const char *, #define MSG_REL_OFFSET "offset 0x%llx" #define MSG_REL_NOFIT "value 0x%llx does not fit" -extern const char *conv_reloc_386_type_str(uint_t); -extern const char *conv_reloc_amd64_type_str(uint_t); -extern const char *conv_reloc_SPARC_type_str(uint_t); +/* + * Provide a macro to select the appropriate conversion routine for this + * architecture. + */ +#if defined(__amd64) + +extern const char *conv_reloc_amd64_type(Word); +#define CONV_RELOC_TYPE conv_reloc_amd64_type + +#elif defined(__i386) + +extern const char *conv_reloc_386_type(Word); +#define CONV_RELOC_TYPE conv_reloc_386_type + +#elif defined(__sparc) + +extern const char *conv_reloc_SPARC_type(Word); +#define CONV_RELOC_TYPE conv_reloc_SPARC_type + +#else +#error platform not defined! +#endif /* - * Note: Related to bug 4128755, dlerror() only keeps track of a single error - * string, and therefore must have errors reported through a single eprintf() - * call. The kernel's _kobj_printf is somewhat more limited, and must receive - * messages with only one arguement to the format string. The following macros - * are to straighted all this out because krtld and rtld share do_reloc(). + * Note: dlerror() only keeps track of a single error string, and therefore + * must have errors reported through a single eprintf() call. The kernel's + * _kobj_printf is somewhat more limited, and must receive messages with only + * one argument to the format string. The following macros account for these + * differences, as krtld and rtld share do_reloc(). */ -#define REL_ERR_UNIMPL(file, sym, rtype) \ +#define REL_ERR_UNIMPL(lml, file, sym, rtype) \ _kobj_printf(ops, MSG_REL_PREFIL, (file)); \ _kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \ _kobj_printf(ops, MSG_REL_UNIMPL, (int)(rtype)) -#define REL_ERR_UNSUPSZ(file, sym, rtype, size) \ +#define REL_ERR_UNSUPSZ(lml, file, sym, rtype, size) \ _kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \ _kobj_printf(ops, MSG_REL_FILE, (file)); \ _kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \ _kobj_printf(ops, MSG_REL_UNSUPSZ, (int)(size)) -#define REL_ERR_NONALIGN(file, sym, rtype, off) \ +#define REL_ERR_NONALIGN(lml, file, sym, rtype, off) \ _kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \ _kobj_printf(ops, MSG_REL_FILE, (file)); \ _kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \ _kobj_printf(ops, MSG_REL_NONALIGN, EC_OFF((off))) -#define REL_ERR_UNNOBITS(file, sym, rtype, nbits) \ +#define REL_ERR_UNNOBITS(lml, file, sym, rtype, nbits) \ _kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \ _kobj_printf(ops, MSG_REL_FILE, (file)); \ _kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \ _kobj_printf(ops, MSG_REL_UNNOBITS, (nbits)) -#define REL_ERR_LOSEBITS(file, sym, rtype, uvalue, nbits, off) \ +#define REL_ERR_LOSEBITS(lml, file, sym, rtype, uvalue, nbits, off) \ _kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \ _kobj_printf(ops, MSG_REL_FILE, (file)); \ _kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \ _kobj_printf(ops, MSG_REL_VALUE, EC_XWORD((uvalue))); \ _kobj_printf(ops, MSG_REL_LOSEBITS, (int)(nbits)); \ - _kobj_printf(ops, MSG_REL_OFFSET, EC_ADDR((off))) + _kobj_printf(ops, MSG_REL_OFFSET, EC_NATPTR((off))) -#define REL_ERR_NOFIT(file, sym, rtype, uvalue) \ +#define REL_ERR_NOFIT(lml, file, sym, rtype, uvalue) \ _kobj_printf(ops, MSG_REL_PREGEN, CONV_RELOC_TYPE((rtype))); \ _kobj_printf(ops, MSG_REL_FILE, (file)); \ _kobj_printf(ops, MSG_REL_SYM, ((sym) ? (sym) : MSG_STR_UNKNOWN)); \ @@ -235,34 +254,34 @@ extern const char *conv_reloc_SPARC_type_str(uint_t); extern const char *demangle(const char *); -#define REL_ERR_UNIMPL(file, sym, rtype) \ - (eprintf(ERR_FATAL, MSG_INTL(MSG_REL_UNIMPL), (file), \ +#define REL_ERR_UNIMPL(lml, file, sym, rtype) \ + (eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_UNIMPL), (file), \ ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), (int)(rtype))) -#define REL_ERR_UNSUPSZ(file, sym, rtype, size) \ - (eprintf(ERR_FATAL, MSG_INTL(MSG_REL_UNSUPSZ), \ - CONV_RELOC_TYPE((rtype)), (file), \ +#define REL_ERR_UNSUPSZ(lml, file, sym, rtype, size) \ + (eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_UNSUPSZ), \ + conv_reloc_type(M_MACH, (rtype)), (file), \ ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), (int)(size))) -#define REL_ERR_NONALIGN(file, sym, rtype, off) \ - (eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NONALIGN), \ - CONV_RELOC_TYPE((rtype)), (file), \ +#define REL_ERR_NONALIGN(lml, file, sym, rtype, off) \ + (eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NONALIGN), \ + conv_reloc_type(M_MACH, (rtype)), (file), \ ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), EC_OFF((off)))) -#define REL_ERR_UNNOBITS(file, sym, rtype, nbits) \ - (eprintf(ERR_FATAL, MSG_INTL(MSG_REL_UNNOBITS), \ - CONV_RELOC_TYPE((rtype)), (file), \ +#define REL_ERR_UNNOBITS(lml, file, sym, rtype, nbits) \ + (eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_UNNOBITS), \ + conv_reloc_type(M_MACH, (rtype)), (file), \ ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), (nbits))) -#define REL_ERR_LOSEBITS(file, sym, rtype, uvalue, nbits, off) \ - (eprintf(ERR_FATAL, MSG_INTL(MSG_REL_LOSEBITS), \ - CONV_RELOC_TYPE((rtype)), (file), \ +#define REL_ERR_LOSEBITS(lml, file, sym, rtype, uvalue, nbits, off) \ + (eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_LOSEBITS), \ + conv_reloc_type(M_MACH, (rtype)), (file), \ ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), \ - EC_XWORD((uvalue)), (nbits), EC_ADDR((off)))) + EC_XWORD((uvalue)), (nbits), EC_NATPTR((off)))) -#define REL_ERR_NOFIT(file, sym, rtype, uvalue) \ - (eprintf(ERR_FATAL, MSG_INTL(MSG_REL_NOFIT), \ - CONV_RELOC_TYPE((rtype)), (file), \ +#define REL_ERR_NOFIT(lml, file, sym, rtype, uvalue) \ + (eprintf(lml, ERR_FATAL, MSG_INTL(MSG_REL_NOFIT), \ + conv_reloc_type(M_MACH, (rtype)), (file), \ ((sym) ? demangle(sym) : MSG_INTL(MSG_STR_UNKNOWN)), \ EC_XWORD((uvalue)))) diff --git a/usr/src/uts/intel/amd64/krtld/doreloc.c b/usr/src/uts/intel/amd64/krtld/doreloc.c index ff85146908..ee88014938 100644 --- a/usr/src/uts/intel/amd64/krtld/doreloc.c +++ b/usr/src/uts/intel/amd64/krtld/doreloc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -151,14 +150,14 @@ const Rel_entry reloc_table[R_AMD64_NUM] = { * * S Represents the value of the symbol whose index resides * in the relocation entry. - * */ #define HIBITS 0xffffffff80000000ULL +/* ARGSUSED5 */ int do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym, - const char *file) + const char *file, void *lml) { const Rel_entry *rep; @@ -199,7 +198,7 @@ do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym, * To keep chkmsg() happy: * MSG_INTL(MSG_REL_NOFIT) */ - REL_ERR_NOFIT(file, sym, rtype, *value); + REL_ERR_NOFIT(lml, file, sym, rtype, *value); return (0); } } else if ((rtype == R_AMD64_32S) || (rtype == R_AMD64_PC32) || @@ -215,7 +214,7 @@ do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym, * To keep chkmsg() happy: * MSG_INTL(MSG_REL_NOFIT) */ - REL_ERR_NOFIT(file, sym, rtype, *value); + REL_ERR_NOFIT(lml, file, sym, rtype, *value); return (0); } } @@ -230,7 +229,7 @@ do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym, /* * To keep chkmsg() happy: MSG_INTL(MSG_REL_UNSUPSZ) */ - REL_ERR_UNSUPSZ(file, sym, rtype, rep->re_fsize); + REL_ERR_UNSUPSZ(lml, file, sym, rtype, rep->re_fsize); return (0); } return (1); diff --git a/usr/src/uts/intel/amd64/krtld/kobj_convrelstr.c b/usr/src/uts/intel/amd64/krtld/kobj_convrelstr.c index 6f191d8e1a..69b45c8b10 100644 --- a/usr/src/uts/intel/amd64/krtld/kobj_convrelstr.c +++ b/usr/src/uts/intel/amd64/krtld/kobj_convrelstr.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -58,7 +57,7 @@ static const char *rels[R_AMD64_NUM] = { * the relocation to it's full syntax. */ const char * -conv_reloc_amd64_type_str(uint_t type) +conv_reloc_amd64_type(Word type) { static char strbuf[32]; int ndx = 31; diff --git a/usr/src/uts/intel/amd64/krtld/kobj_reloc.c b/usr/src/uts/intel/amd64/krtld/kobj_reloc.c index 66186fe80b..f2033e5223 100644 --- a/usr/src/uts/intel/amd64/krtld/kobj_reloc.c +++ b/usr/src/uts/intel/amd64/krtld/kobj_reloc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -181,7 +181,7 @@ do_relocate(struct module *mp, char *reltbl, Word relshtype, int nreloc, symp = (Sym *) (mp->symtbl+(stndx * mp->symhdr->sh_entsize)); _kobj_printf(ops, "krtld:\t%s", - conv_reloc_amd64_type_str(rtype)); + conv_reloc_amd64_type(rtype)); _kobj_printf(ops, "\t0x%8llx", off); _kobj_printf(ops, " 0x%8llx", addend); _kobj_printf(ops, " %s\n", @@ -267,7 +267,7 @@ do_relocate(struct module *mp, char *reltbl, Word relshtype, int nreloc, if (do_reloc(rtype, (unsigned char *)off, &value, (const char *)mp->strings + symref->st_name, - mp->filename) == 0) + mp->filename, 0) == 0) err = 1; } /* end of while loop */ diff --git a/usr/src/uts/intel/ia32/krtld/doreloc.c b/usr/src/uts/intel/ia32/krtld/doreloc.c index 4ea9cff31f..0fc1d362a3 100644 --- a/usr/src/uts/intel/ia32/krtld/doreloc.c +++ b/usr/src/uts/intel/ia32/krtld/doreloc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -161,9 +160,10 @@ const Rel_entry reloc_table[R_386_NUM] = { * been performed before calling this function except for the addition of * the addresses in the instructions. */ +/* ARGSUSED5 */ int do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym, - const char *file) + const char *file, void *lml) { const Rel_entry *rep; @@ -186,7 +186,7 @@ do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym, /* * To keep chkmsg() happy: MSG_INTL(MSG_REL_UNSUPSZ) */ - REL_ERR_UNSUPSZ(file, sym, rtype, rep->re_fsize); + REL_ERR_UNSUPSZ(lml, file, sym, rtype, rep->re_fsize); return (0); } return (1); diff --git a/usr/src/uts/intel/ia32/krtld/kobj_convrelstr.c b/usr/src/uts/intel/ia32/krtld/kobj_convrelstr.c index da12eabc25..afd55669e2 100644 --- a/usr/src/uts/intel/ia32/krtld/kobj_convrelstr.c +++ b/usr/src/uts/intel/ia32/krtld/kobj_convrelstr.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -61,7 +60,7 @@ static const char *rels[R_386_NUM] = { * the relocation to it's full syntax. */ const char * -conv_reloc_386_type_str(uint_t type) +conv_reloc_386_type(Word type) { static char strbuf[32]; int ndx = 31; diff --git a/usr/src/uts/intel/ia32/krtld/kobj_reloc.c b/usr/src/uts/intel/ia32/krtld/kobj_reloc.c index 87d7b720eb..547bf9ce9c 100644 --- a/usr/src/uts/intel/ia32/krtld/kobj_reloc.c +++ b/usr/src/uts/intel/ia32/krtld/kobj_reloc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -177,7 +177,7 @@ do_relocate(struct module *mp, char *reltbl, Word relshtype, int nreloc, symp = (Sym *) (mp->symtbl+(stndx * mp->symhdr->sh_entsize)); _kobj_printf(ops, "krtld:\t%s", - conv_reloc_386_type_str(rtype)); + conv_reloc_386_type(rtype)); _kobj_printf(ops, "\t0x%8x", off); _kobj_printf(ops, " %s\n", (const char *)mp->strings + symp->st_name); @@ -260,7 +260,7 @@ do_relocate(struct module *mp, char *reltbl, Word relshtype, int nreloc, if (do_reloc(rtype, (unsigned char *)off, (Word *)&value, (const char *)mp->strings + symref->st_name, - mp->filename) == 0) + mp->filename, 0) == 0) err = 1; } /* end of while loop */ diff --git a/usr/src/uts/intel/sys/machelf.h b/usr/src/uts/intel/sys/machelf.h index dec2e89db5..ac28665319 100644 --- a/usr/src/uts/intel/sys/machelf.h +++ b/usr/src/uts/intel/sys/machelf.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -39,13 +39,15 @@ extern "C" { #include <sys/elf_386.h> #endif #ifndef _ASM +#include <sys/types.h> #include <sys/elf.h> #include <sys/link.h> /* for Elf*_Dyn */ #endif /* _ASM */ + /* * Make machine class dependent data types transparent to the common code */ -#if defined(_ELF64) && ! defined(_ELF32_COMPAT) +#if defined(_ELF64) && !defined(_ELF32_COMPAT) #ifndef _ASM typedef Elf64_Xword Xword; @@ -56,7 +58,7 @@ typedef Elf64_Sword Sword; typedef Elf64_Half Half; typedef Elf64_Addr Addr; typedef Elf64_Off Off; -typedef unsigned char Byte; +typedef uchar_t Byte; #endif /* _ASM */ #if defined(_KERNEL) @@ -93,14 +95,13 @@ typedef Elf64_Cap Cap; */ typedef struct { Word re_flags; /* relocation attributes */ - unsigned char re_fsize; /* field size (in #bytes) */ - unsigned char re_sigbits; /* # of significant bits */ + uchar_t re_fsize; /* field size (in bytes) */ + uchar_t re_sigbits; /* number of significant bits */ } Rel_entry; -#endif /* _ASM */ - +#endif /* _ASM */ -#else /* _ILP32 */ +#else /* _ILP32 */ #ifndef _ASM typedef Elf32_Word Xword; /* Xword/Sxword are 32-bits in Elf32 */ @@ -111,7 +112,7 @@ typedef Elf32_Sword Sword; typedef Elf32_Half Half; typedef Elf32_Addr Addr; typedef Elf32_Off Off; -typedef unsigned char Byte; +typedef uchar_t Byte; #endif /* _ASM */ #if defined(_KERNEL) @@ -128,9 +129,9 @@ typedef unsigned char Byte; typedef Elf32_Ehdr Ehdr; typedef Elf32_Shdr Shdr; typedef Elf32_Sym Sym; -typedef Elf32_Syminfo Syminfo; -typedef Elf32_Rel Rel; +typedef Elf32_Syminfo Syminfo; typedef Elf32_Rela Rela; +typedef Elf32_Rel Rel; typedef Elf32_Nhdr Nhdr; typedef Elf32_Phdr Phdr; typedef Elf32_Dyn Dyn; @@ -147,42 +148,48 @@ typedef Elf32_Cap Cap; * Structure used to build the reloc_table[] */ typedef struct { - unsigned int re_flags; /* relocation attributes */ - unsigned char re_fsize; /* field size (in #bytes) */ + uint_t re_flags; /* relocation attributes */ + uchar_t re_fsize; /* field size (in bytes) */ } Rel_entry; -#endif /* _ASM */ - +#endif /* _ASM */ -#endif /* _ILP32 */ +#endif /* _ILP32 */ +/* + * Elf `printf' type-cast macros. These force arguments to be a fixed size + * so that Elf32 and Elf64 can share common format strings. + */ +#ifndef __lint +#define EC_ADDR(a) ((Elf64_Addr)(a)) /* "ull" */ +#define EC_OFF(a) ((Elf64_Off)(a)) /* "ull" */ +#define EC_HALF(a) ((Elf64_Half)(a)) /* "d" */ +#define EC_WORD(a) ((Elf64_Word)(a)) /* "u" */ +#define EC_SWORD(a) ((Elf64_Sword)(a)) /* "d" */ +#define EC_XWORD(a) ((Elf64_Xword)(a)) /* "ull" */ +#define EC_SXWORD(a) ((Elf64_Sxword)(a)) /* "ll" */ +#define EC_LWORD(a) ((Elf64_Lword)(a)) /* "ull" */ /* - * Elf `printf' type-cast macros. These force arguements to - * be a fixed size so that Elf32 and Elf64 can share common - * format strings. + * A native pointer is special. Although it can be convenient to display + * these from a common format (ull), compilers may flag the cast of a pointer + * to an integer as illegal. Casting these pointers to the native pointer + * size, suppresses any compiler errors. */ -#ifndef __lint -#define EC_ADDR(a) ((Elf64_Addr)(uintptr_t)(a)) /* "ull" */ -#define EC_OFF(a) ((Elf64_Off)(a)) /* "ll" */ -#define EC_HALF(a) ((Elf64_Half)(a)) /* "d" */ -#define EC_WORD(a) ((Elf64_Word)(a)) /* "u" */ -#define EC_SWORD(a) ((Elf64_Sword)(a)) /* "d" */ -#define EC_XWORD(a) ((Elf64_Xword)(a)) /* "ull" */ -#define EC_SXWORD(a) ((Elf64_Sxword)(a)) /* "ll" */ -#define EC_LWORD(a) ((Elf64_Lword)(a)) /* "ull" */ +#define EC_NATPTR(a) ((Elf64_Xword)(uintptr_t)(a)) /* "ull" */ #else -#define EC_ADDR(a) ((unsigned long long)(a)) -#define EC_OFF(a) ((long long)(a)) -#define EC_HALF(a) ((Elf64_Half)(a)) -#define EC_WORD(a) ((Elf64_Word)(a)) -#define EC_SWORD(a) ((Elf64_Sword)(a)) -#define EC_XWORD(a) ((unsigned long long)(a)) -#define EC_SXWORD(a) ((long long)(a)) -#define EC_LWORD(a) ((unsigned long long)(a)) +#define EC_ADDR(a) ((u_longlong_t)(a)) +#define EC_OFF(a) ((u_longlong_t)(a)) +#define EC_HALF(a) ((ushort_t)(a)) +#define EC_WORD(a) ((uint_t)(a)) +#define EC_SWORD(a) ((int)(a)) +#define EC_XWORD(a) ((u_longlong_t)(a)) +#define EC_SXWORD(a) ((longlong_t)(a)) +#define EC_LWORD(a) ((u_longlong_t)(a)) + +#define EC_NATPTR(a) ((u_longlong_t)(a)) #endif - #ifdef __cplusplus } #endif diff --git a/usr/src/uts/sparc/krtld/doreloc.c b/usr/src/uts/sparc/krtld/doreloc.c index 446f9a82bc..7b98eee72a 100644 --- a/usr/src/uts/sparc/krtld/doreloc.c +++ b/usr/src/uts/sparc/krtld/doreloc.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. @@ -130,8 +129,8 @@ const Rel_entry reloc_table[R_SPARC_NUM] = { 8, 0, 0}, /* R_SPARC_PLT64 */ {0x0, FLG_RE_PLTREL | FLG_RE_VERIFY | FLG_RE_ADDRELATIVE, 8, 0, 0}, -/* R_SPARC_HIX22 */ {(Xword)(-1LL), FLG_RE_NOTREL | FLG_RE_VERIFY, - 4, 10, 22}, /* V9 - HaL */ +/* R_SPARC_HIX22 */ {(Xword)(-1LL), FLG_RE_VERIFY, + 4, 10, 22}, /* V9 - HaL */ /* R_SPARC_LOX10 */ {0x3ff, FLG_RE_SIGN, 4, 0, 13}, /* V9 - HaL */ /* R_SPARC_H44 */ {0x0, FLG_RE_VERIFY, 4, 22, 22}, /* V9 */ /* R_SPARC_M44 */ {0x3ff, FLG_RE_NOTREL, 4, 12, 10}, /* V9 */ @@ -183,8 +182,7 @@ const Rel_entry reloc_table[R_SPARC_NUM] = { /* R_SPARC_GOTDATA_OP_LOX10 */ { 0x3ff, FLG_RE_SIGN | FLG_RE_GOTOPINS | FLG_RE_GOTADD, 4, 0, 13}, /* R_SPARC_GOTDATA_OP */ { 0x0, FLG_RE_GOTOPINS, 0, 0, 0}, -/* R_SPARC_H34 */ {0x0, FLG_RE_NOTREL | FLG_RE_VERIFY, 4, - 12, 22} /* V9 */ +/* R_SPARC_H34 */ {0x0, FLG_RE_VERIFY, 4, 12, 22} /* V9 */ }; @@ -345,10 +343,10 @@ const Rel_entry reloc_table[R_SPARC_NUM] = { * Upon successful completion of do_reloc() *value will be set to the * 'bit-shifted' value that will be or'ed into memory. */ -/* ARGSUSED3 */ +/* ARGSUSED5 */ int do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym, - const char *file) + const char *file, void *lml) { Xword uvalue = 0; Xword basevalue, sigbit_mask, sigfit_mask; @@ -374,7 +372,7 @@ do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym, sigfit_mask = sigbit_mask; if (field_size == 0) { - REL_ERR_UNIMPL(file, sym, rtype); + REL_ERR_UNIMPL(lml, file, sym, rtype); return (0); } @@ -397,7 +395,7 @@ do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym, if (((field_size == 2) && ((uintptr_t)off & 0x1)) || ((field_size == 4) && ((uintptr_t)off & 0x3)) || ((field_size == 8) && ((uintptr_t)off & 0x7))) { - REL_ERR_NONALIGN(file, sym, rtype, (uintptr_t)off); + REL_ERR_NONALIGN(lml, file, sym, rtype, (uintptr_t)off); return (0); } switch (field_size) { @@ -417,7 +415,8 @@ do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym, basevalue = (Xword)*((Xword *)off); break; default: - REL_ERR_UNNOBITS(file, sym, rtype, rep->re_fsize * 8); + REL_ERR_UNNOBITS(lml, file, sym, rtype, + (rep->re_fsize * 8)); return (0); } } @@ -460,7 +459,7 @@ do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym, * jump to a non-4 byte aligned address. */ if ((bshift == 2) && (uvalue & 0x3)) { - REL_ERR_LOSEBITS(file, sym, rtype, uvalue, 2, off); + REL_ERR_LOSEBITS(lml, file, sym, rtype, uvalue, 2, off); return (0); } @@ -500,7 +499,7 @@ do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym, (S_INRANGE((Sxword)uvalue, rep->re_sigbits - 1) == 0)) || (!(re_flags & FLG_RE_SIGN) && ((sigbit_mask & uvalue) != uvalue))) { - REL_ERR_NOFIT(file, sym, rtype, uvalue); + REL_ERR_NOFIT(lml, file, sym, rtype, uvalue); return (0); } } @@ -558,7 +557,7 @@ do_reloc(uchar_t rtype, uchar_t *off, Xword *value, const char *sym, /* * To keep chkmsg() happy: MSG_INTL(MSG_REL_UNSUPSZ) */ - REL_ERR_UNSUPSZ(file, sym, rtype, rep->re_fsize); + REL_ERR_UNSUPSZ(lml, file, sym, rtype, rep->re_fsize); return (0); } } diff --git a/usr/src/uts/sparc/krtld/kobj_convrelstr.c b/usr/src/uts/sparc/krtld/kobj_convrelstr.c index a615f49e80..b9681a461f 100644 --- a/usr/src/uts/sparc/krtld/kobj_convrelstr.c +++ b/usr/src/uts/sparc/krtld/kobj_convrelstr.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -21,7 +20,7 @@ */ /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ #pragma ident "%Z%%M% %I% %E% SMI" @@ -85,7 +84,7 @@ static const char *rels[R_SPARC_NUM] = { * the relocation to it's full syntax. */ const char * -conv_reloc_SPARC_type_str(uint_t type) +conv_reloc_SPARC_type(Word type) { static char strbuf[32]; int ndx = 31; diff --git a/usr/src/uts/sparc/krtld/kobj_reloc.c b/usr/src/uts/sparc/krtld/kobj_reloc.c index 0bfb25cf48..12d2a19d5a 100644 --- a/usr/src/uts/sparc/krtld/kobj_reloc.c +++ b/usr/src/uts/sparc/krtld/kobj_reloc.c @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2005 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -230,7 +230,7 @@ do_relocate( symp = (Sym *) (mp->symtbl+(stndx * mp->symhdr->sh_entsize)); _kobj_printf(ops, "krtld:\t%s", - conv_reloc_SPARC_type_str(rtype)); + conv_reloc_SPARC_type(rtype)); _kobj_printf(ops, "\t0x%8llx", off); _kobj_printf(ops, " 0x%8llx", addend); _kobj_printf(ops, " %s\n", @@ -326,7 +326,7 @@ do_relocate( #endif if (do_reloc(rtype, (unsigned char *)off, (Xword *)&value, (const char *)mp->strings + symref->st_name, - mp->filename) == 0) + mp->filename, 0) == 0) err = 1; } /* end of while loop */ diff --git a/usr/src/uts/sparc/sys/machelf.h b/usr/src/uts/sparc/sys/machelf.h index a31427c862..2ad50966a2 100644 --- a/usr/src/uts/sparc/sys/machelf.h +++ b/usr/src/uts/sparc/sys/machelf.h @@ -2,9 +2,8 @@ * CDDL HEADER START * * The contents of this file are subject to the terms of the - * Common Development and Distribution License, Version 1.0 only - * (the "License"). You may not use this file except in compliance - * with the License. + * Common Development and Distribution License (the "License"). + * You may not use this file except in compliance with the License. * * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE * or http://www.opensolaris.org/os/licensing. @@ -19,8 +18,9 @@ * * CDDL HEADER END */ + /* - * Copyright 2004 Sun Microsystems, Inc. All rights reserved. + * Copyright 2006 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -29,16 +29,17 @@ #pragma ident "%Z%%M% %I% %E% SMI" +#ifdef __cplusplus +extern "C" { +#endif + #include <sys/elf_SPARC.h> #ifndef _ASM +#include <sys/types.h> #include <sys/elf.h> #include <sys/link.h> /* for Elf*_Dyn */ #endif /* _ASM */ -#ifdef __cplusplus -extern "C" { -#endif - /* * Make machine class dependent data types transparent to the common code */ @@ -53,7 +54,7 @@ typedef Elf64_Sword Sword; typedef Elf64_Half Half; typedef Elf64_Addr Addr; typedef Elf64_Off Off; -typedef unsigned char Byte; +typedef uchar_t Byte; #endif /* _ASM */ #if defined(_KERNEL) @@ -87,7 +88,7 @@ typedef Elf64_Move Move; typedef Elf64_Cap Cap; #endif /* _ASM */ -#else /* _ILP32 */ +#else /* _ILP32 */ #ifndef _ASM typedef Elf32_Word Xword; /* Xword/Sxword are 32-bits in Elf32 */ @@ -98,7 +99,7 @@ typedef Elf32_Sword Sword; typedef Elf32_Half Half; typedef Elf32_Addr Addr; typedef Elf32_Off Off; -typedef unsigned char Byte; +typedef uchar_t Byte; #endif /* _ASM */ #if defined(_KERNEL) @@ -132,36 +133,42 @@ typedef Elf32_Move Move; typedef Elf32_Cap Cap; #endif /* _ASM */ -#endif /* _ILP32 */ - - +#endif /* _ILP32 */ /* - * Elf `printf' type-cast macros. These force arguements to - * be a fixed size so that Elf32 and Elf64 can share common - * format strings. + * Elf `printf' type-cast macros. These force arguments to be a fixed size + * so that Elf32 and Elf64 can share common format strings. */ #ifndef __lint -#define EC_ADDR(a) ((Elf64_Addr)(uintptr_t)(a)) /* "ull" */ -#define EC_OFF(a) ((Elf64_Off)(a)) /* "ll" */ -#define EC_HALF(a) ((Elf64_Half)(a)) /* "d" */ -#define EC_WORD(a) ((Elf64_Word)(a)) /* "u" */ -#define EC_SWORD(a) ((Elf64_Sword)(a)) /* "d" */ -#define EC_XWORD(a) ((Elf64_Xword)(a)) /* "ull" */ -#define EC_SXWORD(a) ((Elf64_Sxword)(a)) /* "ll" */ -#define EC_LWORD(a) ((Elf64_Lword)(a)) /* "ull" */ +#define EC_ADDR(a) ((Elf64_Addr)(a)) /* "ull" */ +#define EC_OFF(a) ((Elf64_Off)(a)) /* "ull" */ +#define EC_HALF(a) ((Elf64_Half)(a)) /* "d" */ +#define EC_WORD(a) ((Elf64_Word)(a)) /* "u" */ +#define EC_SWORD(a) ((Elf64_Sword)(a)) /* "d" */ +#define EC_XWORD(a) ((Elf64_Xword)(a)) /* "ull" */ +#define EC_SXWORD(a) ((Elf64_Sxword)(a)) /* "ll" */ +#define EC_LWORD(a) ((Elf64_Lword)(a)) /* "ull" */ + +/* + * A native pointer is special. Although it can be convenient to display + * these from a common format (ull), compilers may flag the cast of a pointer + * to an integer as illegal. Casting these pointers to the native pointer + * size, suppresses any compiler errors. + */ +#define EC_NATPTR(a) ((Elf64_Xword)(uintptr_t)(a)) /* "ull" */ #else -#define EC_ADDR(a) ((unsigned long long)(a)) -#define EC_OFF(a) ((unsigned long long)(a)) -#define EC_HALF(a) ((Elf64_Half)(a)) -#define EC_WORD(a) ((Elf64_Word)(a)) -#define EC_SWORD(a) ((Elf64_Sword)(a)) -#define EC_XWORD(a) ((unsigned long long)(a)) -#define EC_SXWORD(a) ((long long)(a)) -#define EC_LWORD(a) ((unsigned long long)(a)) +#define EC_ADDR(a) ((u_longlong_t)(a)) +#define EC_OFF(a) ((u_longlong_t)(a)) +#define EC_HALF(a) ((ushort_t)(a)) +#define EC_WORD(a) ((uint_t)(a)) +#define EC_SWORD(a) ((int)(a)) +#define EC_XWORD(a) ((u_longlong_t)(a)) +#define EC_SXWORD(a) ((longlong_t)(a)) +#define EC_LWORD(a) ((u_longlong_t)(a)) + +#define EC_NATPTR(a) ((u_longlong_t)(a)) #endif - #ifndef _ASM /* * Structure used to build the reloc_table[] @@ -169,12 +176,12 @@ typedef Elf32_Cap Cap; typedef struct { Xword re_mask; /* mask to apply to reloc */ Word re_flags; /* relocation attributes */ - unsigned char re_fsize; /* field size (in # bytes) */ - unsigned char re_bshift; /* # of bits to shift */ - unsigned char re_sigbits; /* # of significant bits */ + uchar_t re_fsize; /* field size (in bytes) */ + uchar_t re_bshift; /* number of bits to shift */ + uchar_t re_sigbits; /* number of significant bits */ } Rel_entry; -#endif +#endif /* _ASM */ #ifdef __cplusplus } |