[PATCH] D87321: Fix -gz=zlib options for linker

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Sep 11 09:18:09 PDT 2020


MaskRay added inline comments.


================
Comment at: clang/test/Driver/compress.c:21
 
-// RUN: %clang -### -fintegrated-as -gz=none -x assembler -c %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_NONE %s
-// RUN: %clang -### -fintegrated-as -gz=none -c %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_NONE %s
-// CHECK-OPT_GZ_EQ_NONE: "--compress-debug-sections=none"
-
-// RUN: %clang -### -fintegrated-as -gz=zlib -x assembler -c %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_ZLIB %s
-// RUN: %clang -### -fintegrated-as -gz=zlib -c %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_ZLIB %s
-// CHECK-OPT_GZ_EQ_ZLIB: "--compress-debug-sections=zlib"
-
-// RUN: %clang -### -fintegrated-as -gz=zlib-gnu -x assembler -c %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_ZLIB_GNU %s
-// RUN: %clang -### -fintegrated-as -gz=zlib-gnu -c %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_ZLIB_GNU %s
-// CHECK-OPT_GZ_EQ_ZLIB_GNU: "--compress-debug-sections=zlib-gnu"
+// RUN: %clang -### -target x86_64-unknown-linux-gnu -fintegrated-as -gz=none -x assembler %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_NONE %s
+// RUN: %clang -### -target x86_64-unknown-linux-gnu -fintegrated-as -gz=none %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_NONE %s
----------------
You can delete `-fintegrated-as` since it is the default for most targets/OSes.


================
Comment at: clang/test/Driver/compress.c:26
+// CHECK-OPT_GZ_EQ_NONE: {{".*clang.*".* "--compress-debug-sections=none"}}
+// CHECK-OPT_GZ_EQ_NONE: {{".*ld.*".* "--compress-debug-sections=none"}}
+
----------------
If the user sets CLANG_DEFAULT_LINKER to a string not containing "ld", this line will not match. Matching a different substring on the linker command line can be more robust, e.g. `"-m" "elf_x86_64"`


================
Comment at: clang/test/Driver/compress.c:30
+// RUN: %clang -### -target x86_64-unknown-linux-gnu -fintegrated-as -gz=zlib %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_ZLIB %s
+// RUN: %clang -### -target amdgcn-amd-amdhsa -fintegrated-as -gz=zlib -x assembler %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_ZLIB %s
+// RUN: %clang -### -target amdgcn-amd-amdhsa -fintegrated-as -gz=zlib %s 2>&1 | FileCheck -check-prefix CHECK-OPT_GZ_EQ_ZLIB %s
----------------
Delete -fintegrated-as if it is the default on amdgcn-amd-amdhsa


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D87321/new/

https://reviews.llvm.org/D87321



More information about the cfe-commits mailing list