[clang] [lld] [llvm] [X86][APX] Suppress EGPR/NDD instructions for relocations (PR #136660)

Shengchen Kan via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 28 21:59:14 PDT 2025


KanRobert wrote:

> Suppress EGPR/NDD instructions for relocations to avoid APX relocation types emitted. This is to keep backward compatibility with old version of ld and other linkers without APX support. If there are APX relocation types, old version of linkers would raise "unsupported relocation type" error. Example:
> 
> ```
> $ llvm-mc -filetype=obj -o got.o -triple=x86_64-unknown-linux got.s
> $ ld got.o -o got.exe
> ld: got.o: unsupported relocation type 0x2b
> ...
> 
> $ cat got.s
> ...
> movq foo at GOTPCREL(%rip), %r16
> 
> $ llvm-objdump -dr got.o
> ...
> 1: d5 48 8b 05 00 00 00 00       movq    (%rip), %r16
> 0000000000000005:  R_X86_64_CODE_4_GOTPCRELX    foo-0x4
> ```

Could you add who is the user for such request:  LLVM + APX + old BFD linker?
The code looks like a dirty workaround. I expect a real user.

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


More information about the cfe-commits mailing list