[v2,0/3] LoongArch: Modify the method of obtaining symbolic addresses.

Message ID 20220721064123.2981805-1-chenglulu@loongson.cn
Headers
Series LoongArch: Modify the method of obtaining symbolic addresses. |

Message

Lulu Cheng July 21, 2022, 6:41 a.m. UTC
  1. The original LA macro instruction is split into two instructions to
   obtain the address of the symbol if enable '-mexplicit-relocs'.
2. Currently, '-mcmodel=' only supports 'normal' mode, because other mode
   behaviors are not yet determined. This function is gradually improved
   by the subsequent handling.
3. The method that calls global functions from 'la.global + jirl' to 'bl'
   when build with '-fplt'.
4. Some R_LARCH_64 in section .eh_frame will to generate  R_LARCH_NONE, we
   change ASM_PREFERRED_EH_DATA_FORMAT from 'WD_EH_PE_absptr' to
   'WD_EH_PE_pcrel | DW_EH_PE_sdata4' then relocation to R_LARCH_32_PCREL
   from R_LARCH_64 in setction .eh_frame and not generate dynamic relocation
   for R_LARCH_32_PCREL.

This new symbol loading method not support by upstream binutils yet,
this GCC port requires the following patches applied to binutils to build.

  [1]https://sourceware.org/pipermail/binutils/2022-July/121933.html
  [2]https://sourceware.org/pipermail/binutils/2022-July/121937.html
  [3]https://sourceware.org/pipermail/binutils/2022-July/121934.html
  [4]https://sourceware.org/pipermail/binutils/2022-July/121935.html
  [5]https://sourceware.org/pipermail/binutils/2022-July/121936.html
  [6]https://sourceware.org/pipermail/binutils/2022-July/121938.html
  [7]https://sourceware.org/pipermail/binutils/2022-July/121939.html


Lulu Cheng (3):
  LoongArch: Subdivision symbol type, add SYMBOL_PCREL support.
  LoongArch: Support split symbol.
  LoongArch: Modify the definition of the ASM_PREFERRED_EH_DATA_FORMAT
    macro.

 .../config/loongarch/loongarch-common.cc      |   1 +
 gcc/config/loongarch/constraints.md           |  24 +-
 gcc/config/loongarch/genopts/loongarch.opt.in |   4 +
 gcc/config/loongarch/loongarch-protos.h       |  10 +-
 gcc/config/loongarch/loongarch.cc             | 652 +++++++++++++-----
 gcc/config/loongarch/loongarch.h              |   4 +-
 gcc/config/loongarch/loongarch.md             | 401 +++--------
 gcc/config/loongarch/loongarch.opt            |   4 +
 gcc/config/loongarch/predicates.md            |  56 +-
 .../gcc.target/loongarch/func-call-1.c        |  32 +
 .../gcc.target/loongarch/func-call-2.c        |  32 +
 .../gcc.target/loongarch/func-call-3.c        |  32 +
 .../gcc.target/loongarch/func-call-4.c        |  32 +
 .../gcc.target/loongarch/func-call-5.c        |  33 +
 .../gcc.target/loongarch/func-call-6.c        |  33 +
 .../gcc.target/loongarch/func-call-7.c        |  34 +
 .../gcc.target/loongarch/func-call-8.c        |  33 +
 .../loongarch/relocs-symbol-noaddend.c        |  23 +
 18 files changed, 905 insertions(+), 535 deletions(-)
 create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-1.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-2.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-3.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-4.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-5.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-6.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-7.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/func-call-8.c
 create mode 100644 gcc/testsuite/gcc.target/loongarch/relocs-symbol-noaddend.c