public inbox for gas2@sourceware.org
 help / color / mirror / Atom feed
* problem with ld (i386-coff) leaving holes in the executable ...
@ 1994-08-07 10:59 Minh Tran-Le
  1994-08-08  7:59 ` Ian Lance Taylor
  0 siblings, 1 reply; 6+ messages in thread
From: Minh Tran-Le @ 1994-08-07 10:59 UTC (permalink / raw)
  To: gas2

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 ?

Here is a testcase and output of dump using the old ld and the new ld.

=====================
1 mtranle@paris> cat foo.c
#include <stdio.h>
main()
{ printf("hi\n"); }

/* foo.good has been linked using GNU ld of may-31 */

2 mtranle@paris> dump -h foo.good


			***SECTION HEADER***
	Name        Paddr       Vaddr       Scnptr      Relptr     Lnnoptr
	            Flags                    Size       Nreloc      Nlnno

foo.good:
	.text     0x00000120  0x00000120  0x00000120  0x00000000  0x0000f80c
	          0x00000020              0x00009628        0           2

                                     /* 0x120 + 0x9628  => 0x9748 */

	.data     0x00400748  0x00400748  0x00009748  0x00000000  0x00000000
	          0x00000040              0x0000609c        0           0

                                     /* 0x9748 + 0x609c => 0xf7e4 */

	.bss      0x004067e4  0x004067e4  0x00000000  0x00000000  0x00000000
	          0x00000080              0x000027a4        0           0

	.stab     0x00408f88  0x00408f88  0x00000000  0x00000000  0x00000000
	          0x00000200              0x00000000        0           0

	.stabstr  0x00408f88  0x00408f88  0x00000000  0x00000000  0x00000000
	          0x00000200              0x00000000        0           0

                                      /* .comment section scnptr 0xf7e4 */

	.comment  0x00000000  0x00000000  0x0000f7e4  0x00000000  0x00000000
	          0x00000200              0x00000028        0           0

/* foo.bad has been linked using the latest GNU ld and
   scnptr + scnsize does not match the scnptr of the next section */

3 mtranle@paris> dump -h foo.bad


			***SECTION HEADER***
	Name        Paddr       Vaddr       Scnptr      Relptr     Lnnoptr
	            Flags                    Size       Nreloc      Nlnno

foo.bad:
	.text     0x000000d0  0x000000d0  0x000000d0  0x00000000  0x0000ff60
	          0x00000020              0x00009628        0           2

					/* 0xd0 + 0x9628 => 0x96f8 */

	.data     0x004006f8  0x004006f8  0x000096f8  0x00000000  0x00000000
	          0x00000040              0x0000609c        0           0

					/* 0x96f8 + 0x609c => 0xf794 */

	.bss      0x00406794  0x00406794  0x00000000  0x00000000  0x00000000
	          0x00000080              0x000027a4        0           0

					/* 0xf794 does not match .comment
					   scnptr. There is a gap between
					   end of .data and beginning of
					   .comment */

	.comment  0x00408f38  0x00408f38  0x0000ff38  0x00000000  0x00000000
	          0x00000200              0x00000028        0           0

4 mtranle@paris> exit
=================

Thanks,
Minh Tran-Le.
-------


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~1994-08-10 10:03 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1994-08-07 10:59 problem with ld (i386-coff) leaving holes in the executable Minh Tran-Le
1994-08-08  7:59 ` Ian Lance Taylor
1994-08-08 20:11   ` problem with ld (i386-coff) leaving holes in the Minh Tran-Le
1994-08-09  6:58     ` Ian Lance Taylor
1994-08-09 14:11       ` Minh Tran-Le
1994-08-10 10:03         ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).