Skip to content

Fixing the strong imported async frame pointer flags #40035

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

etcwilde
Copy link
Member

@etcwilde etcwilde commented Nov 3, 2021

The weakly-imported symbol was getting optimized out, then put back in
as a strongly-imported symbol. This is no good. The symbol is a
declaration though, so it can't be "used" directly. Instead, we assign
it to another global and "use" it. That avoids the optimizations and
should be fine. Even if that symbol is a nullptr because it doesn't
exist, we are taking the pointer to it, which should be fine for all
situations.

Fixes rdar://84877644.

@etcwilde
Copy link
Member Author

etcwilde commented Nov 3, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Nov 3, 2021

Build failed
Swift Test Linux Platform
Git Sha - 63599b7f9bd2080d2a594a060fa8aa34e3901e98

@etcwilde etcwilde force-pushed the ewilde/fix-weak-extendedFramePointerFlags branch from 63599b7 to 9258f3b Compare November 3, 2021 17:52
@etcwilde
Copy link
Member Author

etcwilde commented Nov 3, 2021

@swift-ci please test

@etcwilde etcwilde force-pushed the ewilde/fix-weak-extendedFramePointerFlags branch from 9258f3b to 5ffd77e Compare November 3, 2021 18:17
@etcwilde
Copy link
Member Author

etcwilde commented Nov 3, 2021

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Nov 3, 2021

Build failed
Swift Test Linux Platform
Git Sha - 5ffd77ea4f7a99530f896d8aa30f3b47a57625ed

@etcwilde
Copy link
Member Author

etcwilde commented Nov 3, 2021

Linux failures are due to the compile module being created by an older version of the compiler.

@etcwilde
Copy link
Member Author

etcwilde commented Nov 3, 2021

@swift-ci please clean test Linux

@swift-ci
Copy link
Contributor

swift-ci commented Nov 3, 2021

Build failed
Swift Test OS X Platform
Git Sha - 5ffd77ea4f7a99530f896d8aa30f3b47a57625ed

@DougGregor
Copy link
Member

@swift-ci please test macOS

@swift-ci
Copy link
Contributor

swift-ci commented Nov 4, 2021

Build failed
Swift Test OS X Platform
Git Sha - 5ffd77ea4f7a99530f896d8aa30f3b47a57625ed

@etcwilde
Copy link
Member Author

etcwilde commented Nov 4, 2021

The macOS failure is due to other symbols being included in the used list. I really just want to verify that (i8*** @_swift_async_extendedFramePointerFlagsUser to i8*) is in the list.

The full list on the bot is

appending global [10 x i8*] [i8* bitcast ({ i32 }* @"\01l_entry_point" to i8*),
i8* bitcast (void (%swift.context*)* @"$s4main1fyyYaF" to i8*),
i8* bitcast (%swift.async_func_pointer* @"$s4main1fyyYaFTu" to i8*),
i8* bitcast (void (%swift.context*)* @"$s4main1gSSyYaF" to i8*),
i8* bitcast (%swift.async_func_pointer* @"$s4main1gSSyYaFTu" to i8*),
i8* bitcast (i16* @__swift_reflection_version to i8*),
i8* bitcast (void ()** @"_swift_FORCE_LOAD_$_swiftCompatibility51_$_main" to i8*),
i8* bitcast (void ()** @"_swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_main" to i8*),
i8* bitcast (i8*** @_swift_async_extendedFramePointerFlagsUser to i8*),
i8* bitcast (i32 (i32, i8**)* @main to i8*)],
section "llvm.metadata"

compared to the following list that I had in the test

appending global [5 x i8*] [i8* bitcast ({ i32 }* @"\01l_entry_point" to i8*), 
i8* bitcast (i16* @__swift_reflection_version to i8*), 
i8* bitcast (void ()** @"_swift_FORCE_LOAD_$_swiftCompatibilityConcurrency_$_test" to i8*), 
i8* bitcast (i8*** @_swift_async_extendedFramePointerFlagsUser to i8*),
i8* bitcast (i32 (i32, i8**)* @main to i8*)],
section "llvm.metadata"

The weakly-imported symbol was getting optimized out, then put back in
as a strongly-imported symbol. This is no good. The symbol is a
declaration though, so it can't be "used" directly. Instead, we assign
it to another global and "use" it. That avoids the optimizations and
should be fine. Even if that symbol is a nullptr because it doesn't
exist, we are taking the pointer to it, which should be fine for all
situations.
Make the little variable LinkOnceODRLinkage so that it doesn't take up
as much space.
@etcwilde etcwilde force-pushed the ewilde/fix-weak-extendedFramePointerFlags branch from 5ffd77e to 3e2c5a6 Compare November 4, 2021 16:03
@etcwilde
Copy link
Member Author

etcwilde commented Nov 4, 2021

@swift-ci please test

Copy link
Contributor

@aschwaighofer aschwaighofer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@swift-ci
Copy link
Contributor

swift-ci commented Nov 4, 2021

Build failed
Swift Test Linux Platform
Git Sha - 3e2c5a6

@etcwilde
Copy link
Member Author

etcwilde commented Nov 4, 2021

@swift-ci please clean test Linux

@swift-ci
Copy link
Contributor

swift-ci commented Nov 4, 2021

Build failed
Swift Test Linux Platform
Git Sha - 3e2c5a6

@swift-ci
Copy link
Contributor

swift-ci commented Nov 4, 2021

Build failed
Swift Test OS X Platform
Git Sha - 3e2c5a6

@DougGregor
Copy link
Member

@swift-ci please test

@swift-ci
Copy link
Contributor

swift-ci commented Nov 5, 2021

Build failed
Swift Test OS X Platform
Git Sha - 3e2c5a6

@swift-ci
Copy link
Contributor

swift-ci commented Nov 5, 2021

Build failed
Swift Test Linux Platform
Git Sha - 3e2c5a6

@DougGregor
Copy link
Member

@swift-ci please test

@etcwilde
Copy link
Member Author

etcwilde commented Nov 5, 2021

The macOS bot may be signal. I'm trying to reproduce the lldb-api :: lang/swift/playgrounds/TestPlaygrounds.py failure locally because the log doesn't give very much information.

FAIL: LLDB (/Users/buildnode/jenkins/workspace/swift-PR-macos/branch-main/buildbot_incremental/llvm-macosx-x86_64/bin/clang-x86_64) :: test_cross_module_extension_dsym (TestPlaygrounds.TestSwiftPlaygrounds)
UNSUPPORTED: LLDB (/Users/buildnode/jenkins/workspace/swift-PR-macos/branch-main/buildbot_incremental/llvm-macosx-x86_64/bin/clang-x86_64) :: test_cross_module_extension_dwarf (TestPlaygrounds.TestSwiftPlaygrounds) (skipping due to the following parameter(s): debug info format) 
UNSUPPORTED: LLDB (/Users/buildnode/jenkins/workspace/swift-PR-macos/branch-main/buildbot_incremental/llvm-macosx-x86_64/bin/clang-x86_64) :: test_cross_module_extension_dwo (TestPlaygrounds.TestSwiftPlaygrounds) (test case does not fall in any category of interest for this run) 
UNSUPPORTED: LLDB (/Users/buildnode/jenkins/workspace/swift-PR-macos/branch-main/buildbot_incremental/llvm-macosx-x86_64/bin/clang-x86_64) :: test_cross_module_extension_gmodules (TestPlaygrounds.TestSwiftPlaygrounds) (skipping (gmodules only makes sense for clang tests)) 
======================================================================
FAIL: test_cross_module_extension_dsym (TestPlaygrounds.TestSwiftPlaygrounds)
   Test that playgrounds work
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/buildnode/jenkins/workspace/swift-PR-macos/branch-main/llvm-project/lldb/packages/Python/lldbsuite/test/lldbtest.py", line 1846, in test_method
    return attrvalue(self)
  File "/Users/buildnode/jenkins/workspace/swift-PR-macos/branch-main/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 150, in wrapper
    return func(*args, **kwargs)
  File "/Users/buildnode/jenkins/workspace/swift-PR-macos/branch-main/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 150, in wrapper
    return func(*args, **kwargs)
  File "/Users/buildnode/jenkins/workspace/swift-PR-macos/branch-main/llvm-project/lldb/packages/Python/lldbsuite/test/decorators.py", line 150, in wrapper
    return func(*args, **kwargs)
  File "/Users/buildnode/jenkins/workspace/swift-PR-macos/branch-main/llvm-project/lldb/test/API/lang/swift/playgrounds/TestPlaygrounds.py", line 79, in test_cross_module_extension
    self.do_test(True)
  File "/Users/buildnode/jenkins/workspace/swift-PR-macos/branch-main/llvm-project/lldb/test/API/lang/swift/playgrounds/TestPlaygrounds.py", line 150, in do_test
    self.assertTrue("=\\'23\\'" in playground_output)
AssertionError: False is not True

The only way I can see for that particular test to fail is if something fails to import.

@swift-ci
Copy link
Contributor

swift-ci commented Nov 5, 2021

Build failed
Swift Test OS X Platform
Git Sha - 3e2c5a6

@etcwilde
Copy link
Member Author

etcwilde commented Nov 9, 2021

swiftlang/llvm-project#3520

@swift-ci please test macOS

@swift-ci
Copy link
Contributor

swift-ci commented Nov 9, 2021

Build failed
Swift Test OS X Platform
Git Sha - 3e2c5a6

@etcwilde
Copy link
Member Author

@swift-ci please test macOS

@etcwilde etcwilde merged commit 28c6dd3 into swiftlang:main Nov 10, 2021
@etcwilde etcwilde deleted the ewilde/fix-weak-extendedFramePointerFlags branch November 10, 2021 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants