Skip to content

Commit 9620f42

Browse files
authored
Merge pull request #316 from philipc/release
Release 0.25.0
2 parents 7f637ae + cf21037 commit 9620f42

10 files changed

Lines changed: 89 additions & 11 deletions

File tree

CHANGELOG.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# `object` Change Log
2+
3+
--------------------------------------------------------------------------------
4+
5+
## 0.25.0
6+
7+
Released 2021/06/02.
8+
9+
### Breaking changes
10+
11+
* Added `non_exhaustive` to most public enums.
12+
[#306](https://github.com/gimli-rs/object/pull/306)
13+
14+
* `MachHeader::parse` and `MachHeader::load_commands` now require a header offset.
15+
[#304](https://github.com/gimli-rs/object/pull/304)
16+
17+
* Added `ReadRef::read_bytes_at_until`.
18+
[#308](https://github.com/gimli-rs/object/pull/308)
19+
20+
* `PeFile::entry`, `PeSection::address` and `PeSegment::address` now return a
21+
virtual address instead of a RVA.
22+
[#315](https://github.com/gimli-rs/object/pull/315)
23+
24+
### Added
25+
26+
* Added `pod::from_bytes_mut`, `pod::slice_from_bytes_mut`, `pod::bytes_of_mut`,
27+
and `pod::bytes_of_slice_mut`.
28+
[#296](https://github.com/gimli-rs/object/pull/296)
29+
[#297](https://github.com/gimli-rs/object/pull/297)
30+
31+
* Added `Object::pdb_info`.
32+
[#298](https://github.com/gimli-rs/object/pull/298)
33+
34+
* Added `read::macho::DyldCache`, other associated definitions,
35+
and support for these in the examples.
36+
[#308](https://github.com/gimli-rs/object/pull/308)
37+
38+
* Added more architecture support.
39+
[#303](https://github.com/gimli-rs/object/pull/303)
40+
[#309](https://github.com/gimli-rs/object/pull/309)
41+
42+
* Derive more traits for enums.
43+
[#311](https://github.com/gimli-rs/object/pull/311)
44+
45+
* Added `Object::relative_address_base`.
46+
[#315](https://github.com/gimli-rs/object/pull/315)
47+
48+
### Changed
49+
50+
* Improved performance for string parsing.
51+
[#302](https://github.com/gimli-rs/object/pull/302)
52+
53+
* `objdump` example allows selecting container members.
54+
[#308](https://github.com/gimli-rs/object/pull/308)

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "object"
3-
version = "0.24.0"
3+
version = "0.25.0"
44
authors = [
55
"Nick Fitzgerald <fitzgen@gmail.com>",
66
"Philip Craig <philipjcraig@gmail.com>",

src/pod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,7 @@ impl BytesMut {
343343
}
344344

345345
#[inline]
346+
#[allow(dead_code)]
346347
pub fn write<T: Pod>(&mut self, val: &T) {
347348
self.0.extend_from_slice(bytes_of(val))
348349
}

src/read/any.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ use crate::read::{
1919
SectionIndex, SectionKind, SymbolFlags, SymbolIndex, SymbolKind, SymbolMap, SymbolMapName,
2020
SymbolScope, SymbolSection,
2121
};
22+
#[allow(unused_imports)]
2223
use crate::Endianness;
2324

2425
/// Evaluate an expression on the contents of a file format enum.
@@ -226,15 +227,16 @@ impl<'data, R: ReadRef<'data>> File<'data, R> {
226227
/// where multiple images, located at different offsets, share the same address
227228
/// space.
228229
pub fn parse_at(data: R, offset: u64) -> Result<Self> {
229-
let inner = match FileKind::parse_at(data, offset)? {
230+
let _inner = match FileKind::parse_at(data, offset)? {
230231
#[cfg(feature = "macho")]
231232
FileKind::MachO32 => FileInternal::MachO32(macho::MachOFile32::parse_at(data, offset)?),
232233
#[cfg(feature = "macho")]
233234
FileKind::MachO64 => FileInternal::MachO64(macho::MachOFile64::parse_at(data, offset)?),
234235
#[allow(unreachable_patterns)]
235236
_ => return Err(Error("Unsupported file format")),
236237
};
237-
Ok(File { inner })
238+
#[allow(unreachable_code)]
239+
Ok(File { inner: _inner })
238240
}
239241

240242
/// Return the file format.

src/read/mod.rs

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use alloc::vec::Vec;
55
use core::{fmt, result};
66

77
use crate::common::*;
8-
use crate::{ByteString, Endianness};
8+
use crate::ByteString;
99

1010
mod read_ref;
1111
pub use read_ref::*;
@@ -18,7 +18,21 @@ pub use read_cache::*;
1818
mod util;
1919
pub use util::StringTable;
2020

21+
#[cfg(any(
22+
feature = "coff",
23+
feature = "elf",
24+
feature = "macho",
25+
feature = "pe",
26+
feature = "wasm"
27+
))]
2128
mod any;
29+
#[cfg(any(
30+
feature = "coff",
31+
feature = "elf",
32+
feature = "macho",
33+
feature = "pe",
34+
feature = "wasm"
35+
))]
2236
pub use any::*;
2337

2438
#[cfg(feature = "archive")]
@@ -86,7 +100,7 @@ impl<T> ReadError<T> for Option<T> {
86100
target_pointer_width = "32",
87101
feature = "elf"
88102
))]
89-
pub type NativeFile<'data, R = &'data [u8]> = elf::ElfFile32<'data, Endianness, R>;
103+
pub type NativeFile<'data, R = &'data [u8]> = elf::ElfFile32<'data, crate::Endianness, R>;
90104

91105
/// The native executable file for the target platform.
92106
#[cfg(all(
@@ -95,15 +109,15 @@ pub type NativeFile<'data, R = &'data [u8]> = elf::ElfFile32<'data, Endianness,
95109
target_pointer_width = "64",
96110
feature = "elf"
97111
))]
98-
pub type NativeFile<'data, R = &'data [u8]> = elf::ElfFile64<'data, Endianness, R>;
112+
pub type NativeFile<'data, R = &'data [u8]> = elf::ElfFile64<'data, crate::Endianness, R>;
99113

100114
/// The native executable file for the target platform.
101115
#[cfg(all(target_os = "macos", target_pointer_width = "32", feature = "macho"))]
102-
pub type NativeFile<'data, R = &'data [u8]> = macho::MachOFile32<'data, Endianness, R>;
116+
pub type NativeFile<'data, R = &'data [u8]> = macho::MachOFile32<'data, crate::Endianness, R>;
103117

104118
/// The native executable file for the target platform.
105119
#[cfg(all(target_os = "macos", target_pointer_width = "64", feature = "macho"))]
106-
pub type NativeFile<'data, R = &'data [u8]> = macho::MachOFile64<'data, Endianness, R>;
120+
pub type NativeFile<'data, R = &'data [u8]> = macho::MachOFile64<'data, crate::Endianness, R>;
107121

108122
/// The native executable file for the target platform.
109123
#[cfg(all(target_os = "windows", target_pointer_width = "32", feature = "pe"))]

src/read/util.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ use core::convert::TryInto;
22

33
use crate::pod::Bytes;
44

5-
#[allow(unused)]
5+
#[allow(dead_code)]
66
#[inline]
77
pub(crate) fn align(offset: usize, size: usize) -> usize {
88
(offset + (size - 1)) & !(size - 1)
99
}
1010

11+
#[allow(dead_code)]
1112
pub(crate) fn data_range(
1213
data: &[u8],
1314
data_address: u64,

src/write/elf.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ use crate::pod::{bytes_of, BytesMut, WritableBuffer};
77
use crate::write::string::*;
88
use crate::write::util::*;
99
use crate::write::*;
10+
use crate::AddressSize;
1011

1112
#[derive(Default, Clone, Copy)]
1213
struct ComdatOffsets {

src/write/macho.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ use crate::pod::{bytes_of, WritableBuffer};
66
use crate::write::string::*;
77
use crate::write::util::*;
88
use crate::write::*;
9+
use crate::AddressSize;
910

1011
#[derive(Default, Clone, Copy)]
1112
struct SectionOffsets {

src/write/mod.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use std::{error, fmt, result, str};
88
use crate::endian::{Endianness, U32, U64};
99
use crate::pod::{BytesMut, WritableBuffer};
1010
use crate::{
11-
AddressSize, Architecture, BinaryFormat, ComdatKind, FileFlags, RelocationEncoding,
12-
RelocationKind, SectionFlags, SectionKind, SymbolFlags, SymbolKind, SymbolScope,
11+
Architecture, BinaryFormat, ComdatKind, FileFlags, RelocationEncoding, RelocationKind,
12+
SectionFlags, SectionKind, SymbolFlags, SymbolKind, SymbolScope,
1313
};
1414

1515
#[cfg(feature = "coff")]
@@ -103,6 +103,7 @@ impl Object {
103103
/// Return the name for a standard segment.
104104
///
105105
/// This will vary based on the file format.
106+
#[allow(unused_variables)]
106107
pub fn segment_name(&self, segment: StandardSegment) -> &'static [u8] {
107108
match self.format {
108109
#[cfg(feature = "coff")]
@@ -241,6 +242,7 @@ impl Object {
241242
(segment, name, kind)
242243
}
243244

245+
#[allow(unused_variables)]
244246
fn subsection_name(&self, section: &[u8], value: &[u8]) -> Vec<u8> {
245247
debug_assert!(!self.has_subsections_via_symbols());
246248
match self.format {
@@ -432,6 +434,7 @@ impl Object {
432434
///
433435
/// For Mach-O, this also creates a `__thread_vars` entry for TLS symbols, and the
434436
/// symbol will indirectly point to the data via the `__thread_vars` entry.
437+
#[allow(unused_mut)]
435438
pub fn set_symbol_data(
436439
&mut self,
437440
mut symbol_id: SymbolId,

src/write/util.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub(crate) fn align(offset: usize, size: usize) -> usize {
44
(offset + (size - 1)) & !(size - 1)
55
}
66

7+
#[allow(dead_code)]
78
pub(crate) fn align_u64(offset: u64, size: u64) -> u64 {
89
(offset + (size - 1)) & !(size - 1)
910
}

0 commit comments

Comments
 (0)