Skip to content

Conversation

Ansuel
Copy link
Contributor

@Ansuel Ansuel commented Oct 10, 2025

While investigating a reproducible problem with a binary compiled with
Meson, it was notice that the RPATH entry was never removed.

By comparing the binary from 2 different build system it was observed
that altough the RPATH entry was removed (verified by the readelf -d
command) the actual path was still present causing 2 different binary.

Going deeper in the Meson build process, it was discovered that
remove_rpath_entry only deletes the entry in the '.dynamic' section but
never actually 'clean' (or better say zero-out) the path from the
.dynstr section producing binary dependendt of the build system.

To address this, introduce a new helper to to zero-out the entry from
the .dynstr section permitting to produce REAL reproducible binary.

Additional logic was needed to handle GCC linker optimization for dynstr
table where the rpath string might be reused for other dym function
string. The setion that is actually removed is filled with 'X' following
patchelf behaviour.

@Ansuel Ansuel requested a review from jpakkane as a code owner October 10, 2025 23:58
@Ansuel Ansuel force-pushed the fix-depfixer branch 2 times, most recently from 981e6f2 to 2c5c23e Compare October 11, 2025 00:03
@Ansuel Ansuel marked this pull request as draft October 11, 2025 02:37
While investigating a reproducible problem with a binary compiled with
Meson, it was notice that the RPATH entry was never removed.

By comparing the binary from 2 different build system it was observed
that altough the RPATH entry was removed (verified by the readelf -d
command) the actual path was still present causing 2 different binary.

Going deeper in the Meson build process, it was discovered that
remove_rpath_entry only deletes the entry in the '.dynamic' section but
never actually 'clean' (or better say zero-out) the path from the
.dynstr section producing binary dependendt of the build system.

To address this, introduce a new helper to to zero-out the entry from
the .dynstr section permitting to produce REAL reproducible binary.

Additional logic was needed to handle GCC linker optimization for dynstr
table where the rpath string might be reused for other dym function
string. The setion that is actually removed is filled with 'X' following
patchelf behaviour.

Signed-off-by: Christian Marangi <[email protected]>
@Ansuel Ansuel marked this pull request as ready for review October 11, 2025 21:37
@thesamesam thesamesam self-requested a review October 15, 2025 16:19
@jpakkane
Copy link
Member

Test failure is unrelated.

@jpakkane jpakkane merged commit 78ffa53 into mesonbuild:master Oct 17, 2025
30 of 32 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants