如何查找鏈接庫的位置,編譯和執行時分別?

GCC 動態鏈接庫鏈接查找

https://www.cprogramming.com/tutorial/shared-libraries-linux-gcc.html

  1. It looks in the DT_RPATH section of the executable, unless there is a DT_RUNPATH section.
  2. It looks in LD_LIBRARY_PATH. This is skipped if the executable is setuid/setgid for security reasons.
  3. It looks in the DT_RUNPATH section of the executable unless the setuid/setgid bits are set (for security reasons).
  4. It looks in the cache file /etc/ld/so/cache (disabled with the -z nodeflib linker option).
  5. It looks in the default directories /lib then /usr/lib (disabled with the -z nodeflib linker option).
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章