Skip to content

.debug_gdb_scripts is being loaded into memory #81028

Open
@jsgf

Description

@jsgf

If I build:

fn main() {}

with rustc -g --crate-type bin --emit obj -o t.o t.rs, and look at the output of readelf -St t.o I see:

  [27] .debug_gdb_scripts
       PROGBITS               PROGBITS         0000000000000000  0000000000000270  0
       0000000000000022 0000000000000001  0                 1
       [0000000000000032]: ALLOC, MERGE, STRINGS

According to #41627, this is not supposed to be an alloc section (ie, loaded into memory), but only present in the object file.

Having this section loaded isn't a huge problem in itself, but when combined with --link-arg -Wl,--strip-all (or --strip-debug) it triggers a crash in lld: https://bugs.llvm.org//show_bug.cgi?id=44878

There are lld fixes pending (https://reviews.llvm.org/D74510, https://reviews.llvm.org/D91291) (lld is already fixed), but it still seems like making .debug_gdb_scripts alloc is unintended.

Meta

rustc --version --verbose:

rustc 1.49.0 (e1884a8e3 2020-12-29)
binary: rustc
commit-hash: e1884a8e3c3e813aada8254edfa120e85bf5ffca
commit-date: 2020-12-29
host: x86_64-unknown-linux-gnu
release: 1.49.0

cc @eddyb @ayermolo

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-debuginfoArea: Debugging information in compiled programs (DWARF, PDB, etc.)A-linkageArea: linking into static, shared libraries and binariesC-bugCategory: This is a bug.I-heavyIssue: Problems and improvements with respect to binary size of generated code.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions