[clang] [lld] [llvm] [X86] Implement disabling APX relocations and EPGR/NDD instrs for relocations (PR #136660)
Feng Zou via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 22 20:11:33 PDT 2025
fzou1 wrote:
> > > > Introduce an option (-mapx-relax-relocations) to control the emission of the new APX relocations. It's off by default to keep backward compatibility with old version of ld and other linkers without APX support. And EGPR and NDD are also suppressed to avoid the instructions updated incorrectly by old version of linkers.
> > >
> > >
> > > Not understand this. IIUC, either we should not emit APX instructions at all, which is controlled by `-m[no-]apxf`, or we should not relax the all the relocations, which is controlled by `-Wl,--no-relax`.
> >
> >
> > If the APX relocation types are emitted in MC, they cannot be recognized by old version of linkers. It leads to APX features unavailable on existing Linux OSes with old version of linkers. `--no-relax` just disables the GOT optimization in linker, and it cannot resolve the link error of unsupported relocation type as mentioned above.
>
> But if you just old relocations for APX instructions and `no-relax` is not used. Wouldn't the old linker do the relaxation incorrectly and silently?
No, the old linker will do wrong thing. Here we added a pass to suppress EGPR and NDD/NF instructions for that.
https://github.com/llvm/llvm-project/pull/136660
More information about the cfe-commits
mailing list