Skip to content

LLVM error compiling core and builtin functions using 16-bit pointers in data layout #68327

@Serentty

Description

@Serentty

I'm trying to compile Rust code to run in 386 real mode, where pointers larger than 2^16 aren't meaningful, even though there are 32-bit registers to work with. It works if I use full 32-bit pointers, but this is quite wasteful, so I've written my target JSON file to specify 16-bit pointers with 16-bit alignment in the LLVM data layout, and set target-pointer-width to 16. However, I get errors from LLVM itself trying to compiler certain functions in core and builtins.

LLVM ERROR: Cannot select: 0x7f962aae09c0: i16 = GlobalAddress<<{ [8 x i8], i8*, [2 x i8] }>* @anon.d1d52a4f9fbe2e9a9c47ed4caed11e39.2.llvm.4753579327427470583> 0
In function: _ZN4core3num7dec2flt3num21compare_with_half_ulp17h4eb4cc321c32da3aE
error: could not compile `core`.
warning: build failed, waiting for other jobs to finish...
LLVM ERROR: Cannot select: 0x7f75cd47f2d8: i16 = FrameIndex<-1>
In function: _ZN51_$LT$u64$u20$as$u20$compiler_builtins..int..Int$GT$12extract_sign17hef80dd72940759b7E
error: could not compile `compiler_builtins`.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-bugCategory: This is a bug.S-needs-reproStatus: This issue has no reproduction and needs a reproduction to make progress.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions