summaryrefslogtreecommitdiffstats
path: root/vendor/object/src/write/coff.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /vendor/object/src/write/coff.rs
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/object/src/write/coff.rs')
-rw-r--r--vendor/object/src/write/coff.rs52
1 files changed, 33 insertions, 19 deletions
diff --git a/vendor/object/src/write/coff.rs b/vendor/object/src/write/coff.rs
index c7489d3d6..d2f7ccc64 100644
--- a/vendor/object/src/write/coff.rs
+++ b/vendor/object/src/write/coff.rs
@@ -37,29 +37,41 @@ impl<'a> Object<'a> {
pub(crate) fn coff_section_info(
&self,
section: StandardSection,
- ) -> (&'static [u8], &'static [u8], SectionKind) {
+ ) -> (&'static [u8], &'static [u8], SectionKind, SectionFlags) {
match section {
- StandardSection::Text => (&[], &b".text"[..], SectionKind::Text),
- StandardSection::Data => (&[], &b".data"[..], SectionKind::Data),
+ StandardSection::Text => (&[], &b".text"[..], SectionKind::Text, SectionFlags::None),
+ StandardSection::Data => (&[], &b".data"[..], SectionKind::Data, SectionFlags::None),
StandardSection::ReadOnlyData
| StandardSection::ReadOnlyDataWithRel
- | StandardSection::ReadOnlyString => (&[], &b".rdata"[..], SectionKind::ReadOnlyData),
- StandardSection::UninitializedData => {
- (&[], &b".bss"[..], SectionKind::UninitializedData)
- }
+ | StandardSection::ReadOnlyString => (
+ &[],
+ &b".rdata"[..],
+ SectionKind::ReadOnlyData,
+ SectionFlags::None,
+ ),
+ StandardSection::UninitializedData => (
+ &[],
+ &b".bss"[..],
+ SectionKind::UninitializedData,
+ SectionFlags::None,
+ ),
// TLS sections are data sections with a special name.
- StandardSection::Tls => (&[], &b".tls$"[..], SectionKind::Data),
+ StandardSection::Tls => (&[], &b".tls$"[..], SectionKind::Data, SectionFlags::None),
StandardSection::UninitializedTls => {
// Unsupported section.
- (&[], &[], SectionKind::UninitializedTls)
+ (&[], &[], SectionKind::UninitializedTls, SectionFlags::None)
}
StandardSection::TlsVariables => {
// Unsupported section.
- (&[], &[], SectionKind::TlsVariables)
+ (&[], &[], SectionKind::TlsVariables, SectionFlags::None)
}
StandardSection::Common => {
// Unsupported section.
- (&[], &[], SectionKind::Common)
+ (&[], &[], SectionKind::Common, SectionFlags::None)
+ }
+ StandardSection::GnuProperty => {
+ // Unsupported section.
+ (&[], &[], SectionKind::Note, SectionFlags::None)
}
}
}
@@ -265,7 +277,7 @@ impl<'a> Object<'a> {
symtab_count += 1;
match symbol.kind {
SymbolKind::File => {
- // Name goes in auxilary symbol records.
+ // Name goes in auxiliary symbol records.
let aux_count = (symbol.name.len() + coff::IMAGE_SIZEOF_SYMBOL - 1)
/ coff::IMAGE_SIZEOF_SYMBOL;
symbol_offsets[index].aux_count = aux_count as u8;
@@ -355,7 +367,9 @@ impl<'a> Object<'a> {
| coff::IMAGE_SCN_MEM_READ
| coff::IMAGE_SCN_MEM_WRITE
}
- SectionKind::ReadOnlyData | SectionKind::ReadOnlyString => {
+ SectionKind::ReadOnlyData
+ | SectionKind::ReadOnlyDataWithRel
+ | SectionKind::ReadOnlyString => {
coff::IMAGE_SCN_CNT_INITIALIZED_DATA | coff::IMAGE_SCN_MEM_READ
}
SectionKind::Debug | SectionKind::Other | SectionKind::OtherString => {
@@ -573,11 +587,11 @@ impl<'a> Object<'a> {
let section_number = match symbol.section {
SymbolSection::None => {
debug_assert_eq!(symbol.kind, SymbolKind::File);
- coff::IMAGE_SYM_DEBUG
+ coff::IMAGE_SYM_DEBUG as u16
}
- SymbolSection::Undefined => coff::IMAGE_SYM_UNDEFINED,
- SymbolSection::Absolute => coff::IMAGE_SYM_ABSOLUTE,
- SymbolSection::Common => coff::IMAGE_SYM_UNDEFINED,
+ SymbolSection::Undefined => coff::IMAGE_SYM_UNDEFINED as u16,
+ SymbolSection::Absolute => coff::IMAGE_SYM_ABSOLUTE as u16,
+ SymbolSection::Common => coff::IMAGE_SYM_UNDEFINED as u16,
SymbolSection::Section(id) => id.0 as u16 + 1,
};
let typ = if symbol.kind == SymbolKind::Text {
@@ -587,7 +601,7 @@ impl<'a> Object<'a> {
};
let storage_class = match symbol.kind {
SymbolKind::File => {
- // Name goes in auxilary symbol records.
+ // Name goes in auxiliary symbol records.
name = b".file";
coff::IMAGE_SYM_CLASS_FILE
}
@@ -640,7 +654,7 @@ impl<'a> Object<'a> {
let mut coff_symbol = coff::ImageSymbol {
name: [0; 8],
value: U32Bytes::new(LE, value),
- section_number: U16Bytes::new(LE, section_number as u16),
+ section_number: U16Bytes::new(LE, section_number),
typ: U16Bytes::new(LE, typ),
storage_class,
number_of_aux_symbols,