LDC with MSP430

Luís Marques via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Wed Jul 5 11:16:39 PDT 2017


On Tuesday, 20 June 2017 at 15:29:35 UTC, Luís Marques wrote:
> FYI: My first quick test compiled fine (to assembly; I don't 
> think the target supports object file generation; I have to 
> finish assembly and linking with the gnu tools, like I did for 
> RISC-V).

It seems that `clang --target=msp430 -c test.c` generates an 
object file successfully, while `ldc2 -O2 -mtriple=msp430 -c 
test.d` fails:

```
no support for asm output
UNREACHABLE executed at ../driver/toobj.cpp:130!
0  ldc2                     0x0000000107e19c9c 
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 60
1  ldc2                     0x0000000107e1a1e9 
PrintStackTraceSignalHandler(void*) + 25
2  ldc2                     0x0000000107e16139 
llvm::sys::RunSignalHandlers() + 425
3  ldc2                     0x0000000107e1a642 SignalHandler(int) 
+ 354
4  libsystem_platform.dylib 0x00007fffa0ad5b3a _sigtramp + 26
5  libsystem_platform.dylib 0x0000000000000003 _sigtramp + 
1599251683
6  libsystem_c.dylib        0x00007fffa095a420 abort + 129
7  ldc2                     0x0000000107d246c0 
LLVMInstallFatalErrorHandler + 0
8  ldc2                     0x0000000105efd2a7 
codegenModule(llvm::TargetMachine&, llvm::Module&, 
llvm::raw_fd_ostream&, llvm::TargetMachine::CodeGenFileType) + 391
9  ldc2                     0x0000000105f00ab9 (anonymous 
namespace)::writeObjectFile(llvm::Module*, char const*) + 377
10 ldc2                     0x0000000105efcc05 
writeModule(llvm::Module*, char const*) + 10517
11 ldc2                     0x0000000105ee6162 
ldc::CodeGenerator::writeAndFreeLLModule(char const*) + 1602
12 ldc2                     0x0000000105ee6a82 
ldc::CodeGenerator::finishLLModule(Module*) + 130
13 ldc2                     0x0000000105ee880c 
ldc::CodeGenerator::emit(Module*) + 1420
14 ldc2                     0x0000000105f36e4e 
codegenModules(Array<Module*>&) + 574
15 ldc2                     0x0000000105bf2a00 
mars_mainBody(Array<char const*>&, Array<char const*>&) + 5120
Abort trap: 6
```

Curiously, if you do `clang --target=msp430 -S -emit-llvm test.c` 
and then you try to generate the object file from test.ll, llc 
fails:

```
llc -filetype=obj test.ll
/opt/msp430/bin/llc: target does not support generation of this 
file type!
```

Any idea on how we can get LDC to generate object files directly?


More information about the digitalmars-d-ldc mailing list