public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/5] libgloss: msp430: delete outdated/wrong code
@ 2023-12-27  3:24 Mike Frysinger
  2023-12-27  3:24 ` [PATCH 2/5] libgloss: msp430: delete stub crt_init.o Mike Frysinger
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Mike Frysinger @ 2023-12-27  3:24 UTC (permalink / raw)
  To: newlib

The #if 0 & comment imply this code doesn't exist and is never used,
except there's another #if Lrun_fini_array section below which *does*
define this function, which makes this code comment confusing.  This
seems to be a hold over of the cleanup of the minrt code in the old
commit 884b05b54e4595433c85f8ca9820e88b4c723e38 ("MSP430: Remove
.init/.fini sections").
---
 libgloss/msp430/crt0.S | 14 --------------
 1 file changed, 14 deletions(-)

diff --git a/libgloss/msp430/crt0.S b/libgloss/msp430/crt0.S
index 88876cd48300..c0b258f508d2 100644
--- a/libgloss/msp430/crt0.S
+++ b/libgloss/msp430/crt0.S
@@ -195,20 +195,6 @@ START_CRT_FUNC 0600 run_init_array
 END_CRT_FUNC	run_init_array
 #endif /* Lrun_init_array */
 
-;; FIXME: There are currently no program termination routines executed for
-;; msp430.
-#if 0
-#if Lrun_fini_array
-;; Ensure global C++ destructors in .fini_array are called on exit
-;; by registering __crt0_run_fini_array with atexit.
-START_CRT_FUNC 0700 register_fini_array
-
-	mov_	#__crt0_run_fini_array, R12
-	call_	#atexit
-
-END_CRT_FUNC	register_fini_array
-#endif /* Lrun_fini_array */
-#endif /* 0 */
 
 #if Lmain
 ;; This function is always included and calls main().
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 2/5] libgloss: msp430: delete stub crt_init.o
  2023-12-27  3:24 [PATCH 1/5] libgloss: msp430: delete outdated/wrong code Mike Frysinger
@ 2023-12-27  3:24 ` Mike Frysinger
  2023-12-27  3:24 ` [PATCH 3/5] libgloss: msp430: split up crt0.S source Mike Frysinger
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2023-12-27  3:24 UTC (permalink / raw)
  To: newlib

This object is created by compiling crt0.S with -DLinit, but there
has never been an "#if Linit" check in crt0.S, so this has always
produced a stub object file.  Drop compiling it entirely.
---
 libgloss/msp430/Makefile.in | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libgloss/msp430/Makefile.in b/libgloss/msp430/Makefile.in
index 05d3f9cba93d..c5d70ff7d954 100644
--- a/libgloss/msp430/Makefile.in
+++ b/libgloss/msp430/Makefile.in
@@ -90,8 +90,7 @@ CRT_OBJS = \
 	crt_run_init_array.o \
 	crt_run_preinit_array.o \
 	crt_run_fini_array.o \
-	crt_run_array.o \
-	crt_init.o
+	crt_run_array.o
 
 #### Host specific Makefile fragment comes in here.
 @host_makefile_frag@
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 3/5] libgloss: msp430: split up crt0.S source
  2023-12-27  3:24 [PATCH 1/5] libgloss: msp430: delete outdated/wrong code Mike Frysinger
  2023-12-27  3:24 ` [PATCH 2/5] libgloss: msp430: delete stub crt_init.o Mike Frysinger
@ 2023-12-27  3:24 ` Mike Frysinger
  2023-12-27  3:24 ` [PATCH 4/5] libgloss: msp430: delete custom .S.o rule Mike Frysinger
  2023-12-27  3:24 ` [PATCH 5/5] libgloss: merge msp430 into top-level Makefile Mike Frysinger
  3 siblings, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2023-12-27  3:24 UTC (permalink / raw)
  To: newlib

The build system compiles crt0.S many times to produce independent
object files by defining different -DLxxx symbols for each.  This
complicates the build, and has led to some bugs in the source and
build (see the previous cleanup commits in here).  The crt_bss.S
file has also been duplicated with crt0.S leading to confusion as
to which one is the "real" one.  The only reason to keep them in
one file is to make management of the section numbers when calling
START_CRT_FUNC a little easier, but that seems trivial to check
with a quick grep across all the files.

Considering how complicated the build is now, and the bugs we've
had as a result, split the crt0.S file up into multiple source
files so we don't have to compile it multiple times.  This will
also simplify merging it into the top-level Makefile.
---
 libgloss/msp430/Makefile.in             |   7 +-
 libgloss/msp430/crt0.S                  | 192 +-----------------------
 libgloss/msp430/crt_bss.S               |  24 +--
 libgloss/msp430/crt_callexit.S          |  39 +++++
 libgloss/msp430/crt_high_bss.S          |  51 +++++++
 libgloss/msp430/crt_init.S              |  46 ++++++
 libgloss/msp430/crt_main.S              |  40 +++++
 libgloss/msp430/crt_move_highdata.S     |  71 +++++++++
 libgloss/msp430/crt_movedata.S          |  50 ++++++
 libgloss/msp430/crt_run_array.S         |  48 ++++++
 libgloss/msp430/crt_run_fini_array.S    |  43 ++++++
 libgloss/msp430/crt_run_init_array.S    |  43 ++++++
 libgloss/msp430/crt_run_preinit_array.S |  43 ++++++
 libgloss/msp430/memmodel.h              |  14 +-
 14 files changed, 499 insertions(+), 212 deletions(-)
 create mode 100644 libgloss/msp430/crt_callexit.S
 create mode 100644 libgloss/msp430/crt_high_bss.S
 create mode 100644 libgloss/msp430/crt_init.S
 create mode 100644 libgloss/msp430/crt_main.S
 create mode 100644 libgloss/msp430/crt_move_highdata.S
 create mode 100644 libgloss/msp430/crt_movedata.S
 create mode 100644 libgloss/msp430/crt_run_array.S
 create mode 100644 libgloss/msp430/crt_run_fini_array.S
 create mode 100644 libgloss/msp430/crt_run_init_array.S
 create mode 100644 libgloss/msp430/crt_run_preinit_array.S

diff --git a/libgloss/msp430/Makefile.in b/libgloss/msp430/Makefile.in
index c5d70ff7d954..ccf94dc1625f 100644
--- a/libgloss/msp430/Makefile.in
+++ b/libgloss/msp430/Makefile.in
@@ -78,8 +78,6 @@ NOSYS_OBJS = ciosyscalls.o \
 	unlink.o \
 	sbrk.o
 
-# Each crt_*.o is built from crt0.S using -DL*.  crt0.o is built from
-# crt0.s with -DL0 via the default rule below.
 CRT_OBJS = \
 	crt_bss.o \
 	crt_high_bss.o \
@@ -98,12 +96,9 @@ CRT_OBJS = \
 
 all: $(CRT) $(SIM_BSP) $(LIB_NOSYS) $(LIB_CRT) copy_scripts_to_objdir
 
-crt_%.o : crt0.S
-	$(CC) -DL$* -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $< -o $@
-
 # Override .S.o rule to pass assembler debugging flags
 .S.o:
-	$(CC) -DL0 -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $<
+	$(CC) -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $<
 
 $(SIM_BSP): $(SIM_OBJS)
 	$(AR) $(ARFLAGS) $@ $?
diff --git a/libgloss/msp430/crt0.S b/libgloss/msp430/crt0.S
index c0b258f508d2..affc2c9a85dd 100644
--- a/libgloss/msp430/crt0.S
+++ b/libgloss/msp430/crt0.S
@@ -13,13 +13,6 @@
 
 #include "memmodel.h"
 
-;; The linker links all .crt_* sections in asciibetical order at the
-;; same place.  So, the four digits in .crt_NNNN_xxx name created by
-;; the START_CRT_FUNC macro determine the link order, so, keep them
-;; in sequential order here.  The first two digits are set here, the
-;; second two allow users to insert code between code fragments here.
-
-#if L0
 	.section ".resetvec", "a"
 __msp430_resetvec_hook:
 	.word	__crt0_start
@@ -56,9 +49,8 @@ START_CRT_FUNC 0000 start
 	mov_	#__stack, R1
 
 END_CRT_FUNC	start
-#endif
 
-;; The CRT functions below will only be present in the final linked
+;; The CRT functions will only be present in the final linked
 ;; executable if the assembler decides they are needed.  The assembler will
 ;; only define the symbol necessary to prevent them being garbage collected
 ;; by the linker if the file being assembled has a specific section,
@@ -67,185 +59,3 @@ END_CRT_FUNC	start
 ;; if it detects that main() has an epilogue. For example, if main() has a
 ;; while(1) loop at the end, GCC will not generate an epilogue (since it won't
 ;; return) and __crt0_call_exit won't be included.
-
-#if Lbss
-;; This function is responsible for initializing the contents of the
-;; .bss section.
-
-START_CRT_FUNC 0100 init_bss
-
-	mov_	#__bssstart, R12
-	clr.w	R13
-	mov_	#__bsssize, R14
-#ifdef __MSP430X_LARGE__
-	clr.w	R15		; We assume that __bsssize is never > 64K
-#endif
-	call_	#memset
-
-END_CRT_FUNC	init_bss
-#endif /* Lbss */
-
-
-#ifdef __MSP430X_LARGE__
-#if Lhigh_bss
-;; This function is responsible for initializing the contents of the
-;; .upper.bss section.
-
-START_CRT_FUNC 0200 init_highbss
-	
-	mov_	#__high_bssstart, R12
-	mov.w	#0, R13
-	mov_	#__high_bsssize, R14
-	;; If __high_bsssize is zero then skip the call to memset.
-	;; This can happen if all of the bss data was placed into .either.bss.
-	cmp.w	#0, R14
-	jeq	1f
-	call_	#memset
-1:
-END_CRT_FUNC	init_highbss
-#endif /* Lhigh_bss */
-#endif /* __MSP430X_LARGE__ */
-
-
-#if Lmovedata
-;; This function is responsible for copying the
-;; contents of the .data section from its load address (in ROM) to
-;; its run-time address (in RAM).
-
-START_CRT_FUNC 0300 movedata
-
-	mov_	#__datastart, R12
-	mov_	#__romdatastart, R13
-
-	;;  memmove and memcpy do not currently work when src == dst
-	cmp_	R12, R13
-	jeq	1f
-
-	mov_	#__romdatacopysize, R14
-
-	call_	#memmove
-1:
-END_CRT_FUNC	movedata
-#endif /* Lmovedata  */
-
-
-#ifdef __MSP430X_LARGE__
-#if Lmove_highdata
-;; This function is responsible for making sure that the
-;; contents of the .upper.data section have their correct startup values.
-;; If a copy of the .upper.data section is stored in ROM then this means
-;; copying the contents into HIFRAM.  If a copy of .upper.data is stored in a
-;; shadow section in HIFRAM then this means copying from the shadow section
-;; into the real section.
-
-START_CRT_FUNC 0400 move_highdata
-	;;  __rom_highdatacopysize may be zero.  Test this first because
-	;; its value may come from the weak definitions above and we do
-	;; not want to access the memory at address 0 pointed to by the
-	;; weak definition of __upper_data_init.
-	mov.w	#__rom_highdatacopysize, R14
-	cmp.w	#0, R14
-	jeq	3f
-
-	/* Test our status word.  */
-	cmpx.w  #0, &__upper_data_init
-	jeq	1f
-	/* Status word is non-zero - copy from shadow into upper.  */
-	mov_	#__high_datastart, R12
-	mov_	#__rom_highdatastart, R13
-	jmp	2f
-
-1:	/* Status word is zero.  Copy from upper to shadow and change status word.  */
-	movx.w  #1, &__upper_data_init
-	mov_	#__rom_highdatastart, R12
-	mov_	#__high_datastart, R13
-
-2:	;; __rom_highdatacopysize may be zero.  memmove should cope.
-	mov.w	#__rom_highdatacopysize, R14
-
-	call_	#memmove
-3:
-END_CRT_FUNC	move_highdata
-#endif /* Lmove_highdata */
-#endif /* __MSP430X_LARGE__ */
-
-#if Lrun_preinit_array
-;; This function is responsible for setting up the arguments
-;; required for __crt0_run_array, to run the functions in .preinit_array.
-START_CRT_FUNC 0500 run_preinit_array
-
-	mov_	#__preinit_array_start, R4
-	mov_	#__preinit_array_end, R5
-	mov_	#PTRsz, R6
-	call_	#__crt0_run_array
-
-END_CRT_FUNC	run_preinit_array
-#endif /* Lrun_preinit_array */
-
-#if Lrun_init_array
-;; This function is responsible for setting up the arguments
-;; required for __crt0_run_array, to run the functions in .init_array.
-START_CRT_FUNC 0600 run_init_array
-
-	mov_	#__init_array_start, R4
-	mov_	#__init_array_end, R5
-	mov_	#PTRsz, R6
-	call_	#__crt0_run_array
-
-END_CRT_FUNC	run_init_array
-#endif /* Lrun_init_array */
-
-
-#if Lmain
-;; This function is always included and calls main().
-
-START_CRT_FUNC 0800 call_main
-
-	clr.w	R12		; Set argc == 0
-	call_	#main
-
-END_CRT_FUNC	call_main
-#endif /* Lmain */
-
-#if Lcallexit
-;; This function is responsible for calling exit once main has finished.
-
-START_CRT_FUNC 0900 call_exit
-
-	call_	#_exit
-
-END_CRT_FUNC	call_exit
-#endif /* Lcallexit  */
-
-;----------------------------------------
-
-#if Lrun_fini_array
-;; This function is responsible for setting up the arguments
-;; required for __crt0_run_array, to run the functions in .fini_array.
-START_CRT_FUNC 1000 run_fini_array
-
-	mov_	#__fini_array_start, R4
-	mov_	#__fini_array_end, R5
-	mov_	#-PTRsz, R6
-	call_	#__crt0_run_array
-
-END_CRT_FUNC	run_fini_array
-#endif /* Lrun_fini_array */
-
-#if Lrun_array
-;; Note - this section is only included in the startup code of the application
-;; if it is needed by one of the above run_*_array functions.
-START_CRT_FUNC 1100 run_array
-
-	cmp_	R4, R5
-	jeq	_msp430_run_done
-	mov_	@R4, R7
-	add_	R6, R4
-	call_	R7
-	br_	#__crt0_run_array
-
-END_CRT_FUNC	run_array
-
-_msp430_run_done:
-	ret_
-#endif /* Lrun_array */
diff --git a/libgloss/msp430/crt_bss.S b/libgloss/msp430/crt_bss.S
index 27ab2efebbe5..e83ea984586f 100644
--- a/libgloss/msp430/crt_bss.S
+++ b/libgloss/msp430/crt_bss.S
@@ -1,19 +1,19 @@
-/* Copyright (c) 2012-2013 Red Hat Incorporated.
+/* Copyright (c) 2012-2015 Red Hat Incorporated.
    All rights reserved.
 
    Redistribution and use in source and binary forms, with or without
    modification, are permitted provided that the following conditions
-   are met: 
+   are met:
 
-     Redistributions of source code must retain the above copyright 
+     Redistributions of source code must retain the above copyright
      notice, this list of conditions and the following disclaimer.
 
      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.
 
-     The name of Red Hat Incorporated may not be used to endorse 
-     or promote products derived from this software without specific 
+     The name of Red Hat Incorporated may not 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
@@ -30,15 +30,17 @@
 
 #include "memmodel.h"
 
-	.section ".crt_bss", "ax", @progbits
+;; This function is responsible for initializing the contents of the
+;; .bss section.
+
+START_CRT_FUNC 0100 init_bss
 
-	.global __crt0_init_bss
-__crt0_init_bss:	
-	
 	mov_	#__bssstart, R12
 	clr.w	R13
-	mov.w	#__bsssize, R14
+	mov_	#__bsssize, R14
 #ifdef __MSP430X_LARGE__
-	clr.w	R15		; We assume that __bsssize is never > 64M
+	clr.w	R15		; We assume that __bsssize is never > 64K
 #endif
 	call_	#memset
+
+END_CRT_FUNC	init_bss
diff --git a/libgloss/msp430/crt_callexit.S b/libgloss/msp430/crt_callexit.S
new file mode 100644
index 000000000000..86a8ca63f0bf
--- /dev/null
+++ b/libgloss/msp430/crt_callexit.S
@@ -0,0 +1,39 @@
+/* Copyright (c) 2012-2015 Red Hat Incorporated.
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     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.
+
+     The name of Red Hat Incorporated may not 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 Red Hat
+   incorporated 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.  */
+
+#include "memmodel.h"
+
+;; This function is responsible for calling exit once main has finished.
+
+START_CRT_FUNC 0900 call_exit
+
+	call_	#_exit
+
+END_CRT_FUNC	call_exit
diff --git a/libgloss/msp430/crt_high_bss.S b/libgloss/msp430/crt_high_bss.S
new file mode 100644
index 000000000000..462c7aecb2c4
--- /dev/null
+++ b/libgloss/msp430/crt_high_bss.S
@@ -0,0 +1,51 @@
+/* Copyright (c) 2012-2015 Red Hat Incorporated.
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     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.
+
+     The name of Red Hat Incorporated may not 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 Red Hat
+   incorporated 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.  */
+
+#ifdef __MSP430X_LARGE__
+
+#include "memmodel.h"
+
+;; This function is responsible for initializing the contents of the
+;; .upper.bss section.
+
+START_CRT_FUNC 0200 init_highbss
+
+	mov_	#__high_bssstart, R12
+	mov.w	#0, R13
+	mov_	#__high_bsssize, R14
+	;; If __high_bsssize is zero then skip the call to memset.
+	;; This can happen if all of the bss data was placed into .either.bss.
+	cmp.w	#0, R14
+	jeq	1f
+	call_	#memset
+1:
+END_CRT_FUNC	init_highbss
+
+#endif /* __MSP430X_LARGE__ */
diff --git a/libgloss/msp430/crt_init.S b/libgloss/msp430/crt_init.S
new file mode 100644
index 000000000000..e83ea984586f
--- /dev/null
+++ b/libgloss/msp430/crt_init.S
@@ -0,0 +1,46 @@
+/* Copyright (c) 2012-2015 Red Hat Incorporated.
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     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.
+
+     The name of Red Hat Incorporated may not 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 Red Hat
+   incorporated 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.  */
+
+#include "memmodel.h"
+
+;; This function is responsible for initializing the contents of the
+;; .bss section.
+
+START_CRT_FUNC 0100 init_bss
+
+	mov_	#__bssstart, R12
+	clr.w	R13
+	mov_	#__bsssize, R14
+#ifdef __MSP430X_LARGE__
+	clr.w	R15		; We assume that __bsssize is never > 64K
+#endif
+	call_	#memset
+
+END_CRT_FUNC	init_bss
diff --git a/libgloss/msp430/crt_main.S b/libgloss/msp430/crt_main.S
new file mode 100644
index 000000000000..ee2094cf3230
--- /dev/null
+++ b/libgloss/msp430/crt_main.S
@@ -0,0 +1,40 @@
+/* Copyright (c) 2012-2015 Red Hat Incorporated.
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     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.
+
+     The name of Red Hat Incorporated may not 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 Red Hat
+   incorporated 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.  */
+
+#include "memmodel.h"
+
+;; This function is always included and calls main().
+
+START_CRT_FUNC 0800 call_main
+
+	clr.w	R12		; Set argc == 0
+	call_	#main
+
+END_CRT_FUNC	call_main
diff --git a/libgloss/msp430/crt_move_highdata.S b/libgloss/msp430/crt_move_highdata.S
new file mode 100644
index 000000000000..b96954962ab6
--- /dev/null
+++ b/libgloss/msp430/crt_move_highdata.S
@@ -0,0 +1,71 @@
+/* Copyright (c) 2012-2015 Red Hat Incorporated.
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     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.
+
+     The name of Red Hat Incorporated may not 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 Red Hat
+   incorporated 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.  */
+
+#ifdef __MSP430X_LARGE__
+
+#include "memmodel.h"
+
+;; This function is responsible for making sure that the
+;; contents of the .upper.data section have their correct startup values.
+;; If a copy of the .upper.data section is stored in ROM then this means
+;; copying the contents into HIFRAM.  If a copy of .upper.data is stored in a
+;; shadow section in HIFRAM then this means copying from the shadow section
+;; into the real section.
+
+START_CRT_FUNC 0400 move_highdata
+	;;  __rom_highdatacopysize may be zero.  Test this first because
+	;; its value may come from the weak definitions above and we do
+	;; not want to access the memory at address 0 pointed to by the
+	;; weak definition of __upper_data_init.
+	mov.w	#__rom_highdatacopysize, R14
+	cmp.w	#0, R14
+	jeq	3f
+
+	/* Test our status word.  */
+	cmpx.w  #0, &__upper_data_init
+	jeq	1f
+	/* Status word is non-zero - copy from shadow into upper.  */
+	mov_	#__high_datastart, R12
+	mov_	#__rom_highdatastart, R13
+	jmp	2f
+
+1:	/* Status word is zero.  Copy from upper to shadow and change status word.  */
+	movx.w  #1, &__upper_data_init
+	mov_	#__rom_highdatastart, R12
+	mov_	#__high_datastart, R13
+
+2:	;; __rom_highdatacopysize may be zero.  memmove should cope.
+	mov.w	#__rom_highdatacopysize, R14
+
+	call_	#memmove
+3:
+END_CRT_FUNC	move_highdata
+
+#endif /* __MSP430X_LARGE__ */
diff --git a/libgloss/msp430/crt_movedata.S b/libgloss/msp430/crt_movedata.S
new file mode 100644
index 000000000000..de0f519907cc
--- /dev/null
+++ b/libgloss/msp430/crt_movedata.S
@@ -0,0 +1,50 @@
+/* Copyright (c) 2012-2015 Red Hat Incorporated.
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     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.
+
+     The name of Red Hat Incorporated may not 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 Red Hat
+   incorporated 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.  */
+
+#include "memmodel.h"
+
+;; This function is responsible for copying the
+;; contents of the .data section from its load address (in ROM) to
+;; its run-time address (in RAM).
+
+START_CRT_FUNC 0300 movedata
+
+	mov_	#__datastart, R12
+	mov_	#__romdatastart, R13
+
+	;;  memmove and memcpy do not currently work when src == dst
+	cmp_	R12, R13
+	jeq	1f
+
+	mov_	#__romdatacopysize, R14
+
+	call_	#memmove
+1:
+END_CRT_FUNC	movedata
diff --git a/libgloss/msp430/crt_run_array.S b/libgloss/msp430/crt_run_array.S
new file mode 100644
index 000000000000..6f9bf07a5ab0
--- /dev/null
+++ b/libgloss/msp430/crt_run_array.S
@@ -0,0 +1,48 @@
+/* Copyright (c) 2012-2015 Red Hat Incorporated.
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     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.
+
+     The name of Red Hat Incorporated may not 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 Red Hat
+   incorporated 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.  */
+
+#include "memmodel.h"
+
+;; Note - this section is only included in the startup code of the application
+;; if it is needed by one of the above run_*_array functions.
+
+START_CRT_FUNC 1100 run_array
+
+	cmp_	R4, R5
+	jeq	_msp430_run_done
+	mov_	@R4, R7
+	add_	R6, R4
+	call_	R7
+	br_	#__crt0_run_array
+
+END_CRT_FUNC	run_array
+
+_msp430_run_done:
+	ret_
diff --git a/libgloss/msp430/crt_run_fini_array.S b/libgloss/msp430/crt_run_fini_array.S
new file mode 100644
index 000000000000..c68b1e3e02c0
--- /dev/null
+++ b/libgloss/msp430/crt_run_fini_array.S
@@ -0,0 +1,43 @@
+/* Copyright (c) 2012-2015 Red Hat Incorporated.
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     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.
+
+     The name of Red Hat Incorporated may not 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 Red Hat
+   incorporated 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.  */
+
+#include "memmodel.h"
+
+;; This function is responsible for setting up the arguments
+;; required for __crt0_run_array, to run the functions in .fini_array.
+
+START_CRT_FUNC 1000 run_fini_array
+
+	mov_	#__fini_array_start, R4
+	mov_	#__fini_array_end, R5
+	mov_	#-PTRsz, R6
+	call_	#__crt0_run_array
+
+END_CRT_FUNC	run_fini_array
diff --git a/libgloss/msp430/crt_run_init_array.S b/libgloss/msp430/crt_run_init_array.S
new file mode 100644
index 000000000000..002507532b7a
--- /dev/null
+++ b/libgloss/msp430/crt_run_init_array.S
@@ -0,0 +1,43 @@
+/* Copyright (c) 2012-2015 Red Hat Incorporated.
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     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.
+
+     The name of Red Hat Incorporated may not 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 Red Hat
+   incorporated 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.  */
+
+#include "memmodel.h"
+
+;; This function is responsible for setting up the arguments
+;; required for __crt0_run_array, to run the functions in .init_array.
+
+START_CRT_FUNC 0600 run_init_array
+
+	mov_	#__init_array_start, R4
+	mov_	#__init_array_end, R5
+	mov_	#PTRsz, R6
+	call_	#__crt0_run_array
+
+END_CRT_FUNC	run_init_array
diff --git a/libgloss/msp430/crt_run_preinit_array.S b/libgloss/msp430/crt_run_preinit_array.S
new file mode 100644
index 000000000000..db2e09ef5996
--- /dev/null
+++ b/libgloss/msp430/crt_run_preinit_array.S
@@ -0,0 +1,43 @@
+/* Copyright (c) 2012-2015 Red Hat Incorporated.
+   All rights reserved.
+
+   Redistribution and use in source and binary forms, with or without
+   modification, are permitted provided that the following conditions
+   are met:
+
+     Redistributions of source code must retain the above copyright
+     notice, this list of conditions and the following disclaimer.
+
+     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.
+
+     The name of Red Hat Incorporated may not 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 Red Hat
+   incorporated 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.  */
+
+#include "memmodel.h"
+
+;; This function is responsible for setting up the arguments
+;; required for __crt0_run_array, to run the functions in .preinit_array.
+
+START_CRT_FUNC 0500 run_preinit_array
+
+	mov_	#__preinit_array_start, R4
+	mov_	#__preinit_array_end, R5
+	mov_	#PTRsz, R6
+	call_	#__crt0_run_array
+
+END_CRT_FUNC	run_preinit_array
diff --git a/libgloss/msp430/memmodel.h b/libgloss/msp430/memmodel.h
index a481460c6d63..9fba60190d61 100644
--- a/libgloss/msp430/memmodel.h
+++ b/libgloss/msp430/memmodel.h
@@ -40,10 +40,16 @@
 #endif
 
 /* Start a function in its own named and numbered section, so that it
-   can be subject to linker garbage collection.  The numbers are used
-   to enforce link-time ordering of the sections.  Note - the construction
-   of the symbol names is critical - they need to match the unresolved
-   symbol references created by the compiler and assembler.  */
+   can be subject to linker garbage collection.
+
+   The linker links all .crt_* sections in asciibetical order at the same place.
+   So, the four digits in .crt_NNNN_xxx name are used to enforce link-time
+   ordering of the sections.  Make sure to keep them in sequential order.  The
+   first two digits are set in the files, the second two allow users to insert
+   code between our standard code fragments.
+
+   Note - the construction of the symbol names is critical - they need to match
+   the unresolved symbol references created by the compiler and assembler.  */
 .macro START_CRT_FUNC number name 
 	.section .crt_\number\name,"ax",@progbits
 	.global __crt0_\name
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 4/5] libgloss: msp430: delete custom .S.o rule
  2023-12-27  3:24 [PATCH 1/5] libgloss: msp430: delete outdated/wrong code Mike Frysinger
  2023-12-27  3:24 ` [PATCH 2/5] libgloss: msp430: delete stub crt_init.o Mike Frysinger
  2023-12-27  3:24 ` [PATCH 3/5] libgloss: msp430: split up crt0.S source Mike Frysinger
@ 2023-12-27  3:24 ` Mike Frysinger
  2023-12-27  3:24 ` [PATCH 5/5] libgloss: merge msp430 into top-level Makefile Mike Frysinger
  3 siblings, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2023-12-27  3:24 UTC (permalink / raw)
  To: newlib

This was added to specify -Wa,-gdwarf2 when compiling the assembly
files.  Considering the size of these .S files, it seems unnecessary
overkill and complicates the build system.  All but one of these
compile down to 6 or fewer lines, and those hardly need extra debug
for anyone who is poking msp430 assembly.  The 1 file that is larger
than that (crt_move_highdata.S) is still <15 insns.

This will also simplify merging it into the top-level Makefile.
---
 libgloss/msp430/Makefile.in | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/libgloss/msp430/Makefile.in b/libgloss/msp430/Makefile.in
index ccf94dc1625f..62c8a280bcaa 100644
--- a/libgloss/msp430/Makefile.in
+++ b/libgloss/msp430/Makefile.in
@@ -96,10 +96,6 @@ CRT_OBJS = \
 
 all: $(CRT) $(SIM_BSP) $(LIB_NOSYS) $(LIB_CRT) copy_scripts_to_objdir
 
-# Override .S.o rule to pass assembler debugging flags
-.S.o:
-	$(CC) -Wa,-gdwarf2 -Wa,-I$(srcdir) $(CFLAGS_FOR_TARGET) $(INCLUDES) $(CFLAGS) -c $<
-
 $(SIM_BSP): $(SIM_OBJS)
 	$(AR) $(ARFLAGS) $@ $?
 	$(RANLIB) $@
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 5/5] libgloss: merge msp430 into top-level Makefile
  2023-12-27  3:24 [PATCH 1/5] libgloss: msp430: delete outdated/wrong code Mike Frysinger
                   ` (2 preceding siblings ...)
  2023-12-27  3:24 ` [PATCH 4/5] libgloss: msp430: delete custom .S.o rule Mike Frysinger
@ 2023-12-27  3:24 ` Mike Frysinger
  3 siblings, 0 replies; 5+ messages in thread
From: Mike Frysinger @ 2023-12-27  3:24 UTC (permalink / raw)
  To: newlib

Avoid a recursive make to speed things up a bit.
A msp430-elf build shows installed objects & libs produce same code.
---
 libgloss/Makefile.am         |   3 +
 libgloss/Makefile.in         | 259 +++++++++++++++++++++++++++--------
 libgloss/configure           |  19 ++-
 libgloss/configure.ac        |   7 +-
 libgloss/msp430/Makefile.in  | 166 ----------------------
 libgloss/msp430/Makefile.inc |  52 +++++++
 6 files changed, 276 insertions(+), 230 deletions(-)
 delete mode 100644 libgloss/msp430/Makefile.in
 create mode 100644 libgloss/msp430/Makefile.inc

diff --git a/libgloss/Makefile.am b/libgloss/Makefile.am
index 92da21efd2ef..6bfff4bd2e1e 100644
--- a/libgloss/Makefile.am
+++ b/libgloss/Makefile.am
@@ -96,6 +96,9 @@ endif
 if CONFIG_MOXIE
 include moxie/Makefile.inc
 endif
+if CONFIG_MSP430
+include msp430/Makefile.inc
+endif
 if CONFIG_NIOS2
 include nios2/Makefile.inc
 endif
diff --git a/libgloss/configure.ac b/libgloss/configure.ac
index bc4421393d5c..a3b191a71e18 100644
--- a/libgloss/configure.ac
+++ b/libgloss/configure.ac
@@ -200,8 +200,7 @@ case "${target}" in
 	subdirs="$subdirs m32c"
 	;;
   msp430-*-elf*)
-	AC_CONFIG_FILES([msp430/Makefile])
-	subdirs="$subdirs msp430"
+	config_msp430=true
 	config_libnosys=false
 	;;
   rl78*-*-elf)
@@ -247,8 +246,8 @@ AC_SUBST(subdirs)
 dnl These subdirs have converted to non-recursive make.  Hopefully someday all
 dnl the ports above will too!
 m4_foreach_w([SUBDIR], [
-  aarch64 arc arm bfin csky d30v i960 iq2000 libnosys lm32 moxie nios2 riscv
-  v850 wince xtensa
+  aarch64 arc arm bfin csky d30v i960 iq2000 libnosys lm32 moxie msp430 nios2
+  riscv v850 wince xtensa
 ], [dnl
   AM_CONDITIONAL([CONFIG_]m4_toupper(SUBDIR), [test x$config_]SUBDIR = xtrue)
 ])
diff --git a/libgloss/msp430/Makefile.in b/libgloss/msp430/Makefile.in
deleted file mode 100644
index 62c8a280bcaa..000000000000
--- a/libgloss/msp430/Makefile.in
+++ /dev/null
@@ -1,166 +0,0 @@
-# Copyright (c) 2008-2014 Red Hat, Inc. All rights reserved.
-#
-# This copyrighted material is made available to anyone wishing to use, modify,
-# copy, or redistribute it subject to the terms and conditions of the BSD
-# License.   This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties
-# of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  A copy of this license
-# is available at http://www.opensource.org/licenses. Any Red Hat trademarks that
-# are incorporated in the source code or documentation are not subject to the BSD
-# License and may only be used or replicated with the express permission of
-# Red Hat, Inc.
-
-# Makefile for libgloss/msp430.
-
-DESTDIR =
-VPATH = @srcdir@
-srcdir = @srcdir@
-objdir = .
-srcroot = $(srcdir)/../..
-objroot = $(objdir)/../..
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-host_alias = @host_alias@
-target_alias = @target_alias@
-
-bindir = @bindir@
-libdir = @libdir@
-tooldir = $(exec_prefix)/$(target_alias)
-
-# Multilib support variables.
-# TOP is used instead of MULTI{BUILD,SRC}TOP.
-MULTIDIRS =
-MULTISUBDIR =
-MULTIDO = true
-MULTICLEAN = true
-
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-
-SHELL = /bin/sh
-
-CC = @CC@
-
-AS = @AS@
-AR = @AR@
-LD = @LD@
-RANLIB = @RANLIB@
-AR_FLAGS = rc
-
-OBJDUMP = `if [ -f ${objroot}/../binutils/objdump ] ; \
-	then echo ${objroot}/../binutils/objdump ; \
-	else t='$(program_transform_name)'; echo objdump | sed -e $$t ; fi`
-OBJCOPY = `if [ -f ${objroot}/../binutils/objcopy ] ; \
-	then echo ${objroot}/../binutils/objcopy ; \
-	else t='$(program_transform_name)'; echo objcopy | sed -e $$t ; fi`
-
-SCRIPTS  = $(srcdir)/msp430-sim.ld
-SCRIPTS += $(srcdir)/msp430xl-sim.ld
-SCRIPTS += $(srcdir)/intr_vectors.ld
-
-CRT = gcrt0.o crt0.o
-SIM_BSP = libsim.a
-LIB_NOSYS = libnosys.a
-LIB_CRT = libcrt.a
-
-SIM_OBJS = syscalls.o \
-	cio.o \
-	write.o \
-	unlink.o \
-	sbrk.o
-
-NOSYS_OBJS = ciosyscalls.o \
-	cio.o \
-	write.o \
-	unlink.o \
-	sbrk.o
-
-CRT_OBJS = \
-	crt_bss.o \
-	crt_high_bss.o \
-	crt_movedata.o \
-	crt_move_highdata.o \
-	crt_main.o \
-	crt_callexit.o \
-	crt_run_init_array.o \
-	crt_run_preinit_array.o \
-	crt_run_fini_array.o \
-	crt_run_array.o
-
-#### Host specific Makefile fragment comes in here.
-@host_makefile_frag@
-
-
-all: $(CRT) $(SIM_BSP) $(LIB_NOSYS) $(LIB_CRT) copy_scripts_to_objdir
-
-$(SIM_BSP): $(SIM_OBJS)
-	$(AR) $(ARFLAGS) $@ $?
-	$(RANLIB) $@
-
-$(LIB_NOSYS): $(NOSYS_OBJS)
-	$(AR) $(ARFLAGS) $@ $?
-	$(RANLIB) $@
-
-$(LIB_CRT): $(CRT_OBJS)
-	$(AR) $(ARFLAGS) $@ $?
-	$(RANLIB) $@
-
-copy_scripts_to_objdir: $(SCRIPTS)
-	cp $(SCRIPTS) $(objdir)
-
-# Dependencies
-
-SDEPS = $(srcdir)/cio.h
-
-abort.o : $(SDEPS)
-argv.o : $(SDEPS)
-argvlen.o : $(SDEPS)
-chdir.o : $(SDEPS)
-chmod.o : $(SDEPS)
-close.o : $(SDEPS)
-exit.o : $(SDEPS)
-fstat.o : $(SDEPS)
-getpid.o : $(SDEPS)
-gettimeofday.o : $(SDEPS)
-gcrt0.o: gcrt0.S crt0.S
-kill.o : $(SDEPS)
-link.o : $(SDEPS)
-lseek.o : $(SDEPS)
-mcount.o : $(SDEPS)
-open.o : $(SDEPS)
-read.o : $(SDEPS)
-sigprocmask.o : $(SDEPS)
-sleep.o : $(SDEPS)
-stat.o : $(SDEPS)
-time.o : $(SDEPS)
-times.o : $(SDEPS)
-unlink.o : $(SDEPS)
-utime.o : $(SDEPS)
-write.o : $(SDEPS)
-
-install: $(CRT) $(SIM_BSP) $(LIB_NOSYS) $(LIB_CRT) $(SCRIPTS)
-	mkdir -p $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}
-	for c in $(CRT) $(SIM_BSP) $(LIB_NOSYS) $(LIB_CRT); do \
-	  $(INSTALL_DATA) $$c $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$c ;\
-	done
-	for c in $(SCRIPTS); do \
-	  b=`basename $$c`; \
-	  $(INSTALL_DATA) $$c $(DESTDIR)$(tooldir)/lib${MULTISUBDIR}/$$b ;\
-	done
-
-clean mostlyclean:
-	rm -f *.o *.a
-
-distclean maintainer-clean realclean: clean
-	rm -f Makefile
-
-.PHONY: info dvi doc install-info clean-info
-info doc dvi:
-install-info:
-clean-info:
-
-Makefile: Makefile.in ../config.status
-	cd .. && $(SHELL) config.status
diff --git a/libgloss/msp430/Makefile.inc b/libgloss/msp430/Makefile.inc
new file mode 100644
index 000000000000..38355343ad9f
--- /dev/null
+++ b/libgloss/msp430/Makefile.inc
@@ -0,0 +1,52 @@
+## Copyright (c) 2008-2014 Red Hat, Inc. All rights reserved.
+##
+## This copyrighted material is made available to anyone wishing to use, modify,
+## copy, or redistribute it subject to the terms and conditions of the BSD
+## License.   This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY expressed or implied, including the implied warranties
+## of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  A copy of this license
+## is available at http://www.opensource.org/licenses. Any Red Hat trademarks that
+## are incorporated in the source code or documentation are not subject to the BSD
+## License and may only be used or replicated with the express permission of
+## Red Hat, Inc.
+
+multilibtool_DATA += \
+	%D%/msp430-sim.ld \
+	%D%/msp430xl-sim.ld \
+	%D%/intr_vectors.ld
+
+multilibtool_DATA += \
+	%D%/gcrt0.o \
+	%D%/crt0.o
+libobjs_a_SOURCES += \
+	%D%/gcrt0.S \
+	%D%/crt0.S
+
+multilibtool_LIBRARIES += %D%/libsim.a
+%C%_libsim_a_SOURCES = \
+	%D%/syscalls.S \
+	%D%/cio.S \
+	%D%/write.c \
+	%D%/unlink.c \
+	%D%/sbrk.c
+
+multilibtool_LIBRARIES += %D%/libnosys.a
+%C%_libnosys_a_SOURCES = \
+	%D%/ciosyscalls.S \
+	%D%/cio.S \
+	%D%/write.c \
+	%D%/unlink.c \
+	%D%/sbrk.c
+
+multilibtool_LIBRARIES += %D%/libcrt.a
+%C%_libcrt_a_SOURCES = \
+	%D%/crt_bss.S \
+	%D%/crt_high_bss.S \
+	%D%/crt_movedata.S \
+	%D%/crt_move_highdata.S \
+	%D%/crt_main.S \
+	%D%/crt_callexit.S \
+	%D%/crt_run_init_array.S \
+	%D%/crt_run_preinit_array.S \
+	%D%/crt_run_fini_array.S \
+	%D%/crt_run_array.S
-- 
2.43.0


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2023-12-27  3:25 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-27  3:24 [PATCH 1/5] libgloss: msp430: delete outdated/wrong code Mike Frysinger
2023-12-27  3:24 ` [PATCH 2/5] libgloss: msp430: delete stub crt_init.o Mike Frysinger
2023-12-27  3:24 ` [PATCH 3/5] libgloss: msp430: split up crt0.S source Mike Frysinger
2023-12-27  3:24 ` [PATCH 4/5] libgloss: msp430: delete custom .S.o rule Mike Frysinger
2023-12-27  3:24 ` [PATCH 5/5] libgloss: merge msp430 into top-level Makefile Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).