llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.09k stars 12k forks source link

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

Open alexrp opened 1 month ago

alexrp commented 1 month ago

Seen in:

The following triples link successfully, however:

If there is a pattern here, I don't see it. :slightly_frowning_face:

This started happening with LLVM 19, but it's possible that's just a coincidence. It's unclear to me if the bug is in LLVM or LLD.

Example steps to reproduce:

$ git clone git@github.com:ziglang/zig-bootstrap.git
$ cd zig-bootstrap
$ ./build mips64-linux-musl 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 mips64-linux-musl.

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 19.1.0 release, with only some trivial build system patches on top to avoid building unnecessary fluff.

Still trying to see if I can reduce this to a more manageable repro, but for now, this is the best I've got.

llvmbot commented 1 month ago

@llvm/issue-subscribers-backend-mips

Author: Alex Rønne Petersen (alexrp)

Seen in: * https://github.com/ziglang/zig-bootstrap/issues/195 (dynamically linked glibc, soft float) * https://github.com/ziglang/zig-bootstrap/issues/196 (dynamically linked glibc, hard float) * https://github.com/ziglang/zig-bootstrap/issues/192 (statically linked musl, hard float) The following triples link successfully, however: * `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) * `mips64el-linux-gnuabi64` (dynamically linked glibc, hard float) * `mips64el-linux-musl` (statically linked musl, hard float) If there is a pattern here, I don't see it. :slightly_frowning_face: This started happening with LLVM 19, but it's possible that's just a coincidence. It's unclear to me if the bug is in LLVM or LLD. Example steps to reproduce: ``` $ git clone git@github.com:ziglang/zig-bootstrap.git $ cd zig-bootstrap $ ./build mips64-linux-musl 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 `mips64-linux-musl`. 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 19.1.0 release, with only some trivial build system patches on top to avoid building unnecessary fluff. Still trying to see if I can reduce this to a more manageable repro, but for now, this is the best I've got.