mirror of
https://github.com/rui314/mold.git
synced 2024-12-27 10:23:41 +03:00
ICF
This commit is contained in:
parent
d24fb706cb
commit
e207e95737
3
Makefile
3
Makefile
@ -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)
|
||||
|
8
main.cc
8
main.cc
@ -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();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user