Skip to content
This repository was archived by the owner on Sep 20, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions torvalds/linux/linux_cmp.gox
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import "strings"

func linuxVersion(version string) string {
// GNU's '~' sorts before the end of a version: v7.2~rc7 < v7.2.
version = strings.ReplaceAll(version, "-rc", "~rc")
// Keep v5.12-rc1-dontuse below the normal v5.12-rc1 tag.
return strings.ReplaceAll(version, "-dontuse", "~dontuse")
}

compareVer (a, b) => {
return gnu.compare(linuxVersion(a.Version), linuxVersion(b.Version))
}
42 changes: 42 additions & 0 deletions torvalds/linux/v5.7/linuxHeaders_llar.gox
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import (
"os"
"path/filepath"
)

id "torvalds/linux"

// Linux 5.7 introduced LLVM=1 for both target tools and host Clang.
fromVer "v5.7"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] Define Linux release-aware tag ordering

Without a _cmp.gox, LLAR uses GNU version comparison, which orders a final tag before its RC suffix (for example, v7.2 < v7.2-rc7). As a result, whenever the newest release has no next-cycle RC yet, an unversioned torvalds/linux request resolves to the release candidate instead of the final release. Add a Linux-aware comparator that treats -rcN as a prerelease of the matching final version while still handling the repository's complete historical tag set.


filter => {
return target.require["os"][0] == "linux" &&
(target.require["arch"][0] == "amd64" || target.require["arch"][0] == "arm64")
}

onBuild ctx => {
arch := "x86"
if target.require["arch"][0] == "arm64" {
arch = "arm64"
}
a := autotools.new(ctx.SourceDir, ctx.SourceDir, ctx.outputDir)
a.build "headers_install", "ARCH="+arch, "LLVM=1", "INSTALL_HDR_PATH="+ctx.outputDir+"/usr"
}

onTest ctx => {
triple := "x86_64-linux-gnu"
readNumber := "0"
if target.require["arch"][0] == "arm64" {
triple = "aarch64-linux-gnu"
readNumber = "63"
}
source := filepath.join(ctx.SourceDir, "headers-consumer.c")
os.writeFile! source, []byte(`#include <asm/unistd.h>
#include <linux/futex.h>
#include <linux/netlink.h>
_Static_assert(__NR_read == EXPECT_NR_READ, "wrong architecture headers");
_Static_assert(sizeof(struct nlmsghdr) == 16, "invalid netlink ABI");
_Static_assert(sizeof(__u64) == 8, "invalid UAPI integer size");
`), 0o644
clang! "--target="+triple, "-fsyntax-only", "-nostdinc",
"-I"+filepath.join(ctx.outputDir, "usr", "include"), "-DEXPECT_NR_READ="+readNumber, source
}
4 changes: 4 additions & 0 deletions torvalds/linux/versions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"path": "torvalds/linux",
"deps": {}
}
Loading