Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libwild/src/input_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,8 @@ impl<'data, P: Platform> TemporaryState<'data, P> {
}))
}
FileKind::MachOStubLibrary => {
let defined_library = parse_defined_library(str::from_utf8(input_file.data())?)?;
let defined_library = parse_defined_library(str::from_utf8(input_file.data())?)
.with_context(|| format!("Failed to process `{}`", absolute_path.display()))?;
tracing::debug!(file = ?input_file.filename, symbols = defined_library.symbols.len(),
weak_symbols = defined_library.weak_symbols.len(), "loaded TBD library");
Ok(LoadedFileState::StubLibrary(input_file, defined_library))
Expand Down
28 changes: 15 additions & 13 deletions libwild/src/macho_stub_library.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use itertools::Itertools;
use serde::Deserialize;
use std::collections::HashSet;

const ARM64_LIB_ARCH: &str = "arm64-macos";
const ARM64_LIB_ARCH: &str = "arm64e-macos";

#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
#[serde(rename_all = "kebab-case")]
Expand Down Expand Up @@ -105,7 +105,8 @@ pub fn parse_defined_library<'data>(input: &'data str) -> Result<DefinedStubLibr
.ok_or_else(|| error!("root library must be defined"))?;
ensure!(
main_library.targets.contains(&ARM64_LIB_ARCH),
"'{ARM64_LIB_ARCH}' architecture not implemented by the library"
"Library only supports {targets:?}, but we need {ARM64_LIB_ARCH}",
targets = main_library.targets,
);

ensure!(
Expand Down Expand Up @@ -141,7 +142,8 @@ pub fn parse_defined_library<'data>(input: &'data str) -> Result<DefinedStubLibr
{
ensure!(
exported_libraries.targets.contains(&ARM64_LIB_ARCH),
"'{ARM64_LIB_ARCH}' architecture not covered in the exported library"
"Exported library only supports {:?}, but we need {ARM64_LIB_ARCH}",
exported_libraries.targets
);
let exported_libraries: HashSet<_> = exported_libraries.libraries.iter().copied().collect();
exported_libraries
Expand Down Expand Up @@ -185,46 +187,46 @@ mod tests {
let stub_library = parse_defined_library(
r"--- !tapi-tbd
tbd-version: 4
targets: [ x86_64-macos, arm64-macos ]
targets: [ x86_64-macos, arm64e-macos ]
install-name: '/usr/lib/libMain.dylib'
current-version: 1.2.3
reexported-libraries:
- targets: [ x86_64-macos, arm64-macos ]
- targets: [ x86_64-macos, arm64e-macos ]
libraries: [ '/usr/lib/libA.dylib', '/usr/lib/libB.dylib' ]
exports:
- targets: [ arm64-macos ]
- targets: [ arm64e-macos ]
symbols: [ _main_arm64 ]
weak-symbols: [ _main_weak_arm64 ]
- targets: [ x86_64-macos ]
symbols: [ _main_x86_64 ]
weak-symbols: [ _main_weak_x86_64 ]
--- !tapi-tbd
tbd-version: 4
targets: [ x86_64-macos, arm64-macos ]
targets: [ x86_64-macos, arm64e-macos ]
install-name: '/usr/lib/libA.dylib'
current-version: 10
parent-umbrella:
- targets: [ x86_64-macos, arm64-macos ]
- targets: [ x86_64-macos, arm64e-macos ]
umbrella: Main
exports:
- targets: [ arm64-macos ]
- targets: [ arm64e-macos ]
symbols: [ _a_arm64 ]
weak-symbols: [ _a_weak_arm64 ]
- targets: [ x86_64-macos ]
symbols: [ _a_x86_64 ]
--- !tapi-tbd
tbd-version: 4
targets: [ x86_64-macos, arm64-macos ]
targets: [ x86_64-macos, arm64e-macos ]
install-name: '/usr/lib/libB.dylib'
current-version: 11
parent-umbrella:
- targets: [ x86_64-macos, arm64-macos ]
- targets: [ x86_64-macos, arm64e-macos ]
umbrella: Main
exports:
- targets: [ arm64-macos ]
- targets: [ arm64e-macos ]
symbols: [ _b_arm64 ]
reexports:
- targets: [ arm64-macos ]
- targets: [ arm64e-macos ]
symbols: [ _b_exported_arm64 ]
weak-symbols: [ _b_weak_exported_arm64 ]
",
Expand Down
2 changes: 2 additions & 0 deletions wild/tests/sources/macho/trivial-cpp/trivial-cpp.cc
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//#LinkerDriver:clang++
//#ExpectWarningWild:Fat object file is not supported yet
//#DiffIgnore:section.__unwind_info
//#DiffIgnore:section.__gcc_except_tab

#include <iostream>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//#TestUpdateInPlace:true
//#LinkerDriver:clang
//#ExpectWarningWild:Fat object file is not supported yet
//#DiffIgnore:section.__unwind_info

#include <stdio.h>
#include <string.h>
Expand Down