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

Introduce 10.13 xnu #273016

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Introduce 10.13 xnu #273016

wants to merge 12 commits into from

Conversation

toonn
Copy link
Contributor

@toonn toonn commented Dec 8, 2023

Description of changes

By introducing the new XNU without disturbing the old version, we avoid causing a stdenv rebuild. We can still depend on this new XNU in a new bootstrap-tools and further source releases.

I'm doing this in the hope it'll enable smaller reviewable changes rather than needing to understand everything all at once.

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/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 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.

@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 0 This PR does not cause any packages to rebuild labels Dec 9, 2023
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label May 22, 2024
@toonn toonn marked this pull request as ready for review June 3, 2024 15:00
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Jun 3, 2024
--replace-fail "-Werror " ""

substituteInPlace SETUP/kextsymboltool/Makefile \
--replace-fail "-lstdc++" "-lc++ -lc++abi"
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: -lc++abi is not needed.

Suggested change
--replace-fail "-lstdc++" "-lc++ -lc++abi"
--replace-fail "-lstdc++" "-lc++"

tho i think that clang changes -lstdc++ to -lc++ too so the entire substituteInPlace might be unneeded as well as long as the link step is initiated by clang and not ld

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It still builds without the substitute but I can't find documentation on this. Do you know where to find some?

Copy link
Contributor

Choose a reason for hiding this comment

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

i don't i just stumbled on it. it seems like it is related to the flag -stdlib=xxx. when -stdlib=libstdc++ no translation is made. -stdlib=libc++ then -lstdc++ -> -lc++. and perhaps the default is -stdlib=platform and for darwin seems to be libc++.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did some spelunking on this because it doesn't seem to be documented anywhere.

The -lstdc++ flag gets rewritten to OPT_Z_reserved_lib_stdcxx.
The reserved lib option is handled and depending on the -stdlib option it can be rewritten as -lc++.

toonn added 4 commits June 5, 2024 14:07
The `applePackageMapping` function will allow us to keep expressions for
the newer releases separate from the originals where necessary, without
needing to change `generate-sdk-packages.sh`. If we ever want to support
multiple versions of source releases simultaneously we should consider
changing that to point to versioned subdirectories of all the packages.

Many of the source releases introduced here will need changes to the
expression to build successfully. These will be introduced one by one.
Releases with dependencies on other releases, e.g., libresolv depends on
Libinfo, mDNSResponder and configdHeaders, were getting those releases
from pkgs.darwin rather than pkgs.darwin."10.13.6". By making the scope
of callPackage overridable we can manipulate which packages are used to
supply dependencies.
Some of the source releases build without changes to their expressions,
others require changes or the passing in of exceptional arguments. To
avoid evaluation of the entire "10.13.6" subset causing evaluation
errors we can include just the functional source releases.
By introducing the new XNU without disturbing the old version, we avoid
causing a stdenv rebuild. We can still depend on this new XNU in a new
bootstrap-tools and further source releases.

I'm doing this in the hope it'll enable smaller reviewable changes
rather than needing to understand everything all at once.
Copy link
Contributor

@paparodeo paparodeo left a comment

Choose a reason for hiding this comment

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

LGTM tho i don't have any domain knowledge here. seems to mostly parallel default.nix

toonn and others added 8 commits June 19, 2024 13:55
We need to raise the `HOST_OS_VERSION` to at least `10.12` according to
an `ld` warning. Since we're bumping anyway I don't see a good reason
not to bump these all the way to the source releases we'll be packaging.
These are the versions from `AvailabilityVersions/availability.pl` for
macOS 10.13.6. The only reason we create the shell script is to avoid a
dependency on Perl in the bootstrap.

We should consider packaging AvailabilityVersions so the script becomes
something that consumes `availability.pl`, that way we don't need to
keep the versions synchronized manually.
The `bridgeos(x)` platform function isn't defined in Apple's XNU but it
is used in Security, so we implement it here.
Co-authored-by: paparodeo <170618376+paparodeo@users.noreply.github.com>
@paparodeo paparodeo mentioned this pull request Jun 22, 2024
13 tasks
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Nov 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
2.status: merge conflict This PR has merge conflicts with the target branch 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild 10.rebuild-linux: 0 This PR does not cause any packages to rebuild
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants