Gisle Vanem wrote:
> With clang-cl I get link-results like:

What is this clang for Windows? I mean the download from [1].
I don't mean the combination with mingw [2].

As far as I can see,

  * It's meant to be used with the MSVC headers and libraries.

  * There are two compiler drivers, 'clang' (C) / 'clang-c++' (C++)
    and 'clang-cl'.
    They produce nearly identical code.
    They have different command-line options:
    - 'clang'/'clang-c++' has GCC compatible options (and can thus be
      used directly with the GNU build system), whereas
    - 'clang-cl' has MSVC compatible options (and thus needs the Automake
      'compile' script when used with the GNU build system).

  * It predefines the symbols __clang__, _MSC_VER but not __GNUC__.
    So, it disguises as MSVC, with some small behaviour differences [3].
    And you just discovered that
      extern int foo();
      static int foo() { ... }
    produces an external symbol 'foo' with clang, but not with MSVC.

  * But it supports the GCC built-ins, despite not defining __GNUC__ !

I'll start a series of patches to support this variant of clang.
(Maybe there will be other variants of clang in the future that don't
advertise __GNUC__.)

I'll do that for clang version 4.0.0 onward. clang 3.9.x is 3.5 years old;
less worth the investment of time, I think.

Bruno

[1] https://releases.llvm.org/download.html#10.0.0
[2] 
https://stackoverflow.com/questions/39871656/how-to-use-clang-with-mingw-w64-headers-on-windows
[3] https://clang.llvm.org/docs/MSVCCompatibility.html


Reply via email to