Skip to content

Commit

Permalink
Build static PIE binaries with clang
Browse files Browse the repository at this point in the history
gcc is not capable of linking with -static-pie, therefore we switch to
using clang.
  • Loading branch information
TheAssassin committed Dec 2, 2024
1 parent 8609383 commit c811634
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion scripts/chroot/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ find /scripts
apk update
apk add alpine-sdk util-linux strace file autoconf automake libtool xz bash \
eudev-dev gettext-dev linux-headers meson \
zstd-dev zlib-dev zlib-static # fuse3-dev fuse3-static fuse-static fuse-dev
zstd-dev zlib-dev zlib-static clang

/scripts/common/install-dependencies.sh
/scripts/build-runtime.sh
2 changes: 1 addition & 1 deletion scripts/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ FROM ${docker_arch}/alpine:latest
RUN apk add --no-cache \
bash alpine-sdk util-linux strace file autoconf automake libtool xz \
eudev-dev gettext-dev linux-headers meson \
zstd-dev zstd-static zlib-dev zlib-static # fuse3-dev fuse3-static fuse-static fuse-dev
zstd-dev zstd-static zlib-dev zlib-static clang

COPY scripts/common/install-dependencies.sh /tmp/scripts/common/install-dependencies.sh
COPY patches/ /tmp/patches/
Expand Down
4 changes: 2 additions & 2 deletions src/runtime/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CC = gcc
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 -fPIE
CC = clang
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
LIBS = -lsquashfuse -lsquashfuse_ll -lzstd -lz -lfuse3

all: runtime
Expand Down

0 comments on commit c811634

Please sign in to comment.