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

Makefile: Allow external Makefile.build and Provide GO 1.18 support #1005

Closed

Conversation

eduardvintila
Copy link
Member

@eduardvintila eduardvintila commented Jul 26, 2023

Prerequisite checklist

  • Read the contribution guidelines regarding submitting new changes to the project;
  • Tested your changes against relevant architectures and platforms;
  • Ran the checkpatch.uk on your commit series before opening this PR;
  • Updated relevant documentation.

Base target

  • Architecture(s): [e.g. x86_64 or N/A]
  • Platform(s): [e.g. kvm, xen or N/A]
  • Application(s): [e.g. app-python3 or N/A]

Additional configuration

Description of changes

This PR is part of a series of PRs that work in conjunction for the update of Go support to 1.18:

For testing, make sure to pass to QEMU the -cpu host argument (this is necessary because the paging API and ukvmem are required by libgo as part of Virtual Address space management, and somehow the default CPU just won't handle 1GB pages).

Only GCC12 and x86 is supported for the moment.

@eduardvintila eduardvintila requested review from a team as code owners July 26, 2023 12:43
@unikraft-bot unikraft-bot added area/lib Internal Unikraft Microlibrary area/makefile Part of the Unikraft Makefile build system lib/ukmmap labels Jul 26, 2023
@razvand razvand requested review from StefanJum and removed request for a team and dragosargint August 2, 2023 12:09
@razvand razvand assigned razvand and unassigned nderjung Aug 2, 2023
@razvand razvand added this to the v0.14.0 (Prometheus) milestone Aug 2, 2023
Copy link
Member

@StefanJum StefanJum left a comment

Choose a reason for hiding this comment

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

This looks fine. Besides the one comment, please rebase this on staging so the ci/cd tests can run.

@@ -2,7 +2,6 @@ menuconfig LIBPOSIX_MMAP
bool "posix-mmap: Memory mapping related functions"
default n
depends on LIBUKVMEM
depends on !LIBUKMMAP
Copy link
Member

Choose a reason for hiding this comment

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

Why change this to be the other way around? (have ukmmap depend on !LIBPOSIX_MMAP instead of posix-mmap depend on !LIBUKMMAP)?

Copy link
Member Author

Choose a reason for hiding this comment

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

@StefanJum, the reason is that most of the external libraries don't have mentions of LIBPOSIX_MMAP, but rather LIBUKMMAP.

For example, without this commit, if you first select compiler-rt in the menuconfig, ukmmap gets selected because the library's Config.uk file includes the statement imply UKMMAP. If you afterwards select libgo, which has the select LIBPOSIX_MMAP requirement, it would indeed select posix-mmap, but for some reason it also keeps ukmmap selected as well, which leads to a double definition conflict.

The dependency switch that I've introduced prevents that from happening, but I do not have a perfect explanation for this behavior, unfortunately.

Copy link
Member

Choose a reason for hiding this comment

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

Hum... one additional thing to do in order to avoid the problem is by patching compiler_rt with
imply LIB_UKMMAP if !LIBPOSIX_MMAP.
Additionally, we probably should add a warning or error with support/scripts/configupdate as soon as ukmmap and posix_mmap are both. I think this would be a reasonable workaround as long as ukmmap exists. Longer term the plan was to migrate the left functionality from ukmmap to posix-mmap anyways.

Overall, I will approve this PR and will open an issue for updating the configupdate script.

marcrittinghaus and others added 3 commits August 6, 2023 12:24
The current method of building libraries is to iterate over
each library's source files and invoke a file type specific
build rule. For libgo this is insufficient as we have to do
more complex operations for dependency resolution
before starting the actual build. This commit allows libraries
to supply an own `Makefile.build` that enables custom
build mechanics.

Co-authored-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Signed-off-by: Eduard Vintilă <eduard.vintila47@gmail.com>
The current Makefile refers to gccgo via gccgo-7. This commit removes
the version suffix.

Co-authored-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Signed-off-by: Eduard Vintilă <eduard.vintila47@gmail.com>
This ensures that both libraries cannot be selected at the same time.

Signed-off-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Copy link
Member

@StefanJum StefanJum left a comment

Choose a reason for hiding this comment

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

All good, thanks.

Reviewed-by: Stefan Jumarea stefanjumarea02@gmail.com

@razvand razvand requested a review from skuenzer August 6, 2023 18:56
Copy link
Contributor

@RaduNichita RaduNichita left a comment

Choose a reason for hiding this comment

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

All good from my side. Tested with gcc12 on x86_64 and it works.

Reviewed-by: Radu Nichita radunichita99@gmail.com

@unikraft-bot
Copy link
Member

Checkpatch passed

Beep boop! I ran Unikraft's checkpatch.pl support script on your pull request and it all looks good!

SHA commit checkpatch
84ecf07 Makefile: Allow external Makefile.build
67bb21e Makefile: Change gccgo-7 to gccgo
379a9f3 lib/ukmmap|posix-mmap/Config.uk: Change ukmmap - posix-mmap dependency

Copy link
Contributor

@razvand razvand left a comment

Choose a reason for hiding this comment

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

Approved-by: Razvan Deaconescu razvand@unikraft.io

unikraft-bot pushed a commit that referenced this pull request Aug 7, 2023
The current Makefile refers to gccgo via gccgo-7. This commit removes
the version suffix.

Co-authored-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Signed-off-by: Marc Rittinghaus <marc.rittinghaus@unikraft.io>
Signed-off-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1005
unikraft-bot pushed a commit that referenced this pull request Aug 7, 2023
This ensures that both libraries cannot be selected at the same time.

Signed-off-by: Eduard Vintilă <eduard.vintila47@gmail.com>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Reviewed-by: Radu Nichita <radunichita99@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1005
@unikraft-bot unikraft-bot added the ci/merged Merged by CI label Aug 7, 2023
skuenzer added a commit to skuenzer/unikraft that referenced this pull request Aug 8, 2023
This commit ensures that the inclusion of sub-'Makefile.build' is done with
the main Makefile. This is done for consistency reasons.
This basically adopts
 commit db20b80 ("Makefile: Allow external Makefile.build")
from GitHub PR unikraft#1005.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
unikraft-bot pushed a commit that referenced this pull request Aug 10, 2023
This commit ensures that the inclusion of sub-'Makefile.build' is done with
the main Makefile. This is done for consistency reasons.
This basically adopts
 commit db20b80 ("Makefile: Allow external Makefile.build")
from GitHub PR #1005.

Signed-off-by: Simon Kuenzer <simon@unikraft.io>
Reviewed-by: Stefan Jumarea <stefanjumarea02@gmail.com>
Approved-by: Razvan Deaconescu <razvand@unikraft.io>
Tested-by: Unikraft CI <monkey@unikraft.io>
GitHub-Closes: #1028
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/lib Internal Unikraft Microlibrary area/makefile Part of the Unikraft Makefile build system ci/merged Merged by CI lib/ukmmap
Projects
Status: Done!
Development

Successfully merging this pull request may close these issues.

None yet

8 participants