From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-yw1-x1131.google.com (mail-yw1-x1131.google.com [IPv6:2607:f8b0:4864:20::1131]) by sourceware.org (Postfix) with ESMTPS id 19C8E3858CDB for ; Wed, 24 Jan 2024 22:52:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 19C8E3858CDB 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 19C8E3858CDB Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::1131 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706136768; cv=none; b=Ke+POaazb8mKBvg/wYxrOXNLdCsA2Q/bX2JUvyse0XLZeGwOvrTfhBrLBgWN9xxmAnUD1or6mujhI9bGn/GEX1fX9JEKrFyTTJDpWrLKmA7hWROQkKCYurTANbs0y7XQYcgZOlhpavvYcUQSahgccPIdI3HQ4X2Ddaj5Y9lTlTc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706136768; c=relaxed/simple; bh=QBy7+o0AG3FnFnEhKpMKCdydvmVZxIoP5OYy4n8VTWg=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=aPggS+Tl5P0qwFSuYwI++MG/JtdefwmvysxYmei7ajwx19py9ladbA3tKDtOGt8PaTeIFSE9YlUDqXxdRVzHKoSIGvzy0EeZdr3sblTJcgOvxFmpM9x9qHEas5arRvnpKUoMMxLLNMpdRS4S7JL4wfCK7SqsZ9XCMK+NdUVAkbI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yw1-x1131.google.com with SMTP id 00721157ae682-60036bfdbfeso27402217b3.3 for ; Wed, 24 Jan 2024 14:52:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706136765; x=1706741565; 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=oW30AQp23xIoaTlGGXXt2Vgta3sg4xz+VMvxy/f421Y=; b=aMpaawnfVyFW63N6lNCaxvj2AdduULUrJ1U5fWjlJ5vO0DjCpbJZ3yrD/a4kiu6dYF RONSWSwJhX7ydnPW+NmdAg7MYE4kYGF2vx23m475QKNm+mnV6CrQGxcqbFpkzSCzdPq5 Vhb5uHPhZT93TgLtgJp/0BamXLziDFZY+iBKF4PbUQbOVfTz1VQrAS3FdX9g3sBPm3B6 sU3Ek6Sl4703VmXbkE89Zt4TOh/FMBWagQ+BSIWADKzX0lkQ4SeqOCvQB0bDCf8XX5LQ xgb8WXFuDwgsyqKYrjWDa1PHrzYYwcVx8inPDThvMnJ3Rv3UQ/akNMOO4KqbEB5GIlx9 MT3A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706136765; x=1706741565; 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=oW30AQp23xIoaTlGGXXt2Vgta3sg4xz+VMvxy/f421Y=; b=v+gi+BWkNQ3nQ2bbOiu5NcZCcn13vFPUuQFMm/yNzhVxCIB//b9KAVox3eqF6E9vH8 xfQa8w97/rSQZb9do8eRJswAUEEXQ0Q4g3ZbM6CTEU5PrlLwakjzSiX/QeOHZdXJXUx+ lbLqBNX2yKPk/b64imc1kmOdbvj9oL590O/Mv1iVO4vk5UX1exLD5o/wZGK8a93BaCMY xkDeYMPhC/G9dhnVV5JJN58/oqQfdvjlK7g08qVN+HrJpT/3/1mgier96/rJWOTnM8kL F1kWkjfpHWzyoF8kkbAtdNDQ4Y30glzMKcv7YlqKm1tiv0RpONpCV5AhU54QUKiNrRf6 h9lg== X-Gm-Message-State: AOJu0YyHjLwVWYGVZ7dIOZeba1Gj35qW1BxNfP7RN1wBkw3/2QACSWXC DBa9ZMDNl/SoE2v4de+av3jai2uCazWCqJSEwQDYFqRzJ3ZOZJTB4R007PbF4Ye07oRoSvG9RKx vm76pXANB2i2KCZ9qx77JEE23LOY= X-Google-Smtp-Source: AGHT+IHNxA4JQ8oq8u2jf/vWSct4tSV5JFrVfUQ2xUVodz6OohiuEaZymjq4jhpx9Tv1HxgDTS1w25bB4FSTmPA6syg= X-Received: by 2002:a25:7445:0:b0:dc2:2720:4386 with SMTP id p66-20020a257445000000b00dc227204386mr99158ybc.68.1706136765319; Wed, 24 Jan 2024 14:52:45 -0800 (PST) MIME-Version: 1.0 References: <87fryomdy6.fsf@redhat.com> <87frymkbl0.fsf@gentoo.org> In-Reply-To: From: "H.J. Lu" Date: Wed, 24 Jan 2024 14:52:09 -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.8 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 8:06=E2=80=AFAM H.J. Lu wrote= : > > 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 th= at > > > come after it. (I am thinking of the -L option here, although ther= e > > > are probably several others). So instead I am considering document= ing > > > 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. > A patch is posted at: https://sourceware.org/pipermail/binutils/2024-January/132106.html --=20 H.J.