5

For the sake of migrating compiler options to ARM using Xcode, I'm looking for a comprehensive documentation for clang c++ compiler/linker options. The closest I could get was this page, however:

  1. Many options aren't explained, e.g. -arch, -arch_errors_fatal, -sub_umbrella and many more.
  2. There are options in the Xcode command line that are missing in this doc, e.g. -Wno-four-char-constants, -Wshorten-64-to-32 etc.

Is there any place where I could find a full documentation with generous explanations for each option? Please note, I don't need the meaning of the options I gave here as examples, only for a comprehensive reference.

gil_mo
  • 575
  • 1
  • 6
  • 27
  • 2
    `man clang` lays it out pretty well. – sweenish Dec 03 '20 at 15:23
  • 1
    For `-W` options see here: https://clang.llvm.org/docs/DiagnosticsReference.html (note that the prefix `no-` is used to disable a diagnostic. So drop it when searching for documentation). – rustyx Dec 03 '20 at 15:31
  • 1
    @sweenish `man clang` omits many options, e.g. `-target`. @rustyx Good to know! – gil_mo Dec 03 '20 at 17:36
  • Some information may be read from `llc -help`, (installed together with llvm). Particular `-target` options will be printed with `llc -version` command. (taken from https://stackoverflow.com/questions/15036909/clang-how-to-list-supported-target-architectures) – Stepan Pavlov Dec 06 '20 at 11:01
  • I don't have an `llc` installed (MacOS High Sierra, Xcode 10). – gil_mo Dec 06 '20 at 16:43

1 Answers1

4

I think that in general, you need to refer to Clang documentation and to the Cross-compilation using Clang.

Update:

  • If you cannot find the argument you need, please go to the bottom of the page to Search Page.
  • Paste the argument and press "Search".
  • If the argument is supported, you will see its description.

For example, if you look for -arch_errors_fatal it will show this:

Static analyzer report output format (html|plist|plist-multi-file|plist-html|sarif|text).

-ansi, --ansi -arch -arch_errors_fatal

It is not very descriptive but on the top of the same page, you can see:

Introduction This page lists the command line arguments currently supported by the GCC-compatible clang and clang++ drivers.

Hence, this specific flag was added for compatibility with the GCC, so you need to look for it in the GCC's documentation.

So you do the following:

  • man gcc.
  • Press /, paste -arch_errors_fatal, and press Enter. This is the search in the man page.
  • press n until you find the relevant information. For this specific flag it will show you:

-arch_errors_fatal Cause the errors having to do with files that have the wrong architecture to be fatal.

I forgot that MacOS comes without GCC nowadays, so you can lookup the GCC manual page online.

Looking for information about open-source tools might be not very straight-forward but yet feasible.

Hope it helps.

fsquirrel
  • 800
  • 8
  • 18
  • How can I use those references when both -arch_errors_fatal and -sub_umbrella aren't explained (and many other options)? – gil_mo Dec 13 '20 at 07:09
  • almost there! what about -sub_umbrella? What does it do? – gil_mo Dec 14 '20 at 06:57
  • 1
    It becomes funny:) Lookup this flag on the GCC man page, it clearly says that "These options are passed to the Darwin linker. The Darwin linker man page describes them in detail.". Run `man ld` and lookup there: "The specified framework will be re-exported. Only used when creating a dynamic library." – fsquirrel Dec 14 '20 at 07:26