[PATCH] D75065: [cmake] Strip quotes in compiler-rt/lib/crt

Zhizhou Yang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 24 10:39:20 PST 2020


zhizhouy created this revision.
zhizhouy added reviewers: hans, xur, russell.gallop, manojgupta.
Herald added subscribers: llvm-commits, Sanitizers, mgorny, dberris.
Herald added projects: Sanitizers, LLVM.

Similar change to CMakeLists as r372312 <https://reviews.llvm.org/rGec841cf36ca1cb6a154393d7e9f48e8723a38966>.

After r372209 <https://reviews.llvm.org/rL372209>, compiler command line may include argument with quotes:

  -fprofile-instr-use="/foo/bar.profdata"

And it causes a hidden failure with execute_process later: Could not read profile "/foo/bar.profdata": No such file or directory.

In this particular case, the check for .init_array will fail silently and creates a PGO-ed binary with bad .init_array section in compiler-rt.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D75065

Files:
  compiler-rt/lib/crt/CMakeLists.txt


Index: compiler-rt/lib/crt/CMakeLists.txt
===================================================================
--- compiler-rt/lib/crt/CMakeLists.txt
+++ compiler-rt/lib/crt/CMakeLists.txt
@@ -43,6 +43,10 @@
     endif()
   endforeach()
 
+  # Strip quotes from the compile command, as the compiler is not expecting
+  # quoted arguments (potential quotes added from D62063).
+  string(REPLACE "\"" "" test_compile_command "${test_compile_command}")
+
   string(REPLACE " " ";" test_compile_command "${test_compile_command}")
 
   execute_process(


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D75065.246247.patch
Type: text/x-patch
Size: 547 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200224/2a5013aa/attachment.bin>


More information about the llvm-commits mailing list