Commit Graph

826 Commits

Author SHA1 Message Date
Hugh Bellamy
cd34d544cb Merge pull request #7487 from hughbe/link-flags-common
Consolidate common fuse-ld linker flag setting in AddSwift
2017-02-16 19:05:31 +07:00
Michael Gottesman
8437819b5a [CMake] Revert recent changes.
These changes caused a number of issues:

1. No debug info is emitted when a release-debug info compiler is built.
2. OS X deployment target specification is broken.
3. Swift options were broken without any attempt any recreating that
functionality. The specific option in question is --force-optimized-typechecker.

Such refactorings should be done in a fashion that does not break existing
users and use cases.

This reverts commit e6ce2ff388.
This reverts commit e8645f3750.
This reverts commit 89b038ea7e.
This reverts commit 497cac64d9.
This reverts commit 953ad094da.
This reverts commit e096d1c033.

rdar://30549345
2017-02-15 22:26:06 -08:00
swift-ci
191a19c4bb Merge pull request #7500 from llvm-beanz/cmake-buildtree-package 2017-02-15 13:02:11 -08:00
Hugh Bellamy
3fae0fbdec Consolidate common fuse-ld linker flag setting in AddSwift 2017-02-15 16:15:03 +07:00
Hugh Bellamy
bc432e639b Cleanup CMake _require_empty list 2017-02-15 15:20:12 +07:00
Chris Bieneman
497cac64d9 [CMake] Add support for Swift buildtrees including CMake packages
This patch generates SwiftExports.cmake and SwiftConfig.cmake in the build tree to be compatible with CMake's `find_package` function for importing targets between CMake build trees. This will allow LLDB to consume Swift's targets and infer their transitive dependencies.
2017-02-14 19:23:13 -08:00
Chris Bieneman
953ad094da [CMake] Fix up an issue encountered in Linux PR testing
This should fix out-of-tree LLDB builds.

This patch overrides the output directories setup by llvm_add_library.
This is required because swift deviates from the LLVM convention of using the LLVM_*_INTDIR variables.

This was causing failures on LLDB's PR testing because LLDB has a terrible mechanism for picking the swift libraries. It finds all the .a files by searching a directory.
2017-02-14 14:50:50 -08:00
Chris Bieneman
e096d1c033 [CMake] Simplify add_swift_library
This patch splits add_swift_library into two functions one which handles
the simple case of adding a library that is part of the compiler being
built and the second handling the more complicated case of "target"
libraries, which may need to build for one or more targets.

The new add_swift_library is built using llvm_add_library, which re-uses
LLVM's CMake modules. In adapting to use LLVM's modules some of
add_swift_library's named parameters have been removed and
LINK_LIBRARIES has changed to LINK_LIBS, and LLVM_LINK_COMPONENTS
changed to LINK_COMPONENTS.

This patch also cleans up libswiftBasic's handling of UUID library and
headers, and how it interfaces with gyb sources.

add_swift_library also no longer has the FILE_DEPENDS parameter, which
doesn't matter because llvm_add_library's DEPENDS parameter has the same
behavior.
2017-02-14 14:28:10 -08:00
John McCall
038303b1b1 Switch MetadataCache to use a global slab allocator.
This seems to more than fix a performance regression that we
detected on a metadata-allocation microbenchmark.

A few months ago, I improved the metadata cache representation
and changed the metadata allocation scheme to primarily use malloc.
Previously, we'd been using malloc in the concurrent tree data
structure but a per-cache slab allocator for the metadata itself.
At the time, I was concerned about the overhead of per-cache
allocators, since many metadata patterns see only a small number
of instantiations.  That's still an important factor, so in the
new scheme we're using a global allocator; but instead of using
malloc for individual allocations, we're using a slab allocator,
which should have better peak, single-thread performance, at the
cost of not easily supporting deallocation.  Deallocation is
only used for metadata when there's contention on the cache, and
specifically only when there's contention for the same key, so
leaking a little isn't the worst thing in the world.

The initial slab is a 64K globally-allocated buffer.
Successive slabs are 16K and allocated with malloc.

rdar://28189496
2017-02-14 11:10:44 -05:00
Chris Bieneman
44b6f32f0e Clean up handling of CMark library dependency.
This change depends on:

https://github.com/apple/swift-cmark/pull/4
2017-02-08 14:32:50 -08:00
swift-ci
37c7641c38 Merge pull request #7258 from gottesmm/swift_force_optimized_typechecker 2017-02-05 18:22:34 -08:00
Saleem Abdulrasool
a891f544a1 Merge pull request #7134 from compnerd/exherbo
build: avoid re-including system paths
2017-02-05 17:49:02 -08:00
Michael Gottesman
fee2db81de [cmake] Add a new option called SWIFT_FORCE_OPTIMIZED_TYPECHECKER that forces Sema to be built optimized.
This should help speed up people trying to compile the standard library and do
SILGen work. *NOTE* This will not necessarily result in a type checker that is
as fast as a release build since most likely the type checker will use some
link_once odr functions that are debug. But it should still be significantly
faster otherwise.

This makes getting to SILGen take 16 seconds on my machine instead of forever
when compiling with everything else in the compiler in debug mode.
2017-02-05 16:48:54 -08:00
Doug Coleman
9e11d8dc7e cmake: For overlays, install to sdk-overlay target by default, but don't
hardcode it.

rdar://problem/21952953
2017-02-02 14:46:57 -08:00
Saleem Abdulrasool
e8aa6cba16 build: avoid re-including system paths
Do not add the (default) system include path as a system include path.
Doing so results in a `-isystem /usr/.../include`.  This changes the
include ordering, resulting in the failure to include headers from the
system when building the standard library.  This breaks compilation on
exherbo which uses a slightly different directory structure
(/usr/include -> /usr/host/include -> /usr/<target>/include).  If the
paths are canonicalised during the build, we would then add
/usr/<target>/include to the CPPFLAGS, resulting in the failure to
include C headers.  Unfortunately, this is insufficient as another site
is also including the path as a SYSTEM include path.  But, this is still
strictly an improvement.
2017-01-29 14:04:25 -08:00
John McCall
2b25701a93 Revert "Switch MetadataCache to use a global slab allocator."
This reverts commit ccbe5fcf73.
2017-01-29 00:17:30 -05:00
John McCall
ccbe5fcf73 Switch MetadataCache to use a global slab allocator.
This seems to more than fix a performance regression that we
detected on a metadata-allocation microbenchmark.

A few months ago, I improved the metadata cache representation
and changed the metadata allocation scheme to primarily use malloc.
Previously, we'd been using malloc in the concurrent tree data
structure but a per-cache slab allocator for the metadata itself.
At the time, I was concerned about the overhead of per-cache
allocators, since many metadata patterns see only a small number
of instantiations.  That's still an important factor, so in the
new scheme we're using a global allocator; but instead of using
malloc for individual allocations, we're using a slab allocator,
which should have better peak, single-thread performance, at the
cost of not easily supporting deallocation.  Deallocation is
only used for metadata when there's contention on the cache, and
specifically only when there's contention for the same key, so
leaking a little isn't the worst thing in the world.

The initial slab is a 64K globally-allocated buffer.
Successive slabs are 16K and allocated with malloc.

rdar://28189496
2017-01-28 02:37:22 -05:00
practicalswift
a9d6d8938c [gardening] Fix recently introduced typos 2017-01-22 20:40:45 +01:00
Hugh Bellamy
e2755c1058 Move Windows specific compiler definitions from _add_link_flags to _add_compile_flags 2017-01-18 10:23:28 +00:00
Han Sangjin
a8dec7fa43 [stdlib] Fixed for Cygwin
- CYGWIN symbol is used to distinguish Cygwin environment from other OS
  and other environment in Windows.
- Added windows and windowsCygnus to OSVersion in StdlibUnittest
2017-01-17 02:31:16 +09:00
Slava Pestov
23b2a4ace8 Merge pull request #6462 from hughbe/libraries-windows
Fix linking libraries on Windows
2017-01-10 22:31:36 -08:00
Michael Gottesman
c9a6532e08 [cmake] Add support for generating targets for a -Onone sib stdlib and a -O sib stdlib, but do not build them by default.
This is useful for engineers who do not want to reconfigure to look at a
-Onone/-O sib stdlib.
2017-01-09 16:39:23 -08:00
Hugh Bellamy
cceba6c09b Fix library_IMPLIB-NOTFOUND errors building Swift on Windows 2017-01-09 14:47:05 +00:00
Slava Pestov
16b20cadd8 Merge pull request #6466 from hughbe/empty-sdk-windows
Don't pass empty "/" SDK path to the swift compiler when compiling the stdlib
2017-01-09 01:45:52 -08:00
Slava Pestov
cc867af8e1 Merge pull request #6498 from hughbe/windows-dependencies
Fix Windows dependency library names
2017-01-09 01:02:30 -08:00
swift-ci
982b711dd4 Merge pull request #6488 from gonzalolarralde/link-paths-issue 2017-01-07 11:40:42 -08:00
swift-ci
e265cc684a Merge pull request #6499 from hughbe/lib-prefix-stdlib 2017-01-03 17:09:17 -08:00
Hugh Bellamy
464fee9110 Remove lib prefix from Windows stdlib libraries 2016-12-27 14:12:53 +00:00
Hugh Bellamy
d90b3afeb0 Fix Windows dependency library names 2016-12-27 14:08:23 +00:00
Gonzalo Larralde
e85e9e1029 Fix swift_target_link_search_directories issue appending just the last directory.
STLD_FLAGS wasn't being appended, but replaced.
2016-12-26 18:11:55 -03:00
Gonzalo Larralde
b057252400 Use linking directories from _add_variant_link_flags in _add_swift_executable_single.
Linking directories from `_add_variant_link_flags` of were overwritten
in `_add_swift_executable_single` by not using the
`LIBRARY_SEARCH_DIRECTORIES` parameter.
2016-12-26 18:11:39 -03:00
Gonzalo Larralde
b3477823f6 Improved naming for _add_variant_link_flags's parameter for library search directories.
`LIBRARY_SEARCH_DIRECTORIES` is actually being used as
`RESULT_VAR_NAME` to affect the value on the parent scope. In this
context `LIBRARY_SEARCH_DIRECTORIES_VAR_NAME` sounds like a better name.
2016-12-26 18:11:06 -03:00
Jordan Rose
fdd02f61d3 [CMake] Stop linking CoreFoundation into swiftc and libobjc into everything.
We link the stdlib against Foundation and that's quite sufficient for the REPL
and script mode to work.
2016-12-22 08:50:13 -08:00
Hugh Bellamy
c94e2a121d Don't pass empty "/" SDK path to the swift compiler when compiling the stdlib 2016-12-22 11:12:41 +00:00
Saleem Abdulrasool
5ec82c73a3 Merge pull request #6354 from compnerd/link-search-path
build: introduce and use `swift_target_link_search_directories`
2016-12-20 10:28:05 -08:00
Saleem Abdulrasool
92a09a0ebe build: ensure that Windows is built without PIC
PIC on windows does not make sense.  All code is position independent.
Currently clang and LLVM do the wrong thing and generate ELF style PIC
code on Windows when `-fPIC` is used.  Add `-fno-pic` to disable that
when cross-compiling to Windows.
2016-12-19 20:44:08 -08:00
Saleem Abdulrasool
f3ffd76c62 Merge pull request #6353 from compnerd/library-names
fix cross-compiled library names
2016-12-19 13:29:12 -08:00
Saleem Abdulrasool
b79b743bac Merge pull request #6350 from compnerd/windows-stdlib-improvements
Windows stdlib improvements
2016-12-18 13:31:56 -08:00
Saleem Abdulrasool
54d5188120 build: collapse a few set_property calls into set_target_properties
Just use a single call to set both properties.  NFC.
2016-12-17 21:11:32 -08:00
Saleem Abdulrasool
6ecef42a45 build: fix invalid variable usage
When the code was refactored, the old variable name `libkind` was left
in a couple of spots.  Update them to `kind`.  Remove unnecessary
quoting which would have exposed this bug.
2016-12-17 21:11:31 -08:00
Saleem Abdulrasool
6ab6d3f532 build: introduce and use swift_target_link_search_directories
Introduce a swift_target_link_search_directories which allows you to
append a search path to the linker.  This interface also allows a tweak
to make the library search directory addition more portable across
compilers (e.g. cl vs clang).
2016-12-17 21:09:58 -08:00
Michael Gottesman
7f06ef40dc [cmake] Instead of using EMIT_SIB to generate sib output, just generate targets
for sib/sibgen files for libraries without building them by default.

This will let engineers just cd into the build directory and type:

ninja swift-stdlib-sib
ninja swift-stdlib-sibgen

To generate sib and sibgen files respectively.

There are still some dependency issues in between the sib targets, so to get
this to work well, I would suggest doing a full build and then using these
targets.
2016-12-17 18:38:32 -08:00
Saleem Abdulrasool
980eb7a250 build: specify the Windows family when building for Windows
`_pipe` is only available in the Desktop App family.  Indicate to msvcrt
that we wish to use the desktop app family windows APIs.
2016-12-17 16:36:04 -08:00
Saleem Abdulrasool
90b329b6aa Merge pull request #6219 from compnerd/icu-include-flags
build: treat ICU includes as system headers
2016-12-12 13:45:06 -08:00
Saleem Abdulrasool
fbb60f8a4b build: treat ICU includes as system headers
These headers should be treated as system headers as we do not control them.

Use target_include_directories so that we can use the `SYSTEM` option to
indicate that they are system headers.  It also simplifies the invocation by not
directly modifying the underlying property.
2016-12-11 22:11:23 -08:00
Saleem Abdulrasool
24644ceef3 build: ignore non-standard C warnings on Windows
Silence a warning from Microsoft's ucrt due to use of the POSIX name (strdup).
2016-12-11 21:34:48 -08:00
Jordan Rose
26d8a9f649 [CMake] Don't pass -embed-bitcode to module generation commands. (#6109)
These are the commands Pete added in 5834df3, doing slightly more work
by compiling Swift sources twice in order to start building downstream
libraries sooner.

Really, we should diagnose when -embed-bitcode is passed here, instead
of generating nonsense commands and then falling over. I filed
https://bugs.swift.org/browse/SR-3352 for that.

rdar://problem/29537164
2016-12-06 16:42:48 -08:00
Simon Evans
1daa3ee1f8 [SR-648] Add option to create statically linked binaries
- Add ImageInspectionStatic.cpp to lookup protocol conformance
  and metadata sections in static binaries

- For Linux, build libswiftImageInspectionShared.a and
  libswiftImageInspectionStatic.a for linking with libswiftCore.a.
  This allows static binaries to be built without linking to
  libdl. libswiftImageInspectionShared (ImageInspectionELF.cpp) is
  automatically compiled into libswiftCore.so

- Adds -static-executable option to swiftc to use along with
  -emit-executable that uses linker arguments in
  static-executable-args.lnk. This also requires a libicu
  to be compiled using the --libicu which has configure options
  that dont require libdl for accessing ICU datafiles

- Static binaries only work on Linux at this time
2016-11-29 13:36:19 +00:00
Doug Coleman
dcb9b39ff5 Merge pull request #5821 from rintaro/cmake-depends-handle_swift_sources
[CMake] Add DEPENDS to dependencies for compiling sources.
2016-11-17 16:47:40 -08:00
Rintaro Ishizaki
87bf209664 [CMake] Add DEPENDS to dependencies for compiling sources. 2016-11-17 02:03:44 +09:00