Skip to content

Commit 3aaf69f

Browse files
committed
Build static PIE binaries with clang
gcc is not capable of linking with -static-pie, therefore we switch to using clang.
1 parent 9f87a66 commit 3aaf69f

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

scripts/chroot/build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ find /scripts
1212
apk update
1313
apk add alpine-sdk util-linux strace file autoconf automake libtool xz bash \
1414
eudev-dev gettext-dev linux-headers meson \
15-
zstd-dev zlib-dev zlib-static # fuse3-dev fuse3-static fuse-static fuse-dev
15+
zstd-dev zlib-dev zlib-static clang
1616

1717
/scripts/common/install-dependencies.sh
1818
/scripts/build-runtime.sh

scripts/docker/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ FROM alpine:3.20
44
RUN apk add --no-cache \
55
bash alpine-sdk util-linux strace file autoconf automake libtool xz \
66
eudev-dev gettext-dev linux-headers meson \
7-
zstd-dev zstd-static zlib-dev zlib-static # fuse3-dev fuse3-static fuse-static fuse-dev
7+
zstd-dev zstd-static zlib-dev zlib-static clang
88

99
COPY scripts/common/install-dependencies.sh /tmp/scripts/common/install-dependencies.sh
1010
COPY patches/ /tmp/patches/

src/runtime/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
GIT_COMMIT := $(shell cat version)
2-
CC = gcc
3-
CFLAGS = -std=gnu99 -Os -D_FILE_OFFSET_BITS=64 -DGIT_COMMIT=\"$(GIT_COMMIT)\" -T data_sections.ld -ffunction-sections -fdata-sections -Wl,--gc-sections -static -Wall -Werror
2+
CC = clang
3+
CFLAGS = -std=gnu99 -Os -D_FILE_OFFSET_BITS=64 -DGIT_COMMIT=\"$(GIT_COMMIT)\" -T data_sections.ld -ffunction-sections -fdata-sections -Wl,--gc-sections -static -Wall -Werror -static-pie
44
LIBS = -lsquashfuse -lsquashfuse_ll -lzstd -lz -lfuse3
55

66
all: runtime

0 commit comments

Comments
 (0)