public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "adhemerval.zanella at linaro dot org" <sourceware-bugzilla@sourceware.org>
To: glibc-bugs@sourceware.org
Subject: [Bug libc/29651] glibc can't handle IRELATIVE in .rel.plt only on ARM32 and PPC
Date: Fri, 14 Oct 2022 12:16:35 +0000	[thread overview]
Message-ID: <bug-29651-131-jVgKrZLmid@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-29651-131@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=29651

--- Comment #3 from Adhemerval Zanella <adhemerval.zanella at linaro dot org> ---
Since IFUNC support was added in a most ad-hoc way for each architecture, there
is no unified code to generate it with binutils or to handle on glibc.

We can implement your suggestion and add support for .rel.plt IRELATIVE
handling on arm and PPC, however it will only work for linkes that implement it
and there will be issues on how to avoid such binaries to run on older glibcs. 

The glibc now avoids random failures if there is missing support and instead
dumps an error on why it has failed.

So essentially this change for ARM and PPC will be similar to what we have done
for DT_RELR: we will need the static linker to advertise that IFUNC is now
placed on .rel.plt instead of .rel.dyn so glibc can avoid starting the binary
if it has no support.  For DT_RELR both binutils and lld now add an extra
version tag GLIBC_ABI_DT_RELR on .gnu.version_r to indicate it.  For instance
on a glibc binary built with DT_RELR support:

Version needs section '.gnu.version_r' contains 1 entry:
 Addr: 0x0000000000000998  Offset: 0x000998  Link: 7 (.dynstr)
  000000: Version: 1  File: libc.so.6  Cnt: 4
  0x0010:   Name: GLIBC_ABI_DT_RELR  Flags: none  Version: 5
  0x0020:   Name: GLIBC_2.4  Flags: none  Version: 4
  0x0030:   Name: GLIBC_2.34  Flags: none  Version: 3
  0x0040:   Name: GLIBC_2.2.5  Flags: none  Version: 2

Older glibcs will fails with a missing GLIBC_ABI_DT_RELR version trying to bind
the version.

So if we want to add support for IRELATE on .rel.plt for ARM and PPC we need a
similar change, where static linkers add a GLIBC_ABI_IFUNC_REL_PLT version tag.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2022-10-14 12:16 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-04  2:39 [Bug libc/29651] New: " rui314 at gmail dot com
2022-10-04  2:43 ` [Bug libc/29651] " rui314 at gmail dot com
2022-10-13 17:41 ` adhemerval.zanella at linaro dot org
2022-10-14  1:48 ` rui314 at gmail dot com
2022-10-14 12:16 ` adhemerval.zanella at linaro dot org [this message]
2022-10-14 13:40 ` adhemerval.zanella at linaro dot org
2022-10-15  2:06 ` rui314 at gmail dot com

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=bug-29651-131-jVgKrZLmid@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=glibc-bugs@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).