rust-lang / rustc_codegen_gcc

libgccjit AOT codegen for rustc
Apache License 2.0
906 stars 60 forks source link

Only emit debug info when asked #378

Closed antoyo closed 5 months ago

antoyo commented 10 months ago

Currently, debug info is always emmited.

mubarak23 commented 5 months ago

@antoyo please i will love to work on this issue and submit the PR to link as we discuss earlier in the mail

antoyo commented 5 months ago

Good. Feel free to ask any questions if you need help.

mubarak23 commented 5 months ago

@antoyo if i understand the config.rs file correctly RUSTFLAGS is what collect all the the environment variables and join them into string, thus removing the "-Cdebuginfo=2" from vector, mean the debug option will not get emitted

bjorn3 commented 5 months ago

The standard library shipped with rustup is built with -Cdebuginfo=1.

mubarak23 commented 5 months ago

@bjorn3 i see, does this mean, -Cdebuginfo=1 will not emit debug information, while -Cdebuginfo=2 emit debug information

bjorn3 commented 5 months ago

-Cdebuginfo=1 only emits the line tables part of the debug info (+ some other things), while -Cdebuginfo=2 emits all debug info. Now that I'm taking a closer look, I see that debuginfo is already enabled for the standard library outside of the -Cdebuginfo=2 your PR removes, so I think your PR is fine. (It is enabled for the standard library at https://github.com/rust-lang/rustc_codegen_gcc/blob/7ff5d39980b7ac84d702ff0e82df02163dfe9265/build_sysroot/Cargo.toml#L21)

antoyo commented 5 months ago

This will emit all debug info, though, so we might as well change this to:

debug = "limited"

@mubarak23: Could you please add this change to your PR?

mubarak23 commented 5 months ago

@antoyo i will add it to the PR and push

mubarak23 commented 5 months ago

PR updated with changes requested @antoyo

antoyo commented 5 months ago

Thanks a lot! I'll merge it when the CI is done.

antoyo commented 5 months ago

Done in https://github.com/antoyo/rustc_codegen_gcc/pull/1.