1//! XCOFF doesn't support the COMDAT section.
2
3use core::fmt::Debug;
4
5use crate::xcoff;
6
7use crate::read::{self, ComdatKind, ObjectComdat, ReadRef, Result, SectionIndex, SymbolIndex};
8
9use super::{FileHeader, XcoffFile};
10
11/// An iterator for the COMDAT section groups in a [`XcoffFile32`](super::XcoffFile32).
12pub type XcoffComdatIterator32<'data, 'file, R = &'data [u8]> =
13 XcoffComdatIterator<'data, 'file, xcoff::FileHeader32, R>;
14/// An iterator for the COMDAT section groups in a [`XcoffFile64`](super::XcoffFile64).
15pub type XcoffComdatIterator64<'data, 'file, R = &'data [u8]> =
16 XcoffComdatIterator<'data, 'file, xcoff::FileHeader64, R>;
17
18/// An iterator for the COMDAT section groups in a [`XcoffFile`].
19///
20/// This is a stub that doesn't implement any functionality.
21#[derive(Debug)]
22pub struct XcoffComdatIterator<'data, 'file, Xcoff, R = &'data [u8]>
23where
24 Xcoff: FileHeader,
25 R: ReadRef<'data>,
26{
27 #[allow(unused)]
28 pub(crate) file: &'file XcoffFile<'data, Xcoff, R>,
29}
30
31impl<'data, 'file, Xcoff, R> Iterator for XcoffComdatIterator<'data, 'file, Xcoff, R>
32where
33 Xcoff: FileHeader,
34 R: ReadRef<'data>,
35{
36 type Item = XcoffComdat<'data, 'file, Xcoff, R>;
37
38 #[inline]
39 fn next(&mut self) -> Option<Self::Item> {
40 None
41 }
42}
43
44/// A COMDAT section group in a [`XcoffFile32`](super::XcoffFile32).
45pub type XcoffComdat32<'data, 'file, R = &'data [u8]> =
46 XcoffComdat<'data, 'file, xcoff::FileHeader32, R>;
47
48/// A COMDAT section group in a [`XcoffFile64`](super::XcoffFile64).
49pub type XcoffComdat64<'data, 'file, R = &'data [u8]> =
50 XcoffComdat<'data, 'file, xcoff::FileHeader64, R>;
51
52/// A COMDAT section group in a [`XcoffFile`].
53///
54/// This is a stub that doesn't implement any functionality.
55#[derive(Debug)]
56pub struct XcoffComdat<'data, 'file, Xcoff, R = &'data [u8]>
57where
58 Xcoff: FileHeader,
59 R: ReadRef<'data>,
60{
61 #[allow(unused)]
62 file: &'file XcoffFile<'data, Xcoff, R>,
63}
64
65impl<'data, 'file, Xcoff, R> read::private::Sealed for XcoffComdat<'data, 'file, Xcoff, R>
66where
67 Xcoff: FileHeader,
68 R: ReadRef<'data>,
69{
70}
71
72impl<'data, 'file, Xcoff, R> ObjectComdat<'data> for XcoffComdat<'data, 'file, Xcoff, R>
73where
74 Xcoff: FileHeader,
75 R: ReadRef<'data>,
76{
77 type SectionIterator = XcoffComdatSectionIterator<'data, 'file, Xcoff, R>;
78
79 #[inline]
80 fn kind(&self) -> ComdatKind {
81 unreachable!();
82 }
83
84 #[inline]
85 fn symbol(&self) -> SymbolIndex {
86 unreachable!();
87 }
88
89 #[inline]
90 fn name_bytes(&self) -> Result<&[u8]> {
91 unreachable!();
92 }
93
94 #[inline]
95 fn name(&self) -> Result<&str> {
96 unreachable!();
97 }
98
99 #[inline]
100 fn sections(&self) -> Self::SectionIterator {
101 unreachable!();
102 }
103}
104
105/// An iterator for the sections in a COMDAT section group in a [`XcoffFile32`](super::XcoffFile32).
106pub type XcoffComdatSectionIterator32<'data, 'file, R = &'data [u8]> =
107 XcoffComdatSectionIterator<'data, 'file, xcoff::FileHeader32, R>;
108/// An iterator for the sections in a COMDAT section group in a [`XcoffFile64`](super::XcoffFile64).
109pub type XcoffComdatSectionIterator64<'data, 'file, R = &'data [u8]> =
110 XcoffComdatSectionIterator<'data, 'file, xcoff::FileHeader64, R>;
111
112/// An iterator for the sections in a COMDAT section group in a [`XcoffFile`].
113///
114/// This is a stub that doesn't implement any functionality.
115#[derive(Debug)]
116pub struct XcoffComdatSectionIterator<'data, 'file, Xcoff, R = &'data [u8]>
117where
118 Xcoff: FileHeader,
119 R: ReadRef<'data>,
120{
121 #[allow(unused)]
122 file: &'file XcoffFile<'data, Xcoff, R>,
123}
124
125impl<'data, 'file, Xcoff, R> Iterator for XcoffComdatSectionIterator<'data, 'file, Xcoff, R>
126where
127 Xcoff: FileHeader,
128 R: ReadRef<'data>,
129{
130 type Item = SectionIndex;
131
132 fn next(&mut self) -> Option<Self::Item> {
133 None
134 }
135}
136