How to find out if a system call is run-time linking or static?

How to find out if a system call is run-time linking or static?

Post by Aaruz » Sun, 12 Jan 2003 08:30:16



Hi,

I am new to AIX programming. Could anyone tell me if there is a way to
find out in an object file if a system call is run-time linking or
static? I tried to analyze the .map file, but got no hint. I used "ld"
and "rtl" option to link the object files.

Thank you

 
 
 

How to find out if a system call is run-time linking or static?

Post by Martin Behren » Tue, 14 Jan 2003 21:37:57


try the ldd(1) command



Quote:> Hi,

> I am new to AIX programming. Could anyone tell me if there is a way to
> find out in an object file if a system call is run-time linking or
> static? I tried to analyze the .map file, but got no hint. I used "ld"
> and "rtl" option to link the object files.

> Thank you


 
 
 

How to find out if a system call is run-time linking or static?

Post by ddunba » Sat, 08 Feb 2003 10:01:58


Originally posted by Gary R. Hook


> >  find out in an object file if a system call is run-time linking
>     or static?

> Huh?  What, exactly, do you mean?

I think I understand what you mean, and the way you find out if a symbol
is linked to a library is to use the "dump" command.   I find this
command useful:

   dump -Hov  executable_name

The output will show you the built-in libpath for the executable, the
libraries referenced, and each externally defined symbol will show you
the library linked to.

If a symbol you discover in the "nm" output is missing from the dump
command output, it means the library containing the symbol was
statically linked.

Some terminology adjustment is necessary for AIX:

- Most system libraries (libc.a) are shared libraries; one copy of the
  programs exist in memory;  the data segment used by shared libraries
  is unique to the process.

- "run time linking" is a separate beast, and is activated by the
  compiler/linker flag:  -brtl
Hint: If you don't know why you need runtime linking, you do not need
it!  It has very specialized use, in my experience.

- Dynamic Link Libraries  (foo.so)
  The suffix ".so" is just a convention;  you could name it anything,
  and pass the name to dlopen() call to get the library loaded.

  ".so" libraries are also shared libraries in the same sense that the
  ".a" libraries described above are.

  Code in ".so" libraries can be dynamically loaded ... it can also be
  "bound" to the executable in exactly the same way that ".a" shared
  libraries are.

But ... there is a trick, and it took me a long time to find it.

The compiler/loader will not look for ".so" libraries to resolve
symbols, UNLESS you say the magic combination of linker flags, which is:

   xlc_r  -qbrtl -bnortllib -lfoo -o mymod xxx.c

With that combination, you are telling the loader:
a) That you want to find either "libfoo.a" or "libfoo.so"
b) That you do NOT want run-time linking
  (You still don't know why you need it, right?  Ask Gary.)

--
* Dunbar

Posted via http://www.veryComputer.com/

 
 
 

How to find out if a system call is run-time linking or static?

Post by ddunba » Sun, 09 Feb 2003 03:46:28


You forgot the -T option.  That shows the loader symbol table.

---- Ooops, Typo ----

The way I remember the dump combinations is this order:

   dump -HoTv ...

--
* Dunbar / Siebel Systems

Posted via http://www.veryComputer.com/

 
 
 

1. time launching aspect : static link vs dynamic link

I am trying to refine some topics about dynamic link at runtime for a
system definition over Solaris.

Could someone answer to the following question ?

Does someone know the time ratio between a process launching with a
binary gotten from  static link and the same process launching with
runtime link on  SS4 workstation for example ?

I think the ratio should be the same regardless to the  kind of CPU. Am
I right ?

Thanks in advanced.

2. X86 2.4 patch distribution3 (NOV 94)

3. RPC time outs at boot time

4. Networking DSL?

5. Removing indirect run-time link dependencies.

6. RedHat 6.1 - in setup I get "boot partition too big"

7. run-time link order affects Applications?

8. Popular SunFlash and FlashBack Articles by Month

9. Linking and run-time libraries in Unix

10. are any particular filesets needed for run-time linking?

11. Run-time linking

12. Couldn't find run-time library.

13. Strange system time values through *getrusage* system call.