• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisãocb9d1f53717dd67892ba943626f3d1b46f3e760b (tree)
Hora2019-11-06 12:33:56
AutorWaldemar Brodkorb <wbx@open...>
CommiterWaldemar Brodkorb

Mensagem de Log

riscv64: lazy relocations do not work like sparc/m68k

Mudança Sumário

Diff

--- a/ldso/ldso/riscv64/elfinterp.c
+++ b/ldso/ldso/riscv64/elfinterp.c
@@ -226,6 +226,8 @@ _dl_do_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope,
226226 return 0;
227227 }
228228
229+#undef __RISCV_LAZY_RELOC_WORKS
230+#ifdef __RISCV_LAZY_RELOC_WORKS
229231 static int
230232 _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope,
231233 ELF_RELOC *rpnt, ElfW(Sym) *symtab, char *strtab)
@@ -250,7 +252,6 @@ _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope,
250252 case R_RISCV_NONE:
251253 break;
252254 case R_RISCV_JUMP_SLOT:
253- *reloc_addr += tpnt->loadaddr;
254255 break;
255256 default:
256257 return -1; /*call _dl_exit(1) */
@@ -265,11 +266,17 @@ _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope,
265266
266267 return 0;
267268 }
269+#endif
268270
269271 void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt,
270272 unsigned long rel_addr, unsigned long rel_size)
271273 {
274+#ifdef __RISCV_LAZY_RELOC_WORKS
272275 (void)_dl_parse(rpnt->dyn, NULL, rel_addr, rel_size, _dl_do_lazy_reloc);
276+#else
277+ _dl_parse_relocation_information(rpnt, &_dl_loaded_modules->symbol_scope,
278+ rel_addr, rel_size);
279+#endif
273280 }
274281
275282 int _dl_parse_relocation_information(struct dyn_elf *rpnt,
--- a/libc/misc/internals/__uClibc_main.c
+++ b/libc/misc/internals/__uClibc_main.c
@@ -500,6 +500,7 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc,
500500 #endif
501501 }
502502 # endif
503+#endif
503504
504505 /* Note: It is possible that any initialization done above could
505506 * have resulted in errno being set nonzero, so set it to 0 before
@@ -511,7 +512,6 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc,
511512 /* Set h_errno to 0 as well */
512513 if (likely(not_null_ptr(__h_errno_location)))
513514 *(__h_errno_location()) = 0;
514-#endif
515515
516516 #if defined HAVE_CLEANUP_JMP_BUF && defined __UCLIBC_HAS_THREADS_NATIVE__
517517 /* Memory for the cancellation buffer. */
--- a/libc/sysdeps/linux/riscv64/crt1.S
+++ b/libc/sysdeps/linux/riscv64/crt1.S
@@ -45,6 +45,9 @@
4545 .globl _start
4646 .type _start,%function
4747
48+ .weak _init
49+ .weak _fini
50+
4851 _start:
4952 call .Lload_gp
5053 mv a5, a0 /* rtld_fini. */
@@ -52,12 +55,9 @@ _start:
5255 la a0, main
5356 REG_L a1, 0(sp) /* argc. */
5457 addi a2, sp, SZREG /* argv. */
55- /*
56- * No support fo app_init/app_fini as we don't support shared libraries.
57- */
58- mv a3, zero
59- mv a4, zero
6058 andi sp, sp, ALMASK /* Align stack. */
59+ lla a3, _init
60+ lla a4, _fini
6161 mv a6, sp /* stack_end. */
6262
6363 tail __uClibc_main@plt