[PATCH 0/3] x86: Add glibc version dependency to prevent run-time failures

H.J. Lu hjl.tools@gmail.com
Mon Aug 18 20:13:19 GMT 2025


There are a few bug fixes in glibc for i386 and x86-64 which prevent
silent run-time failures:

1. There are a GNU2 TLS run-time bug for both i386 and x86-64:

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

and a GNU2 TLS run-time bug only for x86-64:

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

A glibc version tag, GLIBC_ABI_GNU2_TLS, has been added to glibc to
indicate that glibc has the working GNU2 TLS run-time.

3. A glibc version tag, GLIBC_ABI_DT_X86_64_PLT, has been added to x86-64
glibc to indicate that glibc has the commit to ignore r_addend for
R_X86_64_GLOB_DAT/R_X86_64_JUMP_SLOT.

4. There is a GNU TLS run-time bug for i386:

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

A glibc version tag, GLIBC_ABI_GNU_TLS, has been added to glibc to
indicate that glibc has the working GNU TLS run-time.

This patch set updates x86 ELF linker to generate the glibc version tag
dependencies on these tags.

H.J. Lu (3):
  x86: Add GLIBC_ABI_GNU2_TLS version dependency
  x86-64: Add GLIBC_ABI_DT_X86_64_PLT version dependency
  i386: Add GLIBC_ABI_GNU_TLS version dependency

 bfd/elf-bfd.h                         |   4 +-
 bfd/elf-linker-x86.h                  |  17 ++++
 bfd/elf32-i386.c                      |  54 +++++++++-
 bfd/elf64-x86-64.c                    |  50 ++++++++--
 bfd/elflink.c                         | 136 +++++++++++++++-----------
 bfd/elfxx-x86.c                       |   2 +
 bfd/elfxx-x86.h                       |   7 ++
 ld/NEWS                               |  11 +++
 ld/config.in                          |   8 ++
 ld/configure                          |  53 +++++++++-
 ld/configure.ac                       |  38 +++++++
 ld/emulparams/elf32_x86_64.sh         |   2 +-
 ld/emulparams/elf_i386.sh             |   2 +-
 ld/emulparams/elf_i386_fbsd.sh        |   1 +
 ld/emulparams/elf_i386_haiku.sh       |   1 +
 ld/emulparams/elf_x86_64.sh           |   2 +-
 ld/emulparams/elf_x86_64_cloudabi.sh  |   1 +
 ld/emulparams/elf_x86_64_fbsd.sh      |   1 +
 ld/emulparams/elf_x86_64_haiku.sh     |   1 +
 ld/emultempl/elf-i386-glibc.em        |  77 +++++++++++++++
 ld/emultempl/elf-x86-64-glibc.em      |  37 +++++++
 ld/emultempl/elf-x86-64.em            |  68 +++++++++++++
 ld/emultempl/elf-x86-glibc.em         |  70 +++++++++++++
 ld/emultempl/elf-x86.em               |  58 -----------
 ld/emultempl/solaris2-x86-64.em       |  23 +++++
 ld/ld.texi                            |  28 ++++++
 ld/ldlex.h                            |   6 ++
 ld/testsuite/ld-i386/gnu-tls-1.s      |   9 ++
 ld/testsuite/ld-i386/gnu-tls-1a.rd    |   7 ++
 ld/testsuite/ld-i386/gnu-tls-1b.rd    |   4 +
 ld/testsuite/ld-i386/gnu2-tls-1.s     |  11 +++
 ld/testsuite/ld-i386/gnu2-tls-1a.rd   |   7 ++
 ld/testsuite/ld-i386/gnu2-tls-1b.rd   |   4 +
 ld/testsuite/ld-i386/i386.exp         |  39 ++++++++
 ld/testsuite/ld-x86-64/gnu2-tls-1.s   |  11 +++
 ld/testsuite/ld-x86-64/gnu2-tls-1a.rd |   7 ++
 ld/testsuite/ld-x86-64/gnu2-tls-1b.rd |   4 +
 ld/testsuite/ld-x86-64/mark-plt-1a.rd |   2 +-
 ld/testsuite/ld-x86-64/mark-plt-2.rd  |   7 ++
 ld/testsuite/ld-x86-64/mark-plt-2.s   |  13 +++
 ld/testsuite/ld-x86-64/x86-64.exp     |  26 ++++-
 41 files changed, 778 insertions(+), 131 deletions(-)
 create mode 100644 ld/emultempl/elf-i386-glibc.em
 create mode 100644 ld/emultempl/elf-x86-64-glibc.em
 create mode 100644 ld/emultempl/elf-x86-64.em
 create mode 100644 ld/emultempl/elf-x86-glibc.em
 create mode 100644 ld/emultempl/solaris2-x86-64.em
 create mode 100644 ld/testsuite/ld-i386/gnu-tls-1.s
 create mode 100644 ld/testsuite/ld-i386/gnu-tls-1a.rd
 create mode 100644 ld/testsuite/ld-i386/gnu-tls-1b.rd
 create mode 100644 ld/testsuite/ld-i386/gnu2-tls-1.s
 create mode 100644 ld/testsuite/ld-i386/gnu2-tls-1a.rd
 create mode 100644 ld/testsuite/ld-i386/gnu2-tls-1b.rd
 create mode 100644 ld/testsuite/ld-x86-64/gnu2-tls-1.s
 create mode 100644 ld/testsuite/ld-x86-64/gnu2-tls-1a.rd
 create mode 100644 ld/testsuite/ld-x86-64/gnu2-tls-1b.rd
 create mode 100644 ld/testsuite/ld-x86-64/mark-plt-2.rd
 create mode 100644 ld/testsuite/ld-x86-64/mark-plt-2.s

-- 
2.50.1



More information about the Binutils mailing list