Bug ID: 36329
           Summary: [X86_32] Miscompilation with __llvm_retpoline_push
           Product: libraries
           Version: 6.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Backend: X86

Created attachment 19849
Config file for kernel build

After a call via __llvm_retpoline_push, code in the calling function seems
confused about where %esp points.

Reproduced with llvm/clang master (r324745 / r324741 resp.) and also with 6.0
branch (r324726 / r324719 resp) with r326645 added to the latter.

To reproduce:

  git clone git://
  cd linux-retpoline
  git checkout clang
  cp /where/you/downloaded/the/attached/config .config
  make CC=/where/is/your/clang bzImage
  qemu-system-i386  -display none -serial stdio -kernel arch/x86/boot/bzImage 
-append earlyprintk=ttyS0,keep

Observe the output from mp_register_ioapic():
[    0.000000] mp_register_ioapic, 0 fec00000 0 c1b31e88
[    0.000000] At line 412, gsi_base is 0
[    0.000000] At line 425, gsi_base is -1043707140
[    0.000000] At line 427, gsi_base is -1043707140

Between line 412 and 425, gsi_base got clobbered.

Now uncomment the CFLAGS_io_apic_b line in arch/x86/kernel/apic/Makefile and
repeat, to disable the retpoline. Observe the problem go away.

To eliminate the external thunks as a cause of this problem, also retest with
CFLAGS_io_apic_b.o += -mno-retpoline-external-thunk -mretpoline
The problem persists even when we let LLVM emit its own thunks.

You are receiving this mail because:
You are on the CC list for the bug.
llvm-bugs mailing list

Reply via email to