给你看一个例子
gcc -Wl,-rpath,/home/arc/test,-rpath,/lib/,-rpath,/usr/lib/,-rpath,/usr/local/lib 1.c
readelf -d a.out
Dynamic section at offset 0xf10 contains 23 entries:
  Tag        Type                         Name/Value
 0x00000001 (NEEDED)                     Shared library: [libc.so.6]
 0x0000000f (RPATH)                      Library rpath: [/home/arc/test:/lib/:/usr/lib/:/usr/local/lib]
 0x0000001d (RUNPATH)                    Library runpath: [/home/arc/test:/lib/:/usr/lib/:/usr/local/lib]
 0x0000000c (INIT)                       0x8048320
 0x0000000d (FINI)                       0x804850c
 0x00000004 (HASH)                       0x80481c4
 0x6ffffef5 (GNU_HASH)                   0x80481ec
 0x00000005 (STRTAB)                     0x804825c
 0x00000006 (SYMTAB)                     0x804820c
 0x0000000a (STRSZ)                      120 (bytes)
 0x0000000b (SYMENT)                     16 (bytes)
 0x00000015 (DEBUG)                      0x0
 0x00000003 (PLTGOT)                     0x8049ff4
 0x00000002 (PLTRELSZ)                   24 (bytes)
 0x00000014 (PLTREL)                     REL
 0x00000017 (JMPREL)                     0x8048308
 0x00000011 (REL)                        0x8048300
 0x00000012 (RELSZ)                      8 (bytes)
 0x00000013 (RELENT)                     8 (bytes)
 0x6ffffffe (VERNEED)                    0x80482e0
 0x6fffffff (VERNEEDNUM)                 1
 0x6ffffff0 (VERSYM)                     0x80482d4
 0x00000000 (NULL)                       0x0