[clang] [lld] [llvm] [X86, lld] Add relocation R_X86_64_REX2_GOTPCRELX (PR #106681)

Shengchen Kan via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 5 18:18:08 PDT 2024


KanRobert wrote:

> I suppose the name of relocation used by binutils is R_X86_64_CODE_4_GOTPCRELX Also binutils has added R_X86_64_CODE_5_GOTPCRELX/R_X86_64_CODE_6_GOTPCRELX, for evex relocation Refer to [bminor/binutils-gdb at 3d5a60d](https://github.com/bminor/binutils-gdb/commit/3d5a60de52556f6a53d71d7e607c6696450ae3e4) and [bminor/binutils-gdb at 5bc71c2](https://github.com/bminor/binutils-gdb/commit/5bc71c2a6b8efb27089baa1fecded82be4f550a7)

This is the first patch and `R_X86_64_CODE_6_GOTPCRELX` will be added later. `R_X86_64_CODE_5_GOTPCRELX` is only for possible future instructions and whether adding it as placeholder is optional.

I mentioned `R_X86_64_CODE_4_GOTPCRELX` in the description but I prefer `R_X86_64_REX2_GOTPCRELX` personally. Binutils use the former name for possible future instructions w/ 2-byte prefix other than REX2 (see discussion https://groups.google.com/g/x86-64-abi/c/KbzaNHRB6QU).  AFAIKC, the probability is quite low for the general GPR32 design, i.e. `REX2` is already 2-byte long, future prefix should be longer than 2 byte if we need GPR32 at the same time.  And according to that design, probably we should rename  `R_X86_64_REX_GOTPCRELX` to `R_X86_64_CODE_3_GOTPCRELX`. 

If the reviewers prefer the `CODE_4` name, I will update the PR.



https://github.com/llvm/llvm-project/pull/106681


More information about the cfe-commits mailing list