Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What LD stand for on LD_LIBRARY_PATH variable on *unix?

Tags:

linux

unix

I know that LD_LIBRARY_PATH is a environment variable where the linker will look for the shared library (which contains shared objects) to link with the executable code.

But what does the LD Stands for, is it for Load? or List Directory?

like image 766
Marcos Roriz Junior Avatar asked Nov 29 '09 02:11

Marcos Roriz Junior


People also ask

What is ld.so in Linux?

ld.so, ld-linux.so - dynamic linker/loader.

What is ld path in Linux?

The LD_LIBRARY_PATH environment variable tells Linux applications, such as the JVM, where to find shared libraries when they are located in a different directory from the directory that is specified in the header section of the program.

What is the value of LD_LIBRARY_PATH?

So there is no default value for LD_LIBRARY_PATH , default library lookup doesn't need it at all. If LD_LIBRARY_PATH is defined, then it is used first, but doesn't disable the other lookups (which also include a few default directories).

What is ld.so preload?

Additionally, the ld. so. preload file causes a system-wide configuration change, resulting in shared objects being preloaded by any binary on the system. Linux Dynamic Linker Hijacking in Action. Dynamic linker hijacking is often utilised by Linux malware to install rootkits on the target system.

What is ld Linux SO 2?

This program is defined as part of the structure of the ELF file, in the INTERP section of the program header. For 32bit linux binaries, this is the typical name of the 32bit interpreter. For 64bit binaries, you'll find it is typically called ld-linux-x86_64. so. 2 (for 64bit x86 platforms).

How does ld.so work?

When a program linked with shared libraries runs, program execution does not immediately start with that program's first statement. Instead, the operating system loads and executes the dynamic linker (usually called ld.so), which then scans the list of library names embedded in the executable.


1 Answers

Linker. The *nix linker is called ld. When a program with dynamic libraries is linked, the linker adds additional code to look for dynamic libraries to resolve symbols not statically linked. Usually this code looks in /lib and /usr/lib. LD_LIBRARY_PATH is a colon separated list of other directories to search.

"ldd" is a handy program to see where the libraries are: try "ldd /bin/ls", for example.

It could also mean "Loader", though. ;-)

Editorial:

As a (semi) interesting side-note: I think dynamic libraries will go away someday. They were needed when disk space and system memory was scarce. There is a performance hit to using them (i.e. the symbols need to be resolved and the object code edited). In these modern days of 3GB memory and 7 second bootup times, it might be appropriate to go back to static linking.

Except for the fact that every C++ program would magically grow to 3MB. ;-)

like image 166
Richard Pennington Avatar answered Nov 14 '22 04:11

Richard Pennington