Skip to content

Commit 6fc2ce1

Browse files
committed
WIP
1 parent 2538a35 commit 6fc2ce1

File tree

9 files changed

+455
-53
lines changed

9 files changed

+455
-53
lines changed

.github/workflows/abi-check.yml

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
name: "Check for ABI differences vs. glibc"
2+
3+
on:
4+
pull_request:
5+
merge_group:
6+
7+
jobs:
8+
run-abicheck:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
arch: [x86_64, riscv64, aarch64, x86, m68k, loongarch64]
13+
name: Compare ABIs
14+
runs-on: ubuntu-latest
15+
container: debian:trixie
16+
defaults:
17+
run:
18+
shell: bash
19+
steps:
20+
- name: Install prerequisites
21+
run: |
22+
arch="${{matrix.arch}}"
23+
case "$arch" in
24+
x86)
25+
arch="i386"
26+
;;
27+
x86_64)
28+
arch="amd64"
29+
;;
30+
aarch64)
31+
arch="arm64"
32+
;;
33+
loongarch64)
34+
arch="loong64"
35+
;;
36+
esac
37+
dpkg --add-architecture $arch
38+
apt-get update
39+
apt-get install -y meson ninja-build qemu-user \
40+
python3-setuptools python3-jsonschema \
41+
python3-pip python3-clang \
42+
git wget file rsync clang
43+
case "${{matrix.arch}}" in \
44+
x86) \
45+
apt-get install -y gcc-i686-linux-gnu g++-i686-linux-gnu;; \
46+
x86_64) \
47+
apt-get install -y gcc g++;; \
48+
*) \
49+
apt-get install -y gcc-${{matrix.arch}}-linux-gnu g++-${{matrix.arch}}-linux-gnu;; \
50+
esac
51+
pip install --break-system-packages -U xbstrap pyexpect
52+
53+
- name: Prepare directories
54+
run: |
55+
mkdir src/
56+
mkdir src/mlibc/
57+
mkdir build/
58+
59+
- name: Checkout branch
60+
uses: actions/checkout@v2
61+
with:
62+
path: src/mlibc
63+
submodules: true
64+
65+
- name: Get libgcc-binaries
66+
run: |
67+
set -e
68+
case "${{matrix.arch}}" in \
69+
x86) \
70+
wget -O /tmp/libgcc-${{matrix.arch}}.a https://github.com/osdev0/libgcc-binaries/releases/latest/download/libgcc-i686.a;; \
71+
*) \
72+
wget -O /tmp/libgcc-${{matrix.arch}}.a https://github.com/osdev0/libgcc-binaries/releases/latest/download/libgcc-${{matrix.arch}}.a;; \
73+
esac
74+
75+
- name: Prepare src/
76+
run: |
77+
cp mlibc/ci/bootstrap.yml .
78+
touch mlibc/checkedout.xbstrap
79+
working-directory: src/
80+
81+
- name: Prepare build/
82+
run: |
83+
cat > bootstrap-site.yml << EOF
84+
define_options:
85+
arch: ${{matrix.arch}}
86+
EOF
87+
xbstrap init ../src
88+
working-directory: build/
89+
90+
- name: Build mlibc
91+
run: |
92+
set -e
93+
xbstrap install mlibc-static mlibc-headers-only
94+
working-directory: build/
95+
96+
- name: Download glibc
97+
run: |
98+
set -e
99+
arch="${{matrix.arch}}"
100+
case "$arch" in
101+
x86)
102+
arch="i386"
103+
;;
104+
x86_64)
105+
arch="amd64"
106+
;;
107+
aarch64)
108+
arch="arm64"
109+
;;
110+
loongarch64)
111+
arch="loong64"
112+
;;
113+
esac
114+
apt-get download libc6-dev-$arch-cross
115+
dpkg-deb -x libc6-dev-*.deb ./glibc
116+
working-directory: build/
117+
118+
- name: Run checks
119+
run: |
120+
arch="${{matrix.arch}}"
121+
triple="$arch-linux-gnu"
122+
case "$arch" in
123+
x86)
124+
arch="i386"
125+
triple="i686-linux-gnu"
126+
;;
127+
esac
128+
extra_args="--ld-library-path /usr/$triple/"
129+
echo "Comparing ABI of mlibc against glibc for ${{matrix.arch}}" >> $GITHUB_STEP_SUMMARY
130+
echo '```diff' >> $GITHUB_STEP_SUMMARY
131+
python3 ../src/mlibc/scripts/header-abi-compare.py \
132+
--config ../src/mlibc/scripts/header-abi-compare-config.yml \
133+
--arch "$arch" \
134+
$extra_args \
135+
./glibc/usr/*-linux-gnu/include/ \
136+
./packages/mlibc-headers-only/usr/include/ \
137+
-Mmfs >> $GITHUB_STEP_SUMMARY 2>&1
138+
echo '```' >> $GITHUB_STEP_SUMMARY
139+
working-directory: build/

abis/linux/fcntl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#define O_RSYNC 04010000
2828
#define O_LARGEFILE 0100000
2929
#define O_NOATIME 01000000
30-
#define O_TMPFILE 020000000
30+
#define O_TMPFILE 020200000
3131

3232
#define O_EXEC O_PATH
3333
#define O_SEARCH O_PATH

options/elf/include/elf.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,7 +608,7 @@ typedef struct {
608608
#define SHN_LORESERVE 0xff00
609609
#define SHN_COMMON 0xfff2
610610
#define SHN_XINDEX 0xffff
611-
#define SHN_HIRESERVE 0xff00
611+
#define SHN_HIRESERVE 0xffff
612612

613613
/* values for e_machine */
614614
#define EM_NONE 0

options/glibc/include/net/ethernet.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ struct ether_header {
3333
uint8_t ether_dhost[6];
3434
uint8_t ether_shost[6];
3535
uint16_t ether_type;
36-
};
36+
} __attribute__((packed));
3737

3838
#define ETHER_ADDR_LEN 6
3939

options/internal/riscv64-include/sys/hwprobe.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ extern "C" {
1010
#include <bits/size_t.h>
1111

1212
int __riscv_hwprobe(struct riscv_hwprobe *pairs, size_t pair_count, size_t cpusetsize, cpu_set_t *cpus,
13-
unsigned int flags) __attribute__((access(read_write, 1, 2)));
13+
unsigned int flags);
1414

1515
typedef int (*__riscv_hwprobe_t)(struct riscv_hwprobe *pairs, size_t pair_count,
16-
size_t cpusetsize, cpu_set_t *cpus, unsigned int flags) __attribute__((access(read_write, 1, 2)));
16+
size_t cpusetsize, cpu_set_t *cpus, unsigned int flags);
1717

1818
#ifdef __cplusplus
1919
}

options/posix/include/sys/resource.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
#include <bits/posix/id_t.h>
1010
#include <bits/posix/timeval.h>
1111

12-
#define PRIO_PROCESS 1
13-
#define PRIO_PGRP 2
14-
#define PRIO_USER 3
12+
#define PRIO_PROCESS 0
13+
#define PRIO_PGRP 1
14+
#define PRIO_USER 2
1515

1616
#define PRIO_MIN (-20)
1717
#define PRIO_MAX 20

0 commit comments

Comments
 (0)