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 A51263858C52 for ; Wed, 24 Jan 2024 16:06:56 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A51263858C52 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 A51263858C52 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::b2a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706112419; cv=none; b=OgfiK5uUHMAishNJRzZjKbN5F4O72UAPsOWyrHZFei4Kfyx/x8UgOu/z2SjXnclP03ARMSn4iBAL36LZUo8SisuzEqorX62OZaAGTflPnGcWwM5xPana8NwluNf2IvPmMmOQNt9VsFsZa4s/Cfqi0Kfy0pt1eRscSC4Hc0H1NFU= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706112419; c=relaxed/simple; bh=cIDiC0KqqbatDYOOssNGk1k/QKamrEzcnxFcquGdZp0=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=t/bBNPb00vSN3yo29RhZXrtQwv213daKX4Pk1DcLUCwHhs/s6QqLQZicy+wC+FNQZgQgybIvEoUqUpKyOFIQyUXXk8c7fuNXuluqUrRy2POsSdHCMGUJd4Hhe8JqOSRkQ5gP0FUhVoJ1Ri+SClR9pawRkuzBahb6HhM8gIldiu8= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yb1-xb2a.google.com with SMTP id 3f1490d57ef6-dc238cb1b17so5229589276.0 for ; Wed, 24 Jan 2024 08:06:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706112416; x=1706717216; darn=sourceware.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=sU4Hcq/s/GdxgtEepTJcn/kqov77B85yqSRDKpX4T+w=; b=Le0+PFJpDEuZgLp0xxQ7AFXDHw3x2E8NDbtNfRRNrCz2Xwt8VfwD2RtKl52FhCsl9j Dn62b4IDUv3gnAPya/hjtnvw3ZU8S4H4MGOIdNmaypoa8d4skOp04BdvwqwN9OE57p4t wMIJNlu5M5KnACSmMbEBcQSoPcE7Wt/PVWQZAY+rD3j4gwRnALvJR75vq/kKoCA1mT+B /uOOdjCtycn150tDiXM0o8USn/2Br83ZCuN1FIVetZZ/UnvvIbHbP49JgI2VDSe2KF38 JYPFaeAaphPmB04IgHbnlFcTytZRfrU3dBDddFQV0nlIarpgfhkk4zrO7BNhBQzXEstb EDYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706112416; x=1706717216; 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:message-id:reply-to; bh=sU4Hcq/s/GdxgtEepTJcn/kqov77B85yqSRDKpX4T+w=; b=cA8EBzzWen5HYHdz44gNOymrBzlfyZzwMpxmkALTABQrXxza6VQTAdN5/1o5saDNX2 CNZP/Yi8ZztxBb+YCbMX7AiFWv9VEvoZbdGgoPxMoKIxmyYz3jI4Lk1fTFDJa957rrnp dcT2zn/mrX3JnKH8Jt4M7MZW5OE/14rBKGB+TZdQO4CHk/u3NXBuBo2k4ogYoGdMj6pb /MRMpJg11vcgQ5Md+gAImOvD8m89nL2qDEAyAR6Png0n2Js7082WipmchfA3G3vfpj1Y y+PXXeRBse76o+RLgPPSnn0qA7hmyaBBG+sVu23QRBkY/DGz725suwphS04y7vPA3RU6 nv3g== X-Gm-Message-State: AOJu0YzmLUeFypdCpBh1ySCyMEAfDgmJ4dv3PTfxxk38DoRRppY4f0N+ qxzVqYQQwiv67FbmXRO8cjoAF00hgewF/FPRwdZmb83FCFIGccX9w8PNSW5AvChwvWFlmri59Es iV5Q4RLCSX3uP7QAyG/1KCvaQtfY= X-Google-Smtp-Source: AGHT+IEbo518yRDSEdNDvRLZBELEsjA6yKSoClnaG7CFYY7h6FkcCEWl4z0wJ52PXAICp/8zac1LvCu2UUAUJkQ4ezM= X-Received: by 2002:a25:9f0a:0:b0:dbd:ac46:7fdc with SMTP id n10-20020a259f0a000000b00dbdac467fdcmr801789ybq.69.1706112415703; Wed, 24 Jan 2024 08:06:55 -0800 (PST) MIME-Version: 1.0 References: <87fryomdy6.fsf@redhat.com> <87frymkbl0.fsf@gentoo.org> In-Reply-To: <87frymkbl0.fsf@gentoo.org> From: "H.J. Lu" Date: Wed, 24 Jan 2024 08:06:19 -0800 Message-ID: Subject: Re: RFC: Document unexpected behaviour of --fatal-warnings To: Sam James Cc: Nick Clifton , serge.guelton@telecom-bretagne.eu, binutils@sourceware.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-3014.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE 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 Wed, Jan 24, 2024 at 7:15=E2=80=AFAM Sam James wrote: > > > Nick Clifton writes: > > > Hi Guys, > > Hi Nick, > > > > > It was recently pointed out to me that the bfd linker's > > --fatal-warnings option can behave in an unexpected manner. For > > example: > > > > $ ld.bfd -z bad-option --fatal-warnings -e 0/dev/null > > ld.bfd: warning: -z bad-option ignored > > $ echo $? > > 0 > > > > ie the warning about the ignored option is not being treated as an > > error. This happens because the --fatal-warnings option only takes > > affect after it has been processed, and we process the options in a > > linear order. So the following works: > > > > $ ld.bfd --fatal-warnings -z bad-option -e 0 /dev/null > > ld.bfd: warning: -z bad-option ignored > > $ echo $? > > 1 > > > > This behaviour differs from gold and lld, both of which honour > > --fatal-warnings no matter where it occurs on the command line. > > > > So we could fix the linker, create a two pass argument scan and the > > problem would be solved. But a) I am lazy and b) we already have a > > precedent for options on the command line only affecting options that > > come after it. (I am thinking of the -L option here, although there > > are probably several others). So instead I am considering documentin= g > > the current behaviour as expected. (See the patch below). > > > > What do people think ? > > I'm OK with it either way. We're really used to this kind of linker > behaviour so it's not a problem to just document it. I've not hit > this as a problem at all. > > Then if someone wants to improve it later on, so be it. > > (We could maybe change the docs to say "may not affect" if we want > leeway to change it later.) I opened: https://sourceware.org/bugzilla/show_bug.cgi?id=3D31289 and will submit a fix this week. --=20 H.J.