Commit Graph

1960 Commits

Author SHA1 Message Date
Joe Groff
663904766e Revert "Runtime: Only demangle symbolic references in constant memory."
This reverts commit 99842f9919.
2018-06-25 15:47:14 -07:00
swift-ci
b70a1cd998 Merge remote-tracking branch 'origin/master' into master-next 2018-06-25 12:49:31 -07:00
Joe Groff
99842f9919 Runtime: Only demangle symbolic references in constant memory.
This provides a slight amount of defense against attackers constructing mangled names with offsets crafted to JOP the runtime into attacker-controlled code. (Someone could still find some random code or constant data artifact in a binary that *looks* like a mangled string with symbolic references and theoretically attack that way, but they at least wouldn't be able to construct their own string entirely.)
2018-06-25 10:22:20 -07:00
swift-ci
f7e70911de Merge remote-tracking branch 'origin/master' into master-next 2018-06-20 06:30:02 -07:00
Doug Gregor
f232af5535 [Mangling] Allow standard substitutions in protocol mangling.
Protocol name mangling didn’t always go through a path that allowed the use
of standard substitutions. Enable standard substitutions for protocol name
manglings where they make sense.

Removes ~277k from the standard library binary size.
2018-06-19 23:24:38 -07:00
Doug Gregor
7952a19f31 [Mangling] Introduce known manglings for many more standard library types.
Since the mangling scheme and set of standard library types is effectively
fixed now, introduce known mangling substitutions for a number of new
standard library types, filling out the S[A-Za-z] space.

Reduces standard library binary size by ~195k.
2018-06-19 23:24:38 -07:00
Bob Wilson
740c4d0782 [master-next] Avoid use of StringRef::split and rsplit
LLVM r334283 changed StringRef::split(char) to be implemented using
StringRef::split(StringRef), which is not defined inline. Because Swift
uses StringRef without linking LLVM's libSupport.a, we can only use
functions that are defined inline in the headers. Swift currently only
builds LLVM for the host, so we cannot link libSupport.a without building
it for every target, which would be a big change. Instead, this changes
a few places in Swift to avoid using those split and rsplit functions.

rdar://problem/41029268
2018-06-18 12:57:59 -07:00
Bob Wilson
225bc732b4 Merge remote-tracking branch 'origin/master' into master-next 2018-06-15 17:26:12 -07:00
Lily Vulcano
ce6316ed51 Expose swift_getTypeContextDescriptor() on Darwin. 2018-06-15 13:36:26 -07:00
swift-ci
be34234b1d Merge remote-tracking branch 'origin/master' into master-next 2018-06-13 09:49:27 -07:00
Joe Groff
5887165582 Merge pull request #15565 from tanner0101/get-field-c-callable
[runtime] make `swift_getFieldAt` callable from C / Swift
2018-06-13 09:39:32 -07:00
Bob Wilson
796122fa45 Merge remote-tracking branch 'origin/master' into master-next 2018-06-12 15:06:47 -07:00
Saleem Abdulrasool
b33a1e1766 runtime: workaround GCC 4.8 libstdc++ C++11 conformance
libstdc++ included with GCC 4.8 does not define `std::max_align_t` as
required by the C++11 specification.  As a workaround, explicitly create
the definition locally.  This was fixed in GCC 4.9 and later.
2018-06-12 12:03:31 -07:00
swift-ci
737078d205 Merge remote-tracking branch 'origin/master' into master-next 2018-06-11 17:09:35 -07:00
swift-ci
f65000ae57 Merge pull request #16964 from millenomi/bundle-for-class 2018-06-11 17:00:21 -07:00
swift-ci
797dc74b30 Merge remote-tracking branch 'origin/master' into master-next 2018-06-11 11:29:34 -07:00
Pavel Yaskevich
92c4189e2d [Runtime] NFC: remove C style "stddef.h" header from casting 2018-06-10 20:36:27 -07:00
swift-ci
890603e42f Merge remote-tracking branch 'origin/master' into master-next 2018-06-08 17:09:46 -07:00
Saleem Abdulrasool
638b89d12d runtime: use std::max_align_t over max_align_t (NFC)
MSVC does not provide a full C99 environment.  Use the C++ equivalent
spelling for the value.  This allows the build to succeed on Windows.
2018-06-08 14:36:19 -07:00
swift-ci
b6511cf791 Merge remote-tracking branch 'origin/master' into master-next 2018-06-08 10:09:36 -07:00
Joe Groff
c85a881993 Merge pull request #16906 from linux-on-ibm-z/s390x-relocation-fix
Mark swift sections as 1 byte aligned
2018-06-08 09:59:16 -07:00
Lily Vulcano
4c857c5f49 Mark as API; use expanded-from-template return type. 2018-06-08 09:45:49 -07:00
Lily Vulcano
02bf6fd217 Expose SPI to get type descriptor for Bundle(for:) 2018-06-08 09:42:53 -07:00
swift-ci
568855a33c Merge remote-tracking branch 'origin/master' into master-next 2018-05-31 09:29:52 -07:00
Lily Vulcano
1377ab7d7e Turn on ‘as’ bridging on Darwin. 2018-05-30 15:07:22 -07:00
swift-ci
ff0c455b1c Merge remote-tracking branch 'origin/master' into master-next 2018-05-29 11:49:49 -07:00
Mike Ash
9638cb8f6e [Runtime] Fix format string warnings in Errors.cpp and Exclusivity.cpp when built for 32-bit.
rdar://problem/40345076
2018-05-25 16:16:02 -04:00
Michael Munday
94ffb3404b Mark swift sections as 1 byte aligned
The C compiler on some platforms (such as s390x) assumes that the
data pointed to by symbols meets certain alignment requirements.
The swift sections do not necessarily meet these alignment
requirements so this change adds alignment attributes to them to
force the compiler to emit the instruction sequences and relocations
required to address unaligned data.

This fixes a 'R_390_PC32DBL target misaligned' warning issued by
gold on s390x.
2018-05-25 11:03:44 -04:00
swift-ci
76bd350b43 Merge remote-tracking branch 'origin/master' into master-next 2018-05-24 08:09:06 -07:00
Arnold Schwaighofer
c0af215fd8 Merge pull request #16802 from aschwaighofer/swift5_sections
Rename swift sections from swift4 to swift5
2018-05-24 07:52:15 -07:00
swift-ci
469fb047c1 Merge remote-tracking branch 'origin/master' into master-next 2018-05-23 13:29:12 -07:00
swift-ci
435375d258 Merge pull request #16798 from aschwaighofer/opaque_existentials_bitwise_takable 2018-05-23 13:13:02 -07:00
Arnold Schwaighofer
cc7f207cec Rename swift sections from swift4 to swift5
rdar://38465220
2018-05-23 12:18:08 -07:00
swift-ci
0c5bd1d458 Merge remote-tracking branch 'origin/master' into master-next 2018-05-23 11:49:21 -07:00
Mike Ash
66628f6ed6 Merge pull request #16753 from mikeash/fix-metadatalookup-deadlocks
[Runtime] Change MetadataLookup section vectors to use ConcurrentReadableArray.
2018-05-23 14:38:46 -04:00
Mike Ash
93470fb9b9 Merge pull request #16794 from mikeash/fix-ConcurrentReadableArray-double-free
[Runtime] Fix double-frees in ConcurrentReadableArray.
2018-05-23 14:38:33 -04:00
Arnold Schwaighofer
98506e03cf IRGen: Opaque existentials are now bitwise takable
Now that the existential inline buffer is bitwise takable so are opaque
existentials.
2018-05-23 11:17:54 -07:00
swift-ci
9a6af07470 Merge remote-tracking branch 'origin/master' into master-next 2018-05-23 10:49:11 -07:00
Mike Ash
22f199b10d Merge pull request #16772 from mikeash/dynamicCast-unwrap-multilevel-optionals
[Runtime] Have swift_dynamicCast unwrap multiple levels of optionals in the source.
2018-05-23 13:35:38 -04:00
swift-ci
94f870732f Merge remote-tracking branch 'origin/master' into master-next 2018-05-23 08:49:20 -07:00
Mike Ash
00ef29c322 Merge branch 'fix-ConcurrentReadableArray-double-free' into fix-metadatalookup-deadlocks 2018-05-23 11:33:10 -04:00
Mike Ash
c7eeeb5a68 [Runtime] Change ConcurrentReadableArray's API to provide iterable snapshots rather than using a callback-based read call.
rdar://problem/40230581
2018-05-23 11:19:42 -04:00
Arnold Schwaighofer
6267860a7e IRGen: Remove initializeBufferWithTakeOfBuffer in favor of memcpy
And update the existential container's initializeWithTake implementation
in the runtime. After only allowing bitwise takable values in the
inline buffer we can use memcpy to move existential container values.

rdar://31414907
SR-343
2018-05-22 13:05:00 -07:00
swift-ci
7cdafa138d Merge remote-tracking branch 'origin/master' into master-next 2018-05-22 12:49:30 -07:00
Arnold Schwaighofer
d05f611b6d Merge pull request #16759 from aschwaighofer/abi_inline_implies_bitwise_takable
ABI: Only store bitwise take-able values inline
2018-05-22 12:42:03 -07:00
Mike Ash
0dae9b3dc0 [Runtime] Have swift_dynamicCast unwrap multiple levels of optionals in the source.
The real work is done in checkDynamicCastFromOptional. This code tried to unwrap the source and returned the payload on success. It only did this once, so a type like Optional<Optional<Int>> would come out as Optional<Int> and then a cast to Int would fail.

This change makes checkDynamicCastFromOptional recursive, which makes it unwrap as many levels of Optional as it encounters.

Fixes rdar://problem/40171034 and SR-7664.
2018-05-22 15:05:09 -04:00
swift-ci
71070cf332 Merge remote-tracking branch 'origin/master' into master-next 2018-05-22 07:29:25 -07:00
Mike Ash
5b991f30b8 [Runtime] Redo the ErrorObject/dlsym interface to use a struct containing all the bridging points. This allows for better static typing and reduces the amount of dynamic symbol lookups.
rdar://problem/39810532
2018-05-21 17:10:46 -04:00
Arnold Schwaighofer
298067496d ABI: Only store bitwise take-able values inline
SR-343
rdar://31414907
2018-05-21 14:02:12 -07:00
Mike Ash
b3d1030b65 [Runtime] Change MetadataLookup's various section vectors to use ConcurrentReadableArray rather than std::vector. This avoids the need to hold a lock while iterating, removing potential deadlocks.
rdar://problem/40230581
2018-05-21 12:35:15 -04:00