[LLVMdev] STM8 backend for Clang

Andreas Färber andreas.faerber at web.de
Sat Feb 26 02:20:47 PST 2011


Am 21.02.2011 um 02:44 schrieb Eli Friedman:

> On Sun, Feb 20, 2011 at 4:23 PM, Andreas Färber <andreas.faerber at web.de 
> > wrote:
>> [...] I've put together enough skeleton code to successfully
>> compile, but on Mac OS X v10.5 ppc host this is what I get:
>>
>> $ Debug+Asserts/bin/clang -ccc-host-triple stm8-unknown-elf ../ 
>> hello.c
>> -S -o ../hello.s
>> 0  clang             0x0168c4f0
>> llvm::SearchForAddressOfSpecialSymbol(char const*) + 448
>> 1  clang             0x0168cc8c llvm::sys::RunInterruptHandlers() +  
>> 456
>> 2  libSystem.B.dylib 0x9422d9fc _sigtramp + 68
>> 3  clang             0x0159692c std::_Rb_tree<void const*,
>> std::pair<void const* const, llvm::Pass*>,
>> std::_Select1st<std::pair<void const* const, llvm::Pass*> >,
>> std::less<void const*>, std::allocator<std::pair<void const* const,
>> llvm::Pass*> > >::_M_insert(std::_Rb_tree_node_base*,
>> std::_Rb_tree_node_base*, std::pair<void const* const, llvm::Pass*>
>> const&) + 132
>> 4  clang             0x0f1c1cc0 std::_Rb_tree<void const*,
>> std::pair<void const* const, llvm::Pass*>,
>> std::_Select1st<std::pair<void const* const, llvm::Pass*> >,
>> std::less<void const*>, std::allocator<std::pair<void const* const,
>> llvm::Pass*> > >::_M_insert(std::_Rb_tree_node_base*,
>> std::_Rb_tree_node_base*, std::pair<void const* const, llvm::Pass*>
>> const&) + 230863896
>> Stack dump:
>> 0.      Program arguments: /Users/andreas/STM8S-Discovery/llvm-stm8/ 
>> Debug
>> +Asserts/bin/clang -cc1 -triple stm8-unknown-elf -S -disable-free -
>> main-file-name hello.c -mrelocation-model static -mdisable-fp-elim -
>> mconstructor-aliases -target-linker-version 85.2.1 -momit-leaf-frame-
>> pointer -resource-dir /Users/andreas/STM8S-Discovery/llvm-stm8/Debug
>> +Asserts/bin/../lib/clang/2.9 -ferror-limit 19 -fmessage-length 274 -
>> fgnu-runtime -fdiagnostics-show-option -fcolor-diagnostics -o ../
>> hello.s -x c ../hello.c
>> 1.      <eof> parser at end of file
>> clang: error: unable to execute command: Bus error
>> clang: error: clang frontend command failed due to signal 1 (use -v  
>> to
>> see invocation)
>>
>> Same for stm8-unknown-none. Configured with --enable-
>> targets=host,stm8. (It still works for the default Darwin/ppc  
>> target.)
>>
>> I'm fairly sure there's things I haven't implemented yet but I'm
>> missing an assertion or error message as hint where to continue.
>> Neither printf()s nor gdb breakpoints in the above
>> llvm::SearchForAddressOfSpecialSymbol() are reached.
>>
>> Any hint what's going wrong or how to debug? Thanks!
>
> Try valgrind?  That looks like some sort of memory corruption bug.

Not being familiar with valgrind, I went on to implement some random  
parts of the backend and it seems the above error was resolved by  
overriding the remaining get*Info() methods of LLVMTargetMachine. I've  
filed a ticket:

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

Andreas



More information about the llvm-dev mailing list