iOS arm64 manages to crash LLVM

Péter Szilágyi peterke at gmail.com
Thu Dec 3 18:14:30 UTC 2015


Solved it. It was a bug in clang 3.6. I've switched over to clang 3.7 and
the issue disappeared.

On Thu, Dec 3, 2015 at 7:28 PM, Péter Szilágyi <peterke at gmail.com> wrote:

> Hey all,
>
>   This is probably not something that you guys can do much about, but
> thought I'd ask anyway. I've successfully compiled gmplib to iOS ARMv7, but
> when trying to do the same for ARM64, my compiler actually chokes with a
> hard crash on the generated files. I really have no clue where the error
> might come from so I figured I'd ping you too if you have any ideas. Note,
> I can compile C/C++ programs with the compiler, so the issue isn't
> necessarily a bad compiler.
>
>   I configured with
>
> CC=arm-apple-darwin11-clang ./configure --disable-shared
> --host=aarch64-apple-darwin11 --disable-assembly
>
> And on make install, it builds for a while, then crashes with:
>
> libtool: compile:  arm-apple-darwin11-clang -DHAVE_CONFIG_H -I. -I..
> -D__GMP_WITHIN_GMP -I.. -DOPERATION_divrem -mfpu=neon -O2 -pedantic
> -DNO_ASM -c divrem.c -o divrem.o
> clang: warning: argument unused during compilation: '-mfpu=neon'
> 0  libLLVM-3.6.so.1 0x00007fa1a7ff0572
> llvm::sys::PrintStackTrace(_IO_FILE*) + 50
> 1  libLLVM-3.6.so.1 0x00007fa1a7feecb9
> 2  libpthread.so.0  0x00007fa1a70c1d10
> 3  libLLVM-3.6.so.1 0x00007fa1a7dff927
> llvm::MachineInstr::addOperand(llvm::MachineFunction&, llvm::MachineOperand
> const&) + 23
> 4  libLLVM-3.6.so.1 0x00007fa1a871b725
> llvm::AArch64InstrInfo::storeRegToStackSlot(llvm::MachineBasicBlock&,
> llvm::MachineBasicBlock::bundle_iterator<llvm::MachineInstr,
> llvm::ilist_iterator<llvm::MachineInstr> >, unsigned int, bool, int,
> llvm::TargetRegisterClass const*, llvm::TargetRegisterInfo const*) const +
> 1541
> 5  libLLVM-3.6.so.1 0x00007fa1a7d81bcc
> 6  libLLVM-3.6.so.1 0x00007fa1a7d85b30
> 7  libLLVM-3.6.so.1 0x00007fa1a7e79030
> 8  libLLVM-3.6.so.1 0x00007fa1a7e7ccfb
> 9  libLLVM-3.6.so.1 0x00007fa1a7e6b4f6
> llvm::RegAllocBase::allocatePhysRegs() + 198
> 10 libLLVM-3.6.so.1 0x00007fa1a7e7d88c
> 11 libLLVM-3.6.so.1 0x00007fa1a79daa97
> llvm::FPPassManager::runOnFunction(llvm::Function&) + 487
> 12 libLLVM-3.6.so.1 0x00007fa1a79dad2b
> llvm::FPPassManager::runOnModule(llvm::Module&) + 43
> 13 libLLVM-3.6.so.1 0x00007fa1a79da6f4
> llvm::legacy::PassManagerImpl::run(llvm::Module&) + 772
> 14 clang            0x0000000000872c43
> clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::CodeGenOptions
> const&, clang::TargetOptions const&, clang::LangOptions const&,
> llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*) +
> 3267
> 15 clang            0x00000000008632fb
> 16 clang            0x0000000000a21a2a clang::ParseAST(clang::Sema&, bool,
> bool) + 826
> 17 clang            0x00000000006dc1c6 clang::FrontendAction::Execute() +
> 118
> 18 clang            0x00000000006b5669
> clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) + 313
> 19 clang            0x000000000069c613
> clang::ExecuteCompilerInvocation(clang::CompilerInstance*) + 1939
> 20 clang            0x0000000000697ae8 cc1_main(llvm::ArrayRef<char
> const*>, char const*, void*) + 1304
> 21 clang            0x0000000000694b62 main + 962
> 22 libc.so.6        0x00007fa1a676ea40 __libc_start_main + 240
> 23 clang            0x00000000006970b9 _start + 41
> Stack dump:
> 0. Program arguments: /usr/lib/llvm-3.6/bin/clang -cc1 -triple
> arm64-apple-ios6.0.0 -Wdeprecated-objc-isa-usage
> -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration
> -emit-obj -disable-free -disable-llvm-verifier -main-file-name divrem.c
> -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim
> -masm-verbose -target-cpu cyclone -target-feature +neon -target-feature
> +crc -target-feature +crypto -target-feature +zcm -target-feature +zcz
> -target-abi darwinpcs -target-linker-version 253.3 -dwarf-column-info
> -coverage-file /deps-build/gmp-6.1.0/mpn/divrem.o -resource-dir
> /usr/lib/llvm-3.6/bin/../lib/clang/3.6.2 -isysroot
> /usr/local/ios-ndk-arm64/bin/../SDK -D HAVE_CONFIG_H -D __GMP_WITHIN_GMP -D
> OPERATION_divrem -D NO_ASM -I . -I .. -I .. -O2 -pedantic
> -fdebug-compilation-dir /deps-build/gmp-6.1.0/mpn -ferror-limit 19
> -fmessage-length 0 -stack-protector 1 -mstackrealign
> -fallow-half-arguments-and-returns -fblocks -fobjc-runtime=ios-6.0.0
> -fencode-extended-block-signature -fmax-type-align=16
> -fdiagnostics-show-option -vectorize-loops -vectorize-slp -o divrem.o -x c
> divrem.c
> 1. <eof> parser at end of file
> 2. Code generation
> 3. Running pass 'Function Pass Manager' on module 'divrem.c'.
> 4. Running pass 'Greedy Register Allocator' on function '@__gmpn_divrem'
> clang: error: unable to execute command: Segmentation fault (core dumped)
> clang: error: clang frontend command failed due to signal (use -v to see
> invocation)
> Ubuntu clang version 3.6.2-1 (tags/RELEASE_362/final) (based on LLVM 3.6.2)
> Target: aarch64-apple-darwin11
> Thread model: posix
> clang: note: diagnostic msg: PLEASE submit a bug report to
> http://bugs.debian.org/ and include the crash backtrace, preprocessed
> source, and associated run script.
> clang: note: diagnostic msg:
> ********************
>
> PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
> Preprocessed source(s) and associated run script(s) are located at:
> clang: note: diagnostic msg: /tmp/divrem-7d3b68.c
> clang: note: diagnostic msg: /tmp/divrem-7d3b68.sh
> clang: note: diagnostic msg:
>
> ********************
> Makefile:492: recipe for target 'divrem.lo' failed
> make[2]: Leaving directory '/deps-build/gmp-6.1.0/mpn'
> make[2]: *** [divrem.lo] Error 1
> Makefile:954: recipe for target 'install-recursive' failed
> make[1]: Leaving directory '/deps-build/gmp-6.1.0'
> Makefile:1254: recipe for target 'install' failed
> make[1]: *** [install-recursive] Error 1
> make: *** [install] Error 2
>
> The two files mentioned by the crash report can be found at:
> https://www.dropbox.com/sh/bu6pmpc1n1prgoh/AADAg59xevP4_jt5TrTTLKxLa?dl=0
>
> Thanks,
>   Peter
>


More information about the gmp-bugs mailing list