Skip to content

Commit ed8b841

Browse files
committed
Move building of artifacts to separate subdirectory.
This avoids potential issues with clashing translation unit name in case pre-existing translation units exist in the archiving directory.
1 parent 45fbdbe commit ed8b841

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/libcprover-cpp/add_dependencies.sh

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,14 @@ LIB_LIST=$@
1919
# unit name collisions which affect linking against the final artefact. For more
2020
# details, please look at https://github.com/diffblue/cbmc/issues/7586 .
2121

22+
# Create a temporary folder for this script to work in.
23+
rm -rf add_dependencies_tmp
24+
mkdir add_dependencies_tmp
25+
cd add_dependencies_tmp
26+
27+
# The full path of the current "root" directory
28+
WORKING_DIR=$(pwd)
29+
2230
# For each library to add:
2331
for lib in ${LIB_LIST}; do
2432
# We will unpack and rename all .o of dependent libraries marking them with
@@ -33,18 +41,18 @@ for lib in ${LIB_LIST}; do
3341
# Unpack the library
3442
${AR_COMMAND} -x ${lib}
3543

36-
# Rename all object file in the library prepending "${LIBNAME}_" to avoid
37-
# clashes.
44+
# Rename all object files in the library prepending "${LIBNAME}_" to avoid
45+
# clashes, and move to the "root" folder.
3846
for obj in *.o; do
39-
mv ${obj} "${LIBNAME}_${obj}"
47+
mv ${obj} "${WORKING_DIR}/${LIBNAME}_${obj}"
4048
done
4149

4250
# Move back to the working directory.
43-
cd ..
51+
cd "${WORKING_DIR}"
4452
done
4553

4654
# Append all the unpacked files to the destination library
47-
${AR_COMMAND} -rcs ${DESTINATION} **/*.o
55+
${AR_COMMAND} -rcs ${DESTINATION} *.o
4856

4957
# TODO: See if we need to do some cleanup in order to save cache space for
5058
# Github actions runners.

0 commit comments

Comments
 (0)