Skip to content

Commit

Permalink
Next newlib - this one is broken
Browse files Browse the repository at this point in the history
  • Loading branch information
grepwood@sucs.org committed Jul 11, 2020
1 parent 6409bda commit 831b666
Show file tree
Hide file tree
Showing 58 changed files with 6,453 additions and 325 deletions.
86 changes: 85 additions & 1 deletion COPYING.NEWLIB
Expand Up @@ -403,7 +403,7 @@ WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

(20) DJ Delorie (i386)
(20) DJ Delorie (i386 / arm)
Copyright (C) 1991 DJ Delorie
All rights reserved.

Expand Down Expand Up @@ -1049,3 +1049,87 @@ LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

(46) embedded brains - RTEMS targets

Copyright (c) 2017 embedded brains GmbH
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

(47) John Baldwin - RTEMS targets

Copyright (c) 2015 John Baldwin <jhb@FreeBSD.org>.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the author nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.


(48) Jeffrey Roberson - RTEMS targets

Copyright (c) 2008, Jeffrey Roberson <jeff@freebsd.org>
All rights reserved.

Copyright (c) 2008 Nokia Corporation
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice unmodified, this list of conditions, and the following
disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
20 changes: 12 additions & 8 deletions libgloss/arc/Makefile.in
Expand Up @@ -47,14 +47,15 @@ OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
then echo ${objroot}/../binutils/objcopy ; \
else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`

CRT0 = crt0.o
CRT0 = gcrt0.o crt0.o
CRT0_INSTALL = install-crt0

NSIM_BSP = libnsim.a
NSIM_OBJS = \
libcfunc.o \
nsim-syscalls.o \
sbrk.o
libcfunc.o \
nsim-syscalls.o \
sbrk.o \
mcount.o
NSIM_INSTALL = install-nsim
NSIM_SCRIPTS = nsim.specs

Expand All @@ -75,9 +76,9 @@ $(NSIM_BSP): $(NSIM_OBJS)
libcfunc.o: libcfunc.c
nsim-syscalls.o: nsim-syscalls.c
sbrk.o: sbrk.c

#
$(CRT0): crt0.S
mcount.o: mcount.c
gcrt0.o: gcrt0.S crt0.S
crt0.o: crt0.S

clean mostlyclean:
rm -f *.o *.a
Expand All @@ -95,7 +96,10 @@ install: $(CRT0_INSTALL) $(NSIM_INSTALL) $(NANO_INSTALL)

$(CRT0_INSTALL):
$(mkinstalldirs) $(DESTDIR)${tooldir}/lib${MULTISUBDIR}
${INSTALL_DATA} ${CRT0} $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$(CRT0)
for c in $(CRT0); do \
b=`basename $$c`; \
${INSTALL_DATA} $$c $(DESTDIR)${tooldir}/lib${MULTISUBDIR}/$$b ;\
done

$(NSIM_INSTALL):
$(mkinstalldirs) $(DESTDIR)${tooldir}/lib${MULTISUBDIR}
Expand Down
21 changes: 20 additions & 1 deletion libgloss/arc/crt0.S
Expand Up @@ -142,6 +142,11 @@ __start:
bset r2, r2, 19
flag r2
#endif

#if defined (__ARC_CODE_DENSITY__)
;; Initialize jli_base
sr @__JLI_TABLE__,[jli_base]
#endif
mov gp, @__SDATA_BEGIN__
mov_s r2, @__sbss_start ; r2 = start of the bss section
sub r3, @_end, r2 ; r3 = size of the bss section in bytes
Expand Down Expand Up @@ -189,11 +194,18 @@ __start:
mov_s r0, 1
st_s r0, [r1, 4] ; _GLOBAL_REENT->atexit0._ind
; branch to _init
#if defined (__EM__) || defined (__HS__)
#if defined (__ARCEM__) || defined (__ARCHS__)
jl @_init
#else
bl @_init
#endif /* __ARCEM__ || __ARCHS__ */

#ifdef PROFILE_SUPPORT /* Defined in gcrt0.S. */
mov r0,@__start
mov r1,@_etext
jl @_monstartup
#endif /* PROFILE_SUPPORT */

mov_s r0, r13
mov_s r1, r14
; branch to main
Expand All @@ -204,6 +216,13 @@ __start:
bl.d @main
mov fp, 0 ; initialize frame pointer
#endif /* __ARCEM__ || __ARCHS__ */

#ifdef PROFILE_SUPPORT
mov r13, r0 ; Save return code
jl @_mcleanup
mov r0, r13
#endif /* PROFILE_SUPPORT */

; r0 contains exit code
j @exit

Expand Down
79 changes: 79 additions & 0 deletions libgloss/arc/gcrt0.S
@@ -0,0 +1,79 @@
/*
Copyright (c) 2016, Synopsys, Inc. All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1) Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2) Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3) Neither the name of the Synopsys, Inc., nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
*/
#define PROFILE_SUPPORT 1

#include "crt0.S"

.global __mcount
.type __mcount, @function
.align 4
__mcount:
;; When a function is compiled for profiling, gcc will insert
;; a call to __mcount without checking for resources. Hence,
;; we need save all of the argument registers and temp registers,
;; extract the address of <func_name>, and call the _mcount_internal
;; to do the real work. Finally, restore all the argument registers
;; before returning.
push_s blink
push_s r0
push_s r1
push_s r2
push_s r3
#ifndef __ARC_RF16__
push r4
push r5
push r6
push r7
push r8
push r9
#endif
push r10
push r11
push r12
mov r0,blink
jl @_mcount_internal
pop r12
pop r11
pop r10
#ifndef __ARC_RF16__
pop r9
pop r8
pop r7
pop r6
pop r5
pop r4
#endif
pop_s r3
pop_s r2
pop_s r1
pop_s r0
pop_s blink
j_s [blink]
.size __mcount, . - __mcount

0 comments on commit 831b666

Please sign in to comment.