Operating System - HP-UX
1753879 Members
7481 Online
108809 Solutions
New Discussion

Re: How to change or add the share dynamic library list via chatr ?

 
SOLVED
Go to solution
liuyl_it
Frequent Advisor

How to change or add the share dynamic library list via chatr ?

Here I want to directly use the custom libc.so.1 ....,  but why the following way would be failed?
Notes:  I have no way to recompile to change the share dynamic library without the source code!

#
#
#
# ldd ./sleep_st

./sleep_st:
libc.so.1 => /usr/lib/hpux32/libc.so.1
libdl.so.1 => /usr/lib/hpux32/libdl.so.1
#
#
#
# chatr ./sleep_st
./sleep_st:
32-bit ELF executable
shared library dynamic path search:
LD_LIBRARY_PATH enabled first
SHLIB_PATH enabled second
embedded path enabled third Not Defined
shared library list:
libc.so.1
shared library binding:
deferred
global hash table disabled
global hash table size 1103
shared library mapped private disabled
runtime checks disabled
shared library segment merging disabled
shared library (dlopen) segment merging disabled
shared vtable support disabled
explicit unloading disabled
linkage table protection disabled
segments:
index type address flags size
8 text 04000000 z---c- D (default)
9 data 40010000 ---m-- D (default)
executable from stack: D (default)
kernel assisted branch prediction enabled
lazy swap allocation for dynamic segments disabled
nulptr dereferences trap disabled
address space model: default
caliper dynamic instrumentation disabled
#
#
#
# chatr +s enable -s -l /tmp/libc.so.1 ./sleep_st
chatr(error): invalid -l argument: /tmp/libc.so.1
#
#
#
# chatr +s enable -s +l /tmp/libc.so.1 ./sleep_st
chatr(error): invalid +l argument: /tmp/libc.so.1
#
#
#

 

Reference link:
https://www.unix.com/hp-ux/193579-how-use-chatr-change-static-library-path-binary.html

1 REPLY 1
ranganath ramachandra
Esteemed Contributor
Solution

Re: How to change or add the share dynamic library list via chatr ?

Looks like the "-l" functionality is not really available. Anyway once you have enabled LD_LBRARY_PATH with "+s", you don't need the "-l" anymore.

 

[ hostname ~ ] $ cp /usr/bin/ls /tmp
[ hostname ~ ] $ cp /usr/lib/hpux32/libc.so.1 /tmp
[ hostname ~ ] $ LD_LIBRARY_PATH=/tmp ldd /tmp/ls
/tmp/ls:
        libxcurses.so.1 =>      /usr/lib/hpux32/libxcurses.so.1
        libc.so.1 =>    /usr/lib/hpux32/libc.so.1
        libdl.so.1 =>   /usr/lib/hpux32/libdl.so.1
[ hostname ~ ] $ chmod 755 /tmp/ls
[ hostname ~ ] $ chatr -s +s enable /tmp/ls
[ hostname ~ ] $ LD_LIBRARY_PATH=/tmp ldd /tmp/ls
/tmp/ls:
        libxcurses.so.1 =>      /usr/lib/hpux32/libxcurses.so.1
        libc.so.1 =>    /tmp/libc.so.1
        libdl.so.1 =>   /usr/lib/hpux32/libdl.so.1

 

 
--
ranga
[i work for hpe]

Accept or Kudo