From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 177AEC001DE for ; Mon, 24 Jul 2023 20:13:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230465AbjGXUNG (ORCPT ); Mon, 24 Jul 2023 16:13:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55462 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230062AbjGXUND (ORCPT ); Mon, 24 Jul 2023 16:13:03 -0400 Received: from mail-yb1-xb49.google.com (mail-yb1-xb49.google.com [IPv6:2607:f8b0:4864:20::b49]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9F4010D9 for ; Mon, 24 Jul 2023 13:13:01 -0700 (PDT) Received: by mail-yb1-xb49.google.com with SMTP id 3f1490d57ef6-c6dd0e46a52so5581999276.2 for ; Mon, 24 Jul 2023 13:13:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1690229581; x=1690834381; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=CEagIzbSR+iB7PSrtUC5DfVnlIQ8QvGcLEq0hl6k6cA=; b=j2eqq8QJfxe5onO/aGVvaZmBZjt/wIF7SaMZOFFFIBmta/BHNLFdiK8Q22j/eX09oZ w0dHp+SS4oB8TAwI9U1Thqt3j09spPnfcwI5kYPTP6gIVsRyjJHjWvvzSLslo5YYpeoN c2hboVA2Xj41u9rSGKt+XtGy2WWpRd+D5CYDFN6InkvFRRqrqencUeV1GqGIh6jl61n7 b0eNVnasnKfepEZSJY8N3RZ1gOgZfudCajlb88Bm5NjCpYtXm+lCAc1tmM9BAwtyUUlH y67MvoHn0sz9nUTZCUbw2FJ2VKENjbcoNmOlh8rmbn5beNZ12CP1T7kwYUaSKiKFCwFp ShAA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690229581; x=1690834381; h=cc:to:from:subject:references:mime-version:message-id:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=CEagIzbSR+iB7PSrtUC5DfVnlIQ8QvGcLEq0hl6k6cA=; b=bd2t+Ac371L3EPBYqyCeQOClHMfaNewb+bJ9Pi4DHA6i+oT2fyK/9XsX18V048aAoz 4jydyqM8RgsTN+ibesydYSnmcZhESG3aSONbUDA9Ng0Yhi/t7zJpcxRKIfNVYrhTlKvP uqDn3Ko+WWyDArIJcInx+UOLOhwrs89SdA0hOWM9j7xxk4Wcrb6pgS1EjLTOkkI+fnTz wPCssb5tZ7pQ8S+aHu8WeFKKkPiV5M7PHdGJir4MpGbv5dXVCeFQCttBH9SmpEDoHosW +c6gU4bdMxOdl4xHcgJnk4Q+B29EipH0D/MvAhuYnVb+P3rLw/7pCsumW3Yxfnxtv0Nt EOJg== X-Gm-Message-State: ABy/qLaJPOtgxYYCupil2vGIh9j5ZfpSXGKg/jjGg8PwHM78Fbs5LaD5 IWqNHUgJh1xUzp/j6IaAXPIadC8GwXKg X-Google-Smtp-Source: APBJJlGTgMXHdweJXUUP8uwI0itLY4YWQi+grIGikzrinhegW1hUjINBGxYjKS5buICDoHMRDOoVHCAWEx5B X-Received: from irogers.svl.corp.google.com ([2620:15c:2a3:200:5724:8dc0:46f0:f963]) (user=irogers job=sendgmr) by 2002:a25:d156:0:b0:d0e:e780:81b3 with SMTP id i83-20020a25d156000000b00d0ee78081b3mr21789ybg.2.1690229580852; Mon, 24 Jul 2023 13:13:00 -0700 (PDT) Date: Mon, 24 Jul 2023 13:12:46 -0700 In-Reply-To: <20230724201247.748146-1-irogers@google.com> Message-Id: <20230724201247.748146-4-irogers@google.com> Mime-Version: 1.0 References: <20230724201247.748146-1-irogers@google.com> X-Mailer: git-send-email 2.41.0.487.g6d72f3e995-goog Subject: [PATCH v1 3/4] perf test: Avoid weak symbol for arch_tests From: Ian Rogers To: Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Ian Rogers , Adrian Hunter , Nathan Chancellor , Nick Desaulniers , Tom Rix , Kan Liang , Yang Jihong , Ravi Bangoria , Carsten Haitzler , Zhengjun Xing , James Clark , linux-perf-users@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, llvm@lists.linux.dev Cc: maskray@google.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-perf-users@vger.kernel.org GCC LTO will complain that the array length varies for the arch_tests weak symbol. Use extern/static and architecture determining #if to workaround this problem. Signed-off-by: Ian Rogers --- tools/perf/tests/builtin-test.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/tools/perf/tests/builtin-test.c b/tools/perf/tests/builtin-test.c index 1f6557ce3b0a..5291fb5f54d7 100644 --- a/tools/perf/tests/builtin-test.c +++ b/tools/perf/tests/builtin-test.c @@ -33,9 +33,18 @@ static bool dont_fork; const char *dso_to_test; -struct test_suite *__weak arch_tests[] = { +/* + * List of architecture specific tests. Not a weak symbol as the array length is + * dependent on the initialization, as such GCC with LTO complains of + * conflicting definitions with a weak symbol. + */ +#if defined(__i386__) || defined(__x86_64__) || defined(__aarch64__) || defined(__powerpc64__) +extern struct test_suite *arch_tests[]; +#else +static struct test_suite *arch_tests[] = { NULL, }; +#endif static struct test_suite *generic_tests[] = { &suite__vmlinux_matches_kallsyms, -- 2.41.0.487.g6d72f3e995-goog