Skip to content

Compile error instead of falling back to C for unsupported calling conventions#6607

Closed
tadeokondrak wants to merge 2 commits intoziglang:masterfrom
tadeokondrak:error-unsupported-callconv
Closed

Compile error instead of falling back to C for unsupported calling conventions#6607
tadeokondrak wants to merge 2 commits intoziglang:masterfrom
tadeokondrak:error-unsupported-callconv

Conversation

@tadeokondrak
Copy link
Copy Markdown
Contributor

Closes #6536.

@tadeokondrak
Copy link
Copy Markdown
Contributor Author

Trying to build the self-hosted compiler for x86_64-windows-gnu on my machine seems to cause lld to call _exit somewhere during linking. Not sure why.

@tadeokondrak tadeokondrak marked this pull request as draft October 8, 2020 00:00
@tadeokondrak tadeokondrak force-pushed the error-unsupported-callconv branch from c2c2831 to 6319bc7 Compare October 8, 2020 00:29
@tadeokondrak tadeokondrak force-pushed the error-unsupported-callconv branch from 6319bc7 to e436475 Compare October 8, 2020 00:38
Comment thread lib/std/os/windows/bits.zig
Comment thread src/stage1/analyze.cpp
&& g->zig_target->arch != ZigLLVM_avr
&& g->zig_target->arch != ZigLLVM_msp430)
{
allowed_platforms = "x86, x86_64, AVR, and MS430";
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
allowed_platforms = "x86, x86_64, AVR, and MS430";
allowed_platforms = "x86, x86_64, AVR, and MSP430";

@LemonBoy
Copy link
Copy Markdown
Contributor

LemonBoy commented Oct 8, 2020

The old behaviour was modeled after clang as it ignores (and afair gives a warning) whenever it encounters a invalid cc for the given target. But giving an error is also fine and will force people to use the correct cc, so +1 from me.

@Rocknest
Copy link
Copy Markdown
Contributor

Rocknest commented Oct 8, 2020

How do i use SysV callconv when target os = windows?

@tadeokondrak
Copy link
Copy Markdown
Contributor Author

How do i use SysV callconv when target os = windows?

I don't think this is possible but it should be. I don't think it's related to this PR though.

@tadeokondrak
Copy link
Copy Markdown
Contributor Author

Still don't know why this is failing, so closing until #3825 is fixed

@LemonBoy
Copy link
Copy Markdown
Contributor

Still don't know why this is failing, so closing until #3825 is fixed

You should be able to see LLD's fatal errors by modifying ZigLLDLink to use llvm::errs() and llvm::outs() instead of diag_stderr and diag_stdout, the former are two unbuffered streams going to the terminal while the latter are the fake ones Zig setups in order to collect the error messages.
When LLD calls fatal() the whole Zig process is terminated and the error messages get stuck in the diag streams.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Compile error instead of falling back to C for unsupported calling conventions

3 participants