www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2001/06/16/08:07:56

Date: Sat, 16 Jun 2001 14:52:01 +0300 (WET)
From: Andris Pavenis <pavenis AT lanet DOT lv>
To: Eli Zaretskii <eliz AT is DOT elta DOT co DOT il>
Cc: Chris Wilkinson <chrisw AT wam DOT umd DOT edu>, djgpp AT delorie DOT com
Subject: Re: Link errors with Debug switch on
In-Reply-To: <8011-Sat16Jun2001104817+0300-eliz@is.elta.co.il>
Message-ID: <Pine.A41.4.05.10106161439240.106024-100000@ieva06.lanet.lv>
MIME-Version: 1.0
Reply-To: djgpp AT delorie DOT com
Errors-To: nobody AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com


On Sat, 16 Jun 2001, Eli Zaretskii wrote:

> > From: "Chris Wilkinson" <chrisw AT wam DOT umd DOT edu>
> > Newsgroups: comp.os.msdos.djgpp
> > Date: Fri, 15 Jun 2001 16:12:26 -0400
> > > >
> > > What I'm looking for is to see whether ipmpar.o lists the function
> > > ipmpar (symbol name "_ipmpar") with `T'.
> > 
> > Here is the output from nm -A ipmpar.o. No -g switch.
> > C:\FFOP\src\OneUnit>nm -A ipmpar.o
> > ipmpar.o:000000a0 b .bss
> > ipmpar.o:000000a0 d .data
> > ipmpar.o:00000000 t .text
> > ipmpar.o:00000000 t ___gnu_compiled_c
> > ipmpar.o:000000a0 b _imach.3
> > ipmpar.o:00000000 T _ipmpar
> > ipmpar.o:000000cc b _ipmpar.4
> > ipmpar.o:00000000 t gcc2_compiled.
> > 
> > and here with the -g switch
> > C:\FFOP\src\OneUnit>nm -A ipmpar.o
> > ipmpar.o:00000000 t .bf
> > ipmpar.o:000000a0 b .bss
> > ipmpar.o:000000a0 d .data
> > ipmpar.o:00000094 t .ef
> > ipmpar.o:00000000 t .text
> > ipmpar.o:00000000 t ___gnu_compiled_c
> > ipmpar.o:000000a0 b _imach
> > ipmpar.o:000000a0 b _imach.3
> > ipmpar.o:00000000 t _ipmpar
> > ipmpar.o:000000cc b _ipmpar.4
> > ipmpar.o:00000000 t gcc2_compiled.
> > 
> > The difference seems to be that _ipmpar is marked with a 'T' in the first
> > case (no -g) and 't' in the second case (-g).
> 
> Unbelievable: this is a blatant compiler bug.  So blatant that I never
> considered the possibility even though it was staring at me since you
> posted the source of ipmpar.c.
> 
> Andris, could you please see if this problem is fixed in the latest
> version of GCC 3.0?
> 

Here is what I'm getting under Linux with Linux to DJGPP cross-compiler
(haven't booted Win98SE today ...):

andris AT hal:~$ i586-pc-msdosdjgpp-gcc -v
Reading specs from /disk2/gcctest/lib/gcc-lib/i586-pc-msdosdjgpp/3.0/specs
Configured with: ../gcc/configure --build=i586-pc-linux-gnu
--host=i586-pc-linux-gnu --target=i586-pc-msdosdjgpp
--with-as=/disk2/gcctest/bin/i586-pc-msdosdjgpp-as
--with-ld=/disk2/gcctest/bin/i586-pc-msdosdjgpp-ld --disable-nls
--prefix=/disk2/gcctest
--with-headers=/disk2/gcctest/i586-pc-msdosdjgpp/sys-include
--enable-languages=c,c++,f77,objc --enable-version-specific-runtime-libs
Thread model: single
gcc version 3.0 20010611 (prerelease)

andris AT hal:~$ i586-pc-msdosdjgpp-as --version
GNU assembler 2.11
Copyright 2001 Free Software Foundation, Inc.
This program is free software; you may redistribute it under the terms of
the GNU General Public License.  This program has absolutely no warranty.
This assembler was configured for a target of `i586-pc-msdosdjgpp'.

andris AT hal:~$ i586-pc-msdosdjgpp-gcc -c impar.c
andris AT hal:~$ i586-pc-msdosdjgpp-nm impar.o 
00000090 b .bss
000000d0 ? .comment
00000090 d .data
00000000 t .text
00000090 b _imach.0
00000000 T _ipmpar
000000c0 b _ipmpar.1
andris AT hal:~$ i586-pc-msdosdjgpp-gcc -c -gcoff impar.c
andris AT hal:~$ i586-pc-msdosdjgpp-nm impar.o 
00000000 t .bf
00000090 b .bss
000000d0 ? .comment
00000090 d .data
00000081 t .ef
00000000 t .text
00000090 b _imach
00000090 b _imach.0
00000000 t _ipmpar
000000c0 b _ipmpar.1
andris AT hal:~$ i586-pc-msdosdjgpp-gcc -c -gstabs impar.c
andris AT hal:~$ i586-pc-msdosdjgpp-nm impar.o 
00000090 b .bss
000006f1 ? .comment
00000090 d .data
000000d0 ? .stab
00000310 ? .stabstr
00000000 t .text
00000090 b _imach.0
00000000 T _ipmpar
000000c0 b _ipmpar.1


'? .comment' is caused by problems in binutils (only stuff that suffers
from that is dxegen AFAIK)

However comparing assembler outputs with -gcoff and without it it seems
that a bug could be in GNU assembler but not in GCC. One can try different
binutils versions (beginning from 2.8.1 or 2.9.1)


--- impar-nodebug.s     Sat Jun 16 14:56:53 2001
+++ impar-gcoff.s       Sat Jun 16 14:56:43 2001
@@ -3,26 +3,46 @@
 .lcomm _ipmpar.1,16
        .section .text
        .p2align 4
+       .def    _ipmpar;        .val    _ipmpar;        .scl    2;
.type   044;    .endef
 .globl _ipmpar
 _ipmpar:
+       .def    .bf;    .val    .;      .scl    101;    .line   69;
.endef
+       .def    _i;     .val    8;      .scl    9;      .type   024;
.endef
+       .def    _imach; .val    _imach.0;       .scl    3;      .dim
11;     .size   44;     .type   064;    .endef
+       .def    _ipmpar;        .val    _ipmpar.1;      .scl    3;
.type   04;     .endef
        pushl   %ebp
        movl    %esp, %ebp
+       .ln     210
        movl    $2, _imach.0+4
+       .ln     211
        movl    $31, _imach.0+8
+       .ln     212
        movl    $2147483647, _imach.0+12
+       .ln     213
        movl    $2, _imach.0+16
+       .ln     214
        movl    $24, _imach.0+20
+       .ln     215
        movl    $-125, _imach.0+24
+       .ln     216
        movl    $128, _imach.0+28
+       .ln     217
        movl    $53, _imach.0+32
+       .ln     218
        movl    $-1021, _imach.0+36
+       .ln     219
        movl    $1024, _imach.0+40
+       .ln     356
        movl    8(%ebp), %eax
        movl    (%eax), %eax
        sall    $2, %eax
        movl    _imach.0(%eax), %eax
        movl    %eax, _ipmpar.1
+       .ln     357
        movl    _ipmpar.1, %eax
+       .ln     358
        popl    %ebp
        ret
+       .def    .ef;    .val    .;      .scl    101;    .line   358;
.endef
+       .def    _ipmpar;        .val    .;      .scl    -1;     .endef
        .ident  "GCC: (GNU) 3.0 20010611 (prerelease)"



Andris

- Raw text -


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