http://llvm.org/bugs/show_bug.cgi?id=14697

             Bug #: 14697
           Summary: clang doesn't pass target CPU to linker command for
                    LTO
           Product: clang
           Version: 3.2
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
        AssignedTo: [email protected]
        ReportedBy: [email protected]
                CC: [email protected]
    Classification: Unclassified


Created attachment 9756
  --> http://llvm.org/bugs/attachment.cgi?id=9756
test.c

Clang should pass the chosen target CPU (e.g. -march option) to the linker for
LTO. Currently the target CPU is not passed, which makes LTO assume the target
CPU is "native", i.e. current CPU. This sometimes results in the emitting of
instructions not supported based on the -march option.

To reproduce this problem:

1) Compile the attached C program, on a new CPU which supports 'vxorps' (in my
case, Core i3 2120). Make sure the gold linker is being used. Compile with this
command:

clang -### -g -march=corei7 -O4 -flto test.c -o test

Attached is compiler output. See how corei7 is not being passed to the linker.

2) Disassemble the resulting program (objdump -S test) and notice the 'vxorps'
instruction which should not have been emitted. Disassembly is attached.
Alternatively, run the program on an older Core i7 CPU and see it crash with
SIGILL.

-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to