public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "Maciej W. Rozycki" <macro@mips.com>
To: Florian Weimer <fweimer@redhat.com>
Cc: <libc-alpha@sourceware.org>, Alan Modra <amodra@gmail.com>
Subject: Re: [PATCH 2/2] libc-abis: Define ABSOLUTE ABI [BZ #19818][BZ #23307]
Date: Thu, 28 Jun 2018 13:49:00 -0000	[thread overview]
Message-ID: <alpine.DEB.2.00.1806280905490.20622@tp.orcam.me.uk> (raw)
In-Reply-To: <d1ee54d8-9491-28cb-3fcf-b13408d47b6a@redhat.com>

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:

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);
 }
 
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

  reply	other threads:[~2018-06-28 13:49 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-18 18:06 [PATCH 0/2] Accept absolute symbols whose value is zero [BZ #23307] Maciej W. Rozycki
2018-06-18 18:08 ` [PATCH 2/2] libc-abis: Define ABSOLUTE ABI [BZ #19818][BZ #23307] Maciej W. Rozycki
2018-06-25 20:33   ` Florian Weimer
2018-06-27 22:08     ` Maciej W. Rozycki
2018-06-28  6:59       ` Florian Weimer
2018-06-28 13:49         ` Maciej W. Rozycki [this message]
2018-06-28 13:54           ` Florian Weimer
2018-06-28 14:54             ` Maciej W. Rozycki
2018-06-29 16:29               ` Maciej W. Rozycki
2018-07-03 13:53                 ` Carlos O'Donell
2018-07-05 15:42                   ` [PATCH v2 " Maciej W. Rozycki
2018-07-05 16:29                     ` Carlos O'Donell
2018-07-05 17:10                       ` Maciej W. Rozycki
2018-07-05 18:02                         ` Carlos O'Donell
2018-06-18 18:08 ` [PATCH 1/2] elf: Accept absolute (SHN_ABS) symbols whose value is zero [BZ #23307] Maciej W. Rozycki
2018-06-25 20:25   ` Florian Weimer
2018-06-29 16:13     ` [committed v2 " Maciej W. Rozycki
2018-06-29 17:41       ` Joseph Myers
2018-06-29 18:05         ` Maciej W. Rozycki
2018-06-25 19:14 ` [PING][PATCH 0/2] Accept absolute " Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.00.1806280905490.20622@tp.orcam.me.uk \
    --to=macro@mips.com \
    --cc=amodra@gmail.com \
    --cc=fweimer@redhat.com \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).