Skip to content

Commit

Permalink
Compile x86_64-musl binaryas static position independent executable (…
Browse files Browse the repository at this point in the history
…static-pie). A static position independent executable is similar to static executable, but can be loaded at any address without a dynamic linker.

Signed-off-by: DL6ER <dl6er@dl6er.de>
  • Loading branch information
DL6ER committed Jun 18, 2019
1 parent 9691694 commit 81468d8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ version: 2
name: "Build"
command: |
BRANCH=$([ -z "$CIRCLE_TAG" ] && echo "$CIRCLE_BRANCH" || echo "master")
make GIT_BRANCH="${BRANCH}" GIT_TAG="${CIRCLE_TAG}"
make GIT_BRANCH="${BRANCH}" GIT_TAG="${CIRCLE_TAG}" CIRCLE_JOB="${CIRCLE_JOB}"
file pihole-FTL
- run:
name: "Upload"
Expand Down
10 changes: 8 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -98,11 +98,17 @@ CCFLAGS=-std=gnu11 -I$(IDIR) $(WARNFLAGS) -D_FILE_OFFSET_BITS=64 $(HARDENING_FLA
# for FTL we need the pthread library
# for dnsmasq we need the nettle crypto library and the gmp maths library
# We link the two libraries statically. Although this increases the binary file size by about 1 MB, it saves about 5 MB of shared libraries and makes deployment easier
#LIBS=-pthread -lnettle -lgmp -lhogweed
LIBS=-pthread -lrt -Wl,-Bstatic -L/usr/local/lib -lhogweed -lgmp -lnettle -Wl,-Bdynamic
LIBS=-pthread -lrt -Wl,-Bstatic -L/usr/local/lib -lhogweed -lgmp -lnettle
# Flags for compiling with libidn : -lidn
# Flags for compiling with libidn2: -lidn2

# Do we want to compile a statically linked musl executable?
ifeq "$(CIRCLE_JOB)" "x86_64-musl"
CC := $(CC) -Wl,-Bstatic -static-libgcc -static-pie
else
LIBS := $(LIBS) -Wl,-Bdynamic
endif

IDIR = .
ODIR = obj
DNSMASQDIR = dnsmasq
Expand Down

0 comments on commit 81468d8

Please sign in to comment.