From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-f178.google.com (mail-pf1-f178.google.com [209.85.210.178]) by sourceware.org (Postfix) with ESMTPS id 31220385DC00 for ; Sat, 4 Apr 2020 16:38:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 31220385DC00 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=maskray.me Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=emacsray@gmail.com Received: by mail-pf1-f178.google.com with SMTP id u65so5280876pfb.4 for ; Sat, 04 Apr 2020 09:38:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=RDrG1nr1ZbbZ1+TycV0cli4rl9sJX9pkgOQPufB3eAU=; b=jNRODGIYMppfZWP7SQu1j7lHLwU6wFVtTjH9yTz5MGWbbtHeWTL5MBKMIDaJQRvmwa 4zaxG4m1FqI2qWTnBH6um08G9RR0/Ls7OgA3CdhHvkSckT2Jf4ncKGNlI9C3oIJwkk1B UG4ttW6mdkXr8W3hFJ2988Mve2/robeZiII/alGLSERq46SwYphoRjt9UX2eRCZm1UaK 1rVIGsGXMnWIji0qOJYATtIgCy8dQFj8XDA7psqT/AHhIYzTga07eT5OEHZlosJC8sBV OKahj9gl4Uq0Fnl0ZFJxpJcH+gBWUo9rXLRnBfOptgoA77kFDnihIyWwanaU9+X+A+eN H5yg== X-Gm-Message-State: AGi0PuYXWtAQbUE/nmEwplvft+I462D0SL9KG1NGY8R93syreQHwjCl3 U3+gk+kfVB8bqBd1jC/CxnMOckIv X-Google-Smtp-Source: APiQypINjtye36c+RFs7qYWMCOH2cCqgwC5owyLkzHIJUIbsfajFLxDF/WSnufU5dc9UD9vEm2zy6g== X-Received: by 2002:a62:7bca:: with SMTP id w193mr14331369pfc.319.1586018310319; Sat, 04 Apr 2020 09:38:30 -0700 (PDT) Received: from localhost ([2601:647:4b01:ae80::51fb]) by smtp.gmail.com with ESMTPSA id nh14sm8254671pjb.17.2020.04.04.09.38.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Apr 2020 09:38:29 -0700 (PDT) Date: Sat, 4 Apr 2020 09:38:28 -0700 From: Fangrui Song To: "H.J. Lu" Cc: Alan Modra , bd1976 llvm , Binutils Subject: Re: Empty section flags Message-ID: <20200404163828.abhvjv5p26mobuda@gmail.com> References: <20200206073837.j4biw4rsbdy2siip@gmail.com> <20200206083347.GC5669@bubble.grove.modra.org> <20200206091914.5docw46nvgx7om6o@google.com> <20200206140912.GE5669@bubble.grove.modra.org> <20200210052104.GQ5669@bubble.grove.modra.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-2.3 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 autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Sat, 04 Apr 2020 16:38:32 -0000 On 2020-04-04, H.J. Lu wrote: >On Tue, Mar 3, 2020 at 1:20 PM Fangrui Song wrote: >> >> On Sun, Feb 9, 2020 at 9:21 PM Alan Modra wrote: >> > >> > On Thu, Feb 06, 2020 at 05:25:33PM +0000, bd1976 llvm wrote: >> > > Hi Alan, thanks for the input here. I wonder if it wouldn't be more >> > > consistent to error in all cases - even in the case of different group >> > > signatures. The only exception would need to be for the special section >> > > names (.text, .debug_str, etc...) that the assembler has special knowledge >> > > of (as you explained). >> > >> > Yes, let's see how that goes. >> > https://sourceware.org/ml/binutils/2020-02/msg00129.html >> > >> > > I wonder why creating multiple sections with the >> > > same name for section directives with different group signatures was >> > > implemented - why not just require the use of a distinct section name for >> > > these? >> > >> > I think plain ".text" for a group's text section is fine. Distict >> > names would just be yet another thing to track for a group. >> > >> > > Or, now that GNU has the ",unique,N" assembly extension ( >> > > https://sourceware.org/ml/binutils/2020-02/msg00028.html) that could be >> > > used if the section name is fixed - it would then be explicit in the source >> > > code that another section with the same name will be created. >> > >> > Perhaps, but we aren't designing a new toolchain. Backwards >> > compatibility can't be discarded without compelling reasons. >> > >> > -- >> > Alan Modra >> > Australia Development Lab, IBM >> >> For empty flags, should there be an error as well? >> >> .section .foo,"ax",@progbits; .byte 1 >> .section .foo,"",@progbits; .byte 2 # no diagnostic >> .section .foo,"a",@progbits; .byte 3 # Error: changed section >> attributes for .foo >> >> Context: https://github.com/ClangBuiltLinux/linux/issues/913 >> >> I lean toward an error for consistency, and I will try making the LLVM >> MC side rule stick. > >[hjl@gnu-cfl-2 tmp]$ cat x.s >.section .foo,"",@progbits; .byte 2 >[hjl@gnu-cfl-2 tmp]$ gcc -c x.s >[hjl@gnu-cfl-2 tmp]$ readelf -SW x.o | grep foo > [ 4] .foo PROGBITS 0000000000000000 000040 >000001 00 0 0 1 >[hjl@gnu-cfl-2 tmp]$ > >Unless it is disallowed by gABI/psABI, assembler should allow it. >Sometimes, I found a need to create odd object files, like zero-sized >relocation section, for linker test. Assembler should have more >flexibilities within gABI/psABI. > >-- >H.J. Declaring a section with empty flags is fine. My question is about re-declaring with empty flags when the first declaration has other flags: .section .foo,"ax",@progbits; .byte 1 .section .foo,"",@progbits; .byte 2 # no diagnostic .section .foo,"a",@progbits; .byte 3 # Error: changed section This is about the follow-up of https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=33176d912add7680277ad5e18af0e6303d9a7af8