[PATCH] D137753: [Clang][GNU][AIX][p]Enable -p Functionality

Fangrui Song via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 17 19:43:14 PST 2022


MaskRay added a comment.

In D137753#3935617 <https://reviews.llvm.org/D137753#3935617>, @francii wrote:

> In D137753#3935391 <https://reviews.llvm.org/D137753#3935391>, @MaskRay wrote:
>
>> In D137753#3935305 <https://reviews.llvm.org/D137753#3935305>, @francii wrote:
>>
>>> Recall that the goal with `-p` is to create parity with GCC (at least with Linux and AIX), as per the RFC discussion.
>>>
>>> In D137753#3935138 <https://reviews.llvm.org/D137753#3935138>, @MaskRay wrote:
>>>
>>>> In D137753#3935126 <https://reviews.llvm.org/D137753#3935126>, @francii wrote:
>>>>
>>>>> In D137753#3934932 <https://reviews.llvm.org/D137753#3934932>, @MaskRay wrote:
>>>>>
>>>>>> Please make `-p` accepted for AIX only and don't change the semantics for other targets in this patch. For FreeBSD and Linux (musl and gnu) we can try rejecting `-p`. If OpenBSD wants to make `-p` an alias for `-pg`, that's fine.
>>>>>
>>>>> We can make `-p` emit a message on Linux while also accepting it as an alias to `-pg`. Do you have a suggestion as to what that message would be?
>>>>
>>>> The current `warning: argument unused during compilation: '-p' [-Wunused-command-line-argument]` is good for Linux.
>>>> In the future Linux can try removing `-p`.
>>>
>>> The current behaviour of ignoring the option without stopping with an error return code is not a good one.
>>>
>>> Recall that the goal is to create parity with GCC, as per the RFC post.
>>>
>>> Is there a reason this flag shouldn't be supported on Linux? Specifically, what is your justification for diverging from GCC on this matter?
>>
>> It's a legacy option (at least for Linux, FreeBSD, etc) and we don't want the usage to grow. I objected in the RFC, either. Note that the objection is not only from me, also from a Linux distro folk I checked with.
>
> If we aren't adding Linux functionality, we should make it throw an error at the same time.
>
> Once again, ignoring the option without stopping with an error code is not ideal. I can update this patch to throw an error on Linux, much like this patch for z/OS: https://reviews.llvm.org/D137756

I acknowledge that the current state is bad. Reject it for FreeBSD/Linux (perhaps most OSes. An OS can opt in if their platform really needs this) is likely fine. I don't think `-p` has many uses.

Something like D137756 <https://reviews.llvm.org/D137756> will be nice, but I think it can be done in clang/lib/Driver/ToolChains/Clang.cpp: D138255 <https://reviews.llvm.org/D138255>


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D137753



More information about the cfe-commits mailing list