Revisão | cb9d1f53717dd67892ba943626f3d1b46f3e760b (tree) |
---|---|
Hora | 2019-11-06 12:33:56 |
Autor | Waldemar Brodkorb <wbx@open...> |
Commiter | Waldemar Brodkorb |
riscv64: lazy relocations do not work like sparc/m68k
@@ -226,6 +226,8 @@ _dl_do_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope, | ||
226 | 226 | return 0; |
227 | 227 | } |
228 | 228 | |
229 | +#undef __RISCV_LAZY_RELOC_WORKS | |
230 | +#ifdef __RISCV_LAZY_RELOC_WORKS | |
229 | 231 | static int |
230 | 232 | _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope, |
231 | 233 | 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, | ||
250 | 252 | case R_RISCV_NONE: |
251 | 253 | break; |
252 | 254 | case R_RISCV_JUMP_SLOT: |
253 | - *reloc_addr += tpnt->loadaddr; | |
254 | 255 | break; |
255 | 256 | default: |
256 | 257 | return -1; /*call _dl_exit(1) */ |
@@ -265,11 +266,17 @@ _dl_do_lazy_reloc (struct elf_resolve *tpnt, struct r_scope_elem *scope, | ||
265 | 266 | |
266 | 267 | return 0; |
267 | 268 | } |
269 | +#endif | |
268 | 270 | |
269 | 271 | void _dl_parse_lazy_relocation_information(struct dyn_elf *rpnt, |
270 | 272 | unsigned long rel_addr, unsigned long rel_size) |
271 | 273 | { |
274 | +#ifdef __RISCV_LAZY_RELOC_WORKS | |
272 | 275 | (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 | |
273 | 280 | } |
274 | 281 | |
275 | 282 | int _dl_parse_relocation_information(struct dyn_elf *rpnt, |
@@ -500,6 +500,7 @@ void __uClibc_main(int (*main)(int, char **, char **), int argc, | ||
500 | 500 | #endif |
501 | 501 | } |
502 | 502 | # endif |
503 | +#endif | |
503 | 504 | |
504 | 505 | /* Note: It is possible that any initialization done above could |
505 | 506 | * 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, | ||
511 | 512 | /* Set h_errno to 0 as well */ |
512 | 513 | if (likely(not_null_ptr(__h_errno_location))) |
513 | 514 | *(__h_errno_location()) = 0; |
514 | -#endif | |
515 | 515 | |
516 | 516 | #if defined HAVE_CLEANUP_JMP_BUF && defined __UCLIBC_HAS_THREADS_NATIVE__ |
517 | 517 | /* Memory for the cancellation buffer. */ |
@@ -45,6 +45,9 @@ | ||
45 | 45 | .globl _start |
46 | 46 | .type _start,%function |
47 | 47 | |
48 | + .weak _init | |
49 | + .weak _fini | |
50 | + | |
48 | 51 | _start: |
49 | 52 | call .Lload_gp |
50 | 53 | mv a5, a0 /* rtld_fini. */ |
@@ -52,12 +55,9 @@ _start: | ||
52 | 55 | la a0, main |
53 | 56 | REG_L a1, 0(sp) /* argc. */ |
54 | 57 | 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 | |
60 | 58 | andi sp, sp, ALMASK /* Align stack. */ |
59 | + lla a3, _init | |
60 | + lla a4, _fini | |
61 | 61 | mv a6, sp /* stack_end. */ |
62 | 62 | |
63 | 63 | tail __uClibc_main@plt |