File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,44 @@ DESTINATION=$1
1515shift
1616LIB_LIST=$@
1717
18+ # We need to do the following renaming of object files because of translation
19+ # unit name collisions which affect linking against the final artefact. For more
20+ # details, please look at https://github.com/diffblue/cbmc/issues/7586 .
21+
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+
1830# For each library to add:
1931for lib in ${LIB_LIST} ; do
32+ # We will unpack and rename all .o of dependent libraries marking them with
33+ # their library name to avoid clashes.
34+ LIBNAME=$( basename ${lib} .a)
35+
36+ # Remove previous unpacked folders and create a new fresh one to work in.
37+ rm -rf ${LIBNAME}
38+ mkdir ${LIBNAME}
39+ cd ${LIBNAME}
40+
2041 # Unpack the library
2142 ${AR_COMMAND} -x ${lib}
43+
44+ # Rename all object files in the library prepending "${LIBNAME}_" to avoid
45+ # clashes, and move to the "root" folder.
46+ for obj in * .o; do
47+ mv ${obj} " ${WORKING_DIR} /${LIBNAME} _${obj} "
48+ done
49+
50+ # Move back to the working directory.
51+ cd " ${WORKING_DIR} "
2252done
2353
2454# Append all the unpacked files to the destination library
2555${AR_COMMAND} -rcs ${DESTINATION} * .o
56+
57+ # TODO: See if we need to do some cleanup in order to save cache space for
58+ # Github actions runners.
You can’t perform that action at this time.
0 commit comments