diff options
Diffstat (limited to 'arch/mips/boot/elf2ecoff.c')
-rw-r--r-- | arch/mips/boot/elf2ecoff.c | 64 |
1 files changed, 36 insertions, 28 deletions
diff --git a/arch/mips/boot/elf2ecoff.c b/arch/mips/boot/elf2ecoff.c index 8585078ae50e..2a4c52e27f41 100644 --- a/arch/mips/boot/elf2ecoff.c +++ b/arch/mips/boot/elf2ecoff.c | |||
@@ -49,7 +49,8 @@ | |||
49 | /* | 49 | /* |
50 | * Some extra ELF definitions | 50 | * Some extra ELF definitions |
51 | */ | 51 | */ |
52 | #define PT_MIPS_REGINFO 0x70000000 /* Register usage information */ | 52 | #define PT_MIPS_REGINFO 0x70000000 /* Register usage information */ |
53 | #define PT_MIPS_ABIFLAGS 0x70000003 /* Records ABI related flags */ | ||
53 | 54 | ||
54 | /* -------------------------------------------------------------------- */ | 55 | /* -------------------------------------------------------------------- */ |
55 | 56 | ||
@@ -349,39 +350,46 @@ int main(int argc, char *argv[]) | |||
349 | 350 | ||
350 | for (i = 0; i < ex.e_phnum; i++) { | 351 | for (i = 0; i < ex.e_phnum; i++) { |
351 | /* Section types we can ignore... */ | 352 | /* Section types we can ignore... */ |
352 | if (ph[i].p_type == PT_NULL || ph[i].p_type == PT_NOTE || | 353 | switch (ph[i].p_type) { |
353 | ph[i].p_type == PT_PHDR | 354 | case PT_NULL: |
354 | || ph[i].p_type == PT_MIPS_REGINFO) | 355 | case PT_NOTE: |
356 | case PT_PHDR: | ||
357 | case PT_MIPS_REGINFO: | ||
358 | case PT_MIPS_ABIFLAGS: | ||
355 | continue; | 359 | continue; |
356 | /* Section types we can't handle... */ | ||
357 | else if (ph[i].p_type != PT_LOAD) { | ||
358 | fprintf(stderr, | ||
359 | "Program header %d type %d can't be converted.\n", | ||
360 | ex.e_phnum, ph[i].p_type); | ||
361 | exit(1); | ||
362 | } | ||
363 | /* Writable (data) segment? */ | ||
364 | if (ph[i].p_flags & PF_W) { | ||
365 | struct sect ndata, nbss; | ||
366 | 360 | ||
367 | ndata.vaddr = ph[i].p_vaddr; | 361 | case PT_LOAD: |
368 | ndata.len = ph[i].p_filesz; | 362 | /* Writable (data) segment? */ |
369 | nbss.vaddr = ph[i].p_vaddr + ph[i].p_filesz; | 363 | if (ph[i].p_flags & PF_W) { |
370 | nbss.len = ph[i].p_memsz - ph[i].p_filesz; | 364 | struct sect ndata, nbss; |
365 | |||
366 | ndata.vaddr = ph[i].p_vaddr; | ||
367 | ndata.len = ph[i].p_filesz; | ||
368 | nbss.vaddr = ph[i].p_vaddr + ph[i].p_filesz; | ||
369 | nbss.len = ph[i].p_memsz - ph[i].p_filesz; | ||
371 | 370 | ||
372 | combine(&data, &ndata, 0); | 371 | combine(&data, &ndata, 0); |
373 | combine(&bss, &nbss, 1); | 372 | combine(&bss, &nbss, 1); |
374 | } else { | 373 | } else { |
375 | struct sect ntxt; | 374 | struct sect ntxt; |
376 | 375 | ||
377 | ntxt.vaddr = ph[i].p_vaddr; | 376 | ntxt.vaddr = ph[i].p_vaddr; |
378 | ntxt.len = ph[i].p_filesz; | 377 | ntxt.len = ph[i].p_filesz; |
379 | 378 | ||
380 | combine(&text, &ntxt, 0); | 379 | combine(&text, &ntxt, 0); |
380 | } | ||
381 | /* Remember the lowest segment start address. */ | ||
382 | if (ph[i].p_vaddr < cur_vma) | ||
383 | cur_vma = ph[i].p_vaddr; | ||
384 | break; | ||
385 | |||
386 | default: | ||
387 | /* Section types we can't handle... */ | ||
388 | fprintf(stderr, | ||
389 | "Program header %d type %d can't be converted.\n", | ||
390 | ex.e_phnum, ph[i].p_type); | ||
391 | exit(1); | ||
381 | } | 392 | } |
382 | /* Remember the lowest segment start address. */ | ||
383 | if (ph[i].p_vaddr < cur_vma) | ||
384 | cur_vma = ph[i].p_vaddr; | ||
385 | } | 393 | } |
386 | 394 | ||
387 | /* Sections must be in order to be converted... */ | 395 | /* Sections must be in order to be converted... */ |