brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · d525448 Raw
45 lines · plain
1; RUN: llc -mtriple=x86_64-unknown-linux-gnu -relocation-model=pic < %s | FileCheck %s2; RUN: llc -mtriple=x86_64-freebsd -relocation-model=pic < %s | FileCheck %s3 4;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;5;; According to x86-64 psABI, xmm0-xmm7 can be used to pass function parameters.  6;; However regcall calling convention uses also xmm8-xmm15 to pass function  7;; parameters which violates x86-64 psABI. 8;; Detail info about it can be found at:9;; https://sourceware.org/bugzilla/show_bug.cgi?id=2126510;;11;; We encounter the violation symptom when using PIC with lazy binding 12;; optimization.13;; In that case the PLT mechanism as described in x86_64 psABI will14;; not preserve xmm8-xmm15 registers and will lead to miscompilation.15;;16;; The agreed solution is to disable PLT for regcall calling convention for 17;; SystemV using ELF format.18;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;19 20declare void @lazy()21declare x86_regcallcc void @regcall_not_lazy()22 23; CHECK-LABEL: foo:24; CHECK:  callq lazy@PLT25; CHECK:  callq *regcall_not_lazy@GOTPCREL(%rip)26define void @foo() nounwind {27  call void @lazy()28  call void @regcall_not_lazy()29  ret void30}31 32; CHECK-LABEL: tail_call_regcall:33; CHECK:   jmpq *regcall_not_lazy@GOTPCREL(%rip)34define void @tail_call_regcall() nounwind {35  tail call void @regcall_not_lazy()36  ret void37}38 39; CHECK-LABEL: tail_call_regular:40; CHECK:   jmp lazy41define void @tail_call_regular() nounwind {42  tail call void @lazy()43  ret void44}45