|
@@ -189,84 +189,6 @@ static void * __attribute_used__ _dl_start(unsigned long args)
|
|
|
* we can take advantage of the magic offset register, if we
|
|
|
* happen to know what that is for this architecture. If not,
|
|
|
* we can always read stuff out of the ELF file to find it... */
|
|
|
-#if 0
|
|
|
-#if defined(__i386__)
|
|
|
- __asm__("\tmovl %%ebx,%0\n\t":"=a"(got));
|
|
|
-#elif defined(__m68k__)
|
|
|
- __asm__("movel %%a5,%0":"=g"(got));
|
|
|
-#elif defined(__sparc__)
|
|
|
- __asm__("\tmov %%l7,%0\n\t":"=r"(got));
|
|
|
-#elif defined(__arm__)
|
|
|
- __asm__("\tmov %0, r10\n\t":"=r"(got));
|
|
|
-#elif defined(__powerpc__)
|
|
|
- __asm__("\tbl _GLOBAL_OFFSET_TABLE_-4@local\n\t":"=l"(got));
|
|
|
-#elif defined(__mips__)
|
|
|
- __asm__("\tmove %0, $28\n\tsubu %0,%0,0x7ff0\n\t":"=r"(got));
|
|
|
-#elif defined(__sh__) && !defined(__SH5__)
|
|
|
- __asm__(
|
|
|
- " mov.l 1f, %0\n"
|
|
|
- " mova 1f, r0\n"
|
|
|
- " bra 2f\n"
|
|
|
- " add r0, %0\n"
|
|
|
- " .balign 4\n"
|
|
|
- "1: .long _GLOBAL_OFFSET_TABLE_\n"
|
|
|
- "2:" : "=r" (got) : : "r0");
|
|
|
-#elif defined(__cris__)
|
|
|
- __asm__("\tmove.d $pc,%0\n\tsub.d .:GOTOFF,%0\n\t":"=r"(got));
|
|
|
-#else
|
|
|
-
|
|
|
- {
|
|
|
- unsigned long tx_reloc;
|
|
|
- Elf32_Dyn *dynamic = NULL;
|
|
|
- Elf32_Shdr *shdr;
|
|
|
- Elf32_Phdr *pt_load;
|
|
|
-
|
|
|
-#ifdef __SUPPORT_LD_DEBUG_EARLY__
|
|
|
- SEND_STDERR("Finding the GOT using C code to read the ELF file\n");
|
|
|
-#endif
|
|
|
-
|
|
|
- shdr = (Elf32_Shdr *) (header->e_shoff + (char *) header);
|
|
|
- for (indx = header->e_shnum; --indx >= 0; ++shdr) {
|
|
|
- if (shdr->sh_type == SHT_DYNAMIC) {
|
|
|
- goto found_dynamic;
|
|
|
- }
|
|
|
- }
|
|
|
- SEND_STDERR("missing dynamic linking information section \n");
|
|
|
- _dl_exit(0);
|
|
|
-
|
|
|
-found_dynamic:
|
|
|
- dynamic = (Elf32_Dyn *) (shdr->sh_offset + (char *) header);
|
|
|
-
|
|
|
-
|
|
|
- pt_load = (Elf32_Phdr *) (header->e_phoff + (char *) header);
|
|
|
- for (indx = header->e_phnum; --indx >= 0; ++pt_load) {
|
|
|
- if (pt_load->p_type == PT_LOAD) {
|
|
|
- goto found_pt_load;
|
|
|
- }
|
|
|
- }
|
|
|
- SEND_STDERR("missing loadable program segment\n");
|
|
|
- _dl_exit(0);
|
|
|
-
|
|
|
-found_pt_load:
|
|
|
-
|
|
|
- tx_reloc = pt_load->p_vaddr - pt_load->p_offset;
|
|
|
- for (; DT_NULL != dynamic->d_tag; ++dynamic) {
|
|
|
- if (dynamic->d_tag == DT_PLTGOT) {
|
|
|
- goto found_got;
|
|
|
- }
|
|
|
- }
|
|
|
- SEND_STDERR("missing global offset table\n");
|
|
|
- _dl_exit(0);
|
|
|
-
|
|
|
-found_got:
|
|
|
- got = (unsigned long *) (dynamic->d_un.d_val - tx_reloc +
|
|
|
- (char *) header);
|
|
|
- }
|
|
|
-#endif
|
|
|
-
|
|
|
-
|
|
|
- dpnt = (Elf32_Dyn *) (*got + load_addr);
|
|
|
-#endif
|
|
|
got = elf_machine_dynamic();
|
|
|
dpnt = (Elf32_Dyn *) (got + load_addr);
|
|
|
#ifdef __SUPPORT_LD_DEBUG_EARLY__
|