From b8fcdddcbb192fc367ff04bbd753b9deb69b09f3 Mon Sep 17 00:00:00 2001 From: Waldemar Brodkorb Date: Sat, 28 May 2016 18:12:58 +0200 Subject: nios2: sync support with glibc Only static linking is supported for now. More debugging and analyzing for ld.so, TLS and NPTL is required. But at least you can bootup a static root fileystem in Qemu. --- ldso/ldso/nios2/dl-startup.h | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 ldso/ldso/nios2/dl-startup.h (limited to 'ldso/ldso/nios2/dl-startup.h') diff --git a/ldso/ldso/nios2/dl-startup.h b/ldso/ldso/nios2/dl-startup.h new file mode 100644 index 000000000..982e55532 --- /dev/null +++ b/ldso/ldso/nios2/dl-startup.h @@ -0,0 +1,34 @@ +__asm__ ("\ + .text\n\ + .globl _start\n\ + .type _start, %function\n\ +_start:\n\ + mov r4, sp\n\ + br _dl_start\n\ + mov r16, r4\n\ + jmp r16\n\ +"); + +/* + * Get a pointer to the argv array. On many platforms this can be just + * the address of the first argument, on other platforms we need to + * do something a little more subtle here. + */ +#define GET_ARGV(ARGVP, ARGS) ARGVP = (((unsigned long*) ARGS)+1) + +/* The ld.so library requires relocations */ +#define ARCH_NEEDS_BOOTSTRAP_RELOCS + +static __always_inline +void PERFORM_BOOTSTRAP_RELOC(ELF_RELOC *rpnt, unsigned long *reloc_addr, + unsigned long symbol_addr, unsigned long load_addr, attribute_unused Elf32_Sym *symtab) +{ + switch (ELF_R_TYPE(rpnt->r_info)) { + case R_NIOS2_RELATIVE: + *reloc_addr = load_addr + rpnt->r_addend; + break; + default: + _dl_exit(1); + break; + } +} -- cgit v1.2.3