From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yb1-xb2a.google.com (mail-yb1-xb2a.google.com [IPv6:2607:f8b0:4864:20::b2a]) by sourceware.org (Postfix) with ESMTPS id 8878C3858D38 for ; Tue, 4 Oct 2022 07:36:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8878C3858D38 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-yb1-xb2a.google.com with SMTP id 81so8436762ybf.7 for ; Tue, 04 Oct 2022 00:36:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date; bh=0qVJZO//x8/BykJ8ooqDt0LoKfIiWFPe0Xj4JYV1KCc=; b=YXwB2fDKppZSdze6gbnPE16gdyJU+NTpuVQ7cmQ0y4Tucfdej65WslU7Eta/hRhxs6 57t3Ey9CedDfmwU0YjWZI6zasA9lDXZK/CFVXz1A0EYeIglEFtv+gwsgalGoMd4iO8Uc Isl8sYV5juBs0tCj2QmIN7HyjvRBOMBeyg5k9972sOTNkJghmDafp0fUO8kdLp7BgjDf 5+rr9FHqqm9syKCSXQgVQ33EjxMUFGfQ4+vDCWaSh4of4BCEfQsNH5he2XxYL4rnLNdM dnmB4W0IsCd39IYySwdda8sjXZ5sS6B6vYsMHZnggsmCnHH8KKqH+Bp7Hr7ole5l4+Um wr+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date; bh=0qVJZO//x8/BykJ8ooqDt0LoKfIiWFPe0Xj4JYV1KCc=; b=lqOsSVvk8TUptx/GOThOQsHey5r6ln8aWapFcjckCloHU8tCN5uN5PfKS4yo7A72Bn TYGxPGxm9qYVrL37ohPgaVfn6n1iatsk9b6RoQKp9JlscbEWkxNDJB6639YrDGjzBEYP IsZ9BO52/eYHjK8eCTHrcun+svw7tpYCP+V8gH7j5LqOems8mu/WDSqwGc+la3kiQdDB ypFnRB9MJJ1LdzEN+nOg8dV6VT7iqk2TD/s4KhbONk8q7BuIcoVn87l/1xJSPhfaKi/B sqT/HCqANYBW2y9l/TzYuTCkPIYU5i1J60N0ZzUYVH5YOL3llspSEtTtiubSD9S8lrg8 NrAA== X-Gm-Message-State: ACrzQf3s7VYtUVldWiDiRy5sap/9/yp9Hhtr1E52XOs7KbMh0ukALSr1 fbukiI2kO9aKPIWxqmMelHewm/vXa/Xa0U/W+mB0a8MjfG89yg== X-Google-Smtp-Source: AMsMyM63fdw+bNlwUUSLKBYBvAU8sEk8Hpuz9tgmnhik3o28G30NYFLZ3zOGuC8STWBTmlwNFDY1AwxZWAAELJCpm08= X-Received: by 2002:a05:6902:120f:b0:676:aaa4:8434 with SMTP id s15-20020a056902120f00b00676aaa48434mr25450385ybu.218.1664869013942; Tue, 04 Oct 2022 00:36:53 -0700 (PDT) MIME-Version: 1.0 References: <20220930140503.38233-1-chigot@adacore.com> In-Reply-To: From: =?UTF-8?Q?Cl=C3=A9ment_Chigot?= Date: Tue, 4 Oct 2022 09:36:43 +0200 Message-ID: Subject: Re: [PATCH] ld/testsuite: consistently add board_ldflags when linking with GCC To: Palmer Dabbelt Cc: binutils@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,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 List-Id: On Mon, Oct 3, 2022 at 7:10 PM Palmer Dabbelt wrote: > > On Fri, 30 Sep 2022 07:05:03 PDT (-0700), binutils@sourceware.org wrote: > > Currently, the functions checking if the compiler is available or if a > > feature is available add both board_cflags and board_ldflags. > > However, functions running the tests only retrieve board_cflags. This > > can lead to unexpected errors when mandaratory flags are defined in > > board_ldflags and not board_cflags. > > > > ld/ChangeLog: > > > > * testsuite/ld-unique/unique.exp: Add board_ldflags when > > linking with GCC. > > * testsuite/lib/ld-lib.exp: Likewise. > > --- > > ld/testsuite/ld-unique/unique.exp | 8 +++++++- > > ld/testsuite/lib/ld-lib.exp | 22 ++++++++++++++++++---- > > 2 files changed, 25 insertions(+), 5 deletions(-) > > Sorry if I'm misunderstanding what's going on here, but with this > applied I'm still getting the tests skipped when I just run "check-ld". > > Running /home/palmer/life/binutils-gdb/ld/testsuite/ld-undefined/undefine= d.exp ... > UNTESTED: undefined > UNTESTED: undefined function > UNTESTED: undefined line > > =3D=3D=3D ld Summary =3D=3D=3D > > # of expected passes 797 > # of expected failures 8 > # of untested testcases 26 > # of unsupported tests 175 > ./ld-new 2.39.50.20220930 > > I always kind of end up fumbling my way around these test suite > infrastructure things though, so sorry if I'm just lost... Haha don't worry, I spent quite some time trying to understand what was going on. AFAIU, there are several ways to pass flags to the DejaGNU driver. The easiest is through environment variables or .exp files. For the ld testsuite, they will be detected and applied correctly within config/default.exp. However, for more complex targets (like cross), you can pass a "board" to DejaGNU with --target_board flag [1]. This allows deeper configuration like setting up a "simulator" (we are using qemu to run our Risc-V executables for exemple). My patch aims to improve supports when LDFLAGS are passed through the board as follow: | set_board_info ldflags "${LDFLAGS}" | set_currtarget_info ldflags "${LDFLAGS}" Note that I don't know the exact difference between the two. Sometimes the first one is enough, sometimes the second is required. If someone has better knowledge than me on that I would be glad. [1] https://www.gnu.org/software/dejagnu/manual/Adding-a-new-board.html Thanks, Cl=C3=A9ment