Skip to content
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

stlink: patch incorrect calloc argument order #368703

Merged
merged 1 commit into from
Dec 28, 2024

Conversation

jpteb
Copy link
Contributor

@jpteb jpteb commented Dec 28, 2024

With the update to GCC 14, stlink v1.8.0 is broken, as GCC 14 enforces the correct argument order of calloc (-Wcalloc-transposed-args). This commit adds a little patch to resolve the issue for now. This patch should be removed and stlink updated to the newest version that gets released. I've opened an issue in the stlink repository and am waiting for their response stlink-org/stlink#1444.

I have only performed minimal testing on the binaries, but I’d be very surprised if this patch causes any negative side effects.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 25.05 Release Notes (or backporting 24.11 and 25.05 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@jpteb jpteb changed the title fix(stlink): patch the incorrect calloc argument order stlink: patch incorrect calloc argument order Dec 28, 2024
@jpteb jpteb force-pushed the fix/stlink-calloc branch from f2e95a7 to 201cbb9 Compare December 28, 2024 02:40
@github-actions github-actions bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10 labels Dec 28, 2024
@ofborg ofborg bot requested a review from bjornfor December 28, 2024 05:51
Copy link
Contributor

@bjornfor bjornfor left a comment

Choose a reason for hiding this comment

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

Thanks! One nitpick: can you "fetchpatch" the patch instead?

@jpteb jpteb force-pushed the fix/stlink-calloc branch from 201cbb9 to 6bd5697 Compare December 28, 2024 14:11
@jpteb
Copy link
Contributor Author

jpteb commented Dec 28, 2024

Thanks! One nitpick: can you "fetchpatch" the patch instead?

I'm not sure what you had in mind to be honest. I could also use their commits, but I was worried that might break something since I don’t know what has changed between v1.8.0 and now. Let me know if that works for you, or if I should use their commits instead. In that case, we could temporarily switch to their testing branch and revert to the tag once a new release is available.

@ofborg ofborg bot requested a review from bjornfor December 28, 2024 16:40
@bjornfor
Copy link
Contributor

Thanks! One nitpick: can you "fetchpatch" the patch instead?

I'm not sure what you had in mind to be honest. I could also use their commits, but I was worried that might break something since I don’t know what has changed between v1.8.0 and now. Let me know if that works for you, or if I should use their commits instead. In that case, we could temporarily switch to their testing branch and revert to the tag once a new release is available.

I thought the local patch was exported from the upstream git repo, but I see now that it isn't. Sorry for the confusion -- I think your original commit is fine.

@jpteb jpteb force-pushed the fix/stlink-calloc branch from 6bd5697 to f81202a Compare December 28, 2024 18:45
With the update to GCC 14, stlink v1.8.0 is broken, as GCC 14 enforces
the correct argument order of calloc. This commit adds a little patch to
resolve that issue for now. This patch should be removed and stlink
updated to v1.8.1 as soon as that version gets released.
@jpteb jpteb force-pushed the fix/stlink-calloc branch from f81202a to 4619390 Compare December 28, 2024 19:02
@jpteb
Copy link
Contributor Author

jpteb commented Dec 28, 2024

What do you think of this solution? It uses their commit and just pulls the file containing the swapped calloc arguments.

I think I like this solution the best.
This is my first time using fetchpatch, I didn't know it could do that.

Copy link
Contributor

@bjornfor bjornfor left a comment

Choose a reason for hiding this comment

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

Perfect, thanks!

@bjornfor bjornfor merged commit 98afe02 into NixOS:master Dec 28, 2024
23 of 24 checks passed
@jpteb jpteb deleted the fix/stlink-calloc branch December 28, 2024 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin 10.rebuild-linux: 1-10
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants