#THIS DOC IS EARLY DRAFT STATE AND MIGHT CONTAIN TYPOS, ERRORS, EAT YOUR CAT, ...#

##TODO## read below, is /usr/ucblib on Solaris 10 (all versions) in use or not?

This patch is needed to enable a multi-architecture directory
layout. Therefore you can read instead /64/ then /amd64/ or
/sparcv9/ which is needed if the share the same filesystem tree.

If a binary or library is stored in the same filesystemtree,
then you can use isaexec to decide which binary to use.

 isaexec looks up the architecture (i86, amd64, sparcv9, sparc....)
 and continues loading the right binary matching the archiecture.
 The linker code then would as well use libraries matching the 
 chosen architecture (e.g. amd64) and search for libaries in those
 subdirectories.

 example:
 call /sharednfspath/tools/bin/mybinary 
      which is (hard)linked to /usr/lib/isaexec

 the architecture is looked up, in this example amd64
 then isaexec loads this binary:
      /sharednfspath/tools/bin/amd64/mybinary 


*hardcoded -R runpath removed now* START
An older release of this patch contained code that *hardcoded* the runpath
as -R %R/usr/ucblib:%R/usr/ccs/lib:%R/lib:%R/usr/lib:%R/usr/gnu/lib
The template for this patch is partly a historic patch from the Sun
gcc-3 compiler adapted for at that time for the gcc-4 and as well 
including /usr/gnu/lib to find gcc's runtime libary which has
symlinks there which point to the compiler runtime libs in 
/usr/gcc/<major.minor>/lib directory. The idea was to *find* the 
runtime in any case and another different reason was to *find* all
sorts of libs stored e.g. in the directory /usr/gnu/lib which is 
*not* searched by the "ld" linker by default.
But this hardcoding of those directories has a big downside, the 
user looses the ability to build a binary or a library with the
search order for libraries via runpath in an order the *user* needs.
Example: /usr/q++/lib:/usr/lib  to find a lib of the *same* filename
first in the q++ path and not hitting an incompatible file somewhere
else.

Therefore, the "-R" was removed almost entirely (/usr/ucblib is left,
might go away some day if we don't need it any more on Oracle 
Solaris 10 or later releases).
*hardcoded -R runpath removed now* END


*only for reference* START
****another patch, gcc-07-LINK_SPEC.diff **** START
Another patch takes care that the binaries and libraries compiled
with *this* gcc version are found in a predefined directory, totally
free of other libaries.
Currently this is e.g. /usr/gcc/4.6/lib/libgcc_s.so.1 and with 
multilib enabled this might be 
/usr/gcc/4.6/lib/gcc/i386-pc-solaris2.11/4.6.1/amd64/libgcc_s.so.1
(could become default in the future)

Another directory is now predefined where runtime libs are searched.
A set of symbolic links to the runtime libs in /usr/gcc/lib/ is to 
be placed there. Symlinks to the compiler binaries like gcc and g++
go into /usr/gcc/bin/<gcc|g++> . This was the System can be upgraded
to a much more fresh gcc version and use updated runtime libs but
still use old programs linked to the older version of the libs.
The need the interface of a more fresh runtime lib being compatile
to older binaries.
****another patch, gcc-07-LINK_SPEC.diff **** END
*only for reference* END

 



--- gcc-4.5.2/gcc/config/sol2.h	2010-04-16 15:33:58.000000000 +0200
+++ gcc-4.5.2/gcc/config/sol2.h	2011-03-04 20:41:27.986156059 +0100
@@ -156,12 +156,12 @@
    %{YP,*} \
    %{R*} \
    %{compat-bsd: \
-     %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib} \
-             %{!p:%{!pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib:%R/usr/lib}}} \
-             -R %R/usr/ucblib} \
+     %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/lib:%R/usr/lib:%R/usr/gnu/lib} \
+             %{!p:%{!pg:-Y P,%R/usr/ucblib:%R/usr/ccs/lib:%R/lib:%R/usr/lib:%R/usr/gnu/lib}}} \
+             -R %R/usr/ucblib} \
    %{!compat-bsd: \
-     %{!YP,*:%{p|pg:-Y P,%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/usr/lib} \
-             %{!p:%{!pg:-Y P,%R/usr/ccs/lib:%R/usr/lib}}}}"
+     %{!YP,*:%{p|pg:-Y P,%R/usr/ccs/lib/libp:%R/usr/lib/libp:%R/usr/ccs/lib:%R/lib:%R/usr/lib:%R/usr/gnu/lib} \
+             %{!p:%{!pg:-Y P,%R/usr/ccs/lib:%R/lib:%R/usr/lib:%R/usr/gnu/lib}}}}"
 
 #undef LINK_ARCH32_SPEC
 #define LINK_ARCH32_SPEC LINK_ARCH32_SPEC_BASE
--- gcc-4.5.2/gcc/config/i386/sol2-10.h	2010-07-14 10:47:54.000000000 +0200
+++ gcc-4.5.2/gcc/config/i386/sol2-10.h	2011-03-04 20:49:56.627091764 +0100
@@ -109,12 +109,12 @@
    %{YP,*} \
    %{R*} \
    %{compat-bsd: \
-     %{!YP,*:%{p|pg:-Y P,/usr/ucblib/64:/usr/lib/libp/64:/lib/64:/usr/lib/64} \
-             %{!p:%{!pg:-Y P,/usr/ucblib/64:/lib:/usr/lib/64}}} \
-             -R /usr/ucblib/64} \
+     %{!YP,*:%{p|pg:-Y P,/usr/ucblib/amd64:/usr/lib/libp/amd64:/lib/amd64:/usr/lib/amd64:/usr/gnu/lib/amd64} \
+             %{!p:%{!pg:-Y P,/usr/ucblib/amd64:/lib/amd64:/usr/lib/amd64:/usr/gnu/lib/amd64 -R /usr/ucblib/amd64}}} \
+             } \
    %{!compat-bsd: \
-     %{!YP,*:%{p|pg:-Y P,/usr/lib/libp/64:/lib/64:/usr/lib/64} \
-             %{!p:%{!pg:-Y P,/lib/64:/usr/lib/64}}}}"
+     %{!YP,*:%{p|pg:-Y P,/usr/lib/libp/amd64:/lib/amd64:/usr/lib/amd64:/usr/gnu/lib/amd64} \
+             %{!p:%{!pg:-Y P,/lib/amd64:/usr/lib/amd64:/usr/gnu/lib/amd64}}}}"
 
 #undef LINK_ARCH64_SPEC
 #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE
--- gcc-4.5.2/gcc/config/sparc/sol2-bi.h	2010-04-02 21:54:46.000000000 +0200
+++ gcc-4.5.2/gcc/config/sparc/sol2-bi.h	2011-03-04 20:47:36.202790986 +0100
@@ -195,12 +195,12 @@
    %{YP,*} \
    %{R*} \
    %{compat-bsd: \
-     %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/libp/sparcv9:%R/usr/lib/sparcv9} \
-       %{!p:%{!pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/sparcv9}}} \
-     -R %R/usr/ucblib/sparcv9} \
+     %{!YP,*:%{p|pg:-Y P,%R/usr/ucblib/sparcv9:%R/usr/lib/libp/sparcv9:%R/lib/sparcv9:%R/usr/lib/sparcv9:%R/usr/gnu/lib/sparcv9} \
+       %{!p:%{!pg:-Y P,%R/usr/ucblib/sparcv9:%R/lib/sparcv9:%R/usr/lib/sparcv9:%R/usr/gnu/lib/sparcv9 -R %R/usr/ucblib/sparcv9}}} \
+     } \
    %{!compat-bsd: \
-     %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/sparcv9:%R/usr/lib/sparcv9} \
-       %{!p:%{!pg:-Y P,%R/usr/lib/sparcv9}}}}"
+     %{!YP,*:%{p|pg:-Y P,%R/usr/lib/libp/sparcv9:%R/lib/sparcv9:%R/usr/lib/sparcv9:%R/usr/gnu/lib/sparcv9} \
+       %{!p:%{!pg:-Y P,%R/lib/sparcv9:%R/usr/lib/sparcv9:%R/usr/gnu/lib/sparcv9}}}}"
 
 #define LINK_ARCH64_SPEC LINK_ARCH64_SPEC_BASE
 
