Changeset c4049e6 in mainline for uspace/lib/c
- Timestamp:
- 2018-07-05T21:41:20Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 9283830
- Parents:
- 9396c52
- git-author:
- Dzejrou <dzejrou@…> (2018-03-15 10:40:53)
- git-committer:
- Dzejrou <dzejrou@…> (2018-07-05 21:41:20)
- Location:
- uspace/lib/c
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/c/arch/amd64/_link.ld.in
r9396c52 rc4049e6 55 55 } :data 56 56 57 __dso_handle = .; 58 59 .init_array : { 60 PROVIDE_HIDDEN (__init_array_start = .); 61 KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*))) 62 KEEP (*(.init_array .ctors)) 63 PROVIDE_HIDDEN (__init_array_end = .); 64 } 65 66 .fini_array : { 67 PROVIDE_HIDDEN (__fini_array_start = .); 68 KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*))) 69 KEEP (*(.fini_array .dtors)) 70 PROVIDE_HIDDEN (__fini_array_end = .); 71 } 72 57 73 _end = .; 58 74 -
uspace/lib/c/generic/elf/elf_load.c
r9396c52 rc4049e6 112 112 pcb->dynamic = info->finfo.dynamic; 113 113 pcb->rtld_runtime = info->env; 114 pcb->cpp_data = info->finfo.cpp_data; 114 115 } 115 116 -
uspace/lib/c/generic/elf/elf_mod.c
r9396c52 rc4049e6 198 198 size_t phdr_len = header->e_phnum * header->e_phentsize; 199 199 200 elf->info->interp = NULL; 201 elf->info->dynamic = NULL; 202 elf->info->cpp_data.ctors_count = 0; 203 elf->info->cpp_data.dtors_count = 0; 204 200 205 if (phdr_len > sizeof(phdr)) { 201 206 DPRINTF("more than %d program headers\n", phdr_cap); -
uspace/lib/c/generic/libc.c
r9396c52 rc4049e6 61 61 #endif 62 62 63 static bool env_setup = false; 63 64 64 static bool env_setup = false; 65 /** 66 * Used for C++ constructors/destructors 67 * and the GCC constructor/destructor extension. 68 */ 69 typedef void (*init_array_entry_t)(); 70 extern init_array_entry_t __init_array_start[]; 71 extern init_array_entry_t __init_array_end[]; 72 typedef void (*fini_array_entry_t)(); 73 extern fini_array_entry_t __fini_array_start[]; 74 extern fini_array_entry_t __fini_array_end[]; 65 75 66 76 void __libc_main(void *pcb_ptr) … … 115 125 116 126 /* 127 * C++ Static constructor calls. 128 */ 129 ptrdiff_t init_array_entries = (__init_array_end - __init_array_start); 130 131 for (int i = init_array_entries - 1; i > 0; --i) 132 __init_array_start[i](); 133 134 /* 117 135 * Run main() and set task return value 118 136 * according the result … … 124 142 void __libc_exit(int status) 125 143 { 144 /* 145 * GCC extension __attribute__((destructor)), 146 * C++ destructors are added to __cxa_finalize call 147 * when the respective constructor is called. 148 */ 149 ptrdiff_t fini_array_entries = (__fini_array_end - __fini_array_start); 150 151 for (int i = 0; i < fini_array_entries; ++i) 152 __fini_array_start[i](); 153 126 154 if (env_setup) { 127 155 __stdio_done(); -
uspace/lib/c/include/loader/pcb.h
r9396c52 rc4049e6 36 36 #ifndef LIBC_PCB_H_ 37 37 #define LIBC_PCB_H_ 38 39 38 40 39 typedef void (*entry_point_t)(void); … … 76 75 /** Pointer to dynamic linker state structure (rtld_t). */ 77 76 void *rtld_runtime; 77 /** C++ related data. */ 78 cpp_data_t cpp_data; 78 79 } pcb_t; 79 80
Note:
See TracChangeset
for help on using the changeset viewer.