Hey! Just thought I'd bump this patch and see if anyone had a chance to look at it! Let me know if you have any questions or would like anything to be different (for eg. to split "x86_64-*-elf*" and "x86_64-*-rtems*" into their own case statements, instead of what I have here. On Tue, May 1, 2018 at 3:24 PM Amaan Cheval <amaan.che...@gmail.com> wrote:
> Hi! > The x86_64 RTEMS target doesn't currently have gcc build crti.o and crtn.o. This > surfaces as undefined references to "_fini", which RTEMS references in its > kernel: > https://git.rtems.org/rtems/tree/cpukit/libcsupport/src/newlibc_exit.c#n39 > Most other architectures deal with this by adding crti.o to the startfile in > bsp_specs: > https://git.rtems.org/rtems/tree/bsps/i386/pc386/start/bsp_specs#n6 > This patch uses GCC's i386's crti.S and crtn.S (since x86_64-*-* targets use > "cpu_type=i386") as the source for the object files: https://gcc.gnu.org/git/?p=gcc.git;a=blob;f=libgcc/config/i386/crti.S;h=c25e8f9e3ab45e935f6287d5ed3a8437a289e059;hb=HEAD > The patch is as follows: > libgcc/ChangeLog: > 2018-05-01 Amaan Cheval <amaan.che...@gmail.com> > * config.host: Build i386's crti.o and crtn.o for x86_64-*-rtems* > Index: libgcc/config.host > =================================================================== > --- libgcc/config.host (revision 259789) > +++ libgcc/config.host (working copy) > @@ -611,6 +611,11 @@ i[34567]86-*-elf*) > ;; > x86_64-*-elf* | x86_64-*-rtems*) > tmake_file="$tmake_file i386/t-crtstuff t-crtstuff-pic t-libgcc-pic" > + case ${host} in > + x86_64-*-rtems*) > + extra_parts="$extra_parts crti.o crtn.o" > + ;; > + esac > ;; > x86_64-*-fuchsia*) > tmake_file="$tmake_file t-libgcc-pic"