From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pj1-f49.google.com (mail-pj1-f49.google.com [209.85.216.49]) by sourceware.org (Postfix) with ESMTPS id DDD6D3858C83 for ; Tue, 1 Feb 2022 03:39:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org DDD6D3858C83 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=maskray.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-f49.google.com with SMTP id qe6-20020a17090b4f8600b001b7aaad65b9so1124617pjb.2 for ; Mon, 31 Jan 2022 19:39:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=EjzDHYP03L3W37tGHsNLUm/2nadAnvDFveJUv17LVqA=; b=E/a+uQA1CosghnVh/RtJsWHDebU8+F0LSOjLEXl00RolXJvzJ3eisfAADkGxuIOBy5 aoiC0WdXE86keGfP/VNb1/hM8hNoMw2fyoSww2cz50i5K/DNZowBHA/9XvmkLC2RbLHH wbF3LiBdclbtyw67S7fHonNM7ss6cBvF1cAYB/wpvkcQvxPeOFdqLNxqMdjI3Cdlj0oc YXIcrEep+rJ0ZzxorFu6LWl5nRUSP7yOqLV7gu4zZlWTjZbOgQqWkRVMvc8eYQxGkpZ/ BDw7rydjs95+r1ASllqvrTuRKYt3E4aKRhHgrVOTDK3UQrCDj983a02Jf0gKvIc8GA7V 7cwA== X-Gm-Message-State: AOAM533aDmipuFZm7gVwmlnLEsboHlEfFQvaCQ+b7/AbSypnW6iOkEIu rZ4syUKIJgIFHKCV4ekVCYA= X-Google-Smtp-Source: ABdhPJwiiOd46xsxjCZJoCA//N3ao7fbYfDS6xHWJTAdmXJ7H3Rz1Vgizkw02UwlDTyppPCxhzJLyA== X-Received: by 2002:a17:902:e812:: with SMTP id u18mr24046360plg.159.1643686771879; Mon, 31 Jan 2022 19:39:31 -0800 (PST) Received: from localhost ([2601:647:6300:b760:dc88:b1c4:1273:63d3]) by smtp.gmail.com with ESMTPSA id a13sm17034928pgv.27.2022.01.31.19.39.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 31 Jan 2022 19:39:31 -0800 (PST) Date: Mon, 31 Jan 2022 19:39:30 -0800 From: Fangrui Song To: Nick Clifton Cc: Alan Modra , binutils@sourceware.org, Luca Boccassi Subject: Re: Output section type (READONLY) Message-ID: <20220201033930.ssqtsoha6jaqzsfs@gmail.com> References: <20220129074545.csaig4kn5bk4si5k@gmail.com> <653b3fdf-61ed-2c41-5db2-de40bb51e8a0@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <653b3fdf-61ed-2c41-5db2-de40bb51e8a0@redhat.com> X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_INFOUSMEBIZ, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: binutils@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Binutils mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Feb 2022 03:39:36 -0000 On 2022-01-31, Nick Clifton wrote: >Hi Fangrui, > >>Well, READONLY has another behavior that it forces non-SHF_WRITE output >>even if an input section has the SHF_WRITE flag. > >>I find this quite dangerous if an input section has the SHF_WRITE flag. >>I do not see in what circumstances a user may want this behavior. >>This just seems very dangerous to use in general. > >So basically what you are saying is that if a input section is assigned >to an output sections with incompatible attributes (presumably because of a >linker script declaration) then the linker should issue a warning message, >yes ? > >By extension then, this feature should cover not just the readonly section >attribute, but the NOLOAD attribute as well. For NOLOAD, .noload (NOLOAD) : { *(.noload) } makes the output .noload SHT_NOBITS even if there is a non-empty SHT_PROGBITS .noload section. I don't know whether the linker should issue a warning. For READONLY, I am thinking more in line with "whether we need this feature at all"... If no input has SHF_WRITE, the output naturally does not have SHF_WRITE; if an input has SHF_WRITE, chancing the output to non-SHF_WRITE is weird and error-prone. >This sounds like it might be an interesting feature to implement for someone >looking to gain experience with the binutils. Ah, sure:) >Cheers > Nick > > > >