Sun Java Solaris Communities My SDN Account Join SDN
 
Article

A Look Inside a Solaris C++ Shared Libraries Patch

 
By Misha Bykov, Sun Microsystems, November, 2006  

Sun Studio users often ask about the structure of recommended Solaris patches. In this article we take a look inside a typical Solaris patch for the Sun Studio C++ compiler - SUNWlibC patch that contains Solaris C++ shared libraries.

Download A Patch

As an example, let's download a typical SUNWlibC patch for the SPARC platform.

First log in to sunsolve.sun.com and to download the current version of Sun SUNWlibC patch 119963, at:

http://sunsolve.sun.com/search/document.do?assetkey=119963

Click on the "Download patch" link, to download the patch ZIP file to your local system.

When this article was published, patch version number was 119963-08. Now we'll run the following commands:

# unzip 119963-08.zip
# ls -F 119963-08
legal_license.txt
README.119963-08
SUNWlibC/
patchinfo


Look Inside

The patch can be installed using the Solaris patchadd command on the systems where Sun Studio C++ is installed. Let's take a look inside the patch to get a brief overview of its content.
  • LEGAL_LICENSE.TXT is the user license text
  • README.119963-08 patch documentation file
  • patchinfo is the metadata used to create automation-friendly patch

Let's look inside the patchinfo file:

# cat patchinfo
PATCHINFOVERSION="1.0"
PATCHID=119963-08
PATCH_CORRECTS='BaseOS.BundledLibC-5.10'
PATCH_ARCH='sparc'
PATCH_OS='SunOS'
PATCH_OSRELEASE='5.10'
PATCH_PROPERTIES='clientusr'

Update Manager uses this file to determine that this patch is for SunOS 5.10 Sparc with an ID 119963-08.

PATCH_CORRECTS='BaseOS.BundledLibC-5.10' tells Update Manager determines which package should be updated in Solaris and shows users that SUNWlibC patch is available to download.

PATCH_PROPERTIES='clientusr' indicates that when installing to a diskless or caching client from that client's server, the patch is to be installed into the service area

The rest of the data in the patch is defined by the Application Binary Interface (ABI) for the System V Interface Definition (SVID).

The SUNWlibC Directory


The SUNWlibC directory contains the files to be installed by the patch. Lets take a look inside.

# cd SUNWlibC
# ls -CF
install/  pkginfo   pkgmap    reloc/

The install/ directory contains scripts and a copyright file:
# ls -F install
install:
checkinstall        i.none              patch_postinstall   preinstall
copyright           patch_checkinstall  postinstall


SUNWlibC/pkginfo
is a file describing the package as a whole, including special environment variables and installation directives
# cat pkginfo
ARCH=sparc
BASEDIR=/
CATEGORY=system
CLASSES=none
DESC=Sun Workshop Compilers Bundled libC
EMAIL=
HOTLINE=Please contact your local service provider
MAXINST=1000
NAME=Sun Workshop Compilers Bundled libC
PKG=SUNWlibC
SUNW_PKGTYPE=usr
SUNW_PRODNAME=SunOS
SUNW_PKGVERS=1.0
VENDOR=Sun Microsystems, Inc.
SUNW_PRODVERS=5.10
VERSION=5.10,REV=2004.12.22
PSTAMP=ouioui20041222170548
SUNW_PATCHID=119963-08
SUNW_PATCH_PROPERTIES=

SUNWlibC/pkgmap is a file describing each object (file, directory, etc...) to be installed including the correct size and checksum for all action scripts
# cat pkgmap
: 1 11772
1 i checkinstall 4985 7139 1159561508
1 i copyright 59 5214 1159561509
1 i i.none 5768 46312 1159561508
1 i patch_checkinstall 1555 54237 1159561509
1 i patch_postinstall 824 1074 1159561509
1 i pkginfo 421 33070 1159561509
1 i postinstall 6703 341 1159561509
1 i preinstall 6926 2171 1159561509
1 d none usr 0755 root sys
1 d none usr/include 0755 root bin
1 f none usr/include/demangle.h 0644 root bin 1403 48952 1158782637
1 d none usr/lib 0755 root bin
1 d none usr/lib/cpu 0755 root bin
1 d none usr/lib/cpu/sparcv8plus 0755 root bin
1 f none usr/lib/cpu/sparcv8plus/libCstd_isa.so.1 0755 root bin 167352 53201 1158782637
1 f none usr/lib/libC.so.5 0755 root bin 390808 48866 1158782637
1 f none usr/lib/libCrun.so.1 0755 root bin 63444 54865 1158782637
1 f none usr/lib/libCstd.so.1 0755 root bin 1907612 11581 1158782637
1 f none usr/lib/libExbridge.so.1 0755 root bin 33040 6054 1158782637
1 f none usr/lib/libdemangle.so.1 0755 root bin 161296 38587 1158782637
1 f none usr/lib/libiostream.so.1 0755 root bin 240876 11931 1158782637
1 d none usr/lib/sparcv9 0755 root bin
1 f none usr/lib/sparcv9/libCrun.so.1 0755 root bin 79144 62307 1158782637
1 f none usr/lib/sparcv9/libCstd.so.1 0755 root bin 2352496 24007 1158782638
1 f none usr/lib/sparcv9/libdemangle.so.1 0755 root bin 179984 47207 1158782638
1 f none usr/lib/sparcv9/libiostream.so.1 0755 root bin 312408 28098 1158782638


reloc/ is a directory containing the relocatable object files to be installed by this patch relative to the base directory as determined by the BASEDIR environment variable in the pkginfo file, or by the patchadd command.
# ls -R reloc
reloc:
usr

reloc/usr:
include  lib

reloc/usr/include:
demangle.h

reloc/usr/lib:
cpu               libCrun.so.1      libExbridge.so.1  libiostream.so.1
libC.so.5         libCstd.so.1      libdemangle.so.1  sparcv9

reloc/usr/lib/cpu:
sparcv8plus

reloc/usr/lib/cpu/sparcv8plus:
libCstd_isa.so.1

reloc/usr/lib/sparcv9:
libCrun.so.1      libCstd.so.1      libdemangle.so.1  libiostream.so.1


In our case the base directory is / , but it can be always changed by "patchadd".

The libraries included here are:
  • libCrun  - C++ runtime, mode -compat=5
  • libCstd  - C++ standard library, mode -compat=5
  • libiostream  -  Classic iostreams, mode -compat=5
  • libC  - C++ runtime, classic iostreams, mode -compat=4
  • libdemangle  -  Demangling, C interface
  • libExbridge  allows exception handing to work when mixing compat-mode and standard-mode code in the same program

Summary

  • A SUNWlibC patch usually is provided for each version of the Solaris supported by Sun Studio.
  • The patch should be installed on the systems where the executable programs compiled by Sun Studio are run as well as on the systems where compilation itself occurs.
  • The patch package format is defined by the Application Binary Interface which is a supplement to the System V Interface Definition.

References


Rate and Review
Tell us what you think of the content of this page.
Excellent   Good   Fair   Poor  
Comments:
Your email address (no reply is possible without an address):
Sun Privacy Policy

Note: We are not able to respond to all submitted comments.
 Misha Bykov photo
Misha Bykov is a staff software engineer currently working in the Sun Studio sustaining group. For the last 6 years at Sun he worked on compilers support for Solaris and Linux including C/C++, Fortran compilers, NetBeans IDE and Solaris Components for Sun Studio. Before joining Sun he worked in Unipro, in Novosibirsk, Russia as a software developer for Sun Workshop TeamWare project including the cross-platform Java IDE for developing software products based on source code control system and distributive "make".