Message ID | 56423464.20506@iki.fi |
---|---|
State | New |
Headers | show |
On 11/10/2015 11:16 AM, Andris Pavenis wrote: > One may need to execute extra steps after linking program. This is required > for example for DJGPP to run stubify.exe on file generated by linker. > > The only way how to achieve was to use LINK_COMMAND_SPEC. It would be > much easier > and less error prone to use new macro POST_LINK_SPEC introduced in this > patch. > > Andris > > ChangeLog entry > > 2015 Nov 10 Andris Pavenis <andris.pavenis@iki.fi> > > * gcc.c: new macro POST_LINK_SPEC > * doc/tm.texi.in: document POST_LINK_SPEC > * doc/tm.texi: regenerate > Can you also include the changes to djgpp.h which exploit this capability? Jeff
On 11/10/2015 11:16 AM, Andris Pavenis wrote: > One may need to execute extra steps after linking program. This is required > for example for DJGPP to run stubify.exe on file generated by linker. > > The only way how to achieve was to use LINK_COMMAND_SPEC. It would be > much easier > and less error prone to use new macro POST_LINK_SPEC introduced in this > patch. > > Andris > > ChangeLog entry > > 2015 Nov 10 Andris Pavenis <andris.pavenis@iki.fi> > > * gcc.c: new macro POST_LINK_SPEC > * doc/tm.texi.in: document POST_LINK_SPEC > * doc/tm.texi: regenerate Instaled with a better ChangeLog. Presumably there's going to be a followup to simplify a bunch of hte djgpp configuration? jeff
On 11/13/2015 08:40 AM, Jeff Law wrote: > On 11/10/2015 11:16 AM, Andris Pavenis wrote: >> One may need to execute extra steps after linking program. This is required >> for example for DJGPP to run stubify.exe on file generated by linker. >> >> The only way how to achieve was to use LINK_COMMAND_SPEC. It would be >> much easier >> and less error prone to use new macro POST_LINK_SPEC introduced in this >> patch. >> >> Andris >> >> ChangeLog entry >> >> 2015 Nov 10 Andris Pavenis <andris.pavenis@iki.fi> >> >> * gcc.c: new macro POST_LINK_SPEC >> * doc/tm.texi.in: document POST_LINK_SPEC >> * doc/tm.texi: regenerate > Instaled with a better ChangeLog. Presumably there's going to be a followup to simplify a bunch > of hte djgpp configuration? > > jeff > > > There are large number of changes in djgpp related configuration files accumulated over many years. Some cleanup and verification whether all is still needed and and of course testing of both cross- and native compiler is required. It would be rather difficult to split it into parts. I'll going to submit configuration changes for DJGPP (gcc/config.host + gcc/config/i386/*djgpp*) in one large patch after cleanup and testing unless there are objections. Therefore small small separate changes can be expected first. Andris
From 2b50898ca2340aa43ce756bd605862b947cf1e7d Mon Sep 17 00:00:00 2001 From: Andris Pavenis <andris.pavenis@iki.fi> Date: Tue, 10 Nov 2015 19:52:57 +0200 Subject: [PATCH] New macro POST_LINK_SPEC for additional steps after rinning linker --- gcc/doc/tm.texi | 5 +++++ gcc/doc/tm.texi.in | 5 +++++ gcc/gcc.c | 8 +++++++- 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index f394db7..fe4e7f0 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -375,6 +375,11 @@ The sequence in which libgcc and libc are specified to the linker. By default this is @code{%G %L %G}. @end defmac +@defmac POST_LINK_SPEC +Define this macro to add additional steps to be executed after linker. +The default value of this macro is empty string. +@end defmac + @defmac LINK_COMMAND_SPEC A C string constant giving the complete command line need to execute the linker. When you do this, you will need to update your port each time a diff --git a/gcc/doc/tm.texi.in b/gcc/doc/tm.texi.in index d188c57..8c9c1b2 100644 --- a/gcc/doc/tm.texi.in +++ b/gcc/doc/tm.texi.in @@ -375,6 +375,11 @@ The sequence in which libgcc and libc are specified to the linker. By default this is @code{%G %L %G}. @end defmac +@defmac POST_LINK_SPEC +Define this macro to add additional steps to be executed after linker. +The default value of this macro is empty string. +@end defmac + @defmac LINK_COMMAND_SPEC A C string constant giving the complete command line need to execute the linker. When you do this, you will need to update your port each time a diff --git a/gcc/gcc.c b/gcc/gcc.c index bbc9b23..45d6089 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -979,6 +979,10 @@ proper position among the other output files. */ %{%:sanitize(leak):" LIBLSAN_SPEC "}}}" #endif +#ifndef POST_LINK_SPEC +#define POST_LINK_SPEC "" +#endif + /* This is the spec to use, once the code for creating the vtable verification runtime library, libvtv.so, has been created. Currently the vtable verification runtime functions are in libstdc++, so we use @@ -1021,7 +1025,7 @@ proper position among the other output files. */ %(mflib) " STACK_SPLIT_SPEC "\ %{fprofile-arcs|fprofile-generate*|coverage:-lgcov} " SANITIZER_SPEC " \ %{!nostdlib:%{!nodefaultlibs:%(link_ssp) %(link_gcc_c_sequence)}}\ - %{!nostdlib:%{!nostartfiles:%E}} %{T*} }}}}}}" + %{!nostdlib:%{!nostartfiles:%E}} %{T*} \n%(post_link) }}}}}}" #endif #ifndef LINK_LIBGCC_SPEC @@ -1063,6 +1067,7 @@ static const char *linker_name_spec = LINKER_NAME; static const char *linker_plugin_file_spec = ""; static const char *lto_wrapper_spec = ""; static const char *lto_gcc_spec = ""; +static const char *post_link_spec = POST_LINK_SPEC; static const char *link_command_spec = LINK_COMMAND_SPEC; static const char *link_libgcc_spec = LINK_LIBGCC_SPEC; static const char *startfile_prefix_spec = STARTFILE_PREFIX_SPEC; @@ -1571,6 +1576,7 @@ static struct spec_list static_specs[] = INIT_STATIC_SPEC ("linker_plugin_file", &linker_plugin_file_spec), INIT_STATIC_SPEC ("lto_wrapper", <o_wrapper_spec), INIT_STATIC_SPEC ("lto_gcc", <o_gcc_spec), + INIT_STATIC_SPEC ("post_link", &post_link_spec), INIT_STATIC_SPEC ("link_libgcc", &link_libgcc_spec), INIT_STATIC_SPEC ("md_exec_prefix", &md_exec_prefix), INIT_STATIC_SPEC ("md_startfile_prefix", &md_startfile_prefix), -- 2.4.3