ld_ia.1 (2010 09)
l
ld_ia(1) Integrity Systems Only
ld_ia(1)
Create a shared library:
ld -b -o libfunc.so func1.o func2.o func3.o
Create a shared library with an internal name, and this shared library allows dynamic library searching:
ld -b -o libfoo1.so.1 foo1.o foo2.o +h libfoo1.so.1
ln -s libfoo1.so.1 libfoo1.so
cc -g mytest.c -L . -lfoo1
chatr a.out
...
shared library list:
libfoo1.so.1
If you do not use +h, the shared library does not have an internal name. The linker does not check
whether .so is a symbolic link. It records the library name that it looks at, if it does not have the inter-
nal name.
chatr a.out
...
shared library list:
libfoo1.so
Add $ORIGIN before the shared library name in the shared library list.
ld -dynamic main.o -L /usr/lib/hpux32/ +origin -lc
ld -dynamic main.o +origin /usr/lib/hpux32/libc.so
chatr a.out
...
shared library list:
$ORIGIN/libc.so
WARNINGS
ld recognizes several names as having special meanings. The symbol _end is reserved by the linker to
refer to the first address beyond the end of the program’s address space. Similarly, the symbol
_edata
refers to the first address beyond the initialized data, and the symbol _etext refers to the first address
beyond the program text. The symbols end, edata, and etext are also defined by the linker, but only
if the program contains a reference to these symbols and does not define them (see end(3C) for details).
The linker treats a user definition of any of the symbols listed here as an error.
Through its options, the linker gives users great flexibility. However, those who invoke the linker
directly must assume some added responsibilities.
There is no guarantee that the linker will pick up files from archive libraries and include them in the
final program in the same relative order that they occur within the library.
The linker emits warnings wherever it detects any compatibility issues. Among other things, these issues
include architectural ones, as well as functionality that may change over time. Some of these include:
• Checking of unsatisfied symbols by the linker, which sometimes skips certain object files from an
archived library. This warning is only given if the
-v option is also provided.
As noted in the Options section, this release of the linker no longer supports certain options.
The linker accepts the following options and issues a warning message.
•
-A name
• -C n
• -Fw
• -S
• +cg pathname
• +Oreusedir=dir
• +OselectiveO3
• +Oselectivesize size
The following options are supported for compatibility. They are accepted and ignored:
•
-n
• -q
• -Fz
HP-UX 11i Version 3: September 2010 − 19 − Hewlett-Packard Company 19