[0/4] Support APX relocations

Message ID 20231228145804.658337-1-hjl.tools@gmail.com
Headers
Series Support APX relocations |

Message

H.J. Lu Dec. 28, 2023, 2:58 p.m. UTC
  Implement 3 APX relocations in ld and gold:

#define R_X86_64_CODE_4_GOTPCRELX		43
#define R_X86_64_CODE_4_GOTTPOFF		44
#define R_X86_64_CODE_4_GOTPC32_TLSDESC		45

H.J. Lu (4):
  x86-64: Add R_X86_64_CODE_4_GOTPCRELX
  gold: Handle R_X86_64_CODE_4_GOTPCRELX
  x86-64: Add R_X86_64_CODE_4_GOTTPOFF/R_X86_64_CODE_4_GOTPC32_TLSDESC
  Gold: Handle R_X86_64_CODE_4_GOTPC32_TLSDESC/R_X86_64_CODE_4_GOTTPOFF

 bfd/bfd-in2.h                                 |   3 +
 bfd/elf64-x86-64.c                            | 196 ++++++++++++++++--
 bfd/libbfd.h                                  |   3 +
 bfd/reloc.c                                   |   6 +
 elfcpp/x86_64.h                               |  14 +-
 gas/config/tc-i386.c                          |  38 +++-
 gas/config/tc-i386.h                          |   6 +-
 .../gas/i386/ilp32/x86-64-localpic.d          |   4 +-
 gas/testsuite/gas/i386/x86-64-gotpcrel.d      |  12 ++
 gas/testsuite/gas/i386/x86-64-gotpcrel.s      |  19 ++
 gas/testsuite/gas/i386/x86-64-gottpoff.d      |  19 ++
 gas/testsuite/gas/i386/x86-64-gottpoff.s      |  15 ++
 gas/testsuite/gas/i386/x86-64-localpic.d      |   4 +-
 gas/testsuite/gas/i386/x86-64-localpic.s      |   2 +
 gas/testsuite/gas/i386/x86-64-tlsdesc.d       |  17 ++
 gas/testsuite/gas/i386/x86-64-tlsdesc.s       |  13 ++
 gas/testsuite/gas/i386/x86-64.exp             |   3 +
 gas/write.h                                   |   3 +-
 gold/testsuite/Makefile.am                    |  11 +
 gold/testsuite/Makefile.in                    |  17 ++
 gold/testsuite/x86_64_gd_to_le.s              |   1 +
 gold/testsuite/x86_64_gd_to_le.sh             |   1 +
 gold/testsuite/x86_64_ie_to_le.s              |  17 ++
 gold/testsuite/x86_64_ie_to_le.sh             |  29 +++
 gold/testsuite/x86_64_mov_to_lea.sh           |  16 ++
 gold/testsuite/x86_64_mov_to_lea1.s           |   1 +
 gold/testsuite/x86_64_mov_to_lea2.s           |   1 +
 gold/testsuite/x86_64_mov_to_lea3.s           |   1 +
 gold/testsuite/x86_64_mov_to_lea4.s           |   1 +
 gold/testsuite/x86_64_mov_to_lea5.s           |   1 +
 gold/x86_64.cc                                | 193 +++++++++++++----
 include/elf/x86-64.h                          |  12 +-
 ld/testsuite/ld-x86-64/apx-load1.s            |  51 +++++
 ld/testsuite/ld-x86-64/apx-load1a.d           |  54 +++++
 ld/testsuite/ld-x86-64/apx-load1b.d           |  55 +++++
 ld/testsuite/ld-x86-64/apx-load1c.d           |  47 +++++
 ld/testsuite/ld-x86-64/apx-load1d.d           |  47 +++++
 ld/testsuite/ld-x86-64/tlsbindesc.dd          |  49 +++++
 ld/testsuite/ld-x86-64/tlsbindesc.rd          |  36 ++--
 ld/testsuite/ld-x86-64/tlsbindesc.s           |  39 ++++
 ld/testsuite/ld-x86-64/x86-64.exp             |   4 +
 41 files changed, 967 insertions(+), 94 deletions(-)
 create mode 100644 gas/testsuite/gas/i386/x86-64-gottpoff.d
 create mode 100644 gas/testsuite/gas/i386/x86-64-gottpoff.s
 create mode 100644 gas/testsuite/gas/i386/x86-64-tlsdesc.d
 create mode 100644 gas/testsuite/gas/i386/x86-64-tlsdesc.s
 create mode 100644 gold/testsuite/x86_64_ie_to_le.s
 create mode 100755 gold/testsuite/x86_64_ie_to_le.sh
 create mode 100644 ld/testsuite/ld-x86-64/apx-load1.s
 create mode 100644 ld/testsuite/ld-x86-64/apx-load1a.d
 create mode 100644 ld/testsuite/ld-x86-64/apx-load1b.d
 create mode 100644 ld/testsuite/ld-x86-64/apx-load1c.d
 create mode 100644 ld/testsuite/ld-x86-64/apx-load1d.d
  

Comments

H.J. Lu Dec. 28, 2023, 4:57 p.m. UTC | #1
On Thu, Dec 28, 2023 at 6:58 AM H.J. Lu <hjl.tools@gmail.com> wrote:
>
> Implement 3 APX relocations in ld and gold:
>
> #define R_X86_64_CODE_4_GOTPCRELX               43
> #define R_X86_64_CODE_4_GOTTPOFF                44
> #define R_X86_64_CODE_4_GOTPC32_TLSDESC         45
>
> H.J. Lu (4):
>   x86-64: Add R_X86_64_CODE_4_GOTPCRELX
>   gold: Handle R_X86_64_CODE_4_GOTPCRELX
>   x86-64: Add R_X86_64_CODE_4_GOTTPOFF/R_X86_64_CODE_4_GOTPC32_TLSDESC
>   Gold: Handle R_X86_64_CODE_4_GOTPC32_TLSDESC/R_X86_64_CODE_4_GOTTPOFF
>
>  bfd/bfd-in2.h                                 |   3 +
>  bfd/elf64-x86-64.c                            | 196 ++++++++++++++++--
>  bfd/libbfd.h                                  |   3 +
>  bfd/reloc.c                                   |   6 +
>  elfcpp/x86_64.h                               |  14 +-
>  gas/config/tc-i386.c                          |  38 +++-
>  gas/config/tc-i386.h                          |   6 +-
>  .../gas/i386/ilp32/x86-64-localpic.d          |   4 +-
>  gas/testsuite/gas/i386/x86-64-gotpcrel.d      |  12 ++
>  gas/testsuite/gas/i386/x86-64-gotpcrel.s      |  19 ++
>  gas/testsuite/gas/i386/x86-64-gottpoff.d      |  19 ++
>  gas/testsuite/gas/i386/x86-64-gottpoff.s      |  15 ++
>  gas/testsuite/gas/i386/x86-64-localpic.d      |   4 +-
>  gas/testsuite/gas/i386/x86-64-localpic.s      |   2 +
>  gas/testsuite/gas/i386/x86-64-tlsdesc.d       |  17 ++
>  gas/testsuite/gas/i386/x86-64-tlsdesc.s       |  13 ++
>  gas/testsuite/gas/i386/x86-64.exp             |   3 +
>  gas/write.h                                   |   3 +-
>  gold/testsuite/Makefile.am                    |  11 +
>  gold/testsuite/Makefile.in                    |  17 ++
>  gold/testsuite/x86_64_gd_to_le.s              |   1 +
>  gold/testsuite/x86_64_gd_to_le.sh             |   1 +
>  gold/testsuite/x86_64_ie_to_le.s              |  17 ++
>  gold/testsuite/x86_64_ie_to_le.sh             |  29 +++
>  gold/testsuite/x86_64_mov_to_lea.sh           |  16 ++
>  gold/testsuite/x86_64_mov_to_lea1.s           |   1 +
>  gold/testsuite/x86_64_mov_to_lea2.s           |   1 +
>  gold/testsuite/x86_64_mov_to_lea3.s           |   1 +
>  gold/testsuite/x86_64_mov_to_lea4.s           |   1 +
>  gold/testsuite/x86_64_mov_to_lea5.s           |   1 +
>  gold/x86_64.cc                                | 193 +++++++++++++----
>  include/elf/x86-64.h                          |  12 +-
>  ld/testsuite/ld-x86-64/apx-load1.s            |  51 +++++
>  ld/testsuite/ld-x86-64/apx-load1a.d           |  54 +++++
>  ld/testsuite/ld-x86-64/apx-load1b.d           |  55 +++++
>  ld/testsuite/ld-x86-64/apx-load1c.d           |  47 +++++
>  ld/testsuite/ld-x86-64/apx-load1d.d           |  47 +++++
>  ld/testsuite/ld-x86-64/tlsbindesc.dd          |  49 +++++
>  ld/testsuite/ld-x86-64/tlsbindesc.rd          |  36 ++--
>  ld/testsuite/ld-x86-64/tlsbindesc.s           |  39 ++++
>  ld/testsuite/ld-x86-64/x86-64.exp             |   4 +
>  41 files changed, 967 insertions(+), 94 deletions(-)
>  create mode 100644 gas/testsuite/gas/i386/x86-64-gottpoff.d
>  create mode 100644 gas/testsuite/gas/i386/x86-64-gottpoff.s
>  create mode 100644 gas/testsuite/gas/i386/x86-64-tlsdesc.d
>  create mode 100644 gas/testsuite/gas/i386/x86-64-tlsdesc.s
>  create mode 100644 gold/testsuite/x86_64_ie_to_le.s
>  create mode 100755 gold/testsuite/x86_64_ie_to_le.sh
>  create mode 100644 ld/testsuite/ld-x86-64/apx-load1.s
>  create mode 100644 ld/testsuite/ld-x86-64/apx-load1a.d
>  create mode 100644 ld/testsuite/ld-x86-64/apx-load1b.d
>  create mode 100644 ld/testsuite/ld-x86-64/apx-load1c.d
>  create mode 100644 ld/testsuite/ld-x86-64/apx-load1d.d
>
> --
> 2.43.0
>

I will check them in shortly.