From a56a073ea90f7226b5ce036d4f0d1df342a5a4c1 Mon Sep 17 00:00:00 2001 From: "Wu, Yingcong" Date: Sun, 28 Sep 2025 19:00:34 -0700 Subject: [PATCH 1/5] add tool check and feature --- libunwind/test/configs/cmake-bridge.cfg.in | 11 +++++++++++ libunwind/test/eh_frame_fde_pc_range.pass.cpp | 8 +++----- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/libunwind/test/configs/cmake-bridge.cfg.in b/libunwind/test/configs/cmake-bridge.cfg.in index b804c210f0bbc..186118da92597 100644 --- a/libunwind/test/configs/cmake-bridge.cfg.in +++ b/libunwind/test/configs/cmake-bridge.cfg.in @@ -14,6 +14,7 @@ import os, site site.addsitedir(os.path.join('@LIBUNWIND_LIBCXX_PATH@', 'utils')) import libcxx.test.format +from lit.util import which # Basic configuration of the test suite config.name = os.path.basename('@LIBUNWIND_TEST_CONFIG@') @@ -33,3 +34,13 @@ config.substitutions.append(('%{install-prefix}', '@LIBUNWIND_TESTING_INSTALL_PR config.substitutions.append(('%{include}', '@LIBUNWIND_TESTING_INSTALL_PREFIX@/include')) config.substitutions.append(('%{lib}', '@LIBUNWIND_TESTING_INSTALL_PREFIX@/@LIBUNWIND_INSTALL_LIBRARY_DIR@')) config.substitutions.append(('%{benchmark_flags}', '')) + +# Check for objcopy tools +objcopy_path = which('objcopy') +if not objcopy_path: + objcopy_path = which('llvm-objcopy') +if not objcopy_path: + objcopy_path = which('llvm-objcopy', '@LLVM_BUILD_BINARY_DIR@/bin') +if objcopy_path: + config.substitutions.append(('%{objcopy}', objcopy_path)) + config.available_features.add('objcopy-available') diff --git a/libunwind/test/eh_frame_fde_pc_range.pass.cpp b/libunwind/test/eh_frame_fde_pc_range.pass.cpp index 39c8e8066264d..d11fedd45b5c7 100644 --- a/libunwind/test/eh_frame_fde_pc_range.pass.cpp +++ b/libunwind/test/eh_frame_fde_pc_range.pass.cpp @@ -13,17 +13,15 @@ // clang-format off -// REQUIRES: target={{x86_64-.+-linux-gnu}} -// aarch64,arm have a cross toolchain build(llvm-clang-win-x-aarch64, etc) -// where objdump is not available. +// REQUIRES: linux, objcopy-available // TODO: Figure out why this fails with Memory Sanitizer. // XFAIL: msan // RUN: %{build} -// RUN: objcopy --dump-section .eh_frame_hdr=%t_ehf_hdr.bin %t.exe +// RUN: %{objcopy} --dump-section .eh_frame_hdr=%t_ehf_hdr.bin %t.exe // RUN: echo -ne '\xFF' | dd of=%t_ehf_hdr.bin bs=1 seek=2 count=2 conv=notrunc status=none -// RUN: objcopy --update-section .eh_frame_hdr=%t_ehf_hdr.bin %t.exe +// RUN: %{objcopy} --update-section .eh_frame_hdr=%t_ehf_hdr.bin %t.exe // RUN: %{exec} %t.exe // clang-format on From fb351baf3d4a67c7cdfbf19b7bcdd6a7ddcb1aaa Mon Sep 17 00:00:00 2001 From: "Wu, Yingcong" Date: Mon, 29 Sep 2025 01:48:35 -0700 Subject: [PATCH 2/5] unsupported eabi --- libunwind/test/eh_frame_fde_pc_range.pass.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libunwind/test/eh_frame_fde_pc_range.pass.cpp b/libunwind/test/eh_frame_fde_pc_range.pass.cpp index d11fedd45b5c7..fa2f913b8921d 100644 --- a/libunwind/test/eh_frame_fde_pc_range.pass.cpp +++ b/libunwind/test/eh_frame_fde_pc_range.pass.cpp @@ -14,6 +14,7 @@ // clang-format off // REQUIRES: linux, objcopy-available +// UNSUPPORTED: target={{.+-gnueabihf}} // TODO: Figure out why this fails with Memory Sanitizer. // XFAIL: msan From 5200fd9cadcd6068a85484cbf42127ed21ca69f7 Mon Sep 17 00:00:00 2001 From: "Wu, Yingcong" Date: Mon, 29 Sep 2025 01:53:11 -0700 Subject: [PATCH 3/5] unsupported eabi --- libunwind/test/eh_frame_fde_pc_range.pass.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libunwind/test/eh_frame_fde_pc_range.pass.cpp b/libunwind/test/eh_frame_fde_pc_range.pass.cpp index fa2f913b8921d..0787886900155 100644 --- a/libunwind/test/eh_frame_fde_pc_range.pass.cpp +++ b/libunwind/test/eh_frame_fde_pc_range.pass.cpp @@ -14,7 +14,7 @@ // clang-format off // REQUIRES: linux, objcopy-available -// UNSUPPORTED: target={{.+-gnueabihf}} +// UNSUPPORTED: target={{.+-gnueabi.*}} // TODO: Figure out why this fails with Memory Sanitizer. // XFAIL: msan From b9516d64a1eaa403c930069418a2a3f7296280cb Mon Sep 17 00:00:00 2001 From: "Wu, Yingcong" Date: Mon, 29 Sep 2025 16:53:36 -0700 Subject: [PATCH 4/5] change objcopy select order --- libunwind/test/configs/cmake-bridge.cfg.in | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libunwind/test/configs/cmake-bridge.cfg.in b/libunwind/test/configs/cmake-bridge.cfg.in index 186118da92597..e40497bfa9976 100644 --- a/libunwind/test/configs/cmake-bridge.cfg.in +++ b/libunwind/test/configs/cmake-bridge.cfg.in @@ -36,11 +36,11 @@ config.substitutions.append(('%{lib}', '@LIBUNWIND_TESTING_INSTALL_PREFIX@/@LIBU config.substitutions.append(('%{benchmark_flags}', '')) # Check for objcopy tools -objcopy_path = which('objcopy') +objcopy_path = which('llvm-objcopy', '@LLVM_BUILD_BINARY_DIR@/bin') if not objcopy_path: objcopy_path = which('llvm-objcopy') if not objcopy_path: - objcopy_path = which('llvm-objcopy', '@LLVM_BUILD_BINARY_DIR@/bin') + objcopy_path = which('objcopy') if objcopy_path: config.substitutions.append(('%{objcopy}', objcopy_path)) config.available_features.add('objcopy-available') From 73b2a562e3ddb2f52412ba976281af3bc8548ceb Mon Sep 17 00:00:00 2001 From: "Wu, Yingcong" Date: Tue, 30 Sep 2025 05:10:14 -0700 Subject: [PATCH 5/5] address comment --- libunwind/test/eh_frame_fde_pc_range.pass.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libunwind/test/eh_frame_fde_pc_range.pass.cpp b/libunwind/test/eh_frame_fde_pc_range.pass.cpp index 0787886900155..852612bd9a6e4 100644 --- a/libunwind/test/eh_frame_fde_pc_range.pass.cpp +++ b/libunwind/test/eh_frame_fde_pc_range.pass.cpp @@ -13,8 +13,8 @@ // clang-format off -// REQUIRES: linux, objcopy-available -// UNSUPPORTED: target={{.+-gnueabi.*}} +// REQUIRES: target={{x86_64-.+-linux-gnu}} +// REQUIRES: objcopy-available // TODO: Figure out why this fails with Memory Sanitizer. // XFAIL: msan