Skip to content

Enable armv7em and os none triples #6438

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 2 commits into from
Apr 25, 2023

Conversation

rauhul
Copy link
Member

@rauhul rauhul commented Apr 14, 2023

  • Adds preliminary knowledge of armv7em and no os environments to spm. Future diffs will be required to fully support these triples. This change allows a armv7em-apple-none-macho build via a destination v3 bundle to make it further through spm.

@rauhul rauhul force-pushed the teach-spm-about-armv7em-and-os-none branch from 36b731e to cf60251 Compare April 14, 2023 22:09
@rauhul rauhul changed the title Teach spm about arvm7em and os none Teach spm about armv7em and os none Apr 14, 2023
@rauhul
Copy link
Member Author

rauhul commented Apr 14, 2023

@swift-ci please test

@neonichu
Copy link
Contributor

@swift-ci please smoke test

@MaxDesiatov
Copy link
Contributor

@swift-ci test windows

// Better as dynamic error or "fatalError", but it is a larger
// undertaking to teach spm that dylibs are not available on some
// platforms.
return ".os-none-dynamic-library"
Copy link
Contributor

Choose a reason for hiding this comment

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

I personally would prefer fatalError here

Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC, we had problems with that in the WASI case? I don't remember if they were specific to that or a workaround for dylib extensions to be eagerly asked for by SwiftPM.

Copy link
Contributor

@MaxDesiatov MaxDesiatov Apr 17, 2023

Choose a reason for hiding this comment

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

WASI just has static stdlib linking and everything else hardcoded to be enabled by default AFAIR

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed to fatal error, but I had to make the use of this string lazy to avoid crashing in normal use (for triple armv7em-apple-none-macho)

@MaxDesiatov MaxDesiatov changed the title Teach spm about armv7em and os none Enable armv7em and os none triples Apr 17, 2023
@MaxDesiatov
Copy link
Contributor

cc @compnerd who also previously worked on enabling ARM subarchitectures in a different PR

Copy link
Member

@compnerd compnerd left a comment

Choose a reason for hiding this comment

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

I think that just erroring out if a shared library is required is acceptable as a first approximation of this support. We could continue to refine it further later.

@@ -272,6 +280,8 @@ extension Triple {
return ".wasm"
case .windows:
return ".exe"
case .noneOS:
return ""
Copy link
Member

Choose a reason for hiding this comment

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

An argument could be made that it should be ".exe" or "". Embedded systems are really heterogenous and some recommend the .exe and some don't. I'm worried that loaders might care about the extension and we don't have a way to specify that in the Package Manifest.

Copy link
Member Author

Choose a reason for hiding this comment

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

I could conditionalize this based on the vendor I guess? But for now I feel like "" is probably sufficient?

@rauhul
Copy link
Member Author

rauhul commented Apr 24, 2023

@swift-ci please smoke test

- Adds preliminary knowledge of armv7em and no os environments to spm.
  Future diffs will be required to fully support these triples. This
  change allows a armv7em-apple-none-macho build via a destination v3
  bundle to make it further through spm.
@rauhul rauhul force-pushed the teach-spm-about-armv7em-and-os-none branch from 444a1a0 to 3491aeb Compare April 24, 2023 23:22
@rauhul
Copy link
Member Author

rauhul commented Apr 24, 2023

@swift-ci please smoke test

1 similar comment
@rauhul
Copy link
Member Author

rauhul commented Apr 25, 2023

@swift-ci please smoke test

Copy link
Contributor

@MaxDesiatov MaxDesiatov left a comment

Choose a reason for hiding this comment

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

LGTM, just a minor coding style nit

@@ -391,18 +391,22 @@ public struct BuildParameters: Encodable {
return try buildPath.appending(binaryRelativePath(for: product))
}

/// Returns the path to the dynamic library of a product for the current build parameters.
internal func potentialDynamicLibraryPath(for product: ResolvedProduct) throws -> RelativePath {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I don't think we use explicit internal in our codebase

Suggested change
internal func potentialDynamicLibraryPath(for product: ResolvedProduct) throws -> RelativePath {
func potentialDynamicLibraryPath(for product: ResolvedProduct) throws -> RelativePath {

Copy link
Member Author

Choose a reason for hiding this comment

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

done!

@rauhul
Copy link
Member Author

rauhul commented Apr 25, 2023

@swift-ci please smoke test

@rauhul
Copy link
Member Author

rauhul commented Apr 25, 2023

@swift-ci test windows

@MaxDesiatov MaxDesiatov enabled auto-merge (squash) April 25, 2023 17:59
@MaxDesiatov MaxDesiatov merged commit da7d339 into main Apr 25, 2023
@MaxDesiatov MaxDesiatov deleted the teach-spm-about-armv7em-and-os-none branch April 25, 2023 20:55
MaxDesiatov pushed a commit that referenced this pull request Jul 18, 2023
Adds preliminary knowledge of `armv7em` CPU and `none` OS environments to SwiftPM. Future diffs will be required to fully support these triples. This change allows a `armv7em-apple-none-macho` build via a destination v3 bundle to make it further through SwiftPM.

(cherry picked from commit da7d339)

# Conflicts:
#	Sources/SPMBuildCore/BuildParameters.swift
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