Skip to content

"warning: argument unused during compilation" when compiling assembly files #2741

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

Closed
jzck opened this issue Jun 24, 2019 · 3 comments
Closed
Labels
bug Observed behavior contradicts documented or intended behavior stage1 The process of building from source via WebAssembly and the C backend.
Milestone

Comments

@jzck
Copy link

jzck commented Jun 24, 2019

Hello, as of recently assembly files seems to be misbehaving, I've reproduced a minimal viable example:

// main.zig
pub fn main() noreturn {
    while (true) {}
}

// test.s
.global __test
.type __test, @function

__test:
      hlt

//build.zig
const Builder = @import("std").build.Builder;

pub fn build(b: *Builder) void {
    const kernel = b.addExecutable("exe", "main.zig");
    kernel.setOutputDir("build");
    kernel.addAssemblyFile("test.s");

    b.default_step.dependOn(&kernel.step);
}

which gives me the output

~/zig_test$ zig build
zig: warning: argument unused during compilation: '-MD' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-MV' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-MF /home/jack/zig_test/zig-cache/tmp/6EiTG286E8Bm-test.o.d' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-nostdinc' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-fno-spell-checking' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-isystem /snap/zig/640/lib/zig/include' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-D _DEBUG' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-fno-stack-protector' [-Wunused-command-line-argument]
zig: warning: argument unused during compilation: '-fno-omit-frame-pointer' [-Wunused-command-line-argument]

These are just warnings, but I'm suspecting it's causing some of the bugs I'm experiencing. I'll look into how zig handles assembly if I have the time.

PS: is there a roadmap concerning assembly in zig for the future somewhere? I'm interested to see what the plan is

@andrewrk
Copy link
Member

andrewrk commented Jun 27, 2019

Those unused warnings are the result of zig not distinguishing between using zig cc to compile C code or assembly code. They're harmless (although I'll leave this issue open to fix them). I think your issue is something else.

PS: is there a roadmap concerning assembly in zig for the future somewhere? I'm interested to see what the plan is

There are a few open issues, such as #2081 and #215. Compiling assembly files is equivalent to compiling them with clang. Inline assembly is not much more than a bare bones implementation currently, and definitely could use some improvement to make it less error prone.

@andrewrk andrewrk added this to the 0.5.0 milestone Jun 27, 2019
@andrewrk andrewrk changed the title assembly file compiling bug "warning: argument unused during compilation" when compiling assembly files Jun 27, 2019
@andrewrk andrewrk modified the milestones: 0.5.0, 0.6.0 Sep 20, 2019
@andrewrk andrewrk added bug Observed behavior contradicts documented or intended behavior stage1 The process of building from source via WebAssembly and the C backend. labels Jan 8, 2020
@andrewrk
Copy link
Member

andrewrk commented Jan 8, 2020

Planned solution for this is #3508.

@andrewrk andrewrk modified the milestones: 0.6.0, 0.7.0 Jan 8, 2020
@andrewrk andrewrk modified the milestones: 0.7.0, 0.8.0 Aug 13, 2020
@andrewrk andrewrk modified the milestones: 0.8.0, 0.9.0 Nov 6, 2020
@andrewrk andrewrk modified the milestones: 0.9.0, 0.10.0 May 19, 2021
@Vexu
Copy link
Member

Vexu commented Dec 28, 2022

Fixed by #3508

@Vexu Vexu closed this as completed Dec 28, 2022
@andrewrk andrewrk modified the milestones: 0.12.0, 0.11.0 Dec 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Observed behavior contradicts documented or intended behavior stage1 The process of building from source via WebAssembly and the C backend.
Projects
None yet
Development

No branches or pull requests

3 participants