is_static_lib, is_elf, ldconfig 필요유무

markyang92·2022년 12월 2일
0

python

목록 보기
40/42
post-thumbnail

ldconfig 필요유무

  1. 생성된 파일 이름이 .so로 끝나고, install되는 경로 디렉토리가 lib로 끝난다면, ldconfig 명령이 설치 후 필요한 파일이다.

  • $ objdump -p〈file〉2>/dev/null로 정보를 얻는다.
    • GNU/hello 바이너리 대상으로 실험해본다.
$ objdump -p ./hello 2>/dev/null

./hello:     file format elf64-littleaarch64

Program Header:
    PHDR off    0x0000000000000040 vaddr 0x0000000000000040 paddr 0x0000000000000040 align 2**3
         filesz 0x00000000000001f8 memsz 0x00000000000001f8 flags r--
  INTERP off    0x0000000000000238 vaddr 0x0000000000000238 paddr 0x0000000000000238 align 2**0
         filesz 0x000000000000001b memsz 0x000000000000001b flags r--
    LOAD off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**16
         filesz 0x000000000000ab08 memsz 0x000000000000ab08 flags r-x
    LOAD off    0x000000000000fa78 vaddr 0x000000000001fa78 paddr 0x000000000001fa78 align 2**16
         filesz 0x0000000000000608 memsz 0x00000000000007a0 flags rw-
 DYNAMIC off    0x000000000000fb80 vaddr 0x000000000001fb80 paddr 0x000000000001fb80 align 2**3
         filesz 0x0000000000000210 memsz 0x0000000000000210 flags rw-
    NOTE off    0x0000000000000254 vaddr 0x0000000000000254 paddr 0x0000000000000254 align 2**2
         filesz 0x0000000000000044 memsz 0x0000000000000044 flags r--
EH_FRAME off    0x000000000000a7c4 vaddr 0x000000000000a7c4 paddr 0x000000000000a7c4 align 2**2
         filesz 0x0000000000000344 memsz 0x0000000000000344 flags r--
   STACK off    0x0000000000000000 vaddr 0x0000000000000000 paddr 0x0000000000000000 align 2**4
         filesz 0x0000000000000000 memsz 0x0000000000000000 flags rw-
   RELRO off    0x000000000000fa78 vaddr 0x000000000001fa78 paddr 0x000000000001fa78 align 2**3
         filesz 0x0000000000000588 memsz 0x0000000000000588 flags rw-

Dynamic Section:
  PLTGOT               0x000000000001fe20
  PLTRELSZ             0x0000000000000558
  JMPREL               0x0000000000000ff8
  PLTREL               0x0000000000000007
  RELA                 0x0000000000000c98
  RELASZ               0x0000000000000360
  RELAENT              0x0000000000000018
  RELACOUNT            0x000000000000001b
  DEBUG                0x0000000000000000
  SYMTAB               0x0000000000000298
  SYMENT               0x0000000000000018
  STRTAB               0x00000000000008b0
  STRSZ                0x00000000000002f5
  GNU_HASH             0x0000000000000ba8
  NEEDED               libc.so.6				# Rdepends 하는 라이브러리
  NEEDED               ld-linux-aarch64.so.1	# Rdepends 하는 라이브러리
  INIT                 0x0000000000001550
  FINI                 0x0000000000008774
  FINI_ARRAY           0x000000000001fb70
  FINI_ARRAYSZ         0x0000000000000008
  INIT_ARRAY           0x000000000001fb78
  INIT_ARRAYSZ         0x0000000000000008
  FLAGS                0x0000000000000008
  FLAGS_1              0x0000000008000001
  VERSYM               0x0000000000000bc4
  VERNEED              0x0000000000000c48
  VERNEEDNUM           0x0000000000000002

Version References:
  required from libc.so.6:
    0x06969197 0x00 02 GLIBC_2.17
    0x069691b4 0x00 03 GLIBC_2.34
  required from ld-linux-aarch64.so.1:
    0x06969197 0x00 04 GLIBC_2.17
private flags = 0x0:
  • 여기서 보통 RPATH (있는 경우), NEEDED (Rdepends), SONAME (있는 경우) 를 사용한다.
  • postinst ldconfig
profile
pllpokko@alumni.kaist.ac.kr

0개의 댓글