{libdl,nptl}/Makefile.in: Add $(SYMBOL_PREFIX) to -init,-fini symbols

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
nptl/allocatestack.c: Fix stack mprotect alignment for STACK_GROWS_UP

mprotect() expects the first argument to be aligned to a page boundary.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
elf: Add ELF magic number and relocations for the Meta architecture

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
ldd: Add MATCH_MACHINE definition for Meta

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
Add support for the Meta architecture

Meta cores are 32-bit, hardware multithreaded, general purpose, embedded
processors which also feature a DSP instruction set, and can be found in
many digital radios. They are capable of running different operating
systems on different hardware threads, for example a digital radio might
run RTOSes for DAB decoding and audio decoding on 3 hardware threads,
and run Linux on the 4th hardware thread to manage the user interface,
networking etc. HTPs are also capable of running SMP Linux on multiple
hardware threads.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
libm: Add support for the Meta architecture

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
metag: Add support for loading shared objects into core memories.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
extra/locale: Mark __codeset_8_bit_t as packed for Meta

gen_ldc writes offsets into the __locale_mmap_t structure. This
relies on the host system having the same struct offsets as the
target. On Meta, the structs are always aligned to a multiple of
4 bytes, and for these targets it is required for the struct to
be packed so that it is more likely to match the host system
(typically x86 which does not align structs).

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
metag: Add NPTL support

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>
sched_setaffinity: Don't use function calls as arguments to INTERNAL_SYSCALL.

This patch fixes a bug in sched_setaffinity() for Meta where the affinity
argument was ignored when trying to set a process's scheduling
affinity.

INTERNAL_SYSCALL places its arguments in the argument registers in
preparation for a system call, e.g.

	    register int arg1 __asm__ ("D1Ar1") = _arg1;
	    register int arg2 __asm__ ("D0Ar2") = _arg2;

The problem comes when a function call is passed as an argment to
INTERNAL_SYSCALL and the following code results,

	    register int arg1 __asm__ ("D1Ar1") = _arg1;
	    register int arg2 __asm__ ("D0Ar2") = _arg2;
	    register int arg3 __asm__ ("D1Ar3") = func();

Now, because the compiler is smart enough to figure out the argument
registers are not preserved across a function call, and that "func"
takes no arguments, the assignments to D1Ar1 and D0Ar2 are dead code
and the compiler eliminates them. Consequently, the syscall is
performed with garbage arguments in D1Ar1 and D0Ar2.

The solution is to use a temporary variable in which we store the
result of func() and assign that temporary variable to D1Ar3.

Signed-off-by: Markos Chandras <markos.chandras@imgtec.com>