[PATCH] D153600: Implement -frecord-command-line for XCOFF

Hubert Tong via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 5 15:28:44 PDT 2023


hubert.reinterpretcast added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCAsmPrinter.cpp:2974
+    RSOS << "@(#)" << MDS->getString();
+    RSOS.write('\0');
+  }
----------------
hubert.reinterpretcast wrote:
> stephenpeckham wrote:
> > I would use a newline here.  The AIX **what **command looks for @(#) and echos subsequent bytes until it sees a double quote, a backslash, a > symbol, newline, or null byte.  The @(#) is not echoed, nor is the terminating character.  The **what **command prints a newline after it finds a terminating character.  This means that if the command line contains any of the special characters, the line will be truncated.
> > 
> > Exception:  If the @(#) is followed by "opt " or " opt ", the terminating characters are only a newline or null byte. This allows any of the other special characters to be part of the command line. It doesn't really matter if you use a newline or a null byte, but the legacy XL compiler uses a newline. The "opt" keyword should appear if the command line can contain a double quote, a > or a backslash.
> > 
> > The legacy compiler also uses other keywords besides "opt", including "version" and "cfg".  The **what** command doesn't do anything special with these keywords.
> As mentioned offline, newline on its own has potential of ambiguity because it can appear in command line options (null bytes cannot). If there is a preference for newline to be present, then having a null byte after could help.
> 
> Note that `@(#)opt ` can appear on the command line too. Using `what` will have limitations (but we should leave the possibility open for other tools/methods to work).
> 
Thanks; I confirm that my comment has been addressed. I have no further comments at this time. Feel free to commit if another reviewer approves the patch.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D153600



More information about the cfe-commits mailing list