From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ian Lance Taylor To: tranle@intellicorp.com Cc: gas2@cygnus.com Subject: Re: problem with ld (i386-coff) leaving holes in the executable ... Date: Mon, 08 Aug 1994 07:59:00 -0000 Message-id: <199408081459.KAA01744@sanguine.cygnus.com> References: <199408071759.KAA13172@cygnus.com> X-SW-Source: 1994/msg00060.html Date: Sun, 7 Aug 94 10:57:26 PDT From: Minh Tran-Le The latest GNU ld does not produce an executable with a consistent image header. If you take each section and add up its scnptr+scnsize it does not always match the scnptr of the next section with content. And this seems to confuse Emacs unexec which end up dumping the wrong content for the .lib section. Does anybody knows why the new ld leave holes in the executable ? 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