Skip to content

[Mips] out of range PC16 fixup when linking the Zig compiler for some target triples #112010

Open
@alexrp

Description

@alexrp

Seen with:

  • mips64el-linux-gnuabin32 (statically linked musl, hard float)

The following triples link successfully, however:

  • mips-linux-gnueabi (dynamically linked glibc, soft float)
  • mips-linux-gnueabihf (dynamically linked glibc, hard float)
  • mips-linux-musleabi (statically linked musl, soft float)
  • mips-linux-musleabihf (statically linked musl, hard float)
  • mipsel-linux-gnueabi (dynamically linked glibc, soft float)
  • mipsel-linux-gnueabihf (dynamically linked glibc, hard float)
  • mipsel-linux-musleabi (statically linked musl, soft float)
  • mipsel-linux-musleabihf (statically linked musl, hard float)
  • mips64-linux-gnuabi64 (dynamically linked glibc, hard float)
  • mips64-linux-gnuabin32 (dynamically linked glibc, hard float)
  • mips64-linux-muslabi64 (statically linked musl, hard float)
  • mips64-linux-muslabin32 (statically linked musl, hard float)
  • mips64el-linux-gnuabi64 (dynamically linked glibc, hard float)
  • mips64el-linux-muslabi64 (statically linked musl, hard float)
  • mips64el-linux-muslabin32 (statically linked musl, hard float)

This started happening with LLVM 19. We subsequently switched our baseline CPU for MIPS to mips32r2/mips64r2, which alleviated the problem. However, it started happening again with the upgrade to LLVM 20.

Example steps to reproduce:

$ git clone [email protected]:ziglang/zig-bootstrap.git
$ cd zig-bootstrap
$ ./build mips64el-linux-gnuabin32 baseline

On a modern x86 machine, this will take ~15 minutes to build the compiler for the current machine, and then another ~15 minutes to (attempt to) build the compiler that runs on mips64el-linux-gnuabin32.

Note that this repo builds and uses a "vendored" LLVM, LLD, and Clang as its purpose is to allow low-effort bootstrapping of Zig for any system. The vendored code here is ~equivalent to the tagged LLVM 20.1.2 release, with only some trivial build system patches on top to avoid building unnecessary fluff.

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions