diff options
| author | bors <bors@rust-lang.org> | 2022-10-05 11:41:40 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2022-10-05 11:41:40 +0000 |
| commit | 8c71b67159e1a3d0863caf28b7cefee0160cb927 (patch) | |
| tree | ce442e01e1f02f2303faee0d685c189b7d2811dc /src | |
| parent | dd8c3a80dd2e5a0b62c3ef77511f3296070f78e2 (diff) | |
| parent | c65c36242e99ddbf787dcdd9bd2d14f42f7cfce6 (diff) | |
| download | rust-8c71b67159e1a3d0863caf28b7cefee0160cb927.tar.gz rust-8c71b67159e1a3d0863caf28b7cefee0160cb927.zip | |
Auto merge of #98736 - alex:lipo-magic, r=bjorn3
resolve error when attempting to link a universal library on macOS Previously attempting to link universal libraries into libraries (but not binaries) would produce an error that "File too small to be an archive". This works around this by invoking `lipo -thin` to extract a library for the target platform when passed a univeral library. Fixes #55235 It's worth acknowledging that this implementation is kind of a horrible hack. Unfortunately I don't know how to do anything better, hopefully this PR will be a jumping off point.
Diffstat (limited to 'src')
| -rw-r--r-- | src/test/run-make/macos-fat-archive/Makefile | 10 | ||||
| -rw-r--r-- | src/test/run-make/macos-fat-archive/lib.rs | 3 | ||||
| -rw-r--r-- | src/test/run-make/macos-fat-archive/native-library.c | 1 |
3 files changed, 14 insertions, 0 deletions
diff --git a/src/test/run-make/macos-fat-archive/Makefile b/src/test/run-make/macos-fat-archive/Makefile new file mode 100644 index 00000000000..cc99375db69 --- /dev/null +++ b/src/test/run-make/macos-fat-archive/Makefile @@ -0,0 +1,10 @@ +# only-macos + +-include ../../run-make-fulldeps/tools.mk + +"$(TMPDIR)"/libnative-library.a: native-library.c + $(CC) -arch arm64 -arch x86_64 native-library.c -c -o "$(TMPDIR)"/native-library.o + $(AR) crs "$(TMPDIR)"/libnative-library.a "$(TMPDIR)"/native-library.o + +all: "$(TMPDIR)"/libnative-library.a + $(RUSTC) lib.rs --crate-type=lib -L "native=$(TMPDIR)" -l static=native-library diff --git a/src/test/run-make/macos-fat-archive/lib.rs b/src/test/run-make/macos-fat-archive/lib.rs new file mode 100644 index 00000000000..9943a266c3e --- /dev/null +++ b/src/test/run-make/macos-fat-archive/lib.rs @@ -0,0 +1,3 @@ +extern "C" { + pub fn native_func(); +} diff --git a/src/test/run-make/macos-fat-archive/native-library.c b/src/test/run-make/macos-fat-archive/native-library.c new file mode 100644 index 00000000000..d300fdf1c17 --- /dev/null +++ b/src/test/run-make/macos-fat-archive/native-library.c @@ -0,0 +1 @@ +void native_func() {} |
