diff options
| author | Dan Nicolaescu | 2010-07-28 20:25:08 -0700 |
|---|---|---|
| committer | Dan Nicolaescu | 2010-07-28 20:25:08 -0700 |
| commit | 76fd1ee9bd6e22602ed4df4350daeb375f67e16a (patch) | |
| tree | 3628a3c341f6b0750837768a5efcb6d5c44faf6f /src/unexec.c | |
| parent | 087b38a075e28408c397252f3756af9d3ac23e87 (diff) | |
| download | emacs-76fd1ee9bd6e22602ed4df4350daeb375f67e16a.tar.gz emacs-76fd1ee9bd6e22602ed4df4350daeb375f67e16a.zip | |
Clean up unexec.c, remove references to unused code.
* nt/config.nt: Remove code referring to NO_REMAP, unused.
* src/unexec.c (make_hdr): Remove references to NO_REMAP, COFF,
SEGMENT_MASK, SECTION_ALIGNMENT, ADJUST_EXEC_HEADER.
* src/s/usg5-4.h (COFF):
* src/s/template.h:
* src/s/msdos.h (COFF, NO_REMAP):
* src/s/ms-w32.h (NO_REMAP):
* src/s/hpux10-20.h (NO_REMAP):
* src/m/sparc.h (SEGMENT_MASK):
* src/m/m68k.h (NO_REMAP):
* src/m/intel386.h (SEGMENT_MASK):
* src/m/arm.h (NO_REMAP):
* src/m/alpha.h (COFF):
* src/m/template.h: Remove references to unused defines.
Diffstat (limited to 'src/unexec.c')
| -rw-r--r-- | src/unexec.c | 88 |
1 files changed, 0 insertions, 88 deletions
diff --git a/src/unexec.c b/src/unexec.c index 8edd9e22b96..f7f93b066de 100644 --- a/src/unexec.c +++ b/src/unexec.c | |||
| @@ -48,8 +48,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 48 | * | 48 | * |
| 49 | * Specifying zero for data_start means the boundary between text and data | 49 | * Specifying zero for data_start means the boundary between text and data |
| 50 | * should not be the same as when the program was loaded. | 50 | * should not be the same as when the program was loaded. |
| 51 | * If NO_REMAP is defined, the argument data_start is ignored and the | ||
| 52 | * segment boundaries are never changed. | ||
| 53 | * | 51 | * |
| 54 | * Bss_start indicates how much of the data segment is to be saved in the | 52 | * Bss_start indicates how much of the data segment is to be saved in the |
| 55 | * a.out file and restored when the program is executed. It gives the lowest | 53 | * a.out file and restored when the program is executed. It gives the lowest |
| @@ -69,56 +67,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 69 | * of Dell Computer Corporation. james@bigtex.cactus.org. | 67 | * of Dell Computer Corporation. james@bigtex.cactus.org. |
| 70 | */ | 68 | */ |
| 71 | 69 | ||
| 72 | /* There are several compilation parameters affecting unexec: | ||
| 73 | |||
| 74 | * COFF | ||
| 75 | |||
| 76 | Define this if your system uses COFF for executables. | ||
| 77 | |||
| 78 | * NO_REMAP | ||
| 79 | |||
| 80 | Define this if you do not want to try to save Emacs's pure data areas | ||
| 81 | as part of the text segment. | ||
| 82 | |||
| 83 | Saving them as text is good because it allows users to share more. | ||
| 84 | |||
| 85 | However, on machines that locate the text area far from the data area, | ||
| 86 | the boundary cannot feasibly be moved. Such machines require | ||
| 87 | NO_REMAP. | ||
| 88 | |||
| 89 | Also, remapping can cause trouble with the built-in startup routine | ||
| 90 | /lib/crt0.o, which defines `environ' as an initialized variable. | ||
| 91 | Dumping `environ' as pure does not work! So, to use remapping, | ||
| 92 | you must write a startup routine for your machine in Emacs's crt0.c. | ||
| 93 | If NO_REMAP is defined, Emacs uses the system's crt0.o. | ||
| 94 | |||
| 95 | * SECTION_ALIGNMENT | ||
| 96 | |||
| 97 | Some machines that use COFF executables require that each section | ||
| 98 | start on a certain boundary *in the COFF file*. Such machines should | ||
| 99 | define SECTION_ALIGNMENT to a mask of the low-order bits that must be | ||
| 100 | zero on such a boundary. This mask is used to control padding between | ||
| 101 | segments in the COFF file. | ||
| 102 | |||
| 103 | If SECTION_ALIGNMENT is not defined, the segments are written | ||
| 104 | consecutively with no attempt at alignment. This is right for | ||
| 105 | unmodified system V. | ||
| 106 | |||
| 107 | * SEGMENT_MASK | ||
| 108 | |||
| 109 | Some machines require that the beginnings and ends of segments | ||
| 110 | *in core* be on certain boundaries. For most machines, a page | ||
| 111 | boundary is sufficient. That is the default. When a larger | ||
| 112 | boundary is needed, define SEGMENT_MASK to a mask of | ||
| 113 | the bits that must be zero on such a boundary. | ||
| 114 | |||
| 115 | * ADJUST_EXEC_HEADER | ||
| 116 | |||
| 117 | This macro can be used to generate statements to adjust or | ||
| 118 | initialize nonstandard fields in the file header | ||
| 119 | |||
| 120 | */ | ||
| 121 | |||
| 122 | #ifndef emacs | 70 | #ifndef emacs |
| 123 | #define PERROR(arg) perror (arg); return -1 | 71 | #define PERROR(arg) perror (arg); return -1 |
| 124 | #else | 72 | #else |
| @@ -264,19 +212,9 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) | |||
| 264 | pagemask = getpagesize () - 1; | 212 | pagemask = getpagesize () - 1; |
| 265 | 213 | ||
| 266 | /* Adjust text/data boundary. */ | 214 | /* Adjust text/data boundary. */ |
| 267 | #ifdef NO_REMAP | ||
| 268 | data_start = (int) start_of_data (); | 215 | data_start = (int) start_of_data (); |
| 269 | #else /* not NO_REMAP */ | ||
| 270 | if (!data_start) | ||
| 271 | data_start = (int) start_of_data (); | ||
| 272 | #endif /* not NO_REMAP */ | ||
| 273 | data_start = ADDR_CORRECT (data_start); | 216 | data_start = ADDR_CORRECT (data_start); |
| 274 | |||
| 275 | #ifdef SEGMENT_MASK | ||
| 276 | data_start = data_start & ~SEGMENT_MASK; /* (Down) to segment boundary. */ | ||
| 277 | #else | ||
| 278 | data_start = data_start & ~pagemask; /* (Down) to page boundary. */ | 217 | data_start = data_start & ~pagemask; /* (Down) to page boundary. */ |
| 279 | #endif | ||
| 280 | 218 | ||
| 281 | bss_end = ADDR_CORRECT (sbrk (0)) + pagemask; | 219 | bss_end = ADDR_CORRECT (sbrk (0)) + pagemask; |
| 282 | bss_end &= ~ pagemask; | 220 | bss_end &= ~ pagemask; |
| @@ -374,42 +312,20 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) | |||
| 374 | to correspond to what we want to dump. */ | 312 | to correspond to what we want to dump. */ |
| 375 | 313 | ||
| 376 | f_hdr.f_flags |= (F_RELFLG | F_EXEC); | 314 | f_hdr.f_flags |= (F_RELFLG | F_EXEC); |
| 377 | #ifndef NO_REMAP | ||
| 378 | f_ohdr.text_start = (long) start_of_text (); | 315 | f_ohdr.text_start = (long) start_of_text (); |
| 379 | f_ohdr.tsize = data_start - f_ohdr.text_start; | 316 | f_ohdr.tsize = data_start - f_ohdr.text_start; |
| 380 | f_ohdr.data_start = data_start; | 317 | f_ohdr.data_start = data_start; |
| 381 | #endif /* NO_REMAP */ | ||
| 382 | f_ohdr.dsize = bss_start - f_ohdr.data_start; | 318 | f_ohdr.dsize = bss_start - f_ohdr.data_start; |
| 383 | f_ohdr.bsize = bss_end - bss_start; | 319 | f_ohdr.bsize = bss_end - bss_start; |
| 384 | /* On some machines, the old values are right. | ||
| 385 | ??? Maybe on all machines with NO_REMAP. */ | ||
| 386 | f_thdr.s_size = f_ohdr.tsize; | 320 | f_thdr.s_size = f_ohdr.tsize; |
| 387 | f_thdr.s_scnptr = sizeof (f_hdr) + sizeof (f_ohdr); | 321 | f_thdr.s_scnptr = sizeof (f_hdr) + sizeof (f_ohdr); |
| 388 | f_thdr.s_scnptr += (f_hdr.f_nscns) * (sizeof (f_thdr)); | 322 | f_thdr.s_scnptr += (f_hdr.f_nscns) * (sizeof (f_thdr)); |
| 389 | lnnoptr = f_thdr.s_lnnoptr; | 323 | lnnoptr = f_thdr.s_lnnoptr; |
| 390 | #ifdef SECTION_ALIGNMENT | ||
| 391 | /* Some systems require special alignment | ||
| 392 | of the sections in the file itself. */ | ||
| 393 | f_thdr.s_scnptr | ||
| 394 | = (f_thdr.s_scnptr + SECTION_ALIGNMENT) & ~SECTION_ALIGNMENT; | ||
| 395 | #endif /* SECTION_ALIGNMENT */ | ||
| 396 | text_scnptr = f_thdr.s_scnptr; | 324 | text_scnptr = f_thdr.s_scnptr; |
| 397 | f_dhdr.s_paddr = f_ohdr.data_start; | 325 | f_dhdr.s_paddr = f_ohdr.data_start; |
| 398 | f_dhdr.s_vaddr = f_ohdr.data_start; | 326 | f_dhdr.s_vaddr = f_ohdr.data_start; |
| 399 | f_dhdr.s_size = f_ohdr.dsize; | 327 | f_dhdr.s_size = f_ohdr.dsize; |
| 400 | f_dhdr.s_scnptr = f_thdr.s_scnptr + f_thdr.s_size; | 328 | f_dhdr.s_scnptr = f_thdr.s_scnptr + f_thdr.s_size; |
| 401 | #ifdef SECTION_ALIGNMENT | ||
| 402 | /* Some systems require special alignment | ||
| 403 | of the sections in the file itself. */ | ||
| 404 | f_dhdr.s_scnptr | ||
| 405 | = (f_dhdr.s_scnptr + SECTION_ALIGNMENT) & ~SECTION_ALIGNMENT; | ||
| 406 | #endif /* SECTION_ALIGNMENT */ | ||
| 407 | #ifdef DATA_SECTION_ALIGNMENT | ||
| 408 | /* Some systems require special alignment | ||
| 409 | of the data section only. */ | ||
| 410 | f_dhdr.s_scnptr | ||
| 411 | = (f_dhdr.s_scnptr + DATA_SECTION_ALIGNMENT) & ~DATA_SECTION_ALIGNMENT; | ||
| 412 | #endif /* DATA_SECTION_ALIGNMENT */ | ||
| 413 | data_scnptr = f_dhdr.s_scnptr; | 329 | data_scnptr = f_dhdr.s_scnptr; |
| 414 | f_bhdr.s_paddr = f_ohdr.data_start + f_ohdr.dsize; | 330 | f_bhdr.s_paddr = f_ohdr.data_start + f_ohdr.dsize; |
| 415 | f_bhdr.s_vaddr = f_ohdr.data_start + f_ohdr.dsize; | 331 | f_bhdr.s_vaddr = f_ohdr.data_start + f_ohdr.dsize; |
| @@ -427,10 +343,6 @@ make_hdr (new, a_out, data_start, bss_start, entry_address, a_name, new_name) | |||
| 427 | f_thdr.s_lnnoptr += bias; | 343 | f_thdr.s_lnnoptr += bias; |
| 428 | } | 344 | } |
| 429 | 345 | ||
| 430 | #ifdef ADJUST_EXEC_HEADER | ||
| 431 | ADJUST_EXEC_HEADER; | ||
| 432 | #endif /* ADJUST_EXEC_HEADER */ | ||
| 433 | |||
| 434 | if (write (new, &f_hdr, sizeof (f_hdr)) != sizeof (f_hdr)) | 346 | if (write (new, &f_hdr, sizeof (f_hdr)) != sizeof (f_hdr)) |
| 435 | { | 347 | { |
| 436 | PERROR (new_name); | 348 | PERROR (new_name); |