Subject: bug#73318: 31.0.50; with-native-compilation=aot breaks exec -a emacs

From: Spencer Baugh <[email-masked]>
Date: Tue, 17 Sep 2024 11:18:41 -0400

1. Compile and install Emacs with --with-native-compilation=aot, e.g.:
prefix=~/prefix
mkdir $prefix
./configure --with-native-compilation=aot --prefix=$prefix
make -j64 && make install
2. Run emacs with "exec -a" to change its argv[0]:
sh -c "exec -a emacs $prefix/bin/emacs -Q --batch"
3. Observe an error like:
Error using execdir /usr/local/home/sbaugh/workspaces/24833141-bffb-3c99-a9d6-c366d37c4f5e/+share+/app/emacs/bin/:
emacs: /usr/local/home/sbaugh/workspaces/24833141-bffb-3c99-a9d6-c366d37c4f5e/+share+/app/emacs/bin/../native-lisp/31.0.50-a88a37f5/preloaded/minibuffer-b2d9c221-284ab177.eln: cannot open shared object file: No such file or directory

"exec -a emacs" works fine for with-native-compilation=yes or
with-native-compilation=no.