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.

5
  • 2
    man clang lays it out pretty well.
    – sweenish
    Dec 3, 2020 at 15:23
  • 1
    For -W options see here: 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 3, 2020 at 15:31
  • 1
    @sweenish man clang omits many options, e.g. -target. @rustyx Good to know!
    – gil_mo
    Dec 3, 2020 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 stackoverflow.com/questions/15036909/…) Dec 6, 2020 at 11:01
  • I don't have an llc installed (MacOS High Sierra, Xcode 10).
    – gil_mo
    Dec 6, 2020 at 16:43

1 Answer 1

4
+50

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.

3
  • 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, 2020 at 7:09
  • almost there! what about -sub_umbrella? What does it do?
    – gil_mo
    Dec 14, 2020 at 6: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, 2020 at 7:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.