From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C5F8BC4338F for ; Sat, 14 Aug 2021 13:05:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8FABB60E96 for ; Sat, 14 Aug 2021 13:05:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238371AbhHNNGG (ORCPT ); Sat, 14 Aug 2021 09:06:06 -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