Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unsupported file format #454

Closed
anranziruo opened this issue Aug 1, 2022 · 3 comments
Closed

Unsupported file format #454

anranziruo opened this issue Aug 1, 2022 · 3 comments

Comments

@anranziruo
Copy link

system:macOS
object library version:0.29.0
open local dSYM file occur error:Unsupported file format,i find the file has two architecture,(armv7,arm64),another file only one
architecture can work well

@philipc
Copy link
Contributor

philipc commented Aug 1, 2022

Does the objdump example work on the file?

This sounds like FileKind::parse is returning FileKind::MachOFat32 or FileKind::MachOFat64, and File::parse is failing because it does not support that. This is expected behaviour: you need to use FatHeader::parse_arch32 or FatHeader::parse_arch64 for these files, since they contain multiple architectures. The code in the objdump example shows how you can parse these files.

@anranziruo
Copy link
Author

sorry,in object version 0.29.0 ,arch.architecture() this method has no exist

@philipc
Copy link
Contributor

philipc commented Aug 1, 2022

The objdump code that I linked is version 0.29.0, so it does exist. The architecture method is from the FatArch trait. You'll need to use that trait, as done in the objdump example.

@philipc philipc closed this as completed Aug 27, 2022
eeeebbbbrrrr pushed a commit to pgcentralfoundation/pgrx that referenced this issue Jun 16, 2023
FIXES: #1087

A "universal binary" is a fat binary which contains multiple builds for
different architectures. When Postgres is packaged in this format it's
necessary to slice out the build for the current architecture before
trying to parse it. The program terminates early if the universal binary
doesn't support the current architecture.

The list of supported architectures in `slice_arch32` is limited by
[`object`][object-arch], which supports fewer than [Rust][rust-arch].

The universal binary test fixture was simply chosen because of it's
small size relative to other binaries in Postgres.

[^1]: gimli-rs/object#454 (comment)

[rust-arch]: http://doc.rust-lang.org/1.68.2/std/env/consts/constant.ARCH.html
[object-arch]: https://docs.rs/object/latest/object/read/macho/trait.FatArch.html#method.architecture
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants