public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: "H.J. Lu" <hjl.tools@gmail.com>
Cc: Binutils <binutils@sourceware.org>
Subject: Re: PowerPC64 DT_RELR
Date: Wed, 2 Mar 2022 19:11:18 +1030	[thread overview]
Message-ID: <Yh8trlsqq+dSjZQa@squeak.grove.modra.org> (raw)
In-Reply-To: <CAMe9rOqPN-C9NSBnMt1DBO9wZW8Aikb_ksZ+hROtF1QspYeVPw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 570 bytes --]

I had a look today at DT_RELR again, and found I need to do some work
in the linker.  Just keeping addresses of relative relocs isn't
enough, because data addresses can change between ppc64_elf_size_stubs
and ppc64_elf_build_stubs.  Anyway, the reason for the email is to
inform anyone playing with DT_RELR on powerpc64 that the current
support is definitely experimental!  Also, you might like to apply the
attached patch to gitlab.com/x86-glibc/glibc users/hjl/relr/master
branch.  glibc regressions went from 574 to 17.

-- 
Alan Modra
Australia Development Lab, IBM

[-- Attachment #2: 0006-elf-ELF_DYNAMIC_RELOCATE-order-relr-before-rel-rela.patch --]
[-- Type: text/x-diff, Size: 1192 bytes --]

From 59265b9b769a0423700bd5a34bc9933e859e51c2 Mon Sep 17 00:00:00 2001
From: Alan Modra <amodra@gmail.com>
Date: Wed, 2 Mar 2022 15:34:58 +1030
Subject: [PATCH 6/6] elf: ELF_DYNAMIC_RELOCATE: order relr before rel/rela

ld goes to some trouble to sort relative relocs first, so that ifunc
resolvers that require relocated got entries have them relocated.
Preserve that ordering.

diff --git a/elf/dynamic-link.h b/elf/dynamic-link.h
index 320a9029f2..252f407a12 100644
--- a/elf/dynamic-link.h
+++ b/elf/dynamic-link.h
@@ -188,10 +188,10 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[],
   do {									      \
     int edr_lazy = elf_machine_runtime_setup ((map), (scope), (lazy),	      \
 					      (consider_profile));	      \
-    ELF_DYNAMIC_DO_REL ((map), (scope), edr_lazy, skip_ifunc);		      \
-    ELF_DYNAMIC_DO_RELA ((map), (scope), edr_lazy, skip_ifunc);		      \
     if (((map) != &GL(dl_rtld_map) || DO_RTLD_BOOTSTRAP))		      \
       ELF_DYNAMIC_DO_RELR (map);					      \
+    ELF_DYNAMIC_DO_REL ((map), (scope), edr_lazy, skip_ifunc);		      \
+    ELF_DYNAMIC_DO_RELA ((map), (scope), edr_lazy, skip_ifunc);		      \
   } while (0)
 
 #endif

  reply	other threads:[~2022-03-02  8:41 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-18  0:53 Alan Modra
2022-01-18  1:08 ` H.J. Lu
2022-01-18 13:32   ` H.J. Lu
2022-01-18 23:24     ` Alan Modra
2022-01-19 22:56       ` H.J. Lu
2022-01-22  4:28         ` Alan Modra
2022-01-22 13:04           ` H.J. Lu
2022-01-23 13:51           ` H.J. Lu
2022-03-02  8:41             ` Alan Modra [this message]
2022-03-03  2:33               ` PowerPC64 DT_RELR relative reloc addresses Alan Modra
2022-03-09  1:25               ` PowerPC64 DT_RELR Fangrui Song
     [not found]               ` <MWHPR1201MB0110441CD99C43F8215D15EBCB0A9@MWHPR1201MB0110.namprd12.prod.outlook.com>
2022-03-09 21:07                 ` Alan Modra
2022-06-09 10:57 ` Florian Weimer
2022-06-09 22:57   ` Alan Modra
2022-06-09 23:53     ` Alan Modra

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=Yh8trlsqq+dSjZQa@squeak.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=hjl.tools@gmail.com \
    /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).