Skip to content

Commit

Permalink
Rollup merge of #92029 - nikic:section-flags-fix, r=davidtwco
Browse files Browse the repository at this point in the history
Use debug section for .rustc

For a data section, the object crate will set SHF_ALLOC by default, which is exactly what we don't want. Use a debug section instead, the same as we do for .rmeta.

I checked with `objdump -h` that this produces the right flags for ELF.

Fixes #92013.
  • Loading branch information
matthiaskrgr authored Dec 18, 2021
2 parents 31bc43c + 57c0cb7 commit af5b8bc
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/rustc_codegen_ssa/src/back/metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,9 +257,9 @@ pub fn create_compressed_metadata_file(
return compressed.to_vec();
};
let section = file.add_section(
file.segment_name(StandardSegment::Data).to_vec(),
file.segment_name(StandardSegment::Debug).to_vec(),
b".rustc".to_vec(),
SectionKind::Data,
SectionKind::Debug,
);
let offset = file.append_section_data(section, &compressed, 1);

Expand Down

0 comments on commit af5b8bc

Please sign in to comment.