1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
pub mod enums;
pub mod error;
pub mod globals;
pub mod read;
pub mod tag;

use std::{
    collections::HashMap,
    fmt::Display,
    io::{Cursor, Seek},
};

use enums::*;
use error::{BuildAttrError, PublicAttrsError, ReadError, TagError};
use read::{read_string, read_u32, Endian};
use tag::Tag;

pub struct BuildAttrs<'a> {
    data: &'a [u8],
    endian: Endian,
}

impl<'a> BuildAttrs<'a> {
    pub fn new(data: &'a [u8], endian: Endian) -> Result<Self, BuildAttrError> {
        if data.is_empty() {
            Err(BuildAttrError::NoData)
        } else {
            let attrs = Self { data, endian };
            let version = attrs.version();
            if version != b'A' {
                Err(BuildAttrError::IncompatibleVersion(version))
            } else {
                Ok(attrs)
            }
        }
    }

    pub fn version(&self) -> u8 {
        self.data[0]
    }

    pub fn subsections(&self) -> SubsectionIter {
        let data = &self.data[1..];
        SubsectionIter {
            data,
            cursor: Cursor::new(data),
            endian: self.endian,
        }
    }
}

pub struct SubsectionIter<'a> {
    data: &'a [u8],
    cursor: Cursor<&'a [u8]>,
    endian: Endian,
}

impl<'a> Iterator for SubsectionIter<'a> {
    type Item = Result<Subsection<'a>, ReadError>;

    fn next(&mut self) -> Option<Self::Item> {
        let length = match read_u32(&mut self.cursor, self.endian) {
            Ok(length) => length,
            Err(ReadError::Eof) => return None,
            Err(e) => return Some(Err(e)),
        };
        let vendor_name = match read_string(&mut self.cursor) {
            Ok(vendor_name) => vendor_name,
            Err(ReadError::Eof) => return None,
            Err(e) => return Some(Err(e)),
        };
        let name_size = vendor_name.len() + 1;

        let pos = self.cursor.position() as usize;
        let end = pos + length as usize - name_size - 4;
        if end > self.data.len() {
            return Some(Err(ReadError::OutOfBounds));
        }
        let data = &self.data[pos..end];
        if let Err(e) = self.cursor.seek(std::io::SeekFrom::Current(data.len() as i64)) {
            Some(Err(ReadError::Io(e)))
        } else {
            Some(Ok(Subsection {
                data,
                endian: self.endian,
                vendor_name,
            }))
        }
    }
}

pub struct Subsection<'a> {
    data: &'a [u8],
    endian: Endian,
    vendor_name: &'a str,
}

impl<'a> Subsection<'a> {
    pub fn is_aeabi(&self) -> bool {
        self.vendor_name == "aeabi"
    }

    pub fn data(&self) -> &'a [u8] {
        self.data
    }

    pub fn endian(&self) -> Endian {
        self.endian
    }

    pub fn vendor_name(&self) -> &str {
        self.vendor_name
    }
}

impl<'a> Subsection<'a> {
    pub fn into_public_tag_iter(self) -> Result<PublicTagIter<'a>, PublicAttrsError> {
        if self.is_aeabi() {
            Ok(PublicTagIter {
                cursor: Cursor::new(self.data),
                endian: self.endian,
            })
        } else {
            Err(PublicAttrsError::InvalidName(self.vendor_name.to_string()))
        }
    }

    pub fn into_public_attributes(self) -> Result<File<'a>, PublicAttrsError> {
        let data_len = self.data.len();

        let mut cursor = Cursor::new(self.data);
        let first_tag = match Tag::read(&mut cursor, self.endian) {
            Ok(tag) => tag,
            Err(TagError::Read(ReadError::Eof)) => return Err(PublicAttrsError::NoTags),
            Err(e) => return Err(PublicAttrsError::Tag(e)),
        };

        if let Tag::File { end_offset } = first_tag {
            if end_offset as usize != data_len {
                return Err(PublicAttrsError::ScopeEndsBeforeParent);
            }
        } else {
            return Err(PublicAttrsError::NoFileTag);
        }

        let mut file = File::default();
        let mut attrs = &mut file.attributes;
        let mut curr_section = None;
        let mut curr_symbol = None;

        loop {
            let offset = cursor.position() as u32;
            let tag = match Tag::read(&mut cursor, self.endian) {
                Ok(tag) => tag,
                Err(TagError::Read(ReadError::Eof)) => break,
                Err(e) => return Err(PublicAttrsError::Tag(e)),
            };

            if let Some((end_offset, _)) = curr_symbol {
                if offset >= end_offset {
                    curr_symbol = None;
                    attrs = if let Some((_, sections)) = curr_section {
                        &mut file.sections.entry(sections).or_default().attributes
                    } else {
                        &mut file.attributes
                    };
                }
            }

            if let Some((end_offset, _)) = curr_section {
                if offset >= end_offset {
                    curr_section = None;
                    attrs = &mut file.attributes;
                }
            }

            match tag {
                Tag::File { end_offset: _ } => return Err(PublicAttrsError::DuplicateFileTag),
                Tag::Section { end_offset, sections } => {
                    if curr_section.is_none() && curr_symbol.is_none() {
                        let section = file.sections.entry(sections).or_default();
                        attrs = &mut section.attributes;
                        curr_section = Some((end_offset, sections));
                    } else {
                        return Err(PublicAttrsError::NotFileScope);
                    }
                }
                Tag::Symbol { end_offset, symbols } => {
                    if let Some((section_end, sections)) = &curr_section {
                        if end_offset > *section_end {
                            return Err(PublicAttrsError::ScopeEndsBeforeParent);
                        }
                        let symbol = file.sections.entry(sections).or_default().symbols.entry(symbols).or_default();
                        attrs = &mut symbol.attributes;
                        curr_symbol = Some((end_offset, symbols));
                    } else {
                        return Err(PublicAttrsError::NotSectionScope);
                    }
                }
                Tag::CpuRawName(x) => attrs.cpu_raw_name = Some(x),
                Tag::CpuName(x) => attrs.cpu_name = Some(x),
                Tag::CpuArch(x) => attrs.cpu_arch = Some(x),
                Tag::CpuArchProfile(x) => attrs.cpu_arch_profile = Some(x),
                Tag::ArmIsaUse(x) => attrs.arm_isa_use = Some(x),
                Tag::ThumbIsaUse(x) => attrs.thumb_isa_use = Some(x),
                Tag::FpArch(x) => attrs.fp_arch = Some(x),
                Tag::WmmxArch(x) => attrs.wmmx_arch = Some(x),
                Tag::AsimdArch(x) => attrs.asimd_arch = Some(x),
                Tag::PcsConfig(x) => attrs.pcs_config = Some(x),
                Tag::AbiPcsR9Use(x) => attrs.abi_pcs_r9_use = Some(x),
                Tag::AbiPcsRwData(x) => attrs.abi_pcs_rw_data = Some(x),
                Tag::AbiPcsRoData(x) => attrs.abi_pcs_ro_data = Some(x),
                Tag::AbiPcsGotUse(x) => attrs.abi_pcs_got_use = Some(x),
                Tag::AbiPcsWcharT(x) => attrs.abi_pcs_wchar_t = Some(x),
                Tag::AbiFpRounding(x) => attrs.abi_fp_rounding = Some(x),
                Tag::AbiFpDenormal(x) => attrs.abi_fp_denormal = Some(x),
                Tag::AbiFpExceptions(x) => attrs.abi_fp_exceptions = Some(x),
                Tag::AbiFpUserExceptions(x) => attrs.abi_fp_user_exceptions = Some(x),
                Tag::AbiFpNumberModel(x) => attrs.abi_fp_number_model = Some(x),
                Tag::AbiAlignNeeded(x) => attrs.abi_align_needed = Some(x),
                Tag::AbiAlignPreserved(x) => attrs.abi_align_preserved = Some(x),
                Tag::AbiEnumSize(x) => attrs.abi_enum_size = Some(x),
                Tag::AbiHardFpUse(x) => attrs.abi_hardfp_use = Some(x),
                Tag::AbiVfpArgs(x) => attrs.abi_vfp_args = Some(x),
                Tag::AbiWmmxArgs(x) => attrs.abi_wmmx_args = Some(x),
                Tag::AbiOptGoals(x) => attrs.abi_opt_goals = Some(x),
                Tag::AbiFpOptGoals(x) => attrs.abi_fp_opt_goals = Some(x),
                Tag::Compat(x) => attrs.compat = Some(x),
                Tag::CpuUnalignedAccess(x) => attrs.cpu_unaligned_access = Some(x),
                Tag::FpHpExt(x) => attrs.fp_hp_ext = Some(x),
                Tag::AbiFp16BitFormat(x) => attrs.abi_fp_16bit_format = Some(x),
                Tag::MpExtUse(x) => attrs.mp_ext_use = Some(x),
                Tag::DivUse(x) => attrs.div_use = Some(x),
                Tag::DspExt(x) => attrs.dsp_ext = Some(x),
                Tag::MveArch(x) => attrs.mve_arch = Some(x),
                Tag::PacExt(x) => attrs.pac_ext = Some(x),
                Tag::BtiExt(x) => attrs.bti_ext = Some(x),
                Tag::AlsoCompatWith(x) => attrs.also_compat_with = Some(x),
                Tag::Conform(x) => attrs.conform = Some(x),
                Tag::T2EeUse(x) => attrs.t2ee_use = Some(x),
                Tag::VirtualUse(x) => attrs.virtual_use = Some(x),
                Tag::FramePointerUse(x) => attrs.frame_pointer_use = Some(x),
                Tag::BtiUse(x) => attrs.bti_use = Some(x),
                Tag::PacretUse(x) => attrs.pacret_use = Some(x),
                Tag::NoDefaults => attrs.no_defaults = true,
            }
        }

        for section in file.sections.values_mut() {
            if !file.attributes.no_defaults && section.attributes.empty() {
                section.attributes.inherit(&file.attributes);
            }
            if !section.attributes.no_defaults {
                for symbol in section.symbols.values_mut() {
                    if symbol.attributes.empty() {
                        symbol.attributes.inherit(&section.attributes);
                    }
                }
            }
        }

        Ok(file)
    }
}

pub struct PublicTagIter<'a> {
    cursor: Cursor<&'a [u8]>,
    endian: Endian,
}

impl<'a> Iterator for PublicTagIter<'a> {
    type Item = (u32, Tag<'a>);

    fn next(&mut self) -> Option<Self::Item> {
        let offset = self.cursor.position() as u32;
        match Tag::read(&mut self.cursor, self.endian) {
            Ok(tag) => Some((offset, tag)),
            Err(_) => None,
        }
    }
}

#[derive(Default)]
pub struct File<'a> {
    pub attributes: Attributes<'a>,
    /// Maps list of section indices to a section group
    pub sections: HashMap<&'a [u8], SectionGroup<'a>>,
}

#[derive(Default)]
pub struct SectionGroup<'a> {
    pub attributes: Attributes<'a>,
    /// Maps list of symbol values to a symbol group
    pub symbols: HashMap<&'a [u8], SymbolGroup<'a>>,
}

#[derive(Default)]
pub struct SymbolGroup<'a> {
    pub attributes: Attributes<'a>,
}

#[derive(Default)]
pub struct Attributes<'a> {
    // Target-related attributes
    pub cpu_raw_name: Option<&'a str>,
    pub cpu_name: Option<CpuName<'a>>,
    pub cpu_arch: Option<CpuArch>,
    pub cpu_arch_profile: Option<CpuArchProfile>,
    pub arm_isa_use: Option<ArmIsaUse>,
    pub thumb_isa_use: Option<ThumbIsaUse>,
    pub fp_arch: Option<FpArch>,
    pub wmmx_arch: Option<WmmxArch>,
    pub asimd_arch: Option<AsimdArch>,
    pub mve_arch: Option<MveArch>,
    pub fp_hp_ext: Option<FpHpExt>,
    pub cpu_unaligned_access: Option<CpuUnalignedAccess>,
    pub t2ee_use: Option<T2EeUse>,
    pub virtual_use: Option<VirtualUse>,
    pub mp_ext_use: Option<MpExtUse>,
    pub div_use: Option<DivUse>,
    pub dsp_ext: Option<DspExt>,
    pub pac_ext: Option<PacExt>,
    pub bti_ext: Option<BtiExt>,

    // Procedure call-related attributes
    pub pcs_config: Option<PcsConfig>,
    pub abi_pcs_r9_use: Option<AbiPcsR9Use>,
    pub abi_pcs_rw_data: Option<AbiPcsRwData>,
    pub abi_pcs_ro_data: Option<AbiPcsRoData>,
    pub abi_pcs_got_use: Option<AbiPcsGotUse>,
    pub abi_pcs_wchar_t: Option<AbiPcsWcharT>,
    pub abi_enum_size: Option<AbiEnumSize>,
    pub abi_align_needed: Option<AbiAlignNeeded>,
    pub abi_align_preserved: Option<AbiAlignPreserved>,
    pub abi_fp_rounding: Option<AbiFpRounding>,
    pub abi_fp_denormal: Option<AbiFpDenormal>,
    pub abi_fp_exceptions: Option<AbiFpExceptions>,
    pub abi_fp_user_exceptions: Option<AbiFpUserExceptions>,
    pub abi_fp_number_model: Option<AbiFpNumberModel>,
    pub abi_fp_16bit_format: Option<AbiFp16BitFormat>,
    pub abi_hardfp_use: Option<AbiHardFpUse>,
    pub abi_vfp_args: Option<AbiVfpArgs>,
    pub abi_wmmx_args: Option<AbiWmmxArgs>,
    pub frame_pointer_use: Option<FramePointerUse>,
    pub bti_use: Option<BtiUse>,

    // Miscellaneous attributes
    pub pacret_use: Option<PacretUse>,
    pub abi_opt_goals: Option<AbiOptGoals>,
    pub abi_fp_opt_goals: Option<AbiFpOptGoals>,
    pub compat: Option<Compat<'a>>,
    pub also_compat_with: Option<AlsoCompatWith<'a>>,
    pub conform: Option<Conform<'a>>,
    pub no_defaults: bool,
}

impl<'a> Attributes<'a> {
    pub fn empty(&self) -> bool {
        self.cpu_raw_name.is_none()
            && self.cpu_name.is_none()
            && self.cpu_arch.is_none()
            && self.cpu_arch_profile.is_none()
            && self.arm_isa_use.is_none()
            && self.thumb_isa_use.is_none()
            && self.fp_arch.is_none()
            && self.wmmx_arch.is_none()
            && self.asimd_arch.is_none()
            && self.mve_arch.is_none()
            && self.fp_hp_ext.is_none()
            && self.cpu_unaligned_access.is_none()
            && self.t2ee_use.is_none()
            && self.virtual_use.is_none()
            && self.mp_ext_use.is_none()
            && self.div_use.is_none()
            && self.dsp_ext.is_none()
            && self.pac_ext.is_none()
            && self.bti_ext.is_none()
            && self.pcs_config.is_none()
            && self.abi_pcs_r9_use.is_none()
            && self.abi_pcs_rw_data.is_none()
            && self.abi_pcs_ro_data.is_none()
            && self.abi_pcs_got_use.is_none()
            && self.abi_pcs_wchar_t.is_none()
            && self.abi_enum_size.is_none()
            && self.abi_align_needed.is_none()
            && self.abi_align_preserved.is_none()
            && self.abi_fp_rounding.is_none()
            && self.abi_fp_denormal.is_none()
            && self.abi_fp_exceptions.is_none()
            && self.abi_fp_user_exceptions.is_none()
            && self.abi_fp_number_model.is_none()
            && self.abi_fp_16bit_format.is_none()
            && self.abi_hardfp_use.is_none()
            && self.abi_vfp_args.is_none()
            && self.abi_wmmx_args.is_none()
            && self.frame_pointer_use.is_none()
            && self.bti_use.is_none()
            && self.pacret_use.is_none()
            && self.abi_opt_goals.is_none()
            && self.abi_fp_opt_goals.is_none()
            && self.compat.is_none()
            && self.also_compat_with.is_none()
            && self.conform.is_none()
    }

    fn inherit(&mut self, from: &Attributes<'a>) {
        macro_rules! inherit {
            ($to:ident, $from:ident, $tag:ident) => {
                $to.$tag = $to.$tag.or($from.$tag)
            };
        }
        inherit!(self, from, cpu_raw_name);
        inherit!(self, from, cpu_name);
        inherit!(self, from, cpu_arch);
        inherit!(self, from, cpu_arch_profile);
        inherit!(self, from, arm_isa_use);
        inherit!(self, from, thumb_isa_use);
        inherit!(self, from, fp_arch);
        inherit!(self, from, wmmx_arch);
        inherit!(self, from, asimd_arch);
        inherit!(self, from, mve_arch);
        inherit!(self, from, fp_hp_ext);
        inherit!(self, from, cpu_unaligned_access);
        inherit!(self, from, t2ee_use);
        inherit!(self, from, virtual_use);
        inherit!(self, from, mp_ext_use);
        inherit!(self, from, div_use);
        inherit!(self, from, dsp_ext);
        inherit!(self, from, pac_ext);
        inherit!(self, from, bti_ext);
        inherit!(self, from, pcs_config);
        inherit!(self, from, abi_pcs_r9_use);
        inherit!(self, from, abi_pcs_rw_data);
        inherit!(self, from, abi_pcs_ro_data);
        inherit!(self, from, abi_pcs_got_use);
        inherit!(self, from, abi_pcs_wchar_t);
        inherit!(self, from, abi_enum_size);
        inherit!(self, from, abi_align_needed);
        inherit!(self, from, abi_align_preserved);
        inherit!(self, from, abi_fp_rounding);
        inherit!(self, from, abi_fp_denormal);
        inherit!(self, from, abi_fp_exceptions);
        inherit!(self, from, abi_fp_user_exceptions);
        inherit!(self, from, abi_fp_number_model);
        inherit!(self, from, abi_fp_16bit_format);
        inherit!(self, from, abi_hardfp_use);
        inherit!(self, from, abi_vfp_args);
        inherit!(self, from, abi_wmmx_args);
        inherit!(self, from, frame_pointer_use);
        inherit!(self, from, bti_use);
        inherit!(self, from, pacret_use);
        inherit!(self, from, abi_opt_goals);
        inherit!(self, from, abi_fp_opt_goals);
        inherit!(self, from, compat);
        if self.also_compat_with.is_none() {
            self.also_compat_with.clone_from(&from.also_compat_with);
        }
        inherit!(self, from, conform);
    }

    pub fn display(&self, options: AttributeDisplayOptions) -> AttributeScopeDisplay {
        AttributeScopeDisplay { scope: self, options }
    }
}

pub struct AttributeScopeDisplay<'a> {
    scope: &'a Attributes<'a>,
    options: AttributeDisplayOptions,
}

pub struct AttributeDisplayOptions {
    pub indent: usize,
    pub show_defaults: bool,
    pub show_target: bool,
    pub show_pcs: bool,
    pub show_misc: bool,
}

impl<'a> AttributeScopeDisplay<'a> {
    fn display_field<T: Display + Default>(
        &self,
        f: &mut std::fmt::Formatter<'_>,
        field: &str,
        value: &Option<T>,
    ) -> std::fmt::Result {
        if let Some(value) = value {
            writeln!(f, "{}{} : {}", format_args!("{: >1$}", "", self.options.indent), field, value)
        } else if self.options.show_defaults {
            let value = T::default();
            writeln!(
                f,
                "{}{} : [default] {}",
                format_args!("{: >1$}", "", self.options.indent),
                field,
                value
            )
        } else {
            Ok(())
        }
    }

    fn display_quote(&self, f: &mut std::fmt::Formatter<'_>, field: &str, value: &Option<&str>) -> std::fmt::Result {
        if let Some(value) = value {
            writeln!(
                f,
                "{}{} : \"{}\"",
                format_args!("{: >1$}", "", self.options.indent),
                field,
                value
            )
        } else if self.options.show_defaults {
            writeln!(
                f,
                "{}{} : [default] \"\"",
                format_args!("{: >1$}", "", self.options.indent),
                field
            )
        } else {
            Ok(())
        }
    }
}

impl<'a> Display for AttributeScopeDisplay<'a> {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        let scope = self.scope;
        if self.options.show_target {
            self.display_quote(f, "CPU raw name .........", &scope.cpu_raw_name)?;
            self.display_field(f, "CPU name .............", &scope.cpu_name)?;
            self.display_field(f, "CPU arch .............", &scope.cpu_arch)?;
            self.display_field(f, "CPU arch profile .....", &scope.cpu_arch_profile)?;
            self.display_field(f, "ARM ISA use ..........", &scope.arm_isa_use)?;
            self.display_field(f, "Thumb ISA use ........", &scope.thumb_isa_use)?;
            self.display_field(f, "FP arch ..............", &scope.fp_arch)?;
            self.display_field(f, "WMMX arch ............", &scope.wmmx_arch)?;
            self.display_field(f, "Advanced SIMD arch ...", &scope.asimd_arch)?;
            self.display_field(f, "MVE arch .............", &scope.mve_arch)?;
            self.display_field(f, "FP HP extension ......", &scope.fp_hp_ext)?;
            self.display_field(f, "Unaligned access .....", &scope.cpu_unaligned_access)?;
            self.display_field(f, "T2EE use .............", &scope.t2ee_use)?;
            self.display_field(f, "Virtualization use ...", &scope.virtual_use)?;
            self.display_field(f, "MP extension use .....", &scope.mp_ext_use)?;
            self.display_field(f, "DIV use ..............", &scope.div_use)?;
            self.display_field(f, "DSP use ..............", &scope.dsp_ext)?;
            self.display_field(f, "PAC extension ........", &scope.pac_ext)?;
            self.display_field(f, "BTI extension ........", &scope.bti_ext)?;
        }
        if self.options.show_pcs {
            self.display_field(f, "PCS config ...........", &scope.pcs_config)?;
            self.display_field(f, "PCS R9 use ...........", &scope.abi_pcs_r9_use)?;
            self.display_field(f, "PCS RW data ..........", &scope.abi_pcs_rw_data)?;
            self.display_field(f, "PCS RO data ..........", &scope.abi_pcs_ro_data)?;
            self.display_field(f, "PCS GOT use ..........", &scope.abi_pcs_got_use)?;
            self.display_field(f, "PCS wchar_t ..........", &scope.abi_pcs_wchar_t)?;
            self.display_field(f, "Enum size ............", &scope.abi_enum_size)?;
            self.display_field(f, "Align needed .........", &scope.abi_align_needed)?;
            self.display_field(f, "Align preserved ......", &scope.abi_align_preserved)?;
            self.display_field(f, "FP rounding ..........", &scope.abi_fp_rounding)?;
            self.display_field(f, "FP denormal ..........", &scope.abi_fp_denormal)?;
            self.display_field(f, "FP exceptions ........", &scope.abi_fp_exceptions)?;
            self.display_field(f, "FP user exceptions ...", &scope.abi_fp_user_exceptions)?;
            self.display_field(f, "FP number format .....", &scope.abi_fp_number_model)?;
            self.display_field(f, "FP 16-bit format .....", &scope.abi_fp_16bit_format)?;
            self.display_field(f, "FP hardware use ......", &scope.abi_hardfp_use)?;
            self.display_field(f, "VFP args .............", &scope.abi_vfp_args)?;
            self.display_field(f, "WMMX args ............", &scope.abi_wmmx_args)?;
            self.display_field(f, "Frame Pointer use ....", &scope.frame_pointer_use)?;
            self.display_field(f, "BTI use ..............", &scope.bti_use)?;
        }
        if self.options.show_misc {
            self.display_field(f, "PACRET use ...........", &scope.pacret_use)?;
            self.display_field(f, "Optimization goals ...", &scope.abi_opt_goals)?;
            self.display_field(f, "FP optimization goals ", &scope.abi_fp_opt_goals)?;
            self.display_field(f, "Compatibility ........", &scope.compat)?;
            self.display_field(f, "Also compatible with .", &scope.also_compat_with)?;
            self.display_field(f, "Conformance ..........", &scope.conform)?;
        }
        Ok(())
    }
}