Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Clang][AIX][p] Manually Claim -p in front end
The current implementation of `-p` does not claim the argument once it is passed. Since it pushes `-pg` directly, it is only ever referred to again when linking. As a result, when compiling with `-S`, the compiler warns that `-p` goes unused even though that is not the case. With this patch, if both `-p` and `-pg` are passed, the argument that is passed second will take precedence. `-p` will still throw an error on unsupported platforms, regardless of precedence. This revision includes a test case, which has been placed in `clang/test/Driver/zos-profiling-error.c`. As a result, `zos-profiling-error.c` has been renamed to `ibm-profiling.c`. This revision also passes `clang/test/Driver/aix-ld.c`. Differential Revision: https://reviews.llvm.org/D145021
- Loading branch information
1 parent
9dbce77
commit ac1d143
Showing
4 changed files
with
47 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Check that -pg throws an error on z/OS. | ||
// RUN: %clang -### 2>&1 --target=s390x-none-zos -S -pg %s | FileCheck -check-prefix=FAIL-PG-NAME %s | ||
// FAIL-PG-NAME: error: unsupported option '-pg' for target 's390x-none-zos' | ||
|
||
// Check that -p is still used when not linking on AIX. | ||
// RUN: %clang -### 2>&1 --target=powerpc-ibm-aix7.1.0.0 -S -p -S %s \ | ||
// RUN: | FileCheck --check-prefix=CHECK %s | ||
// CHECK-NOT: warning: argument unused during compilation: '-p' | ||
|
||
// Check precedence: -pg is unused when passed first on AIX. | ||
// RUN: %clang -### 2>&1 --target=powerpc-ibm-aix7.1.0.0 --sysroot %S/Inputs/aix_ppc_tree -pg -p %s \ | ||
// RUN: | FileCheck --check-prefix=CHECK2 %s | ||
// CHECK2-NOT: warning: argument unused during compilation: '-p' [-Wunused-command-line-argument] | ||
// CHECK2: "-isysroot" "[[SYSROOT:[^"]+]]" | ||
// CHECK2: "[[SYSROOT]]/usr/lib{{/|\\\\}}mcrt0.o" | ||
// CHECK2: "-L[[SYSROOT]]/lib/profiled" | ||
// CHECK2: "-L[[SYSROOT]]/usr/lib/profiled" | ||
|
||
// Check precedence: -p is unused when passed first on AIX. | ||
// RUN: %clang -### 2>&1 --target=powerpc-ibm-aix7.1.0.0 --sysroot %S/Inputs/aix_ppc_tree -p -pg %s \ | ||
// RUN: | FileCheck --check-prefix=CHECK3 %s | ||
// CHECK3: warning: argument unused during compilation: '-p' [-Wunused-command-line-argument] | ||
// CHECK3: "-isysroot" "[[SYSROOT:[^"]+]]" | ||
// CHECK3: "[[SYSROOT]]/usr/lib{{/|\\\\}}gcrt0.o" | ||
// CHECK3: "-L[[SYSROOT]]/lib/profiled" | ||
// CHECK3: "-L[[SYSROOT]]/usr/lib/profiled" | ||
|
This file was deleted.
Oops, something went wrong.