Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zig cc cross compile to powerpc64le-linux-gnu is broken #10979

Closed
messense opened this issue Feb 24, 2022 · 4 comments
Closed

zig cc cross compile to powerpc64le-linux-gnu is broken #10979

messense opened this issue Feb 24, 2022 · 4 comments
Labels
arch-powerpc bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness. upstream An issue with a third party project that Zig uses. zig cc Zig as a drop-in C compiler feature
Milestone

Comments

@messense
Copy link

Zig Version

0.9.1

Steps to Reproduce

❯ cat hello.c
#include <stdio.h>

int main(int argc, char **argv) {
    fprintf(stderr, "Hello, World!\n");
    return 0;
}

❯ zig cc -o hello hello.c -target powerpc64le-linux-gnu
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-mred-zone' [-Wunused-command-line-argument]

Expected Behavior

compilation successful.

Actual Behavior

The process hangs forever.

@messense messense added the bug Observed behavior contradicts documented or intended behavior label Feb 24, 2022
@messense
Copy link
Author

powerpc64le-linux-musl has the same problem.

@Vexu Vexu added frontend Tokenization, parsing, AstGen, Sema, and Liveness. zig cc Zig as a drop-in C compiler feature arch-powerpc labels Mar 27, 2022
@Vexu Vexu added this to the 0.11.0 milestone Mar 27, 2022
@tsmanner
Copy link

tsmanner commented Apr 8, 2022

I bumped into this recently as well and decided to try running it under gdb to poke around a little bit. I took 11 stack snapshots, a few in the five or so minutes, then a few more a couple of hours later. It does seem to be an infinite loop in LLVM, but I don't know how to isolate where or why that's happening.

11/11 stack traces are identical up to 0x00007ffff2bde933 in llvm::SelectionDAGISel::CodeGenAndEmitDAG() () from /nix/store/22s3qq6a1wck8cs156kljvb6qw05pq27-llvm-13.0.0-lib/lib/libLLVM-13.so

10/11 stack traces are identical up to 0x00007ffff2a6a51b in (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) () from /nix/store/22s3qq6a1wck8cs156kljvb6qw05pq27-llvm-13.0.0-lib/lib/libLLVM-13.so

There are some other patterns in the 10/11 stack traces, all related to this DAG traversal, which makes me think that LLVM is being handed a "DAG" that is not actually acyclic.

@rjzak
Copy link

rjzak commented Nov 1, 2022

I couldn't compile for powerpc64le-linux-gnu on powerpc64le. #1290 (comment)

@andrewrk andrewrk added the upstream An issue with a third party project that Zig uses. label Dec 29, 2022
@andrewrk
Copy link
Member

Tested with 0.11.0-dev.995+7350f0d9b and it works now. We have test coverage here:

zig/test/tests.zig

Lines 330 to 345 in 7350f0d

.{
.target = .{
.cpu_arch = .powerpc64le,
.os_tag = .linux,
.abi = .musl,
},
.link_libc = true,
},
.{
.target = .{
.cpu_arch = .powerpc64le,
.os_tag = .linux,
.abi = .gnu,
},
.link_libc = true,
},

@andrewrk andrewrk modified the milestones: 0.12.0, 0.11.0 Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-powerpc bug Observed behavior contradicts documented or intended behavior frontend Tokenization, parsing, AstGen, Sema, and Liveness. upstream An issue with a third party project that Zig uses. zig cc Zig as a drop-in C compiler feature
Projects
None yet
Development

No branches or pull requests

5 participants