From fdcefcc3367157525185f39495c6cf420a2be323 Mon Sep 17 00:00:00 2001 From: Gleb Popov <6yearold@gmail.com> Date: Fri, 1 May 2026 18:18:08 +0300 Subject: [PATCH] Skip the shared-rpath.sh test if the linker does not dedup strings For example, lld decided to not perform this optimization on purpose, see https://github.com/llvm/llvm-project/issues/193556 Without this optimization the test fails, because patchelf taints the rpath string with XXXXXs. --- tests/shared-rpath.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/tests/shared-rpath.sh b/tests/shared-rpath.sh index 1fa46b9d..e5e9ab71 100755 --- a/tests/shared-rpath.sh +++ b/tests/shared-rpath.sh @@ -23,7 +23,12 @@ echo "#### Number of a_symbol_name strings in the library: $previous_cnt" echo "#### Rename the rpath to something larger than the original" # Pathelf should detect that the rpath string is shared with the symbol name string and avoid # tainting the string with Xs -"${PATCHELF}" --set-rpath a_very_big_rpath_that_is_larger_than_original --output liblarge-rpath.so "${LIB_NAME}" +output=$("${PATCHELF}" --set-rpath a_very_big_rpath_that_is_larger_than_original --output liblarge-rpath.so "${LIB_NAME}" 2>&1) + +# The number of rpath references depends on linker's ability to perform +# strings deduplication optimization. Not all linkers do that, so skip the +# test if there is only 1 reference +(echo $output | grep 'Number of rpath references: 1') && exit 77 echo "#### Checking symbol is still there" ${NM} -D liblarge-rpath.so | grep a_symbol_name