LDC with MSP430

Luís Marques via digitalmars-d-ldc digitalmars-d-ldc at puremagic.com
Tue Jun 20 01:59:05 PDT 2017


On Tuesday, 20 June 2017 at 06:52:05 UTC, Nicholas Wilson wrote:
> What data layout is being used? Can you get clang to 
> `-emit-llvm` and look at the resulting file 2nd line?
>
> should look like target datalayout = "..." .Please post the ...

I was going to say that I hadn't built clang, only LLVM, but that 
you could find that info in the target:

LLVMTargetMachine(T, "e-m:e-p:16:16-i32:16:32-a:16-n8:16", TT, 
CPU, FS,
                         Options, getEffectiveRelocModel(RM), CM, 
OL),

...but I want to help and I was not 100% sure that was what you 
wanted, so I went the extra mile ;)

target datalayout = "e-m:e-p:16:16-i32:16:32-a:16-n8:16"

>  also please also compile with `-vv` and post the last section 
> of diagnostics printed (warning it spits out a lot), the length 
> of the backtrace should suffice.

This is the full output for an empty .d file:

$ ldc2 -mtriple=msp430 -c -betterC test.d -vv
Targeting 'msp430' (CPU '' with features '')
WARNING: Unknown ABI, guessing...
Building type: real
Building type: uint
CodeGenerator::emit(test)
* resetting 978 Dsymbols
* *** Initializing D runtime declarations ***
* * building runtime module
* * Building type: extern (C) void(void*, void*)
* * * DtoFunctionType(extern (C) void(void*, void*))
* * * * Building type: void
* * * * Building type: void*
* * * * Final function type: void (i8*, i8*)
* * Building type: extern (C) void(char[], uint)
* * * DtoFunctionType(extern (C) void(char[], uint))
* * * * Building type: char[]
* * * * * Building type: char
* * * * Final function type: void ({ i32, i8* }, i32)
* * Building type: extern (C) void(char[], char[], uint)
* * * DtoFunctionType(extern (C) void(char[], char[], uint))
* * * * Final function type: void ({ i32, i8* }, { i32, i8* }, 
i32)
* * Building type: extern (C) void(immutable ModuleInfo*, uint)
* * * DtoFunctionType(extern (C) void(immutable ModuleInfo*, 
uint))
* * * * Building type: ModuleInfo*
* * * * * Building type: ModuleInfo
* * * * * * Building struct type object.ModuleInfo @ 
/path/to/ldc/runtime/druntime/src/object.d(1517)
* * * * * * * Field priority for _flags: 1
* * * * * * * Field priority for _index: 1
* * * * * * * final struct type: %object.ModuleInfo = type { i32, 
i32 }
* * * * Final function type: void (%object.ModuleInfo*, i32)
* * Building type: extern (C) void*(uint)
* * * DtoFunctionType(extern (C) void*(uint))
* * * * Final function type: i8* (i32)
* * Building type: extern (C) void*(TypeInfo)
* * * DtoFunctionType(extern (C) void*(TypeInfo))
* * * * Building type: object.TypeInfo
* * * * * Building class type object.TypeInfo @ 
/path/to/ldc/runtime/druntime/src/object.d(242)
* * * * * * Instance size: 4
* * * * * * class type: %object.TypeInfo = type { [18 x i8*]*, 
i8* }
* * * * Final function type: i8* (%object.TypeInfo*)
* * Building type: extern (C) void[](const TypeInfo, uint)
* * * DtoFunctionType(extern (C) void[](const TypeInfo, uint))
* * * * Building type: void[]
* * * * Final function type: { i32, i8* } (%object.TypeInfo*, i32)
* * Building type: extern (C) void[](const TypeInfo, uint[])
* * * DtoFunctionType(extern (C) void[](const TypeInfo, uint[]))
* * * * Building type: uint[]
* * * * Final function type: { i32, i8* } (%object.TypeInfo*, { 
i32, i32* })
* * Building type: extern (C) void[](const TypeInfo, uint, 
void[]*)
* * * DtoFunctionType(extern (C) void[](const TypeInfo, uint, 
void[]*))
* * * * Building type: void[]*
* * * * Final function type: { i32, i8* } (%object.TypeInfo*, 
i32, { i32, i8* }*)
* * Building type: extern (C) void[](const TypeInfo, ref void[], 
uint)
* * * DtoFunctionType(extern (C) void[](const TypeInfo, ref 
void[], uint))
* * * * Final function type: { i32, i8* } (%object.TypeInfo*, { 
i32, i8* }*, i32)
* * Building type: extern (C) void[](const TypeInfo, ref void[], 
void[])
* * * DtoFunctionType(extern (C) void[](const TypeInfo, ref 
void[], void[]))
* * * * Final function type: { i32, i8* } (%object.TypeInfo*, { 
i32, i8* }*, { i32, i8* })
* * Building type: extern (C) void[](ref void[], dchar)
* * * DtoFunctionType(extern (C) void[](ref void[], dchar))
* * * * Building type: dchar
* * * * Final function type: { i32, i8* } ({ i32, i8* }*, i32)
* * Building type: extern (C) void[](const TypeInfo, void[], 
void[])
* * * DtoFunctionType(extern (C) void[](const TypeInfo, void[], 
void[]))
* * * * Final function type: { i32, i8* } (%object.TypeInfo*, { 
i32, i8* }, { i32, i8* })
* * Building type: extern (C) void[](const TypeInfo, void[][])
* * * DtoFunctionType(extern (C) void[](const TypeInfo, void[][]))
* * * * Building type: void[][]
* * * * Final function type: { i32, i8* } (%object.TypeInfo*, { 
i32, { i32, i8* }* })
* * Building type: extern (C) Object(const TypeInfo_Class)
* * * DtoFunctionType(extern (C) Object(const TypeInfo_Class))
* * * * Building type: object.Object
* * * * * Building class type object.Object @ 
/path/to/ldc/runtime/druntime/src/object.d(89)
* * * * * * Instance size: 4
* * * * * * class type: %object.Object = type { [5 x i8*]*, i8* }
* * * * Building type: object.TypeInfo_Class
* * * * * Building class type object.TypeInfo_Class @ 
/path/to/ldc/runtime/druntime/src/object.d(961)
* * * * * * Instance size: 40
* * * * * * Field priority for m_init: 1
* * * * * * Field priority for name: 1
* * * * * * Field priority for vtbl: 1
* * * * * * Field priority for interfaces: 1
* * * * * * Field priority for base: 1
* * * * * * Field priority for destructor: 1
* * * * * * Field priority for classInvariant: 1
* * * * * * Field priority for m_flags: 1
* * * * * * Field priority for deallocator: 1
* * * * * * Field priority for m_offTi: 1
* * * * * * Field priority for defaultConstructor: 1
* * * * * * Field priority for m_RTInfo: 1
* * * * * * Building type: byte[]
* * * * * * * Building type: byte
Assertion failed: (llSize <= dSize && "LLVM type is bigger than 
the corresponding D type, " "might lead to aggregate layout 
mismatch."), function getMemberSize, file ../gen/llvmhelpers.cpp, 
line 1351.
0  ldc2                     0x0000000111936c9c 
llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 60
1  ldc2                     0x00000001119371e9 
PrintStackTraceSignalHandler(void*) + 25
2  ldc2                     0x0000000111933139 
llvm::sys::RunSignalHandlers() + 425
3  ldc2                     0x0000000111937642 SignalHandler(int) 
+ 354
4  libsystem_platform.dylib 0x00007fffcee36b3a _sigtramp + 26
5  ldc2                     0x0000000111de7e00 cppmain(int, 
char**)::DL + 48
6  libsystem_c.dylib        0x00007fffcecbb420 abort + 129
7  libsystem_c.dylib        0x00007fffcec82893 basename_r + 0
8  ldc2                     0x000000010f8d8bbf 
getMemberSize(Type*) + 175
9  ldc2                     0x000000010f9c8dc8 
AggrTypeBuilder::addAggregate(AggregateDeclaration*, 
std::__1::map<VarDeclaration*, llvm::Constant*, 
std::__1::less<VarDeclaration*>, 
std::__1::allocator<std::__1::pair<VarDeclaration* const, 
llvm::Constant*> > > const*, AggrTypeBuilder::Aliases) + 2824
10 ldc2                     0x000000010f9c82b6 
AggrTypeBuilder::addAggregate(AggregateDeclaration*) + 38
11 ldc2                     0x000000010f9cc99e 
IrTypeClass::addClassData(AggrTypeBuilder&, ClassDeclaration*) + 
414
12 ldc2                     0x000000010f9cd0f4 
IrTypeClass::get(ClassDeclaration*) + 612
13 ldc2                     0x000000010f985e3e DtoType(Type*) + 
958
14 ldc2                     0x000000010f9c4d0e 
IrFuncTyArg::IrFuncTyArg(Type*, bool, AttrBuilder) + 126
15 ldc2                     0x000000010f9c4dbc 
IrFuncTyArg::IrFuncTyArg(Type*, bool, AttrBuilder) + 44
16 ldc2                     0x000000010f8b9b3c 
DtoFunctionType(Type*, IrFuncTy&, Type*, Type*, bool, bool, bool, 
bool) + 3468
17 ldc2                     0x000000010f9d02ac 
IrTypeFunction::get(Type*) + 220
18 ldc2                     0x000000010f985e6e DtoType(Type*) + 
1006
19 ldc2                     0x000000010f941ce5 
createFwdDecl(LINK, Type*, llvm::ArrayRef<llvm::StringRef>, 
llvm::ArrayRef<Type*>, llvm::ArrayRef<unsigned long>, AttrSet) + 
373
20 ldc2                     0x000000010f93208f 
buildRuntimeModule() + 9327
21 ldc2                     0x000000010f92fc02 initRuntime() + 50
22 ldc2                     0x000000010f8ee178 
codegenModule(IRState*, Module*) + 248
23 ldc2                     0x000000010fa053ac 
ldc::CodeGenerator::emit(Module*) + 300
24 ldc2                     0x000000010fa53e4e 
codegenModules(Array<Module*>&) + 574
25 ldc2                     0x000000010f70f9c0 
mars_mainBody(Array<char const*>&, Array<char const*>&) + 5120


More information about the digitalmars-d-ldc mailing list