Skip to content

Commit

Permalink
Update object to 0.36 (#8733)
Browse files Browse the repository at this point in the history
* Update object to 0.36

* Update exemptions for the `object` crate

---------

Co-authored-by: Alex Crichton <[email protected]>
  • Loading branch information
philipc and alexcrichton authored Jun 3, 2024
1 parent 4422074 commit 44cd002
Show file tree
Hide file tree
Showing 6 changed files with 26 additions and 26 deletions.
22 changes: 11 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ wit-component = "0.209.1"
# Non-Bytecode Alliance maintained dependencies:
# --------------------------
cc = "1.0"
object = { version = "0.33", default-features = false, features = ['read_core', 'elf'] }
object = { version = "0.36", default-features = false, features = ['read_core', 'elf'] }
gimli = { version = "0.28.0", default-features = false, features = ['read'] }
addr2line = { version = "0.21.0", default-features = false }
anyhow = { version = "1.0.22", default-features = false }
Expand Down
16 changes: 6 additions & 10 deletions cranelift/object/src/backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ impl ObjectModule {
pub fn new(builder: ObjectBuilder) -> Self {
let mut object = Object::new(builder.binary_format, builder.architecture, builder.endian);
object.flags = builder.flags;
object.set_subsections_via_symbols();
object.add_file_symbol(builder.name);
Self {
isa: builder.isa,
Expand Down Expand Up @@ -368,19 +369,14 @@ impl Module for ObjectModule {
let align = alignment
.max(self.isa.function_alignment().minimum.into())
.max(self.isa.symbol_alignment());
let (section, offset) = if self.per_function_section {
let section = if self.per_function_section {
let symbol_name = self.object.symbol(symbol).name.clone();
let (section, offset) =
self.object
.add_subsection(StandardSection::Text, &symbol_name, bytes, align);
self.object.symbol_mut(symbol).section = SymbolSection::Section(section);
self.object.symbol_mut(symbol).value = offset;
(section, offset)
self.object
.add_subsection(StandardSection::Text, &symbol_name)
} else {
let section = self.object.section_id(StandardSection::Text);
let offset = self.object.add_symbol_data(symbol, section, bytes, align);
(section, offset)
self.object.section_id(StandardSection::Text)
};
let offset = self.object.add_symbol_data(symbol, section, bytes, align);

if !relocs.is_empty() {
let relocs = relocs
Expand Down
2 changes: 1 addition & 1 deletion crates/wasmtime/src/runtime/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fn convert_object_elf_to_loadable_file<E: Endian>(
let text_range = match sections.section_by_name(e, b".text") {
Some((i, text)) => {
let range = text.file_range(e);
let off = header.e_shoff.get(e) as usize + i * header.e_shentsize.get(e) as usize;
let off = header.e_shoff.get(e) as usize + i.0 * header.e_shentsize.get(e) as usize;

let section: &mut SectionHeader64<E> =
object::from_bytes_mut(&mut bytes[off..]).unwrap().0;
Expand Down
4 changes: 2 additions & 2 deletions examples/min-platform/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ fn main() -> Result<()> {
fn main() -> Result<()> {
use anyhow::{anyhow, Context};
use libloading::os::unix::{Library, Symbol, RTLD_GLOBAL, RTLD_NOW};
use object::{Object, ObjectSymbol, SymbolKind};
use object::{Object, ObjectSymbol};
use std::io::Write;
use wasmtime::{Config, Engine};

Expand Down Expand Up @@ -44,7 +44,7 @@ fn main() -> Result<()> {
// running `libembedding.so` in this case requires only minimal
// dependencies.
for sym in object.symbols() {
if !sym.is_undefined() || sym.is_weak() || sym.kind() == SymbolKind::Null {
if !sym.is_undefined() || sym.is_weak() {
continue;
}

Expand Down
6 changes: 5 additions & 1 deletion supply-chain/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,11 @@ version = "0.3.0"
criteria = "safe-to-deploy"

[[exemptions.object]]
version = "0.29.0"
version = "0.32.0"
criteria = "safe-to-deploy"

[[exemptions.object]]
version = "0.36.0"
criteria = "safe-to-deploy"

[[exemptions.ocaml-boxroot-sys]]
Expand Down

0 comments on commit 44cd002

Please sign in to comment.