Commit Graph

13 Commits

Author SHA1 Message Date
Mike Frysinger 754f8def0d libgloss: merge stub arch configure scripts up a level
For about half the ports, we don't need a subdir configure script.
They're using the config/default.m[ht] rules, and they aren't doing
any unique configure tests, so they exist just to pass top-level
settings down to create the arch Makefile.  We can just as easily
do that from the top-level Mkaefile directly and skip configure.

Most of the remaining configure scripts could be migrated up to
the top-level too, but that would require care in each subdir.
So let's be lazy and put that off to another day.
2022-01-26 04:32:54 -05:00
Jozef Lawrynowicz 0574317971 MSP430: Add missing build rule for unlink() to libgloss Makefile 2019-10-25 18:04:46 +02:00
Jozef Lawrynowicz 884b05b54e MSP430: Remove .init/.fini sections
The .init/.fini sections are not required for msp430-elf, and add unnecessary
code bloat to the CRT library. These sections are specified as "unused" by
the MSP430 EABI.

.init existed to call __crt0_run_{init,preinit}_array which run through
the functions in .{init,preinit}_array.
__crt0_run_{init,preinit}_array are already dynamically included like the
other crt0 functions, so these can be placed before the call to main,
which ensures they are still called if needed.
With these functions moved, .init has no purpose and can be removed.

.fini existed to call __crt0_run_fini_array.
However, the "__msp430_fini" symbol which marks the start of .fini has
never been used, so no termination routines have ever been run for
msp430. On returning from main(), _exit() is called which just loops
forever.
So there is no current expectation that __crt0_run_fini_array will
get called by the CRT code. Further work is to ensure functions
registered with atexit can be optionally called during program termination,
and then __crt0_run_fini_array can be registered with atexit during
program initialization.

The mechanisms for supporting the "-minrt" option have also been removed.
"-minrt" enabled a "minimum runtime environment" by removing calls to
functions which run global static initializers and constructors. Since
this behaviour is now dynamic, and these functions are only included
when needed, the minrt versions of the CRT object files are no longer
required.
2019-07-24 16:22:00 -04:00
Jozef Lawrynowicz f811485ffb MSP430: Make the inclusion of run_*_array fns depend on defined assembler symbols
Many of the MSP430 crt functions (e.g. to initialize bss) are linked
"dynamically", based on symbols defined in the program.
The GNU assembler defines the symbols corresponding to the crt
functions by examining the section names in the input file.

If GCC has been configured with --enable-initfini-array, then
.init_array and .fini_array will hold pointers to global
constructors/destructors. These sections can also hold functions that
need to be executed for other purposes.

The attached patch puts the __crt0_run_{preinit,init,fini}_array and
__crt0_run_array functions in their own object files, so they will
only be linked when needed.

Successfully regtested the DejaGNU GCC testsuite using the binutils and
newlib changes together with GCC trunk configured with
--enable-initfini-array.
2019-04-18 10:29:24 +02:00
DJ Delorie 7d5b16ab9a Build msp430-specific libnosys
The MSP430 debuggers support I/O on hardware through CIO, so
we can use a CIO-enabled library as the "nosys" library (in
addition to the libsim library, which talks to our simulator)

* configure.in: Don't build default libnosys for msp430
* configure: Regenerate.
* msp430/Makefile: Rename libcio to libnosys.
2015-12-17 16:51:41 -05:00
Nick Clifton baa681fd38 Adds support for placing MSP430 code and data into either low memory or high memory.
* msp430/msp430.ld: Delete.
	* msp430/msp430F5438A-l.ld: Delete.
	* msp430/msp430F5438A-s.ld: Delete.
	* msp430/crt_movedata.S: Delete.

	* msp430/Makefile.in (SCRIPTS): Remove msp430.ld.
	(CRT_OBJS): Add crt_move_highdata.o.
	* msp430/memmodel.h (START_CRT_FUNC): New macro.
	(END_CRT_FUNC): New macro.
	(WEAK_DEF): New macro.
	* msp430/crt0.S: Use new macros.
	(move_highdata): New code to initialise the .data section if it is
	held in high memory.

	* msp430/msp430-sim.ld (.data): Add .either.data.
	(.rodata2): Move some read-only data sections here.
	(.text): Add .either.text.
	(.rodata): Add .either.rodata.
	(.bss): Add .either.bss.
	* msp430/msp430xl-sim.ld (MEMORY): Add HIROM.
	(.rodata2): Move some read-only data sections here.
	(.upper.data): New section.  Include notes about how to initialise
	it.
2015-05-27 13:30:19 +02:00
Nick Clifton b7d6a7c805 * msp430/Makefile.in (CRT_OBJS): Add crt_high_bss.o.
* msp430/crt0.S (high_bss): Add.
	* msp430/msp430-sim.ld: Add error message if .upper sections are
	detected.
	* msp430/msp430xl-sim.ld (MEMORY): Adjust to better mimic real
	life MCUs.  Add support for upper and lower sections.
2014-11-13 10:18:57 +00:00
DJ Delorie 787fa74125 2014-10-22 Tim Harder <radhermit@gmail.com>
* msp430/Makefile.in: respect DESTDIR during install
2014-10-23 01:49:49 +00:00
Nick Clifton c30356443e * configure.in: Remove config_libnosys=false
* configure: Regenerated.
	* msp430/nosyscalls.S: Rename to ciosyscalls.S
	* msp430/Makefile.in: Change LIBNOSYS to LIB_CIO.
2014-09-22 15:26:46 +00:00
Nick Clifton 179e25f0df * msp430/Makefile.in (NOSYS_OBJS): Add unlink.o.
(SCRIPTS): Remove msp430F5438A-s.ld and msp430F5438A-s.ld.
	* unlink.c: New file.
2014-04-30 11:30:14 +00:00
DJ Delorie ed94d4a4aa * msp430/Makefile.in (crt0-minrt.o, crtn-minrt.o): New. Build
from crt0.S with -DMINRT.
(CRT_OBJS): Expand.
(crt_%.o): New rule pattern.  Build multiple objects from crt0.S.
* msp430/crt0.S: Further break out functionality.  Support -DMINRT
that omits all init/fini logic.
* msp430/crtn.S: Likewise.
* msp430/msp430-sim.ld: Wildcard all .crt_* sections, sorted.
* msp430/msp430.ld: Likewise.
* msp430/msp430xl-sim.ld: Likewise.
2014-01-30 02:46:34 +00:00
Nick Clifton 796a9241b3 * msp430/Makefile.in (SCRIPTS): Add intr_vectors.ld.
(LIB_CRT): New.
	(CRT_OBJS): New.
	(all): Add dependency upon LIB_CRT.
	(install): Likewise.
	* msp430/msp430-sim.ld: Include intr_vectors.ld.
	KEEP crt code, lowtext code and tm_clone_table.
	Separate the noinit section from the .bss section.
	Allow for extended .debug_line sections.
	* msp430/msp430.ld: Likewise.
	* msp430/msp430F5438A-l.ld: Likewise.
	* msp430/msp430F5438A-s.ld: Likewise.
	* msp430/msp430xl-sim.ld: Likewise
.	* msp430/crt_movedata.S: New.
	* msp430/crt_bss.S: New.
	* msp430/intr_vectors.ld: New.
2013-09-18 07:38:13 +00:00
DJ Delorie 2f2a304234 [newlib]
* configure.host (msp430): Add.
* libc/include/machine/ieeefp.h: Add MSP430 support.
* libc/include/machine/setjmp.h: Likewise.
* libc/include/sys/config.h: Likewise.
* libc/machine/configure.in (msp430): Add.
* libc/machine/configure: Regenerate.
* libc/machine/msp430: New directory.

[libgloss]
* configure.in (msp430*-*-elf): Add.
* configure: Regenerate.
* msp430: New directory.
2013-05-13 21:39:51 +00:00