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

Florian Weimer <fweimer at redhat dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |fweimer at redhat dot com

--- Comment #1 from Florian Weimer <fweimer at redhat dot com> ---
Apparently, it's deliberate:

static void
elf_x86_64_add_glibc_version_dependency
  (struct elf_find_verdep_info *rinfo)
{
  unsigned int i = 0;
  const char *version[3] = { NULL, NULL, NULL };
  struct elf_x86_link_hash_table *htab;

  if (rinfo->info->enable_dt_relr)
    {
      version[i] = "GLIBC_ABI_DT_RELR";
      i++;
    }

  htab = elf_x86_hash_table (rinfo->info, X86_64_ELF_DATA);
  if (htab != NULL && htab->params->mark_plt)
    {
      version[i] = "GLIBC_2.36";
      i++;
    }

  if (i != 0)
    _bfd_elf_link_add_glibc_version_dependency (rinfo, version);
}

Sneaky.

commit 9167304255940e29423517f63d11bdd968d7685e
Author: H.J. Lu <hjl.to...@gmail.com>
Date:   Fri May 19 15:11:51 2023 -0700

    elf: Add elf_backend_add_glibc_version_dependency

    When -z mark-plt is used to add DT_X86_64_PLT, DT_X86_64_PLTSZ and
    DT_X86_64_PLTENT, the r_addend field of the R_X86_64_JUMP_SLOT relocation
    stores the offset of the indirect branch instruction.  However, glibc
    versions which don't have this commit in glibc 2.36:

    commit f8587a61892cbafd98ce599131bf4f103466f084
    Author: H.J. Lu <hjl.to...@gmail.com>
    Date:   Fri May 20 19:21:48 2022 -0700

        x86-64: Ignore r_addend for R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT

        According to x86-64 psABI, r_addend should be ignored for
R_X86_64_GLOB_DAT
        and R_X86_64_JUMP_SLOT.  Since linkers always set their r_addends to 0,
we
        can ignore their r_addends.

        Reviewed-by: Fangrui Song <mask...@google.com>

    won't ignore the r_addend value in the R_X86_64_JUMP_SLOT relocation.
    Although this commit has been backported to glibc 2.33/2.34/2.35 release
    branches, it is safer to require glibc 2.36 for such binaries.

    Extend the glibc version dependency of GLIBC_ABI_DT_RELR for DT_RELR to
    also add GLIBC_2.36 version dependency for -z mark-plt on the shared C
    library if it provides a GLIBC_2.XX symbol version.

            * elflink.c (elf_find_verdep_info): Moved to ...
            * elf-bfd.h (elf_find_verdep_info): Here.
            (elf_backend_data): Add elf_backend_add_glibc_version_dependency.
            (_bfd_elf_link_add_glibc_version_dependency): New function.
            (_bfd_elf_link_add_dt_relr_dependency): Likewise.
            * elf64-x86-64.c (elf_x86_64_add_glibc_version_dependency):
            Likewise.
            (elf_backend_add_glibc_version_dependency): New.
            * elflink.c (elf_link_add_dt_relr_dependency): Renamed to ...
            (elf_link_add_glibc_verneed): This.  Modified to support other
            glibc dependencies.
            (_bfd_elf_link_add_glibc_version_dependency): Likewise.
            (_bfd_elf_link_add_dt_relr_dependency): Likewise.
            (bfd_elf_size_dynamic_sections): Call
            elf_backend_add_glibc_version_dependency instead of
            elf_link_add_dt_relr_dependency.
            * elfxx-target.h (elf_backend_add_glibc_version_dependency): New.
            (elfNN_bed): Add elf_backend_add_glibc_version_dependency.

    ld/

            * testsuite/ld-x86-64/mark-plt-1a.rd: New file.
            * testsuite/ld-x86-64/mark-plt-1b.rd: Likewise.
            * testsuite/ld-x86-64/x86-64.exp: Run -z mark-plt test for
            GLIBC_2.36 dependency.

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

Reply via email to