delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/07/29/15:02:50

Message-Id: <199907291319.NAA11236@out2.ibm.net>
From: "Mark E." <snowball3 AT bigfoot DOT com>
To: djgpp-workers AT delorie DOT com, binutils AT sourceware DOT cygnus DOT com
Date: Thu, 29 Jul 1999 09:19:31 -0400
MIME-Version: 1.0
Subject: Re: Another script for building binutils
In-reply-to: <19990729020624.1145.qmail@daffy.airs.com>
References: <199907290027 DOT AAA82496 AT out5 DOT ibm DOT net> (snowball3 AT bigfoot DOT com)
X-mailer: Pegasus Mail for Win32 (v3.11)
Reply-To: djgpp-workers AT delorie DOT com
X-Mailing-List: djgpp-workers AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> Run objdump -xs on both files, and see what changed.
> 

I have the results with objdump --xs. First, my sample C program:

int fox(int x)
{
  return x + 1;
}

int main()
{
  fox(1);
  fox(2);
  fox(3);

  return 0;
}

Here is main.s compiled with 'gcc -g main.c':

	.file	"main.c"
gcc2_compiled.:
___gnu_compiled_c:
.text
	.p2align 2
	.def	_fox;	.val	_fox;	.scl	2;	.type	044;	.endef
.globl _fox
_fox:
	.def	.bf;	.val	.;	.scl	101;	.line	2;	.endef
	.def	_x;	.val	8;	.scl	9;	.type	04;	.endef
	pushl %ebp
	movl %esp,%ebp
	.ln	2
	movl 8(%ebp),%edx
	incl %edx
	movl %edx,%eax
	jmp L1
	.ln	3
	.p2align 2
L1:
	movl %ebp,%esp
	popl %ebp
	ret
	.def	.ef;	.val	.;	.scl	101;	.line	3;	.endef
	.def	_fox;	.val	.;	.scl	-1;	.endef
	.p2align 2
	.def	_main;	.val	_main;	.scl	2;	.type	044;	.endef
.globl _main
_main:
	.def	.bf;	.val	.;	.scl	101;	.line	7;	.endef
	pushl %ebp
	movl %esp,%ebp
	.ln	2
	pushl $1
	call _fox
	addl $4,%esp
	.ln	3
	pushl $2
	call _fox
	addl $4,%esp
	.ln	4
	pushl $3
	call _fox
	addl $4,%esp
	.ln	6
	xorl %eax,%eax
	jmp L2
	.ln	7
	.p2align 2
L2:
	movl %ebp,%esp
	popl %ebp
	ret
	.def	.ef;	.val	.;	.scl	101;	.line	7;	.endef
	.def	_main;	.val	.;	.scl	-1;	.endef

Now here is the difference between the two objdumps. The most substantial 
differences appear to at [4] and [11].

--- out1.txt	Thu Jul 29 09:10:16 1999
+++ out2.txt	Thu Jul 29 09:10:20 1999
@@ -1,17 +1,17 @@
 
-main.o:     file format coff-go32
-main.o
-architecture: i386, flags 0x00000035:
-HAS_RELOC, HAS_LINENO, HAS_SYMS, HAS_LOCALS
+main2.o:     file format coff-go32
+main2.o
+architecture: i386, flags 0x00000034:
+HAS_LINENO, HAS_SYMS, HAS_LOCALS
 start address 0x00000000
 
 Sections:
 Idx Name          Size      VMA       LMA       File off  Algn
   0 .text         0000003c  00000000  00000000  0000008c  2**2
                   CONTENTS, ALLOC, LOAD, CODE
-  1 .data         00000000  0000003c  0000003c  00000000  2**2
+  1 .data         00000000  00000000  00000000  00000000  2**2
                   ALLOC, LOAD, DATA
-  2 .bss          00000000  0000003c  0000003c  00000000  2**2
+  2 .bss          00000000  00000000  00000000  00000000  2**2
                   ALLOC
 SYMBOL TABLE:
 [  0](sec -2)(fl 0x00)(ty   0)(scl 103) (nx 1) 0x00000000 main.c
@@ -19,17 +19,17 @@
 [  2](sec  1)(fl 0x00)(ty   0)(scl   6) (nx 0) 0x00000000 gcc2_compiled.
 [  3](sec  1)(fl 0x00)(ty   0)(scl   6) (nx 0) 0x00000000 ___gnu_compiled_c
 [  4](sec  1)(fl 0x00)(ty  24)(scl   2) (nx 1) 0x00000000 _fox
-AUX lnno 16 size 0x0 tagndx 0 endndx 11
+AUX lnno 16 size 0x0 tagndx 0
 _fox :
    2 : 0x3
    3 : 0xb
 [  6](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x00000000 .bf
 AUX lnno 2 size 0x0 tagndx 0 endndx 13
-[  8](sec -1)(fl 0x00)(ty   4)(scl   9) (nx 0) 0x00000008 _x
+[  8](sec -2)(fl 0x00)(ty   4)(scl   9) (nx 0) 0x00000008 _x
 [  9](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x00000010 .ef
-AUX lnno 3 size 0x0 tagndx 0
+AUX lnno 2 size 0x0 tagndx 0
 [ 11](sec  1)(fl 0x00)(ty  24)(scl   2) (nx 1) 0x00000010 _main
-AUX lnno 44 size 0x0 tagndx 0 endndx 17
+AUX lnno 44 size 0x0 tagndx 0
 _main :
    2 : 0x13
    3 : 0x1d
@@ -42,9 +42,9 @@
 AUX lnno 7 size 0x0 tagndx 0
 [ 17](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .text
 AUX scnlen 0x3c nreloc 0 nlnno 9
-[ 19](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x0000003c .data
+[ 19](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .data
 AUX scnlen 0x0 nreloc 0 nlnno 0
-[ 21](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x0000003c .bss
+[ 21](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .bss
 AUX scnlen 0x0 nreloc 0 nlnno 0
 
 
Here's the two objdumps:

First the older one...

main.o:     file format coff-go32
main.o
architecture: i386, flags 0x00000035:
HAS_RELOC, HAS_LINENO, HAS_SYMS, HAS_LOCALS
start address 0x00000000

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         0000003c  00000000  00000000  0000008c  2**2
                  CONTENTS, ALLOC, LOAD, CODE
  1 .data         00000000  0000003c  0000003c  00000000  2**2
                  ALLOC, LOAD, DATA
  2 .bss          00000000  0000003c  0000003c  00000000  2**2
                  ALLOC
SYMBOL TABLE:
[  0](sec -2)(fl 0x00)(ty   0)(scl 103) (nx 1) 0x00000000 main.c
File 
[  2](sec  1)(fl 0x00)(ty   0)(scl   6) (nx 0) 0x00000000 gcc2_compiled.
[  3](sec  1)(fl 0x00)(ty   0)(scl   6) (nx 0) 0x00000000 ___gnu_compiled_c
[  4](sec  1)(fl 0x00)(ty  24)(scl   2) (nx 1) 0x00000000 _fox
AUX lnno 16 size 0x0 tagndx 0 endndx 11
_fox :
   2 : 0x3
   3 : 0xb
[  6](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x00000000 .bf
AUX lnno 2 size 0x0 tagndx 0 endndx 13
[  8](sec -1)(fl 0x00)(ty   4)(scl   9) (nx 0) 0x00000008 _x
[  9](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x00000010 .ef
AUX lnno 3 size 0x0 tagndx 0
[ 11](sec  1)(fl 0x00)(ty  24)(scl   2) (nx 1) 0x00000010 _main
AUX lnno 44 size 0x0 tagndx 0 endndx 17
_main :
   2 : 0x13
   3 : 0x1d
   4 : 0x27
   6 : 0x31
   7 : 0x35
[ 13](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x00000010 .bf
AUX lnno 7 size 0x0 tagndx 0
[ 15](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x0000003c .ef
AUX lnno 7 size 0x0 tagndx 0
[ 17](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .text
AUX scnlen 0x3c nreloc 0 nlnno 9
[ 19](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x0000003c .data
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 21](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x0000003c .bss
AUX scnlen 0x0 nreloc 0 nlnno 0


Contents of section .text:
 0000 5589e58b 55084289 d0eb0190 89ec5dc3  U...U.B.......].
 0010 5589e56a 01e8e6ff ffff83c4 046a02e8  U..j.........j..
 0020 dcffffff 83c4046a 03e8d2ff ffff83c4  .......j........
 0030 0431c0eb 038d7600 89ec5dc3           .1....v...].    

and the newer one which causes problems...

main2.o:     file format coff-go32
main2.o
architecture: i386, flags 0x00000034:
HAS_LINENO, HAS_SYMS, HAS_LOCALS
start address 0x00000000

Sections:
Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         0000003c  00000000  00000000  0000008c  2**2
                  CONTENTS, ALLOC, LOAD, CODE
  1 .data         00000000  00000000  00000000  00000000  2**2
                  ALLOC, LOAD, DATA
  2 .bss          00000000  00000000  00000000  00000000  2**2
                  ALLOC
SYMBOL TABLE:
[  0](sec -2)(fl 0x00)(ty   0)(scl 103) (nx 1) 0x00000000 main.c
File 
[  2](sec  1)(fl 0x00)(ty   0)(scl   6) (nx 0) 0x00000000 gcc2_compiled.
[  3](sec  1)(fl 0x00)(ty   0)(scl   6) (nx 0) 0x00000000 ___gnu_compiled_c
[  4](sec  1)(fl 0x00)(ty  24)(scl   2) (nx 1) 0x00000000 _fox
AUX lnno 16 size 0x0 tagndx 0
_fox :
   2 : 0x3
   3 : 0xb
[  6](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x00000000 .bf
AUX lnno 2 size 0x0 tagndx 0 endndx 13
[  8](sec -2)(fl 0x00)(ty   4)(scl   9) (nx 0) 0x00000008 _x
[  9](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x00000010 .ef
AUX lnno 2 size 0x0 tagndx 0
[ 11](sec  1)(fl 0x00)(ty  24)(scl   2) (nx 1) 0x00000010 _main
AUX lnno 44 size 0x0 tagndx 0
_main :
   2 : 0x13
   3 : 0x1d
   4 : 0x27
   6 : 0x31
   7 : 0x35
[ 13](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x00000010 .bf
AUX lnno 7 size 0x0 tagndx 0
[ 15](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x0000003c .ef
AUX lnno 7 size 0x0 tagndx 0
[ 17](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .text
AUX scnlen 0x3c nreloc 0 nlnno 9
[ 19](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .data
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 21](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .bss
AUX scnlen 0x0 nreloc 0 nlnno 0


Contents of section .text:
 0000 5589e58b 55084289 d0eb0190 89ec5dc3  U...U.B.......].
 0010 5589e56a 01e8e6ff ffff83c4 046a02e8  U..j.........j..
 0020 dcffffff 83c4046a 03e8d2ff ffff83c4  .......j........
 0030 0431c0eb 038d7600 89ec5dc3           .1....v...].    

--- 
Mark Elbrecht, snowball3 AT bigfoot DOT com
http://snowball.frogspace.net/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019