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

Unable to omit unwind tables from binary when using ReleaseSmall + LLVM #21942

Open
wooster0 opened this issue Nov 9, 2024 · 3 comments
Open
Assignees
Labels
arch-x86_64 64-bit x86 bug Observed behavior contradicts documented or intended behavior standard library This issue involves writing Zig code for the standard library.
Milestone

Comments

@wooster0
Copy link
Contributor

wooster0 commented Nov 9, 2024

Zig Version

0.14.0-dev.2164+6b2c8fc68

Steps to Reproduce and Observed Behavior

$ cat x.zig
pub fn main() void {}
$ zig build-exe x.zig -fno-unwind-tables -OReleaseSmall
error: <inline asm>:1:3: this directive must appear between .cfi_startproc and .cfi_endproc directives
         .cfi_undefined %rip
         ^

$

Expected Behavior

Successful compilation.

@wooster0 wooster0 added the bug Observed behavior contradicts documented or intended behavior label Nov 9, 2024
@Rexicon226
Copy link
Contributor

This is the line of inline asm that's causing this:

\\ .cfi_undefined %%rip

added in f289b82

@alexrp
Copy link
Member

alexrp commented Nov 9, 2024

I have an upcoming PR that improves the compiler's handling of unwind tables, including adding a builtin.unwind_tables decl. With that, we can more easily decide whether to emit the .cfi_undefined directive.

Similar fix is needed in clone().

@alexrp alexrp self-assigned this Nov 9, 2024
@alexrp alexrp added this to the 0.14.0 milestone Nov 9, 2024
@alexrp alexrp added standard library This issue involves writing Zig code for the standard library. arch-x86_64 64-bit x86 labels Nov 9, 2024
@alexrp
Copy link
Member

alexrp commented Nov 20, 2024

#22035 is the first step here. We'll need a zig1.wasm update before we can actually start using @import("builtin").unwind_tables in standard library code, though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arch-x86_64 64-bit x86 bug Observed behavior contradicts documented or intended behavior standard library This issue involves writing Zig code for the standard library.
Projects
None yet
Development

No branches or pull requests

3 participants