Need Help to Further Reduce bsp_specs

Sebastian Huber sebastian.huber at embedded-brains.de
Fri Dec 1 07:04:43 UTC 2017


On 30/11/17 19:11, Joel Sherrill wrote:
> Hi
>
> I have been experimenting with the LEON3 bsp_specs and linker script. 
> I have reduced it to this:
>
> ================================
> %rename endfile old_endfile
> %rename startfile old_startfile
>
> *startfile:
> %{!qrtems: %(old_startfile)} \
> %{!nostdlib: %{qrtems: crti.o%s crtbegin.o%s}}
>
> *endfile:
> %{!qrtems: %(old_endfile)} %{qrtems: crtend.o%s crtn.o%s}
> ================================
>
> I can't figure out how to deal with the need for crt[in[ and crtbegin/end
> without modifying gcc.  I was hoping to address them in the linkcmds.
>
> Any ideas?

If we look at the current linker invocation (collect2) with and without 
-specs bsp_specs on erc32 for ticker we get:

sparc-rtems5-gcc -B../../../../../erc32/lib/ -specs bsp_specs -qrtems -o 
ticker.exe init.o tasks.o -wrapper echo
/opt/rtems/5/lib/gcc/sparc-rtems5/7.2.1/collect2
-dc
-dp
-N
-o
ticker.exe
../../../../../erc32/lib/start.o
/opt/rtems/5/lib64/gcc/sparc-rtems5/7.2.1/crti.o
/opt/rtems/5/lib64/gcc/sparc-rtems5/7.2.1/crtbegin.o
-L../../../../../erc32/lib -L/opt/rtems/5/lib64/gcc/sparc-rtems5/7.2.1
-L/opt/rtems/5/lib64/gcc/sparc-rtems5/7.2.1/../../../../sparc-rtems5/lib
init.o
tasks.o
-lgcc
--start-group
-lrtemsbsp
-lrtemscpu
-latomic
-lc
-lgcc
--end-group
-T
../../../../../erc32/lib/linkcmds
-lgcc
/opt/rtems/5/lib64/gcc/sparc-rtems5/7.2.1/crtend.o
/opt/rtems/5/lib64/gcc/sparc-rtems5/7.2.1/crtn.o

sparc-rtems5-gcc -B../../../../../erc32/lib/ -qrtems -o ticker.exe 
init.o tasks.o -wrapper echo
/opt/rtems/5/lib/gcc/sparc-rtems5/7.2.1/collect2
-o
ticker.exe
/opt/rtems/5/lib64/gcc/sparc-rtems5/7.2.1/../../../../sparc-rtems5/lib/crt0.o
-L../../../../../erc32/lib
-L/opt/rtems/5/lib64/gcc/sparc-rtems5/7.2.1
-L/opt/rtems/5/lib64/gcc/sparc-rtems5/7.2.1/../../../../sparc-rtems5/lib
init.o
tasks.o
-lgcc
--start-group
-lrtemsbsp
-lrtemscpu
-latomic
-lc
-lgcc
--end-group
-T
../../../../../erc32/lib/linkcmds
-lgcc

Maybe we can use

/DISCARD/ : { crt0.o(*) }

to get rid of the 
"/opt/rtems/5/lib64/gcc/sparc-rtems5/7.2.1/../../../../sparc-rtems5/lib/crt0.o" 
in the linker command file.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber at embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.



More information about the devel mailing list