Merge pull request #5904 from laytan/ubuntu-arm-ci

Ubuntu arm ci and posix fixes
This commit is contained in:
Laytan
2025-11-08 22:02:07 +01:00
committed by GitHub
10 changed files with 59 additions and 25 deletions

View File

@@ -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

View File

@@ -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,
}

View File

@@ -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 {

View File

@@ -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));

View File

@@ -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))

View File

@@ -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
}
}

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"

View File

@@ -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"