Merge libpsapi.a into libunwind.a

This avoids having to manually add -lpsapi when linking in libc++.a.

This requires using a new script to merge libraries using ar -M
with a small MRI script.

The script merge_archives.py in libcxx does the merge by manually
extracting all object files and creating a new archive out of them.
The import libraries created by LLVM have more than one object file
with the same file name (just like MSVC tools do), so extracting
them doesn't work as intended - but merging using a MRI script works.
This commit is contained in:
Martin Storsjö committed 2017-11-28 22:56:42 +02:00
1 parent c06aca2432
commit 26bba774fe
2 files changed
+36 -5

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
#!/bin/sh
set -e
if [ $# -lt 2 ]; then
echo $0 lib add1 [add2...]
exit 1
fi
: ${AR:=llvm-ar}
: ${RANLIB:=llvm-ranlib}
SCRIPT=merge.mri
OUT=tmp.a
TARGET=$1
rm -f $SCRIPT
echo "CREATE $OUT" >> $SCRIPT
while [ $# -gt 0 ]; do
echo "ADDLIB $1" >> $SCRIPT
shift
done
echo "SAVE" >> $SCRIPT
echo "END" >> $SCRIPT
$AR -M < $SCRIPT
rm -f $SCRIPT
$RANLIB $OUT
mv $OUT $TARGET