From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS31976 209.132.180.0/23 X-Spam-Status: No, score=-4.0 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED, SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.1 Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id 58D3F1F954 for ; Tue, 21 Aug 2018 23:02:29 +0000 (UTC) DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; q=dns; s=default; b=T1RV bgatgNFPxyt2p5ZkknywVlBWCTUVjhv662dfVzsOHeU7S+w9C1Dhxb2ADm2rhTKW pfy6kKRL7CYaRxZg71JYif/SCHMELJjCb0ku5/wXlF0jMjzi4jMZT3uWBh1Nl/+I QINWKK+rPHvQ4r+Y2V3s3P5jVb1yMiMMz7S2Ugc= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc:content-type; s=default; bh=SlHmG9ejJP q2X/wq4wOYTdEJYqA=; b=Zmrwo9qn/hh95E3Ht7ZDHeYW+80oOjudnycBtrka4y VPshJLkxRFDFhjI8LCMZ4czWVS1O6A+hCCIwYaE1ib9HY6AsP+R1GGYcsMZFnhB+ 5bPPgOGI6GdtmtB3qAD3GyWwupU2aQ/uqX5FHjJL7sTnrdLX+1Q2X7pzLhG1F4+m 8= Received: (qmail 27696 invoked by alias); 21 Aug 2018 23:02:26 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 27194 invoked by uid 89); 21 Aug 2018 23:02:25 -0000 Authentication-Results: sourceware.org; auth=none X-HELO: mail-vk0-f50.google.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=QoMU21IwIBogXmCWeQFsT+RATJOYH2obllJZeObZT8A=; b=J52UtQrCzShvUidAO6zQSRuFgGqxIz0Qk1A3/B4q30xogxPTvI+P+N6Q1c6JYg5sJx EpXIxbKk7FvGs3rvbN7Z/VZIe8uqpr3Nimp1tP+BlsUQrv3qNXeTvaVnwM8K9Mu6qMyW vefmmzrIf0/0OJd5LdO0JmHt4NOSO4jsoCKZBQOUReu0GTwpQdGGTdwehO4/C7A1P3X+ Z2cPrUe1o47CG+rY1b9beQfnmyCveQMKnz5QSw+L0CtfQm6eEoPP4dJrWjQva69hxkCp pcVeFYLaaRxvwGC+XHNNENiMg9GJTyIfsD5wqm0kAqDY7Cs5I6c5gZBd23LgI+laJ82U 8NzA== MIME-Version: 1.0 In-Reply-To: <20180817210524.GF8094@wildebeest.org> References: <13a92cb0-a993-f684-9a96-e02e4afb1bef@redhat.com> <480f513b-cfee-311a-0793-55eec81cd0fa@redhat.com> <3edfa10f-f5f0-bc31-5707-b15c78a84d0a@redhat.com> <20180816191628.GA8094@wildebeest.org> <20180817064146.GD8094@wildebeest.org> <20180817210524.GF8094@wildebeest.org> From: Cary Coutant Date: Tue, 21 Aug 2018 16:02:21 -0700 Message-ID: Subject: Re: PT_NOTE alignment, NT_GNU_PROPERTY_TYPE_0, glibc and gold To: Mark Wielaard Cc: "H.J. Lu" , Florian Weimer , x86-64-abi , Binutils , GNU C Library Content-Type: text/plain; charset="UTF-8" >> >> But like you, I don't yet see the value of the 8-byte alignment. We could >> >> decide that the current gold behavior is valid, fix glibc, and move on. >> > >> > Right. gold seems to produce normal GNU abi ELF Notes, which should >> > be accepted as is. >> >> NT_GNU_PROPERTY_TYPE_0 should stay to follow gABI. > > That doesn't make any sense. gABI doesn't have a concept of 32bit word > ELF notes that are 8-byte aligned. That is just a bug in ld when it > generates the note. It also doesn't make sense to generate GNU ELF notes > with slightly different padding added depending on type in the same ELF > file. That just creates confusion, causes you to define different > alignments of notes resulting in extra PT_LOAD segments and results in > bugs like we are discussing now where ELF note parsers fail to parse > some (valid) notes. Lets just agree that the gold linker is correct and > produces consistent GNU abi ELF notes. And lets just fix ld to do the same. I thought the outcome of the old discussion on the gABI/psABI mailing lists was that there was no value in breaking compatibility by introducing an 8-byte aligned note section. As it is, the psABI definition of the gnu properties note is a definitional disaster: like a proper note, it's got three 4-byte words (namesz, descsz, and type), followed by the name field (which happens to be 4 bytes long in this case), then a desc field. For this note, the desc field contains a properties array, where each property has two 4-byte values (pr_type and pr_datasz) and a data field padded to a multiple of 8 bytes. But it describes the properties array as an array of 8-byte words, even though it's really composed of the two 4-byte words and an arbitrary-length buffer (which according to the spec, is always 8 bytes). Why an 8-byte alignment, though? It doesn't provide any conceivable benefit. I think gold is doing the right thing by placing the output in a 4-byte aligned note section, and combining it with other note sections in a 4-byte aligned PT_NOTE segment. As long as HJ is planning on breaking compatibility with his new definition of the x86 properties [1], why not just throw it away and do it right? Let's stop using NOTE sections for something they weren't designed for, and instead use a special section type and segment type (in keeping with existing models like Sun, HP, MIPS, and Arm). Why should the loader have to go parsing everything in a generic PT_NOTE segment anyway? -cary [1] https://groups.google.com/d/msg/x86-64-abi/-D05GQ3kWrA/stKtIPy8DQAJ