Why is the shared library path hard coded in executable?

I recently got a binary test. When I checked it with objdump, I found that it contains a hard-coded library path. Why do I need to hard-code such a path? Shouldn’t you get the path from the SHELL environment variable or -L parameter?

objdump -p testprog

The output includes the hard-coded path of the shared library:

....
NEEDED /home/test/lib/liba.so
NEEDED /home/test/lib/libb.so
NEEDED /home/ test/lib/libc.so
....

This may be because of this The three .so files do not have SONAME on the host that built the test program. Tell the person who built it to rebuild liba.so with -Wl, soname, liba.so and two other similar methods, and then relink the main program.

Recently I got a binary test. When I checked it with objdump, I found that it contains a hard-coded library path. Why do I need to hard-code such a path? Shouldn’t you get the path from the SHELL environment variable or -L parameter?

objdump -p testprog

The output includes the hard-coded path of the shared library:

....
NEEDED /home/test/lib/liba.so
NEEDED /home/test/lib/libb.so
NEEDED /home/ test/lib/libc.so
....

This may be because these three .so files are on the host where the test program is built There is no SONAME. Tell the person who built it to rebuild liba.so with -Wl, soname, liba.so and two other similar methods, and then relink the main program.

WordPress database error: [Table 'yf99682.wp_s6mz6tyggq_comments' doesn't exist]
SELECT SQL_CALC_FOUND_ROWS wp_s6mz6tyggq_comments.comment_ID FROM wp_s6mz6tyggq_comments WHERE ( comment_approved = '1' ) AND comment_post_ID = 4941 ORDER BY wp_s6mz6tyggq_comments.comment_date_gmt ASC, wp_s6mz6tyggq_comments.comment_ID ASC

Leave a Comment

Your email address will not be published.