File tree Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Expand file tree Collapse file tree 1 file changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -15,11 +15,36 @@ DESTINATION=$1
15
15
shift
16
16
LIB_LIST=$@
17
17
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
+
18
22
# For each library to add:
19
23
for lib in ${LIB_LIST} ; do
24
+ # We will unpack and rename all .o of dependent libraries marking them with
25
+ # their library name to avoid clashes.
26
+ LIBNAME=$( basename ${lib} .a)
27
+
28
+ # Remove previous unpacked folders and create a new fresh one to work in.
29
+ rm -rf ${LIBNAME}
30
+ mkdir ${LIBNAME}
31
+ cd ${LIBNAME}
32
+
20
33
# Unpack the library
21
34
${AR_COMMAND} -x ${lib}
35
+
36
+ # Rename all object file in the library prepending "${LIBNAME}_" to avoid
37
+ # clashes.
38
+ for obj in * .o; do
39
+ mv ${obj} " ${LIBNAME} _${obj} "
40
+ done
41
+
42
+ # Move back to the working directory.
43
+ cd ..
22
44
done
23
45
24
46
# Append all the unpacked files to the destination library
25
- ${AR_COMMAND} -rcs ${DESTINATION} * .o
47
+ ${AR_COMMAND} -rcs ${DESTINATION} ** /* .o
48
+
49
+ # TODO: See if we need to do some cleanup in order to save cache space for
50
+ # Github actions runners.
You can’t perform that action at this time.
0 commit comments