From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 43631 invoked by alias); 27 Feb 2020 08:35:50 -0000 Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org Received: (qmail 43616 invoked by uid 89); 27 Feb 2020 08:35:49 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-10.8 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy=HX-Spam-Relays-External:209.85.216.65, H*RU:209.85.216.65, HX-Languages-Length:1253 X-HELO: mail-pj1-f65.google.com Received: from mail-pj1-f65.google.com (HELO mail-pj1-f65.google.com) (209.85.216.65) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 27 Feb 2020 08:35:48 +0000 Received: by mail-pj1-f65.google.com with SMTP id ep11so832322pjb.2 for ; Thu, 27 Feb 2020 00:35:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=5ijnmdjVxBbny9bOlN5KLelBMkmaNiOGD/jKo6dFbL4=; b=Jh//iETmven12uy/CosmSmkQHBeAcpts4fNP+//OP/M+2nhwEUIVJGCGZpxncjkgmo NkTVDoGmbxmk4118LGPTlqFaXRfq9GJ3aWGTSoSRS3weYQZZ0+y2fgO2zvJer1lzwEaG cIKDISi1XcuN56jIQJF+R4/zetntFjg2ScMtF8kBV6+4w8YPKE00yGScDNC88zWZR/0p 9eH489KdFafR1TsVrp5Zp9KXz/RdU2TrYLCQztLo93uHzQI+ZIfBDudqb/GgsPHbN/Ps l5X0Z5oTgA2sWUH4AZU6IUnFmNju+GLhMrfhkXzsPbfWnz1CTQaZrcRPKdEWG6Tj5AlI 7+8Q== Return-Path: Received: from bubble.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id 18sm6220968pfj.20.2020.02.27.00.35.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Feb 2020 00:35:45 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 057D2806B5; Thu, 27 Feb 2020 19:05:41 +1030 (ACDT) Date: Thu, 27 Feb 2020 08:35:00 -0000 From: Alan Modra To: Christian Eggers Cc: binutils@sourceware.org Subject: Re: [PATCH v3 0/2] Fix several mix up between octets and bytes in ELF program headers Message-ID: <20200227083541.GI32593@bubble.grove.modra.org> References: <20564877.7Tol0G4XMo@zbook-opensuse.wgnetz.xx> <5653117.1aehKcCLEe@zbook-opensuse.wgnetz.xx> <20200220012952.GW5570@bubble.grove.modra.org> <13081552.YODp3BJPb1@zbook-opensuse.wgnetz.xx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13081552.YODp3BJPb1@zbook-opensuse.wgnetz.xx> User-Agent: Mutt/1.9.4 (2018-02-28) X-IsSubscribed: yes X-SW-Source: 2020-02/txt/msg00558.txt.bz2 On Sun, Feb 23, 2020 at 10:07:50AM +0100, Christian Eggers wrote: > Conclusion: Conversion of elf_internal_sym::st_value from bytes to octets looks > possible, but may discover some currently undefined behavior. Simply converting > everything from bytes to octets in elf_swap_symbol_in/out() could be a shortcut > as currently all non-zero symbol values are in bytes. But doing so would be > inconsistent to my proposed change for r_offset and r_addend, so I would try > the "hard" way. Symbols are a real problem, not because of some implementation detail, but because you don't know the units of st_value. A symbol defined as a label on a line of assembly holds an address, but for example a symbol defined by sym = 123 could be a size in octets, an address, or just a plain number. I think that if you decide that symbol values should always be octets, then you'll eventually come to the conclusion that addresses in the assembler need to be octets too. And then it's just easier to dispense with octets_per_byte. So if you're going to keep octets per byte of 2, I wouldn't be trying to convert any symbol values. -- Alan Modra Australia Development Lab, IBM