diff options
| author | Matthias Krüger <matthias.krueger@famsik.de> | 2022-01-04 16:34:15 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-04 16:34:15 +0100 |
| commit | 855f6300fbf0801ca9e7c9411e52b6322d68a7c6 (patch) | |
| tree | 5e5ab01e7e421350e76545c762bc3762aca2311c /compiler/rustc_codegen_ssa | |
| parent | c7125ba0fa4e9abe826f004a023c0bf3678a8963 (diff) | |
| parent | 6eb50729291c64acf0d6588dd632e9792508ca31 (diff) | |
| download | rust-855f6300fbf0801ca9e7c9411e52b6322d68a7c6.tar.gz rust-855f6300fbf0801ca9e7c9411e52b6322d68a7c6.zip | |
Rollup merge of #92107 - nikic:rmeta-lnk-remove, r=nagisa
Actually set IMAGE_SCN_LNK_REMOVE for .rmeta The code intended to set the IMAGE_SCN_LNK_REMOVE flag for the .rmeta section, however the value of this flag was set to zero. Instead use the actual value provided by the object crate. This dates back to the original introduction of this code in PR #84449, so we were never setting this flag. As I'm not on Windows, I'm not sure whether that means we were embedding .rmeta into executables, or whether the section ended up getting stripped for some other reason.
Diffstat (limited to 'compiler/rustc_codegen_ssa')
| -rw-r--r-- | compiler/rustc_codegen_ssa/src/back/metadata.rs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/compiler/rustc_codegen_ssa/src/back/metadata.rs b/compiler/rustc_codegen_ssa/src/back/metadata.rs index 7c97143e807..79c24f0f172 100644 --- a/compiler/rustc_codegen_ssa/src/back/metadata.rs +++ b/compiler/rustc_codegen_ssa/src/back/metadata.rs @@ -6,8 +6,8 @@ use std::path::Path; use object::write::{self, StandardSegment, Symbol, SymbolSection}; use object::{ - elf, Architecture, BinaryFormat, Endianness, FileFlags, Object, ObjectSection, SectionFlags, - SectionKind, SymbolFlags, SymbolKind, SymbolScope, + elf, pe, Architecture, BinaryFormat, Endianness, FileFlags, Object, ObjectSection, + SectionFlags, SectionKind, SymbolFlags, SymbolKind, SymbolScope, }; use snap::write::FrameEncoder; @@ -216,13 +216,12 @@ pub fn create_rmeta_file(sess: &Session, metadata: &[u8]) -> Vec<u8> { ); match file.format() { BinaryFormat::Coff => { - const IMAGE_SCN_LNK_REMOVE: u32 = 0; file.section_mut(section).flags = - SectionFlags::Coff { characteristics: IMAGE_SCN_LNK_REMOVE }; + SectionFlags::Coff { characteristics: pe::IMAGE_SCN_LNK_REMOVE }; } BinaryFormat::Elf => { - const SHF_EXCLUDE: u64 = 0x80000000; - file.section_mut(section).flags = SectionFlags::Elf { sh_flags: SHF_EXCLUDE }; + file.section_mut(section).flags = + SectionFlags::Elf { sh_flags: elf::SHF_EXCLUDE as u64 }; } _ => {} }; |
