This is the mail archive of the binutils@sourceware.cygnus.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Another script for building binutils



There definitely seems to be a problem with -g. Here's a sample program that shows 
the problem:

#include <stdio.h>
#include <io.h>

int main()
{
  int fd = 3;
  short dev_info;

  while (fd <= 20)
  {
    dev_info = _get_dev_info(fd);
    if (dev_info >= 0)
      printf ("%i ", fd);
    ++fd;
  }

  printf ("\n");

  return 0;
}

which generates with -g:
	.file	"main.c"
gcc2_compiled.:
___gnu_compiled_c:
.text
	.def	_va_list;	.scl	13;	.type	021;	.endef
	.def	_size_t;	.scl	13;	.type	017;	.endef
	.def	_.0fake;	.scl	10;	.type	010;	.size	32;	.endef
	.def	__cnt;	.val	0;	.scl	8;	.type	04;	.endef
	.def	__ptr;	.val	4;	.scl	8;	.type	022;	.endef
	.def	__base;	.val	8;	.scl	8;	.type	022;	.endef
	.def	__bufsiz;	.val	12;	.scl	8;	.type	04;	.endef
	.def	__flag;	.val	16;	.scl	8;	.type	04;	.endef
	.def	__file;	.val	20;	.scl	8;	.type	04;	.endef
	.def	__name_to_remove;	.val	24;	.scl	8;	.type	022;	.endef
	.def	__fillsize;	.val	28;	.scl	8;	.type	04;	.endef
	.def	.eos;	.val	32;	.scl	102;	.tag	_.0fake;	.size	32;	.endef
	.def	_FILE;	.scl	13;	.tag	_.0fake;	.size	32;	.type	010;	.endef
	.def	_fpos_t;	.scl	13;	.type	017;	.endef
	.def	_dev_t;	.scl	13;	.type	04;	.endef
	.def	_ino_t;	.scl	13;	.type	04;	.endef
	.def	_mode_t;	.scl	13;	.type	04;	.endef
	.def	_nlink_t;	.scl	13;	.type	04;	.endef
	.def	_gid_t;	.scl	13;	.type	04;	.endef
	.def	_off_t;	.scl	13;	.type	04;	.endef
	.def	_pid_t;	.scl	13;	.type	04;	.endef
	.def	_ssize_t;	.scl	13;	.type	04;	.endef
	.def	_uid_t;	.scl	13;	.type	04;	.endef
	.def	_fd_set;	.scl	10;	.type	010;	.size	32;	.endef
	.def	_fd_bits;	.val	0;	.scl	8;	.dim	32;	.size	32;	.type	074;	.endef
	.def	.eos;	.val	32;	.scl	102;	.tag	_fd_set;	.size	32;	.endef
	.def	_fd_set;	.scl	13;	.tag	_fd_set;	.size	32;	.type	010;	.endef
	.def	_time_t;	.scl	13;	.type	016;	.endef
LC0:
	.ascii "%i \0"
LC1:
	.ascii "\12\0"
	.p2align 2
	.def	_main;	.val	_main;	.scl	2;	.type	044;	.endef
.globl _main
_main:
	.def	.bf;	.val	.;	.scl	101;	.line	5;	.endef
	pushl %ebp
	movl %esp,%ebp
	subl $8,%esp
	.ln	2
	.def	_fd;	.val	-4;	.scl	1;	.type	04;	.endef
	.def	_dev_info;	.val	-6;	.scl	1;	.type	03;	.endef
	movl $3,-4(%ebp)
	.ln	5
	.p2align 2
L2:
	cmpl $20,-4(%ebp)
	jle L4
	jmp L3
	.p2align 2
L4:
	.ln	7
	movl -4(%ebp),%eax
	pushl %eax
	call __get_dev_info
	addl $4,%esp
	movl %eax,%eax
	movw %ax,-6(%ebp)
	.ln	8
	cmpw $0,-6(%ebp)
	jl L5
	.ln	9
	movl -4(%ebp),%eax
	pushl %eax
	pushl $LC0
	call _printf
	addl $8,%esp
L5:
	.ln	10
	incl -4(%ebp)
	.ln	11
	jmp L2
	.p2align 2
L3:
	.ln	13
	pushl $LC1
	call _printf
	addl $4,%esp
	.ln	15
	xorl %eax,%eax
	jmp L1
	.ln	16
	.p2align 2
L1:
	movl %ebp,%esp
	popl %ebp
	ret
	.def	.ef;	.val	.;	.scl	101;	.line	16;	.endef
	.def	_main;	.val	.;	.scl	-1;	.endef

Here's the objdump --debug-syms output for main1.o, generated by the Dec. 98 
snapshot version of as.exe:

main1.o:     file format coff-go32

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 -2)(fl 0x00)(ty  11)(scl  13) (nx 0) 0x00000000 _va_list
[  5](sec -2)(fl 0x00)(ty   f)(scl  13) (nx 0) 0x00000000 _size_t
[  6](sec -2)(fl 0x00)(ty   8)(scl  10) (nx 1) 0x00000000 _.0fake
AUX lnno 0 size 0x20 tagndx 0 endndx 18
[  8](sec -1)(fl 0x00)(ty   4)(scl   8) (nx 0) 0x00000000 __cnt
[  9](sec -1)(fl 0x00)(ty  12)(scl   8) (nx 0) 0x00000004 __ptr
[ 10](sec -1)(fl 0x00)(ty  12)(scl   8) (nx 0) 0x00000008 __base
[ 11](sec -1)(fl 0x00)(ty   4)(scl   8) (nx 0) 0x0000000c __bufsiz
[ 12](sec -1)(fl 0x00)(ty   4)(scl   8) (nx 0) 0x00000010 __flag
[ 13](sec -1)(fl 0x00)(ty   4)(scl   8) (nx 0) 0x00000014 __file
[ 14](sec -1)(fl 0x00)(ty  12)(scl   8) (nx 0) 0x00000018 __name_to_remove
[ 15](sec -1)(fl 0x00)(ty   4)(scl   8) (nx 0) 0x0000001c __fillsize
[ 16](sec -1)(fl 0x00)(ty   0)(scl 102) (nx 1) 0x00000020 .eos
AUX lnno 0 size 0x20 tagndx 6
[ 18](sec -2)(fl 0x00)(ty   8)(scl  13) (nx 1) 0x00000000 _FILE
AUX lnno 0 size 0x20 tagndx 6
[ 20](sec -2)(fl 0x00)(ty   f)(scl  13) (nx 0) 0x00000000 _fpos_t
[ 21](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _dev_t
[ 22](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _ino_t
[ 23](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _mode_t
[ 24](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _nlink_t
[ 25](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _gid_t
[ 26](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _off_t
[ 27](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _pid_t
[ 28](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _ssize_t
[ 29](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _uid_t
[ 30](sec -2)(fl 0x00)(ty   8)(scl  10) (nx 1) 0x00000000 _fd_set
AUX lnno 0 size 0x20 tagndx 0 endndx 36
[ 32](sec -1)(fl 0x00)(ty  3c)(scl   8) (nx 1) 0x00000000 _fd_bits
AUX lnno 0 size 0x20 tagndx 0
[ 34](sec -1)(fl 0x00)(ty   0)(scl 102) (nx 1) 0x00000020 .eos
AUX lnno 0 size 0x20 tagndx 30
[ 36](sec -2)(fl 0x00)(ty   8)(scl  13) (nx 1) 0x00000000 _fd_set
AUX lnno 0 size 0x20 tagndx 30
[ 38](sec -2)(fl 0x00)(ty   e)(scl  13) (nx 0) 0x00000000 _time_t
[ 39](sec  1)(fl 0x00)(ty  24)(scl   2) (nx 1) 0x00000008 _main
AUX lnno 96 size 0x0 tagndx 0 endndx 47
_main :
   2 : 0xe
   5 : 0x15
   7 : 0x20
   8 : 0x32
   9 : 0x39
  10 : 0x4a
  11 : 0x4d
  13 : 0x50
  15 : 0x5d
  16 : 0x61
[ 41](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x00000008 .bf
AUX lnno 5 size 0x0 tagndx 0
[ 43](sec -1)(fl 0x00)(ty   4)(scl   1) (nx 0) 0xfffffffc _fd
[ 44](sec -1)(fl 0x00)(ty   3)(scl   1) (nx 0) 0xfffffffa _dev_info
[ 45](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x00000068 .ef
AUX lnno 16 size 0x0 tagndx 0
[ 47](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .text
AUX scnlen 0x68 nreloc 5 nlnno 11
[ 49](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000068 .data
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 51](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000068 .bss
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 53](sec  0)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 __get_dev_info
[ 54](sec  0)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 _printf


Now here is the objdump --debug-syms output for main21.o, generated by a very recent 
snapshot version of as.exe:

main2.o:     file format coff-go32

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 -2)(fl 0x00)(ty  11)(scl  13) (nx 0) 0x00000000 _va_list
[  5](sec -2)(fl 0x00)(ty   f)(scl  13) (nx 0) 0x00000000 _size_t
[  6](sec -2)(fl 0x00)(ty   8)(scl  10) (nx 1) 0x00000000 _.0fake
AUX lnno 0 size 0x20 tagndx 0 endndx 18
[  8](sec -1)(fl 0x00)(ty   4)(scl   8) (nx 0) 0x00000000 __cnt
[  9](sec -1)(fl 0x00)(ty  12)(scl   8) (nx 0) 0x00000004 __ptr
[ 10](sec -1)(fl 0x00)(ty  12)(scl   8) (nx 0) 0x00000008 __base
[ 11](sec -1)(fl 0x00)(ty   4)(scl   8) (nx 0) 0x0000000c __bufsiz
[ 12](sec -1)(fl 0x00)(ty   4)(scl   8) (nx 0) 0x00000010 __flag
[ 13](sec -1)(fl 0x00)(ty   4)(scl   8) (nx 0) 0x00000014 __file
[ 14](sec -1)(fl 0x00)(ty  12)(scl   8) (nx 0) 0x00000018 __name_to_remove
[ 15](sec -1)(fl 0x00)(ty   4)(scl   8) (nx 0) 0x0000001c __fillsize
[ 16](sec -1)(fl 0x00)(ty   0)(scl 102) (nx 1) 0x00000020 .eos
AUX lnno 0 size 0x20 tagndx 6
[ 18](sec -2)(fl 0x00)(ty   8)(scl  13) (nx 1) 0x00000000 _FILE
AUX lnno 0 size 0x20 tagndx 6
[ 20](sec -2)(fl 0x00)(ty   f)(scl  13) (nx 0) 0x00000000 _fpos_t
[ 21](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _dev_t
[ 22](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _ino_t
[ 23](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _mode_t
[ 24](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _nlink_t
[ 25](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _gid_t
[ 26](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _off_t
[ 27](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _pid_t
[ 28](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _ssize_t
[ 29](sec -2)(fl 0x00)(ty   4)(scl  13) (nx 0) 0x00000000 _uid_t
[ 30](sec -2)(fl 0x00)(ty   8)(scl  10) (nx 1) 0x00000000 _fd_set
AUX lnno 0 size 0x20 tagndx 0 endndx 36
[ 32](sec -1)(fl 0x00)(ty  3c)(scl   8) (nx 1) 0x00000000 _fd_bits
AUX lnno 0 size 0x20 tagndx 0
[ 34](sec -1)(fl 0x00)(ty   0)(scl 102) (nx 1) 0x00000020 .eos
AUX lnno 0 size 0x20 tagndx 30
[ 36](sec -2)(fl 0x00)(ty   8)(scl  13) (nx 1) 0x00000000 _fd_set
AUX lnno 0 size 0x20 tagndx 30
[ 38](sec -2)(fl 0x00)(ty   e)(scl  13) (nx 0) 0x00000000 _time_t
[ 39](sec  1)(fl 0x00)(ty  24)(scl   2) (nx 1) 0x00000008 _main
AUX lnno 96 size 0x0 tagndx 0
_main :
   2 : 0xe
   5 : 0x15
   7 : 0x20
   8 : 0x32
   9 : 0x39
  10 : 0x4a
  11 : 0x4d
  13 : 0x50
  15 : 0x5d
  16 : 0x61
[ 41](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x00000008 .bf
AUX lnno 5 size 0x0 tagndx 0
[ 43](sec -2)(fl 0x00)(ty   4)(scl   1) (nx 0) 0xfffffffc _fd
[ 44](sec -2)(fl 0x00)(ty   3)(scl   1) (nx 0) 0xfffffffa _dev_info
[ 45](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x00000068 .ef
AUX lnno 5 size 0x0 tagndx 0
[ 47](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .text
AUX scnlen 0x68 nreloc 5 nlnno 11
[ 49](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .data
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 51](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .bss
AUX scnlen 0x0 nreloc 0 nlnno 0
[ 53](sec  0)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 __get_dev_info
[ 54](sec  0)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 _printf


and the differences between them:

--- out1.txt	Wed Jul 28 21:05:28 1999
+++ out2.txt	Wed Jul 28 21:05:32 1999
@@ -1,4 +1,4 @@
 
-main1.o:     file format coff-go32
+main2.o:     file format coff-go32
 
 SYMBOL TABLE:
@@ -43,5 +43,5 @@
 [ 38](sec -2)(fl 0x00)(ty   e)(scl  13) (nx 0) 0x00000000 _time_t
 [ 39](sec  1)(fl 0x00)(ty  24)(scl   2) (nx 1) 0x00000008 _main
-AUX lnno 96 size 0x0 tagndx 0 endndx 47
+AUX lnno 96 size 0x0 tagndx 0
 _main :
    2 : 0xe
@@ -57,13 +57,13 @@
 [ 41](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x00000008 .bf
 AUX lnno 5 size 0x0 tagndx 0
-[ 43](sec -1)(fl 0x00)(ty   4)(scl   1) (nx 0) 0xfffffffc _fd
-[ 44](sec -1)(fl 0x00)(ty   3)(scl   1) (nx 0) 0xfffffffa _dev_info
+[ 43](sec -2)(fl 0x00)(ty   4)(scl   1) (nx 0) 0xfffffffc _fd
+[ 44](sec -2)(fl 0x00)(ty   3)(scl   1) (nx 0) 0xfffffffa _dev_info
 [ 45](sec  1)(fl 0x00)(ty   0)(scl 101) (nx 1) 0x00000068 .ef
-AUX lnno 16 size 0x0 tagndx 0
+AUX lnno 5 size 0x0 tagndx 0
 [ 47](sec  1)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .text
 AUX scnlen 0x68 nreloc 5 nlnno 11
-[ 49](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000068 .data
+[ 49](sec  2)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .data
 AUX scnlen 0x0 nreloc 0 nlnno 0
-[ 51](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000068 .bss
+[ 51](sec  3)(fl 0x00)(ty   0)(scl   3) (nx 1) 0x00000000 .bss
 AUX scnlen 0x0 nreloc 0 nlnno 0
 [ 53](sec  0)(fl 0x00)(ty   0)(scl   2) (nx 0) 0x00000000 __get_dev_info

Is this enough to get started? If you need more, let me know.


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]