Skip to content

[Backtracing] Update module maps. #78514

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
merged 5 commits into from
Jan 16, 2025
Merged

Conversation

al45tair
Copy link
Contributor

@al45tair al45tair commented Jan 9, 2025

Now that Darwin is provided by the system, we no longer need to disable the system module maps in favour of our own, which also resolves a few other problems that doing that was creating.

rdar://137201928

Now that Darwin is provided by the system, we no longer need to disable the
system module maps in favour of our own, which also resolves a few other
problems that doing that was creating.

rdar://137201928
@al45tair
Copy link
Contributor Author

al45tair commented Jan 9, 2025

@swift-ci Please test

@al45tair
Copy link
Contributor Author

al45tair commented Jan 9, 2025

@swift-ci Please test

@@ -16,14 +16,22 @@

import Swift

@_implementationOnly import OS.Libc
#if os(macOS) || os(iOS) || os(tvOS) || os(watchOS)
internal import Darwin
Copy link
Contributor

Choose a reason for hiding this comment

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

Darwin is pretty heavy, is it possible to import one of the modules under it like errno_h or stdio_h if they're available?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe. That might involve importing a number of modules, mind, and it'll only really affect the compile time of the backtracing library (since we aren't exporting anything from them). So it's worth experimenting with, for sure, but we can probably defer that for now.

Copy link
Contributor

Choose a reason for hiding this comment

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

I was thinking more like pulling in dependencies you don't want rather than compile time. i.e. do you really want bsm and nurses and all the other bs that Darwin gives you? Or do you just need a few cstdlib things?

Copy link
Contributor

@ian-twilightcoder ian-twilightcoder left a comment

Choose a reason for hiding this comment

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

🥳

@al45tair
Copy link
Contributor Author

al45tair commented Jan 9, 2025

Ah. The Linux problem is one I already have fixed elsewhere (by using C++ interop). I might need to pull in some changes from a different PR to fix that.

We have some problems on Linux where Glibc pulls in `<elf.h>` and then
we end up with conflicting definitions.  Fix by using C++ interop and
putting our definitions into a namespace.

rdar://137201928
@al45tair al45tair requested a review from rjmccall as a code owner January 10, 2025 13:51
@al45tair
Copy link
Contributor Author

@swift-ci Please test

@al45tair
Copy link
Contributor Author

Joy. That's not going to work either. Still more changes required.

Also fixed a couple of other minor issues preventing this PR from
building on its own.

rdar://137201928
@al45tair
Copy link
Contributor Author

@swift-ci Please test

The runtime functions must be marked `extern "C"` because the symbols
are not mangled when exported.

rdar://137201928
@al45tair
Copy link
Contributor Author

@swift-ci Please test

1 similar comment
@al45tair
Copy link
Contributor Author

@swift-ci Please test

These types only exist on Linux, so need to be conditionalised here.

rdar://137201928
@al45tair
Copy link
Contributor Author

@swift-ci Please test

@al45tair al45tair merged commit d644728 into swiftlang:main Jan 16, 2025
5 checks passed
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.

2 participants