comparison src/unexelf.c @ 272:c5d627a313b1 r21-0b34

Import from CVS: tag r21-0b34
author cvs
date Mon, 13 Aug 2007 10:28:48 +0200
parents 11cf20601dec
children ca9a9ec9c1c1
comparison
equal deleted inserted replaced
271:c7b7086b0a39 272:c5d627a313b1
434 434
435 #ifndef emacs 435 #ifndef emacs
436 #define fatal(a, b, c) fprintf (stderr, a, b, c), exit (1) 436 #define fatal(a, b, c) fprintf (stderr, a, b, c), exit (1)
437 #else 437 #else
438 #include <config.h> 438 #include <config.h>
439 extern void fatal (char *, ...); 439 extern void fatal (CONST char *, ...);
440 #endif 440 #endif
441 441
442 #ifndef ELF_BSS_SECTION_NAME 442 #ifndef ELF_BSS_SECTION_NAME
443 #define ELF_BSS_SECTION_NAME ".bss" 443 #define ELF_BSS_SECTION_NAME ".bss"
444 #endif 444 #endif
445 445
446 /* Get the address of a particular section or program header entry, 446 /* Get the address of a particular section or program header entry,
447 * accounting for the size of the entries. 447 * accounting for the size of the entries.
448 */ 448 */
449 /* 449 /*
450 On PPC Reference Platform running Solaris 2.5.1 450 On PPC Reference Platform running Solaris 2.5.1
451 the plt section is also of type NOBI like the bss section. 451 the plt section is also of type NOBI like the bss section.
452 (not really stored) and therefore sections after the bss 452 (not really stored) and therefore sections after the bss
453 section start at the plt offset. The plt section is always 453 section start at the plt offset. The plt section is always
454 the one just before the bss section. 454 the one just before the bss section.
455 Thus, we modify the test from 455 Thus, we modify the test from
456 if (NEW_SECTION_H (nn).sh_offset >= new_data2_offset) 456 if (NEW_SECTION_H (nn).sh_offset >= new_data2_offset)
457 to 457 to
458 if (NEW_SECTION_H (nn).sh_offset >= 458 if (NEW_SECTION_H (nn).sh_offset >=
459 OLD_SECTION_H (old_bss_index-1).sh_offset) 459 OLD_SECTION_H (old_bss_index-1).sh_offset)
460 This is just a hack. We should put the new data section 460 This is just a hack. We should put the new data section
461 before the .plt section. 461 before the .plt section.
462 And we should not have this routine at all but use 462 And we should not have this routine at all but use
463 the libelf library to read the old file and create the new 463 the libelf library to read the old file and create the new
668 */ 668 */
669 669
670 for (n = new_file_h->e_phnum - 1; n >= 0; n--) 670 for (n = new_file_h->e_phnum - 1; n >= 0; n--)
671 { 671 {
672 /* Compute maximum of all requirements for alignment of section. */ 672 /* Compute maximum of all requirements for alignment of section. */
673 int alignment = (NEW_PROGRAM_H (n)).p_align; 673 ElfW(Word) alignment = (NEW_PROGRAM_H (n)).p_align;
674 if ((OLD_SECTION_H (old_bss_index)).sh_addralign > alignment) 674 if ((OLD_SECTION_H (old_bss_index)).sh_addralign > alignment)
675 alignment = OLD_SECTION_H (old_bss_index).sh_addralign; 675 alignment = OLD_SECTION_H (old_bss_index).sh_addralign;
676 676
677 #ifndef __mips /* ifndef added by jwz at suggestion of 677 #ifndef __mips /* ifndef added by jwz at suggestion of
678 r02kar@x4u2.desy.de (Karsten Kuenne) to avoid 678 r02kar@x4u2.desy.de (Karsten Kuenne) to avoid