Commit Graph

45 Commits

Author SHA1 Message Date
Andrew Sukach
4cf7940226 Add missing symbols for Fedora 41 2025-07-16 08:20:34 -07:00
Evan Wilde
66a4e52a87 Add missing symbols for Fedora41
Fixing the linux symbol check to unblock nightly packages.
2025-06-09 09:33:53 -07:00
Slava Pestov
70b413dc56 RemoteInspection: Support for parameter packs 2025-05-09 14:49:37 -04:00
Evan Wilde
b492b716f6 Include std::to_string(long) in exported symbols
The GNU C++ runtimes added yet another symbol to our exported symbols
causing this test to fail. Adding it now: _ZNSt7__cxx119to_stringEl

rdar://142782295
2025-01-13 14:29:20 -08:00
Ben Barham
412c8321c3 [Test] Add symbols visible on Ubuntu 23.10
A couple more `basic_string`:
```
_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE15_M_replace_coldEPcmPKcmm
_ZSt12__str_concatINSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEET_PKNS6_10value_typeENS6_9size_typeES9_SA_RKNS6_14allocator_typeE
```

Which are:
```
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_replace_cold(char*, unsigned long, char const*, unsigned long, unsigned long)
```
and
```
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::__str_concat<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::value_type const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size_type, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::value_type const*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::size_type, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::allocator_type const&)
```
2024-04-19 13:26:57 -07:00
Ben Barham
c4111e53ee [Test] Even more visible libstdc++
```
_ZNSt10_HashtableImSt4pairIKmSt8optionalISsEESaIS4_ENSt8__detail10_Select1stESt8equal_toImESt4hashImENS6_18_Mod_range_hashingENS6_20_Default_ranged_hashENS6_20_Prime_rehash_policyENS6_17_Hashtable_traitsILb0ELb0ELb1EEEE10_M_emplaceIJS0_ImS3_EEEES0_INS6_14_Node_iteratorIS4_Lb0ELb0EEEbESt17integral_constantIbLb1EEDpOT_
_ZNSt10_HashtableImSt4pairIKmSt8optionalISsEESaIS4_ENSt8__detail10_Select1stESt8equal_toImESt4hashImENS6_18_Mod_range_hashingENS6_20_Default_ranged_hashENS6_20_Prime_rehash_policyENS6_17_Hashtable_traitsILb0ELb0ELb1EEEE10_M_emplaceIJS0_ImSsEEEES0_INS6_14_Node_iteratorIS4_Lb0ELb0EEEbESt17integral_constantIbLb1EEDpOT_
_ZNSt10_HashtableImSt4pairIKmSt8optionalISsEESaIS4_ENSt8__detail10_Select1stESt8equal_toImESt4hashImENS6_18_Mod_range_hashingENS6_20_Default_ranged_hashENS6_20_Prime_rehash_policyENS6_17_Hashtable_traitsILb0ELb0ELb1EEEE13_M_rehash_auxEmSt17integral_constantIbLb1EE
```

Which corresponds to `_M_emplace` and `_M_rehash_aux`:
```
std::pair<std::__detail::_Node_iterator<std::pair<unsigned long const, std::optional<std::string> >, false, false>, bool> std::_Hashtable<unsigned long, std::pair<unsigned long const, std::optional<std::string> >, std::allocator<std::pair<unsigned long const, std::optional<std::string> > >, std::__detail::_Select1st, std::equal_to<unsigned long>, std::hash<unsigned long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_emplace<std::pair<unsigned long, std::optional<std::string> > >(std::integral_constant<bool, true>, std::pair<unsigned long, std::optional<std::string> >&&)
std::pair<std::__detail::_Node_iterator<std::pair<unsigned long const, std::optional<std::string> >, false, false>, bool> std::_Hashtable<unsigned long, std::pair<unsigned long const, std::optional<std::string> >, std::allocator<std::pair<unsigned long const, std::optional<std::string> > >, std::__detail::_Select1st, std::equal_to<unsigned long>, std::hash<unsigned long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_emplace<std::pair<unsigned long, std::string> >(std::integral_constant<bool, true>, std::pair<unsigned long, std::string>&&)
std::_Hashtable<unsigned long, std::pair<unsigned long const, std::optional<std::string> >, std::allocator<std::pair<unsigned long const, std::optional<std::string> > >, std::__detail::_Select1st, std::equal_to<unsigned long>, std::hash<unsigned long>, std::__detail::_Mod_range_hashing, std::__detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::__detail::_Hashtable_traits<false, false, true> >::_M_rehash_aux(unsigned long, std::integral_constant<bool, true>)
```
2024-02-28 09:11:31 -08:00
Ben Barham
5efd8802b9 [Test] Add another C++ stdlib symbol to the Linux symbol visibility test
`_ZNSt6vectorISt8optionalISt4pairISsbEESaIS3_EE17_M_realloc_insertIJRKS3_EEEvN9__gnu_cxx17__normal_iteratorIPS3_S5_EEDpOT_`

```
void std::vector<std::optional<std::pair<std::string, bool> >, std::allocator<std::optional<std::pair<std::string, bool> > > >::_M_realloc_insert<std::optional<std::pair<std::string, bool> > const&>(__gnu_cxx::__normal_iterator<std::optional<std::pair<std::string, bool> >*, std::vector<std::optional<std::pair<std::string, bool> >, std::allocator<std::optional<std::pair<std::string, bool> > > > >, std::optional<std::pair<std::string, bool> > const&)
```
2024-02-26 18:13:24 -08:00
Ben Barham
dea8e30d0f [Test] Add more C++ stdlib symbols on Linux
Two new symbols:
  `void std::__detail::__variant::__erased_ctor<std::monostate&, std::monostate&&>(void*, void*)`
  `void std::__detail::__variant::__erased_assign<std::monostate&, std::monostate&&>(void*, void*)`

Likely added from #71627.
2024-02-21 22:27:46 -08:00
Ben Barham
ef8825bfe6 Migrate llvm::Optional to std::optional
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Mike Ash
5609103172 [Test] Add _ZNSsC2EPKcRKSaIcE to symbol-visibility-linux.test-sh
This corresponds to:

std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(char const*, std::allocator<char> const&)

rdar://120908750
2024-01-12 14:05:00 -05:00
Evan Wilde
a0fe86a3af Ignore another GNU exported symbol
I ignored this symbol on swiftRemoteMirror, but forgot to ignore it in
swiftCore, so ignoring it now

_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJRKjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_
2023-10-03 20:36:37 -07:00
Evan Wilde
8a7c3c98b6 Adding another C++ stdlib function to ignore list
Looks like rebranch is finding another realloc_insert function on
vector causing failures on the Ubuntu 20.04 aarch64 bot.

_ZNSt6vectorIjSaIjEE17_M_realloc_insertIJRKjEEEvN9__gnu_cxx17__normal_iteratorIPjS1_EEDpOT_

We'll go ahead and ignore it for now.
2023-09-19 11:58:52 -07:00
Egor Zhdan
a785ea18d6 Fix symbol-visibility-linux.test-sh on CentOS
rdar://108041802
2023-04-15 00:31:27 +01:00
Doug Gregor
fb82b8f711 Fix Linux flaky test completely 2023-04-11 23:40:32 -04:00
Doug Gregor
097ecfd545 Fix fragile test 2023-04-11 23:40:32 -04:00
Ben Barham
c542a8834f [Test] Add another C++ symbol to the visibility filter 2023-03-06 09:15:37 -08:00
Evan Wilde
baa1fdf0a4 Add cxx119to_string to ignored symbol list
Looks like more fallout from the move to C++17 on Linux.
Adding the symbol from the C++ stdlib to the ignore list.
2023-03-04 17:50:07 -08:00
Mishal Shah
e256b56545 Merge branch 'main' into rebranch 2023-03-02 18:25:09 -08:00
Mike Ash
91dcf8d298 [Runtime] Fix subscript key path printing when arguments can't be resolved.
If there's a mismatch between the arguments we match and the arguments we actually have, we can end up indexing off the end of the argumentTypeNames vector. This can happen when an argument has a dependent generic type. Add a bounds check and print <unknown> when we're out of bounds to avoid crashing.

For correctness, we should match generic dependent types and add them to the arguments array, but we'll fix the crashes first.

rdar://104438524
2023-03-02 13:46:44 -05:00
Ben Barham
994a37c82b [Test] Add new visible symbols on Linux
Enabling the C++ stdlib assertions seems to have added even more symbols
(this time from `emplace_back`). Add them to the filter.
2023-02-14 17:02:51 -08:00
Ben Barham
295a317a47 [Test] Ignore now-visible stdlib symbols
Last set of CentOS symbols.
2023-02-09 13:11:12 -08:00
Ben Barham
d563ef00e0 [Test] Remove symbol from visibility filter
`_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4nposE` was
accidentally added with the large set of CentOS symbols. Remove it - is
is visible in both all and no weak.
2023-02-06 16:56:49 -08:00
Ben Barham
32d6633b97 [Test] Filter out further symbols from CentOS 2023-02-06 09:50:49 -08:00
Ben Barham
978066e532 [Test] Filter out further symbols now visible on Linux
CentOS has a whole bunch of new std::string symbols that are now
visible. Filter them all out.
2023-02-03 15:53:04 -08:00
Ben Barham
b98ee678ea Merge pull request #63405 from bnbarham/filter-more-symbols
[Test] Filter further C++ standard library symbols
2023-02-02 21:26:23 -08:00
Ben Barham
9bfdccc550 [Test] Filter further C++ standard library symbols
205d68849e but for swiftCore as well (it
only filtered swiftRemoteMirror).
2023-02-02 21:25:03 -08:00
Ben Barham
205d68849e [Test] Filter further C++ standard library symbols
Filters out further standard library symbols:
  - `basic_string::_M_replace`
  - `basic_string::reserve`
  - `basic_string::_M_mutate`
  - `basic_string std::operator+`
2023-02-02 13:06:54 -08:00
Mike Ash
7f6c565c07 [Test] Add new symbol to symbol-visibility-linux.test-sh.
Add `_ZNSt6vectorISsSaISsEE17_M_realloc_insertIJSsEEEvN9__gnu_cxx17__normal_iteratorIPSsS1_EEDpOT_`, which is a slight variation on one of the existing ignored symbols for std::vector::_M_realloc_insert.

rdar://99888061
2022-09-14 14:04:16 -04:00
Ben Pious
57d82317c1 Add CustomDebugDescription conformance to AnyKeyPath (#60133)
* initial

* it works

demangling mostly works

fix dots

printing works

add tests

add conformance to AnyKeyPath

implement SPI

subscripts fully work

comments

use cross platform image inspection

remove unnecessary comment

fix

fix issues

add conditional conformance

add types

try to fix the api-digester test

cr feedback: move impls behind flag, remove addChain(), switch statement, fallthrough instead of if-elses, move import

cr feedback: refactor switch statement

fix #ifdef

reindent, cr feedback: removes manual memory management

fix missing whitespace

fix typo

fix indentation issues

switch to regexes

checks should test in on all platforms

print types in subscripts

add test for empty subscript

Update test/api-digester/stability-stdlib-abi-without-asserts.test

Co-authored-by: Xiaodi Wu <13952+xwu@users.noreply.github.com>

add commas

fix failing test

fix stdlib annotation

cr feedback: remove global, refactor ifdef

cr feedback: switch back to manual memory management

switch to 5.8 macro

add new weakly linked functions to the allowlist

fix one more failing test

more cr feedback

more cr feedback

* fix invisible unicode
2022-09-13 09:23:32 -07:00
Josh Soref
624a54b9cf Spelling stdlib (#42544)
* spelling: abcdefghijklmnopqrstuvwxyz

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: clazz

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: collection

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compressible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: constituent

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: contiguous

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: convertibility

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: element

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: enforce

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: exhaustive

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: exhausts

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: existential

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: facilitate

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: ignored

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: incorporated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: intersection

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: laziness

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: misaligned

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: overhaul

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: preamble

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: precondition

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: replacement

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: trailing

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: unambiguous

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: uncompressible

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: world

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-22 19:18:38 -07:00
Mike Ash
a82ea120a4 [RemoteMirror][swift-inspect] Add a command to inspect the state of the concurrency runtime.
Most of the new inspection logic is in Remote Mirror. New code in swift-inspect calls the new Remote Mirror functions and formats the resulting information for display.

Specific Remote Mirror changes:

* Add a call to check if a given metadata is an actor.
* Add calls to get information about actors and tasks.
* Add a `readObj` call to MemoryReader that combines the read and the cast, greatly simplifying code chasing pointers in the remote process.
* Add a generalized facility to the C shims that can allocate a temporary object that remains valid until at least the next call, which is used to return various temporary arrays from the new calls. Remove the existing `lastString` and `lastChunks` member variables in favor of this new facility.

Swift-inspect changes:

* Add a new dump-concurrency command.
* Add a new `ConcurrencyDumper.swift` file with the implementation. The dumper needs to do some additional work with the results from Remote Mirror to build up the task tree and this keeps it all organized.
* Extend `Inspector` to query the target's threads and fetch each thread's current task.

Concurrency runtime changes:

* Add `_swift_concurrency_debug` variables pointing to the various future adapters. Remote Mirror uses these to provide a better view of a tasks's resume pointer.

rdar://85231338
2022-02-04 09:28:32 -05:00
Evan Wilde
ab9467eba2 Filter std::function call symbol
The `std::function` symbol is showing up on centos 7. It should be okay.
2021-10-11 12:09:21 -07:00
Saleem Abdulrasool
0fed832b13 Update symbol-visibility-linux.test-sh
Ignore an additional symbol in swiftRemoteMirror.  This was ignored in swiftCore previously, update the list for SwiftRemoteMirror as well.
2021-10-08 21:15:48 -07:00
Saleem Abdulrasool
118b47c19b Update symbol-visibility-linux.test-sh
Ignore `_M_realloc_insert` from the C++ standard library which is over-exported in libstdc++.
2021-09-28 10:51:30 -07:00
Erik Eckstein
1c8b369afc tests: exclude two C++ symbols from the weak-symbol test
rdar://82652598
2021-09-09 11:47:08 +02:00
Mike Ash
ebd9c215ec [Reflection] Sanity-check metadata sizes in MetadataReader before reading.
MetadataReader can be given corrupt or garbage data and we need to be able to handle it gracefully. When reading metadata, the full size to read is calculated from partial data. When we're given bad data, these calculated sizes can be enormous, up to 4GB. Trying to read that much data can cause address space exhaustion which leads to unpleasantness.

To avoid this, fix a limit of 1MB on metadata sizes, and fail early if the size is larger. No real-world metadata should ever be that large.

We also switch these potentially large calls to use the readBytes variant that returns a unique_ptr, rather than allocating a buffer and reading into it. Our clients typically implement that as the primitive, so this avoids an unnecessary extra data copy and extra address space usage for them. Clients that implement reading into a provided buffer as the primitive should see the same performance as before.

rdar://78621784
2021-06-11 13:20:10 -04:00
Dario Rexin
fe7ade852f [Linux] Add symbol to ignore list in symbol-visibility-linux test (#37001)
This test fails on linux-aarch64 because of the additional weak C++ symbol
2021-04-29 08:47:12 -07:00
Mike Ash
70354af2b5 [Runtime] Avoid operator new/delete in ConcurrentReadableArray.
The callbacks made in ImageInspectionMachO.cpp are called in a dangerous context, with the dyld and ObjC runtime locks held. C++ allows programs to overload the global operator new/delete, and there's no guarantee that those overloads behave. Ideally, we'd avoid them entirely, but that's a bigger job. For now, avoid the worst trouble by avoiding STL and new/delete in these callbacks. That use came from ConcurrentReadableArray's free list, so we switch that from a std::vector to a linked list.

rdar://75036800
2021-04-09 09:29:20 -04:00
Marcel Hlopko
3a27c119e5 Add exceptions to symbol_visibility_linux_test (#34905) 2020-12-11 08:12:08 +01:00
Mike Ash
782fa27206 [Runtime] Move ElementCapacity into the Elements allocation.
This shrinks ConcurrentReadableHashMap a bit, which will be needed for adapting it for metadata caches.
2020-10-28 10:23:21 -04:00
Mike Ash
4cd1b715bd [Runtime] Shrink ConcurrentReadableHashMap a bit.
We're using a lot of space on the free lists. Each vector is three words, and we have two of them. Switch to a single linked list. We only need one list, as both kinds of pointers just get free()'d. A linked list optimizes for the common case where the list is empty. This takes us from six words to one.

Also make ReaderCount, ElementCount, and ElementCapacity uint32_ts. The size_ts were unnecessarily large and this saves some space on 64-bit systems.

While we're in there, add 0/NULL initialization to all elements. The current use in the runtime is unaffected (it's statically allocated) but the local variables used in the test were tripping over this.
2020-08-27 13:05:40 -04:00
Mike Ash
e13217147f [Test] Filter out a __rotate symbol and another __once_call symbol in symbol-visibility-linux.test-sh. 2020-08-20 15:55:38 -04:00
Dario Rexin
732698e268 Fix symbol visibility test for CentOS 7 2020-07-02 13:21:38 -07:00
tbkka
db9cf4cd80 Filter out more std::__once_call_impl<>() constructors (#32325)
One of our Ubuntu 16.04 CI machines is seeing different variations
of the std::__once_call_impl<>() constructor than the ones we're already filtering out.

Resolves rdar://64267618
2020-06-12 10:03:13 -07:00
Saleem Abdulrasool
017d99d7e4 test: add a test to prevent weak symbol leakage
The Swift standard library should not export weak symbols.  Ensure that
no public weak symbols are defined in the standard library by adding a
test case.  This would have identified the issue introduced by the
recent changes for the runtime.
2020-06-08 16:24:11 -07:00