<div dir="ltr">Thanks. I will try to deal with this Monday.<div><br></div><div>My specs patches are not ready to push to gcc so I need to focus on </div><div>just the parts to make x86_64 right.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, May 18, 2018 at 3:41 PM, Amaan Cheval <span dir="ltr"><<a href="mailto:amaan.cheval@gmail.com" target="_blank">amaan.cheval@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">To be clear, I applied this patch (with my fixes) on the 7.3 release<br>
through the RSB to test, not on GCC's master branch.<br>
<br>
> to add i386/rtemself64.h<br>
<br>
What you sent in this email thread adds rtemself64.h already. Do you<br>
mean you'd like to split the commits up or something?<br>
<br>
The only changes I made on top of yours were:<br>
<br>
- Readd "rtems.h" to config.gcc<br>
- Fix comments<br>
<br>
I've attached the patch file I used within the RSB here (sorry if you<br>
meant a patch of _just_ the fixes I made on top of yours, this is just<br>
the cumulative diff I used to patch GCC 7.3 to test).<br>
<br>
Regards,<br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, May 18, 2018 at 7:00 PM, Joel Sherrill <<a href="mailto:joel@rtems.org">joel@rtems.org</a>> wrote:<br>
><br>
><br>
><br>
> On Fri, May 18, 2018 at 1:38 AM, Amaan Cheval <<a href="mailto:amaan.cheval@gmail.com">amaan.cheval@gmail.com</a>><br>
> wrote:<br>
>><br>
>> I just compiled my local fixed copy (adding rtems.h back in) and<br>
>> there's good news! With the patch, the x86_64 compile stub works with<br>
>> a blank bsp_specs file!<br>
><br>
><br>
> Awesome!<br>
><br>
> Can you send me your changes as a patch? I am thinking I need to make<br>
> sure we agree on what the gcc master for x86_64-rtems looks like.<br>
><br>
> Apparently I owe committing a patch to add i386/rtemself64.h since it is<br>
> missing on the master. And the comment is wrong. What else?<br>
><br>
>> On Fri, May 18, 2018 at 12:59 AM, Amaan Cheval <<a href="mailto:amaan.cheval@gmail.com">amaan.cheval@gmail.com</a>><br>
>> wrote:<br>
>> > Hey!<br>
>> ><br>
>> > Thanks so much for sharing this, it's quite useful to put your earlier<br>
>> > email[1] about minimzing the bsp_specs in context.<br>
>> ><br>
>> > From looking ahead a bit without testing (still compiling), the patch<br>
>> > may need an ENDFILE_SPEC definition as well for "crtend.o" (it defines<br>
>> > __TMC_END__ which crtbegin.o has left undefined for eg.) and possibly<br>
>> > "crtn.o", at least to eliminate the x86_64 port's bsp_specs entirely<br>
>> > (see here[2]).<br>
>><br>
>> Just noticed that ENDFILE_SPEC already includes crtend in i386elf.h,<br>
>> so there's no need for this change.<br>
>><br>
>> ><br>
>> > I've also left some comments inline below.<br>
>> ><br>
>> > +1 on upstreaming this into GCC (making sure it also backports to 7.3<br>
>> > for simplicity, so we don't need to write a 7.3-specific patch for the<br>
>> > RSB as well) with a few additons (at least for the x86_64 target, to<br>
>> > try to have an empty bsp_specs to begin with).<br>
>> ><br>
>> > [1] <a href="https://lists.rtems.org/pipermail/devel/2018-May/021430.html" rel="noreferrer" target="_blank">https://lists.rtems.org/<wbr>pipermail/devel/2018-May/<wbr>021430.html</a><br>
>> > [2]<br>
>> > <a href="https://github.com/AmaanC/rtems-gsoc18/blob/ac/daily-01-compile-stub/bsps/x86_64/amd64/start/bsp_specs" rel="noreferrer" target="_blank">https://github.com/AmaanC/<wbr>rtems-gsoc18/blob/ac/daily-01-<wbr>compile-stub/bsps/x86_64/<wbr>amd64/start/bsp_specs</a><br>
>> ><br>
>> > On Wed, May 16, 2018 at 8:46 PM, Joel Sherrill <<a href="mailto:joel@rtems.org">joel@rtems.org</a>> wrote:<br>
>> >> ---<br>
>> >> gcc/config.gcc | 2 +-<br>
>> >> gcc/config/arm/rtems.h | 4 ++++<br>
>> >> gcc/config/bfin/rtems.h | 4 ++++<br>
>> >> gcc/config/i386/rtemself.h | 6 +++++-<br>
>> >> gcc/config/i386/rtemself64.h | 39<br>
>> >> ++++++++++++++++++++++++++++++<wbr>+++++++++<br>
>> >> gcc/config/m68k/rtemself.h | 4 ++++<br>
>> >> gcc/config/microblaze/rtems.h | 4 ++++<br>
>> >> gcc/config/mips/rtems.h | 4 ++++<br>
>> >> gcc/config/moxie/rtems.h | 4 ++++<br>
>> >> gcc/config/nios2/rtems.h | 4 ++++<br>
>> >> gcc/config/riscv/rtems.h | 4 ++++<br>
>> >> gcc/config/rs6000/rtems.h | 5 +++++<br>
>> >> gcc/config/rtems.h | 6 +++++-<br>
>> >> gcc/config/sh/rtems.h | 4 ++++<br>
>> >> gcc/config/sh/rtemself.h | 4 ++++<br>
>> >> gcc/config/sparc/rtemself.h | 4 ++++<br>
>> >> gcc/config/v850/rtems.h | 4 ++++<br>
>> >> 17 files changed, 103 insertions(+), 3 deletions(-)<br>
>> >> create mode 100644 gcc/config/i386/rtemself64.h<br>
>> >><br>
>> >> diff --git a/gcc/config.gcc b/gcc/config.gcc<br>
>> >> index d509800..de27e5c 100644<br>
>> >> --- a/gcc/config.gcc<br>
>> >> +++ b/gcc/config.gcc<br>
>> >> @@ -1499,7 +1499,7 @@ x86_64-*-elf*)<br>
>> >> tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h<br>
>> >> newlib-stdint.h i386/i386elf.h i386/x86-64.h"<br>
>> >> ;;<br>
>> >> x86_64-*-rtems*)<br>
>> >> - tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h<br>
>> >> newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rtemself.h rtems.h"<br>
>> >> + tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h<br>
>> >> newlib-stdint.h i386/i386elf.h i386/x86-64.h i386/rtemself64.h"<br>
>> ><br>
>> > In rebasing with upstream, this commit must have silently mistakenly<br>
>> > also dropped rtems.h (which my patch earlier added to support the<br>
>> > -qrtems, -qnolinkcmds, etc. flags).<br>
>> ><br>
>> >> ;;<br>
>> >> i[34567]86-*-rdos*)<br>
>> >> tm_file="${tm_file} i386/unix.h i386/att.h dbxelf.h elfos.h<br>
>> >> newlib-stdint.h i386/i386elf.h i386/rdos.h"<br>
>> >> diff --git a/gcc/config/arm/rtems.h b/gcc/config/arm/rtems.h<br>
>> >> index 1123f4a..e79ce90 100644<br>
>> >> --- a/gcc/config/arm/rtems.h<br>
>> >> +++ b/gcc/config/arm/rtems.h<br>
>> >> @@ -34,3 +34,7 @@<br>
>> >> } while (0)<br>
>> >><br>
>> >> #define ARM_DEFAULT_SHORT_ENUMS false<br>
>> >> +<br>
>> >> +#undef STARTFILE_SPEC<br>
>> >> +#define STARTFILE_SPEC "\<br>
>> >> +%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"<br>
>> >> diff --git a/gcc/config/bfin/rtems.h b/gcc/config/bfin/rtems.h<br>
>> >> index 6a9a41f..28a69b9 100644<br>
>> >> --- a/gcc/config/bfin/rtems.h<br>
>> >> +++ b/gcc/config/bfin/rtems.h<br>
>> >> @@ -31,3 +31,7 @@<br>
>> >> builtin_assert ("system=rtems"); \<br>
>> >> } \<br>
>> >> while (0)<br>
>> >> +<br>
>> >> +#undef STARTFILE_SPEC<br>
>> >> +#define STARTFILE_SPEC "\<br>
>> >> +%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"<br>
>> >> diff --git a/gcc/config/i386/rtemself.h b/gcc/config/i386/rtemself.h<br>
>> >> index 65e8dad..3a09354 100644<br>
>> >> --- a/gcc/config/i386/rtemself.h<br>
>> >> +++ b/gcc/config/i386/rtemself.h<br>
>> >> @@ -1,4 +1,4 @@<br>
>> >> -/* Definitions for rtems targeting an ix86 using ELF.<br>
>> >> +/* Definitions for rtems targeting an x86_64 using ELF.<br>
>> ><br>
>> > I think you meant to have this comment in rtemself64.h, which says<br>
>> > ix86 currently?<br>
>> ><br>
>> >> Copyright (C) 1996-2018 Free Software Foundation, Inc.<br>
>> >> Contributed by Joel Sherrill (joel@OARcorp.com).<br>
>> >><br>
>> >> @@ -33,3 +33,7 @@<br>
>> >> builtin_assert ("system=rtems"); \<br>
>> >> } \<br>
>> >> while (0)<br>
>> >> +<br>
>> >> +#undef STARTFILE_SPEC<br>
>> >> +#define STARTFILE_SPEC "\<br>
>> >> +%{!nostdlib: %{!qrtems: crt0.o%s} crtbegin.o%s}"<br>
>> >> diff --git a/gcc/config/i386/rtemself64.h<br>
>> >> b/gcc/config/i386/rtemself64.h<br>
>> >> new file mode 100644<br>
>> >> index 0000000..34e5937<br>
>> >> --- /dev/null<br>
>> >> +++ b/gcc/config/i386/rtemself64.h<br>
>> >> @@ -0,0 +1,39 @@<br>
>> >> +/* Definitions for rtems targeting an ix86 using ELF.<br>
>> ><br>
>> > See above.<br>
>> ><br>
>> >> + Copyright (C) 1996-2018 Free Software Foundation, Inc.<br>
>> >> + Contributed by Joel Sherrill (joel@OARcorp.com).<br>
>> >> +<br>
>> >> + This file is part of GCC.<br>
>> >> +<br>
>> >> + GCC is free software; you can redistribute it and/or modify it<br>
>> >> + under the terms of the GNU General Public License as published<br>
>> >> + by the Free Software Foundation; either version 3, or (at your<br>
>> >> + option) any later version.<br>
>> >> +<br>
>> >> + GCC is distributed in the hope that it will be useful, but WITHOUT<br>
>> >> + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY<br>
>> >> + or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public<br>
>> >> + License for more details.<br>
>> >> +<br>
>> >> + Under Section 7 of GPL version 3, you are granted additional<br>
>> >> + permissions described in the GCC Runtime Library Exception, version<br>
>> >> + 3.1, as published by the Free Software Foundation.<br>
>> >> +<br>
>> >> + You should have received a copy of the GNU General Public License<br>
>> >> and<br>
>> >> + a copy of the GCC Runtime Library Exception along with this<br>
>> >> program;<br>
>> >> + see the files COPYING3 and COPYING.RUNTIME respectively. If not,<br>
>> >> see<br>
>> >> + <<a href="http://www.gnu.org/licenses/" rel="noreferrer" target="_blank">http://www.gnu.org/licenses/</a>><wbr>. */<br>
>> >> +<br>
>> >> +/* Specify predefined symbols in preprocessor. */<br>
>> >> +<br>
>> >> +#define TARGET_OS_CPP_BUILTINS() \<br>
>> >> + do \<br>
>> >> + { \<br>
>> >> + builtin_define ("__rtems__"); \<br>
>> >> + builtin_define ("__USE_INIT_FINI__"); \<br>
>> >> + builtin_assert ("system=rtems"); \<br>
>> >> + } \<br>
>> >> + while (0)<br>
>> >> +<br>
>> >> +#undef STARTFILE_SPEC<br>
>> >> +#define STARTFILE_SPEC "\<br>
>> >> +%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"<br>
>> >> diff --git a/gcc/config/m68k/rtemself.h b/gcc/config/m68k/rtemself.h<br>
>> >> index e18a06e..6f31aa5 100644<br>
>> >> --- a/gcc/config/m68k/rtemself.h<br>
>> >> +++ b/gcc/config/m68k/rtemself.h<br>
>> >> @@ -36,3 +36,7 @@<br>
>> >> builtin_assert ("system=rtems"); \<br>
>> >> } \<br>
>> >> while (0)<br>
>> >> +<br>
>> >> +#undef STARTFILE_SPEC<br>
>> >> +#define STARTFILE_SPEC "\<br>
>> >> +%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"<br>
>> >> diff --git a/gcc/config/microblaze/rtems.<wbr>h<br>
>> >> b/gcc/config/microblaze/rtems.<wbr>h<br>
>> >> index 5f23321..fc8914c 100644<br>
>> >> --- a/gcc/config/microblaze/rtems.<wbr>h<br>
>> >> +++ b/gcc/config/microblaze/rtems.<wbr>h<br>
>> >> @@ -35,3 +35,7 @@<br>
>> >> %{mbig-endian:-EB --oformat=elf32-microblaze} \<br>
>> >> %{mlittle-endian:-EL --oformat=elf32-microblazeel} \<br>
>> >> %{mxl-gp-opt:%{G*}} %{!mxl-gp-opt: -G 0}"<br>
>> >> +<br>
>> >> +#undef STARTFILE_SPEC<br>
>> >> +#define STARTFILE_SPEC "\<br>
>> >> +%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"<br>
>> >> diff --git a/gcc/config/mips/rtems.h b/gcc/config/mips/rtems.h<br>
>> >> index 66e00bf..6e96853 100644<br>
>> >> --- a/gcc/config/mips/rtems.h<br>
>> >> +++ b/gcc/config/mips/rtems.h<br>
>> >> @@ -37,3 +37,7 @@ do { \<br>
>> >> */<br>
>> >> #undef MIPS_DEFAULT_GVALUE<br>
>> >> #define MIPS_DEFAULT_GVALUE 0<br>
>> >> +<br>
>> >> +#undef STARTFILE_SPEC<br>
>> >> +#define STARTFILE_SPEC "\<br>
>> >> +%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"<br>
>> >> diff --git a/gcc/config/moxie/rtems.h b/gcc/config/moxie/rtems.h<br>
>> >> index bc28d6e..6c79063 100644<br>
>> >> --- a/gcc/config/moxie/rtems.h<br>
>> >> +++ b/gcc/config/moxie/rtems.h<br>
>> >> @@ -38,3 +38,7 @@<br>
>> >> #undef PTRDIFF_TYPE<br>
>> >> #undef WCHAR_TYPE<br>
>> >> #undef WCHAR_TYPE_SIZE<br>
>> >> +<br>
>> >> +#undef STARTFILE_SPEC<br>
>> >> +#define STARTFILE_SPEC "\<br>
>> >> +%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"<br>
>> >> diff --git a/gcc/config/nios2/rtems.h b/gcc/config/nios2/rtems.h<br>
>> >> index b4a6082..f6eedf6 100644<br>
>> >> --- a/gcc/config/nios2/rtems.h<br>
>> >> +++ b/gcc/config/nios2/rtems.h<br>
>> >> @@ -37,3 +37,7 @@ do { \<br>
>> >><br>
>> >> This is done so RTEMS targets have Thread Local Storage like Linux.<br>
>> >> */<br>
>> >> #define TARGET_LINUX_ABI 1<br>
>> >> +<br>
>> >> +#undef STARTFILE_SPEC<br>
>> >> +#define STARTFILE_SPEC "\<br>
>> >> +%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"<br>
>> >> diff --git a/gcc/config/riscv/rtems.h b/gcc/config/riscv/rtems.h<br>
>> >> index 231b6a0..a9d1e01 100644<br>
>> >> --- a/gcc/config/riscv/rtems.h<br>
>> >> +++ b/gcc/config/riscv/rtems.h<br>
>> >> @@ -29,3 +29,7 @@<br>
>> >> builtin_define ("__USE_INIT_FINI__"); \<br>
>> >> builtin_assert ("system=rtems"); \<br>
>> >> } while (0)<br>
>> >> +<br>
>> >> +#undef STARTFILE_SPEC<br>
>> >> +#define STARTFILE_SPEC "\<br>
>> >> +%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"<br>
>> >> diff --git a/gcc/config/rs6000/rtems.h b/gcc/config/rs6000/rtems.h<br>
>> >> index 54ddcb4..20a4ffa 100644<br>
>> >> --- a/gcc/config/rs6000/rtems.h<br>
>> >> +++ b/gcc/config/rs6000/rtems.h<br>
>> >> @@ -72,6 +72,11 @@<br>
>> >> } \<br>
>> >> while (0)<br>
>> >><br>
>> >> +<br>
>> >> +#undef STARTFILE_SPEC<br>
>> >> +#define STARTFILE_SPEC "\<br>
>> >> +%{!nostdlib: %{!qrtems: crt0.o%s} ecrti.o%s crtbegin.o%s}"<br>
>> >> +<br>
>> >> /* Copy and paste from linux64.h and freebsd64.h */<br>
>> >> #undef RELOCATABLE_NEEDS_FIXUP<br>
>> >> #define RELOCATABLE_NEEDS_FIXUP \<br>
>> >> diff --git a/gcc/config/rtems.h b/gcc/config/rtems.h<br>
>> >> index dcea95c..9a0619c 100644<br>
>> >> --- a/gcc/config/rtems.h<br>
>> >> +++ b/gcc/config/rtems.h<br>
>> >> @@ -30,11 +30,15 @@<br>
>> >> * Dummy start/end specification to let linker work as<br>
>> >> * needed by autoconf scripts using this compiler.<br>
>> >> */<br>
>> >> +#if 0<br>
>> >> #undef STARTFILE_SPEC<br>
>> >> -#define STARTFILE_SPEC "crt0.o%s"<br>
>> >> +#define STARTFILE_SPEC "%{!qrtems: crt0.o%s}"<br>
>> >> +#endif<br>
>> >><br>
>> >> +#if 0<br>
>> >> #undef ENDFILE_SPEC<br>
>> >> #define ENDFILE_SPEC ""<br>
>> >> +#endif<br>
>> >><br>
>> >> /*<br>
>> >> * Some targets do not set up LIB_SPECS, override it, here.<br>
>> >> diff --git a/gcc/config/sh/rtems.h b/gcc/config/sh/rtems.h<br>
>> >> index d2f2b2a..f699151 100644<br>
>> >> --- a/gcc/config/sh/rtems.h<br>
>> >> +++ b/gcc/config/sh/rtems.h<br>
>> >> @@ -29,3 +29,7 @@<br>
>> >> builtin_define( "__rtems__" ); \<br>
>> >> builtin_assert( "system=rtems" ); \<br>
>> >> } while (0)<br>
>> >> +<br>
>> >> +#undef STARTFILE_SPEC<br>
>> >> +#define STARTFILE_SPEC "\<br>
>> >> +%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"<br>
>> >> diff --git a/gcc/config/sh/rtemself.h b/gcc/config/sh/rtemself.h<br>
>> >> index 6a67b49..85f26b0 100644<br>
>> >> --- a/gcc/config/sh/rtemself.h<br>
>> >> +++ b/gcc/config/sh/rtemself.h<br>
>> >> @@ -29,3 +29,7 @@<br>
>> >> builtin_define( "__rtems__" ); \<br>
>> >> builtin_assert( "system=rtems" ); \<br>
>> >> } while (0)<br>
>> >> +<br>
>> >> +#undef STARTFILE_SPEC<br>
>> >> +#define STARTFILE_SPEC "\<br>
>> >> +%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"<br>
>> >> diff --git a/gcc/config/sparc/rtemself.h b/gcc/config/sparc/rtemself.h<br>
>> >> index e4b52d8..7c5bf43 100644<br>
>> >> --- a/gcc/config/sparc/rtemself.h<br>
>> >> +++ b/gcc/config/sparc/rtemself.h<br>
>> >> @@ -38,3 +38,7 @@<br>
>> >><br>
>> >> /* Use the default */<br>
>> >> #undef LINK_GCC_C_SEQUENCE_SPEC<br>
>> >> +<br>
>> >> +#undef STARTFILE_SPEC<br>
>> >> +#define STARTFILE_SPEC "\<br>
>> >> +%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"<br>
>> >> diff --git a/gcc/config/v850/rtems.h b/gcc/config/v850/rtems.h<br>
>> >> index b20b2c3..1b56649 100644<br>
>> >> --- a/gcc/config/v850/rtems.h<br>
>> >> +++ b/gcc/config/v850/rtems.h<br>
>> >> @@ -39,3 +39,7 @@<br>
>> >> %{!mv850es:%{!mv850e1:%{mv*:-<wbr>mv%*}} \<br>
>> >> %{m8byte-align:-m8byte-align} \<br>
>> >> %{mgcc-abi:-mgcc-abi}}"<br>
>> >> +<br>
>> >> +#undef STARTFILE_SPEC<br>
>> >> +#define STARTFILE_SPEC "\<br>
>> >> +%{!nostdlib: %{!qrtems: crt0.o%s} crti.o%s crtbegin.o%s}"<br>
>> >> --<br>
>> >> 1.8.3.1<br>
>> >><br>
>> >> ______________________________<wbr>_________________<br>
>> >> devel mailing list<br>
>> >> <a href="mailto:devel@rtems.org">devel@rtems.org</a><br>
>> >> <a href="http://lists.rtems.org/mailman/listinfo/devel" rel="noreferrer" target="_blank">http://lists.rtems.org/<wbr>mailman/listinfo/devel</a><br>
><br>
><br>
</div></div></blockquote></div><br></div>