Changeset 4408603 in rtems
- Timestamp:
- 01/09/19 11:14:11 (5 years ago)
- Branches:
- 5, master
- Children:
- d8c70ba6
- Parents:
- a7c6176
- git-author:
- Chris Johns <chrisj@…> (01/09/19 11:14:11)
- git-committer:
- Chris Johns <chrisj@…> (02/08/19 23:06:34)
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
cpukit/include/rtems/rtl/rtl-obj.h
ra7c6176 r4408603 169 169 * parsing. */ 170 170 #define RTEMS_RTL_OBJ_DEP_VISITED (1 << 4) /**< Dependency loop detection. */ 171 #define RTEMS_RTL_OBJ_CTOR_RUN (1 << 5) /**< Constructors have been called. */ 171 172 172 173 /** -
cpukit/libdl/rtl-elf.c
ra7c6176 r4408603 994 994 break; 995 995 996 case SHT_INIT_ARRAY: 997 /* 998 * Constructors are text and need to be loaded. 999 */ 1000 flags = (RTEMS_RTL_OBJ_SECT_CTOR | 1001 RTEMS_RTL_OBJ_SECT_TEXT | 1002 RTEMS_RTL_OBJ_SECT_LOAD); 1003 break; 1004 1005 case SHT_FINI_ARRAY: 1006 /* 1007 * Destructors are text and need to be loaded. 1008 */ 1009 flags = (RTEMS_RTL_OBJ_SECT_DTOR | 1010 RTEMS_RTL_OBJ_SECT_TEXT | 1011 RTEMS_RTL_OBJ_SECT_LOAD); 1012 break; 1013 996 1014 default: 997 1015 /* … … 1020 1038 flags |= RTEMS_RTL_OBJ_SECT_LINK; 1021 1039 1040 /* 1041 * Some architexctures support a named PROGBIT section for INIT/FINI. 1042 */ 1022 1043 len = RTEMS_RTL_ELF_STRING_MAX; 1023 1044 if (!rtems_rtl_obj_cache_read (strings, fd, -
cpukit/libdl/rtl-mdreloc-arm.c
ra7c6176 r4408603 8 8 9 9 #include <errno.h> 10 #include <inttypes.h> 10 11 #include <stdio.h> 11 12 #include <string.h> … … 194 195 case R_TYPE(GLOB_DAT): /* word32 (S + A) | T */ 195 196 case R_TYPE(PREL31): /* word32 (S + A) | T - P */ 197 case R_TYPE(TARGET1): /* Equivalent to ABS32 */ 196 198 case R_TYPE(TARGET2): /* Equivalent to REL32 */ 197 199 if (__predict_true(RELOC_ALIGNED_P(where))) { … … 250 252 251 253 case R_TYPE(THM_JUMP24): 252 /* same to THM_CALL; insn b.w */253 case R_TYPE(THM_ CALL):254 /* same as THM_PC22; insn b.w */ 255 case R_TYPE(THM_PC22): 254 256 upper_insn = *(uint16_t *)where; 255 257 lower_insn = *((uint16_t *)where + 1); … … 323 325 324 326 if (((Elf_Sword)tmp > 0x7ffffe) || ((Elf_Sword)tmp < -0x800000)) { 325 rtems_rtl_set_error (EINVAL, "%s: Overflow % ld"327 rtems_rtl_set_error (EINVAL, "%s: Overflow %" PRIu32 " " 326 328 "THM_JUMP19 relocations", 327 329 sect->name, (uint32_t) ELF_R_TYPE(rel->r_info)); … … 343 345 344 346 default: 345 printf ("rtl: reloc unknown: sym = % lu, type = %lu, offset = %p, "347 printf ("rtl: reloc unknown: sym = %" PRIu32 ", type = %" PRIu32 ", offset = %p, " 346 348 "contents = %p\n", 347 349 ELF_R_SYM(rel->r_info), (uint32_t) ELF_R_TYPE(rel->r_info), 348 350 (void *)rel->r_offset, (void *)*where); 349 351 rtems_rtl_set_error (EINVAL, 350 "%s: Unsupported relocation type % ld"352 "%s: Unsupported relocation type %" PRIu32 " " 351 353 "in non-PLT relocations", 352 354 sect->name, (uint32_t) ELF_R_TYPE(rel->r_info)); -
cpukit/libdl/rtl-unresolved.c
ra7c6176 r4408603 182 182 { 183 183 if (rtems_rtl_trace (RTEMS_RTL_TRACE_UNRESOLVED)) 184 printf ("rtl: unresolv: resolve reloc: %s\n", rd->name_rec->rec.name.name); 184 printf ("rtl: unresolv: resolve reloc: %s\n", 185 rd->name_rec->rec.name.name); 185 186 186 187 rtems_rtl_obj_relocate_unresolved (&rec->rec.reloc, rd->sym); … … 194 195 { 195 196 pending = rtems_rtl_pending_unprotected (); 197 rtems_chain_extract (&rec->rec.reloc.obj->link); 196 198 rtems_chain_append (pending, &rec->rec.reloc.obj->link); 197 199 } -
cpukit/libdl/rtl.c
ra7c6176 r4408603 513 513 } 514 514 515 rtems_chain_append (&rtl->pending, &obj->link); 516 515 517 /* 516 518 * Find the file in the file system using the search path. The fname field … … 524 526 } 525 527 526 rtems_chain_append (&rtl->pending, &obj->link);527 528 528 if (!rtems_rtl_obj_load (obj)) 529 529 { … … 532 532 rtems_rtl_obj_caches_flush (); 533 533 return NULL; 534 } 535 536 /* 537 * If there are unresolved externals remove from the pending queue and place 538 * on the objects list until the symbols are resolved. 539 */ 540 if (obj->unresolved != 0) 541 { 542 rtems_chain_extract (&obj->link); 543 rtems_chain_append (&rtl->objects, &obj->link); 534 544 } 535 545 … … 573 583 while (!rtems_chain_is_tail (&rtl->pending, node)) 574 584 { 575 rtems_rtl_obj* obj = (rtems_rtl_obj*) node;585 rtems_rtl_obj* pobj = (rtems_rtl_obj*) node; 576 586 577 587 /* … … 579 589 * RTL's objects list. 580 590 */ 581 node = rtems_chain_next (& obj->link);582 rtems_chain_extract (& obj->link);583 rtems_chain_append (&rtl->objects, & obj->link);591 node = rtems_chain_next (&pobj->link); 592 rtems_chain_extract (&pobj->link); 593 rtems_chain_append (&rtl->objects, &pobj->link); 584 594 585 595 /* 586 596 * Make sure the object file and cache is synchronized. 587 597 */ 588 rtems_rtl_obj_synchronize_cache ( obj);589 590 /* 591 * Run any local constructors if th is is the first user because the592 * object file will have just been loaded. Unlock the linker to avoid any593 * dead locks if the object file needs to load files or update the symbol594 * t able. We also do not want a constructor to unload this object file.595 */ 596 if ( obj->users == 1)597 { 598 obj->flags |= RTEMS_RTL_OBJ_LOCKED;598 rtems_rtl_obj_synchronize_cache (pobj); 599 600 /* 601 * Run any local constructors if they have not been run. Unlock the linker 602 * to avoid any dead locks if the object file needs to load files or 603 * update the symbol table. We also do not want a constructor to unload 604 * this object file. 605 */ 606 if ((pobj->flags & RTEMS_RTL_OBJ_CTOR_RUN) == 0) 607 { 608 pobj->flags |= RTEMS_RTL_OBJ_LOCKED | RTEMS_RTL_OBJ_CTOR_RUN; 599 609 rtems_rtl_unlock (); 600 rtems_rtl_obj_run_ctors ( obj);610 rtems_rtl_obj_run_ctors (pobj); 601 611 rtems_rtl_lock (); 602 obj->flags &= ~RTEMS_RTL_OBJ_LOCKED;612 pobj->flags &= ~RTEMS_RTL_OBJ_LOCKED; 603 613 } 604 614 } … … 624 634 625 635 /* 626 * Move the object file from the objects list to the pending list if unloaded.636 * The object file cannot be unloaded if it is referenced. 627 637 */ 628 638 if (rtems_rtl_obj_get_reference (obj) > 0) … … 650 660 rtems_chain_control unloading; 651 661 rtems_chain_node* node; 662 bool orphaned_found = true; 663 int loop = 0; 652 664 653 665 /* 654 * Remove the orphaned object files from the objects list. This makes the 655 * list private and any changes in any desctructors will effect the run. 666 * Remove the orphaned object files from the objects list. The unloading is 667 * private so any changes in any desctructors will not effect the list as it 668 * is being iterated over. 669 * 670 * To avoid maintaining a complex tree loop while oprhans are still be found. 656 671 */ 672 657 673 rtems_chain_initialize_empty (&unloading); 658 674 659 node = rtems_chain_first (&rtl->objects); 660 while (!rtems_chain_is_tail (&rtl->objects, node)) 661 { 662 rtems_chain_node* next_node = rtems_chain_next (node); 663 rtems_rtl_obj* uobj = (rtems_rtl_obj*) node; 664 if (rtems_rtl_trace (RTEMS_RTL_TRACE_UNLOAD)) 665 printf ("rtl: unload object: %s: %s\n", 666 rtems_rtl_obj_oname (obj), 667 rtems_rtl_obj_orphaned (uobj) ? "orphaned" : "inuse"); 668 if (rtems_rtl_obj_orphaned (uobj)) 669 { 670 rtems_rtl_obj_remove_dependencies (uobj); 671 rtems_chain_extract (&uobj->link); 672 rtems_chain_append (&unloading, &uobj->link); 673 uobj->flags |= RTEMS_RTL_OBJ_LOCKED; 674 } 675 node = next_node; 675 while (orphaned_found) 676 { 677 orphaned_found = false; 678 ++loop; 679 node = rtems_chain_first (&rtl->objects); 680 while (!rtems_chain_is_tail (&rtl->objects, node)) 681 { 682 rtems_chain_node* next_node = rtems_chain_next (node); 683 rtems_rtl_obj* uobj = (rtems_rtl_obj*) node; 684 if (rtems_rtl_trace (RTEMS_RTL_TRACE_UNLOAD)) 685 printf ("rtl: unload object: %3i: %9s: %s\n", 686 loop, 687 rtems_rtl_obj_orphaned (uobj) ? "orphaned" : "inuse", 688 rtems_rtl_obj_oname (uobj)); 689 if (rtems_rtl_obj_orphaned (uobj)) 690 { 691 orphaned_found = true; 692 rtems_rtl_obj_remove_dependencies (uobj); 693 rtems_chain_extract (&uobj->link); 694 rtems_chain_append (&unloading, &uobj->link); 695 uobj->flags |= RTEMS_RTL_OBJ_LOCKED; 696 } 697 node = next_node; 698 } 676 699 } 677 700 … … 685 708 { 686 709 rtems_rtl_obj* uobj = (rtems_rtl_obj*) node; 687 rtems_rtl_obj_run_dtors (uobj); 710 if ((uobj->flags & RTEMS_RTL_OBJ_CTOR_RUN) != 0) 711 { 712 rtems_rtl_obj_run_dtors (uobj); 713 uobj->flags &= ~RTEMS_RTL_OBJ_CTOR_RUN; 714 } 688 715 node = rtems_chain_next (node); 689 716 } -
cpukit/score/cpu/arm/include/machine/elf_machdep.h
ra7c6176 r4408603 1 /* $NetBSD: elf_machdep.h,v 1.8 2009/05/30 05:56:52 skrll Exp $ */ 1 /* $NetBSD: elf_machdep.h,v 1.19 2017/11/06 03:47:45 christos Exp $ */ 2 3 #ifndef _ARM_ELF_MACHDEP_H_ 4 #define _ARM_ELF_MACHDEP_H_ 2 5 3 6 #if defined(__ARMEB__) … … 25 28 #define EF_ARM_OLD_ABI 0x00000100 26 29 #define EF_ARM_SOFT_FLOAT 0x00000200 30 #define EF_ARM_BE8 0x00800000 27 31 #define EF_ARM_EABIMASK 0xff000000 32 #define EF_ARM_EABI_VER1 0x01000000 33 #define EF_ARM_EABI_VER2 0x02000000 34 #define EF_ARM_EABI_VER3 0x03000000 35 #define EF_ARM_EABI_VER4 0x04000000 36 #define EF_ARM_EABI_VER5 0x05000000 28 37 29 38 #define ELF32_MACHDEP_ID_CASES \ … … 33 42 #define ELF32_MACHDEP_ID EM_ARM 34 43 44 #define KERN_ELFSIZE 32 35 45 #define ARCH_ELFSIZE 32 /* MD native binary size */ 36 46 … … 47 57 #define R_ARM_ABS8 8 48 58 #define R_ARM_SBREL32 9 49 #define R_ARM_THM_ CALL1059 #define R_ARM_THM_PC22 10 50 60 #define R_ARM_THM_PC8 11 51 61 #define R_ARM_AMP_VCALL9 12 … … 69 79 #define R_ARM_GOT32 26 70 80 #define R_ARM_PLT32 27 71 #define R_ARM_CALL 72 #define R_ARM_JUMP24 81 #define R_ARM_CALL 28 82 #define R_ARM_JUMP24 29 73 83 #define R_ARM_THM_JUMP24 30 74 #define R_ARM_BASE_ABS 31 75 84 #define R_ARM_BASE_ABS 31 76 85 #define R_ARM_ALU_PCREL_7_0 32 77 86 #define R_ARM_ALU_PCREL_15_8 33 … … 79 88 #define R_ARM_ALU_SBREL_11_0 35 80 89 #define R_ARM_ALU_SBREL_19_12 36 81 #define R_ARM_ALU_SBREL_27_20 37 82 #define R_ARM_V4BX 40 83 #define R_ARM_TARGET2 41 84 #define R_ARM_PREL31 42 85 86 #define R_ARM_MOVW_ABS_NC 43 87 #define R_ARM_MOVT_ABS 44 88 89 #define R_ARM_THM_MOVW_ABS_NC 47 90 #define R_ARM_THM_MOVT_ABS 48 91 92 #define R_ARM_THM_JUMP19 51 90 #define R_ARM_ALU_SBREL_27_20 37 // depcreated 91 #define R_ARM_TARGET1 38 92 #define R_ARM_SBREL31 39 // deprecated 93 #define R_ARM_V4BX 40 94 #define R_ARM_TARGET2 41 95 #define R_ARM_PREL31 42 96 #define R_ARM_MOVW_ABS_NC 43 97 #define R_ARM_MOVT_ABS 44 98 #define R_ARM_MOVW_PREL_NC 45 99 #define R_ARM_MOVT_PREL 46 100 #define R_ARM_THM_MOVW_ABS_NC 47 101 #define R_ARM_THM_MOVT_ABS 48 102 #define R_ARM_THM_MOVW_PREL_NC 49 103 #define R_ARM_THM_MOVT_PREL 50 104 #define R_ARM_THM_JUMP19 51 93 105 94 106 /* 96-111 are reserved to G++. */ 95 107 #define R_ARM_GNU_VTENTRY 100 96 108 #define R_ARM_GNU_VTINHERIT 101 97 #define R_ARM_THM_ JUMP11 10298 #define R_ARM_THM_ JUMP8103109 #define R_ARM_THM_PC11 102 110 #define R_ARM_THM_PC9 103 99 111 100 112 /* More TLS relocations */ … … 109 121 110 122 /* 112-127 are reserved for private experiments. */ 123 124 #define R_ARM_IRELATIVE 160 111 125 112 126 #define R_ARM_RXPC25 249 … … 125 139 #define PF_ARM_ENTRY 0x80000000 126 140 141 /* Processor specific program header types */ 142 #define PT_ARM_EXIDX (PT_LOPROC + 1) 143 127 144 /* Processor specific section header flags */ 128 145 #define SHF_ENTRYSECT 0x10000000 … … 131 148 /* Processor specific symbol types */ 132 149 #define STT_ARM_TFUNC STT_LOPROC 150 151 #ifdef _KERNEL 152 #ifdef ELFSIZE 153 #define ELF_MD_PROBE_FUNC ELFNAME2(arm_netbsd,probe) 154 #define ELF_MD_COREDUMP_SETUP ELFNAME2(arm_netbsd,coredump_setup) 155 #endif 156 157 struct exec_package; 158 159 int arm_netbsd_elf32_probe(struct lwp *, struct exec_package *, void *, char *, 160 vaddr_t *); 161 void arm_netbsd_elf32_coredump_setup(struct lwp *, void *); 162 #endif 163 164 #endif /* _ARM_ELF_MACHDEP_H_ */ -
testsuites/libtests/dl08/dl-load.c
ra7c6176 r4408603 127 127 dl_load_dump (); 128 128 129 printf (" \n\n\nRunning rtems_main_o1:\n\n");129 printf ("Running rtems_main_o1:\n"); 130 130 if (dl_call (o1, "rtems_main_o1")) 131 131 return 1;
Note: See TracChangeset
for help on using the changeset viewer.