From patchwork Tue Jan 14 03:59:58 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 104732 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 88D4F3858C5F for ; Tue, 14 Jan 2025 04:02:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 88D4F3858C5F Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20230601 header.b=NZH4g4BA X-Original-To: binutils@sourceware.org Delivered-To: binutils@sourceware.org Received: from mail-yb1-xb35.google.com (mail-yb1-xb35.google.com [IPv6:2607:f8b0:4864:20::b35]) by sourceware.org (Postfix) with ESMTPS id 81A4E3858432 for ; Tue, 14 Jan 2025 04:00:35 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 81A4E3858432 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 81A4E3858432 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b35 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736827235; cv=none; b=LzX795AOc/CD0k7u6ZUnK+BIhrGsU5jb3extFsymunJs8/qV42JZdbOEljsCgGbgHJK9++6TIG/Z40A1GHmmDuzrkXw79Gwlyp82OnolzsUHG5Izns6w/L5r7Zt1cQdX4ixOAb5j8hoZlyPUkacdQJaB21ZMXBfO5kmz5jJ4NiY= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1736827235; c=relaxed/simple; bh=bdjaaPUkb9KLzlQj3JSYHObUHrVVt/YOtnyvpcgqLMs=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=OPxXILxqfT2iuU3kf3hnzVPSBIXW1EydXxJMovcqlQ72aC8NFUHj1UHilv+ayKkNuidAfJw/MPNBANPFbTolW/hy7mEHGsjy3UmANSOdUBa2LtVwqHEY7kkVn8uZLXumBn5yJEGbAIaGK/fn3OIbWh7fmpFuNsus/ssLY6U5KpE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 81A4E3858432 Received: by mail-yb1-xb35.google.com with SMTP id 3f1490d57ef6-e3a0acba5feso6774540276.2 for ; Mon, 13 Jan 2025 20:00:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1736827235; x=1737432035; darn=sourceware.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=MTMIyhlPIYq1ob65mYqvi7A/va5jRJM18l4c3vRthTg=; b=NZH4g4BAFf/poTHu68OB+bfvGJC3UwZX8T0JT17Ba86xfTy5KthcvNT1BMt9l98bMZ tA6wfJ8lL0SQ9OufmRpFtZUv6JZzs9OBgEwdCSSl11+zEpos/a7QhT30KtOUKyKX1pJN Dgmy+EdB7+8mc+82ovjcN0OYSOKylcW2u4YrIILeklFjZDPHBwl3XB8Gk4ii19juBMg1 ZTip8gNew+tCVYOJaW+6IpqwrtQ2/UeL2PBNsXPft7GE9dCZpjN/SbkxhzYEF4qCeuI3 SPIUG7DthR7Fn6qmt5PDLwpK7m/OuPpWu/qMIgL9CCLfqehfbPESt53fdvVhj6lUA8uT DpZg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736827235; x=1737432035; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=MTMIyhlPIYq1ob65mYqvi7A/va5jRJM18l4c3vRthTg=; b=Bd4cMYxHWKVtpqvZWlqkRYLGt7JnQPK4zXkPELuqUrav0iBom5KxIWOzn0zY8Czcr3 puyopfx2bjNJ+6Puqd4eVWeNKFUbVzNqAUGDJ6ZSb5TGkR/nUIpfSpy1FYsiEan/9bGU GTypLiVYVCLe5xuptDXfckYsa1MD7+CqWzz49Ly9JObTsMK3QHE5IU2Y3ipcaQ/i/zZO Hku0vXKNXdMiNBKtwT4d0WlMfZQUnBusUwuHDOijqFhs+UNgHU0U8IxH8ukWrTzP+s3R G1tTBzBoyETRvFgbdyp5sUE1jMNkllEDBqG/Kw4n3HgbeKJK1XxmAJyX12mVytWLG763 EK4g== X-Forwarded-Encrypted: i=1; AJvYcCWM/WsB+gOYFFtXuGz6nvZfO9LicRKxemSMw0OvPYgDfR7+GPuJLTWFNAFFMb7K5caz1cHKxNTu5A==@sourceware.org X-Gm-Message-State: AOJu0Yw+T1Tul2QubMzlcXPHW8su/9vqmKZeEnlnEaqHi2KDWMsP69q9 Q8VB9qDQANbeClYCRE52wgFqy/3syRqlp3unTEjOT1TGijo7U+f+WhjyyWUxs2/oMbv5dGVbkR9 l9h9dEpE0Lz4i9oXf0ItdDxlSAdE= X-Gm-Gg: ASbGncsDkiCc28Id8Khg9/F8snGJ/mtENKMgc3xA19aftOh3zVP7BwP0AixJrcnxCAX WvImDefrgW1hP7Bstzef6iSBxmmvn8S5IATUELaI= X-Google-Smtp-Source: AGHT+IEcmzSU0ZNme8H8fLNVoNFn3Jk5wT5+7t2CeazO/69VMgB7NXts3Ci51/bgmr1AZO6aa08QVUpol98byKF3V7U= X-Received: by 2002:a05:6902:160e:b0:e57:3e85:60f6 with SMTP id 3f1490d57ef6-e573e856241mr7113246276.27.1736827234772; Mon, 13 Jan 2025 20:00:34 -0800 (PST) MIME-Version: 1.0 From: "H.J. Lu" Date: Tue, 14 Jan 2025 11:59:58 +0800 X-Gm-Features: AbW1kvY0JLGJB8hbmWCi7ZsKcHNAN_T1n_mvgUCGKpGF51JkDEcRD_SBwUzPzT4 Message-ID: Subject: [PATCH] ld: Update mixed LTO and none-LTO relocatable output tests To: Nick Clifton , Alan Modra , Binutils X-Spam-Status: No, score=-3015.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: binutils-bounces~patchwork=sourceware.org@sourceware.org Since only mixed LTO and none-LTO relocatable output is only supported on ELF platforms, limit these tests to ELF targets. Since powerpc64 elfv1 defines a function symbol on its procedure descriptor, which is in a data section, rather than on the code for that function, allow both D and T for nm test on mixed object. From 1513a020cc1722c332ecf707dad2ca759bc4d133 Mon Sep 17 00:00:00 2001 From: "H.J. Lu" Date: Tue, 14 Jan 2025 09:09:28 +0800 Subject: [PATCH] ld: Update mixed LTO and none-LTO relocatable output tests Since only mixed LTO and none-LTO relocatable output is only supported on ELF platforms, limit these tests to ELF targets. Since powerpc64 elfv1 defines a function symbol on its procedure descriptor, which is in a data section, rather than on the code for that function, allow both D and T for nm test on mixed object. * testsuite/ld-plugin/lto.exp: Limits mixed LTO and none-LTO relocatable output tests to ELF targets. Allow both D and T for nm test on mixed object. Signed-off-by: H.J. Lu --- ld/testsuite/ld-plugin/lto.exp | 82 +++++++++++++++++----------------- 1 file changed, 42 insertions(+), 40 deletions(-) diff --git a/ld/testsuite/ld-plugin/lto.exp b/ld/testsuite/ld-plugin/lto.exp index e454b485ed9..f3d82c834c8 100644 --- a/ld/testsuite/ld-plugin/lto.exp +++ b/ld/testsuite/ld-plugin/lto.exp @@ -726,29 +726,9 @@ set lto_run_tests [list \ [list "LTO 3c" \ "-O2 -flto -fuse-linker-plugin tmpdir/lto-3a.o tmpdir/lto-3c.o -Wl,--whole-archive tmpdir/liblto-3.a -Wl,--no-whole-archive tmpdir/liblto-3.a" "" \ {dummy.c} "lto-3d.exe" "lto-3.out" "" "c"] \ - [list "LTO 4a" \ - "-O2 -flto -fuse-linker-plugin \ - -Wl,--no-warn-execstack,--no-error-execstack \ - tmpdir/lto-4r-a.o" "" \ - {dummy.c} "lto-4a.exe" "lto-4.out" "" "c"] \ - [list "LTO 4c" \ - "-O2 -flto -fuse-linker-plugin \ - -Wl,--no-warn-execstack,--no-error-execstack \ - tmpdir/lto-4r-c.o" "" \ - {dummy.c} "lto-4c.exe" "lto-4.out" "" "c"] \ - [list "LTO 4d" \ - "-O2 -flto -fuse-linker-plugin \ - -Wl,--no-warn-execstack,--no-error-execstack \ - tmpdir/lto-4r-d.o" "" \ - {dummy.c} "lto-4d.exe" "lto-4.out" "" "c"] \ [list "LTO 5" \ "-O2 -flto -fuse-linker-plugin tmpdir/lto-5.o" "" \ {dummy.c} "lto-5.exe" "lto-5.out" "" "c"] \ - [list "LTO 10" \ - "-O2 -flto -fuse-linker-plugin \ - -Wl,--no-warn-execstack,--no-error-execstack \ - tmpdir/lto-10.o" "" \ - {dummy.c} "lto-10.exe" "lto-10.out" "" "c"] \ [list "LTO 11" \ "-O -flto -fuse-linker-plugin tmpdir/liblto-11.a" "" \ {dummy.c} "lto-11.exe" "lto-11.out" "" "c"] \ @@ -918,6 +898,26 @@ set lto_run_elf_shared_tests [list \ # LTO run-time tests for ELF set lto_run_elf_tests [list \ + [list "LTO 4a" \ + "-O2 -flto -fuse-linker-plugin \ + -Wl,--no-warn-execstack,--no-error-execstack \ + tmpdir/lto-4r-a.o" "" \ + {dummy.c} "lto-4a.exe" "lto-4.out" "" "c"] \ + [list "LTO 4c" \ + "-O2 -flto -fuse-linker-plugin \ + -Wl,--no-warn-execstack,--no-error-execstack \ + tmpdir/lto-4r-c.o" "" \ + {dummy.c} "lto-4c.exe" "lto-4.out" "" "c"] \ + [list "LTO 4d" \ + "-O2 -flto -fuse-linker-plugin \ + -Wl,--no-warn-execstack,--no-error-execstack \ + tmpdir/lto-4r-d.o" "" \ + {dummy.c} "lto-4d.exe" "lto-4.out" "" "c"] \ + [list "LTO 10" \ + "-O2 -flto -fuse-linker-plugin \ + -Wl,--no-warn-execstack,--no-error-execstack \ + tmpdir/lto-10.o" "" \ + {dummy.c} "lto-10.exe" "lto-10.out" "" "c"] \ [list "LTO 8" \ "-O2 -flto -fuse-linker-plugin tmpdir/lto-8b.o tmpdir/lto-8a.o" "" \ {dummy.c} "lto-8.exe" "lto-8.out" "" "c"] \ @@ -1135,30 +1135,32 @@ if { [at_least_gcc_version 4 7] } { # Run "ld -r" to generate inputs for complex LTO tests. run_dump_test "lto-3r" remote_exec host "mv" "tmpdir/dump tmpdir/lto-3.o" -run_dump_test "lto-4r-a" -remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-a.o" -run_dump_test "lto-4r-b" -remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-b.o" -run_dump_test "lto-4r-c" -remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-c.o" -run_dump_test "lto-4r-d" -remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-d.o" run_dump_test "lto-5r" remote_exec host "mv" "tmpdir/dump tmpdir/lto-5.o" -run_dump_test "lto-10r" -remote_exec host "mv" "tmpdir/dump tmpdir/lto-10.o" -set testname "nm mixed object" -set lto_plugin [string trim [run_host_cmd "$CC_FOR_TARGET" "-print-prog-name=liblto_plugin.so"]] -if { [ regexp "liblto_plugin.so" $lto_plugin ] } { - set exec_output [run_host_cmd "$NM" "--plugin $lto_plugin tmpdir/lto-10.o"] - if { [ regexp "T main" $exec_output ] } { - pass $testname - } { +if { [is_elf_format] } { + run_dump_test "lto-4r-a" + remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-a.o" + run_dump_test "lto-4r-b" + remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-b.o" + run_dump_test "lto-4r-c" + remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-c.o" + run_dump_test "lto-4r-d" + remote_exec host "mv" "tmpdir/dump tmpdir/lto-4r-d.o" + run_dump_test "lto-10r" + remote_exec host "mv" "tmpdir/dump tmpdir/lto-10.o" + set testname "nm mixed object" + set lto_plugin [string trim [run_host_cmd "$CC_FOR_TARGET" "-print-prog-name=liblto_plugin.so"]] + if { [ regexp "liblto_plugin.so" $lto_plugin ] } { + set exec_output [run_host_cmd "$NM" "--plugin $lto_plugin tmpdir/lto-10.o"] + if { [ regexp "(D|T) main" $exec_output ] } { + pass $testname + } else { + fail $testname + } + } else { fail $testname } -} { - fail $testname - } +} run_cc_link_tests $lto_link_symbol_tests -- 2.47.1