X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f X-Received: by 10.224.86.200 with SMTP id t8mr9977084qal.0.1370969323508; Tue, 11 Jun 2013 09:48:43 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.49.3.37 with SMTP id 5mr626466qez.30.1370969323395; Tue, 11 Jun 2013 09:48:43 -0700 (PDT) Newsgroups: comp.os.msdos.djgpp Date: Tue, 11 Jun 2013 09:48:43 -0700 (PDT) Complaints-To: groups-abuse AT google DOT com Injection-Info: o8g2000yqa.googlegroups.com; posting-host=95.208.11.171; posting-account=OsAajgoAAADdKJnkJkmhzqP0jo6I_P_0 NNTP-Posting-Host: 95.208.11.171 References: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; Linux x86_64; rv:16.0) Gecko/20100101 Firefox/16.0,gzip(gfe) Message-ID: <5868dad2-7c06-4436-b516-d5025e8c8b0d@o8g2000yqa.googlegroups.com> Subject: Re: Incorrect compilation From: Juan Manuel Guerrero Injection-Date: Tue, 11 Jun 2013 16:48:43 +0000 Content-Type: text/plain; charset=ISO-8859-1 Bytes: 8495 Lines: 181 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id r5BH02ll009398 Reply-To: djgpp AT delorie DOT com On 11 Jun., 10:50, Vasya Pupkin wrote: > I am trying to compile Watt-32 for DJGPP 2.04. > Source code was downloaded from:http://home.broadpark.no/~gvanem/ > Compilation was made according to the instruction in the "install" file. > And in the end, I have a strange problem. > Library Watt-32 contains file "pcpkt.c". > This file contains function "pkt_release". > There is it's source code: > > /** >  * Release the pkt-driver. >  * >  * Might be called from exception/signal handler. >  * To make sure the driver is released, use a destructor in addition >  * to rundown function and sock_exit(). This will be called even if >  * _exit() is called. >  */ > #ifdef __WATCOMC__ > #pragma aux pkt_release loadds; > #endif > > #ifdef __GNUC__ > #define DTOR __attribute__((destructor)) > #else > #define DTOR > #endif > > int DTOR pkt_release (void) > { >   DISABLE(); > >   if (_pkt_inf) >   { >     /* Don't do this by default. It may cause some (RealTek) >      * packet-drivers to fail all further upcalls. >      */ >     if (pkt_do_reset) >        pkt_reset_handle (_pkt_inf->handle); >     pkt_release_handle (_pkt_inf->handle); >   } > > /* !! pkt_interrupt = 0; */ > >   /** >    * \todo We might be called between 1st and 2nd packet-driver >    *       upcall. Need to wait for 2nd upcall to finish or else >    *       freeing the RMCB too early could cause a crash or a >    *       stuck PKTDRVR. >    */ > > #if (DOSX) && !defined(USE_FAST_PKT) >   unlock_code_and_data(); /* unlock before freeing */ >   release_callback(); > #endif > > #if (DOSX) && defined(USE_FAST_PKT) >   release_real_mem(); > #endif > >   if (_pkt_inf && !_watt_fatal_error) >      free (_pkt_inf); > >   _pkt_inf = NULL;  /* drop anything still in the queue */ > >   ENABLE(); >   return (1); > > } > > Macroses DISABLE() and ENABLE() are defined as > >     #define ENABLE()      __asm__ __volatile__ ("sti") >     #define DISABLE()     __asm__ __volatile__ ("cli") > > Compilation command: > gcc -O2 -g -gcoff -I. -I../inc -W -Wall -fno-strength-reduce -ffast-math  -o djgpp/pcpkt.o -c pcpkt.c > > After compiling in the object file "pcpkt.o" in place of this procedure is a completely meaningless code. > Here is the result of disassembling this procedure after compilation (made by IDA): > > .text:00000D15                ; _______________ S U B R O U T I N E _______________________________________ > .text:00000D15 > .text:00000D15 > .text:00000D15                                public _pkt_release > .text:00000D15                _pkt_release    proc near               ; CODE XREF: _pkt_eth_init+691 p > .text:00000D15                                                        ; _pkt_eth_init+8E9 p > .text:00000D15                                                        ; DATA XREF: ... > .text:00000D15 70 6B                          jo      short near ptr loc_0_D7E+4 > .text:00000D17 74 5F                          jz      short near ptr loc_0_D77+1 > .text:00000D19 73 65                          jnb     short near ptr loc_0_D7E+2 > .text:00000D1B 6E                             outsb > .text:00000D1C 64 00 74 78 20                 add     fs:[eax+edi*2+20h], dh > .text:00000D21 3D 3D 20 70 6B                 cmp     eax, 6B70203Dh > .text:00000D26 74 5F                          jz      short loc_0_D87 > .text:00000D28 74 78                          jz      short near ptr loc_0_DA1+1 > .text:00000D2A 5F                             pop     edi > .text:00000D2B 62 75 66                       bound   esi, [ebp+66h] > .text:00000D2E 28 29                          sub     [ecx], ch > .text:00000D30 00 8D 76 00 41+                add     [ebp+73410076h], cl > .text:00000D36 79 6E                          jns     short loc_0_DA6 > .text:00000D38 63 20                          arpl    [eax], sp > .text:00000D3A 54                             push    esp > .text:00000D3B 78 20                          js      short loc_0_D5D > .text:00000D3D 66 61                          popaw > .text:00000D3F 69 6C 65 64 2E+                imul    ebp, [ebp+64h], 6552202Eh > .text:00000D47 74 72                          jz      short loc_0_DBB > .text:00000D49 79 69                          jns     short near ptr loc_0_DB3+1 > .text:00000D4B 6E                             outsb > .text:00000D4C 67 20 69 6E                    and     [bx+di+6Eh], ch > .text:00000D50 20 73 79                       and     [ebx+79h], dh > .text:00000D53 6E                             outsb > .text:00000D54 63 20                          arpl    [eax], sp > .text:00000D56 6D                             ins     dword ptr es:[edi], dx > .text:00000D57 6F                             outsd > .text:00000D58                                db      64h, 65h > .text:00000D58 64 65 2E 0A 00                 or      al, cs:[eax] > .text:00000D5D > .text:00000D5D                loc_0_D5D:                              ; CODE XREF: _pkt_release+26 j > .text:00000D5D 8D 76 00                       lea     esi, [esi+0] > .text:00000D5D                _pkt_release    endp > > Can someone explain the reason of this phenomenon and specify ways of its elimination? I do not know what is wrong there. But it is known that the original sources of the Watt-32 library as downloaded from http://home.broadpark.no/~gvanem/ no longer compiles with djgpp. If you really need the library download the version compiled with DJGPP 2.04 as: ftp://ftp.delorie.com/pub/djgpp/beta/v2tk/wat3222b.zip and the sources: ftp://ftp.delorie.com/pub/djgpp/current/v2tk/wat3222s.zip if you really need the sources. For more information please read the announcement: http://www.delorie.com/archives/browse.cgi?p=djgpp-announce/2013/01/13/14:23:40 Regards, Juan M. Guerrero