[CRT][LIT] build the target_cflags for Popen properly
authorJinsong Ji <jji@us.ibm.com>
Thu, 19 Aug 2021 15:37:50 +0000 (15:37 +0000)
committerJinsong Ji <jji@us.ibm.com>
Thu, 19 Aug 2021 15:39:53 +0000 (15:39 +0000)
We recently enabled crt for powerpc in
https://reviews.llvm.org/rGb7611ad0b16769d3bf172e84fa9296158f8f1910.

And we started to see some unexpected error message when running
check-runtimes.

eg:
https://lab.llvm.org/buildbot/#/builders/57/builds/9488/steps/6/logs/stdio
line 100 - 103:

"
clang-14: error: unknown argument: '-m64 -fno-function-sections'
clang-14: error: unknown argument: '-m64 -fno-function-sections'
clang-14: error: unknown argument: '-m64 -fno-function-sections'
clang-14: error: unknown argument: '-m64 -fno-function-sections'
"

Looks like we shouldn't strip the space at the beginning,
or else the command line passed to subprocess won't work well.

Reviewed By: phosek, MaskRay

Differential Revision: https://reviews.llvm.org/D108329

compiler-rt/test/crt/lit.cfg.py

index 68e7eda..b4bbbfc 100644 (file)
@@ -23,8 +23,8 @@ else:
 
 def get_library_path(file):
     cmd = subprocess.Popen([config.clang.strip(),
-                            config.target_cflags.strip(),
-                            '-print-file-name=%s' % file],
+                            '-print-file-name=%s' % file] +
+                           [config.target_cflags],
                            stdout=subprocess.PIPE,
                            env=config.environment,
                            universal_newlines=True)
@@ -39,8 +39,8 @@ def get_library_path(file):
 
 def get_libgcc_file_name():
     cmd = subprocess.Popen([config.clang.strip(),
-                            config.target_cflags.strip(),
-                            '-print-libgcc-file-name'],
+                            '-print-libgcc-file-name'] +
+                           [config.target_cflags],
                            stdout=subprocess.PIPE,
                            env=config.environment,
                            universal_newlines=True)