Changeset 49093a4 in mainline
- Timestamp:
- 2008-12-05T22:44:24Z (16 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2b1f860
- Parents:
- 965dc18
- Location:
- uspace
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/libc/include/loader/pcb.h
r965dc18 r49093a4 48 48 */ 49 49 typedef struct { 50 /** Program entry point */50 /** Program entry point. */ 51 51 entry_point_t entry; 52 52 53 /** Number of command-line arguments */53 /** Number of command-line arguments. */ 54 54 int argc; 55 /** Command-line arguments */55 /** Command-line arguments. */ 56 56 char **argv; 57 57 58 58 /* 59 * ELF-specific data 59 * ELF-specific data. 60 60 */ 61 /** Pointer to ELF dynamic section of the program */61 /** Pointer to ELF dynamic section of the program. */ 62 62 void *dynamic; 63 /** Pointer to dynamic section of the runtime linker */64 void *rtld_dynamic;65 /** Runtime-linker load bias */66 uintptr_t rtld_bias;67 63 } pcb_t; 68 64 65 /** 66 * A pointer to the program control block. Having received the PCB pointer, 67 * the C library startup code stores it here for later use. 68 */ 69 69 extern pcb_t *__pcb; 70 70 -
uspace/srv/loader/main.c
r965dc18 r49093a4 60 60 #include <elf_load.h> 61 61 62 /**63 * Bias used for loading the dynamic linker. This will be soon replaced64 * by automatic placement.65 */66 #define RTLD_BIAS 0x8000067 68 62 /** Pathname of the file that will be loaded */ 69 63 static char *pathname = NULL; … … 230 224 int rc; 231 225 232 // printf("Load program '%s'\n", pathname);233 234 226 rc = elf_load_file(pathname, 0, &prog_info); 235 227 if (rc < 0) { 236 printf(" failed to load program\n");228 printf("Failed to load executable '%s'.\n", pathname); 237 229 ipc_answer_0(rid, EINVAL); 238 230 return 1; 239 231 } 240 232 241 // printf("Create PCB\n");242 233 elf_create_pcb(&prog_info, &pcb); 243 234 … … 247 238 if (prog_info.interp == NULL) { 248 239 /* Statically linked program */ 249 // printf("Run statically linked program\n");250 // printf("entry point: 0x%lx\n", prog_info.entry);251 240 is_dyn_linked = false; 252 241 ipc_answer_0(rid, EOK); … … 254 243 } 255 244 256 printf("Load dynamic linker '%s'\n", prog_info.interp); 257 rc = elf_load_file("/rtld.so", RTLD_BIAS, &interp_info); 245 rc = elf_load_file(prog_info.interp, 0, &interp_info); 258 246 if (rc < 0) { 259 printf(" failed to load dynamic linker\n");247 printf("Failed to load interpreter '%s.'\n", prog_info.interp); 260 248 ipc_answer_0(rid, EINVAL); 261 249 return 1; 262 250 } 263 264 /*265 * Provide dynamic linker with some useful data266 */267 pcb.rtld_dynamic = interp_info.dynamic;268 pcb.rtld_bias = RTLD_BIAS;269 251 270 252 is_dyn_linked = true;
Note:
See TracChangeset
for help on using the changeset viewer.