diff options
| author | Karl Heuer | 1999-06-13 22:48:46 +0000 |
|---|---|---|
| committer | Karl Heuer | 1999-06-13 22:48:46 +0000 |
| commit | 914eeff99a4903612321ddfbe208a1ac22844b30 (patch) | |
| tree | dd536e1b6d2e55ecdf386b93cd94d65a98af26bb /src | |
| parent | 9c332a804d6c9508659ad2f4c7a5ec0ea7dcce7d (diff) | |
| download | emacs-914eeff99a4903612321ddfbe208a1ac22844b30.tar.gz emacs-914eeff99a4903612321ddfbe208a1ac22844b30.zip | |
(unexec): Dump the .rodata section from memory
under IRIX6.5 in order to be able to unexec with gcc.
Diffstat (limited to 'src')
| -rw-r--r-- | src/unexsgi.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/src/unexsgi.c b/src/unexsgi.c index 3f238592546..cd0067f08d9 100644 --- a/src/unexsgi.c +++ b/src/unexsgi.c | |||
| @@ -412,6 +412,7 @@ Filesz Memsz Flags Align | |||
| 412 | 412 | ||
| 413 | */ | 413 | */ |
| 414 | 414 | ||
| 415 | #include <config.h> | ||
| 415 | #include <sys/types.h> | 416 | #include <sys/types.h> |
| 416 | #include <stdio.h> | 417 | #include <stdio.h> |
| 417 | #include <sys/stat.h> | 418 | #include <sys/stat.h> |
| @@ -758,15 +759,17 @@ unexec (new_name, old_name, data_start, bss_start, entry_address) | |||
| 758 | NEW_SECTION_H (nn).sh_size = 0; | 759 | NEW_SECTION_H (nn).sh_size = 0; |
| 759 | } | 760 | } |
| 760 | else | 761 | else |
| 761 | memcpy (&NEW_SECTION_H (nn), &OLD_SECTION_H (n), | 762 | { |
| 762 | old_file_h->e_shentsize); | 763 | memcpy (&NEW_SECTION_H (nn), &OLD_SECTION_H (n), |
| 764 | old_file_h->e_shentsize); | ||
| 763 | 765 | ||
| 764 | /* Any section that was original placed AFTER the bss | 766 | /* Any section that was original placed AFTER the bss |
| 765 | section must now be adjusted by NEW_OFFSETS_SHIFT. */ | 767 | section must now be adjusted by NEW_OFFSETS_SHIFT. */ |
| 768 | |||
| 769 | if (NEW_SECTION_H (nn).sh_offset >= new_data2_offset) | ||
| 770 | NEW_SECTION_H (nn).sh_offset += new_offsets_shift; | ||
| 771 | } | ||
| 766 | 772 | ||
| 767 | if (NEW_SECTION_H (nn).sh_offset >= new_data2_offset) | ||
| 768 | NEW_SECTION_H (nn).sh_offset += new_offsets_shift; | ||
| 769 | |||
| 770 | /* If any section hdr refers to the section after the new .data | 773 | /* If any section hdr refers to the section after the new .data |
| 771 | section, make it refer to next one because we have inserted | 774 | section, make it refer to next one because we have inserted |
| 772 | a new section in between. */ | 775 | a new section in between. */ |
| @@ -786,9 +789,18 @@ unexec (new_name, old_name, data_start, bss_start, entry_address) | |||
| 786 | /* Write out the sections. .data and .data1 (and data2, called | 789 | /* Write out the sections. .data and .data1 (and data2, called |
| 787 | ".data" in the strings table) get copied from the current process | 790 | ".data" in the strings table) get copied from the current process |
| 788 | instead of the old file. */ | 791 | instead of the old file. */ |
| 789 | if (!strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data") | 792 | if (!strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data") |
| 790 | || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".data1") | 793 | || !strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".data1") |
| 791 | || !strcmp (old_section_names + NEW_SECTION_H (n).sh_name, ".got")) | 794 | #ifdef IRIX6_5 |
| 795 | /* Under IRIX 6.5 gcc places objects with adresses relative to | ||
| 796 | shared symbols in the section .rodata, which are adjusted at | ||
| 797 | startup time. Unfortunately they aren't adjusted after unexec, | ||
| 798 | so with this configuration we must get .rodata also from memory. | ||
| 799 | Do any other configurations need this, too? | ||
| 800 | <Wolfgang.Glas@hfm.tu-graz.ac.at> 1999-06-08. */ | ||
| 801 | || !strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".rodata") | ||
| 802 | #endif | ||
| 803 | || !strcmp (old_section_names + NEW_SECTION_H (nn).sh_name, ".got")) | ||
| 792 | src = (caddr_t) OLD_SECTION_H (n).sh_addr; | 804 | src = (caddr_t) OLD_SECTION_H (n).sh_addr; |
| 793 | else | 805 | else |
| 794 | src = old_base + OLD_SECTION_H (n).sh_offset; | 806 | src = old_base + OLD_SECTION_H (n).sh_offset; |
| @@ -859,9 +871,9 @@ unexec (new_name, old_name, data_start, bss_start, entry_address) | |||
| 859 | + new_base); | 871 | + new_base); |
| 860 | for (; num--; sym++) | 872 | for (; num--; sym++) |
| 861 | { | 873 | { |
| 874 | /* don't patch special section indices. */ | ||
| 862 | if (sym->st_shndx == SHN_UNDEF | 875 | if (sym->st_shndx == SHN_UNDEF |
| 863 | || sym->st_shndx == SHN_ABS | 876 | || sym->st_shndx >= SHN_LORESERVE) |
| 864 | || sym->st_shndx == SHN_COMMON) | ||
| 865 | continue; | 877 | continue; |
| 866 | 878 | ||
| 867 | PATCH_INDEX (sym->st_shndx); | 879 | PATCH_INDEX (sym->st_shndx); |