Re: Reserving specified size of RUNPATH entry in the dynamic section during linking

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Jacob Kroon:

> I suppose gnu ld doesn't try to optimize for usage of substrings in
> RUNPATH, thus making if fairly easy to change it post linking.

I think it does, it's just that RUNPATH with an overlapping tail is just
rare in practice because of its contents.

Try this:

$ gcc -nostartfiles -shared -Wl,-rpath,one-long-string,-soname,one-long-string  
$ readelf -dW a.out

Dynamic section at offset 0x1f20 contains 9 entries:
  Tag        Type                         Name/Value
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]
 0x000000000000000e (SONAME)             Library soname: [one-long-string]
 0x000000000000001d (RUNPATH)            Library runpath: [one-long-string]
 0x000000006ffffef5 (GNU_HASH)           0x180
 0x0000000000000005 (STRTAB)             0x1b8
 0x0000000000000006 (SYMTAB)             0x1a0
 0x000000000000000a (STRSZ)              27 (bytes)
 0x000000000000000b (SYMENT)             24 (bytes)
 0x0000000000000000 (NULL)               0x0

But if you look at the file with a hex editor, you'll notice that the
string is only there once:

000001b0: 0000 0000 0000 0000 006c 6962 632e 736f  .........libc.so
000001c0: 2e36 006f 6e65 2d6c 6f6e 672d 7374 7269  .6.one-long-stri
000001d0: 6e67 0000 0000 0000 0000 0000 0000 0000  ng..............

> But can I then specify during link time that RUNTIME should go in a
> "reserved" area, whose size I can also control ? I hope I understood you
> correctly.

I think GNU ld doesn't have this feature today.

Thanks,
Florian




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux