1
1
mirror of https://github.com/rui314/mold.git synced 2024-12-27 10:23:41 +03:00
This commit is contained in:
Rui Ueyama 2021-01-27 18:18:11 +09:00
parent d24fb706cb
commit e207e95737
3 changed files with 16 additions and 1 deletions

View File

@ -11,7 +11,8 @@ LDFLAGS=-L$(TBB_LIBDIR) -Wl,-rpath=$(TBB_LIBDIR) \
-L$(MALLOC_LIBDIR) -Wl,-rpath=$(MALLOC_LIBDIR)
LIBS=-lcrypto -pthread -ltbb -lmimalloc
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
linker_script.o archive_file.o output_file.o subprocess.o gc_sections.o \
icf.o
mold: $(OBJS)
$(CXX) $(CFLAGS) $(OBJS) -o $@ $(LDFLAGS) $(LIBS)

View File

@ -940,6 +940,10 @@ static Config parse_nonpositional_args(std::span<std::string_view> args,
conf.print_gc_sections = true;
} else if (read_flag(args, "no-print-gc-sections")) {
conf.print_gc_sections = false;
} else if (read_flag(args, "icf")) {
conf.icf = true;
} else if (read_flag(args, "no-icf")) {
conf.icf = false;
} else if (read_flag(args, "quick-exit")) {
conf.quick_exit = true;
} else if (read_flag(args, "no-quick-exit")) {
@ -1194,6 +1198,10 @@ int main(int argc, char **argv) {
if (config.gc_sections)
gc_sections();
// Merge identical read-only sections.
if (config.icf)
icf_sections();
// Merge string constants in SHF_MERGE sections.
handle_mergeable_strings();

6
mold.h
View File

@ -1073,6 +1073,12 @@ private:
void gc_sections();
//
// icf_sections.cc
//
void icf_sections();
//
// icf.cc
//