Skip to content

[AVR] make the AVR ABI Swift compatible #8945

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 1 commit into from
Jul 16, 2024

Conversation

carlos4242
Copy link

No description provided.

@carlos4242
Copy link
Author

@kubamracek

@kubamracek
Copy link

This will also need a cherry-pick.

@rauhul
Copy link
Member

rauhul commented Jul 9, 2024

neat! I have no idea what this does

@carlos4242
Copy link
Author

neat! I have no idea what this does

Hi @rauhul ... good question, I have to say the slightly unsatisfying answer is I curated a load of bug fixes over the years without keeping close enough notes as to the exact details of the bugs they were fixing. In nearly every case, the fix was to address the compiler "crashing" (i.e. trapping on an assert).

I'm pretty certain the "crash" in question that this patch is intended to fix is from this helper function in clang...

  /// Returns Swift ABI info helper for the target.
  const SwiftABIInfo &getSwiftABIInfo() const {
    assert(SwiftInfo && "Swift ABI info has not been initialized");
    return *SwiftInfo;
  }

...what I can't tell you (without doing a custom build to track it down) is where exactly this crash occurs in normal use. My vague memory/guess is if you run the swift compiler and it accesses the clang importer then that frequently causes this "crash" and as a result, all architectures that swift supports must have this sort of patch added to clang. It did come up on the call a week ago, discussed by @kubamracek and I because he had to add it to clang in order to get RISCV working. I flagged that I had tried without luck to get this patch merged to llvm/clang back in December/January and gave up. Kuba seemed to be saying that he too thinks this patch is essential for Swift to properly support AVR, but he can probably fill in the details a lot better than I can.

For me, from the next point on, it's most useful to try building the standard library for AVR and seeing what breaks next.

@kubamracek
Copy link

I think this change can go in, it's clearly needed for any compilations to work on AVR. We did the exact same change for RISC-V here: #8229

But we'll need a cherry-pick to stable/20230725, can you prepare it?

@carlos4242
Copy link
Author

@kubamracek sure thing... do I just create a separate PR targeted to that release? I'm sorry I'm not very familiar with the apple procedures for llvm patches.

@kubamracek
Copy link

Yes, a separate PR.

@carlos4242
Copy link
Author

#8970 is this ok?

@kubamracek kubamracek merged commit b1bac04 into swiftlang:next Jul 16, 2024
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.

3 participants