Skip to content

debug_info for system components leak comp_dir when using zig cc #23821

@Bownairo

Description

@Bownairo

Zig Version

0.14.0

Steps to Reproduce and Observed Behavior

When building with zig cc and preserving debug_info, there does not seem to be any way to replace the comp_dir for system components (crt, libc, libunwind, etc.) around here.


For example, when using zig cc and Rust:

$ RUSTFLAGS="--remap-path-prefix=$(pwd)=. -C strip=none" cargo build

In the resulting binary, units built outside of zig are cleaned:

$ readelf --debug-dump=info target/debug/dummy
...
    <153>   DW_AT_name        : (indirect string, offset: 0x108ed6): src/main.rs/@/1l91654gzite33ik2xmzykra6
    <157>   DW_AT_stmt_list   : 0x152
    <15b>   DW_AT_comp_dir    : (indirect string, offset: 0x487a0): .
...

But these system components leak comp_dir:

$ readelf --debug-dump=info target/debug/dummy
...
    <20>   DW_AT_name        : /home/ubuntu/zig-linux-x86_64-0.14.0/lib/libc/glibc/sysdeps/x86_64/start.S
    <6b>   DW_AT_comp_dir    : /home/ubuntu/dummy
...

Expected Behavior

Some configuration path to pass args to the SubCompilation stage, from zig cc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugObserved behavior contradicts documented or intended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions