Skip to content

Commit aeeb282

Browse files
Merge pull request #36 from ahmedcharles/cleanup
Various cleanups.
2 parents 00cf317 + 8a28a25 commit aeeb282

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

src/elf_sections.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ impl ElfSectionsTag {
4545
}
4646
}
4747

48-
#[derive(Clone)]
48+
#[derive(Clone, Debug)]
4949
pub struct ElfSectionIter {
5050
current_section: *const u8,
5151
remaining_sections: u32,
@@ -78,14 +78,15 @@ impl Iterator for ElfSectionIter {
7878
}
7979
}
8080

81+
#[derive(Debug)]
8182
pub struct ElfSection {
8283
inner: *const u8,
8384
string_section: *const u8,
8485
entry_size: u32,
8586
}
8687

8788
#[derive(Debug)]
88-
#[repr(C)]
89+
#[repr(C, packed)]
8990
struct ElfSectionInner32 {
9091
name_index: u32,
9192
typ: u32,
@@ -100,7 +101,7 @@ struct ElfSectionInner32 {
100101
}
101102

102103
#[derive(Debug)]
103-
#[repr(C)]
104+
#[repr(C, packed)]
104105
struct ElfSectionInner64 {
105106
name_index: u32,
106107
typ: u32,

src/header.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
#[repr(C)]
1+
#[derive(Debug)]
2+
#[repr(C, packed)]
23
pub struct Tag {
34
pub typ: u32,
45
pub size: u32,
56
// tag specific fields
67
}
78

9+
#[derive(Debug)]
810
pub struct TagIter {
911
pub current: *const Tag,
1012
}

src/lib.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
#![no_std]
22

3+
#![deny(missing_debug_implementations)]
4+
35
use core::fmt;
46

57
use header::{Tag, TagIter};
@@ -33,7 +35,7 @@ pub struct BootInformation {
3335
inner: *const BootInformationInner,
3436
}
3537

36-
#[repr(C)]
38+
#[repr(C, packed)]
3739
struct BootInformationInner {
3840
total_size: u32,
3941
_reserved: u32,

src/module.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use header::{Tag, TagIter};
22

3-
#[repr(packed)]
43
#[derive(Debug)]
4+
#[repr(C, packed)]
55
pub struct ModuleTag {
66
typ: u32,
77
size: u32,
@@ -36,6 +36,7 @@ pub fn module_iter(iter: TagIter) -> ModuleIter {
3636
ModuleIter { iter: iter }
3737
}
3838

39+
#[derive(Debug)]
3940
pub struct ModuleIter {
4041
iter: TagIter,
4142
}

0 commit comments

Comments
 (0)