From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from fencepost.gnu.org (fencepost.gnu.org [IPv6:2001:470:142:3::e]) by sourceware.org (Postfix) with ESMTPS id 3BE0A384A40A for ; Wed, 2 Sep 2020 16:30:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3BE0A384A40A Received: from eggs.gnu.org ([2001:470:142:3::10]:48476) by fencepost.gnu.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kDVes-0005ZX-KV for gcc-patches@gnu.org; Wed, 02 Sep 2020 12:30:54 -0400 Received: from mail-il1-x141.google.com ([2607:f8b0:4864:20::141]:45002) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kDVeq-00042O-8o; Wed, 02 Sep 2020 12:30:49 -0400 Received: by mail-il1-x141.google.com with SMTP id h11so5520316ilj.11; Wed, 02 Sep 2020 09:30:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=b7rrjxxsX17sPIZkcuVN7JDfPlE/ZPc45lwDeCiN6uY=; b=tNM8/ECe4COWKdPtpbp/tz3E35FdLs6CahS+RPZjTjojgf2Gl4JuBaqCX8uTNCaRTo wmPuvacMNY4LPBrHUtKERR2xbcZ4qgLQ7d7xwX1OTD9oTJ2kieGWgCDV+2RgPYMZW4SA p7FV3pF6FAaPIPO16OatgwecmvcbtS26W764PZ5C4ixSP4PlS4kxtf/2uZM7b4QSu7hA 0Azp5wtUDrVfxlIHPcSjDg8N08axFlQiI9BlWbD/VjDrApHVBZIjW2fcBrETnqaZUnNs IJkhXlYI1FA778ZGAWywQW0S7qql3HAv/bVWfPuaMVzbSlqBi12lFchLxYVd8p9lHvLS NXCQ== X-Gm-Message-State: AOAM533hZqnB29IECsmI9Q+cWVT7lXFT2NyzmPVx0r6NuIopprbr+gTW hSzHdrovN3vR5ERxQ+UjHD86RPe5iS5I4G1/ou0= X-Google-Smtp-Source: ABdhPJzTw12Kc4JAAgwJn6WcbqKPduMeAQSrNN+Ds8QEpOw+HQsxBxtXyceTgCNB1g7R4EFPRpFP/jav7Wo+7XVh21c= X-Received: by 2002:a92:6a09:: with SMTP id f9mr4373142ilc.273.1599064246368; Wed, 02 Sep 2020 09:30:46 -0700 (PDT) MIME-Version: 1.0 References: <87h7sg42ng.fsf@oracle.com> In-Reply-To: <87h7sg42ng.fsf@oracle.com> From: "H.J. Lu" Date: Wed, 2 Sep 2020 09:30:10 -0700 Message-ID: Subject: Re: dg-options after board/cflags To: "Jose E. Marchesi" Cc: gcc-patches@gnu.org, dejagnu@gnu.org Content-Type: text/plain; charset="UTF-8" Received-SPF: pass client-ip=2607:f8b0:4864:20::141; envelope-from=hjl.tools@gmail.com; helo=mail-il1-x141.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Status: No, score=-7.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Sep 2020 16:30:57 -0000 On Wed, Sep 2, 2020 at 8:31 AM Jose E. Marchesi via Gcc-patches wrote: > > > Hi people! > > While adding a bpf-sim.exp to dejagnu, I noticed that the flags in > board/cflags were included in the final compilation line _after_ the > flags in the test's dg-options. > > Since the test options are more particular than the board options, I > would expect them to be placed after any board-defined flags, so I > prepared the patch below for dejagnu, which does the right thing for the > gcc.target/bpf testsuite. > > However: > > 1. There could be tests around that depend (erroneously) on some of > their dg-options to not have effect (or a different effect) because > they are annulled (or modified) by some flag in a board file. > > 2. This could also impact other programs using dejagnu. > > How do you people recommend to proceed? > Should we fix dejagnu and then fix buggy tests? > Or the other way around? :-) > > diff --git a/lib/target.exp b/lib/target.exp > index 36ae639..f0bfe20 100644 > --- a/lib/target.exp > +++ b/lib/target.exp > @@ -455,7 +455,7 @@ proc default_target_compile {source destfile type options} { > } > if {[regexp "^additional_flags=" $i]} { > regsub "^additional_flags=" $i "" tmp > - append add_flags " $tmp" > + append additional_flags " $tmp" > } > if {[regexp "^ldflags=" $i]} { > regsub "^ldflags=" $i "" tmp > @@ -703,6 +703,8 @@ proc default_target_compile {source destfile type options} { > } > } > > + append add_flags " $additional_flags" > + > verbose "doing compile" > > set sources "" > @@ -728,7 +730,7 @@ proc default_target_compile {source destfile type options} { > append add_flags " -o $destfile" > } > } > - > + > # This is obscure: we put SOURCES at the end when building an > # object, because otherwise, in some situations, libtool will > # become confused about the name of the actual source file. Does your dejagnu contain commit 5256bd82343000c76bc0e48139003f90b6184347 Author: H.J. Lu Date: Thu Feb 26 17:53:48 2015 +1100 * lib/target.exp (default_target_compile): Prepend multilib_flags, instead of appending it. Some GCC testcases need explicit GCC options to properly run. For example gcc.target/i386/pr32219-1.c has -fpie specified explicitly: /* { dg-options "-O2 -fpie" } */ But with multlib, eg: make check-gcc RUNTESTFLAGS="--target_board='unix{-fpic}'" -fpic is appended to the command line options, which overrides the command line options specified by dg-options. multlib flags should be placed at the beginning of the command line options, not at the end. This patch updates default_target_compile to prepend multilib_flags, instead of appending it. -- H.J.