1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-27 10:23:41 +03:00

Make it possible to create a statically-linked mold executable

This commit is contained in:
Rui Ueyama 2021-04-03 17:37:07 +09:00
parent 97d5330c17
commit a552711249

View File

@ -10,8 +10,8 @@ CPPFLAGS=-g -IoneTBB/include -IxxHash -pthread -std=c++20 \
-DGIT_HASH=\"$(shell git rev-parse HEAD)\"
LDFLAGS=-L$(TBB_LIBDIR) -Wl,-rpath=$(TBB_LIBDIR) \
-L$(MALLOC_LIBDIR) -Wl,-rpath=$(MALLOC_LIBDIR) \
-L$(CURRENT_DIR)/xxHash
LIBS=-lcrypto -pthread -ltbb -lmimalloc -lz xxHash/libxxhash.a
-L$(CURRENT_DIR)/xxHash -Wl,-rpath=$(CURRENT_DIR)/xxHash
LIBS=-lcrypto -pthread -ltbb -lmimalloc -lz -lxxhash -ldl
OBJS=main.o object_file.o input_sections.o output_chunks.o mapfile.o perf.o \
linker_script.o archive_file.o output_file.o subprocess.o gc_sections.o \
icf.o symbols.o cmdline.o filepath.o glob.o passes.o arch_x86_64.o \
@ -24,6 +24,11 @@ else
CPPFLAGS += -O2
endif
STATIC ?= 0
ifeq ($(STATIC), 1)
LDFLAGS += -static
endif
all: mold mold-wrapper.so
mold: $(OBJS)
@ -36,8 +41,9 @@ $(OBJS): mold.h elf.h Makefile
submodules:
$(MAKE) -C oneTBB
$(MAKE) -C oneTBB extra_inc=big_iron.inc
mkdir -p mimalloc/out/release
(cd mimalloc/out/release; cmake ../..)
(cd mimalloc/out/release; CFLAGS=-DMI_USE_ENVIRON=0 cmake ../..)
$(MAKE) -C mimalloc/out/release
$(MAKE) -C xxHash