aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaytan <laytanlaats@hotmail.com>2025-11-08 22:02:07 +0100
committerGitHub <noreply@github.com>2025-11-08 22:02:07 +0100
commitb4d193b365bca8bb12f4c2670704902bd37147a2 (patch)
tree2c8b037a7db0cc9a8f55921d1c04fa2f9dbeb13c
parent58a66c3017f03d8b937a2fd56b39b014228d3b90 (diff)
parent7aeed8b205fd3c8f5a0e3014beccaff8a50bb6d2 (diff)
Merge pull request #5904 from laytan/ubuntu-arm-ci
Ubuntu arm ci and posix fixes
-rw-r--r--.github/workflows/ci.yml10
-rw-r--r--core/sys/posix/pthread.odin10
-rw-r--r--core/sys/posix/sys_sem.odin34
-rw-r--r--tests/core/sys/posix/structs/structs.c5
-rw-r--r--tests/core/sys/posix/structs/structs.odin5
-rw-r--r--tests/internal/test_pow.odin4
-rw-r--r--vendor/lua/5.1/lua.odin4
-rw-r--r--vendor/lua/5.2/lua.odin4
-rw-r--r--vendor/lua/5.3/lua.odin4
-rw-r--r--vendor/lua/5.4/lua.odin4
10 files changed, 59 insertions, 25 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 696affc44..f32320042 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -74,9 +74,9 @@ jobs:
strategy:
fail-fast: false
matrix:
- os: [macos-15-intel, macos-latest, ubuntu-latest]
+ os: [macos-15-intel, macos-latest, ubuntu-latest, ubuntu-24.04-arm]
runs-on: ${{ matrix.os }}
- name: ${{ matrix.os == 'macos-latest' && 'MacOS ARM' || (matrix.os == 'macos-15-intel' && 'MacOS Intel') || (matrix.os == 'ubuntu-latest' && 'Ubuntu') }} Build, Check, and Test
+ name: ${{ matrix.os == 'macos-latest' && 'MacOS ARM' || (matrix.os == 'macos-15-intel' && 'MacOS Intel') || (matrix.os == 'ubuntu-latest' && 'Ubuntu') || (matrix.os == 'ubuntu-24.04-arm' && 'Ubuntu ARM') }} Build, Check, and Test
timeout-minutes: 15
steps:
@@ -97,19 +97,21 @@ jobs:
echo "$(brew --prefix llvm@20)/bin" >> $GITHUB_PATH
- name: Download LLVM (Ubuntu)
- if: matrix.os == 'ubuntu-latest'
+ if: matrix.os == 'ubuntu-latest' || matrix.os == 'ubuntu-24.04-arm'
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 20
echo "/usr/lib/llvm-20/bin" >> $GITHUB_PATH
-
- name: Build Odin
run: ./build_odin.sh release
- name: Odin version
run: ./odin version
- name: Odin report
run: ./odin report
+ - name: Get needed vendor libs
+ if: matrix.os == 'ubuntu-24.04-arm'
+ run: sudo apt-get install -y liblua5.4-dev
- name: Compile needed Vendor
run: |
make -C vendor/stb/src
diff --git a/core/sys/posix/pthread.odin b/core/sys/posix/pthread.odin
index 733725e2c..e480b761c 100644
--- a/core/sys/posix/pthread.odin
+++ b/core/sys/posix/pthread.odin
@@ -632,8 +632,16 @@ when ODIN_OS == .Darwin {
pthread_t :: distinct c.ulong
+ when ODIN_ARCH == .arm64 {
+ @(private)
+ __SIZEOF_PTHREAD_ATTR_T :: 64
+ } else {
+ @(private)
+ __SIZEOF_PTHREAD_ATTR_T :: 56
+ }
+
pthread_attr_t :: struct #raw_union {
- __size: [56]c.char, // NOTE: may be smaller depending on libc or arch, but never larger.
+ __size: [__SIZEOF_PTHREAD_ATTR_T]c.char,
__align: c.long,
}
diff --git a/core/sys/posix/sys_sem.odin b/core/sys/posix/sys_sem.odin
index e876cf74a..012c0bbdb 100644
--- a/core/sys/posix/sys_sem.odin
+++ b/core/sys/posix/sys_sem.odin
@@ -18,7 +18,7 @@ foreign lib {
[[ More; https://pubs.opengroup.org/onlinepubs/9699919799/functions/semctl.html ]]
*/
@(link_name=LSEMCTL)
- semctl :: proc(semid: FD, semnum: c.int, cmd: Sem_Cmd, arg: ^semun = nil) -> c.int ---
+ semctl :: proc(semid: FD, semnum: c.int, cmd: Sem_Cmd, #c_vararg args: ..semun) -> c.int ---
/*
Returns the semaphore identifier associated with key.
@@ -39,6 +39,9 @@ foreign lib {
}
Sem_Cmd :: enum c.int {
+ RMID = IPC_RMID,
+ SET = IPC_SET,
+ STAT = IPC_STAT,
// Returns the value of semncnt.
GETNCNT = GETNCNT,
// Returns the value of sempid.
@@ -137,15 +140,26 @@ when ODIN_OS == .Darwin || ODIN_OS == .FreeBSD || ODIN_OS == .NetBSD || ODIN_OS
SETVAL :: 16
SETALL :: 17
- semid_ds :: struct {
- sem_perm: ipc_perm, // [PSX] operation permission structure
- sem_otime: time_t, // [PSX] last semop()
- __sem_otime_high: c.ulong,
- sem_ctime: time_t, // [PSX] last time changed by semctl()
- __sem_ctime_high: c.ulong,
- sem_nsems: c.ulong, // [PSX] number of semaphores in set
- __glibc_reserved3: c.ulong,
- __glibc_reserved4: c.ulong,
+ when ODIN_ARCH == .arm64 {
+ semid_ds :: struct {
+ sem_perm: ipc_perm, // [PSX] operation permission structure
+ sem_otime: time_t, // [PSX] last semop()
+ sem_ctime: time_t, // [PSX] last time changed by semctl()
+ sem_nsems: c.ulong, // [PSX] number of semaphores in set
+ __glibc_reserved3: c.ulong,
+ __glibc_reserved4: c.ulong,
+ }
+ } else {
+ semid_ds :: struct {
+ sem_perm: ipc_perm, // [PSX] operation permission structure
+ sem_otime: time_t, // [PSX] last semop()
+ __sem_otime_high: c.ulong,
+ sem_ctime: time_t, // [PSX] last time changed by semctl()
+ __sem_ctime_high: c.ulong,
+ sem_nsems: c.ulong, // [PSX] number of semaphores in set
+ __glibc_reserved3: c.ulong,
+ __glibc_reserved4: c.ulong,
+ }
}
sembuf :: struct {
diff --git a/tests/core/sys/posix/structs/structs.c b/tests/core/sys/posix/structs/structs.c
index 995c1a8c0..ac771057e 100644
--- a/tests/core/sys/posix/structs/structs.c
+++ b/tests/core/sys/posix/structs/structs.c
@@ -102,6 +102,11 @@ int main(int argc, char *argv[])
printf("iovec %zu %zu\n", sizeof(struct iovec), _Alignof(struct iovec));
printf("semid_ds %zu %zu\n", sizeof(struct semid_ds), _Alignof(struct semid_ds));
+ printf("semid_ds.sem_perm %zu\n", offsetof(struct semid_ds, sem_perm));
+ printf("semid_ds.sem_otime %zu\n", offsetof(struct semid_ds, sem_otime));
+ printf("semid_ds.sem_ctime %zu\n", offsetof(struct semid_ds, sem_ctime));
+ printf("semid_ds.sem_nsems %zu\n", offsetof(struct semid_ds, sem_nsems));
+
printf("sembuf %zu %zu\n", sizeof(struct sembuf), _Alignof(struct sembuf));
printf("itimerval %zu %zu\n", sizeof(struct itimerval), _Alignof(struct itimerval));
diff --git a/tests/core/sys/posix/structs/structs.odin b/tests/core/sys/posix/structs/structs.odin
index f2bead5ba..55369e386 100644
--- a/tests/core/sys/posix/structs/structs.odin
+++ b/tests/core/sys/posix/structs/structs.odin
@@ -68,6 +68,11 @@ main :: proc() {
fmt.println("iovec", size_of(posix.iovec), align_of(posix.iovec))
fmt.println("semid_ds", size_of(posix.semid_ds), align_of(posix.semid_ds))
+ fmt.println("semid_ds.sem_perm", offset_of(posix.semid_ds, sem_perm))
+ fmt.println("semid_ds.sem_otime", offset_of(posix.semid_ds, sem_otime))
+ fmt.println("semid_ds.sem_ctime", offset_of(posix.semid_ds, sem_ctime))
+ fmt.println("semid_ds.sem_nsems", offset_of(posix.semid_ds, sem_nsems))
+
fmt.println("sembuf", size_of(posix.sembuf), align_of(posix.sembuf))
fmt.println("itimerval", size_of(posix.itimerval), align_of(posix.itimerval))
diff --git a/tests/internal/test_pow.odin b/tests/internal/test_pow.odin
index d1939ace5..db1f33ffd 100644
--- a/tests/internal/test_pow.odin
+++ b/tests/internal/test_pow.odin
@@ -33,9 +33,9 @@ pow_test :: proc(t: ^testing.T) {
_v2 := transmute(u16)v2
_v1 := transmute(u16)v1
- when ODIN_OS == .Darwin && ODIN_ARCH == .arm64 {
+ when ODIN_ARCH == .arm64 {
if exp == -25 {
- log.info("skipping known test failure on darwin+arm64, Expected math.pow2_f16(-25) == math.pow(2, -25) (= 0000), got 0001")
+ log.info("skipping known test failure on arm64, Expected math.pow2_f16(-25) == math.pow(2, -25) (= 0000), got 0001")
_v2 = 0
}
}
diff --git a/vendor/lua/5.1/lua.odin b/vendor/lua/5.1/lua.odin
index 19a2d9085..f955e0dd3 100644
--- a/vendor/lua/5.1/lua.odin
+++ b/vendor/lua/5.1/lua.odin
@@ -14,7 +14,7 @@ when LUA_SHARED {
when ODIN_OS == .Windows {
// Does nothing special on windows
foreign import lib "windows/lua5.1.dll.lib"
- } else when ODIN_OS == .Linux {
+ } else when ODIN_OS == .Linux && ODIN_ARCH == .amd64 {
foreign import lib "linux/liblua5.1.so"
} else {
foreign import lib "system:lua5.1"
@@ -22,7 +22,7 @@ when LUA_SHARED {
} else {
when ODIN_OS == .Windows {
foreign import lib "windows/lua5.1.dll.lib"
- } else when ODIN_OS == .Linux {
+ } else when ODIN_OS == .Linux && ODIN_ARCH == .amd64 {
foreign import lib "linux/liblua5.1.a"
} else {
foreign import lib "system:lua5.1"
diff --git a/vendor/lua/5.2/lua.odin b/vendor/lua/5.2/lua.odin
index 95105703c..98d13cf69 100644
--- a/vendor/lua/5.2/lua.odin
+++ b/vendor/lua/5.2/lua.odin
@@ -14,7 +14,7 @@ when LUA_SHARED {
when ODIN_OS == .Windows {
// Does nothing special on windows
foreign import lib "windows/lua52dll.lib"
- } else when ODIN_OS == .Linux {
+ } else when ODIN_OS == .Linux && ODIN_ARCH == .amd64 {
foreign import lib "linux/liblua52.so"
} else {
foreign import lib "system:lua5.2"
@@ -22,7 +22,7 @@ when LUA_SHARED {
} else {
when ODIN_OS == .Windows {
foreign import lib "windows/lua52dll.lib"
- } else when ODIN_OS == .Linux {
+ } else when ODIN_OS == .Linux && ODIN_ARCH == .amd64 {
foreign import lib "linux/liblua52.a"
} else {
foreign import lib "system:lua5.2"
diff --git a/vendor/lua/5.3/lua.odin b/vendor/lua/5.3/lua.odin
index 02b1c83ad..2c0dc1fbf 100644
--- a/vendor/lua/5.3/lua.odin
+++ b/vendor/lua/5.3/lua.odin
@@ -14,7 +14,7 @@ when LUA_SHARED {
when ODIN_OS == .Windows {
// Does nothing special on windows
foreign import lib "windows/lua53dll.lib"
- } else when ODIN_OS == .Linux {
+ } else when ODIN_OS == .Linux && ODIN_ARCH == .amd64 {
foreign import lib "linux/liblua53.so"
} else {
foreign import lib "system:lua5.3"
@@ -22,7 +22,7 @@ when LUA_SHARED {
} else {
when ODIN_OS == .Windows {
foreign import lib "windows/lua53dll.lib"
- } else when ODIN_OS == .Linux {
+ } else when ODIN_OS == .Linux && ODIN_ARCH == .amd64 {
foreign import lib "linux/liblua53.a"
} else {
foreign import lib "system:lua5.3"
diff --git a/vendor/lua/5.4/lua.odin b/vendor/lua/5.4/lua.odin
index 1bda09542..3ffa68714 100644
--- a/vendor/lua/5.4/lua.odin
+++ b/vendor/lua/5.4/lua.odin
@@ -14,7 +14,7 @@ when LUA_SHARED {
when ODIN_OS == .Windows {
// LUA_SHARED does nothing special on windows
foreign import lib "windows/lua54dll.lib"
- } else when ODIN_OS == .Linux {
+ } else when ODIN_OS == .Linux && ODIN_ARCH == .amd64 {
foreign import lib "linux/liblua54.so"
} else {
foreign import lib "system:lua5.4"
@@ -22,7 +22,7 @@ when LUA_SHARED {
} else {
when ODIN_OS == .Windows {
foreign import lib "windows/lua54dll.lib"
- } else when ODIN_OS == .Linux {
+ } else when ODIN_OS == .Linux && ODIN_ARCH == .amd64 {
foreign import lib "linux/liblua54.a"
} else {
foreign import lib "system:lua5.4"