specify load address for shared objects on solaris

Posted on 1998-11-09
Last Modified: 2013-12-27
Hi all
On NT you can use the Rebase tool for specifiying a default loading address for dlls. This can speedup startup time because the dlls don't have to be rebased.
Is there anything similar on solaris.
Question by:gadii
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 4
  • 3

Expert Comment

ID: 2007704
In older unix version the sticky bit could be used for keeping programs/libraries in memory, but since swapping and paging has been improved i'm not aware of any systems (unix) that still uses this kind of stuff.
LVL 51

Expert Comment

ID: 2007705

Author Comment

ID: 2007706
There are two stages two this problem.
1. How do I create the shared object so all the funtion calls
and variable refrences will be relative to an address I want
2. After the shared object is created how do I load it and execute the code at that specific area.

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

LVL 51

Expert Comment

ID: 2007707
1. if there are variable references, you have to adjust them yourself
2. mmap()

How it works please refer to  man mmap.
As far as I understand, what you want to do is simply using static libraries.
Dynamic libs only make sense if you use PIC, but that's what you not want, so
fall back to static libs, which won't have the performance penalty at startup.

Expert Comment

ID: 2007708
If on Unix you are using libraries, the usage is transparent.

If you use static libraries, the code is put inside your program, and the  place where variables are put depends on where your program is loaded. If you're using shared libraries, it depends on how your 'dynamic linking' mechanism works.
I know on HP they are working with a TLB (Transition Lookaside Buffer) that assign to each object running/loaded object a logical address that will be translated in the TLB into real memory addresses. So here program can 'see' the same logocal address, but still can have different physical addresses.

Can explain why you want to know the addresses?
If you want to store addresses of functions, or pass them between processes, DON'T. If you still want to do it, you must be very well aware that each os system (and every release) uses his own method. If you just want to creat shared object, compile with the option PIC (check your compiler for Position Independent Code), and then build your library with the ld command, using the correct options (-b on HP i believe)
LVL 51

Expert Comment

ID: 2007709
would be nice to see a comment when rejecting

Author Comment

ID: 2007710
yes I am sorry, for not adding a comment.
I was just hopping there was some automated way to this
which woldn't require lots of code chages. Some linker option
or some post link utility that exists on NT.

LVL 51

Expert Comment

ID: 2007711
some of us is missunderstanding something: you don't need to change code if you use static libs (static and dynamic shared objects are compiled from the same code on UNIX).

Author Comment

ID: 2007712
The problem is we can't easly switch to static libraries,
we need a solution which reduces the startup time for shared

If some one knows for a fact that this is a dead end route or knows about any other ways to shorten startup time please speak up.

Regards Gadi

Accepted Solution

elfie earned 270 total points
ID: 2007713
What do mean by shorter startup time?

There are at least two things to consider

First: What it the time it takes to execute the very first statement in your source? If this takes to long time to execute, may be you must think about splitting up your code into different programs, or -just remembered it while writing this.

vvv solution in next lines ??? vvv

When you use shared libraries, make ABSOLUTELY SURE that the file permissions for all users are set the same. The best possible setting is r-xr-xr-x. If the setting are different eg. rwxr-xr-x, then when the owner is executing the code, and another user wants to execute the same code a whole lot of checkings must be done to see if the page has not been changed, and a lot of other stuff. If you set all to r-xr-xr-x, just some simple tests are performed. If set to something like r-xr-x---, even then a lot test are (were?) done to verify that the pages, when in memory, are still valid.

So first try setting all used shared libraries to file permission  555 (r-xr-xr-x).

Second: it's also possible that the program starts fast enough, but that the first part of the user code, before seeing some user screen takes too long. In this case check the used algorithms.

LVL 51

Expert Comment

ID: 2007714
If you just care about startup time of your program *and* you're shure that it is
because of the shared libs, then check fiollowing (elfie's answer still in mind):

  1) check your LD_LIBRARY_PATH; reduce to necessary dirs only or unset
  2) make shure your shared libs are on a local filesystem
  3) read man-page of ld, especially following options:
       -b -i -B symbolic -R path -Y P,dirlist

Author Comment

ID: 2007715
Ok thanks alot guys I will try this out.
and let you know how it worked out


Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Ubuntu install gnome-session-fallback is failing 4 125
Linux: disable vim auto-comment 7 170
check the file dates in unix 14 76
Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. Please see for the updated article. It is avail…
FreeBSD on EC2 FreeBSD ( is a robust Unix-like operating system that has been around for many years. FreeBSD is available on Amazon EC2 through Amazon Machine Images (AMIs) provided by FreeBSD developer and security office…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question