[llvm] [ObjCopy] Respect requirements of LC_ENCRYPTION_INFO commands (PR #120995)
Mike Hommey via llvm-commits
llvm-commits at lists.llvm.org
Wed Jan 29 22:37:02 PST 2025
glandium wrote:
So, the repro requires an old version of cctools-port, and ldid. It's possible that it's reproducible on macos, but ldid requires building openssl, and I stopped there. For convenience, here's a Dockerfile that will build it all:
```
FROM debian:bookworm
RUN apt update && \
apt install -y cmake clang git libssl-dev && \
git clone https://github.com/tpoechtrager/apple-libtapi && \
git clone https://github.com/tpoechtrager/cctools-port && \
git clone https://github.com/tpoechtrager/ldid && \
cd apple-libtapi && \
INSTALLPREFIX=/opt/cctools ./build.sh && \
./install.sh && \
cd ../cctools-port/cctools && \
git checkout 30518813875aed656aa7f18b6d485feee25f8f87 && \
./configure --prefix=/opt/cctools --with-libtapi=/opt/cctools && \
make -j$(nproc) install || true && \
cd ../../ldid && \
make -j$(nproc) install INSTALLPREFIX=/opt/cctools CC=clang CXX=clang++ && \
cd ../ && \
rm -rf apple-libtapi cctools-port ldid
```
You may do something like `mkdir cctools; docker build -t foo -v $PWD/cctools:/opt/cctools . && docker image rm foo` (assuming you're in the directory where `Dockerfile` is). That will leave you with the required tools in `$PWD/cctools/bin`.
Then, you can use a dummy C file:
```
int main() { return 0; }
```
Build with: `PATH=/path/to/cctools/bin LD_LIBRARY_PATH=/path/to/cctools/lib clang -g -o dummy dummy.c --target=aarch64-apple-darwin -isysroot /path/to/MacOSX.sdk`
If you run that on macos, it works.
Now, if you `llvm-strip -S` it, and run it on macos, it doesn't work anymore.
If you `llvm-strip -S` the original file with a revision before this change, the binary still works.
I know you said you wouldn't download a binary, but here's a small one you can inspect and see it doesn't do anything nefarious: https://glandium.org/files/dummy (the entirety of the text segment is a function that does nothing, it's compiled from the source above, but with -O3)
https://github.com/llvm/llvm-project/pull/120995
More information about the llvm-commits
mailing list