Message ID | 20200408174721.14408-1-sebastian.huber@embedded-brains.de |
---|---|
State | New |
Headers | show |
Series | RTEMS: Improve GCC specification | expand |
On Wed, 2020-04-08 at 19:47 +0200, Sebastian Huber wrote: > Add a start/end file specification if the -qrtems option is present. > Allow targets to customize it. > > Support the standard -nodefaultlibs option. > > gcc/ > > * config/rtems.h (RTEMS_STARTFILE_SPEC): Define if undefined. > (RTEMS_ENDFILE_SPEC): Likewise. > (STARTFILE_SPEC): Update comment. Add RTEMS_STARTFILE_SPEC. > (ENDFILE_SPEC): Add RTEMS_ENDFILE_SPEC. > (LIB_SPECS): Support -nodefaultlibs option. > * config/or1k/rtems.h (RTEMS_STARTFILE_SPEC): Define. > (RTEMS_ENDFILE_SPEC): Likewise. > * config/rs6000/rtems.h (RTEMS_STARTFILE_SPEC): Likewise. > (RTEMS_ENDFILE_SPEC): Likewise. > * config/v850/rtems.h (RTEMS_STARTFILE_SPEC): Likewise. > (RTEMS_ENDFILE_SPEC): Likewise. How important is it to get this into gcc-10? We're well into stage4 at this point and while we do have leeway with a patch like this we do want to be selective about what we accept. If it's important, then OK, otherwise please defer it to gcc-11, where it's pre- approved. Jeff
Hello Jeff, On 08/04/2020 22:24, Jeff Law wrote: > On Wed, 2020-04-08 at 19:47 +0200, Sebastian Huber wrote: >> Add a start/end file specification if the -qrtems option is present. >> Allow targets to customize it. >> >> Support the standard -nodefaultlibs option. >> >> gcc/ >> >> * config/rtems.h (RTEMS_STARTFILE_SPEC): Define if undefined. >> (RTEMS_ENDFILE_SPEC): Likewise. >> (STARTFILE_SPEC): Update comment. Add RTEMS_STARTFILE_SPEC. >> (ENDFILE_SPEC): Add RTEMS_ENDFILE_SPEC. >> (LIB_SPECS): Support -nodefaultlibs option. >> * config/or1k/rtems.h (RTEMS_STARTFILE_SPEC): Define. >> (RTEMS_ENDFILE_SPEC): Likewise. >> * config/rs6000/rtems.h (RTEMS_STARTFILE_SPEC): Likewise. >> (RTEMS_ENDFILE_SPEC): Likewise. >> * config/v850/rtems.h (RTEMS_STARTFILE_SPEC): Likewise. >> (RTEMS_ENDFILE_SPEC): Likewise. > How important is it to get this into gcc-10? We're well into stage4 at this > point and while we do have leeway with a patch like this we do want to be > selective about what we accept. > > If it's important, then OK, otherwise please defer it to gcc-11, where it's pre- > approved. would it be all right to commit it to the trunk once the GCC 11 development starts and then back port it for GCC 10.2 after a while?
On Tue, 2020-04-14 at 17:26 +0200, Sebastian Huber wrote: > Hello Jeff, > > On 08/04/2020 22:24, Jeff Law wrote: > > > On Wed, 2020-04-08 at 19:47 +0200, Sebastian Huber wrote: > > > Add a start/end file specification if the -qrtems option is present. > > > Allow targets to customize it. > > > > > > Support the standard -nodefaultlibs option. > > > > > > gcc/ > > > > > > * config/rtems.h (RTEMS_STARTFILE_SPEC): Define if undefined. > > > (RTEMS_ENDFILE_SPEC): Likewise. > > > (STARTFILE_SPEC): Update comment. Add RTEMS_STARTFILE_SPEC. > > > (ENDFILE_SPEC): Add RTEMS_ENDFILE_SPEC. > > > (LIB_SPECS): Support -nodefaultlibs option. > > > * config/or1k/rtems.h (RTEMS_STARTFILE_SPEC): Define. > > > (RTEMS_ENDFILE_SPEC): Likewise. > > > * config/rs6000/rtems.h (RTEMS_STARTFILE_SPEC): Likewise. > > > (RTEMS_ENDFILE_SPEC): Likewise. > > > * config/v850/rtems.h (RTEMS_STARTFILE_SPEC): Likewise. > > > (RTEMS_ENDFILE_SPEC): Likewise. > > How important is it to get this into gcc-10? We're well into stage4 at this > > point and while we do have leeway with a patch like this we do want to be > > selective about what we accept. > > > > If it's important, then OK, otherwise please defer it to gcc-11, where it's > > pre- > > approved. > would it be all right to commit it to the trunk once the GCC 11 > development starts and then back port it for GCC 10.2 after a while? That works for me. It's not technically a regression, but I think some leeway is reasonable. jeff
diff --git a/gcc/config/or1k/rtems.h b/gcc/config/or1k/rtems.h index 94731435f44..d4b8fef3dc7 100644 --- a/gcc/config/or1k/rtems.h +++ b/gcc/config/or1k/rtems.h @@ -28,3 +28,6 @@ builtin_assert ("system=rtems"); \ } \ while (0) + +#define RTEMS_STARTFILE_SPEC "crtbegin%O%s" +#define RTEMS_ENDFILE_SPEC "crtend%O%s" diff --git a/gcc/config/rs6000/rtems.h b/gcc/config/rs6000/rtems.h index 6ce05bfc6d6..40db6606f17 100644 --- a/gcc/config/rs6000/rtems.h +++ b/gcc/config/rs6000/rtems.h @@ -292,3 +292,6 @@ "%{mads|myellowknife|mmvme|msim:%G %L %G;" \ "!mcall-*|mcall-linux:" GNU_USER_TARGET_LINK_GCC_C_SEQUENCE_SPEC ";" \ ":%G %L %G}" + +#define RTEMS_STARTFILE_SPEC "ecrti%O%s rtems_crti%O%s crtbegin%O%s" +#define RTEMS_ENDFILE_SPEC "crtend%O%s rtems_crtn%O%s ecrtn%O%s" diff --git a/gcc/config/rtems.h b/gcc/config/rtems.h index 55d568f83b5..30ad6258949 100644 --- a/gcc/config/rtems.h +++ b/gcc/config/rtems.h @@ -22,15 +22,25 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef RTEMS_STARTFILE_SPEC +#define RTEMS_STARTFILE_SPEC "crti%O%s crtbegin%O%s" +#endif + +#ifndef RTEMS_ENDFILE_SPEC +#define RTEMS_ENDFILE_SPEC "crtend%O%s crtn%O%s" +#endif + /* - * Dummy start/end specification to let linker work as - * needed by autoconf scripts using this compiler. + * The crt0.o is a dummy start file to let the linker work as needed by + * autoconf scripts using this compiler. */ #undef STARTFILE_SPEC -#define STARTFILE_SPEC "crt0.o%s" +#define STARTFILE_SPEC "%{!qrtems:crt0%O%s} " \ +"%{qrtems:%{!nostdlib:%{!nostartfiles:" RTEMS_STARTFILE_SPEC "}}}" #undef ENDFILE_SPEC -#define ENDFILE_SPEC "" +#define ENDFILE_SPEC \ +"%{qrtems:%{!nostdlib:%{!nostartfiles:" RTEMS_ENDFILE_SPEC "}}}" /* * Some targets do not set up LIB_SPECS, override it, here. @@ -38,10 +48,10 @@ #define STD_LIB_SPEC "%{!shared:%{g*:-lg} %{!p:%{!pg:-lc}}%{p:-lc_p}%{pg:-lc_p}}" #undef LIB_SPEC -#define LIB_SPEC "%{!qrtems: " STD_LIB_SPEC "} " \ -"%{!nostdlib: %{qrtems: --start-group \ - -lrtemsbsp -lrtemscpu \ - -latomic -lc -lgcc --end-group %{!qnolinkcmds: -T linkcmds%s}}}" +#define LIB_SPEC "%{!qrtems:" STD_LIB_SPEC "} " \ +"%{qrtems:%{!nostdlib:%{!nodefaultlibs:" \ +"--start-group -lrtemsbsp -lrtemscpu -latomic -lc -lgcc --end-group} " \ +"%{!qnolinkcmds:-T linkcmds%s}}}" #define TARGET_POSIX_IO diff --git a/gcc/config/v850/rtems.h b/gcc/config/v850/rtems.h index 3f7d39a2cd1..e261ea3b417 100644 --- a/gcc/config/v850/rtems.h +++ b/gcc/config/v850/rtems.h @@ -39,3 +39,6 @@ %{!mv850es:%{!mv850e1:%{mv*:-mv%*}} \ %{m8byte-align:-m8byte-align} \ %{mgcc-abi:-mgcc-abi}}" + +#define RTEMS_STARTFILE_SPEC "" +#define RTEMS_ENDFILE_SPEC ""