On 11/28/21 12:44, Florian Weimer wrote: > * 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? > Yes exactly, but see below. > 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? > The problem is that for two different build I pass two different -Wl,--rpath=<path>, and they are of different length. So I'd like to reserve a maximum size, at link-time, which becomes the same in both builds, so that when I later remove the rpath's, the binaries become identical. Jacob