Received: by 2002:a05:6a10:c7d3:0:0:0:0 with SMTP id h19csp252330pxy; Sat, 14 Aug 2021 06:08:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzKJA26sEr8wCqmmWmch5zHHyKVY5s2YOZms7xvWNa4RVDR0sjCeU+Zs29D+8q80AvlKZvh X-Received: by 2002:a92:cf0d:: with SMTP id c13mr5090849ilo.49.1628946484790; Sat, 14 Aug 2021 06:08:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628946484; cv=none; d=google.com; s=arc-20160816; b=fMeOvZ067eYrQP6vi9cGkr9AJ/KuoSZ9gcOpLO+eJClMZ2G6OwCeada/xFK6ZAPRMK 4zokVpOIHFupUUndjSM3UWHdapWfZdkG2za3CHZbXBY6ttlkPub8tDaY2SVAPUCpn/iW 6xJKNGFAKeaenksu6BwPivxZFIKxgppi6JVlBKWRWxUUKizADht1FFlnl1g8xetZbFU7 KwCqRTiEmEx5c/S3qqfxgjgfW1cNHUl0F3VL293hGFksA1tOTYjxEAp9cWX4NgepiY1O xenceAQBWuY17t/z7ReMRJa5GwUlS54kxP7ZecO55oDRrBCSWLpzEqhYhnzV7XD8QTPM w/tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=7tQI21wdj3hN7JVSuOBcCg+iTSIKYftGfQyWD7iLrLE=; b=MV5g+DWUCKsSrN3M+C8eXEa6T+gEVWexquovlYfZWFSNx/MK3IutfauTZ0iziHmD9F qPZvxvPHBqQkZJCvmITUA4OcKL3pdyM6AqQo5GVJcDGXwadWxnmCsG7+7FD6pcSHcB46 LHlxZLXXT7nLmE8UmMyO5YyIlGnaalNNloM1RHntSb7kyYWxr9D6weRLfOfLAAmErzlN Wu+hBUZ/eMEs0uqafV/8fwaC0ghJO711Sg8jKQmbViryNoBEMgmVNaxxRN2chARikcoO 1DVbA0vRQcuenOZZj/ihVIXf/6Slg/7HxPQ6JLPCbBMFrd7ddbqnvZpxCjKhwqZrHDtq epMw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t16si1612327ilh.72.2021.08.14.06.07.51; Sat, 14 Aug 2021 06:08:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234370AbhHNNGF (ORCPT + 99 others); Sat, 14 Aug 2021 09:06:05 -0400 Received: from gate.crashing.org ([63.228.1.57]:45632 "EHLO gate.crashing.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229549AbhHNNGE (ORCPT ); Sat, 14 Aug 2021 09:06:04 -0400 Received: from gate.crashing.org (localhost.localdomain [127.0.0.1]) by gate.crashing.org (8.14.1/8.14.1) with ESMTP id 17ECwEDi013900; Sat, 14 Aug 2021 07:58:14 -0500 Received: (from segher@localhost) by gate.crashing.org (8.14.1/8.14.1/Submit) id 17ECwCY0013899; Sat, 14 Aug 2021 07:58:12 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Sat, 14 Aug 2021 07:58:12 -0500 From: Segher Boessenkool To: Fangrui Song Cc: Daniel Axtens , Nick Desaulniers , linux-kernel@vger.kernel.org, Nathan Chancellor , clang-built-linux@googlegroups.com, Paul Mackerras , Bill Wendling , linuxppc-dev@lists.ozlabs.org Subject: Re: [PATCH] ppc: add "-z notext" flag to disable diagnostic Message-ID: <20210814125812.GC1583@gate.crashing.org> References: <20210812204951.1551782-1-morbo@google.com> <87sfzde8lk.fsf@linkitivity.dja.id.au> <20210813200508.7bqehxgd6ruerds5@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210813200508.7bqehxgd6ruerds5@google.com> User-Agent: Mutt/1.4.2.3i Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Aug 13, 2021 at 01:05:08PM -0700, Fangrui Song wrote: > Text relocations are considered very awful by linker developers. By very few linker developers. > binutils 2.35 added --enable-textrel-check={no,warn,error} > https://sourceware.org/bugzilla/show_bug.cgi?id=20824 Yes, some people wanted the default to be configurable. So now we have a default default that is sane, so most people get to reap the benefits of having defaults at all, but we also allow other people to shoot themselves (and people who have to deal with them) in the foot. "Progress". Changing the defaults should be a one-time event, only done when the benefits strongly outweigh the costs. Defaults should never be configurable (by the user). > I can imagine that in the future some Linux distributions (especially those > focusing on security) will default their binutils to use > --enable-textrel-check={no,warn,error}. How would this be a benefit to security? > In -no-pie links, R_PPC64_ADDR64 relocations are link-time constants. Where "link" includes dynamic links as well. There are no constants. > There are no text relocations, therefore no need for -z notext. This is a choice by the compiler, nothing more. It saves some process startup time, and allows slightly more maps to be shared by processes that run the same images. But it is a tradeoff, so it might change; and of course it is not an ABI requirement. Segher