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