From 5b30331167ffba6aef06fb3ad9685b792af816ce Mon Sep 17 00:00:00 2001 From: Jeff Johnston Date: Thu, 7 Nov 2002 00:25:57 +0000 Subject: [PATCH] 2002-11-08 Jeff Johnston * arm/Makefile.in: Add support for new pid specs. * arm/coff-iq80310.specs: Change to allow future support. * arm/elf-iq80310.specs: Ditto. * arm/elf-redboot.specs: Ditto. * arm/coff-redboot.ld: Add EH frame support. * arm/redboot-crt0.S: Add optional code to clear bss without memset. * arm/coff-pid.specs: New file. * arm/elf-pid.specs: New file. --- libgloss/ChangeLog | 12 +++++++++ libgloss/arm/Makefile.in | 13 +++++++--- libgloss/arm/coff-iq80310.specs | 2 +- libgloss/arm/coff-pid.specs | 8 ++++++ libgloss/arm/coff-redboot.ld | 9 +++++-- libgloss/arm/elf-iq80310.specs | 2 +- libgloss/arm/elf-pid.specs | 8 ++++++ libgloss/arm/elf-redboot.specs | 2 +- libgloss/arm/redboot-crt0.S | 43 +++++++++++++++++++++------------ 9 files changed, 76 insertions(+), 23 deletions(-) create mode 100644 libgloss/arm/coff-pid.specs create mode 100644 libgloss/arm/elf-pid.specs diff --git a/libgloss/ChangeLog b/libgloss/ChangeLog index b7826ae7b..2820a0b13 100644 --- a/libgloss/ChangeLog +++ b/libgloss/ChangeLog @@ -1,3 +1,15 @@ +2002-11-08 Jeff Johnston + + * arm/Makefile.in: Add support for new pid specs. + * arm/coff-iq80310.specs: Change to allow future support. + * arm/elf-iq80310.specs: Ditto. + * arm/elf-redboot.specs: Ditto. + * arm/coff-redboot.ld: Add EH frame support. + * arm/redboot-crt0.S: Add optional code to clear bss without + memset. + * arm/coff-pid.specs: New file. + * arm/elf-pid.specs: New file. + 2002-11-08 Jeff Johnston Catherine Moore diff --git a/libgloss/arm/Makefile.in b/libgloss/arm/Makefile.in index 9e3024f97..97e3ad451 100644 --- a/libgloss/arm/Makefile.in +++ b/libgloss/arm/Makefile.in @@ -47,15 +47,19 @@ OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \ then echo ${objroot}/../binutils/objcopy ; \ else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi` -REDBOOT_OBJS = redboot-crt0.o redboot-syscalls.o +REDBOOT_OBJS = redboot-crt0.o redboot-syscalls.o REDBOOT_SCRIPTS = redboot.ld redboot.specs REDBOOT_INSTALL = install-redboot CFLAGS = -g -# Here is specific eval board stuff +# Here is all of the eval board stuff +PID_SCRIPTS = pid.specs +PID_INSTALL = install-pid + IQ80310_SCRIPTS = iq80310.specs IQ80310_INSTALL = install-iq80310 + # Host specific makefile fragment comes in here. @host_makefile_frag@ @@ -82,13 +86,16 @@ distclean maintainer-clean realclean: clean rm -f Makefile config.status *~ .PHONY: install info install-info clean-info -install: ${REDBOOT_INSTALL} ${IQ80310_INSTALL} +install: ${REDBOOT_INSTALL} ${IQ80310_INSTALL} ${PID_INSTALL} install-redboot: set -e; for x in ${REDBOOT_OBJS}; do ${INSTALL_DATA} $$x ${tooldir}/lib${MULTISUBDIR}/$$x; done set -e; for x in ${REDBOOT_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${objtype}$$x ${tooldir}/lib${MULTISUBDIR}/$$x; done +install-pid: + set -e; for x in ${PID_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${objtype}$$x ${tooldir}/lib${MULTISUBDIR}/$$x; done + install-iq80310: set -e; for x in ${IQ80310_SCRIPTS}; do ${INSTALL_DATA} ${srcdir}/${objtype}$$x ${tooldir}/lib${MULTISUBDIR}/$$x; done diff --git a/libgloss/arm/coff-iq80310.specs b/libgloss/arm/coff-iq80310.specs index 30b43a676..2cd2d8704 100644 --- a/libgloss/arm/coff-iq80310.specs +++ b/libgloss/arm/coff-iq80310.specs @@ -4,5 +4,5 @@ -T redboot.ld%s -Ttext 0xA0020000 %(old_link) *startfile: -redboot-crt0%O%s redboot-syscalls%O%s +%{!pg:redboot-crt0%O%s} %{pg:redboot-crt0%O%s} redboot-syscalls%O%s diff --git a/libgloss/arm/coff-pid.specs b/libgloss/arm/coff-pid.specs new file mode 100644 index 000000000..61bec3e1e --- /dev/null +++ b/libgloss/arm/coff-pid.specs @@ -0,0 +1,8 @@ +%rename link old_link + +*link: +-T redboot.ld%s -Ttext 0x10000 %(old_link) + +*startfile: +redboot-crt0%O%s redboot-syscalls%O%s + diff --git a/libgloss/arm/coff-redboot.ld b/libgloss/arm/coff-redboot.ld index 7223ed22c..0c33c3b94 100644 --- a/libgloss/arm/coff-redboot.ld +++ b/libgloss/arm/coff-redboot.ld @@ -9,7 +9,7 @@ SECTIONS present): */ .text 0x8000 : { *(.init) - *(.text) + *(.text*) *(.glue_7t) *(.glue_7) *(.rdata) @@ -23,7 +23,12 @@ SECTIONS } .data 0x40000 + (. & 0xfffc0fff) : { __data_start__ = . ; - *(.data) + *(.data*) + *(.gcc_exc*) + ___EH_FRAME_BEGIN__ = . ; + *(.eh_fram*) + ___EH_FRAME_END__ = . ; + LONG(0); __data_end__ = . ; edata = .; _edata = .; diff --git a/libgloss/arm/elf-iq80310.specs b/libgloss/arm/elf-iq80310.specs index abb4f3abe..a016e887f 100644 --- a/libgloss/arm/elf-iq80310.specs +++ b/libgloss/arm/elf-iq80310.specs @@ -4,5 +4,5 @@ -T redboot.ld%s -Ttext 0xA0020000 %(old_link) *startfile: -crti%O%s crtbegin%O%s redboot-crt0%O%s redboot-syscalls%O%s +crti%O%s crtbegin%O%s %{!pg:redboot-crt0%O%s} %{pg:redboot-crt0%O%s} redboot-syscalls%O%s diff --git a/libgloss/arm/elf-pid.specs b/libgloss/arm/elf-pid.specs new file mode 100644 index 000000000..c8a9f14c9 --- /dev/null +++ b/libgloss/arm/elf-pid.specs @@ -0,0 +1,8 @@ +%rename link old_link + +*link: +-T redboot.ld%s -Ttext 0x10000 %(old_link) + +*startfile: +crti%O%s crtbegin%O%s %{!pg:redboot-crt0%O%s} %{pg:redboot-crt0%O%s} redboot-syscalls%O%s + diff --git a/libgloss/arm/elf-redboot.specs b/libgloss/arm/elf-redboot.specs index 7d6061d35..8a00c3b6d 100644 --- a/libgloss/arm/elf-redboot.specs +++ b/libgloss/arm/elf-redboot.specs @@ -4,5 +4,5 @@ -T redboot.ld%s -Ttext 0x20000 %(old_link) *startfile: -crti%O%s crtbegin%O%s redboot-crt0%O%s redboot-syscalls%O%s +crti%O%s crtbegin%O%s %{!pg:redboot-crt0%O%s} %{pg:redboot-crt0%O%s} redboot-syscalls%O%s diff --git a/libgloss/arm/redboot-crt0.S b/libgloss/arm/redboot-crt0.S index e14559a59..f2963eeb4 100644 --- a/libgloss/arm/redboot-crt0.S +++ b/libgloss/arm/redboot-crt0.S @@ -1,4 +1,3 @@ - .file "crt0.S" @@ -12,30 +11,44 @@ #endif .text - /* - * Setup the assembly entry point. - */ + /* Setup the assembly entry point. */ .code 32 .globl SYM_NAME(start) .globl SYM_NAME(_start) SYM_NAME(start): SYM_NAME(_start): - mov fp, #0 /* Null frame pointer */ - mov r7, #0 /* Null frame pointer for Thumb */ + mov fp, #0 /* Null frame pointer. */ + mov r7, #0 /* Null frame pointer for Thumb. */ - /* enable interrupts for gdb debugging */ + /* Enable interrupts for gdb debugging. */ mrs r0, cpsr bic r0, r0, #0xC0 msr cpsr, r0 - mov a2, #0 /* Second arg: fill value */ - ldr a1, .LC1 /* First arg: start of memory block */ + mov a2, #0 /* Second arg: fill value. */ + ldr a1, .LC1 /* First arg: start of memory block. */ ldr a3, .LC2 - sub a3, a3, a1 /* Third arg: length of block */ + sub a3, a3, a1 /* Third arg: length of block. */ -#ifdef __thumb__ /* Enter Thumb mode.... */ - add a4, pc, #1 /* Get the address of the Thumb block */ - bx a4 /* Go there and start Thumb decoding */ +#ifdef GCRT0 + /* Zero out the bss without using memset. + Using memset is bad because it may be instrumented for + profiling, but at this point, the profiling data structures + have not been set up. + FIXME: This loop could be a lot more efficient. */ + subs a3, a3, #0 + beq 2f +1: strb a2, [a1] + subs a3, a3, #1 + add a1, a1, #1 + bne 1b +2: + /* Nothing to left to clear. */ +#endif + +#ifdef __thumb__ /* Enter Thumb mode. */ + add a4, pc, #1 /* Get the address of the Thumb block. */ + bx a4 /* Go there and start Thumb decoding. */ .code 16 .global __change_mode @@ -43,8 +56,9 @@ SYM_NAME(_start): __change_mode: #endif +#ifndef GCRT0 bl SYM_NAME(memset) - +#endif bl SYM_NAME(__get_memtop) sub r0, r0, #32 mov sp, r0 @@ -76,7 +90,6 @@ __change_mode: .Lfini: .word SYM_NAME(_fini) #endif - #if 0 #ifdef __thumb__ .code 16