@@ -226,23 +226,38 @@ else
226
226
fi
227
227
228
228
if $link ; then
229
+ runtime_components=(
230
+ " $LIBDIR " /libarithmetic.a
231
+ " $LIBDIR " /libutil.a
232
+ " $LIBDIR " /libstrings.a
233
+ " $LIBDIR " /libnumeric_strings.a
234
+ " $LIBDIR " /libio.a
235
+ " $LIBDIR " /libcollections.a
236
+ " $LIBDIR " /libBindingsCore.a
237
+ " $LIBDIR " /libKOREPrinter.a
238
+ " $LIBDIR " /liballoc.a
239
+ " $LIBDIR " /libcollect.a
240
+ " $LIBDIR " /libmeta.a
241
+ " $LIBDIR " /libjson.a
242
+ )
243
+
244
+ components=(
245
+ " $LIBDIR " /libParser.a
246
+ " $LIBDIR " /libAST.a
247
+ " $LIBDIR " /libBinaryKore.a
248
+ )
249
+
250
+ # If we're linking a Python AST bindings module, then we don't want to include
251
+ # the backend's runtime components. On some platforms and build type
252
+ # combinations, the linker won't strip undefined symbols for us, which
253
+ # produces an error on trying to load the Python library.
254
+ if [ " $main " != " python_ast" ]; then
255
+ components=(" ${components[@]} " " ${runtime_components[@]} " )
256
+ fi
257
+
229
258
run @CMAKE_CXX_COMPILER@ -Wno-override-module -Wno-return-type-c-linkage " $modopt " " ${files[@]} " \
230
- " $LIBDIR " /libarithmetic.a \
231
259
" $MAINFILES " \
232
- " $LIBDIR " /libutil.a \
233
- " $LIBDIR " /libstrings.a \
234
- " $LIBDIR " /libnumeric_strings.a \
235
- " $LIBDIR " /libio.a \
236
- " $LIBDIR " /libcollections.a \
237
- " $LIBDIR " /libParser.a \
238
- " $LIBDIR " /libAST.a \
239
- " $LIBDIR " /libBindingsCore.a \
240
- " $LIBDIR " /libBinaryKore.a \
241
- " $LIBDIR " /libKOREPrinter.a \
242
- " $LIBDIR " /liballoc.a \
243
- " $LIBDIR " /libcollect.a \
244
- " $LIBDIR " /libmeta.a \
245
- " $LIBDIR " /libjson.a \
260
+ " ${components[@]} " \
246
261
" ${flags[@]} " \
247
262
" ${all_libraries[@]} " \
248
263
-I " $( dirname " $0 " ) " /../include/kllvm \
0 commit comments