1. 18 Jul, 2019 1 commit
  2. 17 Jul, 2019 5 commits
    • Saleem Abdulrasool's avatar
      Swift: support SONAME on ELFish targets · 5803a8a2
      Saleem Abdulrasool authored
      We should enable the soname to be setup for ELF shared libraries.
      Failure to do so generates binaries with incorrect names which prevents
      loading.
      5803a8a2
    • Saleem Abdulrasool's avatar
      Swift: support multithreaded compilation · 47e28cbe
      Saleem Abdulrasool authored
      Query the number of logical CPUs available to enable parallel
      compilation for Swift.
      47e28cbe
    • Saleem Abdulrasool's avatar
      Swift: add rules for static linking · 6814567e
      Saleem Abdulrasool authored
      The Swift driver recently learnt how to generate static libraries using
      the `-static` flag.  This enables us to generate proper static libraries
      with dependency tracking with Swift as well.
      6814567e
    • Saleem Abdulrasool's avatar
      Support per-language library link flags · be0d4042
      Saleem Abdulrasool authored
      This changes the behaviour of the generators to use a per-language
      library search path flag.  This is needed for multi-language projects
      with different compilers (e.g. cl + gfortran).  Since the adjusted
      variable has been part of the user settings, we control this based on a
      policy.
      
      Fixes: #19307
      be0d4042
    • Brad King's avatar
      AIX: Do not enable runtime linking by default anymore · 3fb3157d
      Brad King authored
      We've long created shared objects on AIX using the linker's `-G` option
      (also offered by the XL front-end).  The `-G` option implies `-brtl` and
      enables runtime linking.  This has been largely unnecessary because we
      provide all dependencies on the link line and both XL and GNU compilers
      offer builtin behavior to export symbols.  Since commit 0f150b69 (AIX:
      Explicitly compute shared object exports for both XL and GNU,
      2019-07-11) we compute exports explicitly and consistently.
      Therefore runtime linking is no longer necessary for shared objects.
      
      We've also long created executables on AIX using the linker's `-brtl`
      option to enable runtime linking in case they load plugins at runtime.
      Since commit 9f5c2040 (AIX: Explicitly compute executable exports for
      both XL and GNU, 2019-07-12) and commit 2fa920c0 (AIX: Create import
      library for executables with exports, 2019-07-16) we now provide the
      linker enough information to fully resolve symbols in plugins up front.
      Therefore runtime linking is no longer necessary for executables.
      
      Drop use of `-G` for creating shared objects and use the XL `-qmkshrobj`
      and GCC `-shared` options instead.  Both invoke the linker with the
      `-bM:SRE -bnoentry` options to create a shared object without runtime
      linking enabled.  Also drop use of `-brtl` for creating executables.
      
      Issue: #19163
      3fb3157d
  3. 16 Jul, 2019 1 commit
    • Brad King's avatar
      AIX: Create import library for executables with exports · 2fa920c0
      Brad King authored
      On AIX, plugins meant to be loaded into executables via `dlopen` must be
      linked with access to a list of symbols exported from the executable in
      order to use them (when not using runtime linking).  The AIX linker
      supports specifying this list as an "import file" passed on the command
      line either via the `-bI:...` option or (with a leading `#! .` line) as
      a normal input file like any other library file.
      
      The linker import file plays the same role on AIX as import libraries do
      on Windows.  Teach CMake to enable its import library abstraction on AIX
      for executables with the `ENABLE_EXPORTS` target property set.  Teach
      our internal `ExportImportList` script to optionally generate a leading
      `#! .` line at the top of the generated export/import list.  Update our
      rule for linking an executable with exports to generate a public-facing
      "import library" implemented as an AIX linker import file.
      
      With this approach, our existing infrastructure for handling import
      libraries on Windows will now work for AIX linker import files too:
      
      * Plugins that link to their executable's symbols will be automatically
        linked using the import file on the command line.
      
      * The executable's import file will be (optionally) installed and
        exported for use in linking externally-built plugins.
      
      This will allow executables and their plugins to build even if we later
      turn off runtime linking.
      
      Issue: #19163
      2fa920c0
  4. 15 Jul, 2019 5 commits
    • Brad King's avatar
      AIX: Explicitly compute executable exports for both XL and GNU · 9f5c2040
      Brad King authored
      On AIX, symbols in executables must be exported in order to be visible
      to modules (plugins) they load via `dlopen`.  Prior to policy `CMP0065`,
      CMake linked all executables with flags to export symbols, but the NEW
      behavior for that policy is to do so only for executables that have the
      `ENABLE_EXPORTS` target property set.  In both cases, CMake has always
      used the AIX linker option `-bexpall` option to export symbols from
      executables.
      
      This has worked fairly well with the XL compiler, but with the GNU
      compiler it works only for C ABI symbols.  The reason is that `-bexpall`
      does not export symbols starting in `_` but the GNU C++ ABI mangles all
      symbols with a leading `_`.  Therefore we have only supported C ABI
      plugins with the GNU compiler on AIX.  Some projects have tried to work
      around this by replacing `-bexpall` with `-bexpfull`, but the latter
      often exports symbols that we do not want exported.
      
      Avoid using `-bexpall` for executables by instead using by our own
      internal `ExportImportList` script to compute symbol export lists from
      the object files to be linked into an executable.  Pass the explicitly
      computed export list to the AIX linker's `-bE:...` option.  We already
      do this for shared object exports.
      
      Issue: #19163
      9f5c2040
    • Brad King's avatar
      AIX: Explicitly compute shared object exports for both XL and GNU · 0f150b69
      Brad King authored
      On AIX, symbols in shared objects must be exported in order to be
      visible to dependents (similar to Windows).  The AIX linker provides a
      `-bE:...` option to specify a file listing symbols to be exported.
      Compilers offer some features to help:
      
      * When the XL compiler is invoked with its `-qmkshrobj`/`-G` options for
        creating shared objects (without/with runtime linking), it recognizes
        when no explicit `-bE:...` linker option is specified and runs a
        `CreateExportList` tool provided with the compiler to compute one from
        the object files.  Since commit d468a2c2 (XL: Avoid copying archives
        into shared libraries that link them, 2011-04-07, v2.8.5~153^2) CMake
        runs `CreateExportList` explicitly to ensure it only looks at the object
        files and not any library files.
      
      * When the GNU compiler is invoked with its `-shared` option for creating
        shared objects, its internal `collect2` tool recognizes when no explicit
        `-bE:...` linker option is specified and computes one itself from the
        object files.  However, it sometimes includes extra symbols such as
        `.__init_aix_libgcc_cxa_atexit`.
      
      Introduce our own internal `ExportImportList` script to compute symbol
      export lists from object files.  Use a basic implementation for now: it
      can be extended as needed later.  Update our shared library creation
      rules to run the script explicitly for both the XL and GNU compilers.
      
      Issue: #19163
      0f150b69
    • Brad King's avatar
      AIX: Drop redundant -brtl flags · a5bf4e79
      Brad King authored
      We removed `-brtl` in commit bce7a2a3 (AIX: Do not use -brtl to create
      shared libraries, 2013-03-11, v2.8.11~103^2~1) but it was added again by
      commit f254276f (AIX,HP-UX: Fix RPATH handling when CMP0065 is set to
      NEW, 2015-12-11, v3.4.2~4^2).  Since the latter commit we initialize the
      `CMAKE_{SHARED,MODULE}_LINKER_FLAGS` to use the `-brtl` linker flag.
      This is unnecessary because we already use the `-G` linker flag which
      implies `-brtl`.
      
      The latter commit also moved `-brtl` to `CMAKE_EXE_LINKER_FLAGS` from
      flags that were always included in executable link lines with CMP0065
      OLD behavior and are not part of the change intended by CMP0065.  Leave
      this for now as we've always enabled runtime linking for executables
      (and implicitly done so via -G for shared libraries and modules).
      
      Issue: #13997
      Issue: #19163
      a5bf4e79
    • Steve Robinson's avatar
      FindPNG: Add static libpng names for MSVC · 95f8b0ae
      Steve Robinson authored
      Add names produced by the png upstream buildsystem for static
      libraries with MSVC.
      95f8b0ae
    • Brad King's avatar
      XL: De-duplicate shared object creation flags · 9cb5f040
      Brad King authored
      The XL `-qmkshrobj` flag creates shared objects on all platforms.
      Move the flag out of the per-platform modules into the per-compiler
      module for XL.
      9cb5f040
  5. 14 Jul, 2019 3 commits
  6. 12 Jul, 2019 1 commit
  7. 11 Jul, 2019 2 commits
    • Saleem Abdulrasool's avatar
      Swift: support SONAME on ELFish targets · 6af97178
      Saleem Abdulrasool authored
      We should enable the soname to be setup for ELF shared libraries.
      Failure to do so generates binaries with incorrect names which prevents
      loading.
      6af97178
    • Brad King's avatar
      CMakeDetermineCompilerId: Consider UTF-16 encodings of INFO strings · d1f38ba6
      Brad King authored
      Our compiler identification source encodes `INFO:compiler[...]` and
      similar strings in compiled objects or binaries that we then extract to
      get information about the compiler.  With most compilers the strings are
      encoded in the binaries as a simple byte sequence.  However, some
      compilers use other encodings.  For example, the MS CSharp compiler uses
      UTF-16LE and a TI compiler uses UTF-16BE.  Try each encoding.
      
      Fixes: #19459
      d1f38ba6
  8. 10 Jul, 2019 2 commits
  9. 09 Jul, 2019 2 commits
  10. 08 Jul, 2019 2 commits
  11. 03 Jul, 2019 2 commits
  12. 02 Jul, 2019 2 commits
  13. 29 Jun, 2019 1 commit
  14. 28 Jun, 2019 1 commit
    • Saleem Abdulrasool's avatar
      Swift: add rules for static linking · 8aa0b63b
      Saleem Abdulrasool authored
      The Swift driver recently learnt how to generate static libraries using
      the `-static` flag.  This enables us to generate proper static libraries
      with dependency tracking with Swift as well.
      8aa0b63b
  15. 27 Jun, 2019 1 commit
    • Brad King's avatar
      RC: Honor CMAKE_USER_MAKE_RULES_OVERRIDE · d2f20ab2
      Brad King authored
      Since the refactoring in commit 48f7e2d3 (Unhardcode the
      CMAKE_CONFIGURATION_TYPES values, 2017-11-27, v3.11.0-rc1~130^2~1),
      `CMAKE_BUILD_TYPE` is initialized while enabling the RC language.
      Therefore we need to honor `CMAKE_USER_MAKE_RULES_OVERRIDE`
      as part of enabling RC so that a `CMAKE_BUILD_TYPE_INIT` setting
      in the override file is honored.
      
      Fixes: #19401
      d2f20ab2
  16. 26 Jun, 2019 2 commits
  17. 25 Jun, 2019 2 commits
  18. 24 Jun, 2019 4 commits
  19. 19 Jun, 2019 1 commit