This is an archive of the discontinued LLVM Phabricator instance.

[X86] Disabling PLT in Regcall CC Functions
ClosedPublic

Authored by oren_ben_simhon on Apr 24 2017, 6:25 AM.

Details

Summary

According to x86-64 psABI, xmm0-xmm7 can be used to pass function parameters.
However regcall calling convention uses also xmm8-xmm15 to pass function
parameters which violates x86-64 psABI.
Detail info can be found at bugzilla.

We encounter the violation symptom when using PIC with lazy binding optimization.
In that case the PLT mechanism as described in x86_64 psABI will
not preserve xmm8-xmm15 registers and will lead to miscompilation.

The agreed solution is to disable PLT for Regcall calling convention in linux 64 bit.

Diff Detail

Repository
rL LLVM

Event Timeline

aaboud added inline comments.Apr 27 2017, 8:18 AM
lib/Target/X86/X86Subtarget.cpp
146 ↗(On Diff #96389)

[Style]: Fix format (clang-format).

oren_ben_simhon marked an inline comment as done.

Implemented comments posted until 04/30 (Thanks Amjad)

Added the fix to all SystemV ELF based operating systems (Thanks Rafael and David)

This revision was automatically updated to reflect the committed changes.