Browse Source

Update object to 0.36 (#8733)

* Update object to 0.36

* Update exemptions for the `object` crate

---------

Co-authored-by: Alex Crichton <alex@alexcrichton.com>
pull/8738/head
Philip Craig 5 months ago
committed by GitHub
parent
commit
44cd0026d6
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 22
      Cargo.lock
  2. 2
      Cargo.toml
  3. 16
      cranelift/object/src/backend.rs
  4. 2
      crates/wasmtime/src/runtime/debug.rs
  5. 4
      examples/min-platform/src/main.rs
  6. 6
      supply-chain/config.toml

22
Cargo.lock

@ -781,7 +781,7 @@ dependencies = [
"cranelift-frontend", "cranelift-frontend",
"cranelift-module", "cranelift-module",
"log", "log",
"object 0.33.0", "object 0.36.0",
"target-lexicon", "target-lexicon",
] ]
@ -1862,7 +1862,7 @@ version = "22.0.0"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"libloading", "libloading",
"object 0.33.0", "object 0.36.0",
"wasmtime", "wasmtime",
] ]
@ -1932,9 +1932,9 @@ dependencies = [
[[package]] [[package]]
name = "object" name = "object"
version = "0.33.0" version = "0.36.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d8dd6c0cdf9429bce006e1362bfce61fa1bfd8c898a643ed8d2b471934701d3d" checksum = "576dfe1fc8f9df304abb159d767a29d0476f7750fbf8aa7ad07816004a207434"
dependencies = [ dependencies = [
"crc32fast", "crc32fast",
"hashbrown 0.14.3", "hashbrown 0.14.3",
@ -3184,7 +3184,7 @@ version = "22.0.0"
dependencies = [ dependencies = [
"bitflags 2.4.1", "bitflags 2.4.1",
"byte-array-literals", "byte-array-literals",
"object 0.33.0", "object 0.36.0",
"wasi", "wasi",
"wasm-encoder", "wasm-encoder",
"wit-bindgen-rust-macro", "wit-bindgen-rust-macro",
@ -3392,7 +3392,7 @@ dependencies = [
"mach2", "mach2",
"memfd", "memfd",
"memoffset", "memoffset",
"object 0.33.0", "object 0.36.0",
"once_cell", "once_cell",
"paste", "paste",
"postcard", "postcard",
@ -3537,7 +3537,7 @@ dependencies = [
"log", "log",
"memchr", "memchr",
"num_cpus", "num_cpus",
"object 0.33.0", "object 0.36.0",
"once_cell", "once_cell",
"rayon", "rayon",
"rustix", "rustix",
@ -3624,7 +3624,7 @@ dependencies = [
"cranelift-wasm", "cranelift-wasm",
"gimli", "gimli",
"log", "log",
"object 0.33.0", "object 0.36.0",
"target-lexicon", "target-lexicon",
"thiserror", "thiserror",
"wasmparser", "wasmparser",
@ -3644,7 +3644,7 @@ dependencies = [
"gimli", "gimli",
"indexmap 2.2.6", "indexmap 2.2.6",
"log", "log",
"object 0.33.0", "object 0.36.0",
"postcard", "postcard",
"rustc-demangle", "rustc-demangle",
"serde", "serde",
@ -3761,7 +3761,7 @@ dependencies = [
name = "wasmtime-jit-debug" name = "wasmtime-jit-debug"
version = "22.0.0" version = "22.0.0"
dependencies = [ dependencies = [
"object 0.33.0", "object 0.36.0",
"once_cell", "once_cell",
"rustix", "rustix",
"wasmtime-versioned-export-macros", "wasmtime-versioned-export-macros",
@ -3916,7 +3916,7 @@ dependencies = [
"anyhow", "anyhow",
"cranelift-codegen", "cranelift-codegen",
"gimli", "gimli",
"object 0.33.0", "object 0.36.0",
"target-lexicon", "target-lexicon",
"wasmparser", "wasmparser",
"wasmtime-cranelift", "wasmtime-cranelift",

2
Cargo.toml

@ -265,7 +265,7 @@ wit-component = "0.209.1"
# Non-Bytecode Alliance maintained dependencies: # Non-Bytecode Alliance maintained dependencies:
# -------------------------- # --------------------------
cc = "1.0" 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'] } gimli = { version = "0.28.0", default-features = false, features = ['read'] }
addr2line = { version = "0.21.0", default-features = false } addr2line = { version = "0.21.0", default-features = false }
anyhow = { version = "1.0.22", default-features = false } anyhow = { version = "1.0.22", default-features = false }

16
cranelift/object/src/backend.rs

@ -154,6 +154,7 @@ impl ObjectModule {
pub fn new(builder: ObjectBuilder) -> Self { pub fn new(builder: ObjectBuilder) -> Self {
let mut object = Object::new(builder.binary_format, builder.architecture, builder.endian); let mut object = Object::new(builder.binary_format, builder.architecture, builder.endian);
object.flags = builder.flags; object.flags = builder.flags;
object.set_subsections_via_symbols();
object.add_file_symbol(builder.name); object.add_file_symbol(builder.name);
Self { Self {
isa: builder.isa, isa: builder.isa,
@ -368,19 +369,14 @@ impl Module for ObjectModule {
let align = alignment let align = alignment
.max(self.isa.function_alignment().minimum.into()) .max(self.isa.function_alignment().minimum.into())
.max(self.isa.symbol_alignment()); .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 symbol_name = self.object.symbol(symbol).name.clone();
let (section, offset) = self.object
self.object .add_subsection(StandardSection::Text, &symbol_name)
.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)
} else { } else {
let section = self.object.section_id(StandardSection::Text); self.object.section_id(StandardSection::Text)
let offset = self.object.add_symbol_data(symbol, section, bytes, align);
(section, offset)
}; };
let offset = self.object.add_symbol_data(symbol, section, bytes, align);
if !relocs.is_empty() { if !relocs.is_empty() {
let relocs = relocs let relocs = relocs

2
crates/wasmtime/src/runtime/debug.rs

@ -127,7 +127,7 @@ fn convert_object_elf_to_loadable_file<E: Endian>(
let text_range = match sections.section_by_name(e, b".text") { let text_range = match sections.section_by_name(e, b".text") {
Some((i, text)) => { Some((i, text)) => {
let range = text.file_range(e); 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> = let section: &mut SectionHeader64<E> =
object::from_bytes_mut(&mut bytes[off..]).unwrap().0; object::from_bytes_mut(&mut bytes[off..]).unwrap().0;

4
examples/min-platform/src/main.rs

@ -10,7 +10,7 @@ fn main() -> Result<()> {
fn main() -> Result<()> { fn main() -> Result<()> {
use anyhow::{anyhow, Context}; use anyhow::{anyhow, Context};
use libloading::os::unix::{Library, Symbol, RTLD_GLOBAL, RTLD_NOW}; use libloading::os::unix::{Library, Symbol, RTLD_GLOBAL, RTLD_NOW};
use object::{Object, ObjectSymbol, SymbolKind}; use object::{Object, ObjectSymbol};
use std::io::Write; use std::io::Write;
use wasmtime::{Config, Engine}; use wasmtime::{Config, Engine};
@ -44,7 +44,7 @@ fn main() -> Result<()> {
// running `libembedding.so` in this case requires only minimal // running `libembedding.so` in this case requires only minimal
// dependencies. // dependencies.
for sym in object.symbols() { for sym in object.symbols() {
if !sym.is_undefined() || sym.is_weak() || sym.kind() == SymbolKind::Null { if !sym.is_undefined() || sym.is_weak() {
continue; continue;
} }

6
supply-chain/config.toml

@ -405,7 +405,11 @@ version = "0.3.0"
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
[[exemptions.object]] [[exemptions.object]]
version = "0.29.0" version = "0.32.0"
criteria = "safe-to-deploy"
[[exemptions.object]]
version = "0.36.0"
criteria = "safe-to-deploy" criteria = "safe-to-deploy"
[[exemptions.ocaml-boxroot-sys]] [[exemptions.ocaml-boxroot-sys]]

Loading…
Cancel
Save