瀏覽代碼

CMakeDetermineCompilerABI: Make ABI info string more robust

Backport commit c0224f5aa1 (CMakeDetermineCompilerABI: Make ABI info
string more robust, 2025-03-13, v4.1.0-rc1~499^2~4) to 3.31 and 4.0.
Brad King 7 月之前
父節點
當前提交
41fbc2ce16
共有 1 個文件被更改,包括 7 次插入1 次删除
  1. 7 1
      Modules/CMakeCompilerABI.h

+ 7 - 1
Modules/CMakeCompilerABI.h

@@ -40,6 +40,12 @@ static unsigned short const info_byte_order_little_endian[] = {
 #  define ABI_ID "ELF"
 #endif
 
+/* Construct the string literal in pieces to prevent the source from
+   getting matched.  Store it in a pointer rather than an array
+   because some compilers will just produce instructions to fill the
+   array rather than assigning a pointer to a static array.  */
 #if defined(ABI_ID)
-static char const info_abi[] = "INFO:abi[" ABI_ID "]";
+static char const* info_abi = "INFO"
+                              ":"
+                              "abi[" ABI_ID "]";
 #endif