aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard M. Stallman1992-09-11 23:29:02 +0000
committerRichard M. Stallman1992-09-11 23:29:02 +0000
commit248a26a710ec6401e6eddaccd8446665a261ef5e (patch)
tree0ebcb33391c4f2eb78dcccb5e4c94c3a985d924b
parentac9a31be418952ee0560944c2bc3f6a38fc844cd (diff)
downloademacs-248a26a710ec6401e6eddaccd8446665a261ef5e.tar.gz
emacs-248a26a710ec6401e6eddaccd8446665a261ef5e.zip
(unexec): Allow sections in any order.
Adjust addresses of rdata section as well as data section.
-rw-r--r--src/unexmips.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/unexmips.c b/src/unexmips.c
index 7f4d75de256..76de824d06a 100644
--- a/src/unexmips.c
+++ b/src/unexmips.c
@@ -141,18 +141,16 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
141 } 141 }
142 142
143#define CHECK_SCNHDR(ptr, name, flags) \ 143#define CHECK_SCNHDR(ptr, name, flags) \
144 if (strcmp (hdr.section[i].s_name, name) == 0) \ 144 ptr = NULL; \
145 { \ 145 for (i = 0; i < hdr.fhdr.f_nscns && !ptr; i++) \
146 if (hdr.section[i].s_flags != flags) \ 146 if (strcmp (hdr.section[i].s_name, name) == 0) \
147 fprintf (stderr, "unexec: %x flags (%x expected) in %s section.\n", \ 147 { \
148 hdr.section[i].s_flags, flags, name); \ 148 if (hdr.section[i].s_flags != flags) \
149 ptr = hdr.section + i; \ 149 fprintf (stderr, "unexec: %x flags (%x expected) in %s section.\n", \
150 i += 1; \ 150 hdr.section[i].s_flags, flags, name); \
151 } \ 151 ptr = hdr.section + i; \
152 else \ 152 } \
153 ptr = NULL;
154 153
155 i = 0;
156 CHECK_SCNHDR (text_section, _TEXT, STYP_TEXT); 154 CHECK_SCNHDR (text_section, _TEXT, STYP_TEXT);
157 CHECK_SCNHDR (init_section, _INIT, STYP_INIT); 155 CHECK_SCNHDR (init_section, _INIT, STYP_INIT);
158 CHECK_SCNHDR (rdata_section, _RDATA, STYP_RDATA); 156 CHECK_SCNHDR (rdata_section, _RDATA, STYP_RDATA);
@@ -182,6 +180,12 @@ unexec (new_name, a_name, data_start, bss_start, entry_address)
182 180
183 hdr.aout.bss_start = hdr.aout.data_start + hdr.aout.dsize; 181 hdr.aout.bss_start = hdr.aout.data_start + hdr.aout.dsize;
184 rdata_section->s_size = data_start - DATA_START; 182 rdata_section->s_size = data_start - DATA_START;
183
184 /* Adjust start and virtual addresses of rdata_section, too. */
185 rdata_section->s_vaddr = DATA_START;
186 rdata_section->s_paddr = DATA_START;
187 rdata_section->s_scnptr = text_section->s_scnptr + hdr.aout.tsize;
188
185 data_section->s_vaddr = data_start; 189 data_section->s_vaddr = data_start;
186 data_section->s_paddr = data_start; 190 data_section->s_paddr = data_start;
187 data_section->s_size = brk - data_start; 191 data_section->s_size = brk - data_start;