From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-il1-x142.google.com (mail-il1-x142.google.com [IPv6:2607:f8b0:4864:20::142]) by sourceware.org (Postfix) with ESMTPS id 8C60A385DC00 for ; Sat, 4 Apr 2020 14:18:32 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 8C60A385DC00 Received: by mail-il1-x142.google.com with SMTP id k29so10292216ilg.0 for ; Sat, 04 Apr 2020 07:18:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/R49vBGjz4zO4VyYF+/c/CefeCXh3Fmz4NYrNJurU0o=; b=tQbOaWeagfMpbIu8Bi8Owqa3tk5sJJMD0JTG1MdngfBp0KAOrTOqmfRlWsbpkZYMxO Tn31gtABGNiSLu5hkJji/pS5UH31MYraUlJXhq2u2qmuV6N2hxD7RSSr+mZWjTHCQuBz tkq0SOrCjcaiMvL1+9EpPToRinQfodPG7ASmaKfVpStKuSzryaPxnpzCw3HrdEh1/nIW YxeSSUGYd4SXDt1Q2nE5c0sSokkCSwBNAg/Ws7LQ3doyIYI0KVgdyuJC9TLgMoMIXq5K zOuWUh9+9l5Gevh4WrVF8XvbSF5WVpmXVDxmILW8eQaRG+ukMnJQ1bQKGxyQF96LfRNA 0Cwg== X-Gm-Message-State: AGi0PuYv9sjTmpeD9cFwVXtZpklboMmPuOx2LdmlHOujqs4+PESg3Bdb NF162jVZ0YXptgZIl7RTHrZ/TKotRV88PGGImus= X-Google-Smtp-Source: APiQypLa2umn9vJQArVs3kkb/o9iOfqTrZgVlF80cZ7ezITP4etlnTc8T8ia8L46QQtE8+zrB5VRFkWJnr4pvDYQWXU= X-Received: by 2002:a92:c00a:: with SMTP id q10mr13329488ild.151.1586009911943; Sat, 04 Apr 2020 07:18:31 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: From: "H.J. Lu" Date: Sat, 4 Apr 2020 07:17:56 -0700 Message-ID: Subject: Re: Empty section flags To: Fangrui Song Cc: Alan Modra , bd1976 llvm , Binutils Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-7.2 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 autolearn=ham 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 14:18:34 -0000 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.