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

Florian Weimer fweimer@redhat.com
Sun Nov 28 11:44:59 GMT 2021


* Jacob Kroon via Gcc-help:

> As part of an effort to make binaries reproducible regardless of their
> build path, I need to enforce the same size of the RUNPATH entry in the
> dynamic section during linking, even though I don't fill it completely.
> Is it possible to give some flag to gnu ld that allows me to set it to a
> specific size ? Or is there a way to patch the elf file after linking,
> so that the entry has a specified size ?

Do you want to allocate specific size so that you can patch in a
different value later?

The RUNPATH strings are in the string table, so it's necessary to
allocate space there, and be able to find it during patching.

Solaris offers this mechanism:

| DT_SUNW_STRPAD
| 
|     The total size, in bytes, of the unused reserved space at the end of
|     the dynamic string table. If DT_SUNW_STRPAD is not present in an
|     object, no reserved space is available.

Would that help in your case as well?

Thanks,
Florian



More information about the Gcc-help mailing list