Skip to content

Custom target: data-layout changed #31367

Closed
@phil-opp

Description

@phil-opp

I use a custom target file to build code for ARM. I copied the file from somewhere and it worked without problems. But now, after an update to the latest nightly, the build fails with a strange LLVM error:

rustc:
/buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/CodeGen/MachineFunction.cpp:108:
llvm::MachineFunction::MachineFunction(const llvm::Function*, const
llvm::TargetMachine&, unsigned int, llvm::MachineModuleInfo&): Assertion
`TM.isCompatibleDataLayout(getDataLayout()) && "Can't create a
MachineFunction using a Module with a " "Target-incompatible DataLayout
attached\n"' failed.

I don't understand any of this but it seems like the data-layout is suddently “Target-incompatible”. My target json looks like this:

{
    "arch": "arm",
    "cpu": "cortex-m4",
    "data-layout": "e-m:e-p:32:32-i1:8:32-i8:8:32-i16:16:32-i64:64-v128:64:128-a:0:32-n32-S64",
    "disable-redzone": true,
    "executables": true,
    "llvm-target": "thumbv7em-none-eabihf",
    "morestack": false,
    "os": "none",
    "relocation-model": "static",
    "target-endian": "little",
    "target-pointer-width": "32",
    "no-compiler-rt": true,
    "pre-link-args": [
        "-mcpu=cortex-m7", "-mthumb",
        "-Tlayout.ld"
    ],
    "post-link-args": [
        "-lm", "-lgcc", "-lnosys"
    ]
}

Removing the data-layout line fixes it and everything works again. So I think this issue is already solved :). I opened it anyway as I wasn't sure if this was intended (and maybe it helps someone).

If someone wants to investigate: The travis builds for nightly libcore started failing on rustc 1.8.0-nightly (9a07087bc 2016-01-30).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.A-docsArea: Documentation for any part of the project, including the compiler, standard library, and toolsC-enhancementCategory: An issue proposing an enhancement or a PR with one.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions