diff --git a/gcc/lto/Make-lang.in b/gcc/lto/Make-lang.in index 0b73f9ef7bb..2b84af3ccf8 100644 --- a/gcc/lto/Make-lang.in +++ b/gcc/lto/Make-lang.in @@ -25,8 +25,9 @@ LTO_DUMP_EXE = lto-dump$(exeext) LTO_DUMP_INSTALL_NAME := $(shell echo lto-dump|sed '$(program_transform_name)') # The LTO-specific object files inclued in $(LTO_EXE). LTO_OBJS = lto/lto-lang.o lto/lto.o lto/lto-object.o attribs.o lto/lto-partition.o lto/lto-symtab.o lto/lto-common.o +LTO_OBJS += lto/lto-dump.o lto/lto-wrapper.o lto_OBJS = $(LTO_OBJS) -LTO_DUMP_OBJS = lto/lto-lang.o lto/lto-object.o attribs.o lto/lto-partition.o lto/lto-symtab.o lto/lto-dump.o lto/lto-common.o +LTO_DUMP_OBJS = lto_dump_OBJS = $(LTO_DUMP_OBJS) # this is only useful in a LTO bootstrap, but this does not work right @@ -88,9 +89,8 @@ $(LTO_EXE): $(LTO_OBJS) $(BACKEND) $(LIBDEPS) +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ $(LTO_OBJS) $(BACKEND) $(BACKENDLIBS) $(LIBS) -$(LTO_DUMP_EXE): $(LTO_DUMP_OBJS) $(BACKEND) $(LIBDEPS) - +$(LLINKER) $(ALL_LINKERFLAGS) $(LDFLAGS) -o $@ \ - $(LTO_DUMP_OBJS) $(BACKEND) $(BACKENDLIBS) $(LIBS) +$(LTO_DUMP_EXE): $(LTO_EXE) + +$(LN) $(LTO_EXE) $(LTO_DUMP_EXE) lto/lto-dump.o: $(LTO_OBJS) diff --git a/gcc/lto/lto-dump.c b/gcc/lto/lto-dump.c index 96e26d9e81c..6afe9fbbcbd 100644 --- a/gcc/lto/lto-dump.c +++ b/gcc/lto/lto-dump.c @@ -301,18 +301,12 @@ void dump_tool_help () return; } -unsigned int -lto_option_lang_mask (void) -{ - return CL_LTODump; -} - /* Functions for dumping various details in LTO dump tool are called in lto_main(). The purpose of this dump tool is to analyze the LTO object files. */ void -lto_main (void) +lto_dump_main (void) { quiet_flag = true; if (flag_lto_dump_tool_help) diff --git a/gcc/lto/lto.c b/gcc/lto/lto.c index 1c37814bde4..0f132bc7858 100644 --- a/gcc/lto/lto.c +++ b/gcc/lto/lto.c @@ -575,12 +575,6 @@ offload_handle_link_vars (void) #endif } -unsigned int -lto_option_lang_mask (void) -{ - return CL_LTO; -} - /* Main entry point for the GIMPLE front end. This front end has three main personalities: @@ -602,7 +596,7 @@ lto_option_lang_mask (void) simply applies them. */ void -lto_main (void) +lto1_main (void) { /* LTO is called as a front end, even though it is not a front end. Because it is called as a front end, TV_PHASE_PARSING and diff --git a/gcc/lto/lto.h b/gcc/lto/lto.h index d93d21776a2..fbaeb976eb3 100644 --- a/gcc/lto/lto.h +++ b/gcc/lto/lto.h @@ -34,9 +34,12 @@ struct lto_file /* In lto-lang.c */ extern const char *resolution_file_name; +extern void lto_main (void); +extern void lto_dump_main (void); +extern void lto1_main (void); + /* In lto.c */ extern tree lto_eh_personality (void); -extern void lto_main (void); extern void lto_read_all_file_options (void); /* In lto-elf.c or lto-coff.c */ diff --git a/gcc/lto/lto-wrapper.c b/gcc/lto/lto-wrapper.c new file mode 100644 index 00000000000..e56da21bb12 --- /dev/null +++ b/gcc/lto/lto-wrapper.c @@ -0,0 +1,29 @@ +#include "config.h" +#include "system.h" +#include "coretypes.h" +#include "tm.h" +#include "function.h" +#include "basic-block.h" +#include "tree.h" +#include "gimple.h" +#include "tree-streamer.h" +#include "cgraph.h" +#include "lto.h" + +unsigned int +lto_option_lang_mask (void) +{ + if (strcmp(progname, "lto1") == 0) + return CL_LTO; + else + return CL_LTODump; +} + +void +lto_main (void) +{ + if (strcmp(progname, "lto1") == 0) + lto1_main(); + else + lto_dump_main(); +}