From mboxrd@z Thu Jan 1 00:00:00 1970 From: Minh Tran-Le To: ian@cygnus.com Cc: gas2@cygnus.com Subject: Re: problem with ld (i386-coff) leaving holes in the Date: Mon, 08 Aug 1994 20:11:00 -0000 Message-id: <199408090249.AA13574@bridge2.NSD.3Com.COM> References: <199408081459.KAA01744@sanguine.cygnus.com> X-SW-Source: 1994/msg00061.html Ian Lance Taylor wrote: | |This was done because on a demand paged system, the file position of a |section must match the page position within the executable file, |modulo the page size. Forcing this alignment permits sections to be |removed from the middle of the file, which is desirable when the |debugging information is stored in a separate COFF section, as it is |for stabs debugging information. | |However, this alignment is only required for sections which are |allocated in memory. Could you please try this patch, and see if it |fixes the problem? | |Ian | |*** coffcode.h.~15~ Wed Aug 3 10:22:07 1994 |--- coffcode.h Mon Aug 8 10:48:52 1994 |*************** coff_compute_section_file_positions (abf |*** 1378,1384 **** | #ifdef COFF_PAGE_SIZE | /* In demand paged files the low order bits of the file offset | must match the low order bits of the virtual address. */ |! if ((abfd->flags & D_PAGED) != 0) | sofar += (current->vma - sofar) % COFF_PAGE_SIZE; | #endif | |--- 1378,1385 ---- | #ifdef COFF_PAGE_SIZE | /* In demand paged files the low order bits of the file offset | must match the low order bits of the virtual address. */ |! if ((abfd->flags & D_PAGED) != 0 |! && (current->flags & SEC_ALLOC) != 0) | sofar += (current->vma - sofar) % COFF_PAGE_SIZE; | #endif | This patch seems to work fine for me on small executable but on emacs it still fail and still try to page align the `.comment' section. I made ld printout the section name and flags in the case it wants to page align it. section .text: flags 0x237 section .data: flags 0x247 section .comment: flags 0x10203 section .lib: flags 0x203 == output of: dump -h temacs == ***SECTION HEADER*** Name Paddr Vaddr Scnptr Relptr Lnnoptr Flags Size Nreloc Nlnno temacs: .text 0x00000148 0x00000148 0x00000148 0x00000000 0x0014e2a8 0x00000020 0x000e731c 0 2 .data 0x00400464 0x00400464 0x000e7464 0x00000000 0x00000000 0x00000040 0x00047bc4 0 0 .bss 0x00448028 0x00448028 0x00000000 0x00000000 0x00000000 0x00000080 0x00025ff8 0 0 /* page aligned here */ .comment 0x0046e020 0x0046e020 0x00130020 0x00000000 0x00000000 0x00000200 0x0001e270 0 0 .fkd800 0xd8000000 0xd8000000 0x00000000 0x00000000 0x00000000 0x00000022 0x0003a858 0 0 .lib 0x00000001 0x00000000 0x0014e290 0x00000000 0x00000000 0x00000800 0x00000018 0 0 .fkdc00 0xdc000000 0xdc000000 0x00000000 0x00000000 0x00000000 0x00000042 0x0000f28c 0 0 I have tried to comment out the code that was doing the page align and it cure the problem with emacs unexec without any adverse effect. Does all standard COFF linker do this page align thing ? Does emacs unexec work fine with them ? Thanks, Minh Tran-Le. -------