From patchwork Thu Jun 28 13:49:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Maciej W. Rozycki" X-Patchwork-Id: 28100 Received: (qmail 58599 invoked by alias); 28 Jun 2018 13:49:49 -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 Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 58411 invoked by uid 89); 28 Jun 2018 13:49:26 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-11.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=upgrades, H*r:0700 X-HELO: 9pmail.ess.barracuda.com Date: Thu, 28 Jun 2018 14:49:03 +0100 From: "Maciej W. Rozycki" To: Florian Weimer CC: , Alan Modra Subject: Re: [PATCH 2/2] libc-abis: Define ABSOLUTE ABI [BZ #19818][BZ #23307] In-Reply-To: Message-ID: References: <87sh5a38tz.fsf@mid.deneb.enyo.de> User-Agent: Alpine 2.00 (DEB 1167 2008-08-23) MIME-Version: 1.0 Return-Path: macro@mips.com X-BESS-Apparent-Source-IP: 12.201.5.32 On Wed, 27 Jun 2018, Florian Weimer wrote: > > > Is this really necessary? It essentially precludes backporting the > > > fixes. > > Thank you for your input. Of course bumping up the ABI version is not > > itself required for the change to work, and all existing working binaries > > will continue to. > > > > Technically it does not preclude backporting either, although of course > > it is limited by the previous ABI bump, which is (in the reverse order by > > version/date): > > Maybe I misunderstood what you were trying to do here. > > Will the EI_ABIVERSION in created binaries increase if the programmer simply > upgrades binutils? Or will this happen only when particular features are > used? Only when this particular feature is required, like with the older ABI versions defined so far. I've double-checked with binutils and the MIPS target is the only one actively switching EI_ABIVERSION; all the remaining targets appear to have the value fixed and I am not going to change that. This is how the relevant part of the linker update in question looks like: and then `htab->use_absolute_zero' will be TRUE iff a GOT relocation has been calculated to actually refer to a specially-created absolute symbol used to address the issue covered by binutils PR ld/21375. The flag will be FALSE if code has been relaxed to avoid referring the GOT (by using immediate zero instead), in which case no absolute symbol will have been specially created. Does this explanation clear your concern? Maciej Index: binutils/bfd/elfxx-mips.c =================================================================== --- binutils.orig/bfd/elfxx-mips.c 2018-06-28 00:44:35.780943617 +0100 +++ binutils/bfd/elfxx-mips.c 2018-06-28 00:44:35.913406279 +0100 @@ -16305,13 +16449,14 @@ enum MIPS_LIBC_ABI_MIPS_PLT, MIPS_LIBC_ABI_UNIQUE, MIPS_LIBC_ABI_MIPS_O32_FP64, + MIPS_LIBC_ABI_ABSOLUTE, MIPS_LIBC_ABI_MAX }; void _bfd_mips_post_process_headers (bfd *abfd, struct bfd_link_info *link_info) { - struct mips_elf_link_hash_table *htab; + struct mips_elf_link_hash_table *htab = NULL; Elf_Internal_Ehdr *i_ehdrp; i_ehdrp = elf_elfheader (abfd); @@ -16319,15 +16464,19 @@ _bfd_mips_post_process_headers (bfd *abf { htab = mips_elf_hash_table (link_info); BFD_ASSERT (htab != NULL); - - if (htab->use_plts_and_copy_relocs && !htab->is_vxworks) - i_ehdrp->e_ident[EI_ABIVERSION] = MIPS_LIBC_ABI_MIPS_PLT; } + if (htab != NULL && htab->use_plts_and_copy_relocs && !htab->is_vxworks) + i_ehdrp->e_ident[EI_ABIVERSION] = MIPS_LIBC_ABI_MIPS_PLT; + if (mips_elf_tdata (abfd)->abiflags.fp_abi == Val_GNU_MIPS_ABI_FP_64 || mips_elf_tdata (abfd)->abiflags.fp_abi == Val_GNU_MIPS_ABI_FP_64A) i_ehdrp->e_ident[EI_ABIVERSION] = MIPS_LIBC_ABI_MIPS_O32_FP64; + /* Mark that we need support for absolute symbols in the dynamic loader. */ + if (htab != NULL && htab->use_absolute_zero) + i_ehdrp->e_ident[EI_ABIVERSION] = MIPS_LIBC_ABI_ABSOLUTE; + _bfd_elf_post_process_headers (abfd, link_info); }