[LLVMbugs] [Bug 22349] New: Clang 3.6.0 (branches/release_36 227193) segfaults in X86ELFObjectWriter.cpp while compiling Linux kernel real mode asm

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue Jan 27 07:41:21 PST 2015


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

            Bug ID: 22349
           Summary: Clang 3.6.0 (branches/release_36 227193) segfaults in
                    X86ELFObjectWriter.cpp while compiling Linux kernel
                    real mode asm
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: X86
          Assignee: unassignedbugs at nondot.org
          Reporter: marco.cilloni at studio.unibo.it
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 13741
  --> http://llvm.org/bugs/attachment.cgi?id=13741&action=edit
preprocessed source (from llvmlinux kernel sources)

I was trying to build LLVMLinux from the llvmlinux git repo with clang trunk
227188 first, and it segfaulted while assembling
arch/x86/realmode/rm/trampoline_64.S (perhaps it's where the kernel initializes
long mode?).
So I tried with clang 3.6 from branch_36 (branches/release_36 227193) and it
still crashed in the very same point on the very same file. Preprocessed .S
files from the two versions are identical (diff'ed them).

clang 3.5.1 built the kernel just fine, with no issues.  

The stack trace is:

  CC      arch/x86/platform/efi/efi.o
  LD      arch/x86/mm/mmiotrace.o
  LD      arch/x86/mm/built-in.o
  CC      arch/x86/realmode/init.o
  CC      arch/x86/platform/efi/efi_64.o
  CC      arch/x86/kernel/pci-dma.o
  CC      arch/x86/kernel/quirks.o
  AS      arch/x86/realmode/rm/header.o
  AS      arch/x86/realmode/rm/trampoline_64.o
invalid fixup kind!
UNREACHABLE executed at
../lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp:160!
#0 0x148d682 llvm::sys::PrintStackTrace(_IO_FILE*)
(/mnt/data/llvm36/bin/clang-3.6+0x148d682)
#1 0x148ecab SignalHandler(int) (/mnt/data/llvm36/bin/clang-3.6+0x148ecab)
#2 0x7f948904d210 __restore_rt (/usr/lib/libpthread.so.0+0x10210)
#3 0x7f948828da97 __GI_raise (/usr/lib/libc.so.6+0x33a97)
#4 0x7f948828ee6a __GI_abort (/usr/lib/libc.so.6+0x34e6a)
#5 0x1459b95 llvm::llvm_unreachable_internal(char const*, char const*, unsigned
int) (/mnt/data/llvm36/bin/clang-3.6+0x1459b95)
#6 0xdb5394 (anonymous
namespace)::X86ELFObjectWriter::GetRelocType(llvm::MCValue const&,
llvm::MCFixup const&, bool) const (/mnt/data/llvm36/bin/clang-3.6+0xdb5394)
#7 0x12be355 (anonymous
namespace)::ELFObjectWriter::RecordRelocation(llvm::MCAssembler const&,
llvm::MCAsmLayout const&, llvm::MCFragment const*, llvm::MCFixup const&,
llvm::MCValue, bool&, unsigned long&)
(/mnt/data/llvm36/bin/clang-3.6+0x12be355)
#8 0x12d59a5 llvm::MCAssembler::Finish()
(/mnt/data/llvm36/bin/clang-3.6+0x12d59a5)
#9 0x130f7cc (anonymous namespace)::AsmParser::Run(bool, bool)
(/mnt/data/llvm36/bin/clang-3.6+0x130f7cc)
#10 0x6d9c47 cc1as_main(llvm::ArrayRef<char const*>, char const*, void*)
(/mnt/data/llvm36/bin/clang-3.6+0x6d9c47)
#11 0x6d5362 main (/mnt/data/llvm36/bin/clang-3.6+0x6d5362)
#12 0x7f948827a040 __libc_start_main (/usr/lib/libc.so.6+0x20040)
#13 0x6d245e _start (/mnt/data/llvm36/bin/clang-3.6+0x6d245e)
Stack dump:
0.      Program arguments: /mnt/data/llvm36/bin/clang-3.6 -cc1as -triple
i386-unknown-linux-code16 -filetype obj -main-file-name trampoline_64.S
-target-cpu i386 -target-feature -mmx -target-feature -sse -g
-fdebug-compilation-dir /home/marco/llvmlinux -dwarf-debug-producer clang
version 3.6.0 (branches/release_36 227193) -o
arch/x86/realmode/rm/trampoline_64.o /tmp/trampoline_64-0ebf88.s 
1.      Program arguments: -triple i386-unknown-linux-code16 -filetype obj
-main-file-name trampoline_64.S -target-cpu i386 -target-feature -mmx
-target-feature -sse -g -fdebug-compilation-dir /home/marco/llvmlinux
-dwarf-debug-producer clang version 3.6.0 (branches/release_36 227193) -o
arch/x86/realmode/rm/trampoline_64.o /tmp/trampoline_64-0ebf88.s 
  CC      mm/compaction.o
#0 0x148d682 llvm::sys::PrintStackTrace(_IO_FILE*)
(/mnt/data/llvm36/bin/clang-3.6+0x148d682)
#1 0x148ecab SignalHandler(int) (/mnt/data/llvm36/bin/clang-3.6+0x148ecab)
#2 0x7f948904d210 __restore_rt (/usr/lib/libpthread.so.0+0x10210)
#3 0x7f948828da97 __GI_raise (/usr/lib/libc.so.6+0x33a97)
#4 0x7f948828ee6a __GI_abort (/usr/lib/libc.so.6+0x34e6a)
#5 0x1459b95 llvm::llvm_unreachable_internal(char const*, char const*, unsigned
int) (/mnt/data/llvm36/bin/clang-3.6+0x1459b95)
#6 0xdb5394 (anonymous
namespace)::X86ELFObjectWriter::GetRelocType(llvm::MCValue const&,
llvm::MCFixup const&, bool) const (/mnt/data/llvm36/bin/clang-3.6+0xdb5394)
#7 0x12be355 (anonymous
namespace)::ELFObjectWriter::RecordRelocation(llvm::MCAssembler const&,
llvm::MCAsmLayout const&, llvm::MCFragment const*, llvm::MCFixup const&,
llvm::MCValue, bool&, unsigned long&)
(/mnt/data/llvm36/bin/clang-3.6+0x12be355)
#8 0x12d59a5 llvm::MCAssembler::Finish()
(/mnt/data/llvm36/bin/clang-3.6+0x12d59a5)
#9 0x130f7cc (anonymous namespace)::AsmParser::Run(bool, bool)
(/mnt/data/llvm36/bin/clang-3.6+0x130f7cc)
#10 0x6d9c47 cc1as_main(llvm::ArrayRef<char const*>, char const*, void*)
(/mnt/data/llvm36/bin/clang-3.6+0x6d9c47)
#11 0x6d5362 main (/mnt/data/llvm36/bin/clang-3.6+0x6d5362)
#12 0x7f948827a040 __libc_start_main (/usr/lib/libc.so.6+0x20040)
#13 0x6d245e _start (/mnt/data/llvm36/bin/clang-3.6+0x6d245e)
clang-3.6: error: unable to execute command: Aborted (core dumped)
clang-3.6: error: clang integrated assembler command failed due to signal (use
-v to see invocation)
clang version 3.6.0 (branches/release_36 227193)
Target: i386-unknown-linux-code16
Thread model: posix
clang-3.6: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-3.6: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-3.6: note: diagnostic msg: /tmp/trampoline_64-c0a49e.S
clang-3.6: note: diagnostic msg: /tmp/trampoline_64-c0a49e.sh
clang-3.6: note: diagnostic msg: 

********************
  AS      arch/x86/platform/efi/efi_stub_64.o
scripts/Makefile.build:307: recipe for target
'arch/x86/realmode/rm/trampoline_64.o' failed
make[3]: *** [arch/x86/realmode/rm/trampoline_64.o] Error 254
arch/x86/realmode/Makefile:18: recipe for target
'arch/x86/realmode/rm/realmode.bin' failed
make[2]: *** [arch/x86/realmode/rm/realmode.bin] Error 2
scripts/Makefile.build:416: recipe for target 'arch/x86/realmode' failed
make[1]: *** [arch/x86/realmode] Error 2
make[1]: *** Waiting for unfinished jobs....

The two run scripts are:

trampoline_64-489e6f.sh:

 "/mnt/data/llvm-trunk/bin/clang-3.7" "-cc1as" "-triple"
"i386-unknown-linux-code16" "-filetype" "obj" "-main-file-name"
"trampoline_64.S" "-target-cpu" "i386" "-target-feature" "-mmx"
"-target-feature" "-sse" "-g" "-dwarf-debug-producer" "clang version 3.7.0
(trunk 227188)" "/tmp/trampoline_64-47e829.s"

trampoline_64-c0a49e.sh:

 "/mnt/data/llvm36/bin/clang-3.6" "-cc1as" "-triple"
"i386-unknown-linux-code16" "-filetype" "obj" "-main-file-name"
"trampoline_64.S" "-target-cpu" "i386" "-target-feature" "-mmx"
"-target-feature" "-sse" "-g" "-dwarf-debug-producer" "clang version 3.6.0
(branches/release_36 227193)" "/tmp/trampoline_64-0ebf88.s"

I've also attached the preprocessed .S file from the 3.6 segfault.

All the versions of Clang and LLVM I've mentioned have been built with Clang
3.5.1 on Arch Linux (x86_64, linux 3.18.2, gibc 2.20, gcc 4.9.2). LLVM/Clang
3.5.1 is also custom built (not the one shipped by the distro).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20150127/df514ef2/attachment.html>


More information about the llvm-bugs mailing list