Skip to content

Commit 339d7a7

Browse files
committed
feat: migrate to 24.04 to match x86. add missing profile to client.pom for arm64
1 parent 6daba52 commit 339d7a7

File tree

6 files changed

+97
-20
lines changed

6 files changed

+97
-20
lines changed

.github/workflows/early-access.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
fail-fast: false
6464
matrix:
6565
# binaries wanted: linux amd64, mac M1, mac intel, windows x86
66-
os: [ ubuntu-24.04, ubuntu-22.04-arm, macos-15, macos-15-intel, windows-2025 ]
66+
os: [ ubuntu-24.04, ubuntu-24.04-arm, macos-15, macos-15-intel, windows-2025 ]
6767
runs-on: ${{ matrix.os }}
6868

6969
steps:
@@ -123,26 +123,26 @@ jobs:
123123
ld -r /lib/x86_64-linux-gnu/Scrt1.o client/target/dynamic-libc-start.o -o client/target/graalvm-libs-for-glibc-2.12/Scrt1.o
124124
objcopy --redefine-syms=client/src/main/resources/glibc/glibc.redef client/target/graalvm-libs-for-glibc-2.12/Scrt1.o 2>/dev/null
125125
126-
- name: 'Patch ARM64 GraalVM libs for only requiring glibc 2.28'
126+
- name: 'Patch ARM64 GraalVM libs for only requiring glibc 2.17'
127127
if: ${{ env.OS == 'linux' && env.ARCH == 'aarch64' }}
128128
shell: bash
129129
run: |
130-
mkdir -p client/target/graalvm-libs-for-glibc-2.28
130+
mkdir -p client/target/graalvm-libs-for-glibc-2.17
131131
132132
: patch common libraries
133133
( find "$GRAALVM_HOME/lib/static/linux-aarch64/glibc" -name '*.a'
134134
ls -1 /lib/aarch64-linux-gnu/libz.a
135135
ls -1 "$GRAALVM_HOME/lib/svm/clibraries/linux-aarch64/libjvm.a"
136136
ls -1 "$GRAALVM_HOME/lib/svm/clibraries/linux-aarch64/liblibchelper.a"
137137
) | while IFS= read -r input; do
138-
output="client/target/graalvm-libs-for-glibc-2.28/$(basename -- "$input")"
139-
objcopy --redefine-syms=client/src/main/resources/glibc/glibc.redef -- "$input" "$output" 2>/dev/null
138+
output="client/target/graalvm-libs-for-glibc-2.17/$(basename -- "$input")"
139+
objcopy --redefine-syms=client/src/main/resources/glibc/glibc.redef.aarch64 -- "$input" "$output" 2>/dev/null
140140
done
141141
142142
: patch gcc startfile
143143
gcc -O3 -Os -Wall -Wextra -Werror -Wconversion -Wsign-conversion -Wcast-qual -pedantic -c -o client/target/dynamic-libc-start.o client/src/main/resources/glibc/dynamic-libc-start.c
144-
ld -r /lib/aarch64-linux-gnu/Scrt1.o client/target/dynamic-libc-start.o -o client/target/graalvm-libs-for-glibc-2.28/Scrt1.o
145-
objcopy --redefine-syms=client/src/main/resources/glibc/glibc.redef client/target/graalvm-libs-for-glibc-2.28/Scrt1.o 2>/dev/null
144+
ld -r /lib/aarch64-linux-gnu/Scrt1.o client/target/dynamic-libc-start.o -o client/target/graalvm-libs-for-glibc-2.17/Scrt1.o
145+
objcopy --redefine-syms=client/src/main/resources/glibc/glibc.redef.aarch64 client/target/graalvm-libs-for-glibc-2.17/Scrt1.o 2>/dev/null
146146
147147
- name: 'Build native distribution'
148148
run: ./mvnw verify -Pnative -Dmrm=false -V -B -ntp -e -s .mvn/release-settings.xml
@@ -156,13 +156,13 @@ jobs:
156156
objdump -T client/target/mvnd | grep GLIBC_ | grep -v 'GLIBC_\([01]\|2\.[0-9]\|2\.1[012]\)[^0-9]' || err=$?
157157
(( err == 1 ))
158158
159-
- name: 'Verify ARM64 native binary for only requiring glibc 2.28'
159+
- name: 'Verify ARM64 native binary for only requiring glibc 2.17'
160160
if: ${{ env.OS == 'linux' && env.ARCH == 'aarch64' }}
161161
shell: bash
162162
run: |
163163
(( 4 == "$(ldd client/target/mvnd | awk '{print $1}' | sort -u | grep -c 'lib\(c\|dl\|rt\|pthread\)\.so\.[0-9]')" )) || ( ldd client/target/mvnd && false )
164164
err=0
165-
objdump -T client/target/mvnd | grep GLIBC_ | grep -v 'GLIBC_\([01]\|2\.[0-9]\|2\.1[0-9]\|2\.2[012345678]\)[^0-9]' || err=$?
165+
objdump -T client/target/mvnd | grep GLIBC_ | grep -v 'GLIBC_\([01]\|2\.[0-9]\|2\.1[017]\)[^0-9]' || err=$?
166166
(( err == 1 ))
167167
168168
- name: 'Upload daemon test logs'

.github/workflows/release.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
fail-fast: true
3636
matrix:
3737
# binaries wanted: linux amd64, linux arm64, mac intel, mac M1, windows x86
38-
os: [ ubuntu-24.04, ubuntu-22.04-arm, macos-15-intel, macos-15, windows-2025 ]
38+
os: [ ubuntu-24.04, ubuntu-24.04-arm, macos-15-intel, macos-15, windows-2025 ]
3939
runs-on: ${{ matrix.os }}
4040

4141
steps:
@@ -95,26 +95,26 @@ jobs:
9595
ld -r /lib/x86_64-linux-gnu/Scrt1.o client/target/dynamic-libc-start.o -o client/target/graalvm-libs-for-glibc-2.12/Scrt1.o
9696
objcopy --redefine-syms=client/src/main/resources/glibc/glibc.redef client/target/graalvm-libs-for-glibc-2.12/Scrt1.o 2>/dev/null
9797
98-
- name: 'Patch ARM64 GraalVM libs for only requiring glibc 2.28'
98+
- name: 'Patch ARM64 GraalVM libs for only requiring glibc 2.17'
9999
if: ${{ env.OS == 'linux' && env.ARCH == 'aarch64' }}
100100
shell: bash
101101
run: |
102-
mkdir -p client/target/graalvm-libs-for-glibc-2.28
102+
mkdir -p client/target/graalvm-libs-for-glibc-2.17
103103
104104
: patch common libraries
105105
( find "$GRAALVM_HOME/lib/static/linux-aarch64/glibc" -name '*.a'
106106
ls -1 /lib/aarch64-linux-gnu/libz.a
107107
ls -1 "$GRAALVM_HOME/lib/svm/clibraries/linux-aarch64/libjvm.a"
108108
ls -1 "$GRAALVM_HOME/lib/svm/clibraries/linux-aarch64/liblibchelper.a"
109109
) | while IFS= read -r input; do
110-
output="client/target/graalvm-libs-for-glibc-2.28/$(basename -- "$input")"
111-
objcopy --redefine-syms=client/src/main/resources/glibc/glibc.redef -- "$input" "$output" 2>/dev/null
110+
output="client/target/graalvm-libs-for-glibc-2.17/$(basename -- "$input")"
111+
objcopy --redefine-syms=client/src/main/resources/glibc/glibc.redef.aarch64 -- "$input" "$output" 2>/dev/null
112112
done
113113
114114
: patch gcc startfile
115115
gcc -O3 -Os -Wall -Wextra -Werror -Wconversion -Wsign-conversion -Wcast-qual -pedantic -c -o client/target/dynamic-libc-start.o client/src/main/resources/glibc/dynamic-libc-start.c
116-
ld -r /lib/aarch64-linux-gnu/Scrt1.o client/target/dynamic-libc-start.o -o client/target/graalvm-libs-for-glibc-2.28/Scrt1.o
117-
objcopy --redefine-syms=client/src/main/resources/glibc/glibc.redef client/target/graalvm-libs-for-glibc-2.28/Scrt1.o 2>/dev/null
116+
ld -r /lib/aarch64-linux-gnu/Scrt1.o client/target/dynamic-libc-start.o -o client/target/graalvm-libs-for-glibc-2.17/Scrt1.o
117+
objcopy --redefine-syms=client/src/main/resources/glibc/glibc.redef.aarch64 client/target/graalvm-libs-for-glibc-2.17/Scrt1.o 2>/dev/null
118118
119119
- name: 'Build native distribution'
120120
run: ./mvnw verify -Pnative -Dmrm=false -B -ntp -e -DskipTests -s .mvn/release-settings.xml
@@ -128,13 +128,13 @@ jobs:
128128
objdump -T client/target/mvnd | grep GLIBC_ | grep -v 'GLIBC_\([01]\|2\.[0-9]\|2\.1[012]\)[^0-9]' || err=$?
129129
(( err == 1 ))
130130
131-
- name: 'Verify ARM64 native binary for only requiring glibc 2.28'
131+
- name: 'Verify ARM64 native binary for only requiring glibc 2.17'
132132
if: ${{ env.OS == 'linux' && env.ARCH == 'aarch64' }}
133133
shell: bash
134134
run: |
135135
(( 4 == "$(ldd client/target/mvnd | awk '{print $1}' | sort -u | grep -c 'lib\(c\|dl\|rt\|pthread\)\.so\.[0-9]')" )) || ( ldd client/target/mvnd && false )
136136
err=0
137-
objdump -T client/target/mvnd | grep GLIBC_ | grep -v 'GLIBC_\([01]\|2\.[0-9]\|2\.1[0-9]\|2\.2[012345678]\)[^0-9]' || err=$?
137+
objdump -T client/target/mvnd | grep GLIBC_ | grep -v 'GLIBC_\([01]\|2\.[0-9]\|2\.2[012345678]\)[^0-9]' || err=$?
138138
(( err == 1 ))
139139
140140
- name: 'Upload artifact'

client/pom.xml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@
204204
</profile>
205205

206206
<profile>
207-
<id>linux-image-only-require-glibc-2.12</id>
207+
<id>linux-am64-image-only-require-glibc-2.12</id>
208208
<activation>
209209
<os>
210210
<family>linux</family>
@@ -233,6 +233,36 @@
233233
</build>
234234
</profile>
235235

236+
<profile>
237+
<id>linux-aarch64-image-only-require-glibc-2.17</id>
238+
<activation>
239+
<os>
240+
<family>linux</family>
241+
</os>
242+
<file>
243+
<exists>target/graalvm-libs-for-glibc-2.17</exists>
244+
</file>
245+
</activation>
246+
<properties>
247+
<patchelf.skip>false</patchelf.skip>
248+
</properties>
249+
<build>
250+
<plugins>
251+
<plugin>
252+
<groupId>org.graalvm.buildtools</groupId>
253+
<artifactId>native-maven-plugin</artifactId>
254+
<configuration>
255+
<buildArgs combine.children="append">
256+
<buildArg>-H:CCompilerPath=${basedir}/src/main/resources/glibc/gcc</buildArg>
257+
<buildArg>-H:CCompilerOption=-B${project.build.directory}/graalvm-libs-for-glibc-2.17</buildArg>
258+
<buildArg>-H:CLibraryPath=${project.build.directory}/graalvm-libs-for-glibc-2.17</buildArg>
259+
</buildArgs>
260+
</configuration>
261+
</plugin>
262+
</plugins>
263+
</build>
264+
</profile>
265+
236266
<profile>
237267
<id>native</id>
238268
<build>

client/src/main/resources/glibc/dynamic-libc-start.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,13 @@
2727
#include <dlfcn.h>
2828
#include <stdint.h>
2929

30+
#if defined(__aarch64__)
31+
__asm__(".symver dlsym,dlsym@GLIBC_2.17");
32+
__asm__(".symver dlvsym,dlvsym@GLIBC_2.17");
33+
#else
3034
__asm__(".symver dlsym,dlsym@GLIBC_2.2.5");
3135
__asm__(".symver dlvsym,dlvsym@GLIBC_2.2.5");
36+
#endif
3237

3338
/* __libc_csu_init is statically linked into each program, and passed to __libc_start_main
3439
* when the program is running with an old glibc (<2.34).

client/src/main/resources/glibc/gcc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,14 @@
2020
set -euf
2121

2222
base=$(dirname -- "$0")
23+
redefine_syms="$base/glibc.redef"
24+
25+
# aarch64 starts with GLIBC_2.17 and cannot consume x86-era GLIBC_2.2.5.
26+
if [ "$(uname -m)" = "aarch64" ] && [ -f "$base/glibc.redef.aarch64" ]; then
27+
redefine_syms="$base/glibc.redef.aarch64"
28+
fi
2329

2430
# fix glibc api version on the fly
25-
find . -name '*.o' -print0 | xargs -0rn 1 objcopy --redefine-syms="$base/glibc.redef"
31+
find . -name '*.o' -print0 | xargs -0rn 1 objcopy --redefine-syms="$redefine_syms"
2632

2733
exec gcc "$@"
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one
2+
# or more contributor license agreements. See the NOTICE file
3+
# distributed with this work for additional information
4+
# regarding copyright ownership. The ASF licenses this file
5+
# to you under the Apache License, Version 2.0 (the
6+
# "License"); you may not use this file except in compliance
7+
# with the License. You may obtain a copy of the License at
8+
#
9+
# http://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# Unless required by applicable law or agreed to in writing,
12+
# software distributed under the License is distributed on an
13+
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
# KIND, either express or implied. See the License for the
15+
# specific language governing permissions and limitations
16+
# under the License.
17+
__libc_start_main __dynamic_libc_start_main
18+
clock_gettime clock_gettime@GLIBC_2.17
19+
dlopen dlopen@GLIBC_2.17
20+
dlsym dlsym@GLIBC_2.17
21+
memcpy memcpy@GLIBC_2.17
22+
posix_spawn posix_spawn@GLIBC_2.17
23+
pthread_attr_getguardsize pthread_attr_getguardsize@GLIBC_2.17
24+
pthread_attr_getstack pthread_attr_getstack@GLIBC_2.17
25+
pthread_attr_setstacksize pthread_attr_setstacksize@GLIBC_2.17
26+
pthread_condattr_setclock pthread_condattr_setclock@GLIBC_2.17
27+
pthread_create pthread_create@GLIBC_2.17
28+
pthread_getattr_np pthread_getattr_np@GLIBC_2.17
29+
pthread_join pthread_join@GLIBC_2.17
30+
pthread_kill pthread_kill@GLIBC_2.17
31+
pthread_mutex_trylock pthread_mutex_trylock@GLIBC_2.17
32+
pthread_setname_np pthread_setname_np@GLIBC_2.17
33+
sem_destroy sem_destroy@GLIBC_2.17
34+
sem_init sem_init@GLIBC_2.17
35+
sem_post sem_post@GLIBC_2.17
36+
sem_wait sem_wait@GLIBC_2.17

0 commit comments

Comments
 (0)